Revision 38289
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/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/maven-v4_0_0.xsd"> |
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
8 |
<packaging>jar</packaging> |
|
9 |
<version>2.0-SNAPSHOT</version> |
|
10 |
<name>libFMap_mapcontext</name> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>gvsig-base-library-pom</artifactId> |
|
14 |
<version>2.0-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
25 |
<type>test-jar</type> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.compat</artifactId> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.projection</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
45 |
<classifier>operation</classifier> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.slf4j</groupId> |
|
65 |
<artifactId>slf4j-api</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>com.vividsolutions</groupId> |
|
70 |
<artifactId>jts</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>easymock</groupId> |
|
75 |
<artifactId>easymock</artifactId> |
|
76 |
<version>1.2_Java1.3</version> |
|
77 |
<scope>test</scope> |
|
78 |
</dependency> |
|
79 |
<dependency> |
|
80 |
<groupId>javax.media</groupId> |
|
81 |
<artifactId>jai_core</artifactId> |
|
82 |
<scope>test</scope> |
|
83 |
</dependency> |
|
84 |
<dependency> |
|
85 |
<groupId>javax.media</groupId> |
|
86 |
<artifactId>jai_codec</artifactId> |
|
87 |
<scope>test</scope> |
|
88 |
</dependency> |
|
89 |
</dependencies> |
|
90 |
<properties> |
|
91 |
<build-dir>${basedir}/../build</build-dir> |
|
92 |
<eclipse.project.name>libFMap_mapcontext</eclipse.project.name> |
|
93 |
</properties> |
|
94 |
<build> |
|
95 |
<sourceDirectory>src</sourceDirectory> |
|
96 |
<testSourceDirectory>src-test</testSourceDirectory> |
|
97 |
<resources> |
|
98 |
<resource> |
|
99 |
<directory>src</directory> |
|
100 |
<includes> |
|
101 |
<include>**/*.gif</include> |
|
102 |
<include>**/*.png</include> |
|
103 |
<include>**/*.PNG</include> |
|
104 |
<include> **/*.bmp</include> |
|
105 |
<include> **/*.jpg</include> |
|
106 |
<include> **/*.jpeg</include> |
|
107 |
</includes> |
|
108 |
</resource> |
|
109 |
</resources> |
|
110 |
<testResources> |
|
111 |
<testResource> |
|
112 |
<directory>resources-test</directory> |
|
113 |
</testResource> |
|
114 |
</testResources> |
|
115 |
<plugins> |
|
116 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
117 |
<plugin> |
|
118 |
<groupId>org.apache.maven.plugins</groupId> |
|
119 |
<artifactId>maven-surefire-plugin</artifactId> |
|
120 |
<configuration> |
|
121 |
<skipTests>true</skipTests> |
|
122 |
</configuration> |
|
123 |
</plugin> |
|
124 |
<plugin> |
|
125 |
<groupId>org.apache.maven.plugins</groupId> |
|
126 |
<artifactId>maven-compiler-plugin</artifactId> |
|
127 |
<configuration> |
|
128 |
<source>1.4</source> |
|
129 |
<target>1.4</target> |
|
130 |
<!-- put your configurations here --> |
|
131 |
<encoding>ISO-8859-1</encoding> |
|
132 |
</configuration> |
|
133 |
</plugin> |
|
134 |
</plugins> |
|
135 |
</build> |
|
136 |
<profiles> |
|
137 |
<profile> |
|
138 |
<id>se</id> |
|
139 |
<activation> |
|
140 |
<activeByDefault>true</activeByDefault> |
|
141 |
</activation> |
|
142 |
<dependencies> |
|
143 |
<dependency> |
|
144 |
<groupId>org.gvsig</groupId> |
|
145 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
146 |
<type>test-jar</type> |
|
147 |
<scope>test</scope> |
|
148 |
</dependency> |
|
149 |
|
|
150 |
<dependency> |
|
151 |
<groupId>org.gvsig</groupId> |
|
152 |
<artifactId>org.gvsig.compat</artifactId> |
|
153 |
<version>2.0-SNAPSHOT</version> |
|
154 |
<classifier>se</classifier> |
|
155 |
<scope>test</scope> |
|
156 |
</dependency> |
|
157 |
<dependency> |
|
158 |
<groupId>org.gvsig</groupId> |
|
159 |
<artifactId>org.gvsig.projection</artifactId> |
|
160 |
<version>2.0-SNAPSHOT</version> |
|
161 |
<classifier>cresques-impl</classifier> |
|
162 |
<scope>test</scope> |
|
163 |
</dependency> |
|
164 |
<dependency> |
|
165 |
<groupId>org.gvsig</groupId> |
|
166 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
167 |
<version>2.0-SNAPSHOT</version> |
|
168 |
<classifier>impl</classifier> |
|
169 |
<scope>test</scope> |
|
170 |
</dependency> |
|
171 |
<dependency> |
|
172 |
<groupId>org.gvsig</groupId> |
|
173 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
174 |
<version>2.0-SNAPSHOT</version> |
|
175 |
<classifier>spi</classifier> |
|
176 |
<scope>test</scope> |
|
177 |
</dependency> |
|
178 |
<dependency> |
|
179 |
<groupId>org.gvsig</groupId> |
|
180 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
181 |
<version>2.0-SNAPSHOT</version> |
|
182 |
<classifier>impl</classifier> |
|
183 |
<scope>test</scope> |
|
184 |
</dependency> |
|
185 |
<dependency> |
|
186 |
<groupId>org.geotools</groupId> |
|
187 |
<artifactId>gt2-main</artifactId> |
|
188 |
<scope>test</scope> |
|
189 |
</dependency> |
|
190 |
<dependency> |
|
191 |
<groupId>org.geotools</groupId> |
|
192 |
<artifactId>gt2-legacy</artifactId> |
|
193 |
</dependency> |
|
194 |
<dependency> |
|
195 |
<groupId>org.opengis</groupId> |
|
196 |
<artifactId>geoapi</artifactId> |
|
197 |
<scope>test</scope> |
|
198 |
</dependency> |
|
199 |
|
|
200 |
</dependencies> |
|
201 |
<build> |
|
202 |
|
|
203 |
<plugins> |
|
204 |
<plugin> |
|
205 |
<groupId>org.apache.maven.plugins</groupId> |
|
206 |
<artifactId>maven-jar-plugin</artifactId> |
|
207 |
<!-- |
|
208 |
Generates a jar file only with the mapcontext API |
|
209 |
TODO: make a good configuration of excludes and |
|
210 |
includes, when the api and implementation of |
|
211 |
the mapcontext library would be performed. |
|
212 |
--> |
|
213 |
<configuration> |
|
214 |
<excludes> |
|
215 |
<exclude>org/gvsig/fmap/geom/**</exclude> |
|
216 |
</excludes> |
|
217 |
</configuration> |
|
218 |
<executions> |
|
219 |
<!-- |
|
220 |
Generates a jar file only with the mapcontext implementation |
|
221 |
--> |
|
222 |
<execution> |
|
223 |
<id>impl</id> |
|
224 |
<phase>package</phase> |
|
225 |
<goals> |
|
226 |
<goal>jar</goal> |
|
227 |
</goals> |
|
228 |
<configuration> |
|
229 |
<classifier>impl</classifier> |
|
230 |
<excludes> |
|
231 |
<exclude>**/**</exclude> |
|
232 |
</excludes> |
|
233 |
</configuration> |
|
234 |
</execution> |
|
235 |
<!-- |
|
236 |
Generates a jar file only with the mapcontext geometries operations |
|
237 |
--> |
|
238 |
<execution> |
|
239 |
<id>operation</id> |
|
240 |
<phase>package</phase> |
|
241 |
<goals> |
|
242 |
<goal>jar</goal> |
|
243 |
</goals> |
|
244 |
<configuration> |
|
245 |
<classifier>operation</classifier> |
|
246 |
<excludes> |
|
247 |
<exclude>NONE</exclude> |
|
248 |
</excludes> |
|
249 |
<includes> |
|
250 |
<include>org/gvsig/fmap/geom/**</include> |
|
251 |
</includes> |
|
252 |
</configuration> |
|
253 |
</execution> |
|
254 |
<execution> |
|
255 |
<goals> |
|
256 |
<goal>test-jar</goal> |
|
257 |
</goals> |
|
258 |
</execution> |
|
259 |
</executions> |
|
260 |
</plugin> |
|
261 |
<plugin> |
|
262 |
<artifactId>maven-antrun-plugin</artifactId> |
|
263 |
<executions> |
|
264 |
<execution> |
|
265 |
<id>services</id> |
|
266 |
<phase>package</phase> |
|
267 |
<goals> |
|
268 |
<goal>run</goal> |
|
269 |
</goals> |
|
270 |
<configuration> |
|
271 |
<tasks> |
|
272 |
<jar destfile="${project.build.directory}/${project.build.finalName}.jar" |
|
273 |
update="true"> |
|
274 |
<fileset dir="${basedir}/resources/api" /> |
|
275 |
</jar> |
|
276 |
<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar" |
|
277 |
update="true"> |
|
278 |
<fileset dir="${basedir}/resources/impl" /> |
|
279 |
</jar> |
|
280 |
<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar" |
|
281 |
update="true"> |
|
282 |
<fileset dir="${basedir}/resources/operation" /> |
|
283 |
</jar> |
|
284 |
</tasks> |
|
285 |
</configuration> |
|
286 |
</execution> |
|
287 |
</executions> |
|
288 |
</plugin> |
|
289 |
<plugin> |
|
290 |
<groupId>org.apache.maven.plugins</groupId> |
|
291 |
<artifactId>maven-surefire-plugin</artifactId> |
|
292 |
<configuration> |
|
293 |
<additionalClasspathElements> |
|
294 |
<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement> |
|
295 |
<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement> |
|
296 |
<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement> |
|
297 |
</additionalClasspathElements> |
|
298 |
</configuration> |
|
299 |
</plugin> |
|
300 |
</plugins> |
|
301 |
</build> |
|
302 |
|
|
303 |
</profile> |
|
304 |
<profile> |
|
305 |
<id>cdc</id> |
|
306 |
<activation> |
|
307 |
<activeByDefault>false</activeByDefault> |
|
308 |
</activation> |
|
309 |
|
|
310 |
<dependencies> |
|
311 |
<dependency> |
|
312 |
<groupId>org.gvsig</groupId> |
|
313 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
314 |
<type>test-jar</type> |
|
315 |
<scope>test</scope> |
|
316 |
</dependency> |
|
317 |
<dependency> |
|
318 |
<groupId>org.gvsig.mobile</groupId> |
|
319 |
<artifactId>org.gvsig.mobile.compat</artifactId> |
|
320 |
<version>2.0-SNAPSHOT</version> |
|
321 |
<scope>test</scope> |
|
322 |
</dependency> |
|
323 |
<dependency> |
|
324 |
<groupId>org.gvsig.mobile</groupId> |
|
325 |
<artifactId>org.gvsig.mobile.libProjection</artifactId> |
|
326 |
<version>0.0.1-SNAPSHOT</version> |
|
327 |
<scope>test</scope> |
|
328 |
</dependency> |
|
329 |
<dependency> |
|
330 |
<groupId>org.gvsig</groupId> |
|
331 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
332 |
<version>2.0-SNAPSHOT</version> |
|
333 |
<classifier>impl</classifier> |
|
334 |
<scope>test</scope> |
|
335 |
</dependency> |
|
336 |
<dependency> |
|
337 |
<groupId>org.gvsig</groupId> |
|
338 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
339 |
<version>2.0-SNAPSHOT</version> |
|
340 |
<classifier>spi</classifier> |
|
341 |
<scope>test</scope> |
|
342 |
</dependency> |
|
343 |
<dependency> |
|
344 |
<groupId>org.gvsig</groupId> |
|
345 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
346 |
<version>2.0-SNAPSHOT</version> |
|
347 |
<classifier>impl</classifier> |
|
348 |
<scope>test</scope> |
|
349 |
</dependency> |
|
350 |
|
|
351 |
</dependencies> |
|
352 |
|
|
353 |
<build> |
|
354 |
<plugins> |
|
355 |
<plugin> |
|
356 |
<groupId>org.apache.maven.plugins</groupId> |
|
357 |
<artifactId>maven-compiler-plugin</artifactId> |
|
358 |
<configuration> |
|
359 |
<source>1.4</source> |
|
360 |
<target>1.4</target> |
|
361 |
<!-- put your configurations here --> |
|
362 |
<encoding>ISO-8859-1</encoding> |
|
363 |
</configuration> |
|
364 |
</plugin> |
|
365 |
<plugin> |
|
366 |
<groupId>org.apache.maven.plugins</groupId> |
|
367 |
<artifactId>maven-jar-plugin</artifactId> |
|
368 |
<!-- |
|
369 |
Generates a jar file only with the mapcontext API |
|
370 |
TODO: make a good configuration of excludes and |
|
371 |
includes, when the api and implementation of |
|
372 |
the mapcontext library would be performed. |
|
373 |
--> |
|
374 |
<configuration> |
|
375 |
<excludes> |
|
376 |
<exclude>org/gvsig/fmap/geom/**</exclude> |
|
377 |
</excludes> |
|
378 |
</configuration> |
|
379 |
<executions> |
|
380 |
<!-- |
|
381 |
Generates a jar file only with the mapcontext implementation |
|
382 |
--> |
|
383 |
<execution> |
|
384 |
<id>impl</id> |
|
385 |
<phase>package</phase> |
|
386 |
<goals> |
|
387 |
<goal>jar</goal> |
|
388 |
</goals> |
|
389 |
<configuration> |
|
390 |
<classifier>impl</classifier> |
|
391 |
<excludes> |
|
392 |
<exclude>**/**</exclude> |
|
393 |
</excludes> |
|
394 |
</configuration> |
|
395 |
</execution> |
|
396 |
<!-- |
|
397 |
Generates a jar file only with the mapcontext geometries operations |
|
398 |
--> |
|
399 |
<execution> |
|
400 |
<id>operation</id> |
|
401 |
<phase>package</phase> |
|
402 |
<goals> |
|
403 |
<goal>jar</goal> |
|
404 |
</goals> |
|
405 |
<configuration> |
|
406 |
<classifier>operation</classifier> |
|
407 |
<excludes> |
|
408 |
<exclude>NONE</exclude> |
|
409 |
</excludes> |
|
410 |
<includes> |
|
411 |
<include>org/gvsig/fmap/geom/**</include> |
|
412 |
</includes> |
|
413 |
</configuration> |
|
414 |
</execution> |
|
415 |
</executions> |
|
416 |
</plugin> |
|
417 |
<plugin> |
|
418 |
<artifactId>maven-antrun-plugin</artifactId> |
|
419 |
<executions> |
|
420 |
<execution> |
|
421 |
<id>services</id> |
|
422 |
<phase>package</phase> |
|
423 |
<goals> |
|
424 |
<goal>run</goal> |
|
425 |
</goals> |
|
426 |
<configuration> |
|
427 |
<tasks> |
|
428 |
<jar destfile="${project.build.directory}/${project.build.finalName}.jar" |
|
429 |
update="true"> |
|
430 |
<fileset dir="${basedir}/resources/api" /> |
|
431 |
</jar> |
|
432 |
<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar" |
|
433 |
update="true"> |
|
434 |
<fileset dir="${basedir}/resources/impl" /> |
|
435 |
</jar> |
|
436 |
<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar" |
|
437 |
update="true"> |
|
438 |
<fileset dir="${basedir}/resources/operation" /> |
|
439 |
</jar> |
|
440 |
</tasks> |
|
441 |
</configuration> |
|
442 |
</execution> |
|
443 |
</executions> |
|
444 |
</plugin> |
|
445 |
<plugin> |
|
446 |
<groupId>org.apache.maven.plugins</groupId> |
|
447 |
<artifactId>maven-surefire-plugin</artifactId> |
|
448 |
<configuration> |
|
449 |
<additionalClasspathElements> |
|
450 |
<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement> |
|
451 |
<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement> |
|
452 |
<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement> |
|
453 |
</additionalClasspathElements> |
|
454 |
</configuration> |
|
455 |
</plugin> |
|
456 |
</plugins> |
|
457 |
</build> |
|
458 |
|
|
459 |
</profile> |
|
460 |
<profile> |
|
461 |
<id>eclipse-project</id> |
|
462 |
<build> |
|
463 |
<defaultGoal>antrun:run</defaultGoal> |
|
464 |
<plugins> |
|
465 |
<plugin> |
|
466 |
<artifactId>maven-antrun-plugin</artifactId> |
|
467 |
<configuration> |
|
468 |
<tasks> |
|
469 |
<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml" |
|
470 |
target="eclipse.all"/> |
|
471 |
</tasks> |
|
472 |
</configuration> |
|
473 |
</plugin> |
|
474 |
</plugins> |
|
475 |
</build> |
|
476 |
</profile> |
|
477 |
</profiles> |
|
478 |
</project> |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.fmap.geom.operation.MapContextGeomOperationsLibrary |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.fmap.mapcontext.MapContextLibrary |
|
2 |
org.gvsig.fmap.mapcontext.impl.MapContextImplLibrary |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbol; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Graphics2D; |
|
5 |
import java.awt.image.BufferedImage; |
|
6 |
import java.util.Iterator; |
|
7 |
import java.util.Map; |
|
8 |
|
|
9 |
import org.cresques.cts.ICoordTrans; |
|
10 |
|
|
11 |
import org.gvsig.compat.print.PrintAttributes; |
|
12 |
import org.gvsig.fmap.dal.exception.DataException; |
|
13 |
import org.gvsig.fmap.dal.feature.Feature; |
|
14 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
15 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
16 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
17 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
18 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
19 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
20 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
21 |
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException; |
|
22 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
|
23 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
|
24 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
25 |
import org.gvsig.tools.ToolsLocator; |
|
26 |
import org.gvsig.tools.dynobject.DynStruct; |
|
27 |
import org.gvsig.tools.evaluator.Evaluator; |
|
28 |
import org.gvsig.tools.observer.Observer; |
|
29 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
30 |
import org.gvsig.tools.persistence.PersistentState; |
|
31 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
32 |
import org.gvsig.tools.task.Cancellable; |
|
33 |
|
|
34 |
public class DummyVectorLegend implements IVectorLegend { |
|
35 |
|
|
36 |
private long shpType = -1; |
|
37 |
|
|
38 |
private ISymbol sym = new DummySymbol(Color.RED, TYPES.SOLID); |
|
39 |
|
|
40 |
public DummyVectorLegend() { |
|
41 |
shpType = System.currentTimeMillis() % 1000000; |
|
42 |
} |
|
43 |
|
|
44 |
public DummyVectorLegend(int type) { |
|
45 |
shpType = type; // System.currentTimeMillis() % 1000000; |
|
46 |
} |
|
47 |
|
|
48 |
public void draw(BufferedImage image, Graphics2D graphics2D, |
|
49 |
ViewPort viewPort, Cancellable cancel, double scale, |
|
50 |
Map queryParameters, ICoordTrans coordTrans, |
|
51 |
FeatureStore featureStore, FeatureQuery featureQuery) throws LegendException { |
|
52 |
|
|
53 |
} |
|
54 |
public void draw(BufferedImage image, Graphics2D graphics2D, |
|
55 |
ViewPort viewPort, Cancellable cancel, double scale, |
|
56 |
Map queryParameters, ICoordTrans coordTrans, |
|
57 |
FeatureStore featureStore) throws LegendException { |
|
58 |
|
|
59 |
try { |
|
60 |
FeatureSet fs = featureStore.getFeatureSet(); |
|
61 |
Iterator iter = fs.iterator(); |
|
62 |
Feature feat = null; |
|
63 |
ISymbol symb = null; |
|
64 |
while (iter.hasNext()) { |
|
65 |
feat = (Feature) iter.next(); |
|
66 |
symb = this.getSymbolByFeature(feat); |
|
67 |
symb.draw(graphics2D, viewPort.getAffineTransform(), feat.getDefaultGeometry(), feat, null); |
|
68 |
} |
|
69 |
} catch (DataException e) { |
|
70 |
// TODO Auto-generated catch block |
|
71 |
e.printStackTrace(); |
|
72 |
} |
|
73 |
// TODO Auto-generated method stub |
|
74 |
|
|
75 |
} |
|
76 |
|
|
77 |
public int getShapeType() { |
|
78 |
// TODO Auto-generated method stub |
|
79 |
return (int) shpType; |
|
80 |
} |
|
81 |
|
|
82 |
public ISymbol getSymbolByFeature(Feature feat) { |
|
83 |
return sym; |
|
84 |
} |
|
85 |
|
|
86 |
public boolean isSuitableForShapeType(int shapeType) { |
|
87 |
return sym.getSymbolType() == shapeType; |
|
88 |
} |
|
89 |
|
|
90 |
public boolean isUseDefaultSymbol() { |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
95 |
double scale, Object object, ICoordTrans coordTrans, |
|
96 |
FeatureStore featureStore, Evaluator evaluator, PrintAttributes properties) |
|
97 |
throws LegendException { |
|
98 |
// TODO Auto-generated method stub |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
public void setDefaultSymbol(ISymbol s) throws IllegalArgumentException { |
|
103 |
sym = s; |
|
104 |
} |
|
105 |
|
|
106 |
public void setShapeType(int shapeType) { |
|
107 |
shpType = shapeType; |
|
108 |
} |
|
109 |
|
|
110 |
public void useDefaultSymbol(boolean b) { |
|
111 |
} |
|
112 |
|
|
113 |
public void addLegendListener(LegendContentsChangedListener listener) { |
|
114 |
// TODO Auto-generated method stub |
|
115 |
|
|
116 |
} |
|
117 |
|
|
118 |
public ILegend cloneLegend() { |
|
119 |
// TODO Auto-generated method stub |
|
120 |
return null; |
|
121 |
} |
|
122 |
|
|
123 |
public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) { |
|
124 |
// TODO Auto-generated method stub |
|
125 |
|
|
126 |
} |
|
127 |
|
|
128 |
public ISymbol getDefaultSymbol() { |
|
129 |
return sym; |
|
130 |
} |
|
131 |
|
|
132 |
public LegendContentsChangedListener[] getListeners() { |
|
133 |
// TODO Auto-generated method stub |
|
134 |
return null; |
|
135 |
} |
|
136 |
|
|
137 |
public void removeLegendListener(LegendContentsChangedListener listener) { |
|
138 |
// TODO Auto-generated method stub |
|
139 |
|
|
140 |
} |
|
141 |
|
|
142 |
public String getClassName() { |
|
143 |
return this.getClass().getName(); |
|
144 |
} |
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
public void addDrawingObserver(Observer observer) { |
|
150 |
// TODO Auto-generated method stub |
|
151 |
|
|
152 |
} |
|
153 |
|
|
154 |
public void deleteDrawingObserver(Observer observer) { |
|
155 |
// TODO Auto-generated method stub |
|
156 |
|
|
157 |
} |
|
158 |
|
|
159 |
public void deleteDrawingObservers() { |
|
160 |
// TODO Auto-generated method stub |
|
161 |
|
|
162 |
} |
|
163 |
|
|
164 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
165 |
shpType = state.getLong("shpType"); |
|
166 |
} |
|
167 |
|
|
168 |
|
|
169 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
170 |
state.set("shpType", shpType); |
|
171 |
} |
|
172 |
|
|
173 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
174 |
double scale, Map queryParameters, ICoordTrans coordTrans, |
|
175 |
FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties) |
|
176 |
throws LegendException { |
|
177 |
// TODO Auto-generated method stub |
|
178 |
|
|
179 |
} |
|
180 |
|
|
181 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
182 |
double scale, Map queryParameters, ICoordTrans coordTrans, |
|
183 |
FeatureStore featureStore, PrintAttributes properties) |
|
184 |
throws LegendException { |
|
185 |
// TODO Auto-generated method stub |
|
186 |
|
|
187 |
} |
|
188 |
|
|
189 |
public static void registerPersistent() { |
|
190 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
191 |
DynStruct definition = manager.addDefinition( |
|
192 |
DummyVectorLegend.class, |
|
193 |
"DummyVectorLegend", |
|
194 |
"DummyVectorLegend Persistence definition", |
|
195 |
null, |
|
196 |
null |
|
197 |
); |
|
198 |
definition.addDynFieldLong("shpType") |
|
199 |
.setMandatory(true); |
|
200 |
} |
|
201 |
|
|
202 |
|
|
203 |
public Object clone() throws CloneNotSupportedException { |
|
204 |
return super.clone(); |
|
205 |
} |
|
206 |
|
|
207 |
|
|
208 |
} |
|
0 | 209 |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbol; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Graphics2D; |
|
5 |
import java.awt.Rectangle; |
|
6 |
import java.awt.geom.AffineTransform; |
|
7 |
import java.awt.geom.PathIterator; |
|
8 |
import java.util.ArrayList; |
|
9 |
|
|
10 |
import org.gvsig.compat.print.PrintAttributes; |
|
11 |
import org.gvsig.fmap.dal.feature.Feature; |
|
12 |
import org.gvsig.fmap.geom.Geometry; |
|
13 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
14 |
import org.gvsig.fmap.geom.primitive.Point; |
|
15 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
16 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
17 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
|
18 |
import org.gvsig.tools.persistence.PersistentState; |
|
19 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
20 |
import org.gvsig.tools.task.Cancellable; |
|
21 |
|
|
22 |
public class DummySymbol implements ISymbol { |
|
23 |
|
|
24 |
private Color color = Color.GREEN; |
|
25 |
private int type = TYPES.SOLID; |
|
26 |
|
|
27 |
public DummySymbol(Color c, int geomtype) { |
|
28 |
color = c; |
|
29 |
type = geomtype; |
|
30 |
} |
|
31 |
|
|
32 |
public Object clone() { |
|
33 |
return null; |
|
34 |
} |
|
35 |
|
|
36 |
public void draw(Graphics2D g, AffineTransform affineTransform, |
|
37 |
Geometry geom, Feature f, Cancellable cancel) { |
|
38 |
|
|
39 |
g.setColor(color); |
|
40 |
|
|
41 |
if (geom instanceof Point) { |
|
42 |
Point p = (Point) geom; |
|
43 |
p.transform(affineTransform); |
|
44 |
g.drawRect((int) p.getX(), (int) p.getY(), 3, 3); |
|
45 |
} else { |
|
46 |
PathIterator piter = geom.getPathIterator(affineTransform); |
|
47 |
drawPathIterator(g, piter); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
public void drawInsideRectangle(Graphics2D g, |
|
52 |
AffineTransform scaleInstance, Rectangle r, |
|
53 |
PrintAttributes properties) throws SymbolDrawingException { |
|
54 |
// TODO Auto-generated method stub |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
public Color getColor() { |
|
59 |
return color; |
|
60 |
} |
|
61 |
|
|
62 |
public String getDescription() { |
|
63 |
return "a dummy symbol"; |
|
64 |
} |
|
65 |
|
|
66 |
public int getOnePointRgb() { |
|
67 |
return color.getRGB(); |
|
68 |
} |
|
69 |
|
|
70 |
public void getPixExtentPlus(Geometry geom, float[] distances, |
|
71 |
ViewPort viewPort, int dpi) { |
|
72 |
// TODO Auto-generated method stub |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
public ISymbol getSymbolForSelection() { |
|
77 |
return new DummySymbol(Color.YELLOW, type); |
|
78 |
} |
|
79 |
|
|
80 |
public int getSymbolType() { |
|
81 |
return type; |
|
82 |
} |
|
83 |
|
|
84 |
public boolean isOneDotOrPixel(Geometry geom, |
|
85 |
double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
public boolean isShapeVisible() { |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
public boolean isSuitableFor(Geometry geom) { |
|
95 |
return type == geom.getType(); |
|
96 |
} |
|
97 |
|
|
98 |
public void setColor(Color c) { |
|
99 |
color = c; |
|
100 |
} |
|
101 |
|
|
102 |
public void setDescription(String desc) { |
|
103 |
} |
|
104 |
|
|
105 |
public void loadFromState(PersistentState state) |
|
106 |
throws PersistenceException { |
|
107 |
} |
|
108 |
|
|
109 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
110 |
} |
|
111 |
|
|
112 |
public void print(Graphics2D g, AffineTransform at, Geometry shape, |
|
113 |
PrintAttributes properties) { |
|
114 |
} |
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
/** |
|
119 |
* Draws the general path on the graphics object with the given affine transformation |
|
120 |
* @param g the graphics object |
|
121 |
* @param gp the general path |
|
122 |
*/ |
|
123 |
public static void drawPathIterator(Graphics2D g, PathIterator pit) { |
|
124 |
|
|
125 |
ArrayList x = new ArrayList(); |
|
126 |
ArrayList y = new ArrayList(); |
|
127 |
double[] current = new double[6]; |
|
128 |
|
|
129 |
while (!pit.isDone()) { |
|
130 |
pit.currentSegment(current); |
|
131 |
x.add(new Integer((int) current[0])); |
|
132 |
y.add(new Integer((int) current[1])); |
|
133 |
pit.next(); |
|
134 |
} |
|
135 |
|
|
136 |
int[] gx = integerArrayListToIntArray(x); |
|
137 |
int[] gy = integerArrayListToIntArray(y); |
|
138 |
|
|
139 |
g.drawPolyline(gx, gy, gx.length); |
|
140 |
} |
|
141 |
|
|
142 |
|
|
143 |
/** |
|
144 |
* Converts array list of Integer objects into array of int |
|
145 |
* @param l |
|
146 |
* @return array of int |
|
147 |
*/ |
|
148 |
public static int[] integerArrayListToIntArray(ArrayList l) { |
|
149 |
|
|
150 |
int size = l.size(); |
|
151 |
int[] resp = new int[size]; |
|
152 |
for (int i=0; i<size; i++) { |
|
153 |
resp[i] = ((Integer) l.get(i)).intValue(); |
|
154 |
} |
|
155 |
return resp; |
|
156 |
} |
|
157 |
|
|
158 |
} |
|
0 | 159 |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (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.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Dimension; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
|
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
35 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
36 |
import org.gvsig.tools.persistence.PersistentState; |
|
37 |
|
|
38 |
/** |
|
39 |
* Unit tests for the class {@link DimensionPersistenceFactory}. |
|
40 |
* |
|
41 |
* @author gvSIG team |
|
42 |
*/ |
|
43 |
public class DimensionPersistenceFactoryTest extends |
|
44 |
AbstractLibraryAutoInitTestCase { |
|
45 |
|
|
46 |
private DimensionPersistenceFactory factory; |
|
47 |
private MockControl stateControl; |
|
48 |
private PersistentState state; |
|
49 |
private Dimension dimension; |
|
50 |
|
|
51 |
protected void doSetUp() throws Exception { |
|
52 |
PersistenceManager persistenceManager = ToolsLocator |
|
53 |
.getPersistenceManager(); |
|
54 |
factory = (DimensionPersistenceFactory) persistenceManager |
|
55 |
.getFactories().get(Dimension.class); |
|
56 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
57 |
state = (PersistentState) stateControl.getMock(); |
|
58 |
dimension = new Dimension(320, 200); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Test method for |
|
63 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
64 |
* . |
|
65 |
*/ |
|
66 |
public void testCreateFromState() throws Exception { |
|
67 |
stateControl.expectAndReturn(state |
|
68 |
.getInt(DimensionPersistenceFactory.FIELD_WIDTH), dimension.width); |
|
69 |
stateControl.expectAndReturn(state |
|
70 |
.getInt(DimensionPersistenceFactory.FIELD_HEIGHT), dimension.height); |
|
71 |
stateControl.replay(); |
|
72 |
|
|
73 |
Dimension newDimension = (Dimension) factory.createFromState(state); |
|
74 |
assertTrue(newDimension.equals(dimension)); |
|
75 |
|
|
76 |
stateControl.verify(); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Test method for |
|
81 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
82 |
* . |
|
83 |
*/ |
|
84 |
public void testSaveToState() throws Exception { |
|
85 |
state.set(DimensionPersistenceFactory.FIELD_WIDTH, dimension.width); |
|
86 |
state.set(DimensionPersistenceFactory.FIELD_HEIGHT, dimension.height); |
|
87 |
|
|
88 |
stateControl.replay(); |
|
89 |
|
|
90 |
factory.saveToState(state, dimension); |
|
91 |
|
|
92 |
stateControl.verify(); |
|
93 |
} |
|
94 |
|
|
95 |
} |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (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.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Font; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link FontPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class FontPersistenceFactoryTest extends AbstractLibraryAutoInitTestCase { |
|
43 |
|
|
44 |
private FontPersistenceFactory factory; |
|
45 |
private MockControl stateControl; |
|
46 |
private PersistentState state; |
|
47 |
private Font font; |
|
48 |
|
|
49 |
protected void doSetUp() throws Exception { |
|
50 |
PersistenceManager persistenceManager = ToolsLocator |
|
51 |
.getPersistenceManager(); |
|
52 |
factory = (FontPersistenceFactory) persistenceManager.getFactories() |
|
53 |
.get(Font.class); |
|
54 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
55 |
state = (PersistentState) stateControl.getMock(); |
|
56 |
font = new Font("Arial", Font.BOLD, 18); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Test method for |
|
61 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
62 |
* . |
|
63 |
*/ |
|
64 |
public void testCreateFromState() throws Exception { |
|
65 |
stateControl.expectAndReturn(state |
|
66 |
.getString(FontPersistenceFactory.FIELD_NAME), font.getName()); |
|
67 |
stateControl.expectAndReturn(state |
|
68 |
.getInt(FontPersistenceFactory.FIELD_STYLE), font.getStyle()); |
|
69 |
stateControl.expectAndReturn(state |
|
70 |
.getInt(FontPersistenceFactory.FIELD_SIZE), font.getSize()); |
|
71 |
stateControl.replay(); |
|
72 |
|
|
73 |
Font newFont = (Font) factory.createFromState(state); |
|
74 |
assertTrue(newFont.equals(font)); |
|
75 |
|
|
76 |
stateControl.verify(); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Test method for |
|
81 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
82 |
* . |
|
83 |
*/ |
|
84 |
public void testSaveToState() throws Exception { |
|
85 |
state.set(FontPersistenceFactory.FIELD_NAME, font.getName()); |
|
86 |
state.set(FontPersistenceFactory.FIELD_STYLE, font.getStyle()); |
|
87 |
state.set(FontPersistenceFactory.FIELD_SIZE, font.getSize()); |
|
88 |
stateControl.replay(); |
|
89 |
|
|
90 |
factory.saveToState(state, font); |
|
91 |
|
|
92 |
stateControl.verify(); |
|
93 |
} |
|
94 |
|
|
95 |
} |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (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.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.geom.Rectangle2D; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link Rectangle2DPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class Rectangle2DPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private Rectangle2DPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Rectangle2D rectangle; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (Rectangle2DPersistenceFactory) persistenceManager |
|
54 |
.getFactories().get(Rectangle2D.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
double x = Math.random() * 1000d; |
|
58 |
double y = Math.random() * 1000d; |
|
59 |
rectangle = new Rectangle2D.Double(x, y, 320, 200); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Test method for |
|
64 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#createFromState(PersistentState, Class)} |
|
65 |
* . |
|
66 |
*/ |
|
67 |
public void testCreateFromState() throws Exception { |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_X), rectangle |
|
70 |
.getX()); |
|
71 |
stateControl.expectAndReturn(state |
|
72 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_Y), rectangle |
|
73 |
.getY()); |
|
74 |
stateControl.expectAndReturn(state |
|
75 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_WIDTH), |
|
76 |
rectangle.getWidth()); |
|
77 |
stateControl.expectAndReturn(state |
|
78 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_HEIGHT), |
|
79 |
rectangle.getHeight()); |
|
80 |
stateControl.replay(); |
|
81 |
|
|
82 |
Rectangle2D newRectangle = (Rectangle2D) factory.createFromState(state); |
|
83 |
|
|
84 |
System.out.println("Orig x = " + rectangle.getX() + " - New x = " |
|
85 |
+ newRectangle.getX()); |
|
86 |
assertEquals(rectangle.getX(), newRectangle.getX(), 0.0d); |
|
87 |
System.out.println("Orig y = " + rectangle.getY() + " - New y = " |
|
88 |
+ newRectangle.getY()); |
|
89 |
assertEquals(rectangle.getY(), newRectangle.getY(), 0.0d); |
|
90 |
System.out.println("Orig width = " + rectangle.getWidth() |
|
91 |
+ " - New width = " + newRectangle.getWidth()); |
|
92 |
assertEquals(rectangle.getWidth(), newRectangle.getWidth(), 0.0d); |
|
93 |
System.out.println("Orig height = " + rectangle.getHeight() |
|
94 |
+ " - New height = " + newRectangle.getHeight()); |
|
95 |
assertEquals(rectangle.getHeight(), newRectangle.getHeight(), 0.0d); |
|
96 |
|
|
97 |
assertTrue(newRectangle.equals(rectangle)); |
|
98 |
|
|
99 |
stateControl.verify(); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Test method for |
|
104 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
105 |
* . |
|
106 |
*/ |
|
107 |
public void testSaveToState() throws Exception { |
|
108 |
state.set(Rectangle2DPersistenceFactory.FIELD_X, rectangle.getX()); |
|
109 |
state.set(Rectangle2DPersistenceFactory.FIELD_Y, rectangle.getY()); |
|
110 |
state.set(Rectangle2DPersistenceFactory.FIELD_WIDTH, rectangle |
|
111 |
.getWidth()); |
|
112 |
state.set(Rectangle2DPersistenceFactory.FIELD_HEIGHT, rectangle |
|
113 |
.getHeight()); |
|
114 |
stateControl.replay(); |
|
115 |
|
|
116 |
factory.saveToState(state, rectangle); |
|
117 |
|
|
118 |
stateControl.verify(); |
|
119 |
} |
|
120 |
} |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (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.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Color; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link ColorPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author gvSIG team |
|
41 |
*/ |
|
42 |
public class ColorPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private ColorPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Color color; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (ColorPersistenceFactory) persistenceManager.getFactories() |
|
54 |
.get(Color.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
color = Color.magenta; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Test method for |
|
62 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
63 |
* . |
|
64 |
*/ |
|
65 |
public void testCreateFromState() throws Exception { |
|
66 |
stateControl.expectAndReturn(state |
|
67 |
.getInt(ColorPersistenceFactory.FIELD_RED), color.getRed()); |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getInt(ColorPersistenceFactory.FIELD_GREEN), color.getGreen()); |
|
70 |
stateControl.expectAndReturn(state |
|
71 |
.getInt(ColorPersistenceFactory.FIELD_BLUE), color.getBlue()); |
|
72 |
stateControl.expectAndReturn(state |
|
73 |
.getInt(ColorPersistenceFactory.FIELD_ALPHA), color.getAlpha()); |
|
74 |
stateControl.replay(); |
|
75 |
|
|
76 |
Color newColor = (Color) factory.createFromState(state); |
|
77 |
assertTrue(newColor.equals(color)); |
|
78 |
|
|
79 |
stateControl.verify(); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Test method for |
|
84 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
85 |
* . |
|
86 |
*/ |
|
87 |
public void testSaveToState() throws Exception { |
|
88 |
state.set(ColorPersistenceFactory.FIELD_RED, color.getRed()); |
|
89 |
state.set(ColorPersistenceFactory.FIELD_GREEN, color.getGreen()); |
|
90 |
state.set(ColorPersistenceFactory.FIELD_BLUE, color.getBlue()); |
|
91 |
state.set(ColorPersistenceFactory.FIELD_ALPHA, color.getAlpha()); |
|
92 |
stateControl.replay(); |
|
93 |
|
|
94 |
factory.saveToState(state, color); |
|
95 |
|
|
96 |
stateControl.verify(); |
|
97 |
} |
|
98 |
|
|
99 |
} |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (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.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.geom.Point2D; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link Point2DPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class Point2DPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private Point2DPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Point2D point; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (Point2DPersistenceFactory) persistenceManager.getFactories() |
|
54 |
.get(Point2D.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
double x = Math.random() * 1000d; |
|
58 |
double y = Math.random() * 1000d; |
|
59 |
point = new Point2D.Double(x, y); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Test method for |
|
64 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#createFromState(PersistentState, Class)} |
|
65 |
* . |
|
66 |
*/ |
|
67 |
public void testCreateFromState() throws Exception { |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getDouble(Point2DPersistenceFactory.FIELD_X), point.getX()); |
|
70 |
stateControl.expectAndReturn(state |
|
71 |
.getDouble(Point2DPersistenceFactory.FIELD_Y), point.getY()); |
|
72 |
stateControl.replay(); |
|
73 |
|
|
74 |
Point2D newPoint = (Point2D) factory.createFromState(state); |
|
75 |
assertTrue(newPoint.equals(point)); |
|
76 |
|
|
77 |
stateControl.verify(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Test method for |
|
82 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
83 |
* . |
|
84 |
*/ |
|
85 |
public void testSaveToState() throws Exception { |
|
86 |
state.set(Point2DPersistenceFactory.FIELD_X, point.getX()); |
|
87 |
state.set(Point2DPersistenceFactory.FIELD_Y, point.getY()); |
|
88 |
stateControl.replay(); |
|
89 |
|
|
90 |
factory.saveToState(state, point); |
|
91 |
|
|
92 |
stateControl.verify(); |
|
93 |
} |
|
94 |
} |
tags/v2_0_0_Build_2047/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.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 {DiSiD Technologies} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.impl; |
|
28 |
|
|
29 |
import java.awt.Graphics2D; |
|
30 |
import java.awt.image.BufferedImage; |
|
31 |
import java.util.Map; |
|
32 |
|
|
33 |
import org.cresques.cts.ICoordTrans; |
|
34 |
|
|
35 |
import org.gvsig.compat.print.PrintAttributes; |
|
36 |
import org.gvsig.fmap.crs.CRSFactory; |
|
37 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
38 |
import org.gvsig.fmap.dal.feature.Feature; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
42 |
import org.gvsig.fmap.mapcontext.MapContextDrawer; |
|
43 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
44 |
import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
|
45 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
47 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
48 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
49 |
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException; |
|
50 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
|
51 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
|
52 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
|
53 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
|
54 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
55 |
import org.gvsig.tools.evaluator.Evaluator; |
|
56 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
57 |
import org.gvsig.tools.observer.Observer; |
|
58 |
import org.gvsig.tools.persistence.PersistentState; |
|
59 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
60 |
import org.gvsig.tools.task.Cancellable; |
|
61 |
|
|
62 |
/** |
|
63 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
64 |
*/ |
|
65 |
public class DefaultMapContextManagerTest extends |
|
66 |
AbstractLibraryAutoInitTestCase { |
Also available in: Unified diff