Revision 39658

View differences:

tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/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
    <artifactId>org.gvsig.fmap.dal.file</artifactId>
9
    <packaging>jar</packaging>
10
    <version>2.0-SNAPSHOT</version>
11
    <name>libFMap_dalfile</name>
12
    <parent>
13
        <groupId>org.gvsig</groupId>
14
        <artifactId>gvsig-base-library-pom</artifactId>
15
        <version>2.0-SNAPSHOT</version>
16
    </parent>
17
    <properties>
18
        <!-- dbf -->
19
        <dbf-jarIncludes>org/gvsig/fmap/dal/store/dbf/**/**</dbf-jarIncludes>
20
        <dbf-jarExcludes>NONE</dbf-jarExcludes>
21

  
22
        <!-- dgn -->
23
        <dgn-jarIncludes>org/gvsig/fmap/dal/store/dgn/**/**</dgn-jarIncludes>
24
        <dgn-legend-jarIncludes>org/gvsig/fmap/dal/store/dgn/legend/**/**</dgn-legend-jarIncludes>
25
        <dgn-jarExcludes>${dgn-legend-jarIncludes}</dgn-jarExcludes>
26
        <dgn-legend-jarExcludes>NONE</dgn-legend-jarExcludes>
27

  
28
        <!-- dxf -->
29
        <dxf-jarIncludes>org/gvsig/fmap/dal/store/dxf/**/**</dxf-jarIncludes>
30
        <dxf-legend-jarIncludes>org/gvsig/fmap/dal/store/dxf/legend/**/**</dxf-legend-jarIncludes>
31
        <dxf-jarExcludes>${dxf-legend-jarIncludes}</dxf-jarExcludes>
32
        <dxf-legend-jarExcludes>NONE</dxf-legend-jarExcludes>
33

  
34
        <!-- shp -->
35
        <shp-jarIncludes>org/gvsig/fmap/dal/store/shp/**/**</shp-jarIncludes>
36
        <shp-jarExcludes>NONE</shp-jarExcludes>
37

  
38
        <!-- Common -->
39
        <common-jarIncludes>**/**</common-jarIncludes>
40
        <build-dir>${basedir}/../build</build-dir>
41
        <eclipse.project.name>libFMap_dalfile</eclipse.project.name>
42
    </properties>
43
    <dependencyManagement>
44
        <dependencies>
45
            <dependency>
46
                <groupId>org.gvsig</groupId>
47
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
48
                <version>2.0.1-SNAPSHOT</version>
49
                <type>pom</type>
50
                <scope>import</scope>
51
            </dependency>
52
        </dependencies>
53
    </dependencyManagement>
54
    <dependencies>
55
        <dependency>
56
            <groupId>org.gvsig</groupId>
57
            <artifactId>org.gvsig.tools.lib</artifactId>
58
            <scope>compile</scope>
59
        </dependency>
60
        <dependency>
61
            <groupId>org.gvsig</groupId>
62
            <artifactId>org.gvsig.projection</artifactId>
63
            <scope>compile</scope>
64
        </dependency>
65
        <dependency>
66
            <groupId>org.gvsig</groupId>
67
            <artifactId>org.gvsig.fmap.dal</artifactId>
68
            <scope>compile</scope>
69
        </dependency>
70
        <dependency>
71
            <groupId>org.gvsig</groupId>
72
            <artifactId>org.gvsig.fmap.dal</artifactId>
73
            <classifier>spi</classifier>
74
            <scope>compile</scope>
75
        </dependency>
76
        <dependency>
77
            <groupId>org.gvsig</groupId>
78
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
79
            <scope>compile</scope>
80
        </dependency>
81
        <dependency>
82
            <groupId>org.gvsig</groupId>
83
            <artifactId>org.gvsig.dxf</artifactId>
84
            <scope>compile</scope>
85
        </dependency>
86
        <dependency>
87
            <groupId>org.gvsig</groupId>
88
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
89
            <scope>compile</scope>
90
        </dependency>
91
        <dependency>
92
            <groupId>org.gvsig</groupId>
93
            <artifactId>org.gvsig.symbology.lib.api</artifactId>
94
            <scope>compile</scope>
95
        </dependency>
96
        <dependency>
97
            <groupId>org.gvsig</groupId>
98
            <artifactId>org.gvsig.tools.evaluator.sqljep</artifactId>
99
            <scope>compile</scope>
100
        </dependency>
101
        <dependency>
102
            <groupId>org.gvsig</groupId>
103
            <artifactId>org.gvsig.fmap.geometry</artifactId>
104
            <scope>compile</scope>
105
        </dependency>
106
        <dependency>
107
            <groupId>org.gvsig</groupId>
108
            <artifactId>org.gvsig.fmap.geometry</artifactId>
109
            <classifier>operation</classifier>
110
            <scope>compile</scope>
111
        </dependency>
112
        <dependency>
113
            <groupId>org.gvsig</groupId>
114
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
115
            <scope>compile</scope>
116
        </dependency>
117
        <dependency>
118
            <groupId>org.slf4j</groupId>
119
            <artifactId>slf4j-api</artifactId>
120
            <scope>compile</scope>
121
        </dependency>
122
        <dependency>
123
            <groupId>org.gvsig</groupId>
124
            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
125
            <scope>compile</scope>
126
        </dependency>	
127
		<!-- TESTS -->
128
        <dependency>
129
            <groupId>org.gvsig</groupId>
130
			<artifactId>org.gvsig.tools.lib</artifactId>
131
			<type>test-jar</type>
132
        </dependency>
133
        <dependency>
134
            <groupId>org.gvsig</groupId>
135
			<artifactId>org.gvsig.compat</artifactId>
136
			<classifier>se</classifier>
137
            <scope>test</scope>
138
        </dependency>
139
        <dependency>
140
            <groupId>org.gvsig</groupId>
141
			<artifactId>org.gvsig.fmap.dal</artifactId>
142
			<classifier>impl</classifier>
143
        </dependency>
144
        <dependency>
145
            <groupId>org.gvsig</groupId>
146
            <artifactId>org.gvsig.utils</artifactId>
147
            <scope>compile</scope>
148
        </dependency>
149
        <dependency>
150
            <groupId>org.gvsig</groupId>
151
			<artifactId>org.gvsig.fmap.dal</artifactId>
152
			<classifier>tests</classifier>
153
            <scope>test</scope>
154
        </dependency>
155
        <dependency>
156
            <groupId>org.gvsig</groupId>
157
			<artifactId>org.gvsig.fmap.dal.index.spatial</artifactId>
158
			<classifier>jts</classifier>
159
            <scope>test</scope>
160
        </dependency>
161
        <dependency>
162
            <groupId>org.gvsig</groupId>
163
			<artifactId>org.gvsig.fmap.geometry</artifactId>
164
			<classifier>impl</classifier>
165
            <scope>test</scope>
166
        </dependency>
167
        <dependency>
168
            <groupId>org.gvsig</groupId>
169
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
170
			<classifier>operation</classifier>
171
            <scope>test</scope>
172
        </dependency>
173
        <dependency>
174
            <groupId>org.gvsig</groupId>
175
			<artifactId>org.gvsig.projection</artifactId>
176
			<classifier>cresques-impl</classifier>
177
            <scope>test</scope>
178
        </dependency>
179
        <dependency>
180
            <groupId>org.gvsig</groupId>
181
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>
182
            <scope>test</scope>
183
        </dependency>
184
        <dependency>
185
            <groupId>org.gvsig</groupId>
186
            <artifactId>org.gvsig.timesupport.lib.impl</artifactId>
187
            <scope>test</scope>
188
        </dependency>   
189
        <dependency>
190
            <groupId>org.gvsig</groupId>
191
            <artifactId>org.gvsig.tools.swing.impl</artifactId>
192
            <scope>test</scope>
193
        </dependency>   
194
        
195
        <dependency>
196
        	<groupId>commons-io</groupId>
197
        	<artifactId>commons-io</artifactId>
198
            <scope>compile</scope>
199
        </dependency>
200
    </dependencies>
201
    <build>
202
        <sourceDirectory>src</sourceDirectory>
203
        <testSourceDirectory>src-test</testSourceDirectory>
204
        <testResources>
205
            <testResource>
206
                <directory>src-test</directory>
207
            </testResource>
208
            <testResource>
209
                <directory>resources-test</directory>
210
            </testResource>
211
        </testResources>
212
        <plugins>
213
            <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
214
            <plugin>
215
                <groupId>org.apache.maven.plugins</groupId>
216
                <artifactId>maven-surefire-plugin</artifactId>
217
                <configuration>
218
                    <excludes>
219
                        <exclude>**/*Test*</exclude>
220
                    </excludes>
221
                    <!-- <includes>
222
                        <include>**/Bug*Test.java</include>
223
                         </includes> -->
224
           </configuration>
225
            </plugin>
226
        </plugins>
227
    </build>
228
    <profiles>
229
        <profile>
230
            <id>se</id>
231
            <activation>
232
                <activeByDefault>true</activeByDefault>
233
            </activation>
234
            <build>
235
                <plugins>
236
                    <plugin>
237
                        <groupId>org.apache.maven.plugins</groupId>
238
                        <artifactId>maven-jar-plugin</artifactId>
239
                        <configuration>
240
                            <excludes>
241
                                <exclude>${dbf-jarIncludes}</exclude>
242
                                <exclude>${dgn-jarIncludes}</exclude>
243
                                <exclude>${dxf-jarIncludes}</exclude>
244
                                <exclude>${shp-jarIncludes}</exclude>
245
                            </excludes>
246
                        </configuration>
247
                        <executions>
248
                            <!-- Generates a jar file only with the DAL file DBF 
249
                                Store classes -->
250
                            <execution>
251
                                <id>dbf</id>
252
                                <phase>package</phase>
253
                                <goals>
254
                                    <goal>jar</goal>
255
                                </goals>
256
                                <configuration>
257
                                    <classifier>store.dbf</classifier>
258
                                    <includes>
259
                                        <include>${dbf-jarIncludes}</include>
260
                                    </includes>
261
                                    <excludes>
262
                                        <exclude>${dbf-jarExcludes}</exclude>
263
                                    </excludes>
264
                                </configuration>
265
                            </execution>
266
                            <!-- Generates a jar file only with the DAL file DGN 
267
                                Store classes -->
268
                            <execution>
269
                                <id>dgn</id>
270
                                <phase>package</phase>
271
                                <goals>
272
                                    <goal>jar</goal>
273
                                </goals>
274
                                <configuration>
275
                                    <classifier>store.dgn</classifier>
276
                                    <includes>
277
                                        <include>${dgn-jarIncludes}</include>
278
                                    </includes>
279
                                    <excludes>
280
                                        <exclude>${dgn-jarExcludes}</exclude>
281
                                    </excludes>
282
                                </configuration>
283
                            </execution>
284
                            <!-- Generates a jar file only with the DAL file DGN 
285
                                Store legend classes -->
286
                            <execution>
287
                                <id>dgn.legend</id>
288
                                <phase>package</phase>
289
                                <goals>
290
                                    <goal>jar</goal>
291
                                </goals>
292
                                <configuration>
293
                                    <classifier>store.dgn.legend</classifier>
294
                                    <includes>
295
                                        <include>${dgn-legend-jarIncludes}</include>
296
                                    </includes>
297
                                    <excludes>
298
                                        <exclude>${dgn-legend-jarExcludes}</exclude>
299
                                    </excludes>
300
                                </configuration>
301
                            </execution>
302
                            <!-- Generates a jar file only with the DAL file DXF 
303
                                Store classes -->
304
                            <execution>
305
                                <id>dxf</id>
306
                                <phase>package</phase>
307
                                <goals>
308
                                    <goal>jar</goal>
309
                                </goals>
310
                                <configuration>
311
                                    <classifier>store.dxf</classifier>
312
                                    <includes>
313
                                        <include>${dxf-jarIncludes}</include>
314
                                    </includes>
315
                                    <excludes>
316
                                        <exclude>${dxf-jarExcludes}</exclude>
317
                                    </excludes>
318
                                </configuration>
319
                            </execution>
320
                            <!-- Generates a jar file only with the DAL file DXF 
321
                                Store legend classes -->
322
                            <execution>
323
                                <id>dxf.legend</id>
324
                                <phase>package</phase>
325
                                <goals>
326
                                    <goal>jar</goal>
327
                                </goals>
328
                                <configuration>
329
                                    <classifier>store.dxf.legend</classifier>
330
                                    <includes>
331
                                        <include>${dxf-legend-jarIncludes}</include>
332
                                    </includes>
333
                                    <excludes>
334
                                        <exclude>${dxf-legend-jarExcludes}</exclude>
335
                                    </excludes>
336
                                </configuration>
337
                            </execution>
338
                            <!-- Generates a jar file only with the DAL file SHP 
339
                                Store classes -->
340
                            <execution>
341
                                <id>shp</id>
342
                                <phase>package</phase>
343
                                <goals>
344
                                    <goal>jar</goal>
345
                                </goals>
346
                                <configuration>
347
                                    <classifier>store.shp</classifier>
348
                                    <includes>
349
                                        <include>${shp-jarIncludes}</include>
350
                                    </includes>
351
                                    <excludes>
352
                                        <exclude>${shp-jarExcludes}</exclude>
353
                                    </excludes>
354
                                </configuration>
355
                            </execution>
356
                        </executions>
357
                    </plugin>
358
                    <plugin>
359
                        <artifactId>maven-antrun-plugin</artifactId>
360
                        <executions>
361
                            <execution>
362
                                <id>services</id>
363
                                <phase>package</phase>
364
                                <goals>
365
                                    <goal>run</goal>
366
                                </goals>
367
                                <configuration>
368
                                    <tasks>
369
                                        <jar
370
                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
371
                                            update="true">
372
                                            <fileset dir="${basedir}/resources/api" />
373
                                        </jar>
374
                                        <jar
375
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dbf.jar"
376
                                            update="true">
377
                                            <fileset dir="${basedir}/resources/dbf" />
378
                                        </jar>
379
                                        <jar
380
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.jar"
381
                                            update="true">
382
                                            <fileset dir="${basedir}/resources/dgn" />
383
                                        </jar>
384
                                        <jar
385
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.legend.jar"
386
                                            update="true">
387
                                            <fileset
388
                                                dir="${basedir}/resources/dgn.legend" />
389
                                        </jar>
390
                                        <jar
391
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.jar"
392
                                            update="true">
393
                                            <fileset dir="${basedir}/resources/dxf" />
394
                                        </jar>
395
                                        <jar
396
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.legend.jar"
397
                                            update="true">
398
                                            <fileset
399
                                                dir="${basedir}/resources/dxf.legend" />
400
                                        </jar>
401
                                        <jar
402
                                            destfile="${project.build.directory}/${project.build.finalName}-store.shp.jar"
403
                                            update="true">
404
                                            <fileset dir="${basedir}/resources/shp" />
405
                                        </jar>
406
                                    </tasks>
407
                                </configuration>
408
                            </execution>
409
                        </executions>
410
                    </plugin>
411
                    <plugin>
412
                        <groupId>org.apache.maven.plugins</groupId>
413
                        <artifactId>maven-surefire-plugin</artifactId>
414
                        <configuration>
415
                            <additionalClasspathElements>
416
                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
417
                                <additionalClasspathElement>${basedir}/resources/dbf</additionalClasspathElement>
418
                                <additionalClasspathElement>${basedir}/resources/dgn</additionalClasspathElement>
419
                                <additionalClasspathElement>${basedir}/resources/dgn.legend</additionalClasspathElement>
420
                                <additionalClasspathElement>${basedir}/resources/dxf</additionalClasspathElement>
421
                                <additionalClasspathElement>${basedir}/resources/dxf.legend</additionalClasspathElement>
422
                                <additionalClasspathElement>${basedir}/resources/shp</additionalClasspathElement>
423
                            </additionalClasspathElements>
424
                        </configuration>
425
                    </plugin>
426
                </plugins>
427
            </build>
428
        </profile>
429
        <profile>
430
            <id>cdc</id>
431
            <activation>
432
                <activeByDefault>false</activeByDefault>
433
            </activation>
434
            <build>
435
                <plugins>
436
                    <plugin>
437
                        <groupId>org.apache.maven.plugins</groupId>
438
                        <artifactId>maven-compiler-plugin</artifactId>
439
                        <configuration>
440
                            <excludes>
441
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
442
                            </excludes>
443
                            <testExcludes>
444
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
445
                                <exclude>org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java</exclude>
446
                            </testExcludes>
447
                        </configuration>
448
                    </plugin>
449
                    <plugin>
450
                        <groupId>org.apache.maven.plugins</groupId>
451
                        <artifactId>maven-jar-plugin</artifactId>
452
                        <configuration>
453
                            <excludes>
454
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
455
                            </excludes>
456
                        </configuration>
457
                    </plugin>
458
                    <plugin>
459
                        <artifactId>maven-antrun-plugin</artifactId>
460
                        <executions>
461
                            <execution>
462
                                <id>services</id>
463
                                <phase>package</phase>
464
                                <goals>
465
                                    <goal>run</goal>
466
                                </goals>
467
                                <configuration>
468
                                    <tasks>
469
                                        <jar
470
                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
471
                                            update="true">
472
                                            <fileset dir="${basedir}/resources/api" />
473
                                        </jar>
474
                                    </tasks>
475
                                </configuration>
476
                            </execution>
477
                        </executions>
478
                    </plugin>
479
                    <plugin>
480
                        <groupId>org.apache.maven.plugins</groupId>
481
                        <artifactId>maven-surefire-plugin</artifactId>
482
                        <configuration>
483
                            <additionalClasspathElements>
484
                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
485
                            </additionalClasspathElements>
486
                        </configuration>
487
                    </plugin>
488
                </plugins>
489
            </build>
490
        </profile>
491
        <profile>
492
            <id>eclipse-project</id>
493
            <build>
494
                <defaultGoal>antrun:run</defaultGoal>
495
                <plugins>
496
                    <plugin>
497
                        <artifactId>maven-antrun-plugin</artifactId>
498
                        <configuration>
499
                            <tasks>
500
                                <ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
501
                                    target="eclipse.all" />
502
                            </tasks>
503
                        </configuration>
504
                    </plugin>
505
                </plugins>
506
            </build>
507
        </profile>
508
    </profiles>
509
    <reporting>
510
        <plugins>
511
            <plugin>
512
                <groupId>org.apache.maven.plugins</groupId>
513
                <artifactId>maven-javadoc-plugin</artifactId>
514
                <configuration>
515
                    <doctitle>${project.name} ${project.version}</doctitle>
516
                    <groups>
517
                        <group>
518
                            <title>DAL File common</title>
519
                            <packages>org.gvsig.fmap.dal*</packages>
520
                        </group>
521
                        <group>
522
                            <title>DBF Store</title>
523
                            <packages>org.gvsig.fmap.dal.store.dbf*</packages>
524
                        </group>
525
                        <group>
526
                            <title>DGN Store</title>
527
                            <packages>org.gvsig.fmap.dal.store.dgn*</packages>
528
                        </group>
529
                        <group>
530
                            <title>SHP Store</title>
531
                            <packages>org.gvsig.fmap.dal.store.shp*</packages>
532
                        </group>
533
                        <group>
534
                            <title>DXF Store</title>
535
                            <packages>org.gvsig.fmap.dal.store.dxf*</packages>
536
                        </group>
537
                    </groups>
538
                </configuration>
539
            </plugin>
540
        </plugins>
541
    </reporting>
542
</project>
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dxf.legend/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.dxf.legend.DXFLegendLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFMetadata.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of metadata fields of a shp file.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    
9
    <class name="DXF" namespace="Metadata">
10
      <extends>
11
      	<class namespace="Metadata" name="SpatialProvider"/>
12
      </extends>
13
      <description>Metadata of a DXF store</description>
14
      <fields>
15
      </fields>
16
    </class>
17

  
18
  </classes>
19
</definitions>  
0 20

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFParameters.xml
1
<?xml version= "1.0 "?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5
    <class name="DXFStoreParameters">
6
       <extends>
7
      	<class namespace="dal" name="ProviderParameters"/>
8
      </extends>
9
      <description>Store the parameters need to open a dxf file</description>
10
      <fields>
11
        <field name="File" type="file" mandatory="true" group="Basic">
12
          <description>dxf file</description>
13
        </field>
14
        <field name="CRS" type="crs" mandatory="true" group="Basic">
15
          <description>The coordinate reference system used in this dxf file</description>
16
        </field>
17
      </fields>
18
    </class>
19
  </classes>
20
</definitions>  
0 21

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dxf/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.dxf.DXFLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dgn.legend/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.dgn.legend.DGNLegendLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dgn/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.dgn.DGNLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml
1
<?xml version= "1.0 "?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5
    <class name="DGNStoreParameters">
6
      <extends>
7
      	<class namespace="dal" name="ProviderParameters"/>
8
      </extends>
9
      <description>Store the parameters need to open a dgn file</description>
10
      <fields>
11
        <field name="file" type="file" mandatory="true">
12
          <description>dgn file</description>
13
        </field>
14
        <field name="CRS" type="crs" mandatory="true">
15
          <description>The coordinate reference system used in this dgn file</description>
16
        </field>
17
      </fields>
18
    </class>
19
  </classes>
20
</definitions>  
0 21

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of metadata fields of a shp file.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    
9
    <class name="DGN" namespace="Metadata">
10
      <extends>
11
      	<class namespace="Metadata" name="SpatialProvider"/>
12
      </extends>
13
      <description>Metadata of a DGN store</description>
14
      <fields>
15
      </fields>
16
    </class>
17

  
18
  </classes>
19
</definitions>  
0 20

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/api/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.DALFileLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPMetadata.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of metadata fields of a shp file.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    
9
    <class name="Shape" namespace="Metadata">
10
      <extends>
11
      	<class namespace="Metadata" name="dbf"/>
12
      	<class namespace="Metadata" name="SpatialProvider"/>
13
      </extends>
14
      <description>Metadata of a Shape store</description>
15
      <fields>
16
      </fields>
17
    </class>
18

  
19
  </classes>
20
</definitions>  
0 21

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPParameters.xml
1
<?xml version= "1.0 "?>
2
<definitions>
3
	<version>1.0.0</version>
4
	<classes>
5
		<class name="SHPStoreParameters">
6
			<extends>
7
				<class namespace="dal" name="ProviderParameters" />
8
				<class name="DBFStoreParameters" />
9
			</extends>
10
			<description>Store the parameters need to open a shp file
11
			</description>
12
			<fields>
13
				<field name="dbfFile" type="file" mandatory="false" group="Advanced">
14
					<description>dbf file</description>
15
				</field>
16
				<field name="shxFile" type="file" mandatory="false" group="Advanced">
17
					<description>The shx file associated to this shape file
18
					</description>
19
				</field>
20
				<field name="shpFile" type="file" mandatory="true" group="Basic">
21
					<description>The shp file associated to this shape file
22
					</description>
23
				</field>
24
				<field name="CRS" type="crs" mandatory="true" group="Basic">
25
					<description>The coordinate reference system used in this shape
26
						file</description>
27
				</field>
28
			</fields>
29
		</class>
30

  
31
		<class name="SHPNewStoreParameters">
32
			<description>Store the parameters need to create a shape file
33
			</description>
34
			<extends>
35
				<class>SHPStoreParameters</class>
36
				<class>DBFNewStoreParameters</class>
37
			</extends>
38
			<fields>
39
				<field name="geometryType" type="integer" mandatory="true" group="Basic">
40
					<description>Geometry type use Geometry.TYPES</description>
41
					<availableValues>
42
						<value label="POINT">1</value>
43
						<value label="CURVE">2</value>
44
						<value label="SURFACE">3</value>
45
						<value label="MULTIPOINT">7</value>
46
						<value label="MULTICURVE">8</value>
47
                        <value label="MULTISURFACE">9</value>
48
					</availableValues>
49
				</field>
50
			</fields>
51
		</class>
52

  
53
	</classes>
54
</definitions>  
0 55

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/shp/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.shp.SHPLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFMetadata.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of metadata fields of a dbf file.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="DBF" namespace="Metadata">
9
      <extends>
10
      	<class namespace="Metadata" name="FeatureProvider"/>
11
      </extends>
12
      <description>Metadata of a DBF store</description>
13
      <fields>
14
        <field name="Encoding" type="string" mandatory="false">
15
          <description>Encoding used</description>
16
          <availableValues>
17
          	<value label="(default)"></value>
18
            <value label="US-ASCII">US-ASCII</value>
19
            <value label="ISO-8859-1">ISO-8859-1</value>
20
            <value label="ISO-8859-15">ISO-8859-15</value>
21
            <value label="windows-1250">windows-1250</value>
22
            <value label="windows-1252">windows-1252</value>
23
            <value label="UTF-8">UTF-8</value>
24
            <value label="UTF-16">UTF-16</value>
25
            <value label="UTF-16BE">UTF-16BE</value>
26
            <value label="UTF-16LE">UTF-16LE</value>
27
          </availableValues>
28
        </field>
29
        <field name="CodePage" type="Integer" mandatory="false">          
30
          <description>Code page used</description>
31
          <availableValues>
32
            <value label="DOS USA">0x01</value>
33
            <value label="DOS Multilingual">0x02</value>
34
            <value label="Windows ANSI">0x03</value>
35
            <value label="Standard Macintosh">0x04</value>
36
            <value label="EE MS-DOS">0x64</value>
37
            <value label="Nordic MS-DOS">0x65</value>
38
            <value label="Russian MS-DOS">0x66</value>
39
            <value label="Icelandic MS-DOS">0x67</value>
40
            <value label="Kamenicky (Czech) MS-DOS">0x68</value>
41
            <value label="Mazovia (Polish) MS-DOS">0x69</value>
42
            <value label="Greek MS-DOS (437G)">0x6A</value>
43
            <value label="Turkish MS-DOS">0x6B</value>
44
            <value label="Russian Macintosh">0x96</value>
45
            <value label="Macintosh">0x97</value>
46
            <value label="Greek Macintosh">0x98</value>
47
            <value label="Windows EE">0xC8</value>
48
            <value label="Russian Windows">0xC9</value>
49
            <value label="Turkish Windows">0xCA</value>
50
            <value label="Greek Windows">0xCB</value>
51
          </availableValues> 
52
        </field>
53
      </fields>
54
    </class>
55

  
56
  </classes>
57
</definitions>  
0 58

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFParameters.xml
1
<?xml version="1.0"?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5
    <class name="DBFStoreParameters">
6
      <extends>
7
      	<class namespace="dal" name="ProviderParameters"/>
8
      </extends>
9
      <description>Store the parameters need to open a dbf file</description>
10
      <fields>
11
        <field name="DbfFile" type="file" mandatory="true" group="Basic">
12
          <description>dbf file</description>
13
        </field>
14
        <field name="Encoding" type="string" mandatory="false" group="Basic">
15
          <description>Encoding used in this file</description>
16
          <availableValues>
17
          	<value label="(default)"></value>
18
            <value label="US-ASCII">US-ASCII</value>
19
            <value label="ISO-8859-1">ISO-8859-1</value>
20
            <value label="ISO-8859-15">ISO-8859-15</value>
21
            <value label="windows-1250">windows-1250</value>
22
            <value label="windows-1252">windows-1252</value>
23
            <value label="UTF-8">UTF-8</value>
24
            <value label="UTF-16">UTF-16</value>
25
            <value label="UTF-16BE">UTF-16BE</value>
26
            <value label="UTF-16LE">UTF-16LE</value>
27
          </availableValues>
28
        </field>
29
      </fields>
30
    </class>
31

  
32
    <class name="DBFNewStoreParameters">
33
      <description>Store the parameters need to create a dbf file</description>
34
      <extends>
35
        <class>DBFStoreParameters</class>
36
        <class namespace="dal" name="NewProviderParameters"/>
37
      </extends>
38
      <fields>
39
        <field name="codePage" type="Integer" mandatory="false"  group="Advanced">          
40
          <description>Code page used in this file</description>
41
          <availableValues>
42
            <value label="DOS USA">0x01</value>
43
            <value label="DOS Multilingual">0x02</value>
44
            <value label="Windows ANSI">0x03</value>
45
            <value label="Standard Macintosh">0x04</value>
46
            <value label="EE MS-DOS">0x64</value>
47
            <value label="Nordic MS-DOS">0x65</value>
48
            <value label="Russian MS-DOS">0x66</value>
49
            <value label="Icelandic MS-DOS">0x67</value>
50
            <value label="Kamenicky (Czech) MS-DOS">0x68</value>
51
            <value label="Mazovia (Polish) MS-DOS">0x69</value>
52
            <value label="Greek MS-DOS (437G)">0x6A</value>
53
            <value label="Turkish MS-DOS">0x6B</value>
54
            <value label="Russian Macintosh">0x96</value>
55
            <value label="Macintosh">0x97</value>
56
            <value label="Greek Macintosh">0x98</value>
57
            <value label="Windows EE">0xC8</value>
58
            <value label="Russian Windows">0xC9</value>
59
            <value label="Turkish Windows">0xCA</value>
60
            <value label="Greek Windows">0xCB</value>
61
          </availableValues> 
62
        </field>
63
      </fields>
64
    </class>
65

  
66
  </classes>
67
</definitions>  
0 68

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/resources/dbf/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.store.dbf.DBFLibrary
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/TestDGN.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
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.store.dgn;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.dal.DataStoreParameters;
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.BaseTestFeatureStore;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36

  
37
public class TestDGN extends BaseTestFeatureStore {
38

  
39
	public static final File file_prueba = new File(TestDGN.class.getResource(
40
			"data/prueba.dgn").getFile());
41
	
42
	/*
43
	 * (non-Javadoc)
44
	 *
45
	 * @see
46
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
47
	 * ()
48
	 */
49
	public DataStoreParameters getDefaultDataStoreParameters()
50
			throws DataException {
51
		DGNStoreParameters dgnParameters = null;
52

  
53
		dgnParameters = (DGNStoreParameters) dataManager
54
				.createStoreParameters(DGNStoreProvider.NAME);
55

  
56
		dgnParameters.setFile(file_prueba.getAbsolutePath());
57
		dgnParameters.setCRS("EPSG:23030");
58
		return dgnParameters;
59
	}
60

  
61
	/*
62
	 * (non-Javadoc)
63
	 *
64
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
65
	 */
66
	public boolean hasExplorer() {
67
		// TODO Auto-generated method stub
68
		return false;
69
	}
70

  
71
	public boolean usesResources() {
72
		return true;
73
	}
74

  
75

  
76
	public void testLegendAndLabeling() throws Exception {
77
		FeatureStore store = (FeatureStore) dataManager
78
				.createStore(getDefaultDataStoreParameters());
79

  
80
		assertNotNull(store.invokeDynMethod("getLegend", null));
81
		assertNotNull(store.invokeDynMethod("getLabeling", null));
82
		store.dispose();
83
	}
84
}
0 85

  
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15643Test.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.fmap.dal.store.shp;
23

  
24
import junit.framework.TestCase;
25

  
26
import com.vividsolutions.jts.geom.Coordinate;
27
import com.vividsolutions.jts.geom.GeometryFactory;
28

  
29
import org.gvsig.fmap.dal.DALLocator;
30
import org.gvsig.fmap.dal.DataManager;
31
import org.gvsig.fmap.dal.DataTypes;
32
import org.gvsig.fmap.dal.feature.EditableFeature;
33
import org.gvsig.fmap.dal.feature.EditableFeatureType;
34
import org.gvsig.fmap.dal.feature.Feature;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
37
import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
38
import org.gvsig.fmap.geom.Geometry;
39
import org.gvsig.fmap.geom.GeometryLocator;
40
import org.gvsig.fmap.geom.GeometryManager;
41
import org.gvsig.fmap.geom.operation.GeometryOperation;
42
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
43
import org.gvsig.fmap.geom.operation.fromjts.FromJTS;
44
import org.gvsig.fmap.geom.type.GeometryType;
45
import org.gvsig.tools.exception.BaseException;
46
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
47
import org.gvsig.tools.visitor.VisitCanceledException;
48
import org.gvsig.tools.visitor.Visitor;
49

  
50
/**
51
 * Code to test bug gvsig-desktop#15643. This is based on the code provided by
52
 * the bug reporter (see ticket), thanks to him!!
53
 * 
54
 * @author gvSIG Team
55
 * @version $Id$
56
 */
57
public class Bug15643Test extends TestCase {
58

  
59
    public void testBug15643() throws Exception {
60
        new DefaultLibrariesInitializer().fullInitialize();
61
        DataManager manager = DALLocator.getDataManager();
62
        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
63

  
64
        EditableFeatureType type = new DefaultEditableFeatureType();
65
        GeometryType geometryType =
66
            geometryManager.getGeometryType(Geometry.TYPES.POINT,
67
                Geometry.SUBTYPES.GEOM2D);
68
        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
69
            .setGeometryType(geometryType);
70
        type.setDefaultGeometryAttributeName("geom");
71
        type.add("float", DataTypes.FLOAT).setSize(5);
72
        type.add("double", DataTypes.DOUBLE).setSize(5);
73
        type.add("int", DataTypes.INT).setSize(5);
74
        type.add("long", DataTypes.LONG).setSize(5);
75

  
76
        NewFeatureStoreParameters destParams =
77
            (NewFeatureStoreParameters) manager.createNewStoreParameters(
78
                "FilesystemExplorer", "Shape");
79
        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
80
        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
81
        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
82
        destParams.setDynValue("crs", "EPSG:23030");
83
        destParams.setDefaultFeatureType(type);
84

  
85
        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
86
        FeatureStore store =
87
            (FeatureStore) manager.openStore("Shape", destParams);
88

  
89
        store.edit();
90
        EditableFeature feature = store.createNewFeature().getEditable();
91
        com.vividsolutions.jts.geom.Geometry g =
92
            new GeometryFactory().createPoint(new Coordinate(0, 0));
93

  
94
        int opCode = geometryManager.getGeometryOperationCode(FromJTS.NAME);
95
        GeometryOperation converter =
96
            geometryManager.getGeometryOperation(opCode, Geometry.TYPES.POINT,
97
                Geometry.SUBTYPES.GEOM2D);
98
        GeometryOperationContext ctx = new GeometryOperationContext();
99
        ctx.setAttribute(FromJTS.PARAM, g);
100
        Geometry fmapGeom = (Geometry) converter.invoke(null, ctx);
101
        feature.setGeometry(feature.getType()
102
            .getDefaultGeometryAttributeIndex(), fmapGeom);
103
        feature.setFloat("float", 34.0f);
104
        feature.setDouble("double", 34.0d);
105
        feature.setInt("int", 34);
106
        feature.setLong("long", 34l);
107
        store.insert(feature);
108
        store.finishEditing();
109

  
110
        store.accept(new Visitor() {
111

  
112
            public void visit(Object obj) throws VisitCanceledException,
113
                BaseException {
114
                Feature feature = (Feature) obj;
115
                assertEquals(34.0f, feature.getFloat("float"));
116
                assertEquals(34.0d, feature.getDouble("double"));
117
                assertEquals(34, feature.getInt("int"));
118
                assertEquals(34l, feature.getLong("long"));
119
            }
120
        });
121

  
122
        store.dispose();
123
    }
124

  
125
}
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15670Test.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.fmap.dal.store.shp;
23

  
24
import junit.framework.TestCase;
25

  
26
import org.gvsig.fmap.dal.DALLocator;
27
import org.gvsig.fmap.dal.DataManager;
28
import org.gvsig.fmap.dal.feature.EditableFeature;
29
import org.gvsig.fmap.dal.feature.EditableFeatureType;
30
import org.gvsig.fmap.dal.feature.Feature;
31
import org.gvsig.fmap.dal.feature.FeatureStore;
32
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
33
import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
34
import org.gvsig.fmap.geom.Geometry;
35
import org.gvsig.fmap.geom.GeometryLocator;
36
import org.gvsig.fmap.geom.GeometryManager;
37
import org.gvsig.fmap.geom.primitive.Point;
38
import org.gvsig.fmap.geom.type.GeometryType;
39
import org.gvsig.tools.exception.BaseException;
40
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
41
import org.gvsig.tools.visitor.VisitCanceledException;
42
import org.gvsig.tools.visitor.Visitor;
43

  
44
/**
45
 * Code to test bug gvsig-desktop#15670. This is based on the code provided by
46
 * the bug reporter (see ticket), thanks to him!!
47
 * 
48
 * @author gvSIG Team
49
 * @version $Id$
50
 */
51
public class Bug15670Test extends TestCase {
52

  
53
    public void testBug15670() throws Exception {
54
        new DefaultLibrariesInitializer().fullInitialize();
55
        DataManager manager = DALLocator.getDataManager();
56
        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
57

  
58
        EditableFeatureType type = new DefaultEditableFeatureType();
59
        GeometryType geometryType =
60
            geometryManager.getGeometryType(Geometry.TYPES.POINT,
61
                Geometry.SUBTYPES.GEOM2D);
62
        type.add("GEOMETRY", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
63
            .setGeometryType(geometryType);
64
        type.setDefaultGeometryAttributeName("GEOMETRY");
65

  
66
        NewFeatureStoreParameters destParams =
67
            (NewFeatureStoreParameters) manager.createNewStoreParameters(
68
                "FilesystemExplorer", "Shape");
69
        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
70
        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
71
        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
72
        destParams.setDynValue("crs", "EPSG:23030");
73
        destParams.setDefaultFeatureType(type);
74

  
75
        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
76
        FeatureStore store =
77
            (FeatureStore) manager.openStore("Shape", destParams);
78

  
79
        store.edit();
80
        EditableFeature feature = store.createNewFeature().getEditable();
81
        final Point geom =
82
            geometryManager.createPoint(10.0, 10.0, Geometry.SUBTYPES.GEOM2D);
83
        feature.setGeometry("GEOMETRY", geom);
84
        store.insert(feature);
85
        store.finishEditing();
86

  
87
        store.accept(new Visitor() {
88

  
89
            public void visit(Object obj) throws VisitCanceledException,
90
                BaseException {
91
                Feature feature = (Feature) obj;
92
                assertEquals(geom, feature.getGeometry("GEOMETRY"));
93
            }
94
        });
95
        store.dispose();
96
    }
97
}
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15617Test.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.fmap.dal.store.shp;
23

  
24
import junit.framework.TestCase;
25

  
26
import com.vividsolutions.jts.geom.Coordinate;
27
import com.vividsolutions.jts.geom.GeometryFactory;
28

  
29
import org.gvsig.fmap.dal.DALLocator;
30
import org.gvsig.fmap.dal.DataManager;
31
import org.gvsig.fmap.dal.DataTypes;
32
import org.gvsig.fmap.dal.feature.EditableFeature;
33
import org.gvsig.fmap.dal.feature.EditableFeatureType;
34
import org.gvsig.fmap.dal.feature.Feature;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
37
import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
38
import org.gvsig.fmap.geom.Geometry;
39
import org.gvsig.fmap.geom.GeometryLocator;
40
import org.gvsig.fmap.geom.GeometryManager;
41
import org.gvsig.fmap.geom.operation.GeometryOperation;
42
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
43
import org.gvsig.fmap.geom.operation.fromjts.FromJTS;
44
import org.gvsig.fmap.geom.type.GeometryType;
45
import org.gvsig.tools.exception.BaseException;
46
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
47
import org.gvsig.tools.visitor.VisitCanceledException;
48
import org.gvsig.tools.visitor.Visitor;
49

  
50
/**
51
 * Code to test bug gvsig-desktop#15617.
52
 * 
53
 * @author gvSIG Team
54
 * @version $Id$
55
 */
56
public class Bug15617Test extends TestCase {
57

  
58
    public void testBug15617() throws Exception {
59
        new DefaultLibrariesInitializer().fullInitialize();
60
        DataManager manager = DALLocator.getDataManager();
61
        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
62

  
63
        EditableFeatureType type = new DefaultEditableFeatureType();
64
        GeometryType geometryType =
65
            geometryManager.getGeometryType(Geometry.TYPES.POINT,
66
                Geometry.SUBTYPES.GEOM2D);
67
        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
68
            .setGeometryType(geometryType);
69
        type.setDefaultGeometryAttributeName("geom");
70
//        type.add("float", DataTypes.FLOAT).setSize(5);
71
//        type.add("double", DataTypes.DOUBLE).setSize(5);
72
        type.add("int", DataTypes.INT).setSize(5);
73
//        type.add("long", DataTypes.LONG).setSize(5);
74
        type.add("bool", DataTypes.BOOLEAN);
75

  
76
        NewFeatureStoreParameters destParams =
77
            (NewFeatureStoreParameters) manager.createNewStoreParameters(
78
                "FilesystemExplorer", "Shape");
79
        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
80
        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
81
        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
82
        destParams.setDynValue("crs", "EPSG:23030");
83
        destParams.setDefaultFeatureType(type);
84

  
85
        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
86
        FeatureStore store =
87
            (FeatureStore) manager.openStore("Shape", destParams);
88

  
89
        store.edit();
90
        EditableFeature feature = store.createNewFeature().getEditable();
91
        com.vividsolutions.jts.geom.Geometry g =
92
            new GeometryFactory().createPoint(new Coordinate(0, 0));
93

  
94
        int opCode = geometryManager.getGeometryOperationCode(FromJTS.NAME);
95
        GeometryOperation converter =
96
            geometryManager.getGeometryOperation(opCode, Geometry.TYPES.POINT,
97
                Geometry.SUBTYPES.GEOM2D);
98
        GeometryOperationContext ctx = new GeometryOperationContext();
99
        ctx.setAttribute(FromJTS.PARAM, g);
100
        Geometry fmapGeom = (Geometry) converter.invoke(null, ctx);
101
        feature.setGeometry(feature.getType()
102
            .getDefaultGeometryAttributeIndex(), fmapGeom);
103
//        feature.setFloat("float", 34.0f);
104
//        feature.setDouble("double", 34.0d);
105
        feature.setInt("int", 25);
106
//        feature.setLong("long", 34l);
107
        feature.setBoolean("bool", true);
108
        assertEquals(true, feature.getBoolean("bool"));
109
        store.insert(feature);
110
        store.finishEditing();
111

  
112
        store.accept(new Visitor() {
113

  
114
            public void visit(Object obj) throws VisitCanceledException,
115
                BaseException {
116
                Feature feature = (Feature) obj;
117
//                assertEquals(34.0f, feature.getFloat("float"));
118
//                assertEquals(34.0d, feature.getDouble("double"));
119
                assertEquals(25, feature.getInt("int"));
120
//                assertEquals(34l, feature.getLong("long"));
121
                assertEquals(true, feature.getBoolean("bool"));
122
            }
123
        });
124

  
125
        store.dispose();
126
    }
127

  
128
}
tags/v2_0_0_Build_2063/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15671Test.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.fmap.dal.store.shp;
23

  
24
import junit.framework.TestCase;
25

  
26
import org.gvsig.fmap.dal.DALLocator;
27
import org.gvsig.fmap.dal.DataManager;
28
import org.gvsig.fmap.dal.DataTypes;
29
import org.gvsig.fmap.dal.feature.EditableFeature;
30
import org.gvsig.fmap.dal.feature.EditableFeatureType;
31
import org.gvsig.fmap.dal.feature.Feature;
32
import org.gvsig.fmap.dal.feature.FeatureStore;
33
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
34
import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
35
import org.gvsig.fmap.geom.Geometry;
36
import org.gvsig.fmap.geom.GeometryLocator;
37
import org.gvsig.fmap.geom.GeometryManager;
38
import org.gvsig.fmap.geom.primitive.NullGeometry;
39
import org.gvsig.fmap.geom.type.GeometryType;
40
import org.gvsig.tools.exception.BaseException;
41
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
42
import org.gvsig.tools.visitor.VisitCanceledException;
43
import org.gvsig.tools.visitor.Visitor;
44

  
45
/**
46
 * Code to test bug gvsig-desktop#15671. This is based on the code provided by
47
 * the bug reporter (see ticket), thanks to him!!
48
 * 
49
 * @author gvSIG Team
50
 * @version $Id$
51
 */
52
public class Bug15671Test extends TestCase {
53

  
54
    public void testBug15671() throws Exception {
55
        new DefaultLibrariesInitializer().fullInitialize();
56
        DataManager manager = DALLocator.getDataManager();
57
        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
58

  
59
        EditableFeatureType type = new DefaultEditableFeatureType();
60
        GeometryType geometryType =
61
            geometryManager.getGeometryType(Geometry.TYPES.POINT,
62
                Geometry.SUBTYPES.GEOM2D);
63
        type.add("GEOMETRY", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
64
            .setGeometryType(geometryType);
65
        type.setDefaultGeometryAttributeName("GEOMETRY");
66
        type.add("double", DataTypes.DOUBLE);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff