Revision 37670
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.gvsig.symbology</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
</buildSpec> |
|
9 |
<natures> |
|
10 |
</natures> |
|
11 |
</projectDescription> |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/prepare-workspace.xml | ||
---|---|---|
1 |
<project name="org.gvsig.initial.build" default="prepare-workspace"> |
|
2 |
|
|
3 |
<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" /> |
|
4 |
|
|
5 |
<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." /> |
|
6 |
<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" /> |
|
7 |
<property name="build.jar.version" value="1.0.8-SNAPSHOT" /> |
|
8 |
<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" /> |
|
9 |
|
|
10 |
<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" /> |
|
11 |
|
|
12 |
<target name="check-maven-base-build-available"> |
|
13 |
<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" /> |
|
14 |
</target> |
|
15 |
|
|
16 |
<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available"> |
|
17 |
<!-- Unzip de build jar file from the maven repository into the workspace root folder --> |
|
18 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
19 |
<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"> |
|
20 |
<patternset> |
|
21 |
<exclude name="META-INF/**" /> |
|
22 |
</patternset> |
|
23 |
</zipfileset> |
|
24 |
</copy> |
|
25 |
</target> |
|
26 |
|
|
27 |
<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available"> |
|
28 |
<mkdir dir="target" /> |
|
29 |
|
|
30 |
<!-- Download the build jar file --> |
|
31 |
<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" /> |
|
32 |
|
|
33 |
<!-- Unzip de build jar file into the workspace root folder --> |
|
34 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
35 |
<zipfileset src="target/${build.jar.file}"> |
|
36 |
<patternset> |
|
37 |
<exclude name="META-INF/**" /> |
|
38 |
</patternset> |
|
39 |
</zipfileset> |
|
40 |
</copy> |
|
41 |
|
|
42 |
</target> |
|
43 |
|
|
44 |
<target name="find.depends.natives.file"> |
|
45 |
<condition property="depends.natives.file.exists"> |
|
46 |
<available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/> |
|
47 |
</condition> |
|
48 |
</target> |
|
49 |
|
|
50 |
<target name="find.gvsig.platform.properties.file" |
|
51 |
depends="find.depends.natives.file" |
|
52 |
if="depends.natives.file.exists"> |
|
53 |
<condition property="gvsig.platform.exists"> |
|
54 |
<available file="${user.home}/.gvsig.platform.properties"/> |
|
55 |
</condition> |
|
56 |
</target> |
|
57 |
|
|
58 |
<target name="check.gvsig.platform.properties" |
|
59 |
depends="find.gvsig.platform.properties.file"> |
|
60 |
<fail if="depends.natives.file.exists" unless="gvsig.platform.exists"> |
|
61 |
ERROR!! |
|
62 |
|
|
63 |
You have to define your gvSIG platform properties, |
|
64 |
by creating the file: ${user.home}/.gvsig.platform.properties |
|
65 |
with the following content: |
|
66 |
|
|
67 |
native_platform=linux |
|
68 |
native_distribution=all |
|
69 |
native_compiler=gcc4 |
|
70 |
native_arch=i386 |
|
71 |
native_libraryType=dynamic |
|
72 |
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType} |
|
73 |
|
|
74 |
Replace the fifth initial variables values with the ones appropiate |
|
75 |
to your platform. |
|
76 |
|
|
77 |
If you use maven in the command line, you can use the previous file also |
|
78 |
to define the MAVEN_OPTS environment variable, by adding to your |
|
79 |
.bash_rc file something like this: |
|
80 |
|
|
81 |
if [ -f "${HOME}/.gvsig.platform.properties" ] |
|
82 |
then |
|
83 |
. ${HOME}/.gvsig.platform.properties |
|
84 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}" |
|
85 |
else |
|
86 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m" |
|
87 |
fi |
|
88 |
|
|
89 |
It will work if you use the bash shell. In any other case or platform, you'll |
|
90 |
have to define your MAVEN_OPTS environment variable and set the |
|
91 |
"native-classifier" parameter directly. |
|
92 |
</fail> |
|
93 |
|
|
94 |
</target> |
|
95 |
|
|
96 |
<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties"> |
|
97 |
|
|
98 |
<mkdir dir="target" /> |
|
99 |
|
|
100 |
<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" /> |
|
101 |
|
|
102 |
<!-- Copy the maven launchers to the workspace metadata folder --> |
|
103 |
<copy todir="${workspace.basedir}/.metadata"> |
|
104 |
<fileset dir="${build.basedir}/eclipse-launchers"> |
|
105 |
<exclude name="**/org.eclipse.jdt.core.prefs" /> |
|
106 |
<exclude name="**/org.eclipse.core.variables.prefs" /> |
|
107 |
</fileset> |
|
108 |
</copy> |
|
109 |
|
|
110 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true"> |
|
111 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" /> |
|
112 |
</concat> |
|
113 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true"> |
|
114 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" /> |
|
115 |
</concat> |
|
116 |
|
|
117 |
<!-- Configure the eclipse workspace --> |
|
118 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" /> |
|
119 |
|
|
120 |
<!-- Configure the gvSIG profile --> |
|
121 |
<ant antfile="${build.basedir}/check-gvsig-profile.xml" /> |
|
122 |
|
|
123 |
<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" /> |
|
124 |
|
|
125 |
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"> |
|
126 |
<classpath> |
|
127 |
<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" /> |
|
128 |
</classpath> |
|
129 |
</taskdef> |
|
130 |
|
|
131 |
<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}"> |
|
132 |
<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" /> |
|
133 |
</xmltask> |
|
134 |
|
|
135 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
136 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
137 |
|
|
138 |
<!-- Compile, install and generate eclipse projects --> |
|
139 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" /> |
|
140 |
|
|
141 |
<echo>INFORMATION!!!</echo> |
|
142 |
<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo> |
|
143 |
|
|
144 |
<!-- TODO: copiar al proyecto de configuraciĆ³n general --> |
|
145 |
</target> |
|
146 |
|
|
147 |
<target name="clean"> |
|
148 |
<delete dir="target" /> |
|
149 |
</target> |
|
150 |
|
|
151 |
</project> |
|
0 | 152 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.symbology</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<version>2.0.0-SNAPSHOT</version> |
|
9 |
<name>org.gvsig.symbology</name> |
|
10 |
<description>Symbology example project</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.maven.base.pom</artifactId> |
|
14 |
<version>1.0.8-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
<scm> |
|
17 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/org.gvsig.symbology</connection> |
|
18 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/org.gvsig.symbology</developerConnection> |
|
19 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/libraries/org.gvsig.symbology</url> |
|
20 |
</scm> |
|
21 |
<developers> |
|
22 |
<developer> |
|
23 |
<id>jjdelcerro</id> |
|
24 |
<name>Joaqu?n Jos? del Cerro</name> |
|
25 |
<email>jjdelcerro@gvsig.org</email> |
|
26 |
<roles> |
|
27 |
<role>Architect</role> |
|
28 |
<role>Developer</role> |
|
29 |
</roles> |
|
30 |
</developer> |
|
31 |
<developer> |
|
32 |
<id>jbadia</id> |
|
33 |
<name>Jos? Bad?a</name> |
|
34 |
<email>badia_jos@gva.es</email> |
|
35 |
<roles> |
|
36 |
<role>Developer</role> |
|
37 |
</roles> |
|
38 |
</developer> |
|
39 |
</developers> |
|
40 |
<repositories> |
|
41 |
<repository> |
|
42 |
<id>gvsig-public-http-repository</id> |
|
43 |
<name>gvSIG maven public HTTP repository</name> |
|
44 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
45 |
<releases> |
|
46 |
<enabled>true</enabled> |
|
47 |
<updatePolicy>daily</updatePolicy> |
|
48 |
<checksumPolicy>warn</checksumPolicy> |
|
49 |
</releases> |
|
50 |
<snapshots> |
|
51 |
<enabled>true</enabled> |
|
52 |
<updatePolicy>daily</updatePolicy> |
|
53 |
<checksumPolicy>warn</checksumPolicy> |
|
54 |
</snapshots> |
|
55 |
</repository> |
|
56 |
</repositories> |
|
57 |
<dependencyManagement> |
|
58 |
<dependencies> |
|
59 |
<dependency> |
|
60 |
<groupId>org.gvsig</groupId> |
|
61 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
62 |
<version>2.0.1-SNAPSHOT</version> |
|
63 |
<type>pom</type> |
|
64 |
<scope>import</scope> |
|
65 |
</dependency> |
|
66 |
</dependencies> |
|
67 |
</dependencyManagement> |
|
68 |
<dependencies> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
72 |
<scope>compile</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
77 |
<type>test-jar</type> |
|
78 |
</dependency> |
|
79 |
</dependencies> |
|
80 |
|
|
81 |
<modules> |
|
82 |
<module>org.gvsig.symbology.lib</module> |
|
83 |
<module>org.gvsig.symbology.swing</module> |
|
84 |
<module>org.gvsig.symbology.main</module> |
|
85 |
</modules> |
|
86 |
</project> |
|
0 | 87 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/README.txt | ||
---|---|---|
1 |
The first time you checkout the current project to a new workspace, |
|
2 |
you have to prepare it to be able to work easily with maven from |
|
3 |
eclipse itself. |
|
4 |
|
|
5 |
Perform the following steps: |
|
6 |
|
|
7 |
1.- Launch the *prepare-workspace.xml* ant build file. |
|
8 |
You can do it by loading the file into the ant view, |
|
9 |
and running the default task, or right-clicking the |
|
10 |
file from the package explorer or the navigator and |
|
11 |
select the option: *Run as > Ant build*. |
|
12 |
|
|
13 |
2.- Restart eclipse. |
|
14 |
|
|
15 |
3.- Import the subprojects of the project you have just checked out. |
|
16 |
|
|
17 |
Those steps are only needed once per workspace. |
|
18 |
|
|
0 | 19 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.main/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your classes. |
|
2 |
|
|
3 |
This folder is added to the classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your classes. |
|
0 | 9 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.main/src/main/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.symbology"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
|
0 | 38 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.main/src/main/java/org/gvsig/symbology/main/Main.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.symbology.main; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
|
|
28 |
import javax.swing.AbstractAction; |
|
29 |
import javax.swing.Action; |
|
30 |
import javax.swing.JButton; |
|
31 |
import javax.swing.JFrame; |
|
32 |
import javax.swing.JMenu; |
|
33 |
import javax.swing.JMenuBar; |
|
34 |
import javax.swing.JMenuItem; |
|
35 |
import javax.swing.JToolBar; |
|
36 |
import javax.swing.WindowConstants; |
|
37 |
|
|
38 |
import org.gvsig.symbology.SymbologyLocator; |
|
39 |
import org.gvsig.symbology.SymbologyManager; |
|
40 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
41 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
|
42 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
43 |
import org.slf4j.Logger; |
|
44 |
import org.slf4j.LoggerFactory; |
|
45 |
|
|
46 |
/** |
|
47 |
* Main executable class for testing the Symbology library. |
|
48 |
* |
|
49 |
* @author gvSIG Team |
|
50 |
* @version $Id$ |
|
51 |
*/ |
|
52 |
public class Main { |
|
53 |
|
|
54 |
private static final Logger LOG = LoggerFactory.getLogger(Main.class); |
|
55 |
|
|
56 |
private SymbologyManager manager; |
|
57 |
private SymbologySwingManager swingManager; |
|
58 |
|
|
59 |
public static void main(String args[]) { |
|
60 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
61 |
Main main = new Main(); |
|
62 |
main.show(); |
|
63 |
} |
|
64 |
|
|
65 |
@SuppressWarnings("serial") |
|
66 |
public void show() { |
|
67 |
manager = SymbologyLocator.getSymbologyManager(); |
|
68 |
swingManager = SymbologySwingLocator.getSwingManager(); |
|
69 |
|
|
70 |
Action showCookie = new AbstractAction("Get a Symbology") { |
|
71 |
|
|
72 |
public void actionPerformed(ActionEvent e) { |
|
73 |
showSymbology(manager); |
|
74 |
} |
|
75 |
}; |
|
76 |
|
|
77 |
Action exit = new AbstractAction("Exit") { |
|
78 |
|
|
79 |
public void actionPerformed(ActionEvent e) { |
|
80 |
System.exit(0); |
|
81 |
} |
|
82 |
}; |
|
83 |
|
|
84 |
JFrame frame = new JFrame("Symbology example app"); |
|
85 |
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
|
86 |
|
|
87 |
// Create the menu bar. |
|
88 |
JMenuBar menuBar = new JMenuBar(); |
|
89 |
|
|
90 |
// Build the menu. |
|
91 |
JMenu menuFile = new JMenu("File"); |
|
92 |
menuFile.add(new JMenuItem(showCookie)); |
|
93 |
menuFile.add(new JMenuItem(exit)); |
|
94 |
|
|
95 |
menuBar.add(menuFile); |
|
96 |
|
|
97 |
JToolBar toolBar = new JToolBar(); |
|
98 |
toolBar.add(new JButton(showCookie)); |
|
99 |
toolBar.add(new JButton(exit)); |
|
100 |
|
|
101 |
frame.setPreferredSize(new Dimension(200, 100)); |
|
102 |
frame.setJMenuBar(menuBar); |
|
103 |
frame.add(toolBar, BorderLayout.PAGE_START); |
|
104 |
|
|
105 |
// Display the window. |
|
106 |
frame.pack(); |
|
107 |
frame.setVisible(true); |
|
108 |
} |
|
109 |
|
|
110 |
public void showSymbology(SymbologyManager manager) { |
|
111 |
// try { |
|
112 |
// SymbologyService service = |
|
113 |
// (SymbologyService) manager.getSymbologyService(); |
|
114 |
// JSymbologyServicePanel panel = |
|
115 |
// swingManager.createSymbology(service); |
|
116 |
// swingManager.getWindowManager().showWindow(panel, "Symbology", |
|
117 |
// SymbologyWindowManager.MODE_WINDOW); |
|
118 |
// |
|
119 |
// } catch (ServiceException e) { |
|
120 |
// LOG.error("Error showing a Symbology", e); |
|
121 |
// } |
|
122 |
} |
|
123 |
|
|
124 |
} |
|
0 | 125 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.main/src/main/java/org/gvsig/symbology/main/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.symbology package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Symbology library testing and demo application.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.main/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.symbology.main</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.symbology.main</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.symbology</artifactId> |
|
11 |
<version>2.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
17 |
<version>2.0.0-SNAPSHOT</version> |
|
18 |
<scope>compile</scope> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.symbology.lib.impl</artifactId> |
|
23 |
<version>2.0.0-SNAPSHOT</version> |
|
24 |
<scope>runtime</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.symbology.swing.api</artifactId> |
|
29 |
<version>2.0.0-SNAPSHOT</version> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.symbology.swing.impl</artifactId> |
|
35 |
<version>2.0.0-SNAPSHOT</version> |
|
36 |
<scope>runtime</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.slf4j</groupId> |
|
40 |
<artifactId>slf4j-api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
</dependencies> |
|
44 |
</project> |
|
0 | 45 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
4 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
|
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<artifactId>org.gvsig.symbology.lib</artifactId> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<name>org.gvsig.symbology.lib</name> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.symbology</artifactId> |
|
13 |
<version>2.0.0-SNAPSHOT</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<modules> |
|
17 |
<module>org.gvsig.symbology.lib.api</module> |
|
18 |
<module>org.gvsig.symbology.lib.impl</module> |
|
19 |
</modules> |
|
20 |
</project> |
|
0 | 21 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.symbology.impl.SymbologyDefaultImplLibrary |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/impl/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.symbology package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Symbology library API default implementation.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/impl/SymbologyDefaultImplLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {gvSIG} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.symbology.impl; |
|
28 |
|
|
29 |
import org.gvsig.symbology.SymbologyLibrary; |
|
30 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend; |
|
31 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend; |
|
32 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractLegend; |
|
33 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend; |
|
34 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
|
35 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.SingleSymbolLegend; |
|
36 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialIntervalLegend; |
|
37 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend; |
|
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy; |
|
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.DefaultLabelingMethod; |
|
40 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelClass; |
|
41 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.ZoomConstraintsImpl; |
|
42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.AbstractFillSymbol; |
|
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MarkerFillSymbol; |
|
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MultiLayerFillSymbol; |
|
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.PictureFillSymbol; |
|
46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
|
47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
48 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol; |
|
49 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.AbstractLineSymbol; |
|
50 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.MultiLayerLineSymbol; |
|
51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.PictureLineSymbol; |
|
52 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol; |
|
53 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.AbstractMarkerSymbol; |
|
54 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.ArrowMarkerSymbol; |
|
55 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.MultiLayerMarkerSymbol; |
|
56 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.PictureMarkerSymbol; |
|
57 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol; |
|
58 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.AbstractStyle; |
|
59 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ArrowDecoratorStyle; |
|
60 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.BackgroundFileStyle; |
|
61 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.DefaultMask; |
|
62 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ImageStyle; |
|
63 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.RemoteFileStyle; |
|
64 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SVGStyle; |
|
65 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLineStyle; |
|
66 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleMarkerFillPropertiesStyle; |
|
67 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
|
68 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.warning.impl.WarningSymbol; |
|
69 |
import org.gvsig.tools.library.AbstractLibrary; |
|
70 |
import org.gvsig.tools.library.LibraryException; |
|
71 |
import org.gvsig.tools.util.Caller; |
|
72 |
import org.gvsig.tools.util.impl.DefaultCaller; |
|
73 |
|
|
74 |
/** |
|
75 |
* Library for the Basic Symbology implementation. |
|
76 |
* |
|
77 |
* @author gvSIG team |
|
78 |
*/ |
|
79 |
public class SymbologyDefaultImplLibrary extends AbstractLibrary { |
|
80 |
|
|
81 |
@Override |
|
82 |
public void doRegistration() { |
|
83 |
registerAsImplementationOf(SymbologyLibrary.class); |
|
84 |
} |
|
85 |
|
|
86 |
protected void doInitialize() throws LibraryException { |
|
87 |
Caller caller = new DefaultCaller(); |
|
88 |
caller.add(new DefaultSymbologyManager.RegisterSymbologyManager()); |
|
89 |
if (!caller.call()) { |
|
90 |
throw new LibraryException(SymbologyDefaultImplLibrary.class, |
|
91 |
caller.getExceptions()); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
protected void doPostInitialize() throws LibraryException { |
|
96 |
Caller caller = new DefaultCaller(); |
|
97 |
|
|
98 |
/* |
|
99 |
* Add registry of symbols |
|
100 |
*/ |
|
101 |
caller.add( new SimpleFillSymbol.RegisterSymbol() ); |
|
102 |
caller.add( new MultiLayerFillSymbol.RegisterSymbol() ); |
|
103 |
caller.add( new SimpleLineSymbol.RegisterSymbol() ); |
|
104 |
caller.add( new MultiLayerLineSymbol.RegisterSymbol() ); |
|
105 |
caller.add( new SimpleMarkerSymbol.RegisterSymbol() ); |
|
106 |
caller.add( new MultiLayerMarkerSymbol.RegisterSymbol() ); |
|
107 |
caller.add( new SimpleTextSymbol.RegisterSymbol() ); |
|
108 |
caller.add( new MultiShapeSymbol.RegisterSymbol() ); |
|
109 |
caller.add( new WarningSymbol.RegisterSymbol() ); |
|
110 |
|
|
111 |
caller.add( new PictureFillSymbol.RegisterSymbol() ); |
|
112 |
caller.add( new PictureLineSymbol.RegisterSymbol() ); |
|
113 |
caller.add( new PictureMarkerSymbol.RegisterSymbol() ); |
|
114 |
|
|
115 |
// caller.add( new MarkerFillSymbol.RegisterSymbol() ); |
|
116 |
|
|
117 |
/* |
|
118 |
* Add registry of legends |
|
119 |
*/ |
|
120 |
caller.add( new VectorialUniqueValueLegend.RegisterLegend() ); |
|
121 |
caller.add( new VectorialIntervalLegend.RegisterLegend() ); |
|
122 |
caller.add( new SingleSymbolLegend.RegisterLegend() ); |
|
123 |
|
|
124 |
/* |
|
125 |
* Add registry of persistent styles |
|
126 |
*/ |
|
127 |
caller.add( new AbstractStyle.RegisterPersistence() ); |
|
128 |
caller.add( new ArrowDecoratorStyle.RegisterPersistence() ); |
|
129 |
caller.add( new DefaultMask.RegisterPersistence() ); |
|
130 |
caller.add( new SimpleLineStyle.RegisterPersistence() ); |
|
131 |
|
|
132 |
caller.add( new BackgroundFileStyle.RegisterPersistence() ); |
|
133 |
caller.add( new ImageStyle.RegisterPersistence() ); |
|
134 |
caller.add( new RemoteFileStyle.RegisterPersistence() ); |
|
135 |
caller.add( new SVGStyle.RegisterPersistence() ); |
|
136 |
|
|
137 |
/* |
|
138 |
* Add registry of persistent symbols |
|
139 |
*/ |
|
140 |
caller.add( new AbstractSymbol.RegisterPersistence() ); |
|
141 |
caller.add( new AbstractFillSymbol.RegisterPersistence() ); |
|
142 |
caller.add( new SimpleFillSymbol.RegisterPersistence() ); |
|
143 |
caller.add( new MultiLayerFillSymbol.RegisterPersistence() ); |
|
144 |
caller.add( new AbstractLineSymbol.RegisterPersistence() ); |
|
145 |
caller.add( new SimpleLineSymbol.RegisterPersistence() ); |
|
146 |
caller.add( new MultiLayerLineSymbol.RegisterPersistence() ); |
|
147 |
caller.add( new AbstractMarkerSymbol.RegisterPersistence() ); |
|
148 |
caller.add( new SimpleMarkerSymbol.RegisterPersistence() ); |
|
149 |
caller.add( new ArrowMarkerSymbol.RegisterPersistence() ); |
|
150 |
caller.add( new MultiLayerMarkerSymbol.RegisterPersistence() ); |
|
151 |
caller.add( new SimpleTextSymbol.RegisterPersistence() ); |
|
152 |
caller.add( new MultiShapeSymbol.RegisterPersistence() ); |
|
153 |
caller.add( new WarningSymbol.RegisterPersistence() ); |
|
154 |
|
|
155 |
caller.add( new PictureFillSymbol.RegisterPersistence() ); |
|
156 |
caller.add( new PictureLineSymbol.RegisterPersistence() ); |
|
157 |
caller.add( new PictureMarkerSymbol.RegisterPersistence() ); |
|
158 |
caller.add( new MarkerFillSymbol.RegisterPersistence() ); |
|
159 |
caller.add( new SimpleMarkerFillPropertiesStyle.RegisterPersistence() ); |
|
160 |
|
|
161 |
|
|
162 |
/* |
|
163 |
* Add registry of persistent legends |
|
164 |
*/ |
|
165 |
caller.add(new AbstractLegend.RegisterPersistence()); |
|
166 |
caller.add(new AbstractVectorialLegend.RegisterPersistence()); |
|
167 |
caller.add(new AbstractClassifiedVectorLegend.RegisterPersistence()); |
|
168 |
caller.add(new FInterval.RegisterPersistence()); |
|
169 |
caller.add(new AbstractIntervalLegend.RegisterPersistence()); |
|
170 |
caller.add(new VectorialIntervalLegend.RegisterPersistence()); |
|
171 |
caller.add(new VectorialUniqueValueLegend.RegisterPersistence()); |
|
172 |
caller.add(new SingleSymbolLegend.RegisterPersistence()); |
|
173 |
|
|
174 |
/* |
|
175 |
* Add registry of labeling classes |
|
176 |
*/ |
|
177 |
caller.add(new ZoomConstraintsImpl.RegisterPersistence()); |
|
178 |
caller.add(new LabelClass.RegisterPersistence()); |
|
179 |
caller.add(new DefaultLabelingMethod.RegisterPersistence()); |
|
180 |
caller.add(new AttrInTableLabelingStrategy.RegisterPersistence()); |
|
181 |
|
|
182 |
/* |
|
183 |
* Do register of all |
|
184 |
*/ |
|
185 |
if( !caller.call() ) { |
|
186 |
throw new LibraryException(SymbologyDefaultImplLibrary.class, caller.getExceptions()); |
|
187 |
} |
|
188 |
|
|
189 |
} |
|
190 |
|
|
191 |
} |
|
0 | 192 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/impl/DefaultSymbologyManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.symbology.impl; |
|
28 |
|
|
29 |
import java.io.IOException; |
|
30 |
import java.net.URL; |
|
31 |
|
|
32 |
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
|
33 |
import org.gvsig.symbology.SymbologyLocator; |
|
34 |
import org.gvsig.symbology.SymbologyManager; |
|
35 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
|
36 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy; |
|
37 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy; |
|
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.IMultiShapeSymbol; |
|
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IMarkerFillSymbol; |
|
40 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IPictureFillSymbol; |
|
41 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.ISimpleFillSymbol; |
|
42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MarkerFillSymbol; |
|
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.PictureFillSymbol; |
|
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
|
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol; |
|
46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.IPictureLineSymbol; |
|
47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ISimpleLineSymbol; |
|
48 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.PictureLineSymbol; |
|
49 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol; |
|
50 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IPictureMarkerSymbol; |
|
51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.ISimpleMarkerSymbol; |
|
52 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.PictureMarkerSymbol; |
|
53 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol; |
|
54 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ArrowDecoratorStyle; |
|
55 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.DefaultMask; |
|
56 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IArrowDecoratorStyle; |
|
57 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMarkerFillPropertiesStyle; |
|
58 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMask; |
|
59 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ISimpleLineStyle; |
|
60 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLineStyle; |
|
61 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleMarkerFillPropertiesStyle; |
|
62 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol; |
|
63 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
|
64 |
import org.gvsig.tools.util.Callable; |
|
65 |
|
|
66 |
/** |
|
67 |
* Default {@link SymbologyManager} implementation. |
|
68 |
* |
|
69 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
70 |
*/ |
|
71 |
public class DefaultSymbologyManager implements SymbologyManager { |
|
72 |
|
|
73 |
public IInterval createInterval(double min, double max) { |
|
74 |
return new FInterval(min, max); |
|
75 |
} |
|
76 |
|
|
77 |
public static class RegisterSymbologyManager implements Callable { |
|
78 |
|
|
79 |
public Object call() throws Exception { |
|
80 |
|
|
81 |
SymbologyLocator.registerSymbologyManager(DefaultSymbologyManager.class); |
|
82 |
|
|
83 |
return Boolean.TRUE; |
|
84 |
} |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
public IArrowDecoratorStyle createArrowDecoratorStyle() { |
|
89 |
return new ArrowDecoratorStyle(); |
|
90 |
} |
|
91 |
|
|
92 |
// public IMarkerSymbol createMarkerSymbol(){ |
|
93 |
// return new SimpleMarkerSymbol(); |
|
94 |
// } |
|
95 |
|
|
96 |
public ISimpleMarkerSymbol createSimpleMarkerSymbol() { |
|
97 |
return new SimpleMarkerSymbol(); |
|
98 |
} |
|
99 |
|
|
100 |
public IMask createMask() { |
|
101 |
return new DefaultMask(); |
|
102 |
} |
|
103 |
|
|
104 |
public IMultiShapeSymbol createMultiShapeSymbol() { |
|
105 |
return new MultiShapeSymbol(); |
|
106 |
} |
|
107 |
|
|
108 |
public ISimpleFillSymbol createSimpleFillSymbol() { |
|
109 |
return new SimpleFillSymbol(); |
|
110 |
} |
|
111 |
|
|
112 |
public ISimpleLineSymbol createSimpleLineSymbol() { |
|
113 |
return new SimpleLineSymbol(); |
|
114 |
} |
|
115 |
|
|
116 |
public ISimpleLineStyle createSimpleLineStyle() { |
|
117 |
return new SimpleLineStyle(); |
|
118 |
} |
|
119 |
|
|
120 |
public ISimpleTextSymbol createSimpleTextSymbol() { |
|
121 |
return new SimpleTextSymbol(); |
|
122 |
} |
|
123 |
|
|
124 |
public IMarkerFillPropertiesStyle createSimpleMarkerFillPropertiesStyle() { |
|
125 |
return new SimpleMarkerFillPropertiesStyle(); |
|
126 |
} |
|
127 |
|
|
128 |
public IPictureFillSymbol createPictureFillSymbol(URL imageURL, |
|
129 |
URL selImageURL) throws IOException { |
|
130 |
return new PictureFillSymbol(imageURL, selImageURL); |
|
131 |
} |
|
132 |
|
|
133 |
public IPictureLineSymbol createPictureLineSymbol(URL imageURL, |
|
134 |
URL selImageURL) throws IOException { |
|
135 |
return new PictureLineSymbol(imageURL, selImageURL); |
|
136 |
} |
|
137 |
|
|
138 |
public IPictureMarkerSymbol createPictureMarkerSymbol(URL imageURL, |
|
139 |
URL selImageURL) throws IOException { |
|
140 |
return new PictureMarkerSymbol(imageURL, selImageURL); |
|
141 |
|
|
142 |
} |
|
143 |
|
|
144 |
public IMarkerFillSymbol createMarkerFillSymbol() { |
|
145 |
return new MarkerFillSymbol(); |
|
146 |
} |
|
147 |
|
|
148 |
public IAttrInTableLabelingStrategy createAttrInTableLabelingStrategy() { |
|
149 |
return new AttrInTableLabelingStrategy(); |
|
150 |
} |
|
151 |
|
|
152 |
|
|
153 |
} |
|
0 | 154 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/style/AbstractStyle.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style; |
|
23 |
|
|
24 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.IStyle; |
|
25 |
import org.gvsig.tools.ToolsLocator; |
|
26 |
import org.gvsig.tools.dynobject.DynStruct; |
|
27 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
28 |
import org.gvsig.tools.persistence.PersistentState; |
|
29 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
30 |
import org.gvsig.tools.util.Callable; |
|
31 |
|
|
32 |
/** |
|
33 |
* Implements the IStyle interface in order to complete the methods ot the |
|
34 |
* IStyle interface that allow the users to add the description of an object or |
|
35 |
* obtain it. |
|
36 |
* |
|
37 |
* @author 2005-2008 jaume dominguez faus - jaume.dominguez@iver.es |
|
38 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
39 |
*/ |
|
40 |
|
|
41 |
public abstract class AbstractStyle implements IStyle { |
|
42 |
|
|
43 |
public static final String STYLE_PERSISTENCE_DEFINITION_NAME = "Style"; |
|
44 |
|
|
45 |
private static final String FIELD_DESCRIPTION = "description"; |
|
46 |
|
|
47 |
private String desc; |
|
48 |
|
|
49 |
public final void setDescription(String desc) { |
|
50 |
this.desc = desc; |
|
51 |
} |
|
52 |
|
|
53 |
public final String getDescription() { |
|
54 |
return desc; |
|
55 |
} |
|
56 |
|
|
57 |
public Object clone() throws CloneNotSupportedException { |
|
58 |
return super.clone(); |
|
59 |
} |
|
60 |
|
|
61 |
public void loadFromState(PersistentState state) |
|
62 |
throws PersistenceException { |
|
63 |
setDescription(state.getString(FIELD_DESCRIPTION)); |
|
64 |
} |
|
65 |
|
|
66 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
67 |
state.set(FIELD_DESCRIPTION, getDescription()); |
|
68 |
} |
|
69 |
|
|
70 |
public static class RegisterPersistence implements Callable { |
|
71 |
|
|
72 |
public Object call() throws Exception { |
|
73 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
74 |
if( manager.getDefinition(STYLE_PERSISTENCE_DEFINITION_NAME)==null ) { |
|
75 |
DynStruct definition = manager.addDefinition( |
|
76 |
AbstractStyle.class, |
|
77 |
STYLE_PERSISTENCE_DEFINITION_NAME, |
|
78 |
STYLE_PERSISTENCE_DEFINITION_NAME+" Persistence definition", |
|
79 |
null, |
|
80 |
null |
|
81 |
); |
|
82 |
|
|
83 |
// Description |
|
84 |
definition.addDynFieldString(FIELD_DESCRIPTION); |
|
85 |
} |
|
86 |
return Boolean.TRUE; |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
} |
|
0 | 91 |
tags/v_2_0_0_Build_2043/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/style/Line2DOffset.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style; |
|
42 |
|
|
43 |
import java.awt.Shape; |
|
44 |
import java.awt.geom.Line2D; |
|
45 |
import java.awt.geom.PathIterator; |
|
46 |
import java.awt.geom.Point2D; |
|
47 |
import java.util.ArrayList; |
|
48 |
import java.util.HashMap; |
|
49 |
import java.util.List; |
|
50 |
import java.util.Map; |
|
51 |
|
|
52 |
import org.gvsig.fmap.geom.Geometry; |
|
53 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
54 |
import org.slf4j.Logger; |
|
55 |
import org.slf4j.LoggerFactory; |
|
56 |
|
|
57 |
import com.vividsolutions.jts.geom.Coordinate; |
|
58 |
import com.vividsolutions.jts.geom.LineSegment; |
|
59 |
/** |
|
60 |
* |
|
61 |
* Line2DOffset.java |
|
62 |
* |
|
63 |
* |
|
64 |
* @author jaume dominguez faus - jaume.dominguez@iver.es Jan 3, 2008 |
|
65 |
* |
|
66 |
*/ |
|
67 |
|
|
68 |
public class Line2DOffset { |
|
69 |
final static private Logger logger = LoggerFactory.getLogger(Line2DOffset.class); |
|
70 |
|
|
71 |
public static GeneralPathX offsetLine(Shape p, double offset) { |
|
72 |
|
|
73 |
if (Math.abs(offset) < 1) { |
|
74 |
return new GeneralPathX(p.getPathIterator(null)); |
|
75 |
} |
|
76 |
PathIterator pi = p.getPathIterator(null); |
|
77 |
double[] dataCoords = new double[6]; |
|
78 |
Coordinate from = null, first = null; |
|
79 |
List<LineSegment> segments = new ArrayList<LineSegment>(); |
|
80 |
GeneralPathX offsetSegments = new GeneralPathX(); |
|
81 |
LineSegment line; |
|
82 |
try { |
|
83 |
while (!pi.isDone()) { |
|
84 |
// while not done |
|
85 |
int type = pi.currentSegment(dataCoords); |
|
86 |
|
|
87 |
switch (type) { |
|
88 |
case PathIterator.SEG_MOVETO: |
|
89 |
if(from == null){ |
|
90 |
from = new Coordinate(dataCoords[0], dataCoords[1]); |
|
91 |
first = from; |
|
92 |
break; |
|
93 |
} else { |
|
94 |
/* Puede significar un agujero en un pol?gono o un salto en una linea. |
|
95 |
* Entonces, consumimos los segmentos que llevamos |
|
96 |
* y empezamos un nuevo pol?gono o una nueva linea. |
|
97 |
*/ |
|
98 |
try { |
|
99 |
if(((Geometry)p).getType() == Geometry.TYPES.SURFACE){ |
|
100 |
offsetSegments.append(offsetAndConsumeClosedSegments(offset, segments).getPathIterator(null), |
|
101 |
false); |
|
102 |
} else { |
|
103 |
offsetSegments.append(offsetAndConsumeSegments(offset, segments).getPathIterator(null), |
|
104 |
false); |
|
105 |
} |
|
106 |
} catch (NotEnoughSegmentsToClosePathException e) { |
|
107 |
logger.error( |
|
108 |
e.getMessage(), e); |
|
109 |
} |
|
110 |
segments.clear(); |
|
111 |
from = new Coordinate(dataCoords[0], dataCoords[1]); |
|
112 |
first = from; |
|
113 |
break; |
|
114 |
} |
|
115 |
|
|
116 |
case PathIterator.SEG_LINETO: |
|
117 |
|
|
118 |
// System.out.println("SEG_LINETO"); |
|
119 |
Coordinate to = new Coordinate(dataCoords[0], dataCoords[1]); |
|
120 |
if(from.compareTo(to)!=0){ |
|
121 |
line = new LineSegment(from, to); |
|
122 |
segments.add(line); |
|
123 |
from = to; |
|
124 |
} |
|
125 |
break; |
|
126 |
case PathIterator.SEG_CLOSE: |
|
127 |
line = new LineSegment(from, first); |
|
128 |
segments.add(line); |
|
129 |
// from = first; |
|
130 |
try { |
|
131 |
offsetSegments.append(offsetAndConsumeClosedSegments( |
|
132 |
offset, segments).getPathIterator(null), false); |
|
133 |
} catch (NotEnoughSegmentsToClosePathException e) { |
|
134 |
logger.error( |
|
135 |
e.getMessage(), e); |
|
136 |
} |
|
137 |
segments.clear(); |
|
138 |
first =null; |
|
139 |
from = null; |
|
140 |
|
|
141 |
break; |
|
142 |
|
|
143 |
} // end switch |
|
144 |
|
|
145 |
pi.next(); |
|
146 |
} |
|
147 |
offsetSegments.append(offsetAndConsumeSegments(offset, segments) |
|
148 |
.getPathIterator(null), false); |
|
149 |
|
|
150 |
return offsetSegments; |
|
151 |
} catch (ParallelLinesCannotBeResolvedException e) { |
|
152 |
logger.error(e.getMessage(), e); |
|
153 |
return new GeneralPathX(p.getPathIterator(null)); |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
private static GeneralPathX offsetAndConsumeSegments(double offset, |
|
158 |
List<LineSegment> segments) |
|
159 |
throws ParallelLinesCannotBeResolvedException { |
|
160 |
Map<LineSegment, LineEquation> offsetLines = |
|
161 |
new HashMap<LineSegment, LineEquation>(); |
|
162 |
int segmentCount = segments.size(); |
|
163 |
// first calculate offset lines with the starting point |
|
164 |
for (int i = 0; i < segmentCount; i++) { |
|
165 |
LineSegment segment = (LineSegment)segments.get(i); |
|
166 |
double theta = segment.angle(); |
|
167 |
//FIXME: ?Esto para qu? es? |
|
168 |
// if (Math.abs(theta) % (Math.PI*0.5) < 0.00001){ |
|
169 |
// theta=theta+0.00000000000001; |
|
170 |
// } |
|
171 |
|
|
172 |
double xOffset = offset * Math.sin(theta); |
|
173 |
double yOffset = offset * Math.cos(theta); |
|
174 |
|
|
175 |
Coordinate p0 = segment.p0; |
|
176 |
double x0 = p0.x + xOffset; |
|
177 |
double y0 = p0.y - yOffset; |
|
178 |
|
|
179 |
Coordinate p1 = segment.p1; |
|
180 |
double x1 = p1.x + xOffset; |
|
181 |
double y1 = p1.y - yOffset; |
|
182 |
|
|
183 |
LineEquation offsetLine = new LineEquation(theta, x0, y0, x1, y1); |
|
184 |
offsetLines.put(segment, offsetLine); |
|
185 |
} |
|
186 |
|
|
187 |
/* |
|
188 |
* let's now calculate the end point of each segment with the point |
|
189 |
* where each line crosses the next one. this point will be the end |
|
190 |
* point of the first line, and the start point of its next one. |
|
191 |
*/ |
|
192 |
Point2D pIni = null; |
|
193 |
Point2D pEnd = null; |
|
194 |
GeneralPathX gpx = new GeneralPathX(); |
|
195 |
for (int i = 0; i < segmentCount; i++) { |
|
196 |
LineSegment segment = (LineSegment)segments.get(0); |
|
197 |
LineEquation eq = (LineEquation)offsetLines.get(segment); |
|
198 |
if (i == 0) { |
|
199 |
pIni = new Point2D.Double(eq.x, eq.y); |
|
200 |
} else { |
|
201 |
pIni = pEnd; |
|
202 |
} |
|
203 |
|
|
204 |
if (i < segmentCount - 1) { |
|
205 |
LineEquation eq1 = (LineEquation) offsetLines.get(segments.get(1)); |
|
206 |
try{ |
|
207 |
pEnd = eq.resolve(eq1); |
|
208 |
} catch (ParallelLinesCannotBeResolvedException e) { //Las lineas son paralelas y NO son la misma. |
|
209 |
pEnd = new Point2D.Double(eq.xEnd, eq.yEnd); |
|
210 |
gpx.append(new Line2D.Double(pIni, pEnd) |
|
211 |
.getPathIterator(null), true); // a?adimos una linea |
|
212 |
// hasta el final |
|
213 |
// del primer |
|
214 |
// segmento |
|
215 |
// y asignamos como punto final el principio del siguiente segmento |
|
216 |
// para que en la siguiente iteraci?n lo tome como punto inicial. |
|
217 |
pIni = pEnd; |
|
218 |
pEnd = new Point2D.Double(eq1.x, eq1.y); |
|
219 |
segments.remove(0); |
|
220 |
continue; |
|
221 |
} |
|
222 |
} else { |
|
223 |
pEnd = new Point2D.Double(eq.xEnd, eq.yEnd); |
|
224 |
} |
|
225 |
|
|
226 |
gpx.append(new Line2D.Double(pIni, pEnd).getPathIterator(null), true); |
|
227 |
segments.remove(0); |
|
228 |
} |
|
229 |
return gpx; |
|
230 |
} |
|
231 |
|
|
232 |
private static GeneralPathX offsetAndConsumeClosedSegments(double offset, |
|
233 |
List<LineSegment> segments) |
|
234 |
throws ParallelLinesCannotBeResolvedException, NotEnoughSegmentsToClosePathException { |
|
235 |
int segmentCount = segments.size(); |
|
236 |
if (segmentCount > 1) { |
|
237 |
Map<LineSegment, LineEquation> offsetLines = new HashMap<LineSegment, LineEquation>(); |
|
238 |
// first calculate offset lines with the starting point |
|
239 |
for (int i = 0; i < segmentCount; i++) { |
|
240 |
LineSegment segment = (LineSegment)segments.get(i); |
|
241 |
double theta = segment.angle(); |
|
242 |
//FIXME: ?Esto para qu? es? |
|
243 |
// if (Math.abs(theta) % (Math.PI*0.5) < 0.00001){ |
|
244 |
// theta=theta+0.00000000000001; |
|
245 |
// } |
|
246 |
|
|
247 |
double xOffset = offset * Math.sin(theta); |
|
248 |
double yOffset = offset * Math.cos(theta); |
|
249 |
|
|
250 |
Coordinate p0 = segment.p0; |
|
251 |
double x0 = p0.x + xOffset; |
|
252 |
double y0 = p0.y - yOffset; |
|
253 |
|
|
254 |
Coordinate p1 = segment.p1; |
|
255 |
double x1 = p1.x + xOffset; |
|
256 |
double y1 = p1.y - yOffset; |
|
257 |
|
|
258 |
LineEquation offsetLine = new LineEquation(theta, x0, y0, x1, y1); |
|
259 |
offsetLines.put(segment, offsetLine); |
|
260 |
} |
|
261 |
|
|
262 |
/* |
|
263 |
* let's now calculate the end point of each segment with the point |
|
264 |
* where each line crosses the next one. this point will be the end |
|
265 |
* point of the first line, and the start point of its next one. |
|
266 |
*/ |
|
267 |
Point2D pIni = null; |
|
268 |
Point2D pEnd = null; |
|
269 |
Point2D firstP = null; |
|
270 |
GeneralPathX gpx = new GeneralPathX(); |
|
271 |
for (int i = 0; i < segmentCount; i++) { |
|
272 |
LineSegment segment = (LineSegment)segments.get(0); |
|
273 |
LineEquation eq = offsetLines.get(segment); |
|
274 |
if (i == 0) { //Calculo de la intersecci?n entre el primer segmento y el ?ltimo |
|
275 |
LineEquation eq0 = offsetLines.get((LineSegment)segments.get(segmentCount-1)); |
|
276 |
try{ |
|
277 |
pIni = eq0.resolve(eq); |
|
278 |
} catch (ParallelLinesCannotBeResolvedException e) { //Las lineas son paralelas y NO son la misma. |
|
279 |
// pIni = new Point2D.Double(eq0.xEnd, eq0.yEnd); |
|
280 |
pIni = new Point2D.Double(eq.x, eq.y); |
|
281 |
} |
|
282 |
firstP = pIni; |
|
283 |
} else { |
|
284 |
pIni = pEnd; |
|
285 |
} |
|
286 |
|
|
287 |
if (i < segmentCount - 1) { |
|
288 |
LineEquation eq1 = offsetLines.get((LineSegment)segments.get(1)); |
|
289 |
try{ |
|
290 |
pEnd = eq.resolve(eq1); |
|
291 |
} catch (ParallelLinesCannotBeResolvedException e) { //Las lineas son paralelas y NO son la misma. |
|
292 |
pEnd = new Point2D.Double(eq.xEnd, eq.yEnd); |
|
293 |
gpx.append(new Line2D.Double(pIni, pEnd).getPathIterator(null), true); // a?adimos una linea hasta el final del primer segmento |
|
294 |
// y asignamos como punto final el principio del siguiente segmento |
|
295 |
// para que en la siguiente iteraci?n lo tome como punto inicial. |
|
296 |
pIni = pEnd; |
|
297 |
pEnd = new Point2D.Double(eq1.x, eq1.y); |
|
298 |
segments.remove(0); |
|
299 |
continue; |
|
300 |
} |
|
301 |
} else { |
|
302 |
// pEnd = new Point2D.Double(eq.xEnd, eq.yEnd); |
|
303 |
pEnd = new Point2D.Double(firstP.getX(), firstP.getY()); |
|
304 |
} |
|
305 |
|
|
306 |
gpx.append(new Line2D.Double(pIni, pEnd).getPathIterator(null), true); |
|
307 |
segments.remove(0); |
|
308 |
} |
|
309 |
return gpx; |
|
310 |
} |
|
311 |
throw new NotEnoughSegmentsToClosePathException(segments); |
|
312 |
|
|
313 |
} |
|
314 |
|
|
315 |
// private static GeneralPathX offsetAndConsumeClosedSegments(double offset, |
|
316 |
// List<LineSegment> segments) |
|
317 |
// throws ParallelLinesCannotBeResolvedException, |
|
318 |
// NotEnoughSegmentsToClosePathException { |
|
319 |
// int segmentCount = segments.size(); |
|
320 |
// if (segmentCount > 1) { |
|
321 |
// GeneralPathX openPath = offsetAndConsumeSegments(offset, segments); |
|
322 |
// openPath.closePath(); |
|
323 |
// return openPath; |
|
324 |
// } |
|
325 |
// throw new NotEnoughSegmentsToClosePathException(segments); |
|
326 |
// } |
|
327 |
} |
|
328 |
|
|
329 |
class LineEquation { |
|
330 |
double theta, m, x, y; |
|
331 |
|
|
332 |
double xEnd, yEnd; // just for simplicity of code |
|
333 |
|
|
334 |
public LineEquation(double theta, double x, double y, double xEnd, |
|
335 |
double yEnd) { |
|
336 |
// this.theta = Math.tan(theta); //Esto es un error, no podemos confundir el angulo de la recta con su pendiente |
|
337 |
this.theta = theta; |
|
338 |
this.m = Math.tan(theta); |
|
339 |
this.x = x; |
|
340 |
this.y = y; |
|
341 |
this.xEnd = xEnd; |
|
342 |
this.yEnd = yEnd; |
|
343 |
} |
|
344 |
|
|
345 |
public Point2D resolve(LineEquation otherLine) |
|
346 |
throws ParallelLinesCannotBeResolvedException { |
|
347 |
/* |
|
348 |
* line1 (this): y - y0 = m*(x - x0) |
|
349 |
* line2 (otherLine): y' - y'0 = m'*(x' - x'0) |
|
350 |
*/ |
|
351 |
|
|
352 |
double X; |
|
353 |
double Y; |
|
354 |
if(Math.abs(this.x - this.xEnd)<0.00001) { //Esta linea es vertical |
|
355 |
// System.out.println("1 VERTICAL"); |
|
356 |
X = this.xEnd; |
|
357 |
if (Math.abs(otherLine.x - otherLine.xEnd)<0.00001){//La otra linea es vertical |
|
358 |
// System.out.println(" 2 PERPENDICULAR"); |
|
359 |
if(Math.abs(this.x - otherLine.x)<0.00001){ //Son la misma linea, devolvemos el primer punto de la otra linea. |
|
360 |
// System.out.println(" MISMA LINEA"); |
|
361 |
Y = otherLine.y; |
|
362 |
} else { //No son la misma linea, entonces son paralelas, excepcion. |
Also available in: Unified diff