Revision 38485

View differences:

tags/v2_0_0_Build_2049/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
    </dependencies>
195
    <build>
196
        <sourceDirectory>src</sourceDirectory>
197
        <testSourceDirectory>src-test</testSourceDirectory>
198
        <testResources>
199
            <testResource>
200
                <directory>src-test</directory>
201
            </testResource>
202
            <testResource>
203
                <directory>resources-test</directory>
204
            </testResource>
205
        </testResources>
206
        <plugins>
207
            <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
208
            <plugin>
209
                <groupId>org.apache.maven.plugins</groupId>
210
                <artifactId>maven-surefire-plugin</artifactId>
211
                <configuration>
212
                    <excludes>
213
                        <exclude>**/*Test*</exclude>
214
                    </excludes>
215
                    <!-- <includes>
216
                        <include>**/Bug*Test.java</include>
217
                         </includes> -->
218
           </configuration>
219
            </plugin>
220
        </plugins>
221
    </build>
222
    <profiles>
223
        <profile>
224
            <id>se</id>
225
            <activation>
226
                <activeByDefault>true</activeByDefault>
227
            </activation>
228
            <build>
229
                <plugins>
230
                    <plugin>
231
                        <groupId>org.apache.maven.plugins</groupId>
232
                        <artifactId>maven-jar-plugin</artifactId>
233
                        <configuration>
234
                            <excludes>
235
                                <exclude>${dbf-jarIncludes}</exclude>
236
                                <exclude>${dgn-jarIncludes}</exclude>
237
                                <exclude>${dxf-jarIncludes}</exclude>
238
                                <exclude>${shp-jarIncludes}</exclude>
239
                            </excludes>
240
                        </configuration>
241
                        <executions>
242
                            <!-- Generates a jar file only with the DAL file DBF 
243
                                Store classes -->
244
                            <execution>
245
                                <id>dbf</id>
246
                                <phase>package</phase>
247
                                <goals>
248
                                    <goal>jar</goal>
249
                                </goals>
250
                                <configuration>
251
                                    <classifier>store.dbf</classifier>
252
                                    <includes>
253
                                        <include>${dbf-jarIncludes}</include>
254
                                    </includes>
255
                                    <excludes>
256
                                        <exclude>${dbf-jarExcludes}</exclude>
257
                                    </excludes>
258
                                </configuration>
259
                            </execution>
260
                            <!-- Generates a jar file only with the DAL file DGN 
261
                                Store classes -->
262
                            <execution>
263
                                <id>dgn</id>
264
                                <phase>package</phase>
265
                                <goals>
266
                                    <goal>jar</goal>
267
                                </goals>
268
                                <configuration>
269
                                    <classifier>store.dgn</classifier>
270
                                    <includes>
271
                                        <include>${dgn-jarIncludes}</include>
272
                                    </includes>
273
                                    <excludes>
274
                                        <exclude>${dgn-jarExcludes}</exclude>
275
                                    </excludes>
276
                                </configuration>
277
                            </execution>
278
                            <!-- Generates a jar file only with the DAL file DGN 
279
                                Store legend classes -->
280
                            <execution>
281
                                <id>dgn.legend</id>
282
                                <phase>package</phase>
283
                                <goals>
284
                                    <goal>jar</goal>
285
                                </goals>
286
                                <configuration>
287
                                    <classifier>store.dgn.legend</classifier>
288
                                    <includes>
289
                                        <include>${dgn-legend-jarIncludes}</include>
290
                                    </includes>
291
                                    <excludes>
292
                                        <exclude>${dgn-legend-jarExcludes}</exclude>
293
                                    </excludes>
294
                                </configuration>
295
                            </execution>
296
                            <!-- Generates a jar file only with the DAL file DXF 
297
                                Store classes -->
298
                            <execution>
299
                                <id>dxf</id>
300
                                <phase>package</phase>
301
                                <goals>
302
                                    <goal>jar</goal>
303
                                </goals>
304
                                <configuration>
305
                                    <classifier>store.dxf</classifier>
306
                                    <includes>
307
                                        <include>${dxf-jarIncludes}</include>
308
                                    </includes>
309
                                    <excludes>
310
                                        <exclude>${dxf-jarExcludes}</exclude>
311
                                    </excludes>
312
                                </configuration>
313
                            </execution>
314
                            <!-- Generates a jar file only with the DAL file DXF 
315
                                Store legend classes -->
316
                            <execution>
317
                                <id>dxf.legend</id>
318
                                <phase>package</phase>
319
                                <goals>
320
                                    <goal>jar</goal>
321
                                </goals>
322
                                <configuration>
323
                                    <classifier>store.dxf.legend</classifier>
324
                                    <includes>
325
                                        <include>${dxf-legend-jarIncludes}</include>
326
                                    </includes>
327
                                    <excludes>
328
                                        <exclude>${dxf-legend-jarExcludes}</exclude>
329
                                    </excludes>
330
                                </configuration>
331
                            </execution>
332
                            <!-- Generates a jar file only with the DAL file SHP 
333
                                Store classes -->
334
                            <execution>
335
                                <id>shp</id>
336
                                <phase>package</phase>
337
                                <goals>
338
                                    <goal>jar</goal>
339
                                </goals>
340
                                <configuration>
341
                                    <classifier>store.shp</classifier>
342
                                    <includes>
343
                                        <include>${shp-jarIncludes}</include>
344
                                    </includes>
345
                                    <excludes>
346
                                        <exclude>${shp-jarExcludes}</exclude>
347
                                    </excludes>
348
                                </configuration>
349
                            </execution>
350
                        </executions>
351
                    </plugin>
352
                    <plugin>
353
                        <artifactId>maven-antrun-plugin</artifactId>
354
                        <executions>
355
                            <execution>
356
                                <id>services</id>
357
                                <phase>package</phase>
358
                                <goals>
359
                                    <goal>run</goal>
360
                                </goals>
361
                                <configuration>
362
                                    <tasks>
363
                                        <jar
364
                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
365
                                            update="true">
366
                                            <fileset dir="${basedir}/resources/api" />
367
                                        </jar>
368
                                        <jar
369
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dbf.jar"
370
                                            update="true">
371
                                            <fileset dir="${basedir}/resources/dbf" />
372
                                        </jar>
373
                                        <jar
374
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.jar"
375
                                            update="true">
376
                                            <fileset dir="${basedir}/resources/dgn" />
377
                                        </jar>
378
                                        <jar
379
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.legend.jar"
380
                                            update="true">
381
                                            <fileset
382
                                                dir="${basedir}/resources/dgn.legend" />
383
                                        </jar>
384
                                        <jar
385
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.jar"
386
                                            update="true">
387
                                            <fileset dir="${basedir}/resources/dxf" />
388
                                        </jar>
389
                                        <jar
390
                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.legend.jar"
391
                                            update="true">
392
                                            <fileset
393
                                                dir="${basedir}/resources/dxf.legend" />
394
                                        </jar>
395
                                        <jar
396
                                            destfile="${project.build.directory}/${project.build.finalName}-store.shp.jar"
397
                                            update="true">
398
                                            <fileset dir="${basedir}/resources/shp" />
399
                                        </jar>
400
                                    </tasks>
401
                                </configuration>
402
                            </execution>
403
                        </executions>
404
                    </plugin>
405
                    <plugin>
406
                        <groupId>org.apache.maven.plugins</groupId>
407
                        <artifactId>maven-surefire-plugin</artifactId>
408
                        <configuration>
409
                            <additionalClasspathElements>
410
                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
411
                                <additionalClasspathElement>${basedir}/resources/dbf</additionalClasspathElement>
412
                                <additionalClasspathElement>${basedir}/resources/dgn</additionalClasspathElement>
413
                                <additionalClasspathElement>${basedir}/resources/dgn.legend</additionalClasspathElement>
414
                                <additionalClasspathElement>${basedir}/resources/dxf</additionalClasspathElement>
415
                                <additionalClasspathElement>${basedir}/resources/dxf.legend</additionalClasspathElement>
416
                                <additionalClasspathElement>${basedir}/resources/shp</additionalClasspathElement>
417
                            </additionalClasspathElements>
418
                        </configuration>
419
                    </plugin>
420
                </plugins>
421
            </build>
422
        </profile>
423
        <profile>
424
            <id>cdc</id>
425
            <activation>
426
                <activeByDefault>false</activeByDefault>
427
            </activation>
428
            <build>
429
                <plugins>
430
                    <plugin>
431
                        <groupId>org.apache.maven.plugins</groupId>
432
                        <artifactId>maven-compiler-plugin</artifactId>
433
                        <configuration>
434
                            <excludes>
435
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
436
                            </excludes>
437
                            <testExcludes>
438
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
439
                                <exclude>org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java</exclude>
440
                            </testExcludes>
441
                        </configuration>
442
                    </plugin>
443
                    <plugin>
444
                        <groupId>org.apache.maven.plugins</groupId>
445
                        <artifactId>maven-jar-plugin</artifactId>
446
                        <configuration>
447
                            <excludes>
448
                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
449
                            </excludes>
450
                        </configuration>
451
                    </plugin>
452
                    <plugin>
453
                        <artifactId>maven-antrun-plugin</artifactId>
454
                        <executions>
455
                            <execution>
456
                                <id>services</id>
457
                                <phase>package</phase>
458
                                <goals>
459
                                    <goal>run</goal>
460
                                </goals>
461
                                <configuration>
462
                                    <tasks>
463
                                        <jar
464
                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
465
                                            update="true">
466
                                            <fileset dir="${basedir}/resources/api" />
467
                                        </jar>
468
                                    </tasks>
469
                                </configuration>
470
                            </execution>
471
                        </executions>
472
                    </plugin>
473
                    <plugin>
474
                        <groupId>org.apache.maven.plugins</groupId>
475
                        <artifactId>maven-surefire-plugin</artifactId>
476
                        <configuration>
477
                            <additionalClasspathElements>
478
                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
479
                            </additionalClasspathElements>
480
                        </configuration>
481
                    </plugin>
482
                </plugins>
483
            </build>
484
        </profile>
485
        <profile>
486
            <id>eclipse-project</id>
487
            <build>
488
                <defaultGoal>antrun:run</defaultGoal>
489
                <plugins>
490
                    <plugin>
491
                        <artifactId>maven-antrun-plugin</artifactId>
492
                        <configuration>
493
                            <tasks>
494
                                <ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
495
                                    target="eclipse.all" />
496
                            </tasks>
497
                        </configuration>
498
                    </plugin>
499
                </plugins>
500
            </build>
501
        </profile>
502
    </profiles>
503
    <reporting>
504
        <plugins>
505
            <plugin>
506
                <groupId>org.apache.maven.plugins</groupId>
507
                <artifactId>maven-javadoc-plugin</artifactId>
508
                <configuration>
509
                    <doctitle>${project.name} ${project.version}</doctitle>
510
                    <groups>
511
                        <group>
512
                            <title>DAL File common</title>
513
                            <packages>org.gvsig.fmap.dal*</packages>
514
                        </group>
515
                        <group>
516
                            <title>DBF Store</title>
517
                            <packages>org.gvsig.fmap.dal.store.dbf*</packages>
518
                        </group>
519
                        <group>
520
                            <title>DGN Store</title>
521
                            <packages>org.gvsig.fmap.dal.store.dgn*</packages>
522
                        </group>
523
                        <group>
524
                            <title>SHP Store</title>
525
                            <packages>org.gvsig.fmap.dal.store.shp*</packages>
526
                        </group>
527
                        <group>
528
                            <title>DXF Store</title>
529
                            <packages>org.gvsig.fmap.dal.store.dxf*</packages>
530
                        </group>
531
                    </groups>
532
                </configuration>
533
            </plugin>
534
        </plugins>
535
    </reporting>
536
</project>
tags/v2_0_0_Build_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/libraries/libFMap_dalfile/resources/api/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.dal.DALFileLibrary
tags/v2_0_0_Build_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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_2049/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);
67

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

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

  
81
        store.edit();
82
        EditableFeature feature = store.createNewFeature().getEditable();
83
        NullGeometry geom =
84
            geometryManager.createNullGeometry(Geometry.SUBTYPES.GEOM2D);
85
        feature.setGeometry("GEOMETRY", geom);
86
        feature.setDouble("double", 42.0d);
87
        store.insert(feature);
88
        store.finishEditing();
89

  
90
        store.accept(new Visitor() {
91

  
92
            public void visit(Object obj) throws VisitCanceledException,
93
                BaseException {
94
                Feature feature = (Feature) obj;
95
                Geometry geometry = feature.getGeometry("GEOMETRY");
96
                assertEquals(
97
                    "Read geometry must be of Null Geometry type instead of "
98
                        + geometry.getGeometryType().getName(),
99
                    Geometry.TYPES.NULL, geometry.getType());
100
            }
101
        });
102
        store.dispose();
103
    }
104

  
105
}
tags/v2_0_0_Build_2049/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15597Test.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 java.io.File;
25

  
26
import junit.framework.TestCase;
27

  
28
import org.gvsig.fmap.dal.DALLocator;
29
import org.gvsig.fmap.dal.DataManager;
30
import org.gvsig.fmap.dal.DataTypes;
31
import org.gvsig.fmap.dal.feature.EditableFeature;
32
import org.gvsig.fmap.dal.feature.EditableFeatureType;
33
import org.gvsig.fmap.dal.feature.Feature;
34
import org.gvsig.fmap.dal.feature.FeatureSet;
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.Geometry.SUBTYPES;
40
import org.gvsig.fmap.geom.GeometryLocator;
41
import org.gvsig.fmap.geom.GeometryManager;
42
import org.gvsig.fmap.geom.type.GeometryType;
43
import org.gvsig.tools.dispose.DisposableIterator;
44
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
45

  
46
/**
47
 * Code to test bug gvsig-desktop#15597. This is based on the code provided by
48
 * the bug reporter (see ticket), thanks to him!!
49
 * 
50
 * @author gvSIG Team
51
 * @version $Id$
52
 */
53
public class Bug15597Test extends TestCase {
54
    private static final String TEMP_PATH = System.getProperty("java.io.tmpdir") + File.separator;
55
    
56
    public void testBug15642() throws Exception {
57
        new DefaultLibrariesInitializer().fullInitialize();
58
        DataManager manager = DALLocator.getDataManager();
59
        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
60

  
61
        //Create a feature type with two fields: "geom" and "field1"
62
        EditableFeatureType type = new DefaultEditableFeatureType();
63
        GeometryType geometryType =
64
            geometryManager.getGeometryType(Geometry.TYPES.POINT,
65
                Geometry.SUBTYPES.GEOM2D);
66
        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
67
            .setGeometryType(geometryType);
68
        type.setDefaultGeometryAttributeName("geom");
69
        type.add("field1", DataTypes.STRING).setSize(2);
70
       
71
        //Create a store
72
        NewFeatureStoreParameters destParams =
73
            (NewFeatureStoreParameters) manager.createNewStoreParameters(
74
                "FilesystemExplorer", "Shape");
75
        destParams.setDynValue("shpfile", TEMP_PATH + "mySHP.shp");      
76
        destParams.setDynValue("crs", "EPSG:23030");
77
        destParams.setDefaultFeatureType(type);
78

  
79
        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
80
        FeatureStore store =
81
            (FeatureStore) manager.openStore("Shape", destParams);
82

  
83
                
84
        //Edit the store and add a new Feature.
85
        store.edit();
86
             
87
        EditableFeature feature1 = store.createNewFeature().getEditable();
88
        feature1.setGeometry(type.getDefaultGeometryAttributeIndex(), 
89
            geometryManager.createPoint(0, 0, SUBTYPES.GEOM2D));
90
        feature1.set("field1", "Hi");                     
91
      
92
        store.insert(feature1);
93
        
94
        //Finish the edition
95
        store.finishEditing();
96

  
97
        //Edit the feature type and add a new field: "field2"
98
        store.edit();
99
       
100
        EditableFeatureType type2 = 
101
            store.getDefaultFeatureType().getEditable();        
102
        type2.add("field2", DataTypes.STRING).setSize(10);
103
        store.update(type2);    
104
        
105
        assertEquals(store.getDefaultFeatureType().getAttributeDescriptors().length, 3);
106
        
107
        //Add a second feature
108
        EditableFeature feature2 = store.createNewFeature().getEditable();
109
        feature2.setGeometry(type2.getDefaultGeometryAttributeIndex(),
110
            geometryManager.createPoint(1, 1, SUBTYPES.GEOM2D));
111
        feature2.set("field1", "Hi");    
112
        feature2.set("field2", "Max");   
113
       
114
        store.insert(feature2);
115
        
116
        //The edition is not finished. Check if all the features have the two fields
117
        FeatureSet featureSet = store.getFeatureSet();
118
        DisposableIterator it = featureSet.fastIterator();
119
        
120
        it.hasNext();
121
        Feature feature = (Feature)it.next();   
122
        assertNotNull(feature.getDefaultGeometry());
123
        assertEquals("Hi", feature.get("field1"));
124
        assertNull(feature.get("field2"));
125
        
126
        it.hasNext();
127
        feature = (Feature)it.next();   
128
        assertNotNull(feature.getDefaultGeometry());
129
        assertEquals("Hi", feature.get("field1"));
130
        assertEquals("Max", feature.get("field2"));        
131
        
132
        it.dispose();
133
        store.finishEditing();
134
        
135
        //Edit the feature type and remove the field: "field1"
136
        store.edit();
137
        
138
        EditableFeatureType type3 = 
139
            store.getDefaultFeatureType().getEditable();        
140
        type3.remove("field1");
141
        store.update(type3);    
142
        
143
        assertEquals(store.getDefaultFeatureType().getAttributeDescriptors().length, 2);
144
                
145
        //Finish the edition
146
        store.finishEditing();
147
        
148
        //Check if all the features have one field
149
        featureSet = store.getFeatureSet();
150
        it = featureSet.fastIterator();        
151
        
152
        it.hasNext();
153
        feature = (Feature)it.next();   
154
        assertNotNull(feature.getDefaultGeometry());       
155
        assertEquals("", feature.get("field2"));
156
        
157
        it.hasNext();
158
        feature = (Feature)it.next();   
159
        assertNotNull(feature.getDefaultGeometry());
160
        assertEquals("Max", feature.get("field2"));     
161
        
162
        it.dispose();
163
        store.dispose();
164
    }
165
}
0 166

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff