Revision 33580
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
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 |
|
5 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
6 |
|
|
7 |
<modelVersion>4.0.0</modelVersion> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.symbology</artifactId> |
|
10 |
<packaging>jar</packaging> |
|
11 |
<version>2.0-SNAPSHOT</version> |
|
12 |
<name>org.gvsig.symbology</name> |
|
13 |
<description>[PUT EXTENSION DESCRIPTION HERE]</description> |
|
14 |
<url>http://www.gvsig.org</url> |
|
15 |
<scm> |
|
16 |
<connection>scm:svn:http://subversion.gvsig.org/gvSIG/branches/v2_0_0_prep/extensions/org.gvsig.symbology</connection> |
|
17 |
<developerConnection>scm:svn:https://gvsig.org/svn/gvSIG/branches/v2_0_0_prep/extensions/org.gvsig.symbology</developerConnection> |
|
18 |
<url>http://subversion.gvsig.org/viewvc/?root=gvSIG</url> |
|
19 |
<tag>HEAD</tag> |
|
20 |
</scm> |
|
21 |
<parent> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<!--artifactId>gvsig-base-extension-pom</artifactId--> |
|
24 |
<artifactId>gvsig-base-library-pom</artifactId> |
|
25 |
<version>2.0-SNAPSHOT</version> |
|
26 |
</parent> |
|
27 |
<distributionManagement> |
|
28 |
<site> |
|
29 |
<id>gvsig-repository</id> |
|
30 |
<url>${site-repository}/</url> |
|
31 |
</site> |
|
32 |
</distributionManagement> |
|
33 |
|
|
34 |
<properties> |
|
35 |
<build-dir>${basedir}/../build</build-dir> |
|
36 |
</properties> |
|
37 |
<developers> |
|
38 |
<developer> |
|
39 |
<id>developer1</id> |
|
40 |
<name>Name Surname</name> |
|
41 |
<email>name@domain</email> |
|
42 |
<roles> |
|
43 |
<role>Architect</role> |
|
44 |
<role>Developer</role> |
|
45 |
</roles> |
|
46 |
</developer> |
|
47 |
<developer> |
|
48 |
<id>developer2</id> |
|
49 |
<name>Name2 Surname</name> |
|
50 |
<email>name2@domain</email> |
|
51 |
<roles> |
|
52 |
<role>Developer</role> |
|
53 |
</roles> |
|
54 |
</developer> |
|
55 |
</developers> |
|
56 |
<dependencies> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
64 |
<classifier>tests</classifier> |
|
65 |
<scope>test</scope> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>org.gvsig</groupId> |
|
69 |
<artifactId>org.gvsig.utils</artifactId> |
|
70 |
<version>2.0-SNAPSHOT</version> |
|
71 |
</dependency> |
|
72 |
<dependency> |
|
73 |
<groupId>org.gvsig</groupId> |
|
74 |
<artifactId>org.gvsig.i18n</artifactId> |
|
75 |
<version>2.0-SNAPSHOT</version> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>org.gvsig</groupId> |
|
79 |
<artifactId>org.gvsig.compat</artifactId> |
|
80 |
<version>2.0-SNAPSHOT</version> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.compat</artifactId> |
|
85 |
<version>2.0-SNAPSHOT</version> |
|
86 |
<classifier>se</classifier> |
|
87 |
<scope>test</scope> |
|
88 |
</dependency> |
|
89 |
<dependency> |
|
90 |
<groupId>org.gvsig</groupId> |
|
91 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
92 |
<version>2.0-SNAPSHOT</version> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
97 |
<version>2.0-SNAPSHOT</version> |
|
98 |
<classifier>impl</classifier> |
|
99 |
<scope>test</scope> |
|
100 |
</dependency> |
|
101 |
<dependency> |
|
102 |
<groupId>org.gvsig</groupId> |
|
103 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
104 |
<version>2.0-SNAPSHOT</version> |
|
105 |
</dependency> |
|
106 |
<dependency> |
|
107 |
<groupId>org.gvsig</groupId> |
|
108 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
109 |
<version>2.0-SNAPSHOT</version> |
|
110 |
<classifier>operation</classifier> |
|
111 |
</dependency> |
|
112 |
<dependency> |
|
113 |
<groupId>org.gvsig</groupId> |
|
114 |
<artifactId>org.gvsig.projection</artifactId> |
|
115 |
<version>2.0-SNAPSHOT</version> |
|
116 |
<classifier>cresques-impl</classifier> |
|
117 |
<scope>test</scope> |
|
118 |
</dependency> |
|
119 |
<dependency> |
|
120 |
<groupId>org.gvsig</groupId> |
|
121 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
122 |
<version>2.0-SNAPSHOT</version> |
|
123 |
<classifier>impl</classifier> |
|
124 |
<scope>test</scope> |
|
125 |
</dependency> |
|
126 |
<dependency> |
|
127 |
<groupId>org.gvsig</groupId> |
|
128 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
129 |
<version>2.0-SNAPSHOT</version> |
|
130 |
<classifier>spi</classifier> |
|
131 |
<scope>test</scope> |
|
132 |
</dependency> |
|
133 |
<dependency> |
|
134 |
<groupId>org.gvsig</groupId> |
|
135 |
<artifactId>org.gvsig.metadata</artifactId> |
|
136 |
<version>2.0-SNAPSHOT</version> |
|
137 |
<classifier>simple</classifier> |
|
138 |
<scope>test</scope> |
|
139 |
</dependency> |
|
140 |
<dependency> |
|
141 |
<groupId>org.apache.xmlgraphics</groupId> |
|
142 |
<artifactId>batik-awt-util</artifactId> |
|
143 |
</dependency> |
|
144 |
</dependencies> |
|
145 |
<build> |
|
146 |
<resources> |
|
147 |
<resource> |
|
148 |
<directory>src/main/resources</directory> |
|
149 |
<excludes> |
|
150 |
<exclude>config/**</exclude> |
|
151 |
<exclude>about/**</exclude> |
|
152 |
<exclude>images/**</exclude> |
|
153 |
<exclude>locale/**</exclude> |
|
154 |
</excludes> |
|
155 |
</resource> |
|
156 |
</resources> |
|
157 |
<plugins> |
|
158 |
<plugin> |
|
159 |
<groupId>org.apache.maven.plugins</groupId> |
|
160 |
<artifactId>maven-jar-plugin</artifactId> |
|
161 |
<configuration> |
|
162 |
<excludes> |
|
163 |
<exclude>**/impl/**</exclude> |
|
164 |
</excludes> |
|
165 |
</configuration> |
|
166 |
<executions> |
|
167 |
<!-- |
|
168 |
Generates a jar file only with the mapcontext implementation |
|
169 |
--> |
|
170 |
<execution> |
|
171 |
<id>impl</id> |
|
172 |
<phase>package</phase> |
|
173 |
<goals> |
|
174 |
<goal>jar</goal> |
|
175 |
</goals> |
|
176 |
<configuration> |
|
177 |
<classifier>impl</classifier> |
|
178 |
<excludes> |
|
179 |
<exclude>NONE</exclude> |
|
180 |
</excludes> |
|
181 |
<includes> |
|
182 |
<include>**/impl/**</include> |
|
183 |
</includes> |
|
184 |
</configuration> |
|
185 |
</execution> |
|
186 |
</executions> |
|
187 |
</plugin> |
|
188 |
<plugin> |
|
189 |
<artifactId>maven-antrun-plugin</artifactId> |
|
190 |
<executions> |
|
191 |
<execution> |
|
192 |
<id>services</id> |
|
193 |
<phase>package</phase> |
|
194 |
<goals> |
|
195 |
<goal>run</goal> |
|
196 |
</goals> |
|
197 |
<configuration> |
|
198 |
<tasks> |
|
199 |
<jar destfile="${project.build.directory}/${project.build.finalName}.jar" |
|
200 |
update="true"> |
|
201 |
<fileset dir="${basedir}/resources/api" /> |
|
202 |
</jar> |
|
203 |
<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar" |
|
204 |
update="true"> |
|
205 |
<fileset dir="${basedir}/resources/impl" /> |
|
206 |
</jar> |
|
207 |
</tasks> |
|
208 |
</configuration> |
|
209 |
</execution> |
|
210 |
</executions> |
|
211 |
</plugin> |
|
212 |
<plugin> |
|
213 |
<groupId>org.apache.maven.plugins</groupId> |
|
214 |
<artifactId>maven-surefire-plugin</artifactId> |
|
215 |
<configuration> |
|
216 |
<additionalClasspathElements> |
|
217 |
<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement> |
|
218 |
<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement> |
|
219 |
</additionalClasspathElements> |
|
220 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
221 |
<skipTests>true</skipTests> |
|
222 |
</configuration> |
|
223 |
</plugin> |
|
224 |
<plugin> |
|
225 |
<groupId>org.apache.maven.plugins</groupId> |
|
226 |
<artifactId>maven-compiler-plugin</artifactId> |
|
227 |
<configuration> |
|
228 |
<testExcludes> |
|
229 |
<exclude>**</exclude> |
|
230 |
</testExcludes> |
|
231 |
</configuration> |
|
232 |
</plugin> |
|
233 |
|
|
234 |
</plugins> |
|
235 |
</build> |
|
236 |
<profiles> |
|
237 |
<profile> |
|
238 |
<id>eclipse-project</id> |
|
239 |
<build> |
|
240 |
<defaultGoal>antrun:run</defaultGoal> |
|
241 |
<plugins> |
|
242 |
<plugin> |
|
243 |
<artifactId>maven-antrun-plugin</artifactId> |
|
244 |
<configuration> |
|
245 |
<tasks> |
|
246 |
<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml" |
|
247 |
target="eclipse.all"/> |
|
248 |
</tasks> |
|
249 |
</configuration> |
|
250 |
</plugin> |
|
251 |
</plugins> |
|
252 |
</build> |
|
253 |
</profile> |
|
254 |
</profiles> |
|
255 |
<reporting> |
|
256 |
<plugins> |
|
257 |
<plugin> |
|
258 |
<groupId>org.apache.maven.plugins</groupId> |
|
259 |
<artifactId>maven-javadoc-plugin</artifactId> |
|
260 |
<configuration> |
|
261 |
<links> |
|
262 |
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link> |
|
263 |
<link>http://www.slf4j.org/api/</link> |
|
264 |
<link>${site-repository}/org.gvsig.tools/2.0.0/apidocs/</link> |
|
265 |
<link>${site-repository}/org.gvsig.i18n/2.0.0/apidocs/</link> |
|
266 |
<link>${site-repository}/org.gvsig.metadata/2.0.0/apidocs/</link> |
|
267 |
<link>${site-repository}/org.gvsig.compat/2.0.0/apidocs/</link> |
|
268 |
<link>${site-repository}/org.gvsig.projection/2.0.0/apidocs/</link> |
|
269 |
<link>${site-repository}/org.gvsig.utils/2.0.0/apidocs/</link> |
|
270 |
<link>${site-repository}/org.gvsig.fmap.dal/2.0.0/apidocs/</link> |
|
271 |
</links> |
|
272 |
</configuration> |
|
273 |
</plugin> |
|
274 |
</plugins> |
|
275 |
</reporting> |
|
276 |
</project> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/resources/impl/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.symbology.impl.SymbologyDefaultImplLibrary |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/resources/api/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.symbology.SymbologyLibrary |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/README.txt | ||
---|---|---|
1 |
The project structure of this project is the following: |
|
2 |
|
|
3 |
Project |
|
4 |
|-pom.xml: Maven 2 configuration file. |
|
5 |
`-src |
|
6 |
|-main: Project source code, resources and configuration |
|
7 |
| |-java: Java source code |
|
8 |
| |-resources: Resources needed by the code (resource bundles, images, etc.) |
|
9 |
|`-javadoc: Javadoc common resources |
|
10 |
`-test: Unit tests source code, resources and configuration |
|
11 |
|-java: Unit tests java source code |
|
12 |
`-resources: Resources needed by the test code (resource bundles, images, etc.) |
|
13 |
|
|
14 |
Look at the main folders for a README.txt file with more information on the |
|
15 |
contents of each folder. |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<!-- Extructure for the extension --> |
|
8 |
<fileSet> |
|
9 |
<directory>src/main/resources/config</directory> |
|
10 |
<outputDirectory>${extension.install.dir.name} |
|
11 |
</outputDirectory> |
|
12 |
</fileSet> |
|
13 |
<fileSet> |
|
14 |
<directory>src/main/resources/images</directory> |
|
15 |
<outputDirectory>${extension.install.dir.name}/images |
|
16 |
</outputDirectory> |
|
17 |
</fileSet> |
|
18 |
<fileSet> |
|
19 |
<directory>src/main/resources/about</directory> |
|
20 |
<outputDirectory>${extension.install.dir.name} |
|
21 |
</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
<fileSet> |
|
24 |
<directory>src/main/resources/locale</directory> |
|
25 |
<outputDirectory>${extension.install.dir.name} |
|
26 |
</outputDirectory> |
|
27 |
</fileSet> |
|
28 |
</fileSets> |
|
29 |
<files> |
|
30 |
<file> |
|
31 |
<source>src/main/resources/build.number</source> |
|
32 |
<outputDirectory>${extension.install.dir.name} |
|
33 |
</outputDirectory> |
|
34 |
</file> |
|
35 |
</files> |
|
36 |
|
|
37 |
<dependencySets> |
|
38 |
<dependencySet> |
|
39 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
40 |
</outputDirectory> |
|
41 |
<includes> |
|
42 |
<include>org.gvsig:org.gvsig.symbology</include> |
|
43 |
</includes> |
|
44 |
</dependencySet> |
|
45 |
</dependencySets> |
|
46 |
</assembly> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/javadoc/overview.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.template.extension package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example extension overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your extension classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find: |
|
7 |
|
|
8 |
- about: the HTML content for the gvSIG about panel. |
|
9 |
|
|
10 |
- config: the Andami plugin config.xml file. |
|
11 |
|
|
12 |
- images: some images and icons used by the extension. |
|
13 |
|
|
14 |
- org.gvsig.template.extension.i18n: resource bundle property files with the |
|
15 |
translated texts. |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/resources/locale/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Centrar_la_Vista_sobre_un_punto=Centrar la vista sobre un punto |
|
3 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Debe seleccionar las capas de las que quiera obtener informaci\u00f3n. |
|
4 |
formato_de_numero_incorrecto=Formato de n\u00famero incorrecto. |
|
5 |
no_hay_ninguna_capa_seleccionada=No hay ninguna capa seleccionada |
|
6 |
Vista=Vista |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/resources/locale/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Centrar_la_Vista_sobre_un_punto=Center view to point |
|
3 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Select the layers you want to get information from |
|
4 |
formato_de_numero_incorrecto=Incorrect number format |
|
5 |
no_hay_ninguna_capa_seleccionada=No layer has been selected |
|
6 |
Vista=View |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/resources/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="lib"/> |
|
4 |
<depends plugin-name="org.gvsig.app"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.symbology.ExampleExtension" |
|
8 |
description="Extensi?n plantilla con ejemplo que permite hacer zooms en funci?n de un par de coordenadas introducidas por el usuario." |
|
9 |
active="true"> |
|
10 |
<menu text="Vista/Centrar_la_Vista_sobre_un_punto" |
|
11 |
tooltip="Centrar_la_Vista_sobre_un_punto" |
|
12 |
action-command="CENTERVIEWTOPOINT" |
|
13 |
icon="view-center-to-point" /> |
|
14 |
<tool-bar name="Herramientas"> |
|
15 |
<action-tool icon="view-center-to-point" |
|
16 |
action-command="CENTERVIEWTOPOINT" |
|
17 |
tooltip="Centrar_la_Vista_sobre_un_punto" |
|
18 |
enable-text="deber?a de estar activada" |
|
19 |
last="true"/> |
|
20 |
</tool-bar> |
|
21 |
</extension> |
|
22 |
</extensions> |
|
23 |
</plugin-config> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/resources/about/about.htm | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<title>Extensi?n de ejemplo para GvSIG</title> |
|
4 |
<meta content=""> |
|
5 |
<style></style> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
<table width="60%" border="0"> |
|
9 |
<tr> |
|
10 |
<td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td> |
|
11 |
</tr> |
|
12 |
<tr> |
|
13 |
<td colspan="2"><font face="Arial, Helvetica, sans-serif">© Copyright |
|
14 |
Generalitat Valenciana 2005.</font></td> |
|
15 |
</tr> |
|
16 |
</table> |
|
17 |
<h3>Extensión de Ejemplo</h3> |
|
18 |
<b>Code name: org.gvsig.symbology-0.1.0-#build.number#</b> |
|
19 |
</body> |
|
20 |
</html> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/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.template.extension package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example extension description.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#packagecomment">Javadoc Tool documentation about the package file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/SymbologyManager.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; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
|
30 |
|
|
31 |
|
|
32 |
/** |
|
33 |
* Basic symbology manager. |
|
34 |
* |
|
35 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
36 |
*/ |
|
37 |
public interface SymbologyManager { |
|
38 |
|
|
39 |
/** |
|
40 |
* Creates a new interval with the given limit values |
|
41 |
* |
|
42 |
* @param min |
|
43 |
* the minimum included interval value |
|
44 |
* @param max |
|
45 |
* the maximum included interval value |
|
46 |
* @return a new interval |
|
47 |
*/ |
|
48 |
IInterval createInterval(double min, double max); |
|
49 |
|
|
50 |
} |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/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 org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
|
30 |
import org.gvsig.symbology.SymbologyManager; |
|
31 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
|
32 |
|
|
33 |
/** |
|
34 |
* Default {@link SymbologyManager} implementation. |
|
35 |
* |
|
36 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
37 |
*/ |
|
38 |
public class DefaultSymbologyManager implements SymbologyManager { |
|
39 |
|
|
40 |
public IInterval createInterval(double min, double max) { |
|
41 |
return new FInterval(min, max); |
|
42 |
} |
|
43 |
|
|
44 |
} |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/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 java.util.ArrayList; |
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import org.gvsig.fmap.geom.Geometry; |
|
33 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
34 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
35 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
36 |
import org.gvsig.fmap.mapcontext.rendering.legend.ISingleSymbolLegend; |
|
37 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialIntervalLegend; |
|
38 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend; |
|
39 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
|
40 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
|
41 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
|
42 |
import org.gvsig.symbology.SymbologyLocator; |
|
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend; |
|
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend; |
|
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractLegend; |
|
46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend; |
|
47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
|
48 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.SingleSymbolLegend; |
|
49 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialIntervalLegend; |
|
50 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend; |
|
51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy; |
|
52 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.DefaultLabelingMethod; |
|
53 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelClass; |
|
54 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.ZoomConstraintsImpl; |
|
55 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
|
56 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.AbstractFillSymbol; |
|
57 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MultiLayerFillSymbol; |
|
58 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
|
59 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
60 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol; |
|
61 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
|
62 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.AbstractLineSymbol; |
|
63 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.MultiLayerLineSymbol; |
|
64 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol; |
|
65 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
|
66 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.AbstractMarkerSymbol; |
|
67 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.ArrowMarkerSymbol; |
|
68 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.MultiLayerMarkerSymbol; |
|
69 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol; |
|
70 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.AbstractStyle; |
|
71 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ArrowDecoratorStyle; |
|
72 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.DefaultMask; |
|
73 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLineStyle; |
|
74 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
|
75 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.warning.impl.WarningSymbol; |
|
76 |
import org.gvsig.tools.exception.ListBaseException; |
|
77 |
import org.gvsig.tools.library.AbstractLibrary; |
|
78 |
import org.gvsig.tools.library.LibraryException; |
|
79 |
import org.slf4j.Logger; |
|
80 |
import org.slf4j.LoggerFactory; |
|
81 |
|
|
82 |
/** |
|
83 |
* Library for the Basic Symbology implementation. |
|
84 |
* |
|
85 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
86 |
*/ |
|
87 |
public class SymbologyDefaultImplLibrary extends AbstractLibrary { |
|
88 |
|
|
89 |
private Logger LOG = |
|
90 |
LoggerFactory.getLogger(SymbologyDefaultImplLibrary.class); |
|
91 |
|
|
92 |
protected void doInitialize() throws LibraryException { |
|
93 |
// Nothing to do |
|
94 |
} |
|
95 |
|
|
96 |
@SuppressWarnings({ "rawtypes", "unchecked" }) |
|
97 |
protected void doPostInitialize() throws LibraryException { |
|
98 |
List exs = new ArrayList(); |
|
99 |
|
|
100 |
MapContextManager manager = MapContextLocator.getMapContextManager(); |
|
101 |
try { |
|
102 |
registerSymbols(manager); |
|
103 |
} catch (Exception e) { |
|
104 |
exs.add(e); |
|
105 |
} |
|
106 |
try { |
|
107 |
registerSymbolsPersistence(); |
|
108 |
} catch (Exception e) { |
|
109 |
exs.add(e); |
|
110 |
} |
|
111 |
|
|
112 |
try { |
|
113 |
registerLegends(manager); |
|
114 |
} catch (Exception e) { |
|
115 |
exs.add(e); |
|
116 |
} |
|
117 |
|
|
118 |
try { |
|
119 |
registerLegendsPersistence(); |
|
120 |
} catch (Exception e) { |
|
121 |
exs.add(e); |
|
122 |
} |
|
123 |
|
|
124 |
try { |
|
125 |
registerLabelingPersistence(); |
|
126 |
} catch (Exception e) { |
|
127 |
exs.add(e); |
|
128 |
} |
|
129 |
|
|
130 |
try { |
|
131 |
SymbologyLocator.registerSymbologyManager(DefaultSymbologyManager.class); |
|
132 |
} catch (Exception e) { |
|
133 |
exs.add(e); |
|
134 |
} |
|
135 |
|
|
136 |
if (exs.size() > 0) { |
|
137 |
LibraryException ex = new LibraryException(this.getClass(), exs); |
|
138 |
LOG.warn(((ListBaseException) (ex.getCause())).getMessageStack()); |
|
139 |
throw ex; |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* Registers symbol implementations in the {@link MapContextManager}. |
|
145 |
*/ |
|
146 |
private void registerSymbols(MapContextManager manager) throws MapContextException { |
|
147 |
|
|
148 |
SymbolManager symbolManager = manager.getSymbolManager(); |
|
149 |
|
|
150 |
// Fill |
|
151 |
int[] shapeTypes = |
|
152 |
new int[] { Geometry.TYPES.SURFACE, Geometry.TYPES.CIRCLE, |
|
153 |
Geometry.TYPES.ELLIPSE, Geometry.TYPES.MULTISURFACE }; |
|
154 |
symbolManager.registerSymbol(IFillSymbol.SYMBOL_NAME, |
|
155 |
shapeTypes, |
|
156 |
SimpleFillSymbol.class); |
|
157 |
symbolManager.registerMultiLayerSymbol(IFillSymbol.SYMBOL_NAME, |
|
158 |
shapeTypes, |
|
159 |
MultiLayerFillSymbol.class); |
|
160 |
|
|
161 |
// Line |
|
162 |
shapeTypes = |
|
163 |
new int[] { Geometry.TYPES.CURVE, Geometry.TYPES.ARC, |
|
164 |
Geometry.TYPES.ELLIPTICARC, Geometry.TYPES.MULTICURVE }; |
|
165 |
symbolManager.registerSymbol(ILineSymbol.SYMBOL_NAME, |
|
166 |
shapeTypes, |
|
167 |
SimpleLineSymbol.class); |
|
168 |
symbolManager.registerMultiLayerSymbol(ILineSymbol.SYMBOL_NAME, |
|
169 |
shapeTypes, |
|
170 |
MultiLayerLineSymbol.class); |
|
171 |
|
|
172 |
// Marker |
|
173 |
shapeTypes = |
|
174 |
new int[] { Geometry.TYPES.POINT, Geometry.TYPES.MULTIPOINT }; |
|
175 |
symbolManager.registerSymbol(IMarkerSymbol.SYMBOL_NAME, |
|
176 |
shapeTypes, |
|
177 |
SimpleMarkerSymbol.class); |
|
178 |
symbolManager.registerMultiLayerSymbol(IMarkerSymbol.SYMBOL_NAME, |
|
179 |
shapeTypes, |
|
180 |
MultiLayerMarkerSymbol.class); |
|
181 |
|
|
182 |
// Text |
|
183 |
shapeTypes = new int[] { Geometry.TYPES.TEXT }; |
|
184 |
symbolManager.registerSymbol(ITextSymbol.SYMBOL_NAME, |
|
185 |
shapeTypes, |
|
186 |
SimpleTextSymbol.class); |
|
187 |
|
|
188 |
// MultiShape |
|
189 |
shapeTypes = new int[] { Geometry.TYPES.GEOMETRY }; |
|
190 |
symbolManager.registerSymbol(MultiShapeSymbol.SYMBOL_NAME, |
|
191 |
shapeTypes, |
|
192 |
MultiShapeSymbol.class); |
|
193 |
|
|
194 |
// Warning |
|
195 |
symbolManager.registerSymbol(IWarningSymbol.SYMBOL_NAME, |
|
196 |
WarningSymbol.class); |
|
197 |
} |
|
198 |
|
|
199 |
/** |
|
200 |
* Registers legend implementations in the {@link MapContextManager}. |
|
201 |
*/ |
|
202 |
private void registerLegends(MapContextManager manager) { |
|
203 |
List<Exception> exceptions = new ArrayList<Exception>(); |
|
204 |
|
|
205 |
try { |
|
206 |
manager.registerLegend(IVectorialUniqueValueLegend.LEGEND_NAME, |
|
207 |
VectorialUniqueValueLegend.class); |
|
208 |
} catch (Exception ex) { |
|
209 |
exceptions.add(ex); |
|
210 |
} |
|
211 |
try { |
|
212 |
manager.registerLegend(IVectorialIntervalLegend.LEGEND_NAME, |
|
213 |
VectorialIntervalLegend.class); |
|
214 |
} catch (Exception ex) { |
|
215 |
exceptions.add(ex); |
|
216 |
} |
|
217 |
try { |
|
218 |
manager.registerLegend(ISingleSymbolLegend.LEGEND_NAME, |
|
219 |
SingleSymbolLegend.class); |
|
220 |
|
|
221 |
} catch (Exception ex) { |
|
222 |
exceptions.add(ex); |
|
223 |
} |
|
224 |
if (exceptions.size() > 0) { |
|
225 |
throw new LibraryException(this.getClass(), exceptions); |
|
226 |
} |
|
227 |
|
|
228 |
} |
|
229 |
|
|
230 |
private void registerLabelingPersistence() { |
|
231 |
ZoomConstraintsImpl.registerPersistence(); |
|
232 |
LabelClass.registerPersistence(); |
|
233 |
DefaultLabelingMethod.registerPersistence(); |
|
234 |
AttrInTableLabelingStrategy.registerPersistence(); |
|
235 |
} |
|
236 |
|
|
237 |
/** |
|
238 |
* Register dynclass and persistence definitions for Legend classes. |
|
239 |
*/ |
|
240 |
private void registerLegendsPersistence() { |
|
241 |
AbstractLegend.registerPersistence(); |
|
242 |
AbstractVectorialLegend.registerPersistence(); |
|
243 |
AbstractClassifiedVectorLegend.registerPersistence(); |
|
244 |
FInterval.registerPersistence(); |
|
245 |
AbstractIntervalLegend.registerPersistence(); |
|
246 |
VectorialIntervalLegend.registerPersistence(); |
|
247 |
VectorialUniqueValueLegend.registerPersistence(); |
|
248 |
SingleSymbolLegend.registerPersistence(); |
|
249 |
} |
|
250 |
|
|
251 |
/** |
|
252 |
* Register dynclass and persistence definitions for Symbol classes. |
|
253 |
*/ |
|
254 |
private void registerSymbolsPersistence() { |
|
255 |
// Styles |
|
256 |
AbstractStyle.registerPersistence(); |
|
257 |
ArrowDecoratorStyle.registerPersistence(); |
|
258 |
DefaultMask.registerPersistence(); |
|
259 |
SimpleLineStyle.registerPersistence(); |
|
260 |
|
|
261 |
// Base symbol |
|
262 |
AbstractSymbol.registerPersistence(); |
|
263 |
|
|
264 |
// Fill symbols |
|
265 |
AbstractFillSymbol.registerPersistence(); |
|
266 |
SimpleFillSymbol.registerPersistence(); |
|
267 |
MultiLayerFillSymbol.registerPersistence(); |
|
268 |
|
|
269 |
// Line symbols |
|
270 |
AbstractLineSymbol.registerPersistence(); |
|
271 |
SimpleLineSymbol.registerPersistence(); |
|
272 |
MultiLayerLineSymbol.registerPersistence(); |
|
273 |
|
|
274 |
// Marker symbols |
|
275 |
AbstractMarkerSymbol.registerPersistence(); |
|
276 |
SimpleMarkerSymbol.registerPersistence(); |
|
277 |
ArrowMarkerSymbol.registerPersistence(); |
|
278 |
MultiLayerMarkerSymbol.registerPersistence(); |
|
279 |
|
|
280 |
// Text symbols |
|
281 |
SimpleTextSymbol.registerPersistence(); |
|
282 |
|
|
283 |
// MultiShape symbol |
|
284 |
MultiShapeSymbol.registerPersistence(); |
|
285 |
|
|
286 |
// Warning symbol |
|
287 |
WarningSymbol.registerPersistence(); |
|
288 |
} |
|
289 |
} |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/warning/impl/WarningSymbol.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.warning.impl; |
|
23 |
|
|
24 |
import java.awt.BasicStroke; |
|
25 |
import java.awt.Color; |
|
26 |
import java.awt.Font; |
|
27 |
import java.awt.Graphics2D; |
|
28 |
import java.awt.Rectangle; |
|
29 |
import java.awt.geom.AffineTransform; |
|
30 |
import java.awt.geom.Ellipse2D; |
|
31 |
|
|
32 |
import org.gvsig.compat.CompatLocator; |
|
33 |
import org.gvsig.compat.print.PrintAttributes; |
|
34 |
import org.gvsig.fmap.geom.Geometry; |
|
35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
|
36 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
|
37 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend; |
|
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol; |
|
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
|
40 |
import org.gvsig.tools.ToolsLocator; |
|
41 |
import org.gvsig.tools.dynobject.DynClass; |
|
42 |
import org.gvsig.tools.dynobject.DynStruct; |
|
43 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
44 |
import org.gvsig.tools.persistence.PersistentState; |
|
45 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
46 |
import org.gvsig.tools.task.Cancellable; |
|
47 |
|
|
48 |
/** |
|
49 |
* Warning symbol |
|
50 |
* |
|
51 |
* @author 2005-2008 jaume dominguez faus - jaume.dominguez@iver.es |
|
52 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
53 |
*/ |
|
54 |
public class WarningSymbol extends MultiShapeSymbol implements IWarningSymbol { |
|
55 |
|
|
56 |
public static final String WARNING_SYMBOL_DYNCLASS_NAME = "WarningSymbol"; |
|
57 |
|
|
58 |
private static final String FIELD_DESCRIPTION = "description"; |
|
59 |
private static final String FIELD_MESSAGE = "message"; |
|
60 |
private static final String FIELD_EXCEPTION_TYPE = "exceptionType"; |
|
61 |
|
|
62 |
private String message; |
|
63 |
private int exceptionType; |
|
64 |
private SimpleTextSymbol text; |
|
65 |
|
|
66 |
/** |
|
67 |
* Empty constructor, only used in persistence. |
|
68 |
*/ |
|
69 |
public WarningSymbol() { |
|
70 |
// Nothing to do |
|
71 |
} |
|
72 |
|
|
73 |
public WarningSymbol(String message, String symbolDesc, |
|
74 |
int symbolDrawExceptionType) { |
|
75 |
this.message = message; |
|
76 |
this.exceptionType = symbolDrawExceptionType; |
|
77 |
setDescription(symbolDesc); |
|
78 |
} |
|
79 |
|
|
80 |
public void draw(Graphics2D g, AffineTransform affineTransform, |
|
81 |
Geometry geom, Cancellable cancel) { |
|
82 |
try { |
|
83 |
drawInsideRectangle(g, g.getTransform(), geom.getBounds(), null); |
|
84 |
} catch (SymbolDrawingException e) { |
|
85 |
// IMPOSSIBLE |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
public void setDrawExceptionType(int symbolDrawExceptionType) { |
|
90 |
this.exceptionType = symbolDrawExceptionType; |
|
91 |
} |
|
92 |
|
|
93 |
public void setMessage(String message) { |
|
94 |
this.message = message; |
|
95 |
} |
|
96 |
|
|
97 |
private String getMessage() { |
|
98 |
return message; |
|
99 |
} |
|
100 |
|
|
101 |
public void drawInsideRectangle(Graphics2D g, |
|
102 |
AffineTransform scaleInstance, Rectangle r, |
|
103 |
PrintAttributes properties) throws SymbolDrawingException { |
|
104 |
g.setClip(r); |
|
105 |
if (message == null) { |
|
106 |
message = "Symbol undrawable.\nPlease, check errors."; |
|
107 |
} |
|
108 |
|
|
109 |
String[] messageLines = CompatLocator.getStringUtils().split(message, |
|
110 |
"\n"); |
|
111 |
int strokeWidth = (int) (Math.min(r.width, r.height) * .1); |
|
112 |
|
|
113 |
if (strokeWidth == 0) { |
|
114 |
strokeWidth = 1; |
|
115 |
} |
|
116 |
g.setColor(Color.red); |
|
117 |
g.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_BUTT, |
|
118 |
BasicStroke.JOIN_ROUND)); |
|
119 |
int width = r.width - (strokeWidth + strokeWidth); |
|
120 |
int height = r.height - (strokeWidth + strokeWidth); |
|
121 |
double radius = Math.min(width, height) * .5; |
|
122 |
double centerX = r.getCenterX(); |
|
123 |
double centerY = r.getCenterY(); |
|
124 |
Ellipse2D circle = new Ellipse2D.Double(centerX - radius, centerY |
|
125 |
- radius, 2 * radius, 2 * radius); |
|
126 |
g.draw(circle); |
|
127 |
g.setClip(circle); |
|
128 |
double aux = Math.cos(Math.PI * 0.25) * radius; |
|
129 |
g.drawLine((int) (centerX - aux), (int) (centerY - aux), |
|
130 |
(int) (centerX + aux), (int) (centerY + aux)); |
|
131 |
int fontSize = 20; |
|
132 |
g.setFont(new Font("Arial", fontSize, Font.PLAIN)); |
|
133 |
g.setColor(Color.black); |
|
134 |
g.setClip(null); |
|
135 |
|
|
136 |
if (text == null) { |
|
137 |
text = new SimpleTextSymbol(); |
|
138 |
text.setAutoresizeEnabled(true); |
|
139 |
|
|
140 |
} |
|
141 |
|
|
142 |
double lineHeight = (r.getHeight() - 6) / messageLines.length; |
|
143 |
Rectangle textRect = new Rectangle((int) r.getMinX(), |
|
144 |
(int) r.getMinY() + 6, (int) r.getWidth(), (int) lineHeight); |
|
145 |
for (int i = 0; i < messageLines.length; i++) { |
|
146 |
text.setText(messageLines[i]); |
|
147 |
text.drawInsideRectangle(g, null, textRect, null); |
|
148 |
textRect.setLocation((int) r.getX(), (int) (r.getY() + r |
|
149 |
.getHeight())); |
|
150 |
} |
|
151 |
} |
|
152 |
|
|
153 |
public Object clone() throws CloneNotSupportedException { |
|
154 |
WarningSymbol copy = (WarningSymbol) super.clone(); |
|
155 |
|
|
156 |
if (text != null) { |
|
157 |
copy.text = (SimpleTextSymbol) text.clone(); |
|
158 |
} |
|
159 |
|
|
160 |
return copy; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* @return the exceptionType |
|
165 |
*/ |
|
166 |
private int getExceptionType() { |
|
167 |
return exceptionType; |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* @param exceptionType |
|
172 |
* the exceptionType to set |
|
173 |
*/ |
|
174 |
private void setExceptionType(int exceptionType) { |
|
175 |
this.exceptionType = exceptionType; |
|
176 |
} |
|
177 |
|
|
178 |
public void loadFromState(PersistentState state) |
|
179 |
throws PersistenceException { |
|
180 |
setDescription(state.getString(FIELD_DESCRIPTION)); |
|
181 |
setExceptionType(state.getInt(FIELD_EXCEPTION_TYPE)); |
|
182 |
setMessage(state.getString(FIELD_MESSAGE)); |
|
183 |
} |
|
184 |
|
|
185 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
186 |
state.set(FIELD_DESCRIPTION, getDescription()); |
|
187 |
state.set(FIELD_EXCEPTION_TYPE, getExceptionType()); |
|
188 |
state.set(FIELD_MESSAGE, getMessage()); |
|
189 |
} |
|
190 |
|
|
191 |
public static void registerPersistence() { |
|
192 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
193 |
DynStruct definition = manager.addDefinition( |
|
194 |
WarningSymbol.class, |
|
195 |
WARNING_SYMBOL_DYNCLASS_NAME, |
|
196 |
WARNING_SYMBOL_DYNCLASS_NAME+" Persistence definition", |
|
197 |
null, |
|
198 |
null |
|
199 |
); |
|
200 |
// Description |
|
201 |
definition.addDynFieldString(FIELD_DESCRIPTION).setMandatory(true); |
|
202 |
// Exception type |
|
203 |
definition.addDynFieldInt(FIELD_EXCEPTION_TYPE).setMandatory(true); |
|
204 |
// Message |
|
205 |
definition.addDynFieldString(FIELD_MESSAGE).setMandatory(true); |
|
206 |
} |
|
207 |
|
|
208 |
// public static void main(String[] args) { |
|
209 |
// MapContextImplLibrary mapContextImplLibrary = new |
|
210 |
// MapContextImplLibrary(); |
|
211 |
// SECompatLibrary compatLibrary = new SECompatLibrary(); |
|
212 |
// DefaultGeometryLibrary geometryLibrary = new DefaultGeometryLibrary(); |
|
213 |
// |
|
214 |
// mapContextImplLibrary.initialize(); |
|
215 |
// compatLibrary.initialize(); |
|
216 |
// geometryLibrary.initialize(); |
|
217 |
// mapContextImplLibrary.postInitialize(); |
|
218 |
// compatLibrary.postInitialize(); |
|
219 |
// geometryLibrary.postInitialize(); |
|
220 |
// |
|
221 |
// JFrame f = new JFrame(); |
|
222 |
// final ISymbol warning = new WarningSymbol( |
|
223 |
// SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, |
|
224 |
// "a description", |
|
225 |
// SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS); |
|
226 |
// JPanel preview = new JPanel() { |
|
227 |
// protected void paintComponent(Graphics g) { |
|
228 |
// // TODO Auto-generated method stub |
|
229 |
// super.paintComponent(g); |
|
230 |
// Graphics2D g2 = (Graphics2D) g; |
|
231 |
// try { |
|
232 |
// warning.drawInsideRectangle(g2, g2.getTransform(), |
|
233 |
// getBounds(), null); |
|
234 |
// } catch (SymbolDrawingException e) { |
|
235 |
// // TODO Auto-generated catch block |
|
236 |
// e.printStackTrace(); |
|
237 |
// } |
|
238 |
// } |
|
239 |
// }; |
|
240 |
// f.setContentPane(preview); |
|
241 |
// f.pack(); |
|
242 |
// f.setVisible(true); |
|
243 |
// } |
|
244 |
|
|
245 |
} |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/IFillSymbol.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 |
|
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id: IFillSymbol.java 21071 2008-06-02 10:55:35Z vcaballero $ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.3 2007-08-13 11:36:50 jvidal |
|
47 |
* javadoc |
|
48 |
* |
|
49 |
* Revision 1.2 2007/03/09 11:20:56 jaume |
|
50 |
* Advanced symbology (start committing) |
|
51 |
* |
|
52 |
* Revision 1.1.2.2 2007/02/21 16:09:02 jaume |
|
53 |
* *** empty log message *** |
|
54 |
* |
|
55 |
* Revision 1.1.2.1 2007/02/16 10:54:12 jaume |
|
56 |
* multilayer splitted to multilayerline, multilayermarker,and multilayerfill |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
package org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill; |
|
61 |
|
|
62 |
import java.awt.Color; |
|
63 |
|
|
64 |
import org.gvsig.fmap.geom.Geometry; |
|
65 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
66 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
67 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
|
68 |
|
|
69 |
|
|
70 |
/** |
|
71 |
* Interface that extends ISymbol interface in order to define methods for |
|
72 |
* fill symbols which can manage specific attributes of them. |
|
73 |
* |
|
74 |
* |
|
75 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
76 |
*/ |
|
77 |
|
|
78 |
public interface IFillSymbol extends ISymbol, CartographicSupport{ |
|
79 |
|
|
80 |
public static final String SYMBOL_NAME = "fill"; |
|
81 |
|
|
82 |
public abstract boolean isSuitableFor(Geometry geom); |
|
83 |
|
|
84 |
public abstract int getOnePointRgb(); |
|
85 |
|
|
86 |
/** |
|
87 |
* Sets the color that will be used to draw the filling pattern of this symbol. |
|
88 |
* |
|
89 |
* @param Color |
|
90 |
*/ |
|
91 |
public abstract void setFillColor(Color color); |
|
92 |
|
|
93 |
/** |
|
94 |
* Sets the color of the outline. |
|
95 |
* @deprectated will be substituted by setOutline(AbstractLineSymbol); |
|
96 |
* @param color |
|
97 |
*/ |
|
98 |
public abstract void setOutline(ILineSymbol outline); |
|
99 |
|
|
100 |
/** |
|
101 |
* @return Returns the color. |
|
102 |
*/ |
|
103 |
public abstract Color getFillColor(); |
|
104 |
|
|
105 |
/** |
|
106 |
* Obtains the ILineSymbol interface of the outline |
|
107 |
* @return the outline,ILineSymbol. |
|
108 |
*/ |
|
109 |
public abstract ILineSymbol getOutline(); |
|
110 |
/** |
|
111 |
* Obtains the transparency of the fill symbol |
|
112 |
* @return the transparency of the fill symbol |
|
113 |
*/ |
|
114 |
|
|
115 |
public abstract int getFillAlpha(); |
|
116 |
|
|
117 |
public abstract boolean hasFill(); |
|
118 |
|
|
119 |
public abstract void setHasFill(boolean hasFill); |
|
120 |
|
|
121 |
public abstract boolean hasOutline(); |
|
122 |
|
|
123 |
public abstract void setHasOutline(boolean hasOutline); |
|
124 |
} |
tags/v2_0_0_Build_2011/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/AbstractFillSymbol.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.fill.impl; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
|
|
26 |
import org.gvsig.fmap.geom.Geometry; |
|
27 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
28 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
29 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
|
30 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
31 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.CartographicSupportToolkit; |
|
32 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
37 |
|
|
38 |
/** |
|
39 |
* Abstract class that any FILL SYMBOL should extend |
|
40 |
* |
|
41 |
* @author 2005-2008 jaume dominguez faus - jaume.dominguez@iver.es |
|
42 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
43 |
*/ |
|
44 |
public abstract class AbstractFillSymbol extends AbstractSymbol implements |
|
45 |
IFillSymbol { |
|
46 |
|
|
47 |
public static final String FILL_SYMBOL_DYNCLASS_NAME = "FillSymbol"; |
|
48 |
|
|
49 |
private static final String FIELD_OUTLINE = "outline"; |
|
50 |
|
|
51 |
private static final String FIELD_HAS_OUTLINE = "hasOutline"; |
|
52 |
|
|
53 |
private static final String FIELD_HAS_FILL = "hasFill"; |
|
54 |
|
|
55 |
private static final String FIELD_COLOR = "color"; |
|
56 |
|
|
57 |
private boolean hasFill = true; |
|
58 |
private boolean hasOutline = true; |
|
59 |
private Color color; |
|
60 |
private ILineSymbol outline; |
|
61 |
|
|
62 |
public AbstractFillSymbol() { |
|
63 |
super(); |
|
64 |
color = |
|
65 |
MapContextLocator.getSymbolManager() |
|
66 |
.getSymbolPreferences() |
|
67 |
.getDefaultSymbolFillColor(); |
|
68 |
|
|
69 |
outline = |
|
70 |
(ILineSymbol) MapContextLocator.getSymbolManager() |
|
71 |
.createSymbol(ILineSymbol.SYMBOL_NAME); |
|
72 |
|
|
73 |
} |
|
74 |
|
|
75 |
public boolean isSuitableFor(Geometry geom) { |
|
76 |
return geom.getType() == Geometry.TYPES.SURFACE; |
|
77 |
} |
|
78 |
|
|
79 |
public int getOnePointRgb() { |
|
80 |
int rgb = 0; |
|
81 |
if (outline != null) { |
|
82 |
rgb = outline.getOnePointRgb(); |
|
83 |
} else if (color != null) { |
|
84 |
rgb = color.getRGB(); |
|
85 |
} |
|
86 |
return rgb; |
|
87 |
} |
|
88 |
|
|
89 |
public void getPixExtentPlus(Geometry geom, float[] distances, |
|
90 |
ViewPort viewPort, int dpi) { |
|
91 |
if (getOutline() != null) { |
|
92 |
getOutline().getPixExtentPlus(geom, distances, viewPort, dpi); |
|
93 |
} else { |
|
94 |
distances[0] = 0; |
|
95 |
distances[1] = 0; |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
public void setFillColor(Color color) { |
|
100 |
this.color = color; |
|
101 |
} |
|
102 |
|
|
103 |
public void setOutline(ILineSymbol outline) { |
|
104 |
this.outline = outline; |
|
105 |
} |
|
106 |
|
|
107 |
public Color getFillColor() { |
|
108 |
return color; |
|
109 |
} |
|
110 |
|
|
111 |
public ILineSymbol getOutline() { |
|
112 |
return outline; |
|
113 |
} |
|
114 |
|
|
115 |
public int getFillAlpha() { |
|
116 |
// TODO debatir si es correcto o no (por ejemplo cuando hablamos de |
|
117 |
// LineFillSymbol's |
|
118 |
if (color == null) |
|
119 |
return 255; |
|
120 |
return color.getAlpha(); |
|
121 |
} |
|
122 |
|
|
123 |
public void setCartographicSize(double cartographicSize, Geometry geom) { |
|
124 |
if (getOutline() != null) { |
|
125 |
getOutline().setLineWidth(cartographicSize); |
|
126 |
} |
|
127 |
} |
|
128 |
|
|
129 |
public double toCartographicSize(ViewPort viewPort, double dpi, |
|
130 |
Geometry geom) { |
|
131 |
if (getOutline() != null) { |
|
132 |
double oldSize = getOutline().getLineWidth(); |
|
133 |
setCartographicSize(getCartographicSize(viewPort, dpi, geom), geom); |
|
134 |
return oldSize; |
|
135 |
} |
|
136 |
return 0; |
|
137 |
} |
|
138 |
|
|
139 |
public boolean hasFill() { |
|
140 |
return hasFill; |
|
141 |
} |
|
142 |
|
|
143 |
public void setHasFill(boolean hasFill) { |
|
144 |
this.hasFill = hasFill; |
|
145 |
} |
|
146 |
|
|
147 |
public boolean hasOutline() { |
|
148 |
return hasOutline; |
|
149 |
} |
|
150 |
|
|
151 |
public void setHasOutline(boolean hasOutline) { |
|
152 |
this.hasOutline = hasOutline; |
|
153 |
} |
|
154 |
|
|
155 |
public double getCartographicSize(ViewPort viewPort, double dpi, |
|
156 |
Geometry geom) { |
|
157 |
if (getOutline() != null) { |
|
158 |
return CartographicSupportToolkit.getCartographicLength(this, |
|
159 |
getOutline().getLineWidth(), viewPort, dpi); |
|
160 |
} |
|
161 |
return 0; |
|
162 |
} |
|
163 |
|
|
164 |
public void setUnit(int unitIndex) { |
|
165 |
super.setUnit(unitIndex); |
|
166 |
if (getOutline() != null) { |
|
167 |
getOutline().setUnit(unitIndex); |
|
168 |
} |
|
169 |
} |
|
170 |
|
|
171 |
public Color getColor() { |
|
172 |
return getFillColor(); |
|
173 |
} |
|
174 |
|
|
175 |
public void setColor(Color color) { |
|
176 |
setFillColor(color); |
|
177 |
} |
|
178 |
|
|
179 |
public Object clone() throws CloneNotSupportedException { |
|
180 |
IFillSymbol copy = (IFillSymbol) super.clone(); |
|
181 |
|
|
182 |
// Clone outline |
|
183 |
ILineSymbol outline = copy.getOutline(); |
|
184 |
if (outline != null) { |
|
185 |
copy.setOutline((ILineSymbol) outline.clone()); |
Also available in: Unified diff