Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/pom.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/pom.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/pom.xml	(revision 38736)
@@ -0,0 +1,536 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.fmap.dal.file</artifactId>
+    <packaging>jar</packaging>
+    <version>2.0-SNAPSHOT</version>
+    <name>libFMap_dalfile</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>gvsig-base-library-pom</artifactId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>
+    <properties>
+        <!-- dbf -->
+        <dbf-jarIncludes>org/gvsig/fmap/dal/store/dbf/**/**</dbf-jarIncludes>
+        <dbf-jarExcludes>NONE</dbf-jarExcludes>
+
+        <!-- dgn -->
+        <dgn-jarIncludes>org/gvsig/fmap/dal/store/dgn/**/**</dgn-jarIncludes>
+        <dgn-legend-jarIncludes>org/gvsig/fmap/dal/store/dgn/legend/**/**</dgn-legend-jarIncludes>
+        <dgn-jarExcludes>${dgn-legend-jarIncludes}</dgn-jarExcludes>
+        <dgn-legend-jarExcludes>NONE</dgn-legend-jarExcludes>
+
+        <!-- dxf -->
+        <dxf-jarIncludes>org/gvsig/fmap/dal/store/dxf/**/**</dxf-jarIncludes>
+        <dxf-legend-jarIncludes>org/gvsig/fmap/dal/store/dxf/legend/**/**</dxf-legend-jarIncludes>
+        <dxf-jarExcludes>${dxf-legend-jarIncludes}</dxf-jarExcludes>
+        <dxf-legend-jarExcludes>NONE</dxf-legend-jarExcludes>
+
+        <!-- shp -->
+        <shp-jarIncludes>org/gvsig/fmap/dal/store/shp/**/**</shp-jarIncludes>
+        <shp-jarExcludes>NONE</shp-jarExcludes>
+
+        <!-- Common -->
+        <common-jarIncludes>**/**</common-jarIncludes>
+        <build-dir>${basedir}/../build</build-dir>
+        <eclipse.project.name>libFMap_dalfile</eclipse.project.name>
+    </properties>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.gvsig</groupId>
+                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
+                <version>2.0.1-SNAPSHOT</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.projection</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.dal</artifactId>
+            <classifier>spi</classifier>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.dxf</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.symbology.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.evaluator.sqljep</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry</artifactId>
+            <classifier>operation</classifier>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>	
+		<!-- TESTS -->
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.compat</artifactId>
+			<classifier>se</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.dal</artifactId>
+			<classifier>impl</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.utils</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.dal</artifactId>
+			<classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.dal.index.spatial</artifactId>
+			<classifier>jts</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+			<classifier>impl</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
+			<classifier>operation</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.projection</artifactId>
+			<classifier>cresques-impl</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.symbology.lib.impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.timesupport.lib.impl</artifactId>
+            <scope>test</scope>
+        </dependency>   
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.impl</artifactId>
+            <scope>test</scope>
+        </dependency>   
+    </dependencies>
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <testSourceDirectory>src-test</testSourceDirectory>
+        <testResources>
+            <testResource>
+                <directory>src-test</directory>
+            </testResource>
+            <testResource>
+                <directory>resources-test</directory>
+            </testResource>
+        </testResources>
+        <plugins>
+            <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>**/*Test*</exclude>
+                    </excludes>
+                    <!-- <includes>
+                        <include>**/Bug*Test.java</include>
+                         </includes> -->
+           </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>se</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>${dbf-jarIncludes}</exclude>
+                                <exclude>${dgn-jarIncludes}</exclude>
+                                <exclude>${dxf-jarIncludes}</exclude>
+                                <exclude>${shp-jarIncludes}</exclude>
+                            </excludes>
+                        </configuration>
+                        <executions>
+                            <!-- Generates a jar file only with the DAL file DBF 
+                                Store classes -->
+                            <execution>
+                                <id>dbf</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.dbf</classifier>
+                                    <includes>
+                                        <include>${dbf-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${dbf-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                            <!-- Generates a jar file only with the DAL file DGN 
+                                Store classes -->
+                            <execution>
+                                <id>dgn</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.dgn</classifier>
+                                    <includes>
+                                        <include>${dgn-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${dgn-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                            <!-- Generates a jar file only with the DAL file DGN 
+                                Store legend classes -->
+                            <execution>
+                                <id>dgn.legend</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.dgn.legend</classifier>
+                                    <includes>
+                                        <include>${dgn-legend-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${dgn-legend-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                            <!-- Generates a jar file only with the DAL file DXF 
+                                Store classes -->
+                            <execution>
+                                <id>dxf</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.dxf</classifier>
+                                    <includes>
+                                        <include>${dxf-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${dxf-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                            <!-- Generates a jar file only with the DAL file DXF 
+                                Store legend classes -->
+                            <execution>
+                                <id>dxf.legend</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.dxf.legend</classifier>
+                                    <includes>
+                                        <include>${dxf-legend-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${dxf-legend-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                            <!-- Generates a jar file only with the DAL file SHP 
+                                Store classes -->
+                            <execution>
+                                <id>shp</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                                <configuration>
+                                    <classifier>store.shp</classifier>
+                                    <includes>
+                                        <include>${shp-jarIncludes}</include>
+                                    </includes>
+                                    <excludes>
+                                        <exclude>${shp-jarExcludes}</exclude>
+                                    </excludes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>services</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <tasks>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/api" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.dbf.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/dbf" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/dgn" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.dgn.legend.jar"
+                                            update="true">
+                                            <fileset
+                                                dir="${basedir}/resources/dgn.legend" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/dxf" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.dxf.legend.jar"
+                                            update="true">
+                                            <fileset
+                                                dir="${basedir}/resources/dxf.legend" />
+                                        </jar>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}-store.shp.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/shp" />
+                                        </jar>
+                                    </tasks>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <additionalClasspathElements>
+                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/dbf</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/dgn</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/dgn.legend</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/dxf</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/dxf.legend</additionalClasspathElement>
+                                <additionalClasspathElement>${basedir}/resources/shp</additionalClasspathElement>
+                            </additionalClasspathElements>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>cdc</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
+                            </excludes>
+                            <testExcludes>
+                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
+                                <exclude>org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java</exclude>
+                            </testExcludes>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>org/gvsig/fmap/dal/store/**</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>services</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <tasks>
+                                        <jar
+                                            destfile="${project.build.directory}/${project.build.finalName}.jar"
+                                            update="true">
+                                            <fileset dir="${basedir}/resources/api" />
+                                        </jar>
+                                    </tasks>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <additionalClasspathElements>
+                                <additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+                            </additionalClasspathElements>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>eclipse-project</id>
+            <build>
+                <defaultGoal>antrun:run</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <configuration>
+                            <tasks>
+                                <ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
+                                    target="eclipse.all" />
+                            </tasks>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <doctitle>${project.name} ${project.version}</doctitle>
+                    <groups>
+                        <group>
+                            <title>DAL File common</title>
+                            <packages>org.gvsig.fmap.dal*</packages>
+                        </group>
+                        <group>
+                            <title>DBF Store</title>
+                            <packages>org.gvsig.fmap.dal.store.dbf*</packages>
+                        </group>
+                        <group>
+                            <title>DGN Store</title>
+                            <packages>org.gvsig.fmap.dal.store.dgn*</packages>
+                        </group>
+                        <group>
+                            <title>SHP Store</title>
+                            <packages>org.gvsig.fmap.dal.store.shp*</packages>
+                        </group>
+                        <group>
+                            <title>DXF Store</title>
+                            <packages>org.gvsig.fmap.dal.store.dxf*</packages>
+                        </group>
+                    </groups>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn.legend/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn.legend/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn.legend/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.dgn.legend.DGNLegendLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.dgn.DGNLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml	(revision 38736)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a shp file.  
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    
+    <class name="DGN" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="SpatialProvider"/>
+      </extends>
+      <description>Metadata of a DGN store</description>
+      <fields>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml	(revision 38736)
@@ -0,0 +1,20 @@
+<?xml version= "1.0 "?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DGNStoreParameters">
+      <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Store the parameters need to open a dgn file</description>
+      <fields>
+        <field name="file" type="file" mandatory="true">
+          <description>dgn file</description>
+        </field>
+        <field name="CRS" type="crs" mandatory="true">
+          <description>The coordinate reference system used in this dgn file</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dgn/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/api/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.DALFileLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.shp.SHPLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPMetadata.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPMetadata.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPMetadata.xml	(revision 38736)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a shp file.  
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    
+    <class name="Shape" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="dbf"/>
+      	<class namespace="Metadata" name="SpatialProvider"/>
+      </extends>
+      <description>Metadata of a Shape store</description>
+      <fields>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPMetadata.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPParameters.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPParameters.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPParameters.xml	(revision 38736)
@@ -0,0 +1,54 @@
+<?xml version= "1.0 "?>
+<definitions>
+	<version>1.0.0</version>
+	<classes>
+		<class name="SHPStoreParameters">
+			<extends>
+				<class namespace="dal" name="ProviderParameters" />
+				<class name="DBFStoreParameters" />
+			</extends>
+			<description>Store the parameters need to open a shp file
+			</description>
+			<fields>
+				<field name="dbfFile" type="file" mandatory="false" group="Advanced">
+					<description>dbf file</description>
+				</field>
+				<field name="shxFile" type="file" mandatory="false" group="Advanced">
+					<description>The shx file associated to this shape file
+					</description>
+				</field>
+				<field name="shpFile" type="file" mandatory="true" group="Basic">
+					<description>The shp file associated to this shape file
+					</description>
+				</field>
+				<field name="CRS" type="crs" mandatory="true" group="Basic">
+					<description>The coordinate reference system used in this shape
+						file</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="SHPNewStoreParameters">
+			<description>Store the parameters need to create a shape file
+			</description>
+			<extends>
+				<class>SHPStoreParameters</class>
+				<class>DBFNewStoreParameters</class>
+			</extends>
+			<fields>
+				<field name="geometryType" type="integer" mandatory="true" group="Basic">
+					<description>Geometry type use Geometry.TYPES</description>
+					<availableValues>
+						<value label="POINT">1</value>
+						<value label="CURVE">2</value>
+						<value label="SURFACE">3</value>
+						<value label="MULTIPOINT">7</value>
+						<value label="MULTICURVE">8</value>
+                        <value label="MULTISURFACE">9</value>
+					</availableValues>
+				</field>
+			</fields>
+		</class>
+
+	</classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/shp/org/gvsig/fmap/dal/store/shp/SHPParameters.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFMetadata.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFMetadata.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFMetadata.xml	(revision 38736)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a dbf file.  
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DBF" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="FeatureProvider"/>
+      </extends>
+      <description>Metadata of a DBF store</description>
+      <fields>
+        <field name="Encoding" type="string" mandatory="false">
+          <description>Encoding used</description>
+          <availableValues>
+          	<value label="(default)"></value>
+            <value label="US-ASCII">US-ASCII</value>
+            <value label="ISO-8859-1">ISO-8859-1</value>
+            <value label="ISO-8859-15">ISO-8859-15</value>
+            <value label="windows-1250">windows-1250</value>
+            <value label="windows-1252">windows-1252</value>
+            <value label="UTF-8">UTF-8</value>
+            <value label="UTF-16">UTF-16</value>
+            <value label="UTF-16BE">UTF-16BE</value>
+            <value label="UTF-16LE">UTF-16LE</value>
+          </availableValues>
+        </field>
+        <field name="CodePage" type="Integer" mandatory="false">          
+          <description>Code page used</description>
+          <availableValues>
+            <value label="DOS USA">0x01</value>
+            <value label="DOS Multilingual">0x02</value>
+            <value label="Windows ANSI">0x03</value>
+            <value label="Standard Macintosh">0x04</value>
+            <value label="EE MS-DOS">0x64</value>
+            <value label="Nordic MS-DOS">0x65</value>
+            <value label="Russian MS-DOS">0x66</value>
+            <value label="Icelandic MS-DOS">0x67</value>
+            <value label="Kamenicky (Czech) MS-DOS">0x68</value>
+            <value label="Mazovia (Polish) MS-DOS">0x69</value>
+            <value label="Greek MS-DOS (437G)">0x6A</value>
+            <value label="Turkish MS-DOS">0x6B</value>
+            <value label="Russian Macintosh">0x96</value>
+            <value label="Macintosh">0x97</value>
+            <value label="Greek Macintosh">0x98</value>
+            <value label="Windows EE">0xC8</value>
+            <value label="Russian Windows">0xC9</value>
+            <value label="Turkish Windows">0xCA</value>
+            <value label="Greek Windows">0xCB</value>
+          </availableValues> 
+        </field>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFMetadata.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFParameters.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFParameters.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFParameters.xml	(revision 38736)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DBFStoreParameters">
+      <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Store the parameters need to open a dbf file</description>
+      <fields>
+        <field name="DbfFile" type="file" mandatory="true" group="Basic">
+          <description>dbf file</description>
+        </field>
+        <field name="Encoding" type="string" mandatory="false" group="Basic">
+          <description>Encoding used in this file</description>
+          <availableValues>
+          	<value label="(default)"></value>
+            <value label="US-ASCII">US-ASCII</value>
+            <value label="ISO-8859-1">ISO-8859-1</value>
+            <value label="ISO-8859-15">ISO-8859-15</value>
+            <value label="windows-1250">windows-1250</value>
+            <value label="windows-1252">windows-1252</value>
+            <value label="UTF-8">UTF-8</value>
+            <value label="UTF-16">UTF-16</value>
+            <value label="UTF-16BE">UTF-16BE</value>
+            <value label="UTF-16LE">UTF-16LE</value>
+          </availableValues>
+        </field>
+      </fields>
+    </class>
+
+    <class name="DBFNewStoreParameters">
+      <description>Store the parameters need to create a dbf file</description>
+      <extends>
+        <class>DBFStoreParameters</class>
+        <class namespace="dal" name="NewProviderParameters"/>
+      </extends>
+      <fields>
+        <field name="codePage" type="Integer" mandatory="false"  group="Advanced">          
+          <description>Code page used in this file</description>
+          <availableValues>
+            <value label="DOS USA">0x01</value>
+            <value label="DOS Multilingual">0x02</value>
+            <value label="Windows ANSI">0x03</value>
+            <value label="Standard Macintosh">0x04</value>
+            <value label="EE MS-DOS">0x64</value>
+            <value label="Nordic MS-DOS">0x65</value>
+            <value label="Russian MS-DOS">0x66</value>
+            <value label="Icelandic MS-DOS">0x67</value>
+            <value label="Kamenicky (Czech) MS-DOS">0x68</value>
+            <value label="Mazovia (Polish) MS-DOS">0x69</value>
+            <value label="Greek MS-DOS (437G)">0x6A</value>
+            <value label="Turkish MS-DOS">0x6B</value>
+            <value label="Russian Macintosh">0x96</value>
+            <value label="Macintosh">0x97</value>
+            <value label="Greek Macintosh">0x98</value>
+            <value label="Windows EE">0xC8</value>
+            <value label="Russian Windows">0xC9</value>
+            <value label="Turkish Windows">0xCA</value>
+            <value label="Greek Windows">0xCB</value>
+          </availableValues> 
+        </field>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/org/gvsig/fmap/dal/store/dbf/DBFParameters.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dbf/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.dbf.DBFLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf.legend/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf.legend/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf.legend/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.dxf.legend.DXFLegendLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/META-INF/services/org.gvsig.tools.library.Library	(revision 38736)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.store.dxf.DXFLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFParameters.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFParameters.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFParameters.xml	(revision 38736)
@@ -0,0 +1,20 @@
+<?xml version= "1.0 "?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DXFStoreParameters">
+       <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Store the parameters need to open a dxf file</description>
+      <fields>
+        <field name="File" type="file" mandatory="true" group="Basic">
+          <description>dxf file</description>
+        </field>
+        <field name="CRS" type="crs" mandatory="true" group="Basic">
+          <description>The coordinate reference system used in this dxf file</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFParameters.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFMetadata.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFMetadata.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFMetadata.xml	(revision 38736)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a shp file.  
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    
+    <class name="DXF" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="SpatialProvider"/>
+      </extends>
+      <description>Metadata of a DXF store</description>
+      <fields>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources/dxf/org/gvsig/fmap/dal/store/dxf/DXFMetadata.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/data/prueba.dxf
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/data/prueba.dxf	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/data/prueba.dxf	(revision 38736)
@@ -0,0 +1,10410 @@
+999
+TRANSLATION BY geo.cresques.io.DxfFile
+999
+DATE : Thu Mar 13 09:56:42 CET 2008
+  0
+SECTION
+  2
+HEADER
+  9
+$ACADVER
+  1
+AC1015
+  9
+$INSBASE
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$EXTMIN
+ 10
+999999999.000000
+ 20
+999999999.000000
+ 30
+0.000000
+  9
+$EXTMAX
+ 10
+-999999999.000000
+ 20
+-999999999.000000
+ 30
+0.000000
+  9
+$LIMMIN
+ 10
+999999999.000000
+ 20
+999999999.000000
+  9
+$LIMMAX
+ 10
+-999999999.000000
+ 20
+-999999999.000000
+  9
+$ORTHOMODE
+ 70
+     0
+  9
+$REGENMODE
+ 70
+     1
+  9
+$FILLMODE
+ 70
+     1
+  9
+$QTEXTMODE
+ 70
+     0
+  9
+$MIRRTEXT
+ 70
+     1
+  9
+$DRAGMODE
+ 70
+     2
+  9
+$LTSCALE
+ 40
+1.0
+  9
+$OSMODE
+ 70
+     0
+  9
+$ATTMODE
+ 70
+     1
+  9
+$TEXTSIZE
+ 40
+0.2
+  9
+$TRACEWID
+ 40
+0.05
+  9
+$TEXTSTYLE
+  7
+STANDARD
+  9
+$CLAYER
+  8
+0
+  9
+$CELTYPE
+  6
+CONTINUOUS
+  9
+$CECOLOR
+ 62
+   256
+  9
+$DIMSCALE
+ 40
+1.0
+  9
+$DIMASZ
+ 40
+0.18
+  9
+$DIMEXO
+ 40
+0.0625
+  9
+$DIMDLI
+ 40
+0.38
+  9
+$DIMRND
+ 40
+0.0
+  9
+$DIMDLE
+ 40
+0.0
+  9
+$DIMEXE
+ 40
+0.18
+  9
+$DIMTP
+ 40
+0.0
+  9
+$DIMTM
+ 40
+0.0
+  9
+$DIMTXT
+ 40
+0.18
+  9
+$DIMCEN
+ 40
+0.09
+  9
+$DIMTSZ
+ 40
+0.0
+  9
+$DIMTOL
+ 70
+     0
+  9
+$DIMLIM
+ 70
+     0
+  9
+$DIMTIH
+ 70
+     1
+  9
+$DIMTOH
+ 70
+     1
+  9
+$DIMSE1
+ 70
+     0
+  9
+$DIMSE2
+ 70
+     0
+  9
+$DIMTAD
+ 70
+     0
+  9
+$DIMZIN
+ 70
+     0
+  9
+$DIMBLK
+  1
+
+  9
+$DIMASO
+ 70
+     1
+  9
+$DIMSHO
+ 70
+     1
+  9
+$DIMPOST
+  1
+
+  9
+$DIMAPOST
+  1
+
+  9
+$DIMALT
+ 70
+     0
+  9
+$DIMALTD
+ 70
+     2
+  9
+$DIMALTF
+ 40
+25.4
+  9
+$DIMLFAC
+ 40
+1.0
+  9
+$DIMTOFL
+ 70
+     0
+  9
+$DIMTVP
+ 40
+0.0
+  9
+$DIMTIX
+ 70
+     0
+  9
+$DIMSOXD
+ 70
+     0
+  9
+$DIMSAH
+ 70
+     0
+  9
+$DIMBLK1
+  1
+
+  9
+$DIMBLK2
+  1
+
+  9
+$DIMSTYLE
+  2
+STANDARD
+  9
+$DIMCLRD
+ 70
+     0
+  9
+$DIMCLRE
+ 70
+     0
+  9
+$DIMCLRT
+ 70
+     0
+  9
+$DIMTFAC
+ 40
+1.0
+  9
+$DIMGAP
+ 40
+0.09
+  9
+$LUNITS
+ 70
+     2
+  9
+$LUPREC
+ 70
+     4
+  9
+$AXISMODE
+ 70
+     0
+  9
+$AXISUNIT
+ 10
+0.0
+ 20
+0.0
+  9
+$SKETCHINC
+ 40
+0.1
+  9
+$FILLETRAD
+ 40
+0.0
+  9
+$AUNITS
+ 70
+     0
+  9
+$AUPREC
+ 70
+     0
+  9
+$MENU
+  1
+acad
+  9
+$ELEVATION
+ 40
+0.0
+  9
+$PELEVATION
+ 40
+0.0
+  9
+$THICKNESS
+ 40
+0.0
+  9
+$LIMCHECK
+ 70
+     0
+  9
+$BLIPMODE
+ 70
+     1
+  9
+$CHAMFERA
+ 40
+0.0
+  9
+$CHAMFERB
+ 40
+0.0
+  9
+$SKPOLY
+ 70
+     0
+  9
+$TDCREATE
+ 40
+2453116.436828704
+  9
+$TDUPDATE
+ 40
+2453116.436828704
+  9
+$TDINDWG
+ 40
+0.0000000000
+  9
+$TDUSRTIMER
+ 40
+0.0000000000
+  9
+$USRTIMER
+ 70
+     1
+  9
+$ANGBASE
+ 50
+0.0
+  9
+$ANGDIR
+ 70
+     0
+  9
+$PDMODE
+ 70
+     0
+  9
+$PDSIZE
+ 40
+0.0
+  9
+$PLINEWID
+ 40
+0.0
+  9
+$COORDS
+ 70
+     0
+  9
+$SPLFRAME
+ 70
+     0
+  9
+$SPLINETYPE
+ 70
+     6
+  9
+$SPLINESEGS
+ 70
+    10
+  9
+$ATTDIA
+ 70
+     0
+  9
+$ATTREQ
+ 70
+     1
+  9
+$HANDLING
+ 70
+     1
+  9
+$HANDSEED
+  5
+394B
+  9
+$SURFTAB1
+ 70
+     6
+  9
+$SURFTAB2
+ 70
+     6
+  9
+$SURFTYPE
+ 70
+     6
+  9
+$SURFU
+ 70
+     6
+  9
+$SURFV
+ 70
+     6
+  9
+$UCSNAME
+  2
+
+  9
+$UCSORG
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSXDIR
+ 10
+1.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSYDIR
+ 10
+0.0
+ 20
+1.0
+ 30
+0.0
+  9
+$PUCSNAME
+  2
+
+  9
+$PUCSORG
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$PUCSXDIR
+ 10
+1.0
+ 20
+0.0
+ 30
+0.0
+  9
+$PUCSYDIR
+ 10
+0.0
+ 20
+1.0
+ 30
+0.0
+  9
+$USERI1
+ 70
+     0
+  9
+$USERI2
+ 70
+     0
+  9
+$USERI3
+ 70
+     0
+  9
+$USERI4
+ 70
+     0
+  9
+$USERI5
+ 70
+     0
+  9
+$USERR1
+ 40
+0.0
+  9
+$USERR2
+ 40
+0.0
+  9
+$USERR3
+ 40
+0.0
+  9
+$USERR4
+ 40
+0.0
+  9
+$USERR5
+ 40
+0.0
+  9
+$WORLDVIEW
+ 70
+     1
+  9
+$SHADEDGE
+ 70
+     3
+  9
+$SHADEDIF
+ 70
+    70
+  9
+$TILEMODE
+ 70
+     1
+  9
+$MAXACTVP
+ 70
+    16
+  9
+$PINSBASE
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$PLIMCHECK
+ 70
+     0
+  9
+$PEXTMIN
+ 10
+-1.000000E+20
+ 20
+-1.000000E+20
+ 30
+-1.000000E+20
+  9
+$PEXTMAX
+ 10
+-1.000000E+20
+ 20
+-1.000000E+20
+ 30
+-1.000000E+20
+  9
+$PLIMMIN
+ 10
+0.0
+ 20
+0.0
+  9
+$PLIMMAX
+ 10
+12.0
+ 20
+9.0
+  9
+$UNITMODE
+ 70
+     0
+  9
+$VISRETAIN
+ 70
+     0
+  9
+$PLINEGEN
+ 70
+     1
+  9
+$PSLTSCALE
+ 70
+     0
+  9
+$TREEDEPTH
+ 70
+  3020
+  9
+$DWGCODEPAGE
+  3
+ansi_1252
+  0
+ENDSEC
+  0
+SECTION
+  2
+TABLES
+  0
+TABLE
+  2
+VPORT
+  5
+     8
+100
+AcDbSymbolTable
+ 70
+     0
+  0
+ENDTAB
+  0
+TABLE
+  2
+LTYPE
+  5
+     5
+100
+AcDbSymbolTable
+ 70
+     1
+  0
+LTYPE
+  5
+    14
+100
+AcDbSymbolTableRecord
+100
+AcDbLinetypeTableRecord
+  2
+ByBlock
+ 70
+     0
+  3
+
+ 72
+    65
+ 73
+     0
+ 40
+0.0000
+  0
+LTYPE
+  5
+    15
+100
+AcDbSymbolTableRecord
+100
+AcDbLinetypeTableRecord
+  2
+ByLayer
+ 70
+     0
+  3
+
+ 72
+    65
+ 73
+     0
+ 40
+0.0000
+  0
+ENDTAB
+  0
+TABLE
+  2
+LAYER
+  5
+     2
+100
+AcDbSymbolTable
+ 70
+     1
+  0
+LAYER
+  5
+    10
+100
+AcDbSymbolTableRecord
+100
+AcDbLayerTableRecord
+  2
+0
+ 70
+     0
+ 62
+     7
+  6
+CONTINUOUS
+390
+F
+  0
+ENDTAB
+  0
+TABLE
+  2
+STYLE
+  5
+     3
+100
+AcDbSymbolTable
+ 70
+     0
+  0
+STYLE
+  5
+    11
+100
+AcDbSymbolTableRecord
+100
+AcDbTextStyleTableRecord
+  2
+Standard
+ 70
+     0
+ 71
+     0
+ 40
+0.0000
+ 41
+1.0000
+ 42
+2.5000
+ 50
+0.0000
+  3
+txt
+  4
+
+  0
+ENDTAB
+  0
+TABLE
+  2
+VIEW
+  5
+     6
+100
+AcDbSymbolTable
+ 70
+     0
+  0
+ENDTAB
+  0
+TABLE
+  2
+UCS
+  5
+     7
+100
+AcDbSymbolTable
+ 70
+     0
+  0
+ENDTAB
+  0
+TABLE
+  2
+APPID
+  5
+     9
+100
+AcDbSymbolTable
+ 70
+     1
+  0
+APPID
+  5
+    12
+100
+AcDbSymbolTableRecord
+100
+AcDbRegAppTableRecord
+  2
+ACAD
+ 70
+     1
+  0
+ENDTAB
+  0
+TABLE
+  2
+DIMSTYLE
+  5
+A
+100
+AcDbSymbolTable
+ 70
+     0
+100
+AcDbDimStyleTable
+  0
+ENDTAB
+  0
+TABLE
+  2
+BLOCK_RECORD
+  5
+     1
+100
+AcDbSymbolTable
+ 70
+     1
+  0
+BLOCK_RECORD
+  5
+1F
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Model_Space
+340
+22
+  0
+BLOCK_RECORD
+  5
+1B
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Paper_Space
+340
+1E
+  0
+BLOCK_RECORD
+  5
+23
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Paper_Space0
+340
+26
+  0
+ENDTAB
+  0
+ENDSEC
+  0
+SECTION
+  2
+BLOCKS
+  0
+BLOCK
+  5
+20
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockBegin
+  2
+*Model_Space
+ 70
+     0
+ 10
+0.0000
+ 20
+0.0000
+ 30
+0.0000
+  3
+*Model_Space
+  1
+
+  0
+ENDBLK
+  5
+21
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockEnd
+  0
+BLOCK
+  5
+1C
+100
+AcDbEntity
+ 67
+     1
+  8
+0
+100
+AcDbBlockBegin
+  2
+*Paper_Space
+ 70
+     0
+ 10
+0.0000
+ 20
+0.0000
+ 30
+0.0000
+  3
+*Paper_Space
+  1
+
+  0
+ENDBLK
+  5
+1D
+100
+AcDbEntity
+ 67
+     1
+  8
+0
+100
+AcDbBlockEnd
+  0
+BLOCK
+  5
+24
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockBegin
+  2
+*Paper_Space0
+ 70
+     0
+ 10
+0.0000
+ 20
+0.0000
+ 30
+0.0000
+  3
+*Paper_Space0
+  1
+
+  0
+ENDBLK
+  5
+25
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockEnd
+  0
+ENDSEC
+  0
+SECTION
+  2
+ENTITIES
+  0
+LWPOLYLINE
+  5
+    64
+100
+AcDbEntity
+  8
+Primera
+ 62
+     0
+100
+AcDbPolyline
+ 90
+   264
+ 70
+     1
+ 38
+0.000
+ 10
+759813.387949
+ 20
+4285413.854930
+ 42
+0.000000
+ 10
+759928.208938
+ 20
+4285445.379389
+ 42
+0.000000
+ 10
+759843.259737
+ 20
+4286127.104400
+ 42
+0.000000
+ 10
+760150.094222
+ 20
+4286866.064879
+ 42
+0.000000
+ 10
+760321.572745
+ 20
+4287295.035816
+ 42
+0.000000
+ 10
+760207.429775
+ 20
+4287403.536811
+ 42
+0.000000
+ 10
+760688.379159
+ 20
+4287848.192897
+ 42
+0.000000
+ 10
+760881.917934
+ 20
+4288213.452967
+ 42
+0.000000
+ 10
+761223.246293
+ 20
+4288691.355840
+ 42
+0.000000
+ 10
+761654.494636
+ 20
+4289557.827131
+ 42
+0.000000
+ 10
+762006.942991
+ 20
+4290170.597731
+ 42
+0.000000
+ 10
+762659.927564
+ 20
+4290353.257040
+ 42
+0.000000
+ 10
+762694.463857
+ 20
+4290625.539219
+ 42
+0.000000
+ 10
+762824.411740
+ 20
+4290670.947239
+ 42
+0.000000
+ 10
+762863.432079
+ 20
+4290675.570230
+ 42
+0.000000
+ 10
+763054.523149
+ 20
+4290925.248891
+ 42
+0.000000
+ 10
+763259.610879
+ 20
+4291514.326464
+ 42
+0.000000
+ 10
+763374.071202
+ 20
+4291711.473271
+ 42
+0.000000
+ 10
+763717.086405
+ 20
+4291761.734704
+ 42
+0.000000
+ 10
+763655.069443
+ 20
+4291400.744280
+ 42
+0.000000
+ 10
+763520.598486
+ 20
+4291229.600306
+ 42
+0.000000
+ 10
+763461.290238
+ 20
+4291154.293176
+ 42
+0.000000
+ 10
+763760.288693
+ 20
+4290616.356145
+ 42
+0.000000
+ 10
+764036.518934
+ 20
+4290634.409526
+ 42
+0.000000
+ 10
+764444.376722
+ 20
+4290542.387426
+ 42
+0.000000
+ 10
+764608.794704
+ 20
+4290441.173533
+ 42
+0.000000
+ 10
+764619.172558
+ 20
+4290417.070992
+ 42
+0.000000
+ 10
+764633.824644
+ 20
+4290395.333152
+ 42
+0.000000
+ 10
+764680.131687
+ 20
+4290337.976786
+ 42
+0.000000
+ 10
+764687.384009
+ 20
+4290329.327976
+ 42
+0.000000
+ 10
+764712.878054
+ 20
+4290295.727092
+ 42
+0.000000
+ 10
+764729.159025
+ 20
+4290277.377369
+ 42
+0.000000
+ 10
+765259.755103
+ 20
+4290421.734358
+ 42
+0.000000
+ 10
+765458.639993
+ 20
+4290279.457874
+ 42
+0.000000
+ 10
+765640.231714
+ 20
+4290498.882977
+ 42
+0.000000
+ 10
+765535.110260
+ 20
+4290753.188535
+ 42
+0.000000
+ 10
+765527.558546
+ 20
+4290822.946559
+ 42
+0.000000
+ 10
+765494.464627
+ 20
+4291136.331765
+ 42
+0.000000
+ 10
+765467.729978
+ 20
+4291572.169276
+ 42
+0.000000
+ 10
+765396.532891
+ 20
+4291827.608070
+ 42
+0.000000
+ 10
+765348.515352
+ 20
+4292144.940680
+ 42
+0.000000
+ 10
+765360.924516
+ 20
+4292216.476230
+ 42
+0.000000
+ 10
+765371.520483
+ 20
+4292290.173855
+ 42
+0.000000
+ 10
+765379.396844
+ 20
+4292367.114567
+ 42
+0.000000
+ 10
+765383.037199
+ 20
+4292440.580097
+ 42
+0.000000
+ 10
+765382.404627
+ 20
+4292511.680468
+ 42
+0.000000
+ 10
+765379.052724
+ 20
+4292586.023897
+ 42
+0.000000
+ 10
+765373.240932
+ 20
+4292655.840127
+ 42
+0.000000
+ 10
+765363.877649
+ 20
+4292727.760362
+ 42
+0.000000
+ 10
+765350.592459
+ 20
+4292812.884976
+ 42
+0.000000
+ 10
+765340.545317
+ 20
+4292879.226032
+ 42
+0.000000
+ 10
+765333.901494
+ 20
+4292947.903237
+ 42
+0.000000
+ 10
+765331.920637
+ 20
+4292981.175330
+ 42
+0.000000
+ 10
+765331.641373
+ 20
+4293015.615494
+ 42
+0.000000
+ 10
+765334.967632
+ 20
+4293072.401487
+ 42
+0.000000
+ 10
+765341.956304
+ 20
+4293123.753375
+ 42
+0.000000
+ 10
+765356.101560
+ 20
+4293195.347129
+ 42
+0.000000
+ 10
+765371.301082
+ 20
+4293261.419764
+ 42
+0.000000
+ 10
+765384.077737
+ 20
+4293321.855185
+ 42
+0.000000
+ 10
+765392.767187
+ 20
+4293374.375251
+ 42
+0.000000
+ 10
+765397.831112
+ 20
+4293431.219381
+ 42
+0.000000
+ 10
+765399.067495
+ 20
+4293472.377858
+ 42
+0.000000
+ 10
+765560.031191
+ 20
+4293473.309267
+ 42
+0.000000
+ 10
+765750.308079
+ 20
+4293326.312531
+ 42
+0.000000
+ 10
+765929.581318
+ 20
+4293222.291605
+ 42
+0.000000
+ 10
+766030.271882
+ 20
+4293100.086030
+ 42
+0.000000
+ 10
+766310.135868
+ 20
+4293007.218974
+ 42
+0.000000
+ 10
+766669.633560
+ 20
+4293420.446517
+ 42
+0.000000
+ 10
+766992.245427
+ 20
+4293583.524390
+ 42
+0.000000
+ 10
+767280.336140
+ 20
+4293556.534709
+ 42
+0.000000
+ 10
+767457.837595
+ 20
+4293609.180546
+ 42
+0.000000
+ 10
+767647.850499
+ 20
+4293367.756734
+ 42
+0.000000
+ 10
+767667.495492
+ 20
+4293042.806791
+ 42
+0.000000
+ 10
+767904.272112
+ 20
+4292240.642804
+ 42
+0.000000
+ 10
+768076.401200
+ 20
+4291756.359080
+ 42
+0.000000
+ 10
+768262.111468
+ 20
+4291592.591707
+ 42
+0.000000
+ 10
+768429.027506
+ 20
+4291263.720254
+ 42
+0.000000
+ 10
+768432.767870
+ 20
+4291256.067338
+ 42
+0.000000
+ 10
+768490.866302
+ 20
+4290979.090161
+ 42
+0.000000
+ 10
+768534.852594
+ 20
+4290784.984862
+ 42
+0.000000
+ 10
+768484.128425
+ 20
+4290585.460198
+ 42
+0.000000
+ 10
+768265.191213
+ 20
+4290288.024318
+ 42
+0.000000
+ 10
+768274.778888
+ 20
+4289590.449748
+ 42
+0.000000
+ 10
+768070.700437
+ 20
+4289290.189759
+ 42
+0.000000
+ 10
+768027.382808
+ 20
+4288663.070460
+ 42
+0.000000
+ 10
+768057.779244
+ 20
+4288355.153494
+ 42
+0.000000
+ 10
+767997.738994
+ 20
+4288302.012536
+ 42
+0.000000
+ 10
+768015.050934
+ 20
+4288279.258107
+ 42
+0.000000
+ 10
+768005.808424
+ 20
+4288243.385513
+ 42
+0.000000
+ 10
+767996.154794
+ 20
+4288219.723348
+ 42
+0.000000
+ 10
+767983.779418
+ 20
+4288199.303472
+ 42
+0.000000
+ 10
+767976.623167
+ 20
+4288179.059289
+ 42
+0.000000
+ 10
+767976.500541
+ 20
+4288156.829262
+ 42
+0.000000
+ 10
+767983.475783
+ 20
+4288104.833175
+ 42
+0.000000
+ 10
+767993.706416
+ 20
+4288059.614435
+ 42
+0.000000
+ 10
+768004.871232
+ 20
+4287986.644773
+ 42
+0.000000
+ 10
+768008.778106
+ 20
+4287922.321175
+ 42
+0.000000
+ 10
+768008.858554
+ 20
+4287842.310660
+ 42
+0.000000
+ 10
+768005.293641
+ 20
+4287818.853484
+ 42
+0.000000
+ 10
+767982.307875
+ 20
+4287751.402204
+ 42
+0.000000
+ 10
+768071.559210
+ 20
+4287454.356794
+ 42
+0.000000
+ 10
+768253.269975
+ 20
+4287670.510851
+ 42
+0.000000
+ 10
+768360.766823
+ 20
+4287788.596658
+ 42
+0.000000
+ 10
+768723.390684
+ 20
+4287753.040207
+ 42
+0.000000
+ 10
+768946.607088
+ 20
+4287848.369507
+ 42
+0.000000
+ 10
+769158.707565
+ 20
+4287834.421504
+ 42
+0.000000
+ 10
+769351.633352
+ 20
+4287666.469561
+ 42
+0.000000
+ 10
+769562.524091
+ 20
+4287456.899844
+ 42
+0.000000
+ 10
+769635.358139
+ 20
+4287389.352842
+ 42
+0.000000
+ 10
+769664.136597
+ 20
+4287362.544436
+ 42
+0.000000
+ 10
+769783.597105
+ 20
+4287229.898700
+ 42
+0.000000
+ 10
+769786.432661
+ 20
+4287223.326866
+ 42
+0.000000
+ 10
+769802.919618
+ 20
+4287199.436454
+ 42
+0.000000
+ 10
+769822.016626
+ 20
+4287175.634494
+ 42
+0.000000
+ 10
+769830.072149
+ 20
+4287169.239521
+ 42
+0.000000
+ 10
+769841.908512
+ 20
+4287154.082133
+ 42
+0.000000
+ 10
+769860.817676
+ 20
+4287135.830460
+ 42
+0.000000
+ 10
+769876.853647
+ 20
+4287125.260676
+ 42
+0.000000
+ 10
+769894.592033
+ 20
+4287115.859926
+ 42
+0.000000
+ 10
+769909.645242
+ 20
+4287108.590844
+ 42
+0.000000
+ 10
+769972.167348
+ 20
+4287088.483588
+ 42
+0.000000
+ 10
+770013.772198
+ 20
+4287068.778949
+ 42
+0.000000
+ 10
+770074.098979
+ 20
+4287036.373521
+ 42
+0.000000
+ 10
+770138.926901
+ 20
+4286999.675898
+ 42
+0.000000
+ 10
+770214.078750
+ 20
+4286941.102608
+ 42
+0.000000
+ 10
+770234.348899
+ 20
+4286908.450729
+ 42
+0.000000
+ 10
+770246.073418
+ 20
+4286896.624011
+ 42
+0.000000
+ 10
+770295.962234
+ 20
+4286863.865932
+ 42
+0.000000
+ 10
+770328.300244
+ 20
+4286834.957739
+ 42
+0.000000
+ 10
+770327.265297
+ 20
+4286737.126431
+ 42
+0.000000
+ 10
+770327.491330
+ 20
+4286730.466181
+ 42
+0.000000
+ 10
+770327.299388
+ 20
+4286710.455905
+ 42
+0.000000
+ 10
+770328.840323
+ 20
+4286639.383717
+ 42
+0.000000
+ 10
+770269.582652
+ 20
+4286511.793863
+ 42
+0.000000
+ 10
+770221.939127
+ 20
+4286401.268366
+ 42
+0.000000
+ 10
+770185.571775
+ 20
+4286317.797335
+ 42
+0.000000
+ 10
+770152.081665
+ 20
+4286252.205188
+ 42
+0.000000
+ 10
+770145.831773
+ 20
+4286205.317944
+ 42
+0.000000
+ 10
+770145.563923
+ 20
+4286187.527793
+ 42
+0.000000
+ 10
+770147.454676
+ 20
+4286183.146639
+ 42
+0.000000
+ 10
+770154.067971
+ 20
+4286142.252169
+ 42
+0.000000
+ 10
+770162.685009
+ 20
+4286093.646430
+ 42
+0.000000
+ 10
+770168.696130
+ 20
+4286070.512615
+ 42
+0.000000
+ 10
+770192.515018
+ 20
+4285984.637633
+ 42
+0.000000
+ 10
+770213.389371
+ 20
+4285934.224974
+ 42
+0.000000
+ 10
+770239.367589
+ 20
+4285861.759114
+ 42
+0.000000
+ 10
+770270.567045
+ 20
+4285789.470411
+ 42
+0.000000
+ 10
+770288.229355
+ 20
+4285756.730011
+ 42
+0.000000
+ 10
+770315.195799
+ 20
+4285706.524191
+ 42
+0.000000
+ 10
+770342.459883
+ 20
+4285621.877677
+ 42
+0.000000
+ 10
+770355.165447
+ 20
+4285581.189984
+ 42
+0.000000
+ 10
+770364.959311
+ 20
+4285549.294056
+ 42
+0.000000
+ 10
+770390.446252
+ 20
+4285465.698662
+ 42
+0.000000
+ 10
+770413.402231
+ 20
+4285405.355116
+ 42
+0.000000
+ 10
+770427.656611
+ 20
+4285344.716320
+ 42
+0.000000
+ 10
+769961.380388
+ 20
+4285298.901450
+ 42
+0.000000
+ 10
+769586.889423
+ 20
+4285115.082553
+ 42
+0.000000
+ 10
+769480.398489
+ 20
+4284889.219729
+ 42
+0.000000
+ 10
+769163.319784
+ 20
+4284604.013622
+ 42
+0.000000
+ 10
+768984.191639
+ 20
+4284361.260020
+ 42
+0.000000
+ 10
+768691.472114
+ 20
+4284153.577500
+ 42
+0.000000
+ 10
+768754.927574
+ 20
+4283951.238106
+ 42
+0.000000
+ 10
+768571.979893
+ 20
+4283691.698227
+ 42
+0.000000
+ 10
+768416.964126
+ 20
+4283559.790980
+ 42
+0.000000
+ 10
+768415.143991
+ 20
+4283639.742625
+ 42
+0.000000
+ 10
+768390.448468
+ 20
+4283674.472597
+ 42
+0.000000
+ 10
+768379.513956
+ 20
+4283766.341630
+ 42
+0.000000
+ 10
+768375.658910
+ 20
+4283777.324769
+ 42
+0.000000
+ 10
+768377.223734
+ 20
+4283808.493576
+ 42
+0.000000
+ 10
+768379.274285
+ 20
+4283825.231959
+ 42
+0.000000
+ 10
+768356.357446
+ 20
+4283858.910570
+ 42
+0.000000
+ 10
+768342.357286
+ 20
+4283860.661927
+ 42
+0.000000
+ 10
+768312.119539
+ 20
+4283852.976516
+ 42
+0.000000
+ 10
+768289.031239
+ 20
+4283839.975358
+ 42
+0.000000
+ 10
+768259.663721
+ 20
+4283832.319441
+ 42
+0.000000
+ 10
+768199.983516
+ 20
+4283819.198726
+ 42
+0.000000
+ 10
+768158.207037
+ 20
+4283817.793505
+ 42
+0.000000
+ 10
+768146.855242
+ 20
+4283818.522994
+ 42
+0.000000
+ 10
+768106.457980
+ 20
+4283853.836913
+ 42
+0.000000
+ 10
+768099.271305
+ 20
+4283860.262967
+ 42
+0.000000
+ 10
+768045.185007
+ 20
+4283914.008719
+ 42
+0.000000
+ 10
+768012.845519
+ 20
+4283942.926235
+ 42
+0.000000
+ 10
+767980.804760
+ 20
+4283962.963615
+ 42
+0.000000
+ 10
+767959.618454
+ 20
+4283971.141786
+ 42
+0.000000
+ 10
+767930.872716
+ 20
+4283996.846523
+ 42
+0.000000
+ 10
+767915.554989
+ 20
+4284011.889743
+ 42
+0.000000
+ 10
+767904.738120
+ 20
+4284022.639095
+ 42
+0.000000
+ 10
+767859.208156
+ 20
+4284081.118594
+ 42
+0.000000
+ 10
+767848.242272
+ 20
+4284096.308141
+ 42
+0.000000
+ 10
+767830.388539
+ 20
+4284109.043723
+ 42
+0.000000
+ 10
+767827.703025
+ 20
+4284111.176070
+ 42
+0.000000
+ 10
+767778.145421
+ 20
+4284133.959545
+ 42
+0.000000
+ 10
+767752.049037
+ 20
+4284158.642541
+ 42
+0.000000
+ 10
+767706.918024
+ 20
+4284179.352526
+ 42
+0.000000
+ 10
+767697.954086
+ 20
+4284186.830491
+ 42
+0.000000
+ 10
+767673.673265
+ 20
+4284209.352111
+ 42
+0.000000
+ 10
+767618.684595
+ 20
+4284264.181315
+ 42
+0.000000
+ 10
+767576.588594
+ 20
+4284298.329233
+ 42
+0.000000
+ 10
+767557.753700
+ 20
+4284314.366263
+ 42
+0.000000
+ 10
+767541.753264
+ 20
+4284323.830772
+ 42
+0.000000
+ 10
+767526.219417
+ 20
+4284501.114495
+ 42
+0.000000
+ 10
+767528.561716
+ 20
+4284638.992074
+ 42
+0.000000
+ 10
+767531.600854
+ 20
+4284808.008996
+ 42
+0.000000
+ 10
+767496.097116
+ 20
+4284853.491199
+ 42
+0.000000
+ 10
+767496.594789
+ 20
+4284864.620724
+ 42
+0.000000
+ 10
+767466.722564
+ 20
+4284898.067934
+ 42
+0.000000
+ 10
+767461.253923
+ 20
+4284931.222871
+ 42
+0.000000
+ 10
+767371.368528
+ 20
+4285091.565250
+ 42
+0.000000
+ 10
+767298.950696
+ 20
+4285224.712239
+ 42
+0.000000
+ 10
+767257.372633
+ 20
+4285295.550967
+ 42
+0.000000
+ 10
+767203.100821
+ 20
+4285329.291982
+ 42
+0.000000
+ 10
+766963.832930
+ 20
+4285502.410921
+ 42
+0.000000
+ 10
+766934.247043
+ 20
+4285891.478101
+ 42
+0.000000
+ 10
+766574.769850
+ 20
+4285804.987331
+ 42
+0.000000
+ 10
+766437.530460
+ 20
+4285819.288508
+ 42
+0.000000
+ 10
+766196.765525
+ 20
+4285855.691725
+ 42
+0.000000
+ 10
+766132.397176
+ 20
+4285826.870992
+ 42
+0.000000
+ 10
+766030.225148
+ 20
+4285782.342046
+ 42
+0.000000
+ 10
+765763.173326
+ 20
+4285666.748770
+ 42
+0.000000
+ 10
+765368.985866
+ 20
+4285628.051932
+ 42
+0.000000
+ 10
+765278.478713
+ 20
+4285416.121833
+ 42
+0.000000
+ 10
+765293.667385
+ 20
+4285247.716413
+ 42
+0.000000
+ 10
+765265.281641
+ 20
+4284948.954825
+ 42
+0.000000
+ 10
+765000.340662
+ 20
+4285187.950436
+ 42
+0.000000
+ 10
+764837.478864
+ 20
+4285108.082614
+ 42
+0.000000
+ 10
+764562.624551
+ 20
+4285410.102964
+ 42
+0.000000
+ 10
+764513.527754
+ 20
+4285419.585553
+ 42
+0.000000
+ 10
+764356.482504
+ 20
+4285453.267677
+ 42
+0.000000
+ 10
+764332.426652
+ 20
+4285416.909787
+ 42
+0.000000
+ 10
+764321.703863
+ 20
+4285398.774169
+ 42
+0.000000
+ 10
+764317.366626
+ 20
+4285371.960408
+ 42
+0.000000
+ 10
+764323.668805
+ 20
+4285313.273433
+ 42
+0.000000
+ 10
+764328.230697
+ 20
+4285254.528737
+ 42
+0.000000
+ 10
+764336.434054
+ 20
+4285164.789959
+ 42
+0.000000
+ 10
+764342.455281
+ 20
+4285088.313752
+ 42
+0.000000
+ 10
+764867.649923
+ 20
+4284331.209813
+ 42
+0.000000
+ 10
+764784.973807
+ 20
+4284197.335786
+ 42
+0.000000
+ 10
+764581.245339
+ 20
+4283930.539905
+ 42
+0.000000
+ 10
+764371.723877
+ 20
+4283838.023533
+ 42
+0.000000
+ 10
+764085.731898
+ 20
+4283791.874308
+ 42
+0.000000
+ 10
+764078.622247
+ 20
+4283796.083773
+ 42
+0.000000
+ 10
+763947.611294
+ 20
+4283937.317599
+ 42
+0.000000
+ 10
+763686.489317
+ 20
+4283824.220619
+ 42
+0.000000
+ 10
+763649.983368
+ 20
+4283795.232449
+ 42
+0.000000
+ 10
+763332.082118
+ 20
+4283528.031906
+ 42
+0.000000
+ 10
+762790.181908
+ 20
+4283130.115007
+ 42
+0.000000
+ 10
+762535.400687
+ 20
+4282876.143425
+ 42
+0.000000
+ 10
+762113.509902
+ 20
+4282642.245710
+ 42
+0.000000
+ 10
+761375.407776
+ 20
+4282324.664595
+ 42
+0.000000
+ 10
+761363.403085
+ 20
+4282318.715205
+ 42
+0.000000
+ 10
+761105.605449
+ 20
+4282208.041609
+ 42
+0.000000
+ 10
+760535.067388
+ 20
+4281533.781920
+ 42
+0.000000
+ 10
+760092.957447
+ 20
+4281782.708754
+ 42
+0.000000
+ 10
+757189.414866
+ 20
+4283375.312008
+ 42
+0.000000
+ 10
+757528.306682
+ 20
+4283699.598134
+ 42
+0.000000
+ 10
+757623.161503
+ 20
+4283783.777597
+ 42
+0.000000
+ 10
+757864.164946
+ 20
+4284036.025799
+ 42
+0.000000
+ 10
+758307.080649
+ 20
+4284562.615830
+ 42
+0.000000
+ 10
+758325.541656
+ 20
+4284584.326435
+ 42
+0.000000
+ 10
+758862.088852
+ 20
+4285364.004333
+ 42
+0.000000
+ 10
+759109.905885
+ 20
+4285216.492807
+ 42
+0.000000
+ 10
+759607.998702
+ 20
+4285354.934848
+ 42
+0.000000
+ 10
+759813.387949
+ 20
+4285413.854930
+ 42
+0.000000
+ 10
+759813.387949
+ 20
+4285413.854930
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    65
+100
+AcDbEntity
+  8
+Segunda
+ 62
+     1
+100
+AcDbPolyline
+ 90
+    85
+ 70
+     1
+ 38
+0.000
+ 10
+774285.408273
+ 20
+4292648.256148
+ 42
+0.000000
+ 10
+774295.622883
+ 20
+4292629.715076
+ 42
+0.000000
+ 10
+774755.785965
+ 20
+4291857.631732
+ 42
+0.000000
+ 10
+774770.900050
+ 20
+4291873.713327
+ 42
+0.000000
+ 10
+774787.868143
+ 20
+4291886.524865
+ 42
+0.000000
+ 10
+774793.008426
+ 20
+4291888.925256
+ 42
+0.000000
+ 10
+774803.442421
+ 20
+4291889.285807
+ 42
+0.000000
+ 10
+774822.916669
+ 20
+4291879.956312
+ 42
+0.000000
+ 10
+774839.143143
+ 20
+4291863.846300
+ 42
+0.000000
+ 10
+774872.389537
+ 20
+4291758.302287
+ 42
+0.000000
+ 10
+774890.266215
+ 20
+4291694.459775
+ 42
+0.000000
+ 10
+776091.933898
+ 20
+4290532.440122
+ 42
+0.000000
+ 10
+776446.478754
+ 20
+4290226.890576
+ 42
+0.000000
+ 10
+776168.022128
+ 20
+4289870.464463
+ 42
+0.000000
+ 10
+775848.069111
+ 20
+4289680.432523
+ 42
+0.000000
+ 10
+775579.985123
+ 20
+4289626.688920
+ 42
+0.000000
+ 10
+775387.929154
+ 20
+4289464.446350
+ 42
+0.000000
+ 10
+775354.490998
+ 20
+4289122.093611
+ 42
+0.000000
+ 10
+775211.537175
+ 20
+4288899.318118
+ 42
+0.000000
+ 10
+775193.859233
+ 20
+4288705.326153
+ 42
+0.000000
+ 10
+774503.632887
+ 20
+4287986.886218
+ 42
+0.000000
+ 10
+774389.717982
+ 20
+4288158.556637
+ 42
+0.000000
+ 10
+774212.268041
+ 20
+4288430.285873
+ 42
+0.000000
+ 10
+774003.777952
+ 20
+4288921.000766
+ 42
+0.000000
+ 10
+773681.518314
+ 20
+4289302.226399
+ 42
+0.000000
+ 10
+773657.949942
+ 20
+4289329.200151
+ 42
+0.000000
+ 10
+773613.499287
+ 20
+4289381.017438
+ 42
+0.000000
+ 10
+773568.064958
+ 20
+4289436.135210
+ 42
+0.000000
+ 10
+773551.722483
+ 20
+4289455.578045
+ 42
+0.000000
+ 10
+773547.221074
+ 20
+4289459.868784
+ 42
+0.000000
+ 10
+773444.674163
+ 20
+4289555.256145
+ 42
+0.000000
+ 10
+773436.388761
+ 20
+4289568.307833
+ 42
+0.000000
+ 10
+773380.145767
+ 20
+4289608.607398
+ 42
+0.000000
+ 10
+773342.358445
+ 20
+4289643.984388
+ 42
+0.000000
+ 10
+773239.130239
+ 20
+4289759.355111
+ 42
+0.000000
+ 10
+773148.385699
+ 20
+4289866.264548
+ 42
+0.000000
+ 10
+773120.472157
+ 20
+4289893.090458
+ 42
+0.000000
+ 10
+772991.349761
+ 20
+4290002.018328
+ 42
+0.000000
+ 10
+772976.069882
+ 20
+4290015.941796
+ 42
+0.000000
+ 10
+772687.471508
+ 20
+4291119.626057
+ 42
+0.000000
+ 10
+772646.453989
+ 20
+4291274.921454
+ 42
+0.000000
+ 10
+772443.495770
+ 20
+4291329.091512
+ 42
+0.000000
+ 10
+772052.446817
+ 20
+4291435.732230
+ 42
+0.000000
+ 10
+771115.230031
+ 20
+4291782.696424
+ 42
+0.000000
+ 10
+771132.316082
+ 20
+4291817.730497
+ 42
+0.000000
+ 10
+771150.499589
+ 20
+4291820.573153
+ 42
+0.000000
+ 10
+771167.397235
+ 20
+4291835.596758
+ 42
+0.000000
+ 10
+771160.894489
+ 20
+4291847.599777
+ 42
+0.000000
+ 10
+771143.957983
+ 20
+4291859.247042
+ 42
+0.000000
+ 10
+771127.664913
+ 20
+4291852.023483
+ 42
+0.000000
+ 10
+771112.506205
+ 20
+4291837.059248
+ 42
+0.000000
+ 10
+771040.943711
+ 20
+4291842.399241
+ 42
+0.000000
+ 10
+770632.523236
+ 20
+4292281.914291
+ 42
+0.000000
+ 10
+770634.981648
+ 20
+4292363.125480
+ 42
+0.000000
+ 10
+770639.480285
+ 20
+4292384.393988
+ 42
+0.000000
+ 10
+770646.662718
+ 20
+4292403.531184
+ 42
+0.000000
+ 10
+770650.972355
+ 20
+4292430.349953
+ 42
+0.000000
+ 10
+770653.429455
+ 20
+4292434.878939
+ 42
+0.000000
+ 10
+770667.718261
+ 20
+4292449.812729
+ 42
+0.000000
+ 10
+770671.725223
+ 20
+4292459.951167
+ 42
+0.000000
+ 10
+770675.316475
+ 20
+4292482.300158
+ 42
+0.000000
+ 10
+770678.453997
+ 20
+4292492.409003
+ 42
+0.000000
+ 10
+770675.997147
+ 20
+4292513.440758
+ 42
+0.000000
+ 10
+770930.391836
+ 20
+4292583.229282
+ 42
+0.000000
+ 10
+770965.199442
+ 20
+4292787.790831
+ 42
+0.000000
+ 10
+771439.188815
+ 20
+4292926.208528
+ 42
+0.000000
+ 10
+772276.293033
+ 20
+4293059.303152
+ 42
+0.000000
+ 10
+772424.610681
+ 20
+4293074.386888
+ 42
+0.000000
+ 10
+772621.738584
+ 20
+4293036.690532
+ 42
+0.000000
+ 10
+772695.627823
+ 20
+4293064.786224
+ 42
+0.000000
+ 10
+772702.354207
+ 20
+4293071.685146
+ 42
+0.000000
+ 10
+772742.382757
+ 20
+4293071.947075
+ 42
+0.000000
+ 10
+772752.815054
+ 20
+4293072.305017
+ 42
+0.000000
+ 10
+772778.369261
+ 20
+4293063.179594
+ 42
+0.000000
+ 10
+772800.369902
+ 20
+4293056.155025
+ 42
+0.000000
+ 10
+772826.412609
+ 20
+4293058.160150
+ 42
+0.000000
+ 10
+772850.342546
+ 20
+4293045.645108
+ 42
+0.000000
+ 10
+772868.110812
+ 20
+4293035.141354
+ 42
+0.000000
+ 10
+772875.446759
+ 20
+4293024.279523
+ 42
+0.000000
+ 10
+773432.791692
+ 20
+4292914.511740
+ 42
+0.000000
+ 10
+773745.874126
+ 20
+4292846.378871
+ 42
+0.000000
+ 10
+773782.273764
+ 20
+4292850.966462
+ 42
+0.000000
+ 10
+773888.589020
+ 20
+4292796.836939
+ 42
+0.000000
+ 10
+774285.408273
+ 20
+4292648.256148
+ 42
+0.000000
+ 10
+774285.408273
+ 20
+4292648.256148
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    66
+100
+AcDbEntity
+  8
+Tercera
+ 62
+     2
+100
+AcDbPolyline
+ 90
+   135
+ 70
+     1
+ 38
+0.000
+ 10
+764118.574530
+ 20
+4280562.597719
+ 42
+0.000000
+ 10
+763818.747665
+ 20
+4280324.879106
+ 42
+0.000000
+ 10
+763864.370505
+ 20
+4280078.583073
+ 42
+0.000000
+ 10
+763741.269156
+ 20
+4279978.949183
+ 42
+0.000000
+ 10
+763881.196862
+ 20
+4279806.888204
+ 42
+0.000000
+ 10
+763697.907409
+ 20
+4279681.930360
+ 42
+0.000000
+ 10
+763297.465603
+ 20
+4279903.181134
+ 42
+0.000000
+ 10
+762739.922206
+ 20
+4280104.831626
+ 42
+0.000000
+ 10
+762586.274219
+ 20
+4280111.999008
+ 42
+0.000000
+ 10
+762379.957486
+ 20
+4280263.006630
+ 42
+0.000000
+ 10
+762035.392617
+ 20
+4280403.922898
+ 42
+0.000000
+ 10
+761966.335072
+ 20
+4280542.779355
+ 42
+0.000000
+ 10
+761757.511731
+ 20
+4280611.489714
+ 42
+0.000000
+ 10
+761769.662517
+ 20
+4280931.915581
+ 42
+0.000000
+ 10
+761701.459733
+ 20
+4280965.237185
+ 42
+0.000000
+ 10
+761661.626767
+ 20
+4280983.932656
+ 42
+0.000000
+ 10
+761570.352398
+ 20
+4281029.833259
+ 42
+0.000000
+ 10
+761548.223317
+ 20
+4281040.219955
+ 42
+0.000000
+ 10
+760535.067388
+ 20
+4281533.781920
+ 42
+0.000000
+ 10
+761105.605449
+ 20
+4282208.041609
+ 42
+0.000000
+ 10
+761363.403085
+ 20
+4282318.715205
+ 42
+0.000000
+ 10
+761375.407776
+ 20
+4282324.664595
+ 42
+0.000000
+ 10
+762113.509902
+ 20
+4282642.245710
+ 42
+0.000000
+ 10
+762535.400687
+ 20
+4282876.143425
+ 42
+0.000000
+ 10
+762790.181908
+ 20
+4283130.115007
+ 42
+0.000000
+ 10
+763332.082118
+ 20
+4283528.031906
+ 42
+0.000000
+ 10
+763649.983368
+ 20
+4283795.232449
+ 42
+0.000000
+ 10
+763686.489317
+ 20
+4283824.220619
+ 42
+0.000000
+ 10
+763947.611294
+ 20
+4283937.317599
+ 42
+0.000000
+ 10
+764078.622247
+ 20
+4283796.083773
+ 42
+0.000000
+ 10
+764085.731898
+ 20
+4283791.874308
+ 42
+0.000000
+ 10
+764371.723877
+ 20
+4283838.023533
+ 42
+0.000000
+ 10
+764581.245339
+ 20
+4283930.539905
+ 42
+0.000000
+ 10
+764784.973807
+ 20
+4284197.335786
+ 42
+0.000000
+ 10
+764867.649923
+ 20
+4284331.209813
+ 42
+0.000000
+ 10
+764342.455281
+ 20
+4285088.313752
+ 42
+0.000000
+ 10
+764336.434054
+ 20
+4285164.789959
+ 42
+0.000000
+ 10
+764328.230697
+ 20
+4285254.528737
+ 42
+0.000000
+ 10
+764323.668805
+ 20
+4285313.273433
+ 42
+0.000000
+ 10
+764317.366626
+ 20
+4285371.960408
+ 42
+0.000000
+ 10
+764321.703863
+ 20
+4285398.774169
+ 42
+0.000000
+ 10
+764332.426652
+ 20
+4285416.909787
+ 42
+0.000000
+ 10
+764356.482504
+ 20
+4285453.267677
+ 42
+0.000000
+ 10
+764513.527754
+ 20
+4285419.585553
+ 42
+0.000000
+ 10
+764562.624551
+ 20
+4285410.102964
+ 42
+0.000000
+ 10
+764837.478864
+ 20
+4285108.082614
+ 42
+0.000000
+ 10
+765000.340662
+ 20
+4285187.950436
+ 42
+0.000000
+ 10
+765265.281641
+ 20
+4284948.954825
+ 42
+0.000000
+ 10
+765293.667385
+ 20
+4285247.716413
+ 42
+0.000000
+ 10
+765278.478713
+ 20
+4285416.121833
+ 42
+0.000000
+ 10
+765368.985866
+ 20
+4285628.051932
+ 42
+0.000000
+ 10
+765763.173326
+ 20
+4285666.748770
+ 42
+0.000000
+ 10
+766030.225148
+ 20
+4285782.342046
+ 42
+0.000000
+ 10
+766132.397176
+ 20
+4285826.870992
+ 42
+0.000000
+ 10
+766196.765525
+ 20
+4285855.691725
+ 42
+0.000000
+ 10
+766437.530460
+ 20
+4285819.288508
+ 42
+0.000000
+ 10
+766574.769850
+ 20
+4285804.987331
+ 42
+0.000000
+ 10
+766934.247043
+ 20
+4285891.478101
+ 42
+0.000000
+ 10
+766963.832930
+ 20
+4285502.410921
+ 42
+0.000000
+ 10
+767203.100821
+ 20
+4285329.291982
+ 42
+0.000000
+ 10
+767257.372633
+ 20
+4285295.550967
+ 42
+0.000000
+ 10
+767298.950696
+ 20
+4285224.712239
+ 42
+0.000000
+ 10
+767371.368528
+ 20
+4285091.565250
+ 42
+0.000000
+ 10
+767461.253923
+ 20
+4284931.222871
+ 42
+0.000000
+ 10
+767466.722564
+ 20
+4284898.067934
+ 42
+0.000000
+ 10
+767496.594789
+ 20
+4284864.620724
+ 42
+0.000000
+ 10
+767496.097116
+ 20
+4284853.491199
+ 42
+0.000000
+ 10
+767531.600854
+ 20
+4284808.008996
+ 42
+0.000000
+ 10
+767528.561716
+ 20
+4284638.992074
+ 42
+0.000000
+ 10
+767526.219417
+ 20
+4284501.114495
+ 42
+0.000000
+ 10
+767541.753264
+ 20
+4284323.830772
+ 42
+0.000000
+ 10
+767557.753700
+ 20
+4284314.366263
+ 42
+0.000000
+ 10
+767576.588594
+ 20
+4284298.329233
+ 42
+0.000000
+ 10
+767618.684595
+ 20
+4284264.181315
+ 42
+0.000000
+ 10
+767673.673265
+ 20
+4284209.352111
+ 42
+0.000000
+ 10
+767697.954086
+ 20
+4284186.830491
+ 42
+0.000000
+ 10
+767706.918024
+ 20
+4284179.352526
+ 42
+0.000000
+ 10
+767752.049037
+ 20
+4284158.642541
+ 42
+0.000000
+ 10
+767778.145421
+ 20
+4284133.959545
+ 42
+0.000000
+ 10
+767827.703025
+ 20
+4284111.176070
+ 42
+0.000000
+ 10
+767830.388539
+ 20
+4284109.043723
+ 42
+0.000000
+ 10
+767848.242272
+ 20
+4284096.308141
+ 42
+0.000000
+ 10
+767859.208156
+ 20
+4284081.118594
+ 42
+0.000000
+ 10
+767904.738120
+ 20
+4284022.639095
+ 42
+0.000000
+ 10
+767915.554989
+ 20
+4284011.889743
+ 42
+0.000000
+ 10
+767930.872716
+ 20
+4283996.846523
+ 42
+0.000000
+ 10
+767959.618454
+ 20
+4283971.141786
+ 42
+0.000000
+ 10
+767980.804760
+ 20
+4283962.963615
+ 42
+0.000000
+ 10
+768012.845519
+ 20
+4283942.926235
+ 42
+0.000000
+ 10
+768045.185007
+ 20
+4283914.008719
+ 42
+0.000000
+ 10
+768099.271305
+ 20
+4283860.262967
+ 42
+0.000000
+ 10
+768106.457980
+ 20
+4283853.836913
+ 42
+0.000000
+ 10
+768146.855242
+ 20
+4283818.522994
+ 42
+0.000000
+ 10
+768158.207037
+ 20
+4283817.793505
+ 42
+0.000000
+ 10
+768199.983516
+ 20
+4283819.198726
+ 42
+0.000000
+ 10
+768259.663721
+ 20
+4283832.319441
+ 42
+0.000000
+ 10
+768289.031239
+ 20
+4283839.975358
+ 42
+0.000000
+ 10
+768312.119539
+ 20
+4283852.976516
+ 42
+0.000000
+ 10
+768342.357286
+ 20
+4283860.661927
+ 42
+0.000000
+ 10
+768356.357446
+ 20
+4283858.910570
+ 42
+0.000000
+ 10
+768379.274285
+ 20
+4283825.231959
+ 42
+0.000000
+ 10
+768377.223734
+ 20
+4283808.493576
+ 42
+0.000000
+ 10
+768375.658910
+ 20
+4283777.324769
+ 42
+0.000000
+ 10
+768379.513956
+ 20
+4283766.341630
+ 42
+0.000000
+ 10
+768390.448468
+ 20
+4283674.472597
+ 42
+0.000000
+ 10
+768415.143991
+ 20
+4283639.742625
+ 42
+0.000000
+ 10
+768416.964126
+ 20
+4283559.790980
+ 42
+0.000000
+ 10
+768266.829457
+ 20
+4283438.053019
+ 42
+0.000000
+ 10
+768225.168019
+ 20
+4283277.737345
+ 42
+0.000000
+ 10
+768082.337109
+ 20
+4283094.017294
+ 42
+0.000000
+ 10
+767847.279383
+ 20
+4282776.071135
+ 42
+0.000000
+ 10
+767977.162397
+ 20
+4282619.298074
+ 42
+0.000000
+ 10
+767905.295840
+ 20
+4282475.750961
+ 42
+0.000000
+ 10
+767642.456046
+ 20
+4282205.776606
+ 42
+0.000000
+ 10
+767523.631031
+ 20
+4281565.029399
+ 42
+0.000000
+ 10
+767708.577004
+ 20
+4281507.889996
+ 42
+0.000000
+ 10
+767676.824881
+ 20
+4281311.239929
+ 42
+0.000000
+ 10
+767738.265882
+ 20
+4281116.605212
+ 42
+0.000000
+ 10
+767870.046299
+ 20
+4280929.887923
+ 42
+0.000000
+ 10
+768136.080379
+ 20
+4280846.585898
+ 42
+0.000000
+ 10
+768392.533939
+ 20
+4280504.040882
+ 42
+0.000000
+ 10
+767832.674672
+ 20
+4280563.023271
+ 42
+0.000000
+ 10
+767668.737568
+ 20
+4280590.861798
+ 42
+0.000000
+ 10
+767367.077921
+ 20
+4280670.763495
+ 42
+0.000000
+ 10
+766952.837369
+ 20
+4281380.332005
+ 42
+0.000000
+ 10
+766343.860038
+ 20
+4281451.104285
+ 42
+0.000000
+ 10
+766187.265984
+ 20
+4281547.003127
+ 42
+0.000000
+ 10
+765412.407920
+ 20
+4281470.071927
+ 42
+0.000000
+ 10
+765198.502588
+ 20
+4281455.180527
+ 42
+0.000000
+ 10
+764928.373572
+ 20
+4281296.188584
+ 42
+0.000000
+ 10
+764805.746629
+ 20
+4281183.216238
+ 42
+0.000000
+ 10
+764594.496645
+ 20
+4281061.750814
+ 42
+0.000000
+ 10
+764180.941916
+ 20
+4280811.355872
+ 42
+0.000000
+ 10
+764118.574530
+ 20
+4280562.597719
+ 42
+0.000000
+ 10
+764118.574530
+ 20
+4280562.597719
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    67
+100
+AcDbEntity
+  8
+Cuarta
+ 62
+     3
+100
+AcDbPolyline
+ 90
+    86
+ 70
+     1
+ 38
+0.000
+ 10
+759423.741244
+ 20
+4306115.230214
+ 42
+0.000000
+ 10
+759402.585371
+ 20
+4306124.537969
+ 42
+0.000000
+ 10
+759234.935237
+ 20
+4306176.829591
+ 42
+0.000000
+ 10
+759045.409956
+ 20
+4306233.964767
+ 42
+0.000000
+ 10
+758863.625600
+ 20
+4306293.579858
+ 42
+0.000000
+ 10
+758698.695718
+ 20
+4306342.637516
+ 42
+0.000000
+ 10
+758467.811791
+ 20
+4306416.213673
+ 42
+0.000000
+ 10
+758413.318668
+ 20
+4306435.547511
+ 42
+0.000000
+ 10
+758428.196315
+ 20
+4306219.345196
+ 42
+0.000000
+ 10
+758429.390329
+ 20
+4306209.383193
+ 42
+0.000000
+ 10
+758432.537476
+ 20
+4306192.817636
+ 42
+0.000000
+ 10
+758497.870555
+ 20
+4305841.582701
+ 42
+0.000000
+ 10
+758507.600540
+ 20
+4305809.675029
+ 42
+0.000000
+ 10
+758581.862327
+ 20
+4305557.630710
+ 42
+0.000000
+ 10
+758686.406823
+ 20
+4305203.232549
+ 42
+0.000000
+ 10
+758647.643793
+ 20
+4305139.737830
+ 42
+0.000000
+ 10
+758718.712405
+ 20
+4305092.054676
+ 42
+0.000000
+ 10
+758778.332883
+ 20
+4304889.538069
+ 42
+0.000000
+ 10
+758788.028468
+ 20
+4304858.740705
+ 42
+0.000000
+ 10
+758381.778314
+ 20
+4303860.937125
+ 42
+0.000000
+ 10
+758177.342368
+ 20
+4303814.267666
+ 42
+0.000000
+ 10
+757903.133857
+ 20
+4303882.008752
+ 42
+0.000000
+ 10
+757653.188447
+ 20
+4303738.307617
+ 42
+0.000000
+ 10
+757181.775805
+ 20
+4303456.300516
+ 42
+0.000000
+ 10
+756938.777784
+ 20
+4303258.400991
+ 42
+0.000000
+ 10
+756846.560154
+ 20
+4303180.960725
+ 42
+0.000000
+ 10
+756809.279117
+ 20
+4303258.647129
+ 42
+0.000000
+ 10
+756707.205138
+ 20
+4303485.356478
+ 42
+0.000000
+ 10
+756687.535815
+ 20
+4303529.166941
+ 42
+0.000000
+ 10
+756678.063355
+ 20
+4303553.306311
+ 42
+0.000000
+ 10
+756557.052322
+ 20
+4303828.296036
+ 42
+0.000000
+ 10
+756576.854048
+ 20
+4303914.499373
+ 42
+0.000000
+ 10
+756590.933269
+ 20
+4303962.736807
+ 42
+0.000000
+ 10
+756622.824950
+ 20
+4304104.891768
+ 42
+0.000000
+ 10
+756648.233685
+ 20
+4304205.722661
+ 42
+0.000000
+ 10
+756657.319336
+ 20
+4304247.131330
+ 42
+0.000000
+ 10
+756677.190376
+ 20
+4304331.115013
+ 42
+0.000000
+ 10
+756686.311636
+ 20
+4304371.413706
+ 42
+0.000000
+ 10
+756744.999632
+ 20
+4304517.771695
+ 42
+0.000000
+ 10
+756769.820618
+ 20
+4304583.025896
+ 42
+0.000000
+ 10
+756760.389027
+ 20
+4304632.724014
+ 42
+0.000000
+ 10
+756682.416071
+ 20
+4305081.342590
+ 42
+0.000000
+ 10
+757371.936869
+ 20
+4305172.619741
+ 42
+0.000000
+ 10
+757818.862583
+ 20
+4305589.418440
+ 42
+0.000000
+ 10
+757965.030645
+ 20
+4305743.082576
+ 42
+0.000000
+ 10
+757907.314630
+ 20
+4306127.904554
+ 42
+0.000000
+ 10
+757842.660289
+ 20
+4306299.147579
+ 42
+0.000000
+ 10
+757836.260079
+ 20
+4306308.940013
+ 42
+0.000000
+ 10
+757892.773521
+ 20
+4306654.146622
+ 42
+0.000000
+ 10
+757914.648617
+ 20
+4306675.972579
+ 42
+0.000000
+ 10
+758130.789578
+ 20
+4306894.150921
+ 42
+0.000000
+ 10
+757970.321164
+ 20
+4307073.380275
+ 42
+0.000000
+ 10
+757731.909645
+ 20
+4307058.944255
+ 42
+0.000000
+ 10
+757488.265646
+ 20
+4307392.154532
+ 42
+0.000000
+ 10
+757440.942796
+ 20
+4307485.067654
+ 42
+0.000000
+ 10
+757362.965362
+ 20
+4307639.211590
+ 42
+0.000000
+ 10
+757128.015103
+ 20
+4307759.361226
+ 42
+0.000000
+ 10
+756917.181152
+ 20
+4308233.664272
+ 42
+0.000000
+ 10
+756956.382779
+ 20
+4308417.175754
+ 42
+0.000000
+ 10
+757264.074962
+ 20
+4308142.707430
+ 42
+0.000000
+ 10
+757345.520008
+ 20
+4308068.683009
+ 42
+0.000000
+ 10
+757517.416279
+ 20
+4307910.928570
+ 42
+0.000000
+ 10
+758186.514684
+ 20
+4307396.017736
+ 42
+0.000000
+ 10
+758311.182509
+ 20
+4307302.299263
+ 42
+0.000000
+ 10
+759180.336970
+ 20
+4306782.884442
+ 42
+0.000000
+ 10
+759962.381303
+ 20
+4306565.173779
+ 42
+0.000000
+ 10
+761127.651291
+ 20
+4306293.495361
+ 42
+0.000000
+ 10
+761121.990250
+ 20
+4306254.414774
+ 42
+0.000000
+ 10
+761111.927614
+ 20
+4306190.741456
+ 42
+0.000000
+ 10
+761097.499732
+ 20
+4306101.365396
+ 42
+0.000000
+ 10
+761088.989243
+ 20
+4306043.299611
+ 42
+0.000000
+ 10
+761098.691366
+ 20
+4305749.138079
+ 42
+0.000000
+ 10
+761087.262195
+ 20
+4305753.206140
+ 42
+0.000000
+ 10
+761039.809840
+ 20
+4305769.421308
+ 42
+0.000000
+ 10
+760932.645461
+ 20
+4305804.782095
+ 42
+0.000000
+ 10
+760883.348263
+ 20
+4305824.271084
+ 42
+0.000000
+ 10
+760818.136713
+ 20
+4305852.125997
+ 42
+0.000000
+ 10
+760712.920249
+ 20
+4305907.556194
+ 42
+0.000000
+ 10
+760539.536012
+ 20
+4305975.189946
+ 42
+0.000000
+ 10
+760162.941622
+ 20
+4306119.488906
+ 42
+0.000000
+ 10
+760095.241261
+ 20
+4306143.933832
+ 42
+0.000000
+ 10
+760038.064966
+ 20
+4306165.391313
+ 42
+0.000000
+ 10
+759989.640412
+ 20
+4306184.914159
+ 42
+0.000000
+ 10
+759423.741244
+ 20
+4306115.230214
+ 42
+0.000000
+ 10
+759423.741244
+ 20
+4306115.230214
+ 42
+0.000000
+ 10
+759423.741244
+ 20
+4306115.230214
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    68
+100
+AcDbEntity
+  8
+Quinta
+ 62
+     4
+100
+AcDbPolyline
+ 90
+   285
+ 70
+     1
+ 38
+0.000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+ 10
+769678.260110
+ 20
+4299643.183416
+ 42
+0.000000
+ 10
+769523.824864
+ 20
+4299427.891741
+ 42
+0.000000
+ 10
+769489.720190
+ 20
+4299407.840368
+ 42
+0.000000
+ 10
+769472.760665
+ 20
+4299369.478806
+ 42
+0.000000
+ 10
+769471.815198
+ 20
+4299346.108619
+ 42
+0.000000
+ 10
+769483.029494
+ 20
+4299297.590732
+ 42
+0.000000
+ 10
+769503.156777
+ 20
+4299242.707608
+ 42
+0.000000
+ 10
+769504.174925
+ 20
+4299212.736100
+ 42
+0.000000
+ 10
+769527.116944
+ 20
+4298818.990957
+ 42
+0.000000
+ 10
+769542.092339
+ 20
+4298480.542162
+ 42
+0.000000
+ 10
+769542.167750
+ 20
+4298478.322052
+ 42
+0.000000
+ 10
+769556.663494
+ 20
+4298333.229462
+ 42
+0.000000
+ 10
+769629.617509
+ 20
+4297312.167968
+ 42
+0.000000
+ 10
+769644.816769
+ 20
+4296941.498648
+ 42
+0.000000
+ 10
+769745.608518
+ 20
+4295766.908839
+ 42
+0.000000
+ 10
+769910.139421
+ 20
+4295405.758319
+ 42
+0.000000
+ 10
+769948.454664
+ 20
+4295404.837693
+ 42
+0.000000
+ 10
+770000.599857
+ 20
+4295406.610005
+ 42
+0.000000
+ 10
+770068.842544
+ 20
+4295421.154649
+ 42
+0.000000
+ 10
+770100.584405
+ 20
+4295460.019362
+ 42
+0.000000
+ 10
+770136.710615
+ 20
+4295549.043485
+ 42
+0.000000
+ 10
+770166.865749
+ 20
+4295634.530739
+ 42
+0.000000
+ 10
+770186.024535
+ 20
+4295710.753394
+ 42
+0.000000
+ 10
+770198.494852
+ 20
+4295778.969226
+ 42
+0.000000
+ 10
+770261.029670
+ 20
+4295910.012224
+ 42
+0.000000
+ 10
+770621.605657
+ 20
+4295847.830675
+ 42
+0.000000
+ 10
+770671.172247
+ 20
+4296001.773892
+ 42
+0.000000
+ 10
+770963.166925
+ 20
+4295986.170084
+ 42
+0.000000
+ 10
+771097.886073
+ 20
+4295786.279455
+ 42
+0.000000
+ 10
+771309.432342
+ 20
+4295884.633905
+ 42
+0.000000
+ 10
+771361.126314
+ 20
+4295848.614026
+ 42
+0.000000
+ 10
+771454.386990
+ 20
+4295792.899316
+ 42
+0.000000
+ 10
+771426.535697
+ 20
+4295538.559078
+ 42
+0.000000
+ 10
+771310.687057
+ 20
+4294828.893833
+ 42
+0.000000
+ 10
+771407.633649
+ 20
+4294691.063628
+ 42
+0.000000
+ 10
+771402.745367
+ 20
+4294477.517458
+ 42
+0.000000
+ 10
+771197.859855
+ 20
+4294259.365818
+ 42
+0.000000
+ 10
+770982.199335
+ 20
+4293897.489761
+ 42
+0.000000
+ 10
+770880.770394
+ 20
+4293630.643849
+ 42
+0.000000
+ 10
+770112.578181
+ 20
+4293468.916594
+ 42
+0.000000
+ 10
+770084.572002
+ 20
+4293473.521533
+ 42
+0.000000
+ 10
+769966.462617
+ 20
+4293491.735570
+ 42
+0.000000
+ 10
+769505.295013
+ 20
+4293566.102206
+ 42
+0.000000
+ 10
+768953.884241
+ 20
+4293452.961565
+ 42
+0.000000
+ 10
+768416.587574
+ 20
+4293308.108988
+ 42
+0.000000
+ 10
+768705.127447
+ 20
+4293654.586487
+ 42
+0.000000
+ 10
+768749.568357
+ 20
+4293961.701096
+ 42
+0.000000
+ 10
+768557.361665
+ 20
+4294138.570203
+ 42
+0.000000
+ 10
+768473.460252
+ 20
+4294715.841140
+ 42
+0.000000
+ 10
+768589.556026
+ 20
+4294910.911504
+ 42
+0.000000
+ 10
+768706.600904
+ 20
+4295154.914239
+ 42
+0.000000
+ 10
+768839.101020
+ 20
+4295250.525541
+ 42
+0.000000
+ 10
+768885.723836
+ 20
+4295621.062245
+ 42
+0.000000
+ 10
+768909.122509
+ 20
+4295675.197865
+ 42
+0.000000
+ 10
+768963.519007
+ 20
+4295815.955121
+ 42
+0.000000
+ 10
+768982.454166
+ 20
+4295847.713443
+ 42
+0.000000
+ 10
+769069.615247
+ 20
+4296048.481689
+ 42
+0.000000
+ 10
+769216.950594
+ 20
+4296193.502139
+ 42
+0.000000
+ 10
+769513.426391
+ 20
+4296993.715221
+ 42
+0.000000
+ 10
+769622.741908
+ 20
+4297309.711769
+ 42
+0.000000
+ 10
+769170.135839
+ 20
+4297625.528182
+ 42
+0.000000
+ 10
+769128.604165
+ 20
+4297798.598577
+ 42
+0.000000
+ 10
+769105.905127
+ 20
+4297826.723491
+ 42
+0.000000
+ 10
+768916.123118
+ 20
+4298062.560464
+ 42
+0.000000
+ 10
+768732.424119
+ 20
+4298016.330459
+ 42
+0.000000
+ 10
+768515.921752
+ 20
+4298091.240454
+ 42
+0.000000
+ 10
+768127.312545
+ 20
+4298240.354283
+ 42
+0.000000
+ 10
+767917.585794
+ 20
+4298321.065065
+ 42
+0.000000
+ 10
+767737.663778
+ 20
+4298266.094959
+ 42
+0.000000
+ 10
+767221.085471
+ 20
+4298445.385042
+ 42
+0.000000
+ 10
+766909.761351
+ 20
+4298496.029142
+ 42
+0.000000
+ 10
+766877.435608
+ 20
+4298319.355930
+ 42
+0.000000
+ 10
+766881.239598
+ 20
+4298387.273374
+ 42
+0.000000
+ 10
+766867.407438
+ 20
+4298462.376832
+ 42
+0.000000
+ 10
+766819.959992
+ 20
+4298631.921992
+ 42
+0.000000
+ 10
+766711.720398
+ 20
+4298928.334692
+ 42
+0.000000
+ 10
+766679.210802
+ 20
+4299041.706076
+ 42
+0.000000
+ 10
+766664.539106
+ 20
+4299090.110238
+ 42
+0.000000
+ 10
+766640.903640
+ 20
+4299198.223477
+ 42
+0.000000
+ 10
+766587.766896
+ 20
+4299382.025175
+ 42
+0.000000
+ 10
+766549.872702
+ 20
+4299526.332378
+ 42
+0.000000
+ 10
+766505.158325
+ 20
+4299614.845448
+ 42
+0.000000
+ 10
+766434.461547
+ 20
+4299700.263325
+ 42
+0.000000
+ 10
+766328.314620
+ 20
+4299805.606034
+ 42
+0.000000
+ 10
+766222.230947
+ 20
+4299960.960517
+ 42
+0.000000
+ 10
+766137.219832
+ 20
+4300110.355405
+ 42
+0.000000
+ 10
+766056.095414
+ 20
+4300247.657084
+ 42
+0.000000
+ 10
+765988.323582
+ 20
+4300427.636522
+ 42
+0.000000
+ 10
+765936.597103
+ 20
+4300518.139370
+ 42
+0.000000
+ 10
+765891.720401
+ 20
+4300637.765855
+ 42
+0.000000
+ 10
+765843.147655
+ 20
+4300763.936367
+ 42
+0.000000
+ 10
+765642.136053
+ 20
+4300872.774333
+ 42
+0.000000
+ 10
+765608.539515
+ 20
+4300889.429550
+ 42
+0.000000
+ 10
+765562.412919
+ 20
+4300916.778159
+ 42
+0.000000
+ 10
+765520.517406
+ 20
+4300947.602575
+ 42
+0.000000
+ 10
+765483.298984
+ 20
+4300968.582156
+ 42
+0.000000
+ 10
+765447.743339
+ 20
+4300991.840147
+ 42
+0.000000
+ 10
+765347.765157
+ 20
+4301069.617861
+ 42
+0.000000
+ 10
+765311.379084
+ 20
+4301091.737311
+ 42
+0.000000
+ 10
+765295.264357
+ 20
+4301105.644860
+ 42
+0.000000
+ 10
+765261.409625
+ 20
+4301130.071795
+ 42
+0.000000
+ 10
+765246.126358
+ 20
+4301145.118539
+ 42
+0.000000
+ 10
+765228.349265
+ 20
+4301156.748012
+ 42
+0.000000
+ 10
+765151.102770
+ 20
+4301230.843199
+ 42
+0.000000
+ 10
+765134.157307
+ 20
+4301243.611958
+ 42
+0.000000
+ 10
+765107.822461
+ 20
+4301277.181256
+ 42
+0.000000
+ 10
+765092.576877
+ 20
+4301291.118222
+ 42
+0.000000
+ 10
+765078.993939
+ 20
+4301307.333381
+ 42
+0.000000
+ 10
+765063.748461
+ 20
+4301321.270397
+ 42
+0.000000
+ 10
+765021.300428
+ 20
+4301368.747962
+ 42
+0.000000
+ 10
+764942.358162
+ 20
+4301441.676889
+ 42
+0.000000
+ 10
+764922.882486
+ 20
+4301452.138903
+ 42
+0.000000
+ 10
+764884.910958
+ 20
+4301469.761942
+ 42
+0.000000
+ 10
+764864.752479
+ 20
+4301474.644841
+ 42
+0.000000
+ 10
+764845.351167
+ 20
+4301482.886943
+ 42
+0.000000
+ 10
+764804.997289
+ 20
+4301493.763033
+ 42
+0.000000
+ 10
+764784.044698
+ 20
+4301496.397031
+ 42
+0.000000
+ 10
+764763.812222
+ 20
+4301503.500274
+ 42
+0.000000
+ 10
+764682.347889
+ 20
+4301521.894328
+ 42
+0.000000
+ 10
+764598.464101
+ 20
+4301534.652013
+ 42
+0.000000
+ 10
+764579.174403
+ 20
+4301539.564606
+ 42
+0.000000
+ 10
+764560.641979
+ 20
+4301547.836363
+ 42
+0.000000
+ 10
+764280.753915
+ 20
+4301364.029757
+ 42
+0.000000
+ 10
+764256.384292
+ 20
+4301338.769281
+ 42
+0.000000
+ 10
+764119.919836
+ 20
+4301155.306186
+ 42
+0.000000
+ 10
+764087.290434
+ 20
+4301090.876516
+ 42
+0.000000
+ 10
+764078.181373
+ 20
+4301077.237800
+ 42
+0.000000
+ 10
+764037.864419
+ 20
+4301034.777863
+ 42
+0.000000
+ 10
+763930.067106
+ 20
+4300930.062825
+ 42
+0.000000
+ 10
+763903.385186
+ 20
+4300895.836502
+ 42
+0.000000
+ 10
+763865.394289
+ 20
+4300835.674661
+ 42
+0.000000
+ 10
+763836.697328
+ 20
+4300783.601202
+ 42
+0.000000
+ 10
+763818.551398
+ 20
+4300754.104362
+ 42
+0.000000
+ 10
+763804.415297
+ 20
+4300734.742426
+ 42
+0.000000
+ 10
+763775.699769
+ 20
+4300709.339162
+ 42
+0.000000
+ 10
+763731.147617
+ 20
+4300663.406409
+ 42
+0.000000
+ 10
+763722.037404
+ 20
+4300649.768166
+ 42
+0.000000
+ 10
+763672.567702
+ 20
+4301039.290353
+ 42
+0.000000
+ 10
+763385.975518
+ 20
+4301160.894313
+ 42
+0.000000
+ 10
+763425.121249
+ 20
+4301343.331657
+ 42
+0.000000
+ 10
+763522.591228
+ 20
+4301471.033225
+ 42
+0.000000
+ 10
+763659.706174
+ 20
+4301556.715168
+ 42
+0.000000
+ 10
+763732.672592
+ 20
+4301793.620981
+ 42
+0.000000
+ 10
+763871.736245
+ 20
+4302238.314156
+ 42
+0.000000
+ 10
+763862.461544
+ 20
+4302308.015759
+ 42
+0.000000
+ 10
+763838.129744
+ 20
+4302490.566244
+ 42
+0.000000
+ 10
+763710.069873
+ 20
+4302681.888265
+ 42
+0.000000
+ 10
+763690.802292
+ 20
+4302712.362797
+ 42
+0.000000
+ 10
+763618.185313
+ 20
+4302831.075614
+ 42
+0.000000
+ 10
+763597.961554
+ 20
+4303099.331218
+ 42
+0.000000
+ 10
+763568.098631
+ 20
+4303605.079082
+ 42
+0.000000
+ 10
+763727.357027
+ 20
+4303729.285887
+ 42
+0.000000
+ 10
+763764.460437
+ 20
+4303998.339240
+ 42
+0.000000
+ 10
+763398.463983
+ 20
+4303792.798746
+ 42
+0.000000
+ 10
+763064.403167
+ 20
+4303567.223056
+ 42
+0.000000
+ 10
+763149.424690
+ 20
+4303257.779885
+ 42
+0.000000
+ 10
+763068.617641
+ 20
+4303126.189261
+ 42
+0.000000
+ 10
+762757.568250
+ 20
+4303018.076656
+ 42
+0.000000
+ 10
+762729.785485
+ 20
+4303017.155385
+ 42
+0.000000
+ 10
+762711.332220
+ 20
+4303023.211117
+ 42
+0.000000
+ 10
+762703.260701
+ 20
+4303030.722351
+ 42
+0.000000
+ 10
+762660.166465
+ 20
+4303045.962637
+ 42
+0.000000
+ 10
+762584.176261
+ 20
+4303083.449412
+ 42
+0.000000
+ 10
+762503.382161
+ 20
+4303108.553819
+ 42
+0.000000
+ 10
+762484.818996
+ 20
+4303117.940188
+ 42
+0.000000
+ 10
+762412.987559
+ 20
+4303161.122555
+ 42
+0.000000
+ 10
+762379.908634
+ 20
+4303188.919833
+ 42
+0.000000
+ 10
+762350.192421
+ 20
+4303220.162358
+ 42
+0.000000
+ 10
+762317.150711
+ 20
+4303246.849833
+ 42
+0.000000
+ 10
+762254.356950
+ 20
+4303305.890330
+ 42
+0.000000
+ 10
+762423.383896
+ 20
+4303608.193950
+ 42
+0.000000
+ 10
+762378.022137
+ 20
+4303744.487859
+ 42
+0.000000
+ 10
+762357.916457
+ 20
+4303800.496287
+ 42
+0.000000
+ 10
+762169.185402
+ 20
+4303909.818835
+ 42
+0.000000
+ 10
+762408.071982
+ 20
+4304096.642099
+ 42
+0.000000
+ 10
+762567.298979
+ 20
+4304221.935315
+ 42
+0.000000
+ 10
+762703.908813
+ 20
+4304295.363687
+ 42
+0.000000
+ 10
+762735.916975
+ 20
+4304299.759212
+ 42
+0.000000
+ 10
+762812.843777
+ 20
+4304312.312850
+ 42
+0.000000
+ 10
+762903.217337
+ 20
+4304338.648819
+ 42
+0.000000
+ 10
+762920.652385
+ 20
+4304337.005039
+ 42
+0.000000
+ 10
+762957.942445
+ 20
+4304339.354284
+ 42
+0.000000
+ 10
+763016.565560
+ 20
+4304353.524816
+ 42
+0.000000
+ 10
+763048.573418
+ 20
+4304357.921624
+ 42
+0.000000
+ 10
+763156.752290
+ 20
+4304816.025726
+ 42
+0.000000
+ 10
+763152.499198
+ 20
+4305127.040916
+ 42
+0.000000
+ 10
+763083.763887
+ 20
+4305155.872516
+ 42
+0.000000
+ 10
+763047.512971
+ 20
+4305174.671049
+ 42
+0.000000
+ 10
+763010.431134
+ 20
+4305192.330862
+ 42
+0.000000
+ 10
+762936.693606
+ 20
+4305241.000372
+ 42
+0.000000
+ 10
+762872.430888
+ 20
+4305292.207597
+ 42
+0.000000
+ 10
+762845.728703
+ 20
+4305311.323989
+ 42
+0.000000
+ 10
+762837.732813
+ 20
+4305316.614904
+ 42
+0.000000
+ 10
+762819.026648
+ 20
+4305330.440465
+ 42
+0.000000
+ 10
+762802.130152
+ 20
+4305342.103591
+ 42
+0.000000
+ 10
+762770.404784
+ 20
+4305355.497132
+ 42
+0.000000
+ 10
+762731.662232
+ 20
+4305370.880474
+ 42
+0.000000
+ 10
+762642.305103
+ 20
+4305419.034145
+ 42
+0.000000
+ 10
+762630.800857
+ 20
+4305425.320137
+ 42
+0.000000
+ 10
+762571.580836
+ 20
+4305455.582714
+ 42
+0.000000
+ 10
+762513.266035
+ 20
+4305484.764444
+ 42
+0.000000
+ 10
+762498.290240
+ 20
+4305490.935506
+ 42
+0.000000
+ 10
+762473.619950
+ 20
+4305501.230260
+ 42
+0.000000
+ 10
+762447.213856
+ 20
+4305511.467546
+ 42
+0.000000
+ 10
+762425.221099
+ 20
+4305519.628666
+ 42
+0.000000
+ 10
+762382.824447
+ 20
+4305540.448796
+ 42
+0.000000
+ 10
+762412.039821
+ 20
+4305550.307208
+ 42
+0.000000
+ 10
+762454.737240
+ 20
+4305572.836587
+ 42
+0.000000
+ 10
+762473.316471
+ 20
+4305589.010254
+ 42
+0.000000
+ 10
+762490.659659
+ 20
+4305616.255657
+ 42
+0.000000
+ 10
+762507.245217
+ 20
+4305640.142187
+ 42
+0.000000
+ 10
+762510.995910
+ 20
+4305658.046828
+ 42
+0.000000
+ 10
+762512.605854
+ 20
+4305688.104427
+ 42
+0.000000
+ 10
+762507.419692
+ 20
+4305713.491607
+ 42
+0.000000
+ 10
+762492.539302
+ 20
+4305743.002418
+ 42
+0.000000
+ 10
+762479.358024
+ 20
+4305773.680852
+ 42
+0.000000
+ 10
+762437.094407
+ 20
+4305816.730345
+ 42
+0.000000
+ 10
+762419.184402
+ 20
+4305832.805629
+ 42
+0.000000
+ 10
+762406.886610
+ 20
+4305836.843046
+ 42
+0.000000
+ 10
+762365.190606
+ 20
+4305836.572310
+ 42
+0.000000
+ 10
+762338.138560
+ 20
+4305840.120857
+ 42
+0.000000
+ 10
+762299.009520
+ 20
+4305841.046798
+ 42
+0.000000
+ 10
+762264.256775
+ 20
+4305841.006649
+ 42
+0.000000
+ 10
+762246.751702
+ 20
+4305844.871794
+ 42
+0.000000
+ 10
+762235.969206
+ 20
+4305855.627251
+ 42
+0.000000
+ 10
+762228.364159
+ 20
+4305875.378087
+ 42
+0.000000
+ 10
+762217.052382
+ 20
+4305928.344074
+ 42
+0.000000
+ 10
+762210.874477
+ 20
+4305983.702652
+ 42
+0.000000
+ 10
+762200.298255
+ 20
+4306014.467730
+ 42
+0.000000
+ 10
+762173.387300
+ 20
+4306092.476147
+ 42
+0.000000
+ 10
+762150.499685
+ 20
+4306153.948909
+ 42
+0.000000
+ 10
+763158.928726
+ 20
+4305744.011865
+ 42
+0.000000
+ 10
+763355.575877
+ 20
+4305709.433848
+ 42
+0.000000
+ 10
+763496.234615
+ 20
+4305686.332237
+ 42
+0.000000
+ 10
+763947.978605
+ 20
+4305714.716040
+ 42
+0.000000
+ 10
+764337.552303
+ 20
+4305835.509256
+ 42
+0.000000
+ 10
+764643.497748
+ 20
+4306092.438042
+ 42
+0.000000
+ 10
+765052.197391
+ 20
+4306108.334977
+ 42
+0.000000
+ 10
+765385.307431
+ 20
+4305942.798852
+ 42
+0.000000
+ 10
+765705.479210
+ 20
+4305930.201454
+ 42
+0.000000
+ 10
+765907.277461
+ 20
+4305820.289971
+ 42
+0.000000
+ 10
+766232.375035
+ 20
+4305738.977446
+ 42
+0.000000
+ 10
+766876.158792
+ 20
+4305509.495373
+ 42
+0.000000
+ 10
+767643.858285
+ 20
+4305368.710890
+ 42
+0.000000
+ 10
+768464.353311
+ 20
+4305260.905544
+ 42
+0.000000
+ 10
+768951.893629
+ 20
+4304952.938725
+ 42
+0.000000
+ 10
+769063.110569
+ 20
+4304748.895581
+ 42
+0.000000
+ 10
+769251.818492
+ 20
+4304591.941463
+ 42
+0.000000
+ 10
+769942.210560
+ 20
+4304530.980268
+ 42
+0.000000
+ 10
+770088.654797
+ 20
+4304518.191316
+ 42
+0.000000
+ 10
+770194.967174
+ 20
+4303923.908043
+ 42
+0.000000
+ 10
+770263.484355
+ 20
+4303851.784542
+ 42
+0.000000
+ 10
+770380.588909
+ 20
+4303731.308642
+ 42
+0.000000
+ 10
+770455.159012
+ 20
+4303583.820787
+ 42
+0.000000
+ 10
+770534.337992
+ 20
+4303428.711301
+ 42
+0.000000
+ 10
+770836.953517
+ 20
+4303297.907360
+ 42
+0.000000
+ 10
+771246.978152
+ 20
+4303000.751314
+ 42
+0.000000
+ 10
+771671.403422
+ 20
+4302893.040598
+ 42
+0.000000
+ 10
+772038.334797
+ 20
+4303169.024968
+ 42
+0.000000
+ 10
+772489.500772
+ 20
+4303042.270948
+ 42
+0.000000
+ 10
+773081.727219
+ 20
+4302909.287353
+ 42
+0.000000
+ 10
+773283.715319
+ 20
+4302799.554787
+ 42
+0.000000
+ 10
+773408.634454
+ 20
+4302731.623262
+ 42
+0.000000
+ 10
+773559.887673
+ 20
+4302480.111215
+ 42
+0.000000
+ 10
+773778.592438
+ 20
+4302490.997516
+ 42
+0.000000
+ 10
+773941.871390
+ 20
+4302369.940324
+ 42
+0.000000
+ 10
+774143.489878
+ 20
+4302095.727528
+ 42
+0.000000
+ 10
+774300.058754
+ 20
+4302043.351383
+ 42
+0.000000
+ 10
+774472.333202
+ 20
+4301688.108951
+ 42
+0.000000
+ 10
+774963.912905
+ 20
+4301402.841318
+ 42
+0.000000
+ 10
+774901.568453
+ 20
+4301119.493350
+ 42
+0.000000
+ 10
+774610.435976
+ 20
+4300863.784771
+ 42
+0.000000
+ 10
+774318.695874
+ 20
+4300449.137639
+ 42
+0.000000
+ 10
+774018.467725
+ 20
+4300027.542590
+ 42
+0.000000
+ 10
+773998.604879
+ 20
+4300023.522217
+ 42
+0.000000
+ 10
+773194.943780
+ 20
+4299850.209119
+ 42
+0.000000
+ 10
+772875.435960
+ 20
+4299759.191740
+ 42
+0.000000
+ 10
+771763.493500
+ 20
+4299673.229276
+ 42
+0.000000
+ 10
+771653.973660
+ 20
+4299823.957487
+ 42
+0.000000
+ 10
+771169.844121
+ 20
+4300096.345134
+ 42
+0.000000
+ 10
+770298.883492
+ 20
+4300111.068956
+ 42
+0.000000
+ 10
+769752.550700
+ 20
+4300015.786030
+ 42
+0.000000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    69
+100
+AcDbEntity
+  8
+Sexta
+ 62
+     5
+100
+AcDbPolyline
+ 90
+    64
+ 70
+     1
+ 38
+0.000
+ 10
+765386.860623
+ 20
+4293473.081532
+ 42
+0.000000
+ 10
+764805.706666
+ 20
+4293468.144350
+ 42
+0.000000
+ 10
+764252.745120
+ 20
+4293505.303532
+ 42
+0.000000
+ 10
+764278.126588
+ 20
+4293867.307841
+ 42
+0.000000
+ 10
+764203.318916
+ 20
+4294128.189653
+ 42
+0.000000
+ 10
+763953.391687
+ 20
+4294422.146597
+ 42
+0.000000
+ 10
+763945.089877
+ 20
+4294436.317197
+ 42
+0.000000
+ 10
+763793.312566
+ 20
+4294683.532439
+ 42
+0.000000
+ 10
+763607.471850
+ 20
+4294987.404904
+ 42
+0.000000
+ 10
+763944.061336
+ 20
+4295305.289342
+ 42
+0.000000
+ 10
+764078.049935
+ 20
+4296273.209313
+ 42
+0.000000
+ 10
+764523.695558
+ 20
+4296526.965500
+ 42
+0.000000
+ 10
+764927.130946
+ 20
+4296689.327120
+ 42
+0.000000
+ 10
+765352.230753
+ 20
+4296905.776197
+ 42
+0.000000
+ 10
+766175.463874
+ 20
+4297103.361511
+ 42
+0.000000
+ 10
+766579.983446
+ 20
+4297283.629435
+ 42
+0.000000
+ 10
+766588.522948
+ 20
+4297288.361399
+ 42
+0.000000
+ 10
+766627.099721
+ 20
+4297305.215176
+ 42
+0.000000
+ 10
+766602.829848
+ 20
+4297691.131883
+ 42
+0.000000
+ 10
+766717.403179
+ 20
+4297879.456944
+ 42
+0.000000
+ 10
+766838.856622
+ 20
+4298095.798068
+ 42
+0.000000
+ 10
+766877.435608
+ 20
+4298319.355930
+ 42
+0.000000
+ 10
+766909.761351
+ 20
+4298496.029142
+ 42
+0.000000
+ 10
+767221.085471
+ 20
+4298445.385042
+ 42
+0.000000
+ 10
+767737.663778
+ 20
+4298266.094959
+ 42
+0.000000
+ 10
+767917.585794
+ 20
+4298321.065065
+ 42
+0.000000
+ 10
+768127.312545
+ 20
+4298240.354283
+ 42
+0.000000
+ 10
+768515.921752
+ 20
+4298091.240454
+ 42
+0.000000
+ 10
+768732.424119
+ 20
+4298016.330459
+ 42
+0.000000
+ 10
+768916.123118
+ 20
+4298062.560464
+ 42
+0.000000
+ 10
+769105.905127
+ 20
+4297826.723491
+ 42
+0.000000
+ 10
+769128.604165
+ 20
+4297798.598577
+ 42
+0.000000
+ 10
+769170.135839
+ 20
+4297625.528182
+ 42
+0.000000
+ 10
+769622.741908
+ 20
+4297309.711769
+ 42
+0.000000
+ 10
+769513.426391
+ 20
+4296993.715221
+ 42
+0.000000
+ 10
+769216.950594
+ 20
+4296193.502139
+ 42
+0.000000
+ 10
+769069.615247
+ 20
+4296048.481689
+ 42
+0.000000
+ 10
+768982.454166
+ 20
+4295847.713443
+ 42
+0.000000
+ 10
+768963.519007
+ 20
+4295815.955121
+ 42
+0.000000
+ 10
+768909.122509
+ 20
+4295675.197865
+ 42
+0.000000
+ 10
+768885.723836
+ 20
+4295621.062245
+ 42
+0.000000
+ 10
+768839.101020
+ 20
+4295250.525541
+ 42
+0.000000
+ 10
+768706.600904
+ 20
+4295154.914239
+ 42
+0.000000
+ 10
+768589.556026
+ 20
+4294910.911504
+ 42
+0.000000
+ 10
+768473.460252
+ 20
+4294715.841140
+ 42
+0.000000
+ 10
+768557.361665
+ 20
+4294138.570203
+ 42
+0.000000
+ 10
+768749.568357
+ 20
+4293961.701096
+ 42
+0.000000
+ 10
+768705.127447
+ 20
+4293654.586487
+ 42
+0.000000
+ 10
+768416.587574
+ 20
+4293308.108988
+ 42
+0.000000
+ 10
+768264.541402
+ 20
+4293326.313442
+ 42
+0.000000
+ 10
+767667.495492
+ 20
+4293042.806791
+ 42
+0.000000
+ 10
+767647.850499
+ 20
+4293367.756734
+ 42
+0.000000
+ 10
+767457.837595
+ 20
+4293609.180546
+ 42
+0.000000
+ 10
+767280.336140
+ 20
+4293556.534709
+ 42
+0.000000
+ 10
+766992.245427
+ 20
+4293583.524390
+ 42
+0.000000
+ 10
+766669.633560
+ 20
+4293420.446517
+ 42
+0.000000
+ 10
+766310.135868
+ 20
+4293007.218974
+ 42
+0.000000
+ 10
+766030.271882
+ 20
+4293100.086030
+ 42
+0.000000
+ 10
+765929.581318
+ 20
+4293222.291605
+ 42
+0.000000
+ 10
+765750.308079
+ 20
+4293326.312531
+ 42
+0.000000
+ 10
+765560.031191
+ 20
+4293473.309267
+ 42
+0.000000
+ 10
+765399.067495
+ 20
+4293472.377858
+ 42
+0.000000
+ 10
+765386.860623
+ 20
+4293473.081532
+ 42
+0.000000
+ 10
+765386.860623
+ 20
+4293473.081532
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    70
+100
+AcDbEntity
+  8
+Septima
+ 62
+     6
+100
+AcDbPolyline
+ 90
+   171
+ 70
+     1
+ 38
+0.000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+ 10
+769752.550700
+ 20
+4300015.786030
+ 42
+0.000000
+ 10
+770298.883492
+ 20
+4300111.068956
+ 42
+0.000000
+ 10
+771169.844121
+ 20
+4300096.345134
+ 42
+0.000000
+ 10
+771653.973660
+ 20
+4299823.957487
+ 42
+0.000000
+ 10
+771763.493500
+ 20
+4299673.229276
+ 42
+0.000000
+ 10
+772875.435960
+ 20
+4299759.191740
+ 42
+0.000000
+ 10
+773194.943780
+ 20
+4299850.209119
+ 42
+0.000000
+ 10
+773998.604879
+ 20
+4300023.522217
+ 42
+0.000000
+ 10
+774018.467725
+ 20
+4300027.542590
+ 42
+0.000000
+ 10
+774318.695874
+ 20
+4300449.137639
+ 42
+0.000000
+ 10
+774610.435976
+ 20
+4300863.784771
+ 42
+0.000000
+ 10
+774901.568453
+ 20
+4301119.493350
+ 42
+0.000000
+ 10
+774963.912905
+ 20
+4301402.841318
+ 42
+0.000000
+ 10
+775156.437859
+ 20
+4301367.287252
+ 42
+0.000000
+ 10
+775342.509578
+ 20
+4301117.010990
+ 42
+0.000000
+ 10
+775499.704065
+ 20
+4301022.444141
+ 42
+0.000000
+ 10
+775640.458795
+ 20
+4300950.648307
+ 42
+0.000000
+ 10
+776198.513903
+ 20
+4300856.702232
+ 42
+0.000000
+ 10
+776523.800109
+ 20
+4300730.222331
+ 42
+0.000000
+ 10
+776828.785284
+ 20
+4300513.020361
+ 42
+0.000000
+ 10
+777086.114995
+ 20
+4300390.858181
+ 42
+0.000000
+ 10
+777317.879839
+ 20
+4300154.443370
+ 42
+0.000000
+ 10
+777410.035488
+ 20
+4300030.962454
+ 42
+0.000000
+ 10
+777666.848707
+ 20
+4299998.825417
+ 42
+0.000000
+ 10
+777797.994835
+ 20
+4299755.566433
+ 42
+0.000000
+ 10
+777628.728447
+ 20
+4299547.358837
+ 42
+0.000000
+ 10
+777314.789359
+ 20
+4299421.900529
+ 42
+0.000000
+ 10
+777037.055359
+ 20
+4299305.499693
+ 42
+0.000000
+ 10
+776729.939459
+ 20
+4299308.118322
+ 42
+0.000000
+ 10
+776573.993978
+ 20
+4299115.961192
+ 42
+0.000000
+ 10
+776658.784479
+ 20
+4299078.906126
+ 42
+0.000000
+ 10
+776740.272702
+ 20
+4299061.742362
+ 42
+0.000000
+ 10
+776744.040459
+ 20
+4299028.531031
+ 42
+0.000000
+ 10
+776664.736693
+ 20
+4299007.982544
+ 42
+0.000000
+ 10
+776579.695858
+ 20
+4299027.246118
+ 42
+0.000000
+ 10
+776521.469949
+ 20
+4299050.779338
+ 42
+0.000000
+ 10
+776483.178337
+ 20
+4298901.625816
+ 42
+0.000000
+ 10
+776484.208068
+ 20
+4298797.188092
+ 42
+0.000000
+ 10
+776483.586324
+ 20
+4298540.428188
+ 42
+0.000000
+ 10
+776483.409587
+ 20
+4298245.895637
+ 42
+0.000000
+ 10
+776599.103700
+ 20
+4297846.481225
+ 42
+0.000000
+ 10
+776914.204083
+ 20
+4297317.316176
+ 42
+0.000000
+ 10
+777074.815717
+ 20
+4297177.323563
+ 42
+0.000000
+ 10
+777113.569668
+ 20
+4297014.185244
+ 42
+0.000000
+ 10
+777228.135282
+ 20
+4296872.587974
+ 42
+0.000000
+ 10
+777267.219440
+ 20
+4296725.021586
+ 42
+0.000000
+ 10
+777186.737069
+ 20
+4296513.263621
+ 42
+0.000000
+ 10
+777357.525308
+ 20
+4296381.410272
+ 42
+0.000000
+ 10
+777495.801162
+ 20
+4296482.935377
+ 42
+0.000000
+ 10
+777816.058180
+ 20
+4296207.383921
+ 42
+0.000000
+ 10
+778124.986564
+ 20
+4295908.106632
+ 42
+0.000000
+ 10
+778204.615117
+ 20
+4295820.869168
+ 42
+0.000000
+ 10
+778515.531557
+ 20
+4295490.553919
+ 42
+0.000000
+ 10
+778682.745957
+ 20
+4295313.030906
+ 42
+0.000000
+ 10
+778972.816358
+ 20
+4295180.947545
+ 42
+0.000000
+ 10
+779404.470318
+ 20
+4295279.476387
+ 42
+0.000000
+ 10
+779603.019016
+ 20
+4295250.895809
+ 42
+0.000000
+ 10
+779793.455358
+ 20
+4295180.910497
+ 42
+0.000000
+ 10
+779979.669973
+ 20
+4295576.481255
+ 42
+0.000000
+ 10
+780083.891554
+ 20
+4295236.714793
+ 42
+0.000000
+ 10
+779950.893209
+ 20
+4294960.831398
+ 42
+0.000000
+ 10
+779999.860519
+ 20
+4294781.389617
+ 42
+0.000000
+ 10
+780178.775989
+ 20
+4294594.303129
+ 42
+0.000000
+ 10
+780176.917048
+ 20
+4294350.828307
+ 42
+0.000000
+ 10
+780217.578481
+ 20
+4293888.784263
+ 42
+0.000000
+ 10
+780371.266504
+ 20
+4293455.178462
+ 42
+0.000000
+ 10
+780586.109079
+ 20
+4293434.973024
+ 42
+0.000000
+ 10
+780716.965665
+ 20
+4293500.723764
+ 42
+0.000000
+ 10
+780963.887818
+ 20
+4293607.257166
+ 42
+0.000000
+ 10
+780889.152615
+ 20
+4293258.950205
+ 42
+0.000000
+ 10
+780870.928170
+ 20
+4292937.093269
+ 42
+0.000000
+ 10
+781024.875767
+ 20
+4292866.954110
+ 42
+0.000000
+ 10
+780891.630055
+ 20
+4292622.169156
+ 42
+0.000000
+ 10
+781000.980054
+ 20
+4292459.313539
+ 42
+0.000000
+ 10
+780835.842160
+ 20
+4292254.527512
+ 42
+0.000000
+ 10
+780935.015144
+ 20
+4292010.174616
+ 42
+0.000000
+ 10
+780637.762717
+ 20
+4292144.168579
+ 42
+0.000000
+ 10
+780441.709620
+ 20
+4292198.382035
+ 42
+0.000000
+ 10
+780112.184888
+ 20
+4291914.461591
+ 42
+0.000000
+ 10
+779964.707032
+ 20
+4291874.813390
+ 42
+0.000000
+ 10
+779576.902815
+ 20
+4291613.318430
+ 42
+0.000000
+ 10
+779470.533920
+ 20
+4291766.293475
+ 42
+0.000000
+ 10
+779365.572712
+ 20
+4291879.307149
+ 42
+0.000000
+ 10
+779383.200018
+ 20
+4292046.642775
+ 42
+0.000000
+ 10
+778925.656697
+ 20
+4291986.123583
+ 42
+0.000000
+ 10
+778504.681579
+ 20
+4291950.251875
+ 42
+0.000000
+ 10
+778275.993246
+ 20
+4291867.780411
+ 42
+0.000000
+ 10
+778064.946542
+ 20
+4291629.221739
+ 42
+0.000000
+ 10
+778141.404512
+ 20
+4291285.130393
+ 42
+0.000000
+ 10
+778028.566158
+ 20
+4291175.600116
+ 42
+0.000000
+ 10
+777822.626876
+ 20
+4291163.958875
+ 42
+0.000000
+ 10
+777463.891770
+ 20
+4291114.760626
+ 42
+0.000000
+ 10
+777296.177256
+ 20
+4291055.564349
+ 42
+0.000000
+ 10
+776959.833090
+ 20
+4290838.235682
+ 42
+0.000000
+ 10
+776873.562713
+ 20
+4290615.173716
+ 42
+0.000000
+ 10
+776681.006138
+ 20
+4290694.052997
+ 42
+0.000000
+ 10
+776446.478754
+ 20
+4290226.890576
+ 42
+0.000000
+ 10
+776091.933898
+ 20
+4290532.440122
+ 42
+0.000000
+ 10
+774890.266215
+ 20
+4291694.459775
+ 42
+0.000000
+ 10
+774872.389537
+ 20
+4291758.302287
+ 42
+0.000000
+ 10
+774839.143143
+ 20
+4291863.846300
+ 42
+0.000000
+ 10
+774822.916669
+ 20
+4291879.956312
+ 42
+0.000000
+ 10
+774803.442421
+ 20
+4291889.285807
+ 42
+0.000000
+ 10
+774793.008426
+ 20
+4291888.925256
+ 42
+0.000000
+ 10
+774787.868143
+ 20
+4291886.524865
+ 42
+0.000000
+ 10
+774770.900050
+ 20
+4291873.713327
+ 42
+0.000000
+ 10
+774755.785965
+ 20
+4291857.631732
+ 42
+0.000000
+ 10
+774295.622883
+ 20
+4292629.715076
+ 42
+0.000000
+ 10
+774285.408273
+ 20
+4292648.256148
+ 42
+0.000000
+ 10
+773888.589020
+ 20
+4292796.836939
+ 42
+0.000000
+ 10
+773782.273764
+ 20
+4292850.966462
+ 42
+0.000000
+ 10
+773745.874126
+ 20
+4292846.378871
+ 42
+0.000000
+ 10
+773432.791692
+ 20
+4292914.511740
+ 42
+0.000000
+ 10
+772875.446759
+ 20
+4293024.279523
+ 42
+0.000000
+ 10
+772868.110812
+ 20
+4293035.141354
+ 42
+0.000000
+ 10
+772850.342546
+ 20
+4293045.645108
+ 42
+0.000000
+ 10
+772826.412609
+ 20
+4293058.160150
+ 42
+0.000000
+ 10
+772800.369902
+ 20
+4293056.155025
+ 42
+0.000000
+ 10
+772778.369261
+ 20
+4293063.179594
+ 42
+0.000000
+ 10
+772752.815054
+ 20
+4293072.305017
+ 42
+0.000000
+ 10
+772742.382757
+ 20
+4293071.947075
+ 42
+0.000000
+ 10
+772702.354207
+ 20
+4293071.685146
+ 42
+0.000000
+ 10
+772695.627823
+ 20
+4293064.786224
+ 42
+0.000000
+ 10
+772621.738584
+ 20
+4293036.690532
+ 42
+0.000000
+ 10
+772424.610681
+ 20
+4293074.386888
+ 42
+0.000000
+ 10
+772276.293033
+ 20
+4293059.303152
+ 42
+0.000000
+ 10
+771439.188815
+ 20
+4292926.208528
+ 42
+0.000000
+ 10
+770965.199442
+ 20
+4292787.790831
+ 42
+0.000000
+ 10
+770869.633910
+ 20
+4293191.284620
+ 42
+0.000000
+ 10
+770880.770394
+ 20
+4293630.643849
+ 42
+0.000000
+ 10
+770982.199335
+ 20
+4293897.489761
+ 42
+0.000000
+ 10
+771197.859855
+ 20
+4294259.365818
+ 42
+0.000000
+ 10
+771402.745367
+ 20
+4294477.517458
+ 42
+0.000000
+ 10
+771407.633649
+ 20
+4294691.063628
+ 42
+0.000000
+ 10
+771310.687057
+ 20
+4294828.893833
+ 42
+0.000000
+ 10
+771426.535697
+ 20
+4295538.559078
+ 42
+0.000000
+ 10
+771454.386990
+ 20
+4295792.899316
+ 42
+0.000000
+ 10
+771361.126314
+ 20
+4295848.614026
+ 42
+0.000000
+ 10
+771309.432342
+ 20
+4295884.633905
+ 42
+0.000000
+ 10
+771097.886073
+ 20
+4295786.279455
+ 42
+0.000000
+ 10
+770963.166925
+ 20
+4295986.170084
+ 42
+0.000000
+ 10
+770671.172247
+ 20
+4296001.773892
+ 42
+0.000000
+ 10
+770621.605657
+ 20
+4295847.830675
+ 42
+0.000000
+ 10
+770261.029670
+ 20
+4295910.012224
+ 42
+0.000000
+ 10
+770198.494852
+ 20
+4295778.969226
+ 42
+0.000000
+ 10
+770186.024535
+ 20
+4295710.753394
+ 42
+0.000000
+ 10
+770166.865749
+ 20
+4295634.530739
+ 42
+0.000000
+ 10
+770136.710615
+ 20
+4295549.043485
+ 42
+0.000000
+ 10
+770100.584405
+ 20
+4295460.019362
+ 42
+0.000000
+ 10
+770068.842544
+ 20
+4295421.154649
+ 42
+0.000000
+ 10
+770000.599857
+ 20
+4295406.610005
+ 42
+0.000000
+ 10
+769948.454664
+ 20
+4295404.837693
+ 42
+0.000000
+ 10
+769910.139421
+ 20
+4295405.758319
+ 42
+0.000000
+ 10
+769745.608518
+ 20
+4295766.908839
+ 42
+0.000000
+ 10
+769644.816769
+ 20
+4296941.498648
+ 42
+0.000000
+ 10
+769629.617509
+ 20
+4297312.167968
+ 42
+0.000000
+ 10
+769556.663494
+ 20
+4298333.229462
+ 42
+0.000000
+ 10
+769542.167750
+ 20
+4298478.322052
+ 42
+0.000000
+ 10
+769542.092339
+ 20
+4298480.542162
+ 42
+0.000000
+ 10
+769527.116944
+ 20
+4298818.990957
+ 42
+0.000000
+ 10
+769504.174925
+ 20
+4299212.736100
+ 42
+0.000000
+ 10
+769503.156777
+ 20
+4299242.707608
+ 42
+0.000000
+ 10
+769483.029494
+ 20
+4299297.590732
+ 42
+0.000000
+ 10
+769471.815198
+ 20
+4299346.108619
+ 42
+0.000000
+ 10
+769472.760665
+ 20
+4299369.478806
+ 42
+0.000000
+ 10
+769489.720190
+ 20
+4299407.840368
+ 42
+0.000000
+ 10
+769523.824864
+ 20
+4299427.891741
+ 42
+0.000000
+ 10
+769678.260110
+ 20
+4299643.183416
+ 42
+0.000000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+ 10
+769697.447451
+ 20
+4299743.856370
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    71
+100
+AcDbEntity
+  8
+Octava
+ 62
+     7
+100
+AcDbPolyline
+ 90
+   141
+ 70
+     1
+ 38
+0.000
+ 10
+759836.354763
+ 20
+4297472.299741
+ 42
+0.000000
+ 10
+760010.512882
+ 20
+4297970.273690
+ 42
+0.000000
+ 10
+759996.233330
+ 20
+4298777.664558
+ 42
+0.000000
+ 10
+759969.942526
+ 20
+4298863.478482
+ 42
+0.000000
+ 10
+759718.573172
+ 20
+4299688.661811
+ 42
+0.000000
+ 10
+759737.499734
+ 20
+4299694.837664
+ 42
+0.000000
+ 10
+759761.455857
+ 20
+4299706.734388
+ 42
+0.000000
+ 10
+759779.513793
+ 20
+4299712.881900
+ 42
+0.000000
+ 10
+759830.285953
+ 20
+4299728.990821
+ 42
+0.000000
+ 10
+759897.669574
+ 20
+4299742.310692
+ 42
+0.000000
+ 10
+759933.675963
+ 20
+4299757.936497
+ 42
+0.000000
+ 10
+759995.993466
+ 20
+4299766.646313
+ 42
+0.000000
+ 10
+760018.466661
+ 20
+4299770.716673
+ 42
+0.000000
+ 10
+760163.181908
+ 20
+4299812.132554
+ 42
+0.000000
+ 10
+760227.017462
+ 20
+4299827.561397
+ 42
+0.000000
+ 10
+760292.772039
+ 20
+4299837.497606
+ 42
+0.000000
+ 10
+760315.208517
+ 20
+4299842.678858
+ 42
+0.000000
+ 10
+760401.808001
+ 20
+4299853.300150
+ 42
+0.000000
+ 10
+760422.507298
+ 20
+4299858.424681
+ 42
+0.000000
+ 10
+760442.265129
+ 20
+4299865.740815
+ 42
+0.000000
+ 10
+760482.466959
+ 20
+4299885.951931
+ 42
+0.000000
+ 10
+760523.792364
+ 20
+4299898.421551
+ 42
+0.000000
+ 10
+760566.095598
+ 20
+4299907.589824
+ 42
+0.000000
+ 10
+760609.121397
+ 20
+4299921.227003
+ 42
+0.000000
+ 10
+760697.311022
+ 20
+4299936.348799
+ 42
+0.000000
+ 10
+760739.577434
+ 20
+4299946.628052
+ 42
+0.000000
+ 10
+760804.389187
+ 20
+4299958.760099
+ 42
+0.000000
+ 10
+760843.144740
+ 20
+4299970.035712
+ 42
+0.000000
+ 10
+760866.412629
+ 20
+4299976.357160
+ 42
+0.000000
+ 10
+760909.656762
+ 20
+4299983.335801
+ 42
+0.000000
+ 10
+760953.659804
+ 20
+4299993.673365
+ 42
+0.000000
+ 10
+761041.957881
+ 20
+4300005.468957
+ 42
+0.000000
+ 10
+761128.299430
+ 20
+4300023.868567
+ 42
+0.000000
+ 10
+761191.409711
+ 20
+4300034.836609
+ 42
+0.000000
+ 10
+761212.108186
+ 20
+4300039.963249
+ 42
+0.000000
+ 10
+761233.565480
+ 20
+4300048.448660
+ 42
+0.000000
+ 10
+761270.180849
+ 20
+4300071.879597
+ 42
+0.000000
+ 10
+761762.596468
+ 20
+4300273.694694
+ 42
+0.000000
+ 10
+761831.157303
+ 20
+4300224.840580
+ 42
+0.000000
+ 10
+761943.339610
+ 20
+4300145.201413
+ 42
+0.000000
+ 10
+762399.160345
+ 20
+4300401.411789
+ 42
+0.000000
+ 10
+762518.014192
+ 20
+4300304.221078
+ 42
+0.000000
+ 10
+762558.309796
+ 20
+4300268.883603
+ 42
+0.000000
+ 10
+762784.001730
+ 20
+4300096.334908
+ 42
+0.000000
+ 10
+762948.544136
+ 20
+4300247.363683
+ 42
+0.000000
+ 10
+762995.523159
+ 20
+4300430.057112
+ 42
+0.000000
+ 10
+762905.015402
+ 20
+4300563.741127
+ 42
+0.000000
+ 10
+762956.570863
+ 20
+4300713.248386
+ 42
+0.000000
+ 10
+763043.730498
+ 20
+4300863.937261
+ 42
+0.000000
+ 10
+763276.942494
+ 20
+4300936.130859
+ 42
+0.000000
+ 10
+763385.975518
+ 20
+4301160.894313
+ 42
+0.000000
+ 10
+763672.567702
+ 20
+4301039.290353
+ 42
+0.000000
+ 10
+763722.037404
+ 20
+4300649.768166
+ 42
+0.000000
+ 10
+763731.147617
+ 20
+4300663.406409
+ 42
+0.000000
+ 10
+763775.699769
+ 20
+4300709.339162
+ 42
+0.000000
+ 10
+763804.415297
+ 20
+4300734.742426
+ 42
+0.000000
+ 10
+763818.551398
+ 20
+4300754.104362
+ 42
+0.000000
+ 10
+763836.697328
+ 20
+4300783.601202
+ 42
+0.000000
+ 10
+763865.394289
+ 20
+4300835.674661
+ 42
+0.000000
+ 10
+763903.385186
+ 20
+4300895.836502
+ 42
+0.000000
+ 10
+763930.067106
+ 20
+4300930.062825
+ 42
+0.000000
+ 10
+764037.864419
+ 20
+4301034.777863
+ 42
+0.000000
+ 10
+764078.181373
+ 20
+4301077.237800
+ 42
+0.000000
+ 10
+764087.290434
+ 20
+4301090.876516
+ 42
+0.000000
+ 10
+764119.919836
+ 20
+4301155.306186
+ 42
+0.000000
+ 10
+764256.384292
+ 20
+4301338.769281
+ 42
+0.000000
+ 10
+764280.753915
+ 20
+4301364.029757
+ 42
+0.000000
+ 10
+764560.641979
+ 20
+4301547.836363
+ 42
+0.000000
+ 10
+764579.174403
+ 20
+4301539.564606
+ 42
+0.000000
+ 10
+764598.464101
+ 20
+4301534.652013
+ 42
+0.000000
+ 10
+764682.347889
+ 20
+4301521.894328
+ 42
+0.000000
+ 10
+764763.812222
+ 20
+4301503.500274
+ 42
+0.000000
+ 10
+764784.044698
+ 20
+4301496.397031
+ 42
+0.000000
+ 10
+764804.997289
+ 20
+4301493.763033
+ 42
+0.000000
+ 10
+764845.351167
+ 20
+4301482.886943
+ 42
+0.000000
+ 10
+764864.752479
+ 20
+4301474.644841
+ 42
+0.000000
+ 10
+764884.910958
+ 20
+4301469.761942
+ 42
+0.000000
+ 10
+764922.882486
+ 20
+4301452.138903
+ 42
+0.000000
+ 10
+764942.358162
+ 20
+4301441.676889
+ 42
+0.000000
+ 10
+765021.300428
+ 20
+4301368.747962
+ 42
+0.000000
+ 10
+765063.748461
+ 20
+4301321.270397
+ 42
+0.000000
+ 10
+765078.993939
+ 20
+4301307.333381
+ 42
+0.000000
+ 10
+765092.576877
+ 20
+4301291.118222
+ 42
+0.000000
+ 10
+765107.822461
+ 20
+4301277.181256
+ 42
+0.000000
+ 10
+765134.157307
+ 20
+4301243.611958
+ 42
+0.000000
+ 10
+765151.102770
+ 20
+4301230.843199
+ 42
+0.000000
+ 10
+765228.349265
+ 20
+4301156.748012
+ 42
+0.000000
+ 10
+765246.126358
+ 20
+4301145.118539
+ 42
+0.000000
+ 10
+765261.409625
+ 20
+4301130.071795
+ 42
+0.000000
+ 10
+765295.264357
+ 20
+4301105.644860
+ 42
+0.000000
+ 10
+765311.379084
+ 20
+4301091.737311
+ 42
+0.000000
+ 10
+765347.765157
+ 20
+4301069.617861
+ 42
+0.000000
+ 10
+765447.743339
+ 20
+4300991.840147
+ 42
+0.000000
+ 10
+765483.298984
+ 20
+4300968.582156
+ 42
+0.000000
+ 10
+765520.517406
+ 20
+4300947.602575
+ 42
+0.000000
+ 10
+765562.412919
+ 20
+4300916.778159
+ 42
+0.000000
+ 10
+765608.539515
+ 20
+4300889.429550
+ 42
+0.000000
+ 10
+765642.136053
+ 20
+4300872.774333
+ 42
+0.000000
+ 10
+765843.147655
+ 20
+4300763.936367
+ 42
+0.000000
+ 10
+765891.720401
+ 20
+4300637.765855
+ 42
+0.000000
+ 10
+765936.597103
+ 20
+4300518.139370
+ 42
+0.000000
+ 10
+765988.323582
+ 20
+4300427.636522
+ 42
+0.000000
+ 10
+766056.095414
+ 20
+4300247.657084
+ 42
+0.000000
+ 10
+766137.219832
+ 20
+4300110.355405
+ 42
+0.000000
+ 10
+766222.230947
+ 20
+4299960.960517
+ 42
+0.000000
+ 10
+766328.314620
+ 20
+4299805.606034
+ 42
+0.000000
+ 10
+766434.461547
+ 20
+4299700.263325
+ 42
+0.000000
+ 10
+766505.158325
+ 20
+4299614.845448
+ 42
+0.000000
+ 10
+766549.872702
+ 20
+4299526.332378
+ 42
+0.000000
+ 10
+766587.766896
+ 20
+4299382.025175
+ 42
+0.000000
+ 10
+766640.903640
+ 20
+4299198.223477
+ 42
+0.000000
+ 10
+766664.539106
+ 20
+4299090.110238
+ 42
+0.000000
+ 10
+766679.210802
+ 20
+4299041.706076
+ 42
+0.000000
+ 10
+766711.720398
+ 20
+4298928.334692
+ 42
+0.000000
+ 10
+766819.959992
+ 20
+4298631.921992
+ 42
+0.000000
+ 10
+766867.407438
+ 20
+4298462.376832
+ 42
+0.000000
+ 10
+766881.239598
+ 20
+4298387.273374
+ 42
+0.000000
+ 10
+766877.435608
+ 20
+4298319.355930
+ 42
+0.000000
+ 10
+766838.856622
+ 20
+4298095.798068
+ 42
+0.000000
+ 10
+766717.403179
+ 20
+4297879.456944
+ 42
+0.000000
+ 10
+766602.829848
+ 20
+4297691.131883
+ 42
+0.000000
+ 10
+766627.099721
+ 20
+4297305.215176
+ 42
+0.000000
+ 10
+766588.522948
+ 20
+4297288.361399
+ 42
+0.000000
+ 10
+766579.983446
+ 20
+4297283.629435
+ 42
+0.000000
+ 10
+766175.463874
+ 20
+4297103.361511
+ 42
+0.000000
+ 10
+765352.230753
+ 20
+4296905.776197
+ 42
+0.000000
+ 10
+764927.130946
+ 20
+4296689.327120
+ 42
+0.000000
+ 10
+764523.695558
+ 20
+4296526.965500
+ 42
+0.000000
+ 10
+764078.049935
+ 20
+4296273.209313
+ 42
+0.000000
+ 10
+763944.061336
+ 20
+4295305.289342
+ 42
+0.000000
+ 10
+763607.471850
+ 20
+4294987.404904
+ 42
+0.000000
+ 10
+762785.540619
+ 20
+4295242.430441
+ 42
+0.000000
+ 10
+762119.169154
+ 20
+4295267.085456
+ 42
+0.000000
+ 10
+761206.217688
+ 20
+4295541.488833
+ 42
+0.000000
+ 10
+761003.394843
+ 20
+4296471.587392
+ 42
+0.000000
+ 10
+760990.938088
+ 20
+4296480.067774
+ 42
+0.000000
+ 10
+760569.125883
+ 20
+4296769.578689
+ 42
+0.000000
+ 10
+759968.009090
+ 20
+4296984.340212
+ 42
+0.000000
+ 10
+759827.669978
+ 20
+4297445.346206
+ 42
+0.000000
+ 10
+759836.354763
+ 20
+4297472.299741
+ 42
+0.000000
+ 10
+759836.354763
+ 20
+4297472.299741
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    72
+100
+AcDbEntity
+  8
+Novena
+ 62
+     8
+100
+AcDbPolyline
+ 90
+    56
+ 70
+     1
+ 38
+0.000
+ 10
+763520.598486
+ 20
+4291229.600306
+ 42
+0.000000
+ 10
+763655.069443
+ 20
+4291400.744280
+ 42
+0.000000
+ 10
+763717.086405
+ 20
+4291761.734704
+ 42
+0.000000
+ 10
+763374.071202
+ 20
+4291711.473271
+ 42
+0.000000
+ 10
+763489.070677
+ 20
+4292049.768859
+ 42
+0.000000
+ 10
+763757.640868
+ 20
+4292139.794419
+ 42
+0.000000
+ 10
+763939.067412
+ 20
+4292128.034579
+ 42
+0.000000
+ 10
+764094.727318
+ 20
+4292446.577732
+ 42
+0.000000
+ 10
+764296.157655
+ 20
+4292827.766065
+ 42
+0.000000
+ 10
+764206.487097
+ 20
+4293038.147318
+ 42
+0.000000
+ 10
+764252.745120
+ 20
+4293505.303532
+ 42
+0.000000
+ 10
+764805.706666
+ 20
+4293468.144350
+ 42
+0.000000
+ 10
+765386.860623
+ 20
+4293473.081532
+ 42
+0.000000
+ 10
+765399.067495
+ 20
+4293472.377858
+ 42
+0.000000
+ 10
+765397.831112
+ 20
+4293431.219381
+ 42
+0.000000
+ 10
+765392.767187
+ 20
+4293374.375251
+ 42
+0.000000
+ 10
+765384.077737
+ 20
+4293321.855185
+ 42
+0.000000
+ 10
+765371.301082
+ 20
+4293261.419764
+ 42
+0.000000
+ 10
+765356.101560
+ 20
+4293195.347129
+ 42
+0.000000
+ 10
+765341.956304
+ 20
+4293123.753375
+ 42
+0.000000
+ 10
+765334.967632
+ 20
+4293072.401487
+ 42
+0.000000
+ 10
+765331.641373
+ 20
+4293015.615494
+ 42
+0.000000
+ 10
+765331.920637
+ 20
+4292981.175330
+ 42
+0.000000
+ 10
+765333.901494
+ 20
+4292947.903237
+ 42
+0.000000
+ 10
+765340.545317
+ 20
+4292879.226032
+ 42
+0.000000
+ 10
+765350.592459
+ 20
+4292812.884976
+ 42
+0.000000
+ 10
+765363.877649
+ 20
+4292727.760362
+ 42
+0.000000
+ 10
+765373.240932
+ 20
+4292655.840127
+ 42
+0.000000
+ 10
+765379.052724
+ 20
+4292586.023897
+ 42
+0.000000
+ 10
+765382.404627
+ 20
+4292511.680468
+ 42
+0.000000
+ 10
+765383.037199
+ 20
+4292440.580097
+ 42
+0.000000
+ 10
+765379.396844
+ 20
+4292367.114567
+ 42
+0.000000
+ 10
+765371.520483
+ 20
+4292290.173855
+ 42
+0.000000
+ 10
+765360.924516
+ 20
+4292216.476230
+ 42
+0.000000
+ 10
+765348.515352
+ 20
+4292144.940680
+ 42
+0.000000
+ 10
+765396.532891
+ 20
+4291827.608070
+ 42
+0.000000
+ 10
+765467.729978
+ 20
+4291572.169276
+ 42
+0.000000
+ 10
+765494.464627
+ 20
+4291136.331765
+ 42
+0.000000
+ 10
+765527.558546
+ 20
+4290822.946559
+ 42
+0.000000
+ 10
+765535.110260
+ 20
+4290753.188535
+ 42
+0.000000
+ 10
+765640.231714
+ 20
+4290498.882977
+ 42
+0.000000
+ 10
+765458.639993
+ 20
+4290279.457874
+ 42
+0.000000
+ 10
+765259.755103
+ 20
+4290421.734358
+ 42
+0.000000
+ 10
+764729.159025
+ 20
+4290277.377369
+ 42
+0.000000
+ 10
+764712.878054
+ 20
+4290295.727092
+ 42
+0.000000
+ 10
+764687.384009
+ 20
+4290329.327976
+ 42
+0.000000
+ 10
+764680.131687
+ 20
+4290337.976786
+ 42
+0.000000
+ 10
+764633.824644
+ 20
+4290395.333152
+ 42
+0.000000
+ 10
+764619.172558
+ 20
+4290417.070992
+ 42
+0.000000
+ 10
+764608.794704
+ 20
+4290441.173533
+ 42
+0.000000
+ 10
+764444.376722
+ 20
+4290542.387426
+ 42
+0.000000
+ 10
+764036.518934
+ 20
+4290634.409526
+ 42
+0.000000
+ 10
+763760.288693
+ 20
+4290616.356145
+ 42
+0.000000
+ 10
+763461.290238
+ 20
+4291154.293176
+ 42
+0.000000
+ 10
+763520.598486
+ 20
+4291229.600306
+ 42
+0.000000
+ 10
+763520.598486
+ 20
+4291229.600306
+ 42
+0.000000
+  0
+LWPOLYLINE
+  5
+    73
+100
+AcDbEntity
+  8
+Decima
+ 62
+     9
+100
+AcDbPolyline
+ 90
+   164
+ 70
+     1
+ 38
+0.000
+ 10
+772052.446817
+ 20
+4291435.732230
+ 42
+0.000000
+ 10
+772443.495770
+ 20
+4291329.091512
+ 42
+0.000000
+ 10
+772646.453989
+ 20
+4291274.921454
+ 42
+0.000000
+ 10
+772687.471508
+ 20
+4291119.626057
+ 42
+0.000000
+ 10
+772976.069882
+ 20
+4290015.941796
+ 42
+0.000000
+ 10
+772991.349761
+ 20
+4290002.018328
+ 42
+0.000000
+ 10
+773120.472157
+ 20
+4289893.090458
+ 42
+0.000000
+ 10
+773148.385699
+ 20
+4289866.264548
+ 42
+0.000000
+ 10
+773239.130239
+ 20
+4289759.355111
+ 42
+0.000000
+ 10
+773342.358445
+ 20
+4289643.984388
+ 42
+0.000000
+ 10
+773380.145767
+ 20
+4289608.607398
+ 42
+0.000000
+ 10
+773436.388761
+ 20
+4289568.307833
+ 42
+0.000000
+ 10
+773444.674163
+ 20
+4289555.256145
+ 42
+0.000000
+ 10
+773547.221074
+ 20
+4289459.868784
+ 42
+0.000000
+ 10
+773551.722483
+ 20
+4289455.578045
+ 42
+0.000000
+ 10
+773568.064958
+ 20
+4289436.135210
+ 42
+0.000000
+ 10
+773613.499287
+ 20
+4289381.017438
+ 42
+0.000000
+ 10
+773657.949942
+ 20
+4289329.200151
+ 42
+0.000000
+ 10
+773681.518314
+ 20
+4289302.226399
+ 42
+0.000000
+ 10
+774003.777952
+ 20
+4288921.000766
+ 42
+0.000000
+ 10
+774212.268041
+ 20
+4288430.285873
+ 42
+0.000000
+ 10
+774389.717982
+ 20
+4288158.556637
+ 42
+0.000000
+ 10
+774503.632887
+ 20
+4287986.886218
+ 42
+0.000000
+ 10
+774468.957076
+ 20
+4287678.951932
+ 42
+0.000000
+ 10
+774510.375211
+ 20
+4287488.112116
+ 42
+0.000000
+ 10
+774428.390064
+ 20
+4287036.292535
+ 42
+0.000000
+ 10
+774464.999403
+ 20
+4286858.623284
+ 42
+0.000000
+ 10
+774259.234408
+ 20
+4286687.053271
+ 42
+0.000000
+ 10
+774317.592682
+ 20
+4286510.132461
+ 42
+0.000000
+ 10
+774219.784102
+ 20
+4286340.059961
+ 42
+0.000000
+ 10
+774076.694732
+ 20
+4286143.981206
+ 42
+0.000000
+ 10
+773889.632871
+ 20
+4285959.730341
+ 42
+0.000000
+ 10
+773783.092477
+ 20
+4286372.828985
+ 42
+0.000000
+ 10
+773617.934178
+ 20
+4286895.050655
+ 42
+0.000000
+ 10
+773507.643143
+ 20
+4286834.583392
+ 42
+0.000000
+ 10
+773315.718120
+ 20
+4286766.870873
+ 42
+0.000000
+ 10
+773116.438437
+ 20
+4286761.146903
+ 42
+0.000000
+ 10
+772879.062259
+ 20
+4286774.127050
+ 42
+0.000000
+ 10
+772791.791396
+ 20
+4286778.917253
+ 42
+0.000000
+ 10
+772569.667288
+ 20
+4286753.531686
+ 42
+0.000000
+ 10
+772344.322021
+ 20
+4286771.384718
+ 42
+0.000000
+ 10
+772080.975999
+ 20
+4286601.240549
+ 42
+0.000000
+ 10
+771843.906164
+ 20
+4286528.689104
+ 42
+0.000000
+ 10
+771734.621618
+ 20
+4286412.715465
+ 42
+0.000000
+ 10
+771486.723588
+ 20
+4286069.752125
+ 42
+0.000000
+ 10
+771079.513021
+ 20
+4285492.443675
+ 42
+0.000000
+ 10
+771005.190782
+ 20
+4285269.873263
+ 42
+0.000000
+ 10
+770730.488316
+ 20
+4285406.119501
+ 42
+0.000000
+ 10
+770427.656611
+ 20
+4285344.716320
+ 42
+0.000000
+ 10
+770413.402231
+ 20
+4285405.355116
+ 42
+0.000000
+ 10
+770390.446252
+ 20
+4285465.698662
+ 42
+0.000000
+ 10
+770364.959311
+ 20
+4285549.294056
+ 42
+0.000000
+ 10
+770355.165447
+ 20
+4285581.189984
+ 42
+0.000000
+ 10
+770342.459883
+ 20
+4285621.877677
+ 42
+0.000000
+ 10
+770315.195799
+ 20
+4285706.524191
+ 42
+0.000000
+ 10
+770288.229355
+ 20
+4285756.730011
+ 42
+0.000000
+ 10
+770270.567045
+ 20
+4285789.470411
+ 42
+0.000000
+ 10
+770239.367589
+ 20
+4285861.759114
+ 42
+0.000000
+ 10
+770213.389371
+ 20
+4285934.224974
+ 42
+0.000000
+ 10
+770192.515018
+ 20
+4285984.637633
+ 42
+0.000000
+ 10
+770168.696130
+ 20
+4286070.512615
+ 42
+0.000000
+ 10
+770162.685009
+ 20
+4286093.646430
+ 42
+0.000000
+ 10
+770154.067971
+ 20
+4286142.252169
+ 42
+0.000000
+ 10
+770147.454676
+ 20
+4286183.146639
+ 42
+0.000000
+ 10
+770145.563923
+ 20
+4286187.527793
+ 42
+0.000000
+ 10
+770145.831773
+ 20
+4286205.317944
+ 42
+0.000000
+ 10
+770152.081665
+ 20
+4286252.205188
+ 42
+0.000000
+ 10
+770185.571775
+ 20
+4286317.797335
+ 42
+0.000000
+ 10
+770221.939127
+ 20
+4286401.268366
+ 42
+0.000000
+ 10
+770269.582652
+ 20
+4286511.793863
+ 42
+0.000000
+ 10
+770328.840323
+ 20
+4286639.383717
+ 42
+0.000000
+ 10
+770327.299388
+ 20
+4286710.455905
+ 42
+0.000000
+ 10
+770327.491330
+ 20
+4286730.466181
+ 42
+0.000000
+ 10
+770327.265297
+ 20
+4286737.126431
+ 42
+0.000000
+ 10
+770328.300244
+ 20
+4286834.957739
+ 42
+0.000000
+ 10
+770295.962234
+ 20
+4286863.865932
+ 42
+0.000000
+ 10
+770246.073418
+ 20
+4286896.624011
+ 42
+0.000000
+ 10
+770234.348899
+ 20
+4286908.450729
+ 42
+0.000000
+ 10
+770214.078750
+ 20
+4286941.102608
+ 42
+0.000000
+ 10
+770138.926901
+ 20
+4286999.675898
+ 42
+0.000000
+ 10
+770074.098979
+ 20
+4287036.373521
+ 42
+0.000000
+ 10
+770013.772198
+ 20
+4287068.778949
+ 42
+0.000000
+ 10
+769972.167348
+ 20
+4287088.483588
+ 42
+0.000000
+ 10
+769909.645242
+ 20
+4287108.590844
+ 42
+0.000000
+ 10
+769894.592033
+ 20
+4287115.859926
+ 42
+0.000000
+ 10
+769876.853647
+ 20
+4287125.260676
+ 42
+0.000000
+ 10
+769860.817676
+ 20
+4287135.830460
+ 42
+0.000000
+ 10
+769841.908512
+ 20
+4287154.082133
+ 42
+0.000000
+ 10
+769830.072149
+ 20
+4287169.239521
+ 42
+0.000000
+ 10
+769822.016626
+ 20
+4287175.634494
+ 42
+0.000000
+ 10
+769802.919618
+ 20
+4287199.436454
+ 42
+0.000000
+ 10
+769786.432661
+ 20
+4287223.326866
+ 42
+0.000000
+ 10
+769783.597105
+ 20
+4287229.898700
+ 42
+0.000000
+ 10
+769664.136597
+ 20
+4287362.544436
+ 42
+0.000000
+ 10
+769635.358139
+ 20
+4287389.352842
+ 42
+0.000000
+ 10
+769562.524091
+ 20
+4287456.899844
+ 42
+0.000000
+ 10
+769351.633352
+ 20
+4287666.469561
+ 42
+0.000000
+ 10
+769158.707565
+ 20
+4287834.421504
+ 42
+0.000000
+ 10
+768946.607088
+ 20
+4287848.369507
+ 42
+0.000000
+ 10
+768723.390684
+ 20
+4287753.040207
+ 42
+0.000000
+ 10
+768360.766823
+ 20
+4287788.596658
+ 42
+0.000000
+ 10
+768253.269975
+ 20
+4287670.510851
+ 42
+0.000000
+ 10
+768071.559210
+ 20
+4287454.356794
+ 42
+0.000000
+ 10
+767982.307875
+ 20
+4287751.402204
+ 42
+0.000000
+ 10
+768005.293641
+ 20
+4287818.853484
+ 42
+0.000000
+ 10
+768008.858554
+ 20
+4287842.310660
+ 42
+0.000000
+ 10
+768008.778106
+ 20
+4287922.321175
+ 42
+0.000000
+ 10
+768004.871232
+ 20
+4287986.644773
+ 42
+0.000000
+ 10
+767993.706416
+ 20
+4288059.614435
+ 42
+0.000000
+ 10
+767983.475783
+ 20
+4288104.833175
+ 42
+0.000000
+ 10
+767976.500541
+ 20
+4288156.829262
+ 42
+0.000000
+ 10
+767976.623167
+ 20
+4288179.059289
+ 42
+0.000000
+ 10
+767983.779418
+ 20
+4288199.303472
+ 42
+0.000000
+ 10
+767996.154794
+ 20
+4288219.723348
+ 42
+0.000000
+ 10
+768005.808424
+ 20
+4288243.385513
+ 42
+0.000000
+ 10
+768015.050934
+ 20
+4288279.258107
+ 42
+0.000000
+ 10
+767997.738994
+ 20
+4288302.012536
+ 42
+0.000000
+ 10
+768057.779244
+ 20
+4288355.153494
+ 42
+0.000000
+ 10
+768027.382808
+ 20
+4288663.070460
+ 42
+0.000000
+ 10
+768070.700437
+ 20
+4289290.189759
+ 42
+0.000000
+ 10
+768274.778888
+ 20
+4289590.449748
+ 42
+0.000000
+ 10
+768265.191213
+ 20
+4290288.024318
+ 42
+0.000000
+ 10
+768484.128425
+ 20
+4290585.460198
+ 42
+0.000000
+ 10
+768534.852594
+ 20
+4290784.984862
+ 42
+0.000000
+ 10
+768490.866302
+ 20
+4290979.090161
+ 42
+0.000000
+ 10
+768432.767870
+ 20
+4291256.067338
+ 42
+0.000000
+ 10
+768429.027506
+ 20
+4291263.720254
+ 42
+0.000000
+ 10
+768262.111468
+ 20
+4291592.591707
+ 42
+0.000000
+ 10
+768076.401200
+ 20
+4291756.359080
+ 42
+0.000000
+ 10
+767904.272112
+ 20
+4292240.642804
+ 42
+0.000000
+ 10
+767667.495492
+ 20
+4293042.806791
+ 42
+0.000000
+ 10
+768264.541402
+ 20
+4293326.313442
+ 42
+0.000000
+ 10
+768416.587574
+ 20
+4293308.108988
+ 42
+0.000000
+ 10
+768953.884241
+ 20
+4293452.961565
+ 42
+0.000000
+ 10
+769505.295013
+ 20
+4293566.102206
+ 42
+0.000000
+ 10
+769966.462617
+ 20
+4293491.735570
+ 42
+0.000000
+ 10
+770084.572002
+ 20
+4293473.521533
+ 42
+0.000000
+ 10
+770112.578181
+ 20
+4293468.916594
+ 42
+0.000000
+ 10
+770880.770394
+ 20
+4293630.643849
+ 42
+0.000000
+ 10
+770869.633910
+ 20
+4293191.284620
+ 42
+0.000000
+ 10
+770965.199442
+ 20
+4292787.790831
+ 42
+0.000000
+ 10
+770930.391836
+ 20
+4292583.229282
+ 42
+0.000000
+ 10
+770675.997147
+ 20
+4292513.440758
+ 42
+0.000000
+ 10
+770678.453997
+ 20
+4292492.409003
+ 42
+0.000000
+ 10
+770675.316475
+ 20
+4292482.300158
+ 42
+0.000000
+ 10
+770671.725223
+ 20
+4292459.951167
+ 42
+0.000000
+ 10
+770667.718261
+ 20
+4292449.812729
+ 42
+0.000000
+ 10
+770653.429455
+ 20
+4292434.878939
+ 42
+0.000000
+ 10
+770650.972355
+ 20
+4292430.349953
+ 42
+0.000000
+ 10
+770646.662718
+ 20
+4292403.531184
+ 42
+0.000000
+ 10
+770639.480285
+ 20
+4292384.393988
+ 42
+0.000000
+ 10
+770634.981648
+ 20
+4292363.125480
+ 42
+0.000000
+ 10
+770632.523236
+ 20
+4292281.914291
+ 42
+0.000000
+ 10
+771040.943711
+ 20
+4291842.399241
+ 42
+0.000000
+ 10
+771112.506205
+ 20
+4291837.059248
+ 42
+0.000000
+ 10
+771127.664913
+ 20
+4291852.023483
+ 42
+0.000000
+ 10
+771143.957983
+ 20
+4291859.247042
+ 42
+0.000000
+ 10
+771160.894489
+ 20
+4291847.599777
+ 42
+0.000000
+ 10
+771167.397235
+ 20
+4291835.596758
+ 42
+0.000000
+ 10
+771150.499589
+ 20
+4291820.573153
+ 42
+0.000000
+ 10
+771132.316082
+ 20
+4291817.730497
+ 42
+0.000000
+ 10
+771115.230031
+ 20
+4291782.696424
+ 42
+0.000000
+ 10
+772052.446817
+ 20
+4291435.732230
+ 42
+0.000000
+ 10
+772052.446817
+ 20
+4291435.732230
+ 42
+0.000000
+  0
+ENDSEC
+  0
+SECTION
+  2
+OBJECTS
+  0
+DICTIONARY
+  5
+C
+100
+AcDbDictionary
+280
+     0
+281
+     1
+  3
+ACAD_GROUP
+350
+D
+  3
+ACAD_LAYOUT
+350
+1A
+  3
+ACAD_MLINESTYLE
+350
+17
+  3
+ACAD_PLOTSETTINGS
+350
+19
+  3
+ACAD_PLOTSTYLENAME
+350
+E
+  3
+AcDbVariableDictionary
+350
+2C
+  0
+DICTIONARY
+  5
+D
+100
+AcDbDictionary
+280
+     0
+281
+     1
+  0
+ACDBDICTIONARYWDFLT
+  5
+E
+100
+AcDbDictionary
+281
+     1
+  3
+Normal
+350
+F
+100
+AcDbDictionaryWithDefault
+340
+F
+  0
+ACDBPLACEHOLDER
+  5
+F
+  0
+DICTIONARY
+  5
+17
+100
+AcDbDictionary
+280
+     0
+281
+     1
+  3
+Standard
+350
+18
+  0
+MLINESTYLE
+  5
+18
+100
+AcDbMlineStyle
+  2
+STANDARD
+ 70
+     0
+  3
+
+ 62
+   256
+ 51
+90.0000
+ 52
+90.0000
+ 71
+     2
+ 49
+0.5000
+ 62
+   256
+  6
+BYLAYER
+ 49
+-0.5000
+ 62
+   256
+  6
+BYLAYER
+  0
+DICTIONARY
+  5
+19
+100
+AcDbDictionary
+280
+     0
+281
+     1
+  0
+DICTIONARY
+  5
+1A
+100
+AcDbDictionary
+281
+     1
+  3
+Layout1
+350
+1E
+  3
+Layout2
+350
+26
+  3
+Model
+350
+22
+  0
+LAYOUT
+  5
+1E
+100
+AcDbPlotSettings
+  1
+
+  2
+C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3
+  4
+
+  6
+
+ 40
+0.0000
+ 41
+0.0000
+ 42
+0.0000
+ 43
+0.0000
+ 44
+0.0000
+ 45
+0.0000
+ 46
+0.0000
+ 47
+0.0000
+ 48
+0.0000
+ 49
+0.0000
+140
+0.0000
+141
+0.0000
+142
+1.0000
+143
+1.0000
+ 70
+   688
+ 72
+     0
+ 73
+     0
+ 74
+     5
+  7
+
+ 75
+    16
+147
+1.0000
+148
+0.0000
+149
+0.0000
+100
+AcDbLayout
+  1
+Layout1
+ 70
+     1
+ 71
+     1
+ 10
+0.0000
+ 20
+0.0000
+ 11
+420.0000
+ 21
+297.0000
+ 12
+0.0000
+ 22
+0.0000
+ 32
+0.0000
+ 14
+100000000000000000000.0000
+ 24
+100000000000000000000.0000
+ 34
+100000000000000000000.0000
+ 15
+-100000000000000000000.0000
+ 25
+-100000000000000000000.0000
+ 35
+-100000000000000000000.0000
+146
+0.0000
+ 13
+0.0000
+ 23
+0.0000
+ 33
+0.0000
+ 16
+1.0000
+ 26
+0.0000
+ 36
+0.0000
+ 17
+0.0000
+ 27
+1.0000
+ 37
+0.0000
+ 76
+     0
+330
+1B
+  0
+LAYOUT
+  5
+22
+100
+AcDbPlotSettings
+  1
+
+  2
+C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3
+  4
+
+  6
+
+ 40
+0.0000
+ 41
+0.0000
+ 42
+0.0000
+ 43
+0.0000
+ 44
+0.0000
+ 45
+0.0000
+ 46
+0.0000
+ 47
+0.0000
+ 48
+0.0000
+ 49
+0.0000
+140
+0.0000
+141
+0.0000
+142
+1.0000
+143
+1.0000
+ 70
+  1712
+ 72
+     0
+ 73
+     0
+ 74
+     0
+  7
+
+ 75
+     0
+147
+1.0000
+148
+0.0000
+149
+0.0000
+100
+AcDbLayout
+  1
+Model
+ 70
+     1
+ 71
+     0
+ 10
+0.0000
+ 20
+0.0000
+ 11
+12.0000
+ 21
+9.0000
+ 12
+0.0000
+ 22
+0.0000
+ 32
+0.0000
+ 14
+0.0000
+ 24
+0.0000
+ 34
+0.0000
+ 15
+0.0000
+ 25
+0.0000
+ 35
+0.0000
+146
+0.0000
+ 13
+0.0000
+ 23
+0.0000
+ 33
+0.0000
+ 16
+1.0000
+ 26
+0.0000
+ 36
+0.0000
+ 17
+0.0000
+ 27
+1.0000
+ 37
+0.0000
+ 76
+     0
+330
+1F
+  0
+LAYOUT
+  5
+26
+100
+AcDbPlotSettings
+  1
+
+  2
+C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3
+  4
+
+  6
+
+ 40
+0.0000
+ 41
+0.0000
+ 42
+0.0000
+ 43
+0.0000
+ 44
+0.0000
+ 45
+0.0000
+ 46
+0.0000
+ 47
+0.0000
+ 48
+0.0000
+ 49
+0.0000
+140
+0.0000
+141
+0.0000
+142
+1.0000
+143
+1.0000
+ 70
+   688
+ 72
+     0
+ 73
+     0
+ 74
+     5
+  7
+
+ 75
+    16
+147
+1.0000
+148
+0.0000
+149
+0.0000
+100
+AcDbLayout
+  1
+Layout2
+ 70
+     1
+ 71
+     2
+ 10
+0.0000
+ 20
+0.0000
+ 11
+12.0000
+ 21
+9.0000
+ 12
+0.0000
+ 22
+0.0000
+ 32
+0.0000
+ 14
+0.0000
+ 24
+0.0000
+ 34
+0.0000
+ 15
+0.0000
+ 25
+0.0000
+ 35
+0.0000
+146
+0.0000
+ 13
+0.0000
+ 23
+0.0000
+ 33
+0.0000
+ 16
+1.0000
+ 26
+0.0000
+ 36
+0.0000
+ 17
+0.0000
+ 27
+1.0000
+ 37
+0.0000
+ 76
+     0
+330
+23
+  0
+DICTIONARY
+  5
+    46
+100
+AcDbDictionary
+281
+     1
+  3
+DIMASSOC
+350
+    48
+  3
+HIDETEXT
+350
+    47
+  0
+DICTIONARYVAR
+  5
+    47
+100
+DictionaryVariables
+280
+     0
+  1
+     2
+  0
+DICTIONARYVAR
+  5
+    48
+100
+DictionaryVariables
+280
+     0
+  1
+     1
+  0
+ENDSEC
+  0
+EOF
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/TestDXF.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/TestDXF.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/TestDXF.java	(revision 38736)
@@ -0,0 +1,84 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.io.File;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.BaseTestFeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+
+public class TestDXF extends BaseTestFeatureStore {
+
+	public static final File file_prueba = new File(TestDXF.class.getResource(
+			"data/prueba.dxf").getFile());
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
+	 * ()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException {
+		DXFStoreParameters dxfParameters = null;
+
+		dxfParameters = (DXFStoreParameters) dataManager
+				.createStoreParameters(DXFStoreProvider.NAME);
+
+		dxfParameters.setFile(file_prueba.getAbsolutePath());
+		dxfParameters.setCRS("EPSG:23030");
+		return dxfParameters;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
+	 */
+	public boolean hasExplorer() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean usesResources() {
+		return true;
+	}
+
+
+	public void testLegendAndLabeling() throws Exception {
+		FeatureStore store = (FeatureStore) dataManager
+				.createStore(getDefaultDataStoreParameters());
+
+		assertNotNull(store.invokeDynMethod("getLegend", null));
+		assertNotNull(store.invokeDynMethod("getLabeling", null));
+		store.dispose();
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dxf/TestDXF.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/TestDGN.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/TestDGN.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/TestDGN.java	(revision 38736)
@@ -0,0 +1,84 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.io.File;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.BaseTestFeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+
+public class TestDGN extends BaseTestFeatureStore {
+
+	public static final File file_prueba = new File(TestDGN.class.getResource(
+			"data/prueba.dgn").getFile());
+	
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
+	 * ()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException {
+		DGNStoreParameters dgnParameters = null;
+
+		dgnParameters = (DGNStoreParameters) dataManager
+				.createStoreParameters(DGNStoreProvider.NAME);
+
+		dgnParameters.setFile(file_prueba.getAbsolutePath());
+		dgnParameters.setCRS("EPSG:23030");
+		return dgnParameters;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
+	 */
+	public boolean hasExplorer() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean usesResources() {
+		return true;
+	}
+
+
+	public void testLegendAndLabeling() throws Exception {
+		FeatureStore store = (FeatureStore) dataManager
+				.createStore(getDefaultDataStoreParameters());
+
+		assertNotNull(store.invokeDynMethod("getLegend", null));
+		assertNotNull(store.invokeDynMethod("getLabeling", null));
+		store.dispose();
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/TestDGN.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/data/prueba.dgn
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dgn/data/prueba.dgn
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15642Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15642Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15642Test.java	(revision 38736)
@@ -0,0 +1,113 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import junit.framework.TestCase;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.operation.GeometryOperation;
+import org.gvsig.fmap.geom.operation.GeometryOperationContext;
+import org.gvsig.fmap.geom.operation.fromjts.FromJTS;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+
+/**
+ * Code to test bug gvsig-desktop#15642. This is based on the code provided by
+ * the bug reporter (see ticket), thanks to him!!
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15642Test extends TestCase {
+
+    public void testBug15642() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("geom");
+        type.add("float", DataTypes.FLOAT).setSize(5);
+        type.add("long", DataTypes.LONG).setSize(5);
+
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
+        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
+        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+        store.edit();
+        EditableFeature feature = store.createNewFeature().getEditable();
+        com.vividsolutions.jts.geom.Geometry g =
+            new GeometryFactory().createPoint(new Coordinate(0, 0));
+
+        int opCode = geometryManager.getGeometryOperationCode(FromJTS.NAME);
+        GeometryOperation converter =
+            geometryManager.getGeometryOperation(opCode, Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        GeometryOperationContext ctx = new GeometryOperationContext();
+        ctx.setAttribute(FromJTS.PARAM, g);
+        Geometry fmapGeom = (Geometry) converter.invoke(null, ctx);
+        feature.setGeometry(feature.getType()
+            .getDefaultGeometryAttributeIndex(), fmapGeom);
+        feature.setFloat("float", 34.0f);
+        feature.setLong("long", 34l);
+        store.insert(feature);
+        store.finishEditing();
+
+        FeatureAttributeDescriptor defaultGeometryAttribute =
+            store.getDefaultFeatureType().getDefaultGeometryAttribute();
+
+        geometryType = defaultGeometryAttribute.getGeomType();
+        assertEquals(Geometry.TYPES.POINT, geometryType.getType());
+        assertEquals(Geometry.SUBTYPES.GEOM2D, geometryType.getSubType());
+
+        store.dispose();
+    }
+
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15643Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15643Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15643Test.java	(revision 38736)
@@ -0,0 +1,125 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import junit.framework.TestCase;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.operation.GeometryOperation;
+import org.gvsig.fmap.geom.operation.GeometryOperationContext;
+import org.gvsig.fmap.geom.operation.fromjts.FromJTS;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Code to test bug gvsig-desktop#15643. This is based on the code provided by
+ * the bug reporter (see ticket), thanks to him!!
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15643Test extends TestCase {
+
+    public void testBug15643() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("geom");
+        type.add("float", DataTypes.FLOAT).setSize(5);
+        type.add("double", DataTypes.DOUBLE).setSize(5);
+        type.add("int", DataTypes.INT).setSize(5);
+        type.add("long", DataTypes.LONG).setSize(5);
+
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
+        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
+        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+        store.edit();
+        EditableFeature feature = store.createNewFeature().getEditable();
+        com.vividsolutions.jts.geom.Geometry g =
+            new GeometryFactory().createPoint(new Coordinate(0, 0));
+
+        int opCode = geometryManager.getGeometryOperationCode(FromJTS.NAME);
+        GeometryOperation converter =
+            geometryManager.getGeometryOperation(opCode, Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        GeometryOperationContext ctx = new GeometryOperationContext();
+        ctx.setAttribute(FromJTS.PARAM, g);
+        Geometry fmapGeom = (Geometry) converter.invoke(null, ctx);
+        feature.setGeometry(feature.getType()
+            .getDefaultGeometryAttributeIndex(), fmapGeom);
+        feature.setFloat("float", 34.0f);
+        feature.setDouble("double", 34.0d);
+        feature.setInt("int", 34);
+        feature.setLong("long", 34l);
+        store.insert(feature);
+        store.finishEditing();
+
+        store.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                Feature feature = (Feature) obj;
+                assertEquals(34.0f, feature.getFloat("float"));
+                assertEquals(34.0d, feature.getDouble("double"));
+                assertEquals(34, feature.getInt("int"));
+                assertEquals(34l, feature.getLong("long"));
+            }
+        });
+
+        store.dispose();
+    }
+
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15670Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15670Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15670Test.java	(revision 38736)
@@ -0,0 +1,97 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import junit.framework.TestCase;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Code to test bug gvsig-desktop#15670. This is based on the code provided by
+ * the bug reporter (see ticket), thanks to him!!
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15670Test extends TestCase {
+
+    public void testBug15670() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("GEOMETRY", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("GEOMETRY");
+
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
+        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
+        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+        store.edit();
+        EditableFeature feature = store.createNewFeature().getEditable();
+        final Point geom =
+            geometryManager.createPoint(10.0, 10.0, Geometry.SUBTYPES.GEOM2D);
+        feature.setGeometry("GEOMETRY", geom);
+        store.insert(feature);
+        store.finishEditing();
+
+        store.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                Feature feature = (Feature) obj;
+                assertEquals(geom, feature.getGeometry("GEOMETRY"));
+            }
+        });
+        store.dispose();
+    }
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15617Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15617Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15617Test.java	(revision 38736)
@@ -0,0 +1,128 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import junit.framework.TestCase;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.operation.GeometryOperation;
+import org.gvsig.fmap.geom.operation.GeometryOperationContext;
+import org.gvsig.fmap.geom.operation.fromjts.FromJTS;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Code to test bug gvsig-desktop#15617.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15617Test extends TestCase {
+
+    public void testBug15617() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("geom");
+//        type.add("float", DataTypes.FLOAT).setSize(5);
+//        type.add("double", DataTypes.DOUBLE).setSize(5);
+        type.add("int", DataTypes.INT).setSize(5);
+//        type.add("long", DataTypes.LONG).setSize(5);
+        type.add("bool", DataTypes.BOOLEAN);
+
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
+        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
+        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+        store.edit();
+        EditableFeature feature = store.createNewFeature().getEditable();
+        com.vividsolutions.jts.geom.Geometry g =
+            new GeometryFactory().createPoint(new Coordinate(0, 0));
+
+        int opCode = geometryManager.getGeometryOperationCode(FromJTS.NAME);
+        GeometryOperation converter =
+            geometryManager.getGeometryOperation(opCode, Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        GeometryOperationContext ctx = new GeometryOperationContext();
+        ctx.setAttribute(FromJTS.PARAM, g);
+        Geometry fmapGeom = (Geometry) converter.invoke(null, ctx);
+        feature.setGeometry(feature.getType()
+            .getDefaultGeometryAttributeIndex(), fmapGeom);
+//        feature.setFloat("float", 34.0f);
+//        feature.setDouble("double", 34.0d);
+        feature.setInt("int", 25);
+//        feature.setLong("long", 34l);
+        feature.setBoolean("bool", true);
+        assertEquals(true, feature.getBoolean("bool"));
+        store.insert(feature);
+        store.finishEditing();
+
+        store.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                Feature feature = (Feature) obj;
+//                assertEquals(34.0f, feature.getFloat("float"));
+//                assertEquals(34.0d, feature.getDouble("double"));
+                assertEquals(25, feature.getInt("int"));
+//                assertEquals(34l, feature.getLong("long"));
+                assertEquals(true, feature.getBoolean("bool"));
+            }
+        });
+
+        store.dispose();
+    }
+
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15671Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15671Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15671Test.java	(revision 38736)
@@ -0,0 +1,105 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import junit.framework.TestCase;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.primitive.NullGeometry;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Code to test bug gvsig-desktop#15671. This is based on the code provided by
+ * the bug reporter (see ticket), thanks to him!!
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15671Test extends TestCase {
+
+    public void testBug15671() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("GEOMETRY", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("GEOMETRY");
+        type.add("double", DataTypes.DOUBLE);
+
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", "/tmp/mySHP.shp");
+        destParams.setDynValue("dbffile", "/tmp/mySHP.dbf");
+        destParams.setDynValue("shxfile", "/tmp/mySHP.shx");
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+        store.edit();
+        EditableFeature feature = store.createNewFeature().getEditable();
+        NullGeometry geom =
+            geometryManager.createNullGeometry(Geometry.SUBTYPES.GEOM2D);
+        feature.setGeometry("GEOMETRY", geom);
+        feature.setDouble("double", 42.0d);
+        store.insert(feature);
+        store.finishEditing();
+
+        store.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                Feature feature = (Feature) obj;
+                Geometry geometry = feature.getGeometry("GEOMETRY");
+                assertEquals(
+                    "Read geometry must be of Null Geometry type instead of "
+                        + geometry.getGeometryType().getName(),
+                    Geometry.TYPES.NULL, geometry.getType());
+            }
+        });
+        store.dispose();
+    }
+
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15597Test.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15597Test.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15597Test.java	(revision 38736)
@@ -0,0 +1,165 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+
+/**
+ * Code to test bug gvsig-desktop#15597. This is based on the code provided by
+ * the bug reporter (see ticket), thanks to him!!
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug15597Test extends TestCase {
+    private static final String TEMP_PATH = System.getProperty("java.io.tmpdir") + File.separator;
+    
+    public void testBug15642() throws Exception {
+        new DefaultLibrariesInitializer().fullInitialize();
+        DataManager manager = DALLocator.getDataManager();
+        GeometryManager geometryManager = GeometryLocator.getGeometryManager();
+
+        //Create a feature type with two fields: "geom" and "field1"
+        EditableFeatureType type = new DefaultEditableFeatureType();
+        GeometryType geometryType =
+            geometryManager.getGeometryType(Geometry.TYPES.POINT,
+                Geometry.SUBTYPES.GEOM2D);
+        type.add("geom", org.gvsig.fmap.geom.DataTypes.GEOMETRY)
+            .setGeometryType(geometryType);
+        type.setDefaultGeometryAttributeName("geom");
+        type.add("field1", DataTypes.STRING).setSize(2);
+       
+        //Create a store
+        NewFeatureStoreParameters destParams =
+            (NewFeatureStoreParameters) manager.createNewStoreParameters(
+                "FilesystemExplorer", "Shape");
+        destParams.setDynValue("shpfile", TEMP_PATH + "mySHP.shp");      
+        destParams.setDynValue("crs", "EPSG:23030");
+        destParams.setDefaultFeatureType(type);
+
+        manager.newStore("FilesystemExplorer", "Shape", destParams, true);
+        FeatureStore store =
+            (FeatureStore) manager.openStore("Shape", destParams);
+
+                
+        //Edit the store and add a new Feature.
+        store.edit();
+             
+        EditableFeature feature1 = store.createNewFeature().getEditable();
+        feature1.setGeometry(type.getDefaultGeometryAttributeIndex(), 
+            geometryManager.createPoint(0, 0, SUBTYPES.GEOM2D));
+        feature1.set("field1", "Hi");                     
+      
+        store.insert(feature1);
+        
+        //Finish the edition
+        store.finishEditing();
+
+        //Edit the feature type and add a new field: "field2"
+        store.edit();
+       
+        EditableFeatureType type2 = 
+            store.getDefaultFeatureType().getEditable();        
+        type2.add("field2", DataTypes.STRING).setSize(10);
+        store.update(type2);    
+        
+        assertEquals(store.getDefaultFeatureType().getAttributeDescriptors().length, 3);
+        
+        //Add a second feature
+        EditableFeature feature2 = store.createNewFeature().getEditable();
+        feature2.setGeometry(type2.getDefaultGeometryAttributeIndex(),
+            geometryManager.createPoint(1, 1, SUBTYPES.GEOM2D));
+        feature2.set("field1", "Hi");    
+        feature2.set("field2", "Max");   
+       
+        store.insert(feature2);
+        
+        //The edition is not finished. Check if all the features have the two fields
+        FeatureSet featureSet = store.getFeatureSet();
+        DisposableIterator it = featureSet.fastIterator();
+        
+        it.hasNext();
+        Feature feature = (Feature)it.next();   
+        assertNotNull(feature.getDefaultGeometry());
+        assertEquals("Hi", feature.get("field1"));
+        assertNull(feature.get("field2"));
+        
+        it.hasNext();
+        feature = (Feature)it.next();   
+        assertNotNull(feature.getDefaultGeometry());
+        assertEquals("Hi", feature.get("field1"));
+        assertEquals("Max", feature.get("field2"));        
+        
+        it.dispose();
+        store.finishEditing();
+        
+        //Edit the feature type and remove the field: "field1"
+        store.edit();
+        
+        EditableFeatureType type3 = 
+            store.getDefaultFeatureType().getEditable();        
+        type3.remove("field1");
+        store.update(type3);    
+        
+        assertEquals(store.getDefaultFeatureType().getAttributeDescriptors().length, 2);
+                
+        //Finish the edition
+        store.finishEditing();
+        
+        //Check if all the features have one field
+        featureSet = store.getFeatureSet();
+        it = featureSet.fastIterator();        
+        
+        it.hasNext();
+        feature = (Feature)it.next();   
+        assertNotNull(feature.getDefaultGeometry());       
+        assertEquals("", feature.get("field2"));
+        
+        it.hasNext();
+        feature = (Feature)it.next();   
+        assertNotNull(feature.getDefaultGeometry());
+        assertEquals("Max", feature.get("field2"));     
+        
+        it.dispose();
+        store.dispose();
+    }
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/Bug15597Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.shx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.shx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.shp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.shp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.dbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.dbf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.shx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.shx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.shp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.shp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.dbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/pruebaNull.dbf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.shx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/poly-valencia.shx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.shp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.shp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.dbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/data/prueba.dbf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/TestSHP.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/TestSHP.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/TestSHP.java	(revision 38736)
@@ -0,0 +1,297 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider;
+
+public class TestSHP extends BaseTestEditableFeatureStore {
+
+	private FilesystemServerExplorer myExplorer;
+
+	public static final File file_prueba = new File(TestSHP.class.getResource(
+			"data/prueba.shp").getFile());
+	public static final File file_prueba_destino = new File(file_prueba
+			.getParent()
+			+ File.separatorChar + "pruebaTemp.shp");
+	public static final File file_pruebaNull = new File(TestSHP.class
+			.getResource("data/pruebaNull.shp").getFile());
+
+	public static final File file_poly_valencia = new File(TestSHP.class
+			.getResource("data/poly-valencia.shp").getFile());
+
+	public void testSimpleIteration() throws Exception {
+
+		FeatureStore store = null;
+		SHPStoreParameters shpParameters = null;
+
+		shpParameters = (SHPStoreParameters) dataManager
+				.createStoreParameters(SHPStoreProvider.NAME);
+
+		// shpParameters.setFile(file_poly_valencia);
+		shpParameters.setFile(file_prueba);
+
+		shpParameters.setCRS("EPSG:23030");
+
+		store = (FeatureStore) dataManager.createStore(shpParameters);
+		FeatureSet set;
+		FeatureType type = store.getDefaultFeatureType();
+		set = store.getFeatureSet();
+
+		System.out.println("Num:" + set.getSize());
+		DisposableIterator it = set.iterator();
+		Iterator ftIt;
+		FeatureAttributeDescriptor desc;
+
+		int i = 0;
+		Feature feature;
+		while (it.hasNext()) {
+			ftIt = type.iterator();
+
+			feature = (Feature) it.next();
+			// while (ftIt.hasNext()) {
+			// desc = (FeatureAttributeDescriptor) ftIt.next();
+			// System.out.println(desc.getName() + ":"
+			// + feature.get(desc.getIndex()));
+			//
+			// }
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.print(feature.getDefaultEnvelope() + "\t");
+			// System.out.print(feature.getDefaultGeometry() + "\t");
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.println("row:" + i);
+			i++;
+
+
+		}
+
+		it.dispose();
+		set.dispose();
+
+		store.dispose();
+
+	}
+
+	public void testEditing(Object x) throws Exception {
+		FeatureStore store = null;
+		SHPStoreParameters shpParameters = null;
+
+		shpParameters = (SHPStoreParameters) dataManager
+				.createStoreParameters(SHPStoreProvider.NAME);
+
+		shpParameters.setFile(file_poly_valencia);
+
+		store = (FeatureStore) dataManager.createStore(shpParameters);
+		FeatureSet set;
+		FeatureType type = store.getDefaultFeatureType();
+		System.err.println("Antes de la edici�n");
+		set = store.getFeatureSet();
+		System.out.println("Num:" + set.getSize());
+		DisposableIterator it = set.iterator();
+		Iterator ftIt;
+		FeatureAttributeDescriptor desc;
+
+		int i = 0;
+		Feature feature;
+		while (it.hasNext()) {
+			ftIt = type.iterator();
+
+			feature = (Feature) it.next();
+			// while (ftIt.hasNext()) {
+			// desc = (FeatureAttributeDescriptor) ftIt.next();
+			// System.out.println(desc.getName() + ":"
+			// + feature.get(desc.getIndex()));
+			//
+			// }
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.print(feature.getDefaultEnvelope() + "\t");
+			// System.out.print(feature.getDefaultGeometry() + "\t");
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.println("row:" + i);
+			i++;
+
+
+		}
+
+		it.dispose();
+		set.dispose();
+		store.edit();
+		EditableFeature ef = store.createNewFeature();
+		store.insert(ef);
+		store.finishEditing();
+		System.err.println("Despu�s de la edici�n");
+		set = store.getFeatureSet();
+		System.out.println("Num:" + set.getSize());
+		it = set.iterator();
+
+		i = 0;
+		while (it.hasNext()) {
+			ftIt = type.iterator();
+
+			feature = (Feature) it.next();
+			// while (ftIt.hasNext()) {
+			// desc = (FeatureAttributeDescriptor) ftIt.next();
+			// System.out.println(desc.getName() + ":"
+			// + feature.get(desc.getIndex()));
+			//
+			// }
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.print(feature.getDefaultEnvelope() + "\t");
+			// System.out.print(feature.getDefaultGeometry() + "\t");
+			// System.out.println(feature.get("NOMBRE"));
+			System.out.println("row:" + i);
+			i++;
+
+
+		}
+
+		it.dispose();
+		set.dispose();
+
+		store.dispose();
+
+	}
+
+	public void testExport(Object x) throws Exception {
+		DBFStoreParameters dbfParameters = null;
+
+		dbfParameters = (DBFStoreParameters) dataManager
+				.createStoreParameters(DBFStoreProvider.NAME);
+
+		dbfParameters.setFile(file_prueba);
+
+		FeatureStore store = (FeatureStore) dataManager
+				.createStore(dbfParameters);
+		FilesystemServerExplorerParameters explorerParams = (FilesystemServerExplorerParameters) dataManager
+				.createServerExplorerParameters(FilesystemServerExplorerParameters.DYNCLASS_NAME);
+		explorerParams.setRoot(file_prueba.getParent());
+
+		FilesystemServerExplorer explorer = (FilesystemServerExplorer) dataManager
+				.createServerExplorer(explorerParams);
+
+		NewFeatureStoreParameters newParams = (NewFeatureStoreParameters) explorer
+				.getAddParameters(file_prueba_destino);
+
+		store.export(explorer, DBFStoreProvider.NAME, newParams);
+
+		FeatureStore result = (FeatureStore) dataManager.createStore(newParams);
+
+		FeatureSet set = result.getFeatureSet();
+		FeatureSet originalSet = store.getFeatureSet();
+		assertEquals(set.getSize(), originalSet.getSize());
+
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+		while (iter.hasNext()) {
+			assertEquals(originalIter.next(), iter.next());
+		}
+
+		originalIter.dispose();
+		iter.dispose();
+		result.dispose();
+		explorer.remove(newParams);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
+	 * ()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException {
+		SHPStoreParameters shpParameters = (SHPStoreParameters) dataManager
+				.createStoreParameters(SHPStoreProvider.NAME);
+
+		//			shpParameters.setFile(file_poly_valencia);
+		shpParameters.setFile(file_prueba);
+		shpParameters.setCRS("EPSG:23030");
+		return shpParameters;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
+	 */
+	public boolean hasExplorer() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @seeorg.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#
+	 * getDefaultNewDataStoreParameters()
+	 */
+	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
+			throws Exception {
+		SHPStoreParameters parameters = (SHPStoreParameters) this
+				.getDefaultDataStoreParameters();
+
+		if (this.myExplorer == null) {
+			FeatureStore store = (FeatureStore) dataManager
+					.createStore(parameters);
+			myExplorer = (FilesystemServerExplorer) store.getExplorer();
+			store.dispose();
+		}
+
+		SHPNewStoreParameters result = (SHPNewStoreParameters) myExplorer
+				.getAddParameters(file_prueba_destino);
+
+		result.setCRS(parameters.getCRS());
+		return result;
+	}
+
+	public boolean usesResources() {
+		return true;
+	}
+
+	public boolean resourcesNotifyChanges() {
+		return true;
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/shp/TestSHP.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/JoinTransform.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/JoinTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/JoinTransform.java	(revision 38736)
@@ -0,0 +1,353 @@
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+import org.gvsig.tools.evaluator.EvaluatorFieldsInfo;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class JoinTransform extends AbstractFeatureStoreTransform {
+
+	/**
+	 * Store from which the join transform will get the additional attributes
+	 */
+	private FeatureStore store2;
+
+	/**
+	 * name of the key attr in store1 that will be used to match features in
+	 * store2
+	 */
+	private String keyAttr1;
+
+	/**
+	 * name of the key attr in store2 that will be used to match features in
+	 * store1
+	 */
+	private String keyAttr2;
+
+	/**
+	 * names of the attributes to join from store2 to store1
+	 */
+	private String[] attrs;
+
+	/**
+	 * Attribute names may change after transformation if they are repeated in
+	 * both stores. This map keeps correspondence between store2 original names
+	 * and their transformed counterparts.
+	 */
+	private Map targetNamesMap;
+
+	private JoinTransformEvaluator evaluator = null;
+
+	private FeatureType originalFeatureType;
+
+	private String[] attrsForQuery;
+
+	private String prefix1;
+
+	private String prefix2;
+
+	/**
+	 * A default constructor
+	 */
+	public JoinTransform() {
+		targetNamesMap = new HashMap();
+	}
+
+	/**
+	 * Initializes all the necessary data for this transform
+	 *
+	 * @param store1
+	 *            store whose default feature type is the target of this
+	 *            transform
+	 *
+	 * @param store2
+	 *            store whose default feature type will provide the new
+	 *            attributes to join
+	 *
+	 * @param keyAttr1
+	 *            key attribute in store1 that matches keyAttr2 in store2
+	 *            (foreign key), used for joining both stores.
+	 *
+	 * @param keyAttr2
+	 *            key attribute in store2 that matches keyAttr1 in store2
+	 *            (foreign key), used for joining both stores.
+	 *
+	 * @param attrs
+	 *            names of the attributes in store2 that will be joined to
+	 *            store1.
+	 */
+	public void initialize(FeatureStore store1, FeatureStore store2,
+			String keyAttr1, String keyAttr2, String prefix1, String prefix2,
+			String[] attrs)
+			throws DataException {
+
+		if (store1 == store2) {
+			throw new IllegalArgumentException("store1 == store2");
+		}
+
+		// Initialize needed data
+		this.setFeatureStore(store1);
+		this.store2 = store2;
+		this.keyAttr1 = keyAttr1;
+		this.keyAttr2 = keyAttr2;
+		this.prefix1 = prefix1; // TODO
+		this.prefix2 = prefix2; // TODO
+		this.attrs = attrs;
+
+		// calculate this transform resulting feature type
+		// by adding all specified attrs from store2 to store1's default
+		// feature type
+		// FIXME for more than one FTypes ??
+		this.originalFeatureType = this.getFeatureStore()
+				.getDefaultFeatureType();
+
+		// TODO tener en cuenta prefix1
+		EditableFeatureType type = this.getFeatureStore().getDefaultFeatureType().getEditable();
+
+		FeatureType type2 = store2.getDefaultFeatureType();
+
+		// TODO tener en cuenta prefix2
+		for (int i = 0; i < attrs.length; i++) {
+			String name = attrs[i];
+
+			// If an attribute already exists with the same name in store1's
+			// default feature type,
+			// calculate an alternate name and add it to our type
+			int j = 0;
+			while (type.getIndex(name) >= 0) {
+				name = attrs[i] + "_" + ++j;
+			}
+			type.add(name,
+					type2.getAttributeDescriptor(attrs[i]).getType());
+
+			// keep correspondence between original name and transformed name
+			this.targetNamesMap.put(attrs[i], name);
+		}
+		if (this.targetNamesMap.containsKey(keyAttr2)) {
+			this.attrsForQuery = this.attrs;
+		} else {
+			ArrayList list = new ArrayList(this.attrs.length + 1);
+			list.addAll(Arrays.asList(this.attrs));
+			list.add(keyAttr2);
+			this.attrsForQuery = (String[]) list.toArray(new String[] {});
+		}
+
+		// assign calculated feature type as this transform's feature type
+		FeatureType[] types = new FeatureType[] { type.getNotEditableCopy() };
+		setFeatureTypes(Arrays.asList(types), types[0]);
+	}
+
+	/**
+	 *
+	 *
+	 * @param source
+	 *
+	 * @param target
+	 *
+	 * @throws DataException
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+
+		// copy the data from store1 into the resulting feature
+		this.copySourceToTarget(source, target);
+
+		// ask store2 for the specified attributes, filtering by the key
+		// attribute value
+		// from the source feature
+		JoinTransformEvaluator eval = this.getEvaluator();
+		eval.updateValue(source.get(this.keyAttr1));
+
+		FeatureQuery query = this.getFeatureStore().createFeatureQuery();
+		query.setAttributeNames(attrsForQuery);
+		query.setFilter(eval);
+
+		FeatureSet set = store2.getFeatureSet(query);
+
+		// In this join implementation, we will take only the first matching
+		// feature found in store2
+
+		FeatureAttributeDescriptor attr;
+		Feature feat;
+		String targetName;
+
+		Iterator itAttr;
+
+		DisposableIterator itFeat = set.iterator();
+		if (itFeat.hasNext()) {
+			feat = (Feature) itFeat.next();
+
+			// copy all attributes from joined feature to target
+			this.copyJoinToTarget(feat, target);
+		}
+		itFeat.dispose();
+		set.dispose();
+	}
+
+	/**
+	 * @param feat
+	 * @param target
+	 */
+	private void copyJoinToTarget(Feature join, EditableFeature target) {
+		Iterator iter = targetNamesMap.entrySet()
+				.iterator();
+		Entry entry;
+		FeatureType trgType = target.getType();
+		FeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			entry = (Entry) iter.next();
+			attr = trgType.getAttributeDescriptor((String) entry.getValue());
+			if (attr != null) {
+				target.set(attr.getIndex(), join.get((String) entry.getKey()));
+			}
+		}
+
+
+	}
+
+	/**
+	 * @param source
+	 * @param target
+	 */
+	private void copySourceToTarget(Feature source, EditableFeature target) {
+		FeatureAttributeDescriptor attr, attrTrg;
+		FeatureType ftSrc = source.getType();
+		FeatureType ftTrg = target.getType();
+
+
+		for (int i = 0; i < source.getType().size(); i++) {
+			attr = ftSrc.getAttributeDescriptor(i);
+			if (ftTrg.getIndex(attr.getName()) > -1) {
+				try {
+					target.set(attr.getName(), source.get(i));
+				} catch (IllegalArgumentException e) {
+					attrTrg = ftTrg.getAttributeDescriptor(attr.getName());
+					target.set(attrTrg.getIndex(), attrTrg.getDefaultValue());
+				}
+
+			}
+		}
+
+	}
+
+	private JoinTransformEvaluator getEvaluator() {
+		if (this.evaluator == null){
+			this.evaluator = new JoinTransformEvaluator(keyAttr2);
+		}
+		return evaluator;
+
+	}
+
+	private class JoinTransformEvaluator implements Evaluator {
+
+		private String attribute;
+		private Object value;
+		private String sql;
+		private EvaluatorFieldsInfo info = null;
+
+		//		private int attributeIndex;
+
+		public JoinTransformEvaluator(String attribute) {
+			this.attribute = attribute;
+			this.value = null;
+			this.info = new EvaluatorFieldsInfo();
+
+			//			this.attributeIndex = attrIndex;
+		}
+
+		public void updateValue(Object value) {
+			this.value = value;
+			this.sql = this.attribute + "= '" + this.value + "'";
+			this.info = new EvaluatorFieldsInfo();
+			this.info.addMatchFieldValue(this.attribute, value);
+		}
+
+		public Object evaluate(EvaluatorData arg0) throws EvaluatorException {
+			Object curValue = arg0.getDataValue(attribute);
+			if (curValue == null) {
+				return new Boolean(value == null);
+			}
+			return new Boolean(curValue.equals(value));
+		}
+
+		public String getSQL() {
+			return this.sql;
+		}
+
+		public String getDescription() {
+			return "Evaluates join transform match";
+		}
+
+		public String getName() {
+			return "JoinTransformEvaluator";
+		}
+
+		public EvaluatorFieldsInfo getFieldsInfo() {
+			return this.info;
+		}
+
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getSourceFeatureTypeFrom(FeatureType arg0) {
+		EditableFeatureType orgType = originalFeatureType.getEditable();
+		Iterator iter = arg0.iterator();
+		FeatureAttributeDescriptor attr;
+		ArrayList toRetain = new ArrayList();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (this.targetNamesMap.containsValue(attr.getName())) {
+				continue;
+			}
+			toRetain.add(attr.getName());
+		}
+
+		if (!toRetain.contains(keyAttr1)) {
+			toRetain.add(keyAttr1);
+		}
+
+		iter = originalFeatureType.iterator();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (!toRetain.contains(attr.getName())) {
+				orgType.remove(attr.getName());
+			}
+
+		}
+
+		return orgType.getNotEditableCopy();
+	}
+
+	public boolean isTransformsOriginalValues() {
+		return false;
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/JoinTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/TestDBF.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/TestDBF.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/TestDBF.java	(revision 38736)
@@ -0,0 +1,161 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+
+public class TestDBF extends BaseTestEditableFeatureStore {
+
+	public static final File dbf_prueba = new File(TestDBF.class.getResource(
+			"data/prueba.dbf").getFile());
+	public static final File dbf_prueba_destino= new File(TestDBF.class.getResource(
+			"data").getFile()+"/pruebaTemp.dbf");
+	public static final File dbf_pruebaNull = new File(TestDBF.class
+			.getResource("data/pruebaNull.dbf").getFile());
+
+	private FilesystemServerExplorer myExplorer = null;
+
+	public DataStoreParameters getDefaultDataStoreParameters() throws DataException {
+		DBFStoreParameters dbfParameters = null;
+		dbfParameters = (DBFStoreParameters) dataManager
+				.createStoreParameters(DBFStoreProvider.NAME);
+
+		dbfParameters.setFile(dbf_prueba);
+
+		return dbfParameters;
+	}
+
+	public void testExplorerList() throws Exception {
+		this.testExplorerList(2);
+	}
+
+	public void testJoin() throws Exception {
+		DBFStoreParameters dbfParameters = null;
+		FeatureStore store1, store2;
+
+		dbfParameters = (DBFStoreParameters) dataManager
+				.createStoreParameters(DBFStoreProvider.NAME);
+
+		dbfParameters.setFile(dbf_prueba);
+
+		store1 = (FeatureStore) dataManager.createStore(dbfParameters);
+		store2 = (FeatureStore) dataManager.createStore(dbfParameters);
+
+		JoinTransform join = new JoinTransform();
+
+		ArrayList names = new ArrayList();// <String>
+		Iterator iter = store2.getDefaultFeatureType().iterator();// <FeatureAttributeDescriptor>
+		while (iter.hasNext()) {
+			names.add(((FeatureAttributeDescriptor) iter.next()).getName());
+		}
+
+		join.initialize(store1, store2, "NOMBRE", "NOMBRE", null, null,
+				(String[]) names.toArray(new String[0]));
+		store1.getTransforms().add(join);
+
+		this.testSimpleIteration(store1);
+
+		FeatureQuery query = store1.createFeatureQuery();
+		FeatureType ftFinal = store1.getDefaultFeatureType();
+		String[] queryNames = new String[] {
+				ftFinal.getAttributeDescriptor(0).getName(),
+				ftFinal.getAttributeDescriptor(1).getName(),
+				ftFinal.getAttributeDescriptor(ftFinal.size() - 1).getName() };
+		query.setAttributeNames(queryNames);
+
+		this.testSimpleIteration(store1, query);
+
+		queryNames = new String[] {
+				ftFinal.getAttributeDescriptor(ftFinal.size() - 1).getName(),
+				ftFinal.getAttributeDescriptor(1).getName(),
+				ftFinal.getAttributeDescriptor(0).getName(),
+				ftFinal.getAttributeDescriptor(ftFinal.size() - 2).getName() };
+
+		query.setAttributeNames(queryNames);
+		this.testSimpleIteration(store1, query);
+
+		store1.dispose();
+		store2.dispose();
+
+
+
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
+	 */
+	public boolean hasExplorer() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @seeorg.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#
+	 * getDefaultNewDataStoreParameters()
+	 */
+	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
+			throws Exception {
+		if (this.myExplorer == null) {
+			DBFStoreParameters dbfParameters = (DBFStoreParameters) this
+					.getDefaultDataStoreParameters();
+			FeatureStore store = (FeatureStore) dataManager
+					.createStore(dbfParameters);
+			myExplorer = (FilesystemServerExplorer) store.getExplorer();
+			store.dispose();
+		}
+
+		return (NewFeatureStoreParameters) myExplorer
+				.getAddParameters(dbf_prueba_destino);
+	}
+
+	public boolean usesResources() {
+		return true;
+	}
+
+	@Override
+	public boolean resourcesNotifyChanges() {
+		return true;
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/TestDBF.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/data/pruebaNull.dbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/data/pruebaNull.dbf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/data/prueba.dbf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/store/dbf/data/prueba.dbf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java	(revision 38736)
@@ -0,0 +1,166 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.explorer.filesystem;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider;
+import org.gvsig.fmap.dal.store.dbf.TestDBF;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+
+public class FileSystemExplorerTest extends AbstractLibraryAutoInitTestCase {
+
+	private static DataManager dataManager = null;
+	public static final File dbf_data = new File(TestDBF.class.getResource(
+			"data/prueba.dbf").getFile()).getParentFile();
+
+	@Override
+	protected void doSetUp() throws Exception {
+		dataManager = DALLocator.getDataManager();
+	}
+
+	public void testList() throws Exception {
+		FilesystemServerExplorerParameters exParam = (FilesystemServerExplorerParameters) dataManager
+				.createServerExplorerParameters(FilesystemServerExplorer.NAME);
+
+		exParam.setRoot(dbf_data.getPath());
+
+		DataServerExplorer ex = dataManager.createServerExplorer(exParam);
+
+		List list = ex.list();
+
+		assertEquals(2, list.size());
+
+		if (((FilesystemStoreParameters) list.get(0)).getFile().getPath()
+				.equals(TestDBF.dbf_prueba.getPath())) {
+			assertEquals(((FilesystemStoreParameters) list.get(1)).getFile()
+					.getPath(), TestDBF.dbf_pruebaNull.getPath());
+
+		} else {
+			assertEquals(((FilesystemStoreParameters) list.get(0)).getFile()
+					.getPath(), TestDBF.dbf_pruebaNull.getPath());
+			assertEquals(((FilesystemStoreParameters) list.get(1)).getFile()
+					.getPath(), TestDBF.dbf_prueba.getPath());
+		}
+
+		Iterator iter = list.iterator();
+		TestDBF testDBF = new TestDBF();
+		while (iter.hasNext()) {
+			testDBF.testSimpleIteration((DBFStoreParameters) iter.next());
+		}
+
+
+
+	}
+
+	private boolean deleteDir(File dir) {
+		File[] files = dir.listFiles();
+		for (int i = 0; i < files.length; i++) {
+			if (files[i].isDirectory()) {
+				if (!deleteDir(files[i])) {
+					return false;
+				}
+			}
+			if (!files[i].delete()) {
+				return false;
+			}
+		}
+		return dir.delete();
+	}
+
+	public void testAddRemove() throws Exception {
+		File tmpDir = new File("target/_FilesystemExplorer.tmp");
+
+		if (tmpDir.exists()) {
+			if (!deleteDir(tmpDir)) {
+				fail("Clean tmp dir:" + tmpDir.getAbsolutePath());
+			}
+		}
+
+		tmpDir.mkdir();
+
+		FilesystemServerExplorerParameters exParam = (FilesystemServerExplorerParameters) dataManager
+				.createServerExplorerParameters(FilesystemServerExplorer.NAME);
+
+		exParam.setRoot(tmpDir.getAbsolutePath());
+
+		DataServerExplorer ex = dataManager.createServerExplorer(exParam);
+
+		assertTrue(ex.canAdd());
+
+		assertTrue(ex.canAdd(DBFStoreProvider.NAME));
+
+		assertEquals(0, ex.list().size());
+
+		NewDataStoreParameters newParams = ex
+				.getAddParameters(DBFStoreProvider.NAME);
+
+		((FilesystemStoreParameters) newParams).setFile(new File(tmpDir,
+				"tmp1.dbf"));
+		EditableFeatureType fType;
+		if (((NewFeatureStoreParameters) newParams).getDefaultFeatureType() instanceof EditableFeatureType) {
+			fType = (EditableFeatureType) ((NewFeatureStoreParameters) newParams)
+					.getDefaultFeatureType();
+		} else {
+			fType = ((NewFeatureStoreParameters) newParams)
+					.getDefaultFeatureType().getEditable();
+		}
+		fType.add("campo1", DataTypes.STRING).setSize(10);
+		((NewFeatureStoreParameters) newParams).setDefaultFeatureType(fType);
+		ex.add(DBFStoreProvider.NAME, newParams, false);
+
+		List list = ex.list();
+		assertEquals(1, list.size());
+
+		Iterator iter = list.iterator();
+		TestDBF testDBF = new TestDBF();
+		while (iter.hasNext()) {
+			testDBF.testSimpleIteration((DBFStoreParameters) iter.next());
+		}
+
+		ex.remove((DataStoreParameters) list.get(0));
+
+		assertEquals(0, ex.list().size());
+
+
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src-test/org/gvsig/fmap/dal/explorer/filesystem/FileSystemExplorerTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources-test/log4j.xml
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources-test/log4j.xml	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/resources-test/log4j.xml	(revision 38736)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- 
+Log4J configuration file for unit tests execution.
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <!-- Appender configuration to show logging messages through the console -->
+    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]  %m%n" />
+        </layout>
+    </appender>
+
+    <!-- 
+    Activate logging messages of DEBUG level of higher only for the
+    org.gvsig.fmap.dal packages.
+    You can put full classes names or packages instead, to configure
+    logging for all the classes and subpackages of the package.
+    -->
+    <category name="org.gvsig.fmap.dal">
+        <priority value="TRACE" />
+    </category>
+
+    <!-- 
+    By default, show only logging messages of INFO level or higher, 
+    through the previously configured CONSOLE appender. 
+    -->
+    <root>
+        <priority value="INFO" />
+        <appender-ref ref="CONSOLE" />
+    </root>
+</log4j:configuration>
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/FileHelper.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/FileHelper.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/FileHelper.java	(revision 38736)
@@ -0,0 +1,114 @@
+package org.gvsig.fmap.dal;
+
+import java.io.InputStream;
+
+import org.gvsig.fmap.dal.store.shp.SHPStoreProvider;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FileHelper {
+
+	private static final Logger LOG = LoggerFactory.getLogger(FileHelper.class);
+
+	private FileHelper() {
+		// Do nothing
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static DynStruct registerParametersDefinition(String name, Class theClass, String filename) {
+		DynStruct definition = null;
+		
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		definition = manager.getDefinition(name);
+		if ( definition == null) {
+			InputStream stream = theClass.getResourceAsStream(filename);
+			if( stream == null ) {
+				throw new DefinitionNotFoundException(theClass,filename);
+			}
+			definition = manager.addDefinition(
+					theClass,
+					name, 
+					stream,
+					theClass.getClassLoader(), 
+					null, 
+					null
+			);
+		}
+		return definition;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static DynStruct registerMetadataDefinition(String name, Class theClass, String filename) throws MetadataException {
+		DynStruct definition = null;
+
+		MetadataManager manager = MetadataLocator.getMetadataManager();
+		definition = manager.getDefinition(name);
+		if ( definition == null) {
+			InputStream stream = theClass.getResourceAsStream(filename);
+			if( stream == null ) {
+				throw new DefinitionNotFoundException(theClass,filename);
+			}
+			definition = manager.addDefinition(
+					name, 
+					theClass.getResourceAsStream(filename),
+					theClass.getClassLoader()
+			);
+		}
+		return definition;
+	}
+
+	public static DynObject newParameters(String name) {
+    	return ToolsLocator.getDynObjectManager()
+			.createDynObject(
+				ToolsLocator.getPersistenceManager().getDefinition(name)
+			);
+	}
+	
+	public static DynObject newMetadataContainer(String name) {
+		try {
+			MetadataManager manager = MetadataLocator.getMetadataManager();
+			DynStruct definition = manager.getDefinition(name);
+	    	return ToolsLocator.getDynObjectManager().createDynObject(definition);
+		} catch(NullPointerException e) {
+			throw new CantCreateMetadataException(name,e);
+		}
+	}
+
+	private static class DefinitionNotFoundException extends BaseRuntimeException {
+		
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 7598155353307119897L;
+
+		public DefinitionNotFoundException(Class<?> theClass, String filename ) {
+			super(
+				"Can't open parameters definition '%(filename)' from class %(classname).",
+				"_ResourceForParametersDefinitionNotFoundException",
+				serialVersionUID
+			);
+			this.setValue("filename", filename);
+			this.setValue("classname", theClass.getClass().getName());
+		}
+	}
+	
+	private static class CantCreateMetadataException extends RuntimeException {
+		
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = -8373306339537106075L;
+
+		CantCreateMetadataException(String name, Throwable cause) {
+			super("Can't retrieve metadata definition for '"+name+"'.", cause);			
+		}
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/FileHelper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLocator.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLocator.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLocator.java	(revision 38736)
@@ -0,0 +1,93 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerManager;
+import org.gvsig.tools.locator.AbstractLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+public class DALFileLocator extends AbstractLocator {
+
+
+	private static final String LOCATOR_NAME = "DALFileLocator";
+
+	/**
+	 * DataManager name used by the locator to access the instance
+	 */
+	public static final String FILESYSTEMSERVEREXPLORERE_MANAGER_NAME = "FilesystemServerExplorereManager";
+
+	private static final String FILESYSTEMSERVEREXPLORERE_MANAGER_DESCRIPTION = "FilesystemServerExplorereManager of gvSIG Data Access Library";
+
+	/**
+	 * Unique instance.
+	 */
+	private static final DALFileLocator instance = new DALFileLocator();
+
+	/**
+	 * Return the singleton instance.
+	 *
+	 * @return the singleton instance
+	 */
+	public static DALFileLocator getInstance() {
+		return instance;
+	}
+
+	public String getLocatorName() {
+		return LOCATOR_NAME;
+	}
+
+	/**
+	 * Return a reference to FilesystemServerExplorerManager.
+	 *
+	 * @return a reference to FilesystemServerExplorerManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static FilesystemServerExplorerManager getFilesystemServerExplorerManager()
+			throws LocatorException {
+		return (FilesystemServerExplorerManager) getInstance().get(
+				FILESYSTEMSERVEREXPLORERE_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the FilesystemSeverExplorerManager
+	 * interface.
+	 * 
+	 * @param clazz
+	 *            implementing the FilesystemSeverExplorerManager interface
+	 */
+	public static void registerFilesystemSeverExplorerManager(Class clazz) {
+		getInstance().register(FILESYSTEMSERVEREXPLORERE_MANAGER_NAME,
+				FILESYSTEMSERVEREXPLORERE_MANAGER_DESCRIPTION,
+				clazz);
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLibrary.java	(revision 38736)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.file.FileResourceParameters;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.DefaultFilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.DefaultFilesystemServerExplorerManager;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+
+public class DALFileLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+    	DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
+
+    	ResourceManagerProviderServices resman = (ResourceManagerProviderServices) DALLocator.getResourceManager();
+
+    	if (!resman.getResourceProviders().contains(FileResource.NAME)) {
+			resman.register(FileResource.NAME, FileResource.DESCRIPTION,
+					FileResource.class, FileResourceParameters.class);
+		}
+
+    	if (!dataman.getExplorerProviders().contains(FilesystemServerExplorer.NAME)) {
+			dataman.registerExplorerProvider(FilesystemServerExplorer.NAME,
+					DefaultFilesystemServerExplorer.class,
+					FilesystemServerExplorerParameters.class);
+			DALFileLocator
+					.registerFilesystemSeverExplorerManager(DefaultFilesystemServerExplorerManager.class);
+    	}
+	}
+}
\ No newline at end of file
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResource.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResource.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResource.java	(revision 38736)
@@ -0,0 +1,111 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.text.MessageFormat;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.PrepareResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.gvsig.fmap.dal.resource.spi.AbstractResource;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class FileResource extends AbstractResource {
+
+	final public static String NAME = "file";
+	final public static String DESCRIPTION = "File of filesystem";
+
+	private File file;
+
+	public FileResource(FileResourceParameters params)
+			throws InitializeException {
+		super(params);
+		file = null;
+	}
+
+	public Object get() throws AccessResourceException {
+		return getFile();
+	}
+
+	public String getFileName() throws AccessResourceException {
+		return (String) getFile().getPath();
+	}
+
+	public File getFile() throws AccessResourceException {
+
+		try {
+			prepare();
+		} catch (PrepareResourceException e) {
+			throw new AccessResourceException(this, e);
+		}
+		return ((FileResourceParameters)getParameters()).getFile();
+	}
+
+	// TODO ???
+	public FileInputStream getFileInputStream() throws AccessResourceException,
+			FileNotFoundException {
+		FileInputStream fis = new FileInputStream(getFile());
+		try {
+			notifyOpen();
+		} catch (ResourceNotifyOpenException e) {
+			throw new AccessResourceException(this, e);
+		}
+		return fis;
+	}
+
+	public String getName() throws AccessResourceException {
+		return MessageFormat.format("FileResource({0})",
+				new Object[] { getFileName() });
+	}
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException {
+		if (!(parameters instanceof FileResourceParameters)) {
+			return false;
+		}
+		FileResourceParameters params;
+		params = (FileResourceParameters) parameters.getCopy();
+		prepare(params);
+		return params.getFileName().equals(this.getFileName());
+
+	}
+
+}
+

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java	(revision 38736)
@@ -0,0 +1,89 @@
+package org.gvsig.fmap.dal.resource.file;
+
+import java.io.File;
+
+import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+
+public class FileResourceParameters extends AbstractResourceParameters {
+
+    public static final String DYNCLASS_NAME = "FileResourceParameters";
+
+    private static final String DYNFIELDNAME_FILE = "file";
+
+	private DelegatedDynObject delegatedDynObject;
+
+    public FileResourceParameters() {
+		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
+				.getDynObjectManager()
+				.createDynObject(registerDynClass());
+	}
+
+	public FileResourceParameters(Object[] params) {
+		this();
+		// XXX puede que sobre
+        setDynValue(DYNFIELDNAME_FILE, params[0]);
+	}
+
+	public FileResourceParameters(String name) {
+		this();
+		setDynValue(DYNFIELDNAME_FILE, name);
+	}
+
+	public String getFileName() {
+		if( this.getFile()== null ) {
+			return null;
+		}
+		return this.getFile().getPath();
+	}
+
+	public FileResourceParameters setFileName(String fileName) {
+		this.setDynValue(DYNFIELDNAME_FILE, fileName);
+		return this;
+	}
+
+	public File getFile() {
+		return (File) this.getDynValue(DYNFIELDNAME_FILE);
+	}
+
+	public FileResourceParameters setFile(File file) {
+		this.setDynValue(DYNFIELDNAME_FILE, file);
+		return this;
+	}
+
+	public FileResourceParameters setFile(String fileName) {
+		this.setDynValue(DYNFIELDNAME_FILE, fileName);
+		return this;
+	}
+
+	public String getTypeName() {
+		return FileResource.NAME;
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return delegatedDynObject;
+	}
+
+    private DynClass registerDynClass() {
+    	PersistenceManager manager = ToolsLocator.getPersistenceManager();
+    	DynClass definition = (DynClass) manager.getDefinition(DYNCLASS_NAME);
+    	if( definition == null ) {
+    		definition = (DynClass) manager.addDefinition(
+    				FileResourceParameters.class,
+    				DYNCLASS_NAME, 
+    				DYNCLASS_NAME+" persistence definition", 
+    				null, 
+    				null
+    		);
+
+			definition.addDynField(DYNFIELDNAME_FILE).setType(DataTypes.FILE)
+					.setDescription("The file");
+        }
+        return definition;
+    }
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java	(revision 38736)
@@ -0,0 +1,72 @@
+package org.gvsig.fmap.dal.serverexplorer.filesystem;
+
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectManager;
+
+public class FilesystemServerExplorerParameters extends AbstractDataParameters
+		implements DataServerExplorerParameters {
+
+    public static final String DYNCLASS_NAME = "FilesystemServerExplorerParameters";
+
+    private static final String FIELD_ROOT = "root";
+
+	private DelegatedDynObject delegatedDynObject;
+
+	public FilesystemServerExplorerParameters() {
+		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
+				.getDynObjectManager()
+				.createDynObject(this.registerDynClass());
+	}
+
+	private DynClass registerDynClass() {
+	   	DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+    	DynClass dynClass = dynman.get(DYNCLASS_NAME);
+    	DynField field;
+    	if (dynClass == null) {
+    		dynClass = dynman.add(DYNCLASS_NAME);
+
+    		field = dynClass.addDynField(FIELD_ROOT);
+    		field.setType(DataTypes.STRING);
+    		field.setDescription("Root directory path of the explorer");
+    		field.setTheTypeOfAvailableValues(DynField.ANY);
+
+
+    		field = dynClass.addDynField("initialpath");
+			field.setType(DataTypes.STRING);
+			field.setDescription("Initial path of the explorer");
+			field.setTheTypeOfAvailableValues(DynField.ANY);
+
+    	}
+    	return dynClass;
+	}
+
+	public void setRoot(String path) {
+		this.setDynValue(FIELD_ROOT, path);
+	}
+
+	public String getRoot() {
+		return (String) this.getDynValue(FIELD_ROOT);
+	}
+
+	public void setInitialpath(String path) {
+		this.setDynValue("initialpath", path);
+	}
+
+	public String getInitialpath() {
+		return (String) this.getDynValue("initialpath");
+	}
+
+	public String getExplorerName() {
+		return FilesystemServerExplorer.NAME;
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return delegatedDynObject;
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/AbstractFilesystemServerExplorerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/AbstractFilesystemServerExplorerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/AbstractFilesystemServerExplorerProvider.java	(revision 38736)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
+
+import java.io.File;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public abstract class AbstractFilesystemServerExplorerProvider implements FilesystemServerExplorerProvider {
+
+	public String getResourceRootPathName(DataStore dataStore) {
+		if (dataStore.getParameters().hasDynValue(FileResource.NAME)){
+			Object obj = (dataStore.getParameters().getDynValue(FileResource.NAME));
+			if (obj != null){	
+				return removeFileExtension(new File(obj.toString()));		
+			}
+		}
+		return null;
+	}
+	
+	protected String removeFileExtension(File file){
+		int whereDot = file.getName().lastIndexOf(".");	
+		if ((0 < whereDot) && (whereDot <= file.getName().length() - 2)) {
+			whereDot = file.getAbsolutePath().lastIndexOf(".");
+			return file.getAbsolutePath().substring(0, whereDot);
+		}	
+		return file.getAbsolutePath();
+	}
+	
+	public int getMode() {
+		return DataServerExplorer.MODE_ALL;
+	}
+	
+	public boolean isMode(int mode) {
+		if( mode == DataServerExplorer.MODE_ALL ) {
+			return true;
+		}
+		return (this.getMode() & mode) != 0;
+	}
+
+}
+

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/AbstractFilesystemServerExplorerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorerManager.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorerManager.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorerManager.java	(revision 38736)
@@ -0,0 +1,51 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerManager;
+import org.gvsig.tools.ToolsLocator;
+
+public class DefaultFilesystemServerExplorerManager implements
+		FilesystemServerExplorerManager {
+
+	public Iterator getRegisteredProviders() {
+		return ToolsLocator.getExtensionPointManager().get(FILE_FILTER_EPSNAME)
+				.iterator();
+	}
+
+	public void registerProvider(String name, String description,
+			Class filesystemServerProvicerClass) {
+		ToolsLocator.getExtensionPointManager().add(FILE_FILTER_EPSNAME,
+				FILE_FILTER_EPSDESCRIPTION).append(
+				name, description,
+				filesystemServerProvicerClass);
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorerManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorer.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorer.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorer.java	(revision 38736)
@@ -0,0 +1,496 @@
+package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.exception.ServerExplorerAddException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+
+@SuppressWarnings({"unchecked"})
+public class DefaultFilesystemServerExplorer extends AbstractDisposable
+		implements FilesystemServerExplorerProviderServices,
+		FilesystemFileFilter {
+
+	FilesystemServerExplorerParameters parameters;
+
+	private File root;
+
+	private File current; // Current path
+
+	private DataServerExplorerProviderServices providerServices;
+
+	private List serverProviders;
+
+	public DefaultFilesystemServerExplorer(
+			FilesystemServerExplorerParameters parameters,
+			DataServerExplorerProviderServices services)
+			throws InitializeException {
+		this.parameters = parameters;
+		this.providerServices = services;
+		if (this.parameters.getRoot() != null) {
+			this.root = new File(this.parameters.getRoot());
+		}
+		if (this.parameters.getInitialpath() != null) {
+			this.current = new File(this.parameters.getInitialpath());
+		}
+		if (this.root == null && this.current == null) {
+			// throw new InitializeException(this.getName(),
+			// new IllegalArgumentException());
+		} else if (this.current == null) {
+			this.current = new File(this.parameters.getRoot());
+		}
+	}
+
+	public DataServerExplorerParameters getParameters() {
+		return parameters;
+	}
+
+	protected void doDispose() throws BaseException {
+		this.parameters = null;
+		this.root = null;
+	}
+
+	public List list(int mode) throws DataException {
+		if (this.current == null) {
+			throw new IllegalStateException();
+		}
+		if (!this.current.exists()) {
+			new org.gvsig.fmap.dal.exception.FileNotFoundException(this.current);
+		}
+
+		if (!this.current.isDirectory()) {
+			new IllegalArgumentException(this.getProviderName()
+					+ ": Path not a directory '" + this.current + "'");
+		}
+
+		List files = new ArrayList(); // return files
+		List providers = this.getProviders(mode); 
+		String allfiles[] = this.current.list();
+
+		for (int i = 0; i < allfiles.length; i++) {
+			File file = new File(this.root, allfiles[i]);
+			Iterator providersit = providers.iterator();
+			while (providersit.hasNext()) {
+				FilesystemServerExplorerProvider provider = (FilesystemServerExplorerProvider) providersit
+						.next();
+				if( provider.accept(file)) {
+					DataStoreParameters dsp = this.createStoreParameters(file);
+					if (dsp != null) {
+						files.add(dsp);
+					}
+					break;
+				}
+			}
+		}
+		return files;
+	}
+
+	public List list() throws DataException {
+		if (this.current == null) {
+			throw new IllegalStateException(); // FIXME
+		}
+		if (!this.current.exists()) {
+			// TODO crear excepcion de Data??
+			new org.gvsig.fmap.dal.exception.FileNotFoundException(this.current);
+		}
+
+		if (!this.current.isDirectory()) {
+			new IllegalArgumentException(this.getProviderName()
+					+ ": Path not a directory '" + this.current + "'");
+		}
+
+		String files[] = this.current.list();
+		int i;
+		File theFile;
+		ArrayList list = new ArrayList();
+		DataStoreParameters dsp = null;
+
+		for (i = 0; i < files.length; i++) {
+			theFile = new File(this.root, files[i]);
+			dsp = this.createStoreParameters(theFile);
+			if (dsp != null) {
+				list.add(dsp);
+			}
+		}
+		return list;
+	}
+
+	public void setCurrentPath(File path) throws FileNotFoundException {
+		// FIXME Comprobar si es un directorio existente
+		if (!path.exists()) {
+			throw new FileNotFoundException(path);
+		}
+		if (!path.isDirectory()) {
+			throw new IllegalArgumentException(path.getPath()
+					+ " is not a directory");
+		}
+		if (!isFromRoot(path)) {
+			throw new IllegalArgumentException(path.getPath()
+					+ " is not from root");
+
+		}
+
+		this.current = path;
+	}
+
+	public File getCurrentPath() {
+		return this.current;
+	}
+
+	public File getRoot() {
+		return this.root;
+	}
+
+	public void remove(DataStoreParameters dsp) throws RemoveException {
+		String providerName = dsp.getDataStoreName();
+		try {
+			this.checkIsMine(dsp);
+			FilesystemServerExplorerProvider provider = this
+					.getProvider(providerName);
+
+			provider.remove(dsp);
+		} catch (DataException e) {
+			throw new RemoveException(this.getProviderName(), e);
+		}
+	}
+
+	public boolean add(String providerName, NewDataStoreParameters ndsp,
+			boolean overwrite) throws DataException {
+
+		try {
+			this.checkIsMine(ndsp);
+			FilesystemServerExplorerProvider provider = this
+					.getProvider(providerName);
+
+			ndsp.validate();
+			provider.create(ndsp, overwrite);
+			return true; 
+		} catch (DataException e) {
+			throw new ServerExplorerAddException(this.getProviderName(), e);
+		} catch (ValidateDataParametersException e) {
+			throw new ServerExplorerAddException(this.getProviderName(), e);
+		}
+	}
+
+	public boolean canAdd() {
+		return this.root.canWrite();
+	}
+
+	public String getProviderName() {
+		return FilesystemServerExplorer.NAME;
+	}
+
+	public NewDataStoreParameters getAddParameters(String storeName)
+			throws DataException {
+		FilesystemServerExplorerProvider provider = this.getProvider(storeName);
+		if (provider == null) {
+			throw new IllegalArgumentException(
+					"Not registered in this explorer"); // FIXME
+		}
+
+		NewDataStoreParameters nParams = provider.getCreateParameters();
+		// nParams.setAttribute("path", this.getCurrentPath().getPath());
+		return nParams;
+	}
+
+	public boolean canAdd(String storeName) throws DataException {
+		if (storeName == null) {
+			return false;// CanAdd with genericFilter
+		}
+		FilesystemServerExplorerProvider provider = this.getProvider(storeName);
+		if (provider == null) {
+			throw new IllegalArgumentException(
+					"Not registered in this explorer"); // FIXME
+		}
+
+		return provider.canCreate();
+
+	}
+
+	// ==========================================
+
+	private FilesystemServerExplorerProvider getProvider(String storeName)
+			throws InitializeException, ProviderNotRegisteredException {
+		Iterator providers = getProviders(FilesystemServerExplorer.MODE_ALL).iterator();
+		FilesystemServerExplorerProvider provider;
+		while (providers.hasNext()) {
+			provider = (FilesystemServerExplorerProvider) providers.next();
+			if (provider.getDataStoreProviderName().equals(storeName)) {
+				return provider;
+			}
+		}
+		return null;
+	}
+
+	private DataManagerProviderServices getManager() {
+		return (DataManagerProviderServices) DALLocator.getDataManager();
+	}
+	
+	public DataStoreParameters createStoreParameters(File file, String providerName) throws DataException {
+
+		return this.getParametersFor(file, providerName, true);
+	}
+
+	public DataStoreParameters createStoreParameters(File file) throws DataException {
+
+		return this.getParametersFor(file, null, true);
+	}
+	
+	public DataStoreParameters getParametersFor(File file, String providerName, boolean checksExist) throws DataException {
+		
+		if (checksExist) {
+			if (!file.exists()) {
+				return null;
+			}
+			if (!file.isFile()) {
+				return null;
+			}
+			if (!file.canRead()) {
+				return null;
+			}
+			if (file.isHidden()) { // XXX ???
+				return null;
+			}
+		}
+		if(providerName == null)
+			providerName = this.getProviderName(file);
+		if (providerName != null) {
+			DataStoreParameters params = this.getManager()
+			.createStoreParameters(providerName);
+			((FilesystemStoreParameters) params).setFile(file);
+			return params;
+
+		}
+		return null;
+	}
+	
+	public ArrayList<String> getProviderNameList(File file) {
+		Iterator filters = getFilters();
+		ArrayList<String> list = new ArrayList<String>();
+		while (filters.hasNext()) {
+			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
+			if (filter.accept(file)) {
+				list.add(filter.getDataStoreProviderName());
+			}
+		}
+		return list;
+	}
+
+	public String getProviderName(File file) {
+		Iterator filters = getFilters();
+		while (filters.hasNext()) {
+			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
+			if (filter.accept(file)) {
+				return filter.getDataStoreProviderName();
+			}
+		}
+		return null;
+	}
+
+	public List getDataStoreProviderNames() {
+		Set names = new HashSet();
+		
+		Iterator filters = getFilters();
+		while (filters.hasNext()) {
+			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
+			names.add(filter.getDataStoreProviderName());
+		}
+		return new ArrayList(names);	
+	}
+
+	private void checkIsMine(DataStoreParameters dsp)
+			throws IllegalArgumentException, DataException {
+		// FIXME Exception ???
+		if (!(dsp instanceof FilesystemStoreParameters)) {
+			new IllegalArgumentException(
+					"not instance of FilesystemStoreParameters");
+		}
+		Iterator filters = getFilters();
+		File file = ((FilesystemStoreParameters) dsp).getFile();
+		if (!this.isFromRoot(file)) {
+			throw new IllegalArgumentException("worng explorer");
+		}
+		FilesystemFileFilter filter;
+		while (filters.hasNext()) {
+			filter = (FilesystemFileFilter) filters.next();
+			if (dsp.getDataStoreName()
+					.equals(filter.getDataStoreProviderName())) {
+				return;
+			}
+		}
+		throw new IllegalArgumentException("worng explorer");
+	}
+
+	private boolean isFromRoot(File file) {
+		if (this.root == null) {
+			return true;
+		}
+		return file.getAbsolutePath().startsWith(this.root.getAbsolutePath());
+	}
+
+	public List getProviders() {
+		if (this.serverProviders == null) {
+			Iterator iter = DALFileLocator.getFilesystemServerExplorerManager()
+					.getRegisteredProviders();
+			this.serverProviders = new ArrayList();
+			Extension ext;
+			FilesystemServerExplorerProvider provider;
+			while (iter.hasNext()) {
+				ext = (Extension) iter.next();
+				try {
+					provider = (FilesystemServerExplorerProvider) ext.create();
+				} catch (Exception e) {
+					throw new RuntimeException(e);// FIXME !!!
+				}
+				provider.initialize(this);
+				this.serverProviders.add(provider);
+			}
+		}
+		return this.serverProviders;
+	}
+
+	public List getProviders(int mode) {
+		Iterator iter = DALFileLocator.getFilesystemServerExplorerManager()
+				.getRegisteredProviders();
+		List providers = new ArrayList();
+		Extension ext;
+		FilesystemServerExplorerProvider provider;
+		while (iter.hasNext()) {
+			ext = (Extension) iter.next();
+			try {
+				provider = (FilesystemServerExplorerProvider) ext.create();
+			} catch (Exception e) {
+				throw new RuntimeException(e);// FIXME !!!
+			}
+			if (provider.isMode(mode)) {
+				provider.initialize(this);
+				providers.add(provider);
+			}
+		}
+		return providers;
+	}
+
+	public Iterator getFilters(int mode) {
+		return this.getProviders(mode).iterator();
+	}
+	
+	public Iterator getFilters() {
+		return this.getProviders().iterator();
+	}
+
+	public FilesystemFileFilter getFilter(int mode, final String description ) {
+		
+		final List filters = new ArrayList();
+		Iterator it = this.getFilters(mode);
+		while( it.hasNext() ) {
+			filters.add( it.next() );
+		}
+		FilesystemFileFilter filter = new FilesystemFileFilter() {
+			
+			public boolean accept(File f) {
+				if (f.isDirectory()) {
+					return true;
+				}
+				for(int i=0; i<filters.size(); i++) {
+					if( ((FilesystemFileFilter)filters.get(i)).accept(f) ) {
+						return true;
+					}
+				}
+				return false;
+			}
+			
+			public String getDescription() {
+				return description;
+			}
+			
+			public String getDataStoreProviderName() {
+				return null;
+			}
+		};
+		return filter;
+	}
+
+	public FilesystemFileFilter getGenericFilter() {
+		// FIXME: Este metodo, getGenericFilter, no tengo claro que deba existir (jjdc)
+		return this;
+	}
+
+	public String getDataStoreProviderName() {
+		return null;
+	}
+
+	public String getDescription() {
+		return "All supporteds";
+	}
+
+	public boolean accept(File pathname) {
+		try {
+			return this.createStoreParameters(pathname) != null;
+		} catch (DataException e) {
+			throw new RuntimeException(e); // FIXME excpetion??
+		}
+	}
+
+	public DataServerExplorerProviderServices getServerExplorerProviderServices() {
+		return this.providerServices;
+	}
+
+	public DataStore open(File file) throws DataException,
+			ValidateDataParametersException {
+		DataManager manager =  DALLocator.getDataManager();
+		String providerName = this.getProviderName(file);
+		
+        DataStoreParameters params = this.getAddParameters(file);
+		return manager.openStore(providerName, params);
+	}
+
+	public NewDataStoreParameters getAddParameters(File file)
+			throws DataException {
+		DataStoreParameters params = this.getParametersFor(file, null, false);
+		NewDataStoreParameters newParams = this.getAddParameters(params
+				.getDataStoreName());
+		((FilesystemStoreParameters) newParams)
+				.setFile(((FilesystemStoreParameters) params).getFile());
+		return newParams;
+	}
+
+	public File getResourcePath(DataStore dataStore, String resourceName) throws DataException {
+		FilesystemServerExplorerProvider provider = 
+			this.getProvider(dataStore.getProviderName());
+		if (provider == null){
+			return null;
+		}		
+		String rootPath = provider.getResourceRootPathName(dataStore);
+		if (rootPath == null){
+			return null;
+		}
+		return new File(rootPath + "." + resourceName);
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemStoreParameters.java	(revision 38736)
@@ -0,0 +1,44 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.serverexplorer.filesystem;
+
+import java.io.File;
+
+/**
+ * @author jmvivo
+ *
+ */
+public interface FilesystemStoreParameters {
+
+	public File getFile();
+
+	public void setFile(File file);
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemFileFilter.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemFileFilter.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemFileFilter.java	(revision 38736)
@@ -0,0 +1,10 @@
+package org.gvsig.fmap.dal.serverexplorer.filesystem;
+
+import java.io.FileFilter;
+
+public interface FilesystemFileFilter extends FileFilter {
+
+	public String getDataStoreProviderName();
+	public String getDescription();
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemFileFilter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/AbsolutePathRequiredException.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/AbsolutePathRequiredException.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/AbsolutePathRequiredException.java	(revision 38736)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.serverexplorer.filesystem;
+
+import org.gvsig.fmap.dal.exception.CreateException;
+
+public class AbsolutePathRequiredException extends CreateException {
+
+	private static final long serialVersionUID = 8723525042950358334L;
+	private final static String MESSAGE_FORMAT = "Absolute path required creating '%(resource)'.";
+	private final static String MESSAGE_KEY = "_AbsolutePathRequiredException";
+
+	public AbsolutePathRequiredException(String resource) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+}
+
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerManager.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerManager.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerManager.java	(revision 38736)
@@ -0,0 +1,41 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.serverexplorer.filesystem.spi;
+
+import java.util.Iterator;
+
+public interface FilesystemServerExplorerManager {
+	final public static String FILE_FILTER_EPSNAME = "FilesystemExplorerFilters";
+	final public String FILE_FILTER_EPSDESCRIPTION = "Registro de filtros asociados al explorador del sistema de ficheros.";
+
+	public void registerProvider(String name, String description,
+			Class filesystemServerProvicerClass);
+
+	public Iterator getRegisteredProviders();
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProvider.java	(revision 38736)
@@ -0,0 +1,71 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.serverexplorer.filesystem.spi;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter;
+
+/**
+ * @author jmvivo
+ *
+ */
+public interface FilesystemServerExplorerProvider extends FilesystemFileFilter {
+
+	public void initialize(FilesystemServerExplorerProviderServices serverExplorer);
+
+	public boolean canCreate();
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException;
+
+	public NewDataStoreParameters getCreateParameters() throws DataException;
+
+	public void remove(DataStoreParameters parameters) throws RemoveException;
+
+	public boolean canCreate(NewDataStoreParameters parameters);
+	
+	public String getResourceRootPathName(DataStore dataStore);
+	
+	public int getMode();
+
+	/**
+	 * Return true if any mode in the parameter is supported.
+	 * 
+	 * @param mode
+	 * @return
+	 */
+	public boolean isMode(int mode);
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProviderServices.java	(revision 38736)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.serverexplorer.filesystem.spi;
+
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProvider;
+
+public interface FilesystemServerExplorerProviderServices extends
+		DataServerExplorerProvider, FilesystemServerExplorer {
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorer.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorer.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorer.java	(revision 38736)
@@ -0,0 +1,76 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.serverexplorer.filesystem;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+
+public interface FilesystemServerExplorer extends DataServerExplorer {
+
+	public static final String NAME = "FilesystemExplorer";
+
+	public void setCurrentPath(File path) throws FileNotFoundException;
+
+	public File getCurrentPath();
+
+	public File getRoot();
+	
+	public ArrayList<String> getProviderNameList(File file);
+
+	public String getProviderName(File file);
+	
+	public NewDataStoreParameters getAddParameters(File file)
+			throws DataException;
+
+	public DataStoreParameters createStoreParameters(File file)
+			throws DataException;
+	public DataStoreParameters createStoreParameters(File file, String providerName) 
+			throws DataException;
+
+//	public DataStore open(File file) throws DataException,
+//			ValidateDataParametersException;
+
+	public Iterator getFilters();
+
+	public Iterator getFilters(int mode);
+	
+	public FilesystemFileFilter getFilter(int mode, String description);
+	
+	public FilesystemFileFilter getGenericFilter();
+	
+	public File getResourcePath(DataStore dataStore, String resourceName) throws DataException;
+
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFLibrary.java	(revision 38736)
@@ -0,0 +1,138 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DBFLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DALFileLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		List<Throwable> exs = new ArrayList<Throwable>();
+
+		FileHelper.registerParametersDefinition(
+				DBFStoreParameters.PARAMETERS_DEFINITION_NAME, 
+				DBFStoreParameters.class,
+				"DBFParameters.xml"
+		);
+		updateEncodingDefinition();
+		FileHelper.registerParametersDefinition(
+				DBFNewStoreParameters.PARAMETERS_DEFINITION_NAME, 
+				DBFNewStoreParameters.class,
+				"DBFParameters.xml"
+		);
+		try {
+			FileHelper.registerMetadataDefinition(
+					DBFStoreProvider.METADATA_DEFINITION_NAME, 
+					DBFStoreProvider.class,
+					"DBFMetadata.xml"
+			);
+		} catch (MetadataException e) {
+			exs.add(e);
+		}
+
+        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+				.getDataManager();
+
+		try {
+			if (!dataman.getStoreProviders().contains(DBFStoreProvider.NAME)) {
+				dataman.registerStoreProvider(DBFStoreProvider.NAME,
+						DBFStoreProvider.class, DBFStoreParameters.class);
+			}
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		try {
+			DALFileLocator.getFilesystemServerExplorerManager()
+					.registerProvider(DBFStoreProvider.NAME,
+							DBFStoreProvider.DESCRIPTION,
+							DBFFilesystemServerProvider.class);
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		if( exs.size()>0 ) {
+			throw new LibraryException(this.getClass(), exs);
+		}
+	}
+	
+	private static void updateEncodingDefinition() {
+		DynStruct parametersDefinition = ToolsLocator.getPersistenceManager().getDefinition(DBFStoreParameters.PARAMETERS_DEFINITION_NAME);
+		
+		DynObjectValueItem[] values = parametersDefinition.getDynField("encoding").getAvailableValues();
+    	
+		Set<DynObjectValueItem> charsetSet = new LinkedHashSet<DynObjectValueItem>(160);
+
+		charsetSet.addAll( Arrays.asList(values) );
+		Map<String,Charset> charsets = Charset.availableCharsets();
+		Iterator<String> iter = charsets.keySet().iterator();
+		while (iter.hasNext()){
+			String value = (String) iter.next();
+			String label= value;
+			charsetSet.add(new DynObjectValueItem(value, label));
+		}
+
+		parametersDefinition.getDynField("Encoding")
+			.setAvailableValues(
+					(DynObjectValueItem[]) charsetSet.toArray(new DynObjectValueItem[charsets.size()])
+			);
+
+		
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileWriter.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileWriter.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileWriter.java	(revision 38736)
@@ -0,0 +1,504 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.store.dbf.utils;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+import java.text.FieldPosition;
+import java.text.NumberFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.UnsupportedEncodingException;
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+
+/**
+ * A DbaseFileReader is used to read a dbase III format file. The general use of
+ * this class is: <CODE><PRE>
+ * DbaseFileHeader header = ...
+ * WritableFileChannel out = new FileOutputStream("thefile.dbf").getChannel();
+ * DbaseFileWriter w = new DbaseFileWriter(header,out);
+ * while ( moreRecords ) {
+ *   w.write( getMyRecord() );
+ * }
+ * w.close();
+ * </PRE></CODE> You must supply the <CODE>moreRecords</CODE> and
+ * <CODE>getMyRecord()</CODE> logic...
+ * 
+ * @author Ian Schneider
+ */
+public class DbaseFileWriter {
+
+    private DbaseFileHeader header;
+    private DbaseFileWriter.FieldFormatter formatter =
+        new DbaseFileWriter.FieldFormatter();
+    FileChannel channel;
+    private ByteBuffer buffer;
+    // private final Number NULL_NUMBER = new Integer(0);
+    private final String NULL_STRING = "";
+    private final String NULL_DATE = "        ";
+    private boolean headDrity = false;
+
+    // TODO: READ HEADER AND STABLIST THE RIGHT CHARSET
+    private Charset charset = Charset.forName("ISO-8859-1");
+
+    /**
+     * Create a DbaseFileWriter using the specified header and writing to the
+     * given channel.
+     * 
+     * @param header
+     *            The DbaseFileHeader to write.
+     * @param out
+     *            The Channel to write to.
+     * 
+     * 
+     * @throws InitializeWriterException
+     * @throws IOException
+     *             If errors occur while initializing.
+     */
+    public DbaseFileWriter(DbaseFileHeader header, FileChannel out,
+        boolean isNew) throws InitializeException {
+        this.header = header;
+        this.channel = out;
+        this.headDrity = isNew;
+
+        init();
+    }
+
+    private void init() throws InitializeException {
+        try {
+            if (this.channel.size() < this.header.getHeaderLength()) {
+                this.writeHeader();
+            }
+            buffer = ByteBuffer.allocateDirect(header.getRecordLength());
+        } catch (Exception e) {
+            throw new InitializeException("DBF Writer", e);
+        }
+    }
+
+    private void write() throws WriteException {
+        buffer.position(0);
+        int r = buffer.remaining();
+        try {
+            while ((r -= channel.write(buffer)) > 0) {
+                ; // do nothing
+            }
+        } catch (IOException e) {
+            throw new WriteException("DBF Writer", e);
+        }
+    }
+
+    private void writeHeader() throws WriteException {
+        try {
+            channel.position(0);
+            header.writeHeader(channel);
+        } catch (IOException e) {
+            throw new WriteException("DBF Writer", e);
+        }
+    }
+
+    /**
+     * Write a single dbase record.
+     * 
+     * @param record
+     *            The entries to write.
+     * @throws UnsupportedEncodingException
+     * @throws WriteException
+     */
+    public void append(Feature feature) throws WriteException,
+        UnsupportedEncodingException {
+        this.fillBuffer(feature);
+        try {
+            this.moveToEOF();
+        } catch (IOException e) {
+            throw new WriteException("DbaseFileWriter", e);
+        }
+        this.header.setNumRecords(this.header.getNumRecords() + 1);
+        write();
+
+        this.headDrity = true;
+    }
+
+    private void fillBuffer(Feature feature)
+        throws UnsupportedEncodingException, WriteException {
+        FeatureType featureType = feature.getType();
+        try {
+            buffer.position(0);
+
+            // put the 'not-deleted' marker
+            buffer.put((byte) ' ');
+
+            @SuppressWarnings("unchecked")
+            Iterator<FeatureAttributeDescriptor> iterator =
+                featureType.iterator();
+            while (iterator.hasNext()) {
+                FeatureAttributeDescriptor fad = iterator.next();
+                int type = fad.getType();
+                if (type == DataTypes.GEOMETRY) {
+                    continue;
+                }
+                String fieldString = fieldString(fad, feature);
+                if (fieldString == null) {
+                    if (type == DataTypes.STRING) {
+                        fieldString = NULL_STRING;
+                    } else
+                        if (type == DataTypes.DATE) {
+                            fieldString = NULL_DATE;
+                        } else {
+                            fieldString = "0";
+                        }
+                }
+                try {
+                    buffer.put(fieldString.getBytes(charset.name()));
+                } catch (java.io.UnsupportedEncodingException e) {
+                    throw new UnsupportedEncodingException(e);
+                }
+            }
+        } catch (Exception e) {
+            throw new WriteException("DbaseFileWriter", e);
+        }
+    }
+
+    private void moveToEOF() throws IOException {
+        this.moveTo(this.header.getNumRecords());
+    }
+
+    private void moveTo(long numReg) throws IOException {
+        // if (!(channel instanceof FileChannel)) {
+        // throw new IOException(
+        // "DbaseFileWriterNIO: channel is not a FileChannel. Cannot position properly");
+        // }
+
+        long newPos =
+            header.getHeaderLength() + numReg * header.getRecordLength();
+        if (this.channel.position() != newPos) {
+            this.channel.position(newPos);
+        }
+    }
+
+    /**
+     * Write a single dbase record. Useful to update a dbf.
+     * 
+     * @param record
+     *            The entries to write.
+     * @throws WriteException
+     * @throws UnsupportedEncodingException
+     */
+    public void update(Feature feature, long numReg) throws WriteException,
+        UnsupportedEncodingException {
+        this.fillBuffer(feature);
+
+        try {
+            this.moveTo(numReg);
+        } catch (IOException e) {
+            throw new WriteException("DbaseFileWriter", e);
+        }
+
+        write();
+    }
+
+    private String fieldString(FeatureAttributeDescriptor attr, Feature feature) {
+        int type = attr.getType();
+        int dbfFieldIndex = this.header.getFieldIndex(attr.getName());
+        final int fieldLen = header.getFieldLength(dbfFieldIndex);
+        String fieldString = "";
+        if (DataTypes.BOOLEAN == type) {
+            boolean b = feature.getBoolean(attr.getIndex());
+            if (b) {
+                fieldString = "T";
+            } else {
+                fieldString = "F";
+            }
+        } else
+            if (DataTypes.BYTE == type) {
+                fieldString = String.valueOf(feature.getByte(attr.getIndex()));
+            } else
+                if (DataTypes.DATE == type) {
+                    Date date = feature.getDate(attr.getIndex());
+                    fieldString = formatter.getFieldString(date);
+                } else
+                    if (DataTypes.DOUBLE == type) {
+                        double d = feature.getDouble(attr.getIndex());
+                        fieldString =
+                            formatter.getFieldString(fieldLen,
+                                header.getFieldDecimalCount(dbfFieldIndex), d);
+                    } else
+                        if (DataTypes.FLOAT == type) {
+                            float f = feature.getFloat(attr.getIndex());
+                            fieldString =
+                                formatter.getFieldString(fieldLen,
+                                    header.getFieldDecimalCount(dbfFieldIndex),
+                                    f);
+                        } else
+                            if (DataTypes.INT == type) {
+                                int integer = feature.getInt(attr.getIndex());
+                                fieldString =
+                                    formatter.getFieldString(fieldLen, header
+                                        .getFieldDecimalCount(dbfFieldIndex),
+                                        integer);
+                            } else
+                                if (DataTypes.LONG == type) {
+                                    long l = feature.getLong(attr.getIndex());
+                                    fieldString =
+                                        formatter
+                                            .getFieldString(
+                                                fieldLen,
+                                                header
+                                                    .getFieldDecimalCount(dbfFieldIndex),
+                                                l);
+                                } else
+                                    if (DataTypes.STRING == type) {
+                                        String s =
+                                            feature.getString(attr.getIndex());
+                                        fieldString =
+                                            formatter.getFieldString(fieldLen,
+                                                s);
+                                    }
+        return fieldString;
+
+    }
+
+    // private String fieldString(Object obj,final int col) {
+    // String o;
+    // final int fieldLen = header.getFieldLength(col);
+    // switch (header.getFieldType(col)) {
+    // case 'C':
+    // case 'c':
+    // o = formatter.getFieldString(
+    // fieldLen,
+    // (obj instanceof NullValue)? NULL_STRING : ((StringValue) obj).getValue()
+    // );
+    // break;
+    // case 'L':
+    // case 'l':
+    // o = (obj instanceof NullValue) ? "F" : ((BooleanValue)obj).getValue() ==
+    // true ? "T" : "F";
+    // break;
+    // case 'M':
+    // case 'G':
+    // o = formatter.getFieldString(
+    // fieldLen,
+    // (obj instanceof NullValue) ? NULL_STRING : ((StringValue) obj).getValue()
+    // );
+    // break;
+    // /* case 'N':
+    // case 'n':
+    // // int?
+    // if (header.getFieldDecimalCount(col) == 0) {
+    //
+    // o = formatter.getFieldString(
+    // fieldLen, 0, (Number) (obj == null ? NULL_NUMBER :
+    // Double.valueOf(obj.toString()))
+    // );
+    // break;
+    //
+    // }
+    // */
+    // case 'N':
+    // case 'n':
+    // case 'F':
+    // case 'f':
+    // Number number = null;
+    // if(obj instanceof NullValue){
+    // number = NULL_NUMBER;
+    // }else{
+    // NumericValue gVal = (NumericValue) obj;
+    // number = new Double(gVal.doubleValue());
+    // }
+    // o = formatter.getFieldString(fieldLen,
+    // header.getFieldDecimalCount(col),
+    // number);
+    // break;
+    // case 'D':
+    // case 'd':
+    // if (obj instanceof NullValue)
+    // o = NULL_DATE;
+    // else
+    // o = formatter.getFieldString(((DateValue)obj).getValue());
+    // break;
+    // default:
+    // throw new RuntimeException("Unknown type " + header.getFieldType(col));
+    // }
+    //
+    // return o;
+    // }
+
+    /**
+     * Release resources associated with this writer. <B>Highly recommended</B>
+     * 
+     * @throws CloseException
+     * @throws IOException
+     *             If errors occur.
+     */
+    public void close() throws CloseException {
+        // IANS - GEOT 193, bogus 0x00 written. According to dbf spec, optional
+        // eof 0x1a marker is, well, optional. Since the original code wrote a
+        // 0x00 (which is wrong anyway) lets just do away with this :)
+        // - produced dbf works in OpenOffice and ArcExplorer java, so it must
+        // be okay.
+        // buffer.position(0);
+        // buffer.put((byte) 0).position(0).limit(1);
+        // write();
+
+        if (headDrity) {
+            try {
+                this.writeHeader();
+            } catch (WriteException e) {
+                throw new CloseException("DbaseFileWriter", e);
+            }
+        }
+
+        try {
+            channel.close();
+        } catch (IOException e) {
+            throw new CloseException("DBF Writer", e);
+        }
+        if (buffer instanceof MappedByteBuffer) {
+            // NIOUtilities.clean(buffer);
+        }
+
+        buffer = null;
+        channel = null;
+        formatter = null;
+    }
+
+    /** Utility for formatting Dbase fields. */
+    public static class FieldFormatter {
+
+        private StringBuffer buffer = new StringBuffer(255);
+        private NumberFormat numFormat = NumberFormat
+            .getNumberInstance(Locale.US);
+        private Calendar calendar = Calendar.getInstance(Locale.US);
+        private String emtpyString;
+        private static final int MAXCHARS = 255;
+
+        public FieldFormatter() {
+            // Avoid grouping on number format
+            numFormat.setGroupingUsed(false);
+
+            // build a 255 white spaces string
+            StringBuffer sb = new StringBuffer(MAXCHARS);
+            sb.setLength(MAXCHARS);
+            for (int i = 0; i < MAXCHARS; i++) {
+                sb.setCharAt(i, ' ');
+            }
+
+            emtpyString = sb.toString();
+        }
+
+        public String getFieldString(int size, String s) {
+            buffer.replace(0, size, emtpyString);
+            buffer.setLength(size);
+
+            if (s != null) {
+                buffer.replace(0, size, s);
+                if (s.length() <= size) {
+                    for (int i = s.length(); i < size; i++) {
+                        buffer.append(' ');
+                    }
+                }
+            }
+
+            buffer.setLength(size);
+            return buffer.toString();
+        }
+
+        public String getFieldString(Date d) {
+
+            if (d != null) {
+                buffer.delete(0, buffer.length());
+
+                calendar.setTime(d);
+                int year = calendar.get(Calendar.YEAR);
+                int month = calendar.get(Calendar.MONTH) + 1; // returns 0 based
+                                                              // month?
+                int day = calendar.get(Calendar.DAY_OF_MONTH);
+
+                if (year < 1000) {
+                    if (year >= 100) {
+                        buffer.append("0");
+                    } else
+                        if (year >= 10) {
+                            buffer.append("00");
+                        } else {
+                            buffer.append("000");
+                        }
+                }
+                buffer.append(year);
+
+                if (month < 10) {
+                    buffer.append("0");
+                }
+                buffer.append(month);
+
+                if (day < 10) {
+                    buffer.append("0");
+                }
+                buffer.append(day);
+            } else {
+                buffer.setLength(8);
+                buffer.replace(0, 8, emtpyString);
+            }
+
+            buffer.setLength(8);
+            return buffer.toString();
+        }
+
+        public String getFieldString(int size, int decimalPlaces, double n) {
+            buffer.delete(0, buffer.length());
+
+            // if (n != null) {
+            numFormat.setMaximumFractionDigits(decimalPlaces);
+            numFormat.setMinimumFractionDigits(decimalPlaces);
+            numFormat.format(n, buffer, new FieldPosition(
+                NumberFormat.INTEGER_FIELD));
+            // }
+
+            int diff = size - buffer.length();
+            if (diff >= 0) {
+                while (diff-- > 0) {
+                    buffer.insert(0, ' ');
+                }
+            } else {
+                buffer.setLength(size);
+            }
+            return buffer.toString();
+        }
+    }
+
+    public void setCharset(Charset charset) {
+        this.charset = charset;
+
+    }
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java	(revision 38736)
@@ -0,0 +1,524 @@
+/*
+ * Created on 16-feb-2004
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.gvsig.fmap.dal.store.dbf.utils;
+
+/**
+ */
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+import java.text.FieldPosition;
+import java.text.NumberFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.UnsupportedEncodingException;
+import org.gvsig.fmap.dal.exception.UnsupportedVersionException;
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.utils.bigfile.BigByteBuffer2;
+
+
+/**
+ * Class to read and write data to a dbase III format file. Creation date:
+ * (5/15/2001 5:15:13 PM)
+ */
+public class DbaseFile {
+	// Header information for the DBase File
+	private DbaseFileHeader myHeader;
+
+	private File file;
+
+	private RandomAccessFile raf;
+
+	private FileChannel channel;
+
+	private BigByteBuffer2 buffer;
+
+	private FileChannel.MapMode mode;
+
+	private FieldFormatter formatter = new FieldFormatter();
+
+	private long posActual = -1;
+
+	private int recordOffset;
+
+	private ByteBuffer cachedRecord = null;
+
+	private byte[] bytesCachedRecord = null;
+
+	private final Number NULL_NUMBER = new Integer(0);
+
+	private final String NULL_STRING = "";
+
+	private final String NULL_DATE = "        ";
+
+	private Charset chars = null;
+	private Charset charsOriginal;
+
+	private boolean isOpen = false;
+
+
+	/** Utility for formatting Dbase fields. */
+	public static class FieldFormatter {
+		private StringBuffer buffer = new StringBuffer(255);
+
+		private NumberFormat numFormat = NumberFormat
+				.getNumberInstance(Locale.US);
+
+		private Calendar calendar = Calendar.getInstance(Locale.US);
+
+		private String emtpyString;
+
+		private static final int MAXCHARS = 255;
+
+		public FieldFormatter() {
+			// Avoid grouping on number format
+			numFormat.setGroupingUsed(false);
+
+			// build a 255 white spaces string
+			StringBuffer sb = new StringBuffer(MAXCHARS);
+			sb.setLength(MAXCHARS);
+			for (int i = 0; i < MAXCHARS; i++) {
+				sb.setCharAt(i, ' ');
+			}
+
+			emtpyString = sb.toString();
+		}
+
+		public String getFieldString(int size, String s) {
+			buffer.replace(0, size, emtpyString);
+			buffer.setLength(size);
+
+			if (s != null) {
+				buffer.replace(0, size, s);
+				if (s.length() <= size) {
+					for (int i = s.length(); i < size; i++) {
+						buffer.append(' ');
+					}
+				}
+			}
+
+			buffer.setLength(size);
+			return buffer.toString();
+		}
+
+		public String getFieldString(Date d) {
+
+			if (d != null) {
+				buffer.delete(0, buffer.length());
+
+				calendar.setTime(d);
+				int year = calendar.get(Calendar.YEAR);
+				int month = calendar.get(Calendar.MONTH) + 1; // returns 0
+																// based month?
+				int day = calendar.get(Calendar.DAY_OF_MONTH);
+
+				if (year < 1000) {
+					if (year >= 100) {
+						buffer.append("0");
+					} else if (year >= 10) {
+						buffer.append("00");
+					} else {
+						buffer.append("000");
+					}
+				}
+				buffer.append(year);
+
+				if (month < 10) {
+					buffer.append("0");
+				}
+				buffer.append(month);
+
+				if (day < 10) {
+					buffer.append("0");
+				}
+				buffer.append(day);
+			} else {
+				buffer.setLength(8);
+				buffer.replace(0, 8, emtpyString);
+			}
+
+			buffer.setLength(8);
+			return buffer.toString();
+		}
+
+		public String getFieldString(int size, int decimalPlaces, Number n) {
+			buffer.delete(0, buffer.length());
+
+			if (n != null) {
+				numFormat.setMaximumFractionDigits(decimalPlaces);
+				numFormat.setMinimumFractionDigits(decimalPlaces);
+				numFormat.format(n, buffer, new FieldPosition(
+						NumberFormat.INTEGER_FIELD));
+			}
+
+			int diff = size - buffer.length();
+			if (diff >= 0) {
+				while (diff-- > 0) {
+					buffer.insert(0, ' ');
+				}
+			} else {
+				buffer.setLength(size);
+			}
+			return buffer.toString();
+		}
+	}
+
+	public DbaseFile(File afile){
+		this(afile, null);
+	}
+
+	public DbaseFile(File afile, Charset chars) {
+		this.file = afile;
+		this.chars = chars;
+	}
+
+	public byte getCodePage() {
+		return myHeader.getLanguageID();
+	}
+
+	// Retrieve number of records in the DbaseFile
+	public int getRecordCount() {
+		return myHeader.getNumRecords();
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getFieldCount() {
+		return myHeader.getNumFields();
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param rowIndex
+	 *            DOCUMENT ME!
+	 * @param fieldId
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public boolean getBooleanFieldValue(int rowIndex, int fieldId) {
+		int recordOffset = (myHeader.getRecordLength() * rowIndex)
+				+ myHeader.getHeaderLength() + 1;
+
+		// Se calcula el offset del campo
+		int fieldOffset = 0;
+
+		for (int i = 0; i < (fieldId - 1); i++) {
+			fieldOffset += myHeader.getFieldLength(i);
+		}
+
+		buffer.position(recordOffset + fieldOffset);
+
+		char bool = (char) buffer.get();
+
+		return ((bool == 't') || (bool == 'T') || (bool == 'Y') || (bool == 'y'));
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param rowIndex
+	 *            DOCUMENT ME!
+	 * @param fieldId
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 * @throws UnsupportedEncodingException
+	 */
+	public String getStringFieldValue(int rowIndex, int fieldId)
+			throws UnsupportedEncodingException {
+		int fieldOffset = myHeader.getFieldDescription(fieldId).myFieldDataAddress;
+		byte[] data = new byte[myHeader.getFieldLength(fieldId)];
+		if (rowIndex != posActual) {
+			recordOffset = (myHeader.getRecordLength() * rowIndex)
+					+ myHeader.getHeaderLength() + 1;
+
+			/*
+			 * System.err.println("getStringFieldValue: rowIndex = " +
+			 * rowIndex); System.err.println("recordOffset = " + recordOffset + "
+			 * fieldOffset=" + fieldOffset);
+			 */
+
+			buffer.position(recordOffset);
+			buffer.get(bytesCachedRecord);
+			cachedRecord = ByteBuffer.wrap(bytesCachedRecord);
+			posActual = rowIndex;
+
+		}
+		cachedRecord.position(fieldOffset);
+		cachedRecord.get(data);
+
+		try {
+			return new String(data, chars.name());
+		} catch (java.io.UnsupportedEncodingException e) {
+			throw new UnsupportedEncodingException(
+					e);
+		}
+
+	}
+
+	public void setFieldValue(int rowIndex, int fieldId, Object obj) throws UnsupportedEncodingException, WriteException {
+		try{
+			int fieldOffset = myHeader.getFieldDescription(fieldId).myFieldDataAddress;
+			String str = fieldString(obj, fieldId);
+			byte[] data = new byte[myHeader.getFieldLength(fieldId)];
+			recordOffset = (myHeader.getRecordLength() * rowIndex)
+					+ myHeader.getHeaderLength() + 1;
+
+			ByteBuffer aux = ByteBuffer.wrap(data);
+			aux.put(str.getBytes(chars.name()));
+//			raf.seek(recordOffset + fieldOffset);
+//			raf.writeBytes(str);
+			aux.flip();
+//			int numBytesWritten = channel.write(aux, recordOffset + fieldOffset);
+			channel.write(aux, recordOffset + fieldOffset);
+			//channel.force(true);
+		}catch (java.io.UnsupportedEncodingException e) {
+			throw new UnsupportedEncodingException(e);
+		}catch (IOException e) {
+			throw new WriteException("DBF",e);
+		}
+
+	}
+
+
+	/**
+	 * Retrieve the name of the given column.
+	 *
+	 * @param inIndex
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public String getFieldName(int inIndex) {
+		return myHeader.getFieldName(inIndex).trim();
+	}
+
+	/**
+	 * Retrieve the type of the given column.
+	 *
+	 * @param inIndex
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public char getFieldType(int inIndex) {
+		return myHeader.getFieldType(inIndex);
+	}
+
+	/**
+	 * Retrieve the length of the given column.
+	 *
+	 * @param inIndex
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getFieldLength(int inIndex) {
+		return myHeader.getFieldLength(inIndex);
+	}
+
+	/*
+	 * Retrieve the value of the given column as string.
+	 *
+	 * @param idField DOCUMENT ME! @param idRecord DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 *
+	 * public Object getFieldValue(int idField, long idRecord) throws
+	 * IOException { Object[] tmpReg = getRecord(idRecord); return
+	 * tmpReg[idField]; }
+	 */
+	/*
+	 * DOCUMENT ME!
+	 *
+	 * @param idField DOCUMENT ME! @param idRecord DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 *
+	 * public double getFieldValueAsDouble(int idField, int idRecord) throws
+	 * IOException { Object[] tmpReg = getRecord(idRecord); return (double)
+	 * Double.parseDouble(tmpReg[idField].toString()); }
+	 */
+
+	/**
+	 * Retrieve the location of the decimal point.
+	 *
+	 * @param inIndex
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getFieldDecimalLength(int inIndex) {
+		return myHeader.getFieldDecimalCount(inIndex);
+	}
+
+	/**
+	 * read the DBF file into memory.
+	 *
+	 * @param file
+	 *            DOCUMENT ME!
+	 * @throws FileNotFoundException
+	 * @throws UnsupportedVersionException
+	 * @throws IOException
+	 *
+	 * @throws IOException
+	 *             DOCUMENT ME!
+	 */
+	public void open() throws FileNotFoundException,
+			UnsupportedVersionException, IOException {
+		/*
+		 * 01h DOS USA code page 437 02h DOS Multilingual code page 850 03h
+		 * Windows ANSI code page 1252 04h Standard Macintosh 64h EE MS-DOS code
+		 * page 852 65h Nordic MS-DOS code page 865 66h Russian MS-DOS code page
+		 * 866 67h Icelandic MS-DOS 68h Kamenicky (Czech) MS-DOS 69h Mazovia
+		 * (Polish) MS-DOS 6Ah Greek MS-DOS (437G) 6Bh Turkish MS-DOS 96h
+		 * Russian Macintosh 97h Eastern European Macintosh 98h Greek Macintosh
+		 * C8h Windows EE code page 1250 C9h Russian Windows CAh Turkish Windows
+		 * CBh Greek Windows
+		 */
+		if (!file.exists()) {
+			throw new FileNotFoundException(file);
+		}
+//		if (file.canWrite()) {
+//			try {
+//				raf = new RandomAccessFile(file, "rw");
+//				mode = FileChannel.MapMode.READ_WRITE;
+//			} catch (java.io.FileNotFoundException e) {
+//				raf = new RandomAccessFile(file, "r");
+//				mode = FileChannel.MapMode.READ_ONLY;
+//			}
+//		} else {
+			raf = new RandomAccessFile(file, "r");
+			mode = FileChannel.MapMode.READ_ONLY;
+//		}
+		channel = raf.getChannel();
+
+		// buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0,
+		// channel.size());
+		buffer = new BigByteBuffer2(channel, mode);
+
+		// create the header to contain the header information.
+		myHeader = new DbaseFileHeader();
+		if (chars == null) {
+			myHeader.readHeader(buffer, null);
+		} else {
+			myHeader.readHeader(buffer, chars.name());
+		}
+		charsOriginal = Charset.forName(myHeader.getCharsetName());
+		if (chars == null) {
+			chars = charsOriginal;
+		}
+		bytesCachedRecord = new byte[myHeader.getRecordLength()];
+		this.isOpen = true;
+	}
+
+	/**
+	 * Removes all data from the dataset
+	 * @throws CloseException
+	 *
+	 * @throws IOException
+	 *             DOCUMENT ME!
+	 */
+	public void close() throws CloseException {
+		try{
+		raf.close();
+		channel.close();
+		buffer = null;
+		posActual=-1;
+		myHeader = null;
+		}catch (Exception e) {
+			throw new CloseException("DBF",e);
+		}
+		this.isOpen = false;
+	}
+
+	public FileChannel getWriteChannel() {
+		return channel;
+	}
+
+	private String fieldString(Object obj, final int col) {
+		String o;
+		final int fieldLen = myHeader.getFieldLength(col);
+		switch (myHeader.getFieldType(col)) {
+		case 'C':
+		case 'c':
+			o = formatter.getFieldString(fieldLen, (obj == null) ? NULL_STRING
+					: ((String) obj));
+			break;
+		case 'L':
+		case 'l':
+			o = (obj == null) ? "F"
+					: ((Boolean) obj).booleanValue() == true ? "T" : "F";
+			break;
+		case 'M':
+		case 'G':
+			o = formatter.getFieldString(fieldLen, (obj == null) ? NULL_STRING
+					: ((String) obj));
+			break;
+		case 'N':
+		case 'n':
+		case 'F':
+		case 'f':
+			Number number = null;
+			if (obj == null) {
+				number = NULL_NUMBER;
+			} else {
+				Number gVal = (Number) obj;
+				number = new Double(gVal.doubleValue());
+			}
+			o = formatter.getFieldString(fieldLen, myHeader
+					.getFieldDecimalCount(col), number);
+			break;
+		case 'D':
+		case 'd':
+			if (obj == null) {
+				o = NULL_DATE;
+			} else {
+				o = formatter.getFieldString(((Date) obj));
+			}
+			break;
+		default:
+			throw new RuntimeException("Unknown type "
+					+ myHeader.getFieldType(col));
+		}
+
+		return o;
+	}
+
+	public boolean isOpen() {
+		return this.isOpen;
+	}
+
+	public int getFieldIndex(String name) {
+		return myHeader.getFieldIndex(name);
+	}
+
+	public Charset getCurrenCharset() {
+		return chars;
+	}
+
+	public Charset getOriginalCharset() {
+		return charsOriginal;
+	}
+
+	public void setCharset(Charset chars) {
+		this.chars = chars;
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileHeader.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileHeader.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileHeader.java	(revision 38736)
@@ -0,0 +1,729 @@
+/*
+ * Created on 16-feb-2004
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.gvsig.fmap.dal.store.dbf.utils;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.UnsupportedVersionException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeNotSuportedException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.utils.bigfile.BigByteBuffer2;
+
+
+
+/**
+ * Class to represent the header of a Dbase III file. Creation date: (5/15/2001
+ * 5:15:30 PM)
+ */
+public class DbaseFileHeader {
+    // Constant for the size of a record
+    private int FILE_DESCRIPTOR_SIZE = 32;
+
+	// type of the file, must be 03h
+	private static final byte MAGIC = 0x03;
+
+	private static final int MINIMUM_HEADER = 33;
+
+    // type of the file, must be 03h
+    private int myFileType = 0x03;
+
+    // Date the file was last updated.
+    private Date myUpdateDate = new Date();
+
+    // Number of records in the datafile
+	private int myNumRecords = 0;
+
+    // Length of the header structure
+    private int myHeaderLength;
+
+    /**
+     * Length of the records. Set to 1 as the default value as if there is
+     * not any defined column, at least the deleted status initial byte
+     * is taken into account.
+     */
+    private int myRecordLength = 1;
+
+    // Number of fields in the record.
+    private int myNumFields;
+
+    // collection of header records.
+    private DbaseFieldDescriptor[] myFieldDescriptions;
+
+	private byte myLanguageID;
+
+    /**
+     * DbaseFileHreader constructor comment.
+     */
+    public DbaseFileHeader() {
+        super();
+    }
+
+    /**
+     * Add a column to this DbaseFileHeader. The type is one of (C N L or D)
+     * character, number, logical(true/false), or date. The Field length is
+     * the total length in bytes reserved for this column. The decimal count
+     * only applies to numbers(N), and floating point values (F), and refers
+     * to the number of characters to reserve after the decimal point.
+     *
+     * @param inFieldName DOCUMENT ME!
+     * @param inFieldType DOCUMENT ME!
+     * @param inFieldLength DOCUMENT ME!
+     * @param inDecimalCount DOCUMENT ME!
+     * @throws BadFieldDriverException
+     *
+     * @throws Exception DOCUMENT ME!
+     */
+    public void addColumn(String inFieldName, char inFieldType,
+        int inFieldLength, int inDecimalCount)
+			throws AttributeFeatureTypeNotSuportedException {
+        if (inFieldLength <= 0) {
+            inFieldLength = 1;
+        }
+
+        if (myFieldDescriptions == null) {
+            myFieldDescriptions = new DbaseFieldDescriptor[0];
+        }
+
+        int tempLength = 1; // the length is used for the offset, and there is a * for deleted as the first byte
+        DbaseFieldDescriptor[] tempFieldDescriptors = new DbaseFieldDescriptor[myFieldDescriptions.length +
+            1];
+
+        for (int i = 0; i < myFieldDescriptions.length; i++) {
+            myFieldDescriptions[i].myFieldDataAddress = tempLength;
+            tempLength = tempLength + myFieldDescriptions[i].myFieldLength;
+            tempFieldDescriptors[i] = myFieldDescriptions[i];
+        }
+
+        tempFieldDescriptors[myFieldDescriptions.length] = new DbaseFieldDescriptor();
+        tempFieldDescriptors[myFieldDescriptions.length].myFieldLength = inFieldLength;
+        tempFieldDescriptors[myFieldDescriptions.length].myDecimalCount = inDecimalCount;
+        tempFieldDescriptors[myFieldDescriptions.length].myFieldDataAddress = tempLength;
+
+        // set the field name
+        String tempFieldName = inFieldName;
+
+        if (tempFieldName == null) {
+            tempFieldName = "NoName";
+        }
+
+        if (tempFieldName.length() > 11) {
+            tempFieldName = tempFieldName.substring(0, 11);
+            warn("FieldName " + inFieldName +
+                " is longer than 11 characters, truncating to " +
+                tempFieldName);
+        }
+
+        tempFieldDescriptors[myFieldDescriptions.length].myFieldName = tempFieldName;
+        tempFieldDescriptors[myFieldDescriptions.length].myFieldName_trim = tempFieldName
+				.trim();
+
+        // the field type
+        if ((inFieldType == 'C') || (inFieldType == 'c')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'C';
+
+            if (inFieldLength > 254) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength +
+                    " Which is longer than 254, not consistent with dbase III");
+            }
+        } else if ((inFieldType == 'S') || (inFieldType == 's')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'C';
+            warn("Field type for " + inFieldName +
+                " set to S which is flat out wrong people!, I am setting this to C, in the hopes you meant character.");
+
+            if (inFieldLength > 254) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength +
+                    " Which is longer than 254, not consistent with dbase III");
+            }
+
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldLength = 8;
+        } else if ((inFieldType == 'D') || (inFieldType == 'd')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'D';
+
+            if (inFieldLength != 8) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength + " Setting to 8 digets YYYYMMDD");
+            }
+
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldLength = 8;
+        } else if ((inFieldType == 'F') || (inFieldType == 'f')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'F';
+
+            if (inFieldLength > 20) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength +
+                    " Preserving length, but should be set to Max of 20 not valid for dbase IV, and UP specification, not present in dbaseIII.");
+            }
+        } else if ((inFieldType == 'N') || (inFieldType == 'n')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'N';
+
+            if (inFieldLength > 18) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength +
+                    " Preserving length, but should be set to Max of 18 for dbase III specification.");
+            }
+
+            if (inDecimalCount < 0) {
+                warn("Field Decimal Position for " + inFieldName + " set to " +
+                    inDecimalCount +
+                    " Setting to 0 no decimal data will be saved.");
+                tempFieldDescriptors[myFieldDescriptions.length].myDecimalCount = 0;
+            }
+//
+//            if (inDecimalCount > (inFieldLength - 1)) {
+//                warn("Field Decimal Position for " + inFieldName + " set to " +
+//                    inDecimalCount + " Setting to " + (inFieldLength - 1) +
+//                    " no non decimal data will be saved.");
+//                tempFieldDescriptors[myFieldDescriptions.length].myDecimalCount = inFieldLength -
+//                    1;
+//            }
+        } else if ((inFieldType == 'L') || (inFieldType == 'l')) {
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldType = 'L';
+
+            if (inFieldLength != 1) {
+                warn("Field Length for " + inFieldName + " set to " +
+                    inFieldLength +
+                    " Setting to length of 1 for logical fields.");
+            }
+
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldLength = 1;
+        } else {
+            throw new AttributeFeatureTypeNotSuportedException(tempFieldName,
+					inFieldType, ToolsLocator.getDataTypesManager().getTypeName(inFieldType), "DBF");
+        }
+
+        // the length of a record
+        tempLength = tempLength +
+            tempFieldDescriptors[myFieldDescriptions.length].myFieldLength;
+
+        // set the new fields.
+        myFieldDescriptions = tempFieldDescriptors;
+        myHeaderLength = 33 + (32 * myFieldDescriptions.length);
+        myNumFields = myFieldDescriptions.length;
+        myRecordLength = tempLength;
+    }
+
+    /**
+     * Remove a column from this DbaseFileHeader.
+     *
+     * @param inFieldName DOCUMENT ME!
+     *
+     * @return index of the removed column, -1 if no found
+     */
+    public int removeColumn(String inFieldName) {
+        int retCol = -1;
+        int tempLength = 1;
+        DbaseFieldDescriptor[] tempFieldDescriptors = new DbaseFieldDescriptor[myFieldDescriptions.length -
+            1];
+
+        for (int i = 0, j = 0; i < myFieldDescriptions.length; i++) {
+            if (!inFieldName.equalsIgnoreCase(
+                        myFieldDescriptions[i].myFieldName.trim())) {
+                // if this is the last field and we still haven't found the
+                // named field
+                if ((i == j) && (i == (myFieldDescriptions.length - 1))) {
+                    System.err.println("Could not find a field named '" +
+                        inFieldName + "' for removal");
+
+                    return retCol;
+                }
+
+                tempFieldDescriptors[j] = myFieldDescriptions[i];
+                tempFieldDescriptors[j].myFieldDataAddress = tempLength;
+                tempLength += tempFieldDescriptors[j].myFieldLength;
+
+                // only increment j on non-matching fields
+                j++;
+            } else {
+                retCol = i;
+            }
+        }
+
+        // set the new fields.
+        myFieldDescriptions = tempFieldDescriptors;
+        myHeaderLength = 33 + (32 * myFieldDescriptions.length);
+        myNumFields = myFieldDescriptions.length;
+        myRecordLength = tempLength;
+
+        return retCol;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param inWarn DOCUMENT ME!
+     */
+    private void warn(String inWarn) {
+        //TODO Descomentar esto cuando tenga la clase warning support
+        //    	warnings.warn(inWarn);
+    }
+
+    /**
+     * Return the Field Descriptor for the given field.
+     *
+     * @param inIndex DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
+    public DbaseFieldDescriptor getFieldDescription(int inIndex) {
+        return myFieldDescriptions[inIndex];
+    }
+
+    // Retrieve the length of the field at the given index
+    public int getFieldLength(int inIndex) {
+        return myFieldDescriptions[inIndex].myFieldLength;
+    }
+
+    // Retrieve the location of the decimal point within the field.
+    public int getFieldDecimalCount(int inIndex) {
+        return myFieldDescriptions[inIndex].myDecimalCount;
+    }
+
+    // Retrieve the Name of the field at the given index
+    public String getFieldName(int inIndex) {
+        return myFieldDescriptions[inIndex].myFieldName;
+    }
+
+    public int getFieldIndex(String name) {
+		for (int i = 0; i < myFieldDescriptions.length; i++) {
+			if (myFieldDescriptions[i].myFieldName_trim
+					.equalsIgnoreCase(name)) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+    // Retrieve the type of field at the given index
+    public char getFieldType(int inIndex) {
+        return myFieldDescriptions[inIndex].myFieldType;
+    }
+
+    /**
+     * Return the date this file was last updated.
+     *
+     * @return DOCUMENT ME!
+     */
+    public Date getLastUpdateDate() {
+        return myUpdateDate;
+    }
+
+     /**
+     * Return the number of fields in the records.
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getNumFields() {
+        return myNumFields;
+    }
+
+    /**
+     * Return the number of records in the file
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getNumRecords() {
+        return myNumRecords;
+    }
+
+    /**
+     * Return the length of the records in bytes.
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getRecordLength() {
+        return myRecordLength;
+    }
+
+    /**
+     * Return the length of the header
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getHeaderLength() {
+        return myHeaderLength;
+    }
+
+	/**
+	 * Read the header data from the DBF file.
+	 *
+	 * @param in
+	 *            DOCUMENT ME!
+	 * @throws UnsupportedVersionException
+	 * @throws UnsupportedEncodingException
+	 *
+	 * @throws IOException
+	 *             DOCUMENT ME!
+	 */
+    public void readHeader(BigByteBuffer2 in, String charsName)
+			throws UnsupportedVersionException, UnsupportedEncodingException {
+        // type of file.
+        myFileType = in.get();
+
+        if (myFileType != 0x03) {
+            throw new UnsupportedVersionException("DBF", Integer
+					.toHexString(myFileType));
+        }
+
+        // parse the update date information.
+        int tempUpdateYear = in.get();
+        int tempUpdateMonth = in.get();
+        int tempUpdateDay = in.get();
+        tempUpdateYear = tempUpdateYear + 1900;
+
+        Calendar c = Calendar.getInstance();
+        c.set(Calendar.YEAR, tempUpdateYear);
+        c.set(Calendar.MONTH, tempUpdateMonth - 1);
+        c.set(Calendar.DATE, tempUpdateDay);
+        myUpdateDate = c.getTime();
+
+        // read the number of records.
+        in.order(ByteOrder.LITTLE_ENDIAN);
+        myNumRecords = in.getInt();
+
+        // read the length of the header structure.
+        myHeaderLength = in.getShort();
+
+        // read the length of a record
+        myRecordLength = in.getShort(); //posicon 0h
+
+        in.order(ByteOrder.BIG_ENDIAN);
+
+        // skip the reserved bytes in the header.
+        // in.position(in.position() + 20);
+
+        // Leemos el byte de language
+        in.position(29);
+        myLanguageID = in.get();
+        if (charsName == null) {
+        	charsName = getCharsetName();
+		}
+
+
+        // Posicionamos para empezar a leer los campos.
+        in.position(32);
+
+        // calculate the number of Fields in the header
+        myNumFields = (myHeaderLength - FILE_DESCRIPTOR_SIZE - 1) / FILE_DESCRIPTOR_SIZE;
+
+        // read all of the header records
+        myFieldDescriptions = new DbaseFieldDescriptor[myNumFields];
+        int fieldOffset = 0;
+
+        for (int i = 0; i < myNumFields; i++) {
+            myFieldDescriptions[i] = new DbaseFieldDescriptor();
+
+            // read the field name
+            byte[] buffer = new byte[11];
+            in.get(buffer);
+            if (charsName != null) {
+				myFieldDescriptions[i].myFieldName = new String(buffer,
+						charsName);
+			} else {
+				myFieldDescriptions[i].myFieldName = new String(buffer);
+			}
+            myFieldDescriptions[i].myFieldName_trim = myFieldDescriptions[i].myFieldName
+					.trim();
+
+            // read the field type
+            myFieldDescriptions[i].myFieldType = (char) in.get();
+
+            // read the field data address, offset from the start of the record.
+            myFieldDescriptions[i].myFieldDataAddress = in.getInt();
+
+            // read the field length in bytes
+            int tempLength = in.get();
+
+            if (tempLength < 0) {
+                tempLength = tempLength + 256;
+            }
+
+            myFieldDescriptions[i].myFieldLength = tempLength;
+
+            // read the field decimal count in bytes
+            myFieldDescriptions[i].myDecimalCount = in.get();
+
+            // NUEVO: Calculamos los offsets aqu� para no
+            // tener que recalcular cada vez que nos piden
+            // algo.
+            myFieldDescriptions[i].myFieldDataAddress = fieldOffset;
+            fieldOffset += tempLength;
+            // Fin NUEVO
+            // read the reserved bytes.
+            in.position(in.position() + 14);
+        }
+
+        // Last byte is a marker for the end of the field definitions.
+        in.get();
+    }
+
+    /**
+     * Set the number of records in the file
+     *
+     * @param inNumRecords DOCUMENT ME!
+     */
+    public void setNumRecords(int inNumRecords) {
+        myNumRecords = inNumRecords;
+    }
+
+    /*
+     * Write the header data to the DBF file.
+     *
+     * @param out DOCUMENT ME!
+     *
+     * @throws Exception DOCUMENT ME!
+     *
+           public void writeHeader(LEDataOutputStream out) throws Exception {
+               // write the output file type.
+               out.writeByte(myFileType);
+               // write the date stuff
+               Calendar c = Calendar.getInstance();
+               c.setTime(new Date());
+               out.writeByte(c.get(Calendar.YEAR) - 1900);
+               out.writeByte(c.get(Calendar.MONTH) + 1);
+               out.writeByte(c.get(Calendar.DAY_OF_MONTH));
+               // write the number of records in the datafile.
+               out.writeInt(myNumRecords);
+               // write the length of the header structure.
+               out.writeShort(myHeaderLength);
+               // write the length of a record
+               out.writeShort(myRecordLength);
+               // write the reserved bytes in the header
+               for (int i = 0; i < 20; i++)
+                   out.writeByte(0);
+               // write all of the header records
+               int tempOffset = 0;
+               for (int i = 0; i < myFieldDescriptions.length; i++) {
+                   // write the field name
+                   for (int j = 0; j < 11; j++) {
+                       if (myFieldDescriptions[i].myFieldName.length() > j) {
+                           out.writeByte((int) myFieldDescriptions[i].myFieldName.charAt(
+                                   j));
+                       } else {
+                           out.writeByte(0);
+                       }
+                   }
+                   // write the field type
+                   out.writeByte(myFieldDescriptions[i].myFieldType);
+                   // write the field data address, offset from the start of the record.
+                   out.writeInt(tempOffset);
+                   tempOffset += myFieldDescriptions[i].myFieldLength;
+                   // write the length of the field.
+                   out.writeByte(myFieldDescriptions[i].myFieldLength);
+                   // write the decimal count.
+                   out.writeByte(myFieldDescriptions[i].myDecimalCount);
+                   // write the reserved bytes.
+                   for (int j = 0; j < 14; j++)
+                       out.writeByte(0);
+               }
+               // write the end of the field definitions marker
+               out.writeByte(0x0D);
+           }
+     */
+
+    /**
+     * Class for holding the information assicated with a record.
+     */
+    class DbaseFieldDescriptor {
+        // Field Name
+        String myFieldName;
+
+        String myFieldName_trim;
+
+        // Field Type (C N L D F or M)
+        char myFieldType;
+
+        // Field Data Address offset from the start of the record.
+        int myFieldDataAddress;
+
+        // Length of the data in bytes
+        int myFieldLength;
+
+        // Field decimal count in Binary, indicating where the decimal is
+        int myDecimalCount;
+    }
+
+	public byte getLanguageID() {
+		return myLanguageID;
+	}
+
+
+
+	public static DbaseFileHeader createDbaseHeader(FeatureType featureType)
+			throws AttributeFeatureTypeNotSuportedException {
+		DbaseFileHeader header = new DbaseFileHeader();
+		Iterator iterator=featureType.iterator();
+		// TODO header.myLanguageID = langId;
+		while (iterator.hasNext()) {
+			FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator.next();
+
+
+			int type = descriptor.getType();
+			String colName = descriptor.getName();
+
+			int fieldLen = descriptor.getSize(); // TODO aqu� el
+			// tama�o no es
+			// correcto hay que
+			// calcularlo, ahora
+			// mismo est� puesto
+			// a pi��n.
+			int decimales = descriptor.getPrecision();
+			if ((type==DataTypes.DOUBLE || type==DataTypes.FLOAT) && decimales==0){
+				decimales=1;
+			}
+
+			if (DataTypes.DOUBLE == type || DataTypes.FLOAT == type
+					|| DataTypes.INT == type || DataTypes.LONG == type) {
+				header.addColumn(colName, 'N', Math.min(fieldLen, 18),
+						decimales);
+			} else if (DataTypes.DATE == type) {
+				header.addColumn(colName, 'D', fieldLen, 0);
+			} else if (DataTypes.BOOLEAN == type) {
+				header.addColumn(colName, 'L', 1, 0);
+			} else if (DataTypes.STRING == type) {
+				header.addColumn(colName, 'C', Math.min(254, fieldLen), 0);
+			}
+
+
+		}
+		return header;
+	}
+	/**
+	 * Write the header data to the DBF file.
+	 *
+	 * @param out
+	 *            A channel to write to. If you have an OutputStream you can
+	 *            obtain the correct channel by using
+	 *            java.nio.Channels.newChannel(OutputStream out).
+	 *
+	 * @throws IOException
+	 *             If errors occur.
+	 */
+	public void writeHeader(FileChannel out) throws IOException {
+		// take care of the annoying case where no records have been added...
+		if (myHeaderLength <= 0) {
+			myHeaderLength = MINIMUM_HEADER;
+		}
+
+		// Desde el principio
+		out.position(0);
+
+		ByteBuffer buffer = ByteBuffer.allocateDirect(myHeaderLength);
+		buffer.order(ByteOrder.LITTLE_ENDIAN);
+
+		// write the output file type.
+		buffer.put(MAGIC);
+
+		// write the date stuff
+		Calendar c = Calendar.getInstance();
+		c.setTime(new Date());
+		buffer.put((byte) (c.get(Calendar.YEAR) % 100));
+		buffer.put((byte) (c.get(Calendar.MONTH) + 1));
+		buffer.put((byte) (c.get(Calendar.DAY_OF_MONTH)));
+
+		// write the number of records in the datafile.
+		buffer.putInt(myNumRecords);
+
+		// write the length of the header structure.
+		buffer.putShort((short) myHeaderLength);
+
+		// write the length of a record
+		buffer.putShort((short) myRecordLength);
+
+		// // write the reserved bytes in the header
+		// for (int i=0; i<20; i++) out.writeByteLE(0);
+		buffer.position(buffer.position() + 20);
+
+		// write all of the header records
+		int tempOffset = 0;
+
+		if (myFieldDescriptions != null) {
+			for (int i = 0; i < myFieldDescriptions.length; i++) {
+				// write the field name
+				for (int j = 0; j < 11; j++) {
+					if (myFieldDescriptions[i].myFieldName.length() > j) {
+						buffer.put((byte) myFieldDescriptions[i].myFieldName.charAt(j));
+					} else {
+						buffer.put((byte) 0);
+					}
+				}
+
+				// write the field type
+				buffer.put((byte) myFieldDescriptions[i].myFieldType);
+
+				// // write the field data address, offset from the start of the
+				// record.
+				buffer.putInt(tempOffset);
+				tempOffset += myFieldDescriptions[i].myFieldLength;
+
+				// write the length of the field.
+				buffer.put((byte) myFieldDescriptions[i].myFieldLength);
+
+				// write the decimal count.
+				buffer.put((byte) myFieldDescriptions[i].myDecimalCount);
+
+				// write the reserved bytes.
+				// for (in j=0; jj<14; j++) out.writeByteLE(0);
+				buffer.position(buffer.position() + 14);
+			}
+		}
+		// write the end of the field definitions marker
+		buffer.put((byte) 0x0D);
+
+		buffer.position(0);
+
+		int r = buffer.remaining();
+
+		while ((r -= out.write(buffer)) > 0) {
+			; // do nothing
+		}
+	}
+
+	public String getCharsetName() {
+		switch (getLanguageID()) {
+		case 0x01:
+			return "US-ASCII";
+		case 0x02:
+			return "ISO-8859-1";
+		case 0x03:
+			return "windows-1252";
+		case 0x04:
+			return "mac";
+		case 0x64:
+			return "ISO-8859-1";
+		case 0x65:
+			return "ISO-8859-1";
+		case 0x66:
+			return "ISO-8859-1";
+		case 0x67:
+			return "ISO-8859-1";
+		case 0x68:
+			return "greek";
+		case 0x69:
+			return "ISO-8859-1";
+		case 0x6A:
+			return "greek";
+		case 0x6B:
+			return "ISO-8859-1";
+
+		default:
+			return "ISO-8859-1";
+		}
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFileHeader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/MyTransform.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/MyTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/MyTransform.java	(revision 38736)
@@ -0,0 +1,156 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class MyTransform extends AbstractFeatureStoreTransform {
+
+    private String geomName;
+	private String xname;
+	private String yname;
+
+    private GeometryManager geomManager;
+
+	/**
+	 * A default constructor with out parameters
+	 */
+	public MyTransform() {
+		this.geomManager = GeometryLocator.getGeometryManager();
+
+	}
+
+	/**
+	 * Initializes the transform by assigning the source store and the names of
+	 * the necessary attributes.
+	 *
+	 * @param store
+	 *            source store.
+	 *
+	 * @param geomName
+	 *            name of the geometry attribute in the default feature type
+	 *            from the source store.
+	 *
+	 * @param xname
+	 *            name of the attribute containing the X coordinates
+	 *
+	 * @param yname
+	 *            name of the attribute containing the Y coordinates
+	 *
+	 * @throws DataException
+	 */
+	public MyTransform initialize(FeatureStore store, String geomName,
+			String xname, String yname) throws DataException {
+
+		// Initialize some data
+		setFeatureStore(store);
+		this.geomName = geomName;
+		this.xname = xname;
+		this.yname = yname;
+
+		// obtain the feature type, add the new attribute
+		// and keep a reference to the
+		// resulting feature type
+		EditableFeatureType type = getFeatureStore().getDefaultFeatureType()
+				.getEditable();
+		type.add(geomName, DataTypes.GEOMETRY);
+		List list = new ArrayList(1);
+		list.add(type.getNotEditableCopy());
+		setFeatureTypes(list, (FeatureType) list.get(0));
+		return this;
+	}
+
+	/**
+	 * Applies this transform to a target editable feature, using data from the
+	 * source feature.
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+
+		// copy source feature data over target feature
+		target.copyFrom(source);
+
+		// calculate and assign new attribute's value
+		Geometry geom;
+		try {
+			geom = geomManager.createPoint(source.getDouble(xname), source
+					.getDouble(yname), Geometry.SUBTYPES.GEOM2D);
+		} catch (CreateGeometryException e) {
+			throw new ReadException("XYTranform", e);
+		}
+		target.setGeometry(this.geomName, geom);
+	}
+
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("xname", xname);
+		state.set("yname", yname);
+		state.set("geomName", geomName);
+	}
+
+    public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		this.xname = state.getString("xname");
+		this.yname = state.getString("yname");
+		this.geomName = state.getString("geomName");
+	}
+
+    /**
+	 * Returns the FeatureType to use to get data from original store
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		EditableFeatureType ed = targetFeatureType.getEditable();
+		ed.remove(this.geomName);
+		return ed.getNotEditableCopy();
+	}
+
+	/**
+	 * Informs that original values of store don't will be modified
+	 */
+	public boolean isTransformsOriginalValues() {
+		return false;
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/MyTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureProvider.java	(revision 38736)
@@ -0,0 +1,79 @@
+package org.gvsig.fmap.dal.store.dbf;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadRuntimeException;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+public class DBFFeatureProvider extends DefaultFeatureProvider {
+	protected DBFStoreProvider store;
+	protected boolean loading;
+	protected boolean loaded;
+
+	public DBFFeatureProvider(DBFStoreProvider store, FeatureType type) {
+		super(type);
+		this.store = store;
+		loading = false;
+		loaded = false;
+	}
+
+	protected void load() {
+		if (loading || loaded || this.isNew()) {
+			return;
+		}
+		loading = true;
+		try {
+			this.store.loadFeatureProviderByIndex(this);
+		} catch (DataException e) {
+			throw new ReadRuntimeException("DBFFeatureProvider.load", e);
+		} finally {
+			loading = false;
+			loaded = true;
+		}
+	}
+
+	public void set(int i, Object value) {
+		this.load();
+		super.set(i, value);
+	}
+
+	public void set(String name, Object value) {
+		this.load();
+		super.set(featureType.getIndex(name), value);
+	}
+
+	public Object get(int i) {
+		this.load();
+		return super.get(i);
+	}
+
+	public Object get(String name) {
+		this.load();
+		return super.get(name);
+	}
+
+	public Geometry getDefaultGeometry() {
+		return null;
+	}
+
+	public Envelope getDefaultEnvelope() {
+		return null;
+	}
+
+	public void setOID(Object oid) {
+		this.loaded = false;
+		super.setOID(oid);
+	}
+
+	public FeatureProvider getCopy() {
+		this.load();
+		return super.getCopy();
+	}
+
+
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFilesystemServerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFilesystemServerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFilesystemServerProvider.java	(revision 38736)
@@ -0,0 +1,183 @@
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.AbsolutePathRequiredException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+
+public class DBFFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider 
+	implements FilesystemServerExplorerProvider, ResourceConsumer {
+
+	protected FilesystemServerExplorerProviderServices serverExplorer;
+
+	public String getDataStoreProviderName() {
+		return DBFStoreProvider.NAME;
+	}
+
+	public int getMode() {
+		return DataServerExplorer.MODE_FEATURE;
+	}
+
+	public boolean accept(File pathname) {
+		return (pathname.getName().toLowerCase().endsWith(".dbf"));
+	}
+
+	public String getDescription() {
+		return DBFStoreProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		DBFStoreParameters params = (DBFStoreParameters) manager
+				.createStoreParameters(this.getDataStoreProviderName());
+		params.setDBFFile(file.getPath());
+		return params;
+	}
+
+	public boolean canCreate() {
+		return true;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		DBFNewStoreParameters params = (DBFNewStoreParameters) parameters;
+		if (params.getDBFFile().getParentFile().canWrite()) {
+			return false;
+		}
+		if (params.getDBFFile().exists()) {
+			if (!params.getDBFFile().canWrite()) {
+				return false;
+			}
+		}
+		if (params.getDefaultFeatureType() == null) {
+			return false;
+		}
+		return true;
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+
+		final DBFNewStoreParameters params = (DBFNewStoreParameters) parameters;
+		File file = params.getDBFFile();
+		
+		if (!file.isAbsolute()) {
+			throw new AbsolutePathRequiredException(file.getPath());
+		}
+
+
+		if (file.exists()) {
+			if (overwrite) {
+//				if (!file.delete()) {
+//					throw new CreateException(this.getDataStoreProviderName(),
+//							new IOException(
+//							"cannot delete file"));
+//				}
+			} else {
+				throw new CreateException(this.getDataStoreProviderName(),
+						new IOException(
+						"file already exist"));
+			}
+		}
+
+		final FileResource resource;
+		try {
+
+			resource = (FileResource) this.serverExplorer
+					.getServerExplorerProviderServices().createResource(
+							FileResource.NAME,
+					new Object[] { file.getAbsolutePath() });
+		} catch (InitializeException e1) {
+			throw new CreateException(params.getDBFFileName(), e1);
+		}
+		resource.addConsumer(this);
+
+		try {
+			resource.execute(new ResourceAction() {
+				public Object run() throws Exception {
+					DBFFeatureWriter writer =
+							new DBFFeatureWriter(getDataStoreProviderName());
+
+					writer.begin(params, params.getDefaultFeatureType(), 0);
+					writer.end();
+					writer.dispose();
+					resource.notifyChanges();
+					return null;
+				}
+			});
+		} catch (ResourceExecuteException e) {
+			throw new CreateException(this.getDataStoreProviderName(), e);
+		} finally {
+			resource.removeConsumer(this);
+		}
+
+
+	}
+
+
+	protected NewDataStoreParameters createInstanceNewDataStoreParameters() {
+		return new DBFNewStoreParameters();
+	}
+
+
+	public NewDataStoreParameters getCreateParameters() {
+		NewFeatureStoreParameters params = (NewFeatureStoreParameters) this
+				.createInstanceNewDataStoreParameters();
+		params.setDefaultFeatureType(this.serverExplorer
+				.getServerExplorerProviderServices().createNewFeatureType());
+		return params;
+	}
+
+	public void initialize(FilesystemServerExplorerProviderServices serverExplorer) {
+		this.serverExplorer = serverExplorer;
+
+	}
+
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		DBFStoreParameters params = (DBFStoreParameters) parameters;
+		File file = params.getDBFFile();
+		if (!file.exists()) {
+			throw new RemoveException(this.getDataStoreProviderName(),
+					new FileNotFoundException(params.getDBFFile()));
+		}
+		if (!file.delete()) {
+			throw new RemoveException(this.getDataStoreProviderName(),
+					new IOException()); // FIXME Exception
+		}
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		// while it is using a resource anyone can't close it
+		return !(this.equals(resource));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
+	 */
+	public void resourceChanged(ResourceProvider resource) {
+		// Do nothing
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFilesystemServerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFSetProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFSetProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFSetProvider.java	(revision 38736)
@@ -0,0 +1,146 @@
+/**
+ *
+ */
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadRuntimeException;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureProviderIterator;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureSetProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * @author jjdelcerro
+ *
+ */
+public class DBFSetProvider extends AbstractFeatureSetProvider {
+
+	public DBFSetProvider(DBFStoreProvider store, FeatureQuery query,
+			FeatureType featureType)
+			throws DataException {
+		super(store, query, featureType);
+	}
+
+	public boolean canFilter() {
+		return false;
+	}
+
+	public boolean canIterateFromIndex() {
+		return true;
+	}
+
+	public boolean canOrder() {
+		return false;
+	}
+
+	public long getSize() throws DataException {
+		return getStore().getFeatureCount();
+	}
+
+	public boolean isEmpty() throws DataException {
+		return getSize() == 0;
+	}
+
+	@Override
+	protected void doDispose() throws BaseException {
+	}
+
+	protected AbstractFeatureProviderIterator createIterator(long index)
+			throws DataException {
+		return new DBFIterator((DBFStoreProvider) getStore(), getFeatureType(),
+				index);
+	}
+
+	protected AbstractFeatureProviderIterator createFastIterator(long index)
+			throws DataException {
+		return new FastDBFIterator((DBFStoreProvider) getStore(),
+				getFeatureType(), index);
+	}
+
+	protected class DBFIterator extends AbstractFeatureProviderIterator {
+		protected long index;
+		protected FeatureType type;
+		protected long count;
+
+		public DBFIterator(DBFStoreProvider store, FeatureType type,
+				long startOn) throws DataException {
+			super(store);
+			this.index = startOn;
+			this.type = type;
+			this.count = store.getFeatureCount();
+		}
+
+		protected boolean internalHasNext() {
+			return this.count > index;
+		}
+
+		protected Object internalNext() {
+			if (index >= this.count) {
+				throw new NoSuchElementException();
+			}
+			try {
+
+				FeatureProvider ret =
+						getDBFStoreProvider().getFeatureProviderByIndex(index,
+								this.type);
+				index++;
+				return ret;
+			} catch (DataException e) {
+				throw new ReadRuntimeException(getDBFStoreProvider().getProviderName(),
+						e);
+			}
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		protected void internalDispose() {
+			type = null;
+		}
+
+		protected DBFStoreProvider getDBFStoreProvider() {
+			return (DBFStoreProvider) getFeatureStoreProvider();
+		}
+
+		@Override
+		protected void doDispose() throws BaseException {
+			// Nothing to do
+		}
+	}
+
+	protected class FastDBFIterator extends DBFIterator {
+		protected FeatureProvider data;
+
+		public FastDBFIterator(DBFStoreProvider store, FeatureType type,
+				long startOn) throws DataException {
+			super(store, type, startOn);
+			this.data = getFeatureStoreProvider().createFeatureProvider(type);
+		}
+
+		protected Object internalNext() {
+			if (index >= this.count) {
+				throw new NoSuchElementException();
+			}
+
+			try {
+				getDBFStoreProvider().initFeatureProviderByIndex(this.data,
+						index, type);
+			} catch (DataException e) {
+				throw new ReadRuntimeException("next", e);
+			}
+			index++;
+			return this.data;
+		}
+
+		protected void internalDispose() {
+			super.internalDispose();
+			data = null;
+		}
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFSetProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java	(revision 38736)
@@ -0,0 +1,751 @@
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.UnsupportedVersionException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.exception.UnknownDataTypeException;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.dal.store.dbf.utils.DbaseFile;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.exception.BaseException;
+
+public class DBFStoreProvider extends AbstractFeatureStoreProvider implements
+		ResourceConsumer {
+
+//	private static final Logger LOG = LoggerFactory.getLogger(DBFStoreProvider.class);
+
+	public static String NAME = "DBF";
+	public static String DESCRIPTION = "DBF file";
+	private static final Locale ukLocale = new Locale("en", "UK");
+	
+	public static final String METADATA_DEFINITION_NAME = NAME;
+	private static final String METADATA_ENCODING = "Encoding";
+	private static final String METADATA_CODEPAGE = "CodePage";
+		
+	private DbaseFile dbfFile = null;
+	private ResourceProvider dbfResource;
+	private long counterNewsOIDs = -1;
+	private DBFFeatureWriter writer;
+
+
+	protected static void registerMetadataDefinition() throws MetadataException {
+		MetadataManager manager = MetadataLocator.getMetadataManager();
+		if( manager.getDefinition(METADATA_DEFINITION_NAME)==null ) {
+			manager.addDefinition(
+					METADATA_DEFINITION_NAME, 
+					DBFStoreParameters.class.getResourceAsStream("DBFStoreMetadata.xml"),
+					DBFStoreParameters.class.getClassLoader()
+			);
+		}
+	}
+
+	public DBFStoreProvider(DBFStoreParameters params,
+			DataStoreProviderServices storeServices)
+			throws InitializeException {
+		super(
+				params, 
+				storeServices,
+				FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME)
+		);
+		this.init(params, storeServices);
+	}
+
+	protected DBFStoreProvider(DBFStoreParameters params,
+			DataStoreProviderServices storeServices, DynObject metadata)
+			throws InitializeException {
+		super(params, storeServices, metadata);
+		this.init(params, storeServices);
+	}
+
+	protected void init(DBFStoreParameters params,
+			DataStoreProviderServices storeServices) throws InitializeException {
+		if( params == null ) {
+			throw new InitializeException( new NullPointerException("params is null") );
+		}
+		File theFile = getDBFParameters().getDBFFile();
+		if( theFile == null ) {
+			throw new InitializeException( new NullPointerException("dbf file is null") );
+		}
+		initResource(params, storeServices);
+
+		Charset charset = params.getEncoding();
+		this.dbfFile = new DbaseFile(theFile, charset);
+
+		writer = new DBFFeatureWriter(this.getProviderName());
+
+		this.initFeatureType();
+
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		try {
+			this.open();
+		} catch (OpenException e) {
+			throw new RuntimeException(e);
+		}
+		if( METADATA_ENCODING.equalsIgnoreCase(name) ) {
+			return this.dbfFile.getOriginalCharset();
+		} else if( METADATA_CODEPAGE.equalsIgnoreCase(name) ) {
+			return new Byte(this.dbfFile.getCodePage());
+		}
+		return super.getDynValue(name);
+	}
+
+	protected void initResource(DBFStoreParameters params,
+			DataStoreProviderServices storeServices) throws InitializeException {
+
+		File theFile = getDBFParameters().getDBFFile();
+		dbfResource =
+				this.createResource(FileResource.NAME,
+						new Object[] { theFile.getAbsolutePath() });
+		dbfResource.addConsumer(this);
+	}
+
+	public String getProviderName() {
+		return NAME;
+	}
+
+	protected DBFStoreParameters getDBFParameters() {
+		return (DBFStoreParameters) super.getParameters();
+	}
+
+
+	public DataServerExplorer getExplorer() throws ReadException {
+		DataManager manager = DALLocator.getDataManager();
+		FilesystemServerExplorerParameters params;
+		try {
+			params = (FilesystemServerExplorerParameters) manager
+					.createServerExplorerParameters(FilesystemServerExplorer.NAME);
+			params.setRoot(this.getDBFParameters().getDBFFile().getParent());
+			return manager.openServerExplorer(FilesystemServerExplorer.NAME,params);
+		} catch (DataException e) {
+			throw new ReadException(this.getProviderName(), e);
+		} catch (ValidateDataParametersException e) {
+			// TODO Auto-generated catch block
+			throw new ReadException(this.getProviderName(), e);
+		}
+	}
+
+	protected FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference, FeatureType featureType)
+			throws DataException {
+		return this.getFeatureProviderByIndex(
+				((Long) reference.getOID()).longValue(), featureType);
+	}
+
+	public void performChanges(Iterator deleteds, Iterator inserteds,
+			Iterator updateds, Iterator originalFeatureTypesUpdated)
+			throws PerformEditingException {
+
+		try {
+			final FeatureStore store =
+					this.getStoreServices().getFeatureStore();
+			getResource().execute(new ResourceAction() {
+
+				public Object run() throws Exception {
+					FeatureSet set = null;
+					DisposableIterator iter = null;
+					try {
+						set = store.getFeatureSet();
+						DBFStoreParameters tmpParams =
+								(DBFStoreParameters) getDBFParameters().getCopy();
+
+						tmpParams.setDBFFile(tmpParams.getDBFFileName()
+								+ ".tmp");
+
+						writer.begin(tmpParams, store.getDefaultFeatureType(),
+								set.getSize());
+
+						iter = set.fastIterator();
+						while (iter.hasNext()) {
+							Feature feature = (Feature) iter.next();
+							writer.append(feature);
+						}
+
+						writer.end();
+
+						try {
+							close();
+						} catch (CloseException e1) {
+							throw new PerformEditingException(getProviderName(), e1);
+						}
+						getDBFParameters().getDBFFile().delete();
+						tmpParams.getDBFFile().renameTo(
+								getDBFParameters().getDBFFile());
+
+						resourcesNotifyChanges();
+						initFeatureType();
+					} finally {
+						if (set != null) {
+							set.dispose();
+						}
+						if (iter != null) {
+							iter.dispose();
+						}
+					}
+					return null;
+				}
+			});
+		} catch (ResourceExecuteException e) {
+			throw new PerformEditingException(this.getProviderName(), e);
+		}
+
+		this.counterNewsOIDs = -1;
+	}
+
+	/*
+	 * ==================================================
+	 */
+
+	public FeatureProvider createFeatureProvider(FeatureType type) throws DataException {
+		return new DBFFeatureProvider(this, type);
+	}
+
+
+	/*
+	 * ===================================================
+	 */
+
+
+
+	protected void initFeatureType() throws InitializeException {
+		try {
+			FeatureType defaultType =
+					this.getTheFeatureType().getNotEditableCopy();
+			List types = new ArrayList(1);
+			types.add(defaultType);
+			this.getStoreServices().setFeatureTypes(types, defaultType);
+		} catch (OpenException e) {
+			throw new InitializeException(getResource().toString(), e);
+		}
+	}
+
+	protected EditableFeatureType getTheFeatureType()
+			throws InitializeException, OpenException {
+		try {
+			this.open();
+		} catch (DataException e) {
+			throw new InitializeException(this.getProviderName(), e);
+		}
+		return (EditableFeatureType) getResource().execute(
+				new ResourceAction() {
+
+					public Object run() throws Exception {
+						int fieldCount = -1;
+						fieldCount = dbfFile.getFieldCount();
+
+						EditableFeatureType fType =
+								getStoreServices().createFeatureType();
+
+						fType.setHasOID(true);
+						int precision;
+						for (int i = 0; i < fieldCount; i++) {
+							char fieldType = dbfFile.getFieldType(i);
+							EditableFeatureAttributeDescriptor attr;
+
+							if (fieldType == 'L') {
+								attr =
+										fType.add(dbfFile.getFieldName(i),
+												DataTypes.BOOLEAN);
+								attr.setDefaultValue(new Boolean(false));
+								attr.setAllowNull(false);
+
+							} else if ((fieldType == 'F') || (fieldType == 'N')) {
+								precision = dbfFile.getFieldDecimalLength(i);
+								if (precision > 0) {
+									attr =
+											fType.add(dbfFile.getFieldName(i),
+													DataTypes.DOUBLE,
+													dbfFile.getFieldLength(i));
+									attr.setPrecision(precision);
+									attr.setDefaultValue(new Double(0));
+
+								} else {
+								    int length = dbfFile.getFieldLength(i);
+								    int type = DataTypes.INT;
+								    if (length > 9){
+								        type = DataTypes.LONG;
+								    }
+									attr =
+											fType.add(dbfFile.getFieldName(i),
+											        type,
+													length);
+									attr.setDefaultValue(new Integer(0));
+								}
+								attr.setAllowNull(false);
+
+							} else if (fieldType == 'C') {
+								attr =
+										fType.add(dbfFile.getFieldName(i),
+												DataTypes.STRING);
+								attr.setSize(dbfFile.getFieldLength(i));
+								attr.setDefaultValue("");
+								attr.setAllowNull(false);
+
+							} else if (fieldType == 'D') {
+								attr =
+										fType.add(dbfFile.getFieldName(i),
+												DataTypes.DATE);
+								attr.setDefaultValue(null);
+								attr.setAllowNull(true);
+							} else {
+								throw new InitializeException(getProviderName(),
+										new UnknownDataTypeException(
+												dbfFile.getFieldName(i), ""
+														+ fieldType, getProviderName()));
+							}
+						}
+						return fType;
+					}
+				});
+	}
+
+
+	protected void loadValue(FeatureProvider featureProvider, int rowIndex,
+			FeatureAttributeDescriptor descriptor) throws ReadException {
+		if (descriptor.getEvaluator() != null) {
+			// Nothing to do
+			return;
+		}
+
+
+		int dbfIndex = this.dbfFile.getFieldIndex(descriptor.getName());
+		String value = null;
+		try {
+			value = this.dbfFile.getStringFieldValue(rowIndex, dbfIndex);
+		} catch (DataException e) {
+			throw new ReadException(this.getProviderName(), e);
+		}
+		value = value.trim();
+		int fieldType = descriptor.getType();
+		switch (fieldType) {
+		case DataTypes.STRING:
+			featureProvider.set(descriptor.getIndex(), value);
+			break;
+
+		case DataTypes.DOUBLE:
+			try {
+				featureProvider.set(descriptor.getIndex(), new Double(value));
+			} catch (NumberFormatException e) {
+				featureProvider.set(descriptor.getIndex(), null);
+			}
+			break;
+
+		case DataTypes.INT:
+			try {
+				featureProvider.set(descriptor.getIndex(), new Integer(value));
+			} catch (NumberFormatException e) {
+				featureProvider.set(descriptor.getIndex(), null);
+			}
+			break;
+
+		case DataTypes.FLOAT:
+			try {
+				featureProvider.set(descriptor.getIndex(), new Float(value));
+			} catch (NumberFormatException e) {
+				featureProvider.set(descriptor.getIndex(), null);
+			}
+			break;
+
+		case DataTypes.LONG:
+			try {
+				featureProvider.set(descriptor.getIndex(), new Long(value));
+			} catch (NumberFormatException e) {
+				featureProvider.set(descriptor.getIndex(), null);
+			}
+			break;
+
+		case DataTypes.BOOLEAN:
+			if (value.equalsIgnoreCase("T")){
+				featureProvider.set(descriptor.getIndex(), Boolean.TRUE);
+			} else {
+				featureProvider.set(descriptor.getIndex(), Boolean.FALSE);
+				
+			}
+			break;
+
+		case DataTypes.BYTE:
+			try {
+				featureProvider.set(descriptor.getIndex(), new Byte(value));
+			} catch (NumberFormatException e) {
+				featureProvider.set(descriptor.getIndex(), null);
+			}
+			break;
+
+		case DataTypes.DATE:
+			if (value.equals("")){
+				value=null;
+				return;
+			}
+			String year = value.substring(0, 4);
+			String month = value.substring(4, 6);
+			String day = value.substring(6, 8);
+			DateFormat df;
+			if (descriptor.getDateFormat() == null){
+				df = DateFormat.getDateInstance(DateFormat.SHORT,
+						ukLocale);
+			} else{
+				df = descriptor.getDateFormat();
+			}
+			/*
+			 * Calendar c = Calendar.getInstance(); c.clear();
+			 * c.set(Integer.parseInt(year), Integer.parseInt(month),
+			 * Integer.parseInt(day)); c.set(Calendar.MILLISECOND, 0);
+			 */
+			String strAux = month + "/" + day + "/" + year;
+			Date dat = null;
+			try {
+				dat = df.parse(strAux);
+			} catch (ParseException e) {
+				throw new ReadException(this.getProviderName(), e);
+			}
+			featureProvider.set(descriptor.getIndex(), dat);
+			break;
+
+
+		default:
+			featureProvider
+					.set(descriptor.getIndex(), descriptor.getDefaultValue());
+			break;
+		}
+	}
+
+
+	/***
+	 * NOT supported in Alter Mode
+	 *
+	 * @param index
+	 * @return
+	 * @throws ReadException
+	 */
+	protected FeatureProvider getFeatureProviderByIndex(long index) throws DataException {
+		return this
+				.getFeatureProviderByIndex(index, this.getStoreServices()
+				.getDefaultFeatureType());
+	}
+
+	public long getFeatureCount() throws ReadException, OpenException,
+			ResourceNotifyChangesException {
+		this.open();
+		return ((Long) getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				return Long.valueOf(dbfFile.getRecordCount());
+			}
+		})).longValue();
+	}
+
+	public FeatureSetProvider createSet(FeatureQuery query, FeatureType featureType)
+			throws DataException {
+		return new DBFSetProvider(this, query, featureType);
+	}
+
+	public boolean canCreate() {
+		return true;
+	}
+
+	public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException {
+		return false;
+	}
+
+	public void open() throws OpenException {
+		if (this.dbfFile.isOpen()) {
+			return;
+		}
+		try {
+			getResource().execute(new ResourceAction() {
+				public Object run() throws Exception {
+					openFile();
+					resourcesOpen();
+					return null;
+				}
+			});
+
+		} catch (ResourceExecuteException e) {
+			throw new OpenException(this.getProviderName(), e);
+		}
+	}
+
+	protected void openFile() throws FileNotFoundException,
+			UnsupportedVersionException, IOException, DataException {
+		this.dbfFile.open();
+	}
+
+	public void close() throws CloseException {
+		if (dbfFile == null || !this.dbfFile.isOpen()) {
+			return;
+		}
+		super.close();
+		//Cerrar recurso
+		try {
+			getResource().execute(new ResourceAction() {
+				public Object run() throws Exception {
+					closeFile();
+					resourcesNotifyClose();
+					return null;
+				}
+			});
+		} catch (ResourceExecuteException e) {
+			throw new CloseException(this.getProviderName(), e);
+		}
+	}
+
+	protected void closeFile() throws CloseException {
+		this.dbfFile.close();
+	}
+
+	@Override
+	protected void doDispose() throws BaseException {
+		this.close();
+		dbfFile = null;
+		disposeResource();
+		super.doDispose();
+	}
+
+	protected void disposeResource() {
+		this.dbfResource.removeConsumer(this);
+		dbfResource = null;
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		try {
+			this.close();
+		} catch (CloseException e) {
+			return false;
+		}
+		return true;
+	}
+
+	public boolean allowWrite() {
+		File file;
+		try {
+			file = ((File) this.dbfResource.get());
+		} catch (AccessResourceException e) {
+			return false;
+		}
+		return file.canWrite();
+	}
+
+	public void refresh() throws OpenException {
+		try {
+			this.close();
+		} catch (CloseException e) {
+			throw new OpenException(this.getProviderName(), e);
+		}
+		this.open();
+		try {
+			this.initFeatureType();
+		} catch (InitializeException e) {
+			throw new OpenException(this.getProviderName(), e);
+		}
+	}
+
+	/**
+	 *
+	 * @param index
+	 * @param featureType
+	 * @return
+	 * @throws ReadException
+	 */
+	protected FeatureProvider getFeatureProviderByIndex(long index,
+			FeatureType featureType) throws DataException {
+		FeatureProvider featureProvider = this.createFeatureProvider(featureType);
+		featureProvider.setOID(new Long(index));
+		return featureProvider;
+	}
+
+	protected void initFeatureProviderByIndex(FeatureProvider featureProvider,
+			long index, FeatureType featureType) throws DataException {
+		featureProvider.setOID(new Long(index));
+	}
+
+	/**
+	 *
+	 * @param featureProvider
+	 * @throws DataException
+	 */
+	protected void loadFeatureProviderByIndex(FeatureProvider featureProvider)
+			throws DataException {
+		long index = ((Long) featureProvider.getOID()).longValue();
+		if (index >= this.dbfFile.getRecordCount()) {
+			// FIXME
+			throw new ArrayIndexOutOfBoundsException("" + index);
+		}
+		Iterator iterator = featureProvider.getType().iterator();
+		while (iterator.hasNext()) {
+			FeatureAttributeDescriptor descriptor =
+					(FeatureAttributeDescriptor) iterator.next();
+			this.loadValue(featureProvider, (int) index, descriptor);
+		}
+	}
+
+	public int getOIDType() {
+		return DataTypes.LONG;
+	}
+
+	public Object createNewOID() {
+		if (this.counterNewsOIDs < 0) {
+			try {
+				this.counterNewsOIDs = this.getFeatureCount();
+			} catch (DataException e) {
+				e.printStackTrace();
+			}
+
+		}else{
+			this.counterNewsOIDs++;
+		}
+		return new Long(counterNewsOIDs);
+	}
+
+	public boolean supportsAppendMode() {
+		return true;
+	}
+
+
+	public void append(final FeatureProvider featureProvider)
+			throws DataException {
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				writer.append(getStoreServices().createFeature(featureProvider));
+				return null;
+			}
+		});
+	}
+
+	public void beginAppend() throws DataException {
+		this.close();
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				writer.begin(getDBFParameters(),
+						getStoreServices().getDefaultFeatureType(),
+						getStoreServices().getFeatureStore().getFeatureCount());
+				return null;
+			}
+		});
+	}
+
+	public void endAppend() throws DataException {
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				writer.end();
+			    resourcesNotifyChanges();
+				counterNewsOIDs = -1;
+				return null;
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
+	 */
+	public void resourceChanged(ResourceProvider resource) {
+		this.getStoreServices().notifyChange(
+				DataStoreNotification.RESOURCE_CHANGED,
+				resource);
+	}
+
+	/**
+	 *
+	 * @throws ResourceNotifyChangesException
+	 */
+	protected void resourcesNotifyChanges()
+			throws ResourceNotifyChangesException {
+		this.dbfResource.notifyChanges();
+	}
+
+	/**
+	 * @throws ResourceNotifyCloseException
+	 *
+	 */
+	protected void resourcesNotifyClose() throws ResourceNotifyCloseException {
+		this.dbfResource.notifyClose();
+	}
+
+	/**
+	 * @throws ResourceNotifyOpenException
+	 *
+	 */
+	protected void resourcesOpen() throws ResourceNotifyOpenException {
+		this.dbfResource.notifyOpen();
+	}
+
+	public Object getSourceId() {
+		return this.getDBFParameters().getFile();
+	}
+	
+	public String getName() {
+		String name = this.getDBFParameters().getFile().getName();
+		int n = name.lastIndexOf(".");
+		if( n<1 ) {
+			return name;
+		}
+		return name.substring(0, n);
+	}
+	
+	public String getFullName() {
+		return this.getDBFParameters().getFile().getAbsolutePath();
+	}
+
+	protected void resourceCloseRequest() throws ResourceException {
+		this.dbfResource.closeRequest();
+	}
+
+	public ResourceProvider getResource() {
+		return dbfResource;
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureWriter.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureWriter.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureWriter.java	(revision 38736)
@@ -0,0 +1,137 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.WritableByteChannel;
+import java.nio.charset.Charset;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeNotSuportedException;
+import org.gvsig.fmap.dal.store.dbf.utils.DbaseFileHeader;
+import org.gvsig.fmap.dal.store.dbf.utils.DbaseFileWriter;
+
+public class DBFFeatureWriter {
+	protected FeatureType featuretype;
+	private DbaseFileWriter dbfWriter = null;
+	protected String name;
+	private File dbfFile;
+	private DbaseFileHeader myHeader;
+	private FileChannel dbfChannel;
+
+	protected DBFFeatureWriter(String name) {
+		this.name= name;
+	}
+
+	public void begin(DBFStoreParameters storeParameters,
+			FeatureType featureType, long numRows) throws DataException {
+
+		// TODO if is new set the langID
+		try {
+			myHeader = DbaseFileHeader.createDbaseHeader(featureType);
+		} catch (AttributeFeatureTypeNotSuportedException e1) {
+			throw new WriteException(this.name, e1);
+		}
+
+		dbfFile = storeParameters.getDBFFile();
+
+		dbfChannel = null;
+
+		try {
+			dbfChannel = (FileChannel) getWriteChannel(dbfFile
+					.getAbsolutePath());
+		} catch (IOException e) {
+			throw new WriteException(this.name, e);
+		}
+		try{
+			this.dbfWriter = new DbaseFileWriter(myHeader, dbfChannel, true);
+
+
+			this.dbfWriter.setCharset(Charset.forName("ISO-8859-1"));
+			} catch (InitializeException e) {
+				throw new WriteException(this.name, e);
+			}
+
+
+		this.featuretype=featureType;
+		dbfFile = storeParameters.getDBFFile();
+
+	}
+
+	public void append(Feature feature) throws DataException {
+		// TODO use FeatureProvider
+		dbfWriter.append(feature);
+	}
+
+	public void end() throws DataException {
+		dbfWriter.close();
+	}
+
+	public void dispose() {
+		dbfWriter = null;
+
+	}
+
+	protected static WritableByteChannel getWriteChannel(String path)
+	throws IOException {
+		WritableByteChannel channel;
+
+		File f = new File(path);
+
+		if (!f.exists()) {
+			//			System.out.println("Creando fichero " + f.getAbsolutePath());
+
+			if (!f.createNewFile()) {
+				System.err.print("Error al crear el fichero "
+						+ f.getAbsolutePath());
+				throw new IOException("Cannot create file " + f);
+			}
+		}
+
+		RandomAccessFile raf = new RandomAccessFile(f, "rw");
+		channel = raf.getChannel();
+
+		return channel;
+	}
+
+	/**
+	 * @return
+	 */
+	protected int getRowCount() {
+		return this.myHeader.getNumRecords();
+	}
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFNewStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFNewStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFNewStoreParameters.java	(revision 38736)
@@ -0,0 +1,63 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dbf;
+
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+
+public class DBFNewStoreParameters extends DBFStoreParameters implements
+		NewFeatureStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME = "DBFNewStoreParameters";
+
+    public static final String FEATURETYPE_PARAMTER_NAME = "FeatureType";
+    
+    public static final String CODEPAGE_PARAMTER_NAME = "codePage";
+    
+    public DBFNewStoreParameters() {
+    	super(PARAMETERS_DEFINITION_NAME);
+    }
+
+	public byte getCodePage(){
+		return ((Byte) this.getDynValue(CODEPAGE_PARAMTER_NAME)).byteValue();
+	}
+
+	public void setCodePage(byte value){
+		setDynValue(CODEPAGE_PARAMTER_NAME, new Byte(value));
+	}
+
+	public EditableFeatureType getDefaultFeatureType() {
+		return (EditableFeatureType) this.getDynValue(FEATURETYPE_PARAMTER_NAME);
+	}
+
+	public void setDefaultFeatureType(FeatureType featureType) {
+		this.setDynValue(FEATURETYPE_PARAMTER_NAME, featureType);
+	}
+
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFNewStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreParameters.java	(revision 38736)
@@ -0,0 +1,104 @@
+package org.gvsig.fmap.dal.store.dbf;
+
+import java.io.File;
+import java.nio.charset.Charset;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+
+
+public class DBFStoreParameters extends AbstractDataParameters implements
+		DataStoreParameters, FilesystemStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME = "DBFStoreParameters";
+
+	public static final String DBFFILE_PARAMTER_NAME = "dbfFile";
+	public static final String ENCODING_PARAMTER_NAME = "encoding";
+
+	private DelegatedDynObject parameters;
+
+	public DBFStoreParameters() {
+		this(PARAMETERS_DEFINITION_NAME);
+	}
+
+	protected DBFStoreParameters(String parametersDefinitionName) {
+		this(parametersDefinitionName, DBFStoreProvider.NAME);
+	}
+
+	public DBFStoreParameters(String parametersDefinitionName, String name) {
+		super();
+		this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
+		this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
+	}
+
+	public String getDataStoreName() {
+		return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
+	}
+
+	public String getDescription() {
+		return this.getDynClass().getDescription();
+	}
+
+	public boolean isValid() {
+		return (this.getDBFFileName() != null);
+	}
+
+	public File getFile() {
+		return (File) this.getDynValue(DBFFILE_PARAMTER_NAME);
+	}
+
+	public void setFile(File file) {
+		this.setDynValue(DBFFILE_PARAMTER_NAME, file);
+	}
+
+	public void setFile(String fileName) {
+		this.setDynValue(DBFFILE_PARAMTER_NAME, fileName);
+	}
+
+	public String getDBFFileName() {
+		if( this.getDBFFile() == null ) {
+			return null;
+		}
+		return this.getDBFFile().getAbsolutePath();
+	}
+
+	public File getDBFFile() {
+		return (File) this.getDynValue(DBFFILE_PARAMTER_NAME);
+	}
+
+	public void setDBFFile(File file) {
+		this.setDynValue(DBFFILE_PARAMTER_NAME, file);
+	}
+
+	public void setDBFFile(String fileName) {
+		this.setDynValue(DBFFILE_PARAMTER_NAME, fileName);
+	}
+
+	public String getEncodingName() {
+		return (String) getDynValue(ENCODING_PARAMTER_NAME);
+	}
+	
+	public Charset getEncoding() {
+		String name = getEncodingName();
+		if (name == null) {
+			return null;
+		}
+		return Charset.forName(name);
+	}
+
+	public void setEncoding(String encoding) {
+		this.setEncoding(Charset.forName(encoding));
+	}
+
+	public void setEncoding(Charset charset) {
+		this.setDynValue(ENCODING_PARAMTER_NAME, charset.name());
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return parameters;
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegend.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegend.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegend.java	(revision 38736)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dxf.legend;
+
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
+import org.gvsig.fmap.dal.store.dxf.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DXFGetLegend implements DynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dxfLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(dxfLegendDynClass, new DXFGetLegend()));
+
+	}
+	public int getCode() throws DynMethodNotSupportedException {
+		return code.intValue();
+	}
+
+	public String getDescription() {
+		return "DXF Legend";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_GETLEGEND_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		try {
+			return ((DXFStoreProvider) self).getLegend();
+		} catch (OpenException e) {
+			//FIXME
+			throw new RuntimeException(e);
+		}
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendLibrary.java	(revision 38736)
@@ -0,0 +1,68 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.store.dxf.legend;
+
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.store.dxf.DXFLibrary;
+import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
+import org.gvsig.metadata.MetadataLibrary;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DXFLegendLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DXFLibrary.class);
+        require(MetadataLibrary.class);
+        require(DALLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
+			.getDefinition(DXFStoreProvider.METADATA_DEFINITION_NAME);
+		DXFGetLegendBuilder.register(metadataDefinition);
+		DXFGetLegend.register(metadataDefinition);
+		DXFGetLabeling.register(metadataDefinition);
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegendBuilder.java	(revision 38736)
@@ -0,0 +1,67 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dxf.legend;
+
+import org.gvsig.fmap.dal.store.dxf.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DXFGetLegendBuilder implements DynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dxfLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(
+						dxfLegendDynClass, new DXFGetLegendBuilder()));
+
+	}
+	public int getCode() throws DynMethodNotSupportedException {
+		return code.intValue();
+	}
+
+	public String getDescription() {
+		return "DXF LegendBuilder creator";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_BUILDER_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		return new DXFLegendBuilder();
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendBuilder.java	(revision 38736)
@@ -0,0 +1,134 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dxf.legend;
+
+import java.awt.Color;
+
+import org.gvsig.dxf.px.dxf.AcadColor;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
+import org.gvsig.fmap.dal.store.dxf.LegendBuilder;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.symbology.SymbologyLocator;
+import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy;
+import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
+import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
+
+public class DXFLegendBuilder implements LegendBuilder {
+
+	private MapContextManager mapContextManager = MapContextLocator
+			.getMapContextManager();
+
+	private IVectorialUniqueValueLegend defaultLegend = null;
+	private IAttrInTableLabelingStrategy labelingStragegy = null;
+
+	public void begin() {
+		// Nothing to do
+	}
+
+	public void end() {
+		defaultLegend.useDefaultSymbol(true);
+	}
+
+	public Object getLegend() {
+		return defaultLegend;
+	}
+
+	public LegendBuilder initialize(FeatureStoreProvider store) {
+		defaultLegend = (IVectorialUniqueValueLegend) mapContextManager
+				.createLegend(IVectorialUniqueValueLegend.LEGEND_NAME);
+		defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY);
+		defaultLegend
+				.setClassifyingFieldNames(new String[] { DXFStoreProvider.NAME_FIELD_COLOR });
+		defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT });
+
+		ISymbol myDefaultSymbol =
+				mapContextManager.getSymbolManager().createSymbol(
+				Geometry.TYPES.GEOMETRY, Color.BLACK);
+
+		defaultLegend.setDefaultSymbol(myDefaultSymbol);
+		defaultLegend.useDefaultSymbol(false);
+
+		labelingStragegy = SymbologyLocator.getSymbologyManager().createAttrInTableLabelingStrategy();
+		labelingStragegy.setTextField(DXFStoreProvider.NAME_FIELD_TEXT);
+		labelingStragegy
+				.setRotationField(DXFStoreProvider.NAME_FIELD_ROTATIONTEXT);
+		labelingStragegy.setHeightField(DXFStoreProvider.NAME_FIELD_HEIGHTTEXT);
+		labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters)
+		return this;
+	}
+
+	public void process(FeatureProvider feature) {
+		Integer clave = (Integer) feature.get("Color");
+		if (clave == null) {
+			return;
+		}
+
+		if (defaultLegend.getSymbolByValue(clave) == null) {
+			ISymbol theSymbol;
+			Color color = null;
+			try {
+				color = AcadColor.getColor(clave.intValue());
+			} catch (ArrayIndexOutOfBoundsException e) {
+				color = AcadColor.getColor(255);
+			}
+			// jaume, moved to ISymbol
+			theSymbol =
+					mapContextManager.getSymbolManager().createSymbol(
+							Geometry.TYPES.GEOMETRY,
+					color);
+			theSymbol.setDescription(clave.toString());
+			// Asigna los colores de Autocad a los
+			// bordes de los pol�gonos y pone el relleno transparente.
+			if (theSymbol instanceof IFillSymbol) {
+				((IFillSymbol) theSymbol).getOutline().setLineColor(color);
+				Color fillColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 0);
+				((IFillSymbol) theSymbol).setFillColor(fillColor);
+			}
+			// Asigna los colores de Autocad a las l�neas
+			if (theSymbol instanceof ILineSymbol) {
+				((ILineSymbol) theSymbol).setLineColor(color);
+			}
+			if (theSymbol != null) {
+				defaultLegend.addSymbol(clave, theSymbol);
+			}
+		}
+	}
+
+	public Object getLabeling() {
+		return labelingStragegy;
+	}
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLabeling.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLabeling.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLabeling.java	(revision 38736)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dxf.legend;
+
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
+import org.gvsig.fmap.dal.store.dxf.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DXFGetLabeling implements DynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dxfLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(dxfLegendDynClass, new DXFGetLabeling()));
+
+	}
+	public int getCode() throws DynMethodNotSupportedException {
+		return code.intValue();
+	}
+
+	public String getDescription() {
+		return "DXF Labeling";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_GETLABELING_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		try {
+			return ((DXFStoreProvider) self).getLabeling();
+		} catch (OpenException e) {
+			//FIXME
+			throw new RuntimeException(e);
+		}
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLabeling.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProviderFactory.java	(revision 38736)
@@ -0,0 +1,61 @@
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.DataStoreProvider;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class DXFStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{
+
+	protected DXFStoreProviderFactory(String name, String description) {
+		super(name, description);
+	}
+
+	public DataStoreProvider createProvider(DataParameters parameters,
+			DataStoreProviderServices providerServices)
+			throws InitializeException {
+		return new DXFStoreProvider((DXFStoreParameters) parameters, providerServices);
+	}
+
+	public DynObject createParameters() {
+		return new DXFStoreParameters();
+	}
+	
+	public int allowCreate() {
+		return YES;
+	}
+	
+	public int allowWrite() {
+		return YES;
+	}
+
+	public int allowRead() {
+		return YES;
+	}
+	
+	public int hasRasterSupport() {
+		return NO;
+	}
+	
+	public int hasTabularSupport() {
+		return YES;
+	}
+	
+	public int hasVectorialSupport() {
+		return YES;
+	}
+
+	public int allowMultipleGeometryTypes() {
+		return NO;
+	}
+	
+	public int allowEditableFeatureType() {
+		return NO;
+	}
+
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreParameters.java	(revision 38736)
@@ -0,0 +1,103 @@
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.io.File;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+
+public class DXFStoreParameters extends AbstractDataParameters implements
+		DataStoreParameters, FilesystemStoreParameters,
+		NewFeatureStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME = "DXFStoreParameters";
+
+    private static final String FILE_PARAMTER_NAME = "File";
+    private static final String CRS_PARAMTER_NAME = "CRS";
+
+	private DelegatedDynObject parameters;
+
+	
+	public DXFStoreParameters() {
+		this(PARAMETERS_DEFINITION_NAME);
+	}
+
+	protected DXFStoreParameters(String parametersDefinitionName) {
+		this(parametersDefinitionName, DXFStoreProvider.NAME);
+	}
+
+	public DXFStoreParameters(String parametersDefinitionName, String name) {
+		super();
+		this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
+		this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
+	}
+
+	public String getDataStoreName() {
+		return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
+	}
+
+	public String getDescription() {
+		return this.getDynClass().getDescription();
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return parameters;
+	}
+
+	public void setCRS(String srs) {
+		setDynValue(CRS_PARAMTER_NAME, srs);
+	}
+
+	public void setCRS(IProjection srs) {
+		setDynValue(CRS_PARAMTER_NAME, srs);
+	}
+
+	public IProjection getCRS() {
+		return (IProjection) getDynValue(CRS_PARAMTER_NAME);
+	}
+
+	public String getFileName() {
+		if( this.getFile() == null ) {
+			return null;
+		}
+		return this.getFile().getPath();
+	}
+
+	public boolean isValid() {
+		if (getCRS() == null ) {
+			return false;
+		}
+		if (getFileName() == null) {
+			return false;
+		}
+		return true;
+	}
+
+	public File getFile() {
+		return (File) this.getDynValue(FILE_PARAMTER_NAME);
+	}
+
+	public void setFile(File file) {
+		this.setDynValue(FILE_PARAMTER_NAME, file);
+	}
+
+	public void setFile(String file) {
+		this.setDynValue(FILE_PARAMTER_NAME, file);
+	}
+
+	public EditableFeatureType getDefaultFeatureType() {
+		return DXFStoreProvider.createFeatureType(null, Geometry.SUBTYPES.GEOM3D);
+	}
+
+	public void setDefaultFeatureType(FeatureType defaultFeatureType) {
+		throw new UnsupportedOperationException();
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/LegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/LegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/LegendBuilder.java	(revision 38736)
@@ -0,0 +1,24 @@
+package org.gvsig.fmap.dal.store.dxf;
+
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+
+
+public interface LegendBuilder {
+
+	final public static String DYNMETHOD_BUILDER_NAME = "getLegendBuilder";
+	final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend";
+	final public static String DYNMETHOD_GETLABELING_NAME = "getLabeling";
+
+	public LegendBuilder initialize(FeatureStoreProvider store);
+
+	public void begin();
+
+	public void process(FeatureProvider feature);
+
+	public void end();
+
+	public Object getLegend();
+	public Object getLabeling();
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/LegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFLibrary.java	(revision 38736)
@@ -0,0 +1,97 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.store.shp.SHPStoreProvider;
+import org.gvsig.fmap.dal.store.shp.SHPStoreProviderFactory;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DXFLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DALFileLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		List<Throwable> exs = new ArrayList<Throwable>();
+
+		FileHelper.registerParametersDefinition(
+				DXFStoreParameters.PARAMETERS_DEFINITION_NAME,
+				DXFStoreParameters.class, "DXFParameters.xml");
+		try {
+			FileHelper.registerMetadataDefinition(
+					DXFStoreProvider.METADATA_DEFINITION_NAME,
+					DXFStoreProvider.class, "DXFMetadata.xml");
+		} catch (MetadataException e) {
+			exs.add(e);
+		}
+
+		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+				.getDataManager();
+
+		try {
+			if (!dataman.getStoreProviders().contains(DXFStoreProvider.NAME)) {
+				dataman.registerStoreProviderFactory(new DXFStoreProviderFactory(DXFStoreProvider.NAME, DXFStoreProvider.DESCRIPTION));
+
+			}
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		try {
+			DALFileLocator.getFilesystemServerExplorerManager()
+					.registerProvider(DXFStoreProvider.NAME,
+							DXFStoreProvider.DESCRIPTION,
+							DXFFilesystemServerProvider.class);
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		if (exs.size() > 0) {
+			throw new LibraryException(this.getClass(), exs);
+		}
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFFilesystemServerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFFilesystemServerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFFilesystemServerProvider.java	(revision 38736)
@@ -0,0 +1,213 @@
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.dxf.io.DxfFile;
+import org.gvsig.dxf.px.dxf.DxfEntityMaker;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.AbsolutePathRequiredException;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+
+public class DXFFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider 
+	implements FilesystemServerExplorerProvider, ResourceConsumer {
+
+	private FilesystemServerExplorerProviderServices serverExplorer;
+
+	public String getDataStoreProviderName() {
+		return DXFStoreProvider.NAME;
+	}
+
+	public int getMode() {
+		return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
+	}
+
+	public boolean accept(File pathname) {
+		return (pathname.getName().toLowerCase().endsWith(".dxf"));
+	}
+
+	public String getDescription() {
+		return DXFStoreProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		DXFStoreParameters params = (DXFStoreParameters) manager
+				.createStoreParameters(this
+				.getDataStoreProviderName());
+		params.setFile(file.getPath());
+		return params;
+	}
+
+	public boolean canCreate() {
+		return true;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		if (!(parameters instanceof DXFStoreParameters)) {
+			throw new IllegalArgumentException(); // FIXME ???
+		}
+		DXFStoreParameters dxfParams = (DXFStoreParameters) parameters;
+		// TODO comporbar si el ftype es correcto (para este formato es fijo)
+		File file = new File(dxfParams.getFileName());
+
+		if (dxfParams.getCRS() == null) {
+			return false;
+		}
+		// TODO comprobamos extension del fichero ??
+		if (file.exists()) {
+			return file.canWrite();
+		} else {
+			return file.getParentFile().canWrite();
+		}
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+
+		final IProjection projection = null;
+		DXFStoreParameters params = (DXFStoreParameters) parameters;
+
+		File file = params.getFile();
+		if (!file.isAbsolute()) {
+			throw new AbsolutePathRequiredException(file.getPath());
+		}
+
+		if (file.exists()) {
+			if (overwrite) {
+				if (!file.delete()) {
+					throw new CreateException(this.getDataStoreProviderName(),
+							new IOException(
+							"cannot delete file"));
+				}
+			} else {
+				throw new CreateException(this.getDataStoreProviderName(),
+						new IOException(
+						"file already exist"));
+			}
+		}
+
+		//		projection = CRSFactory.getCRS(params.getSRSID());
+
+
+		final FileResource resource;
+		try {
+			resource = (FileResource) this.serverExplorer
+					.getServerExplorerProviderServices().createResource(
+							FileResource.NAME,
+					new Object[] { file.getAbsolutePath() });
+		} catch (InitializeException e1) {
+			throw new CreateException(params.getFileName(), e1);
+		}
+		resource.addConsumer(this);
+
+		try {
+			resource.execute(new ResourceAction() {
+				public Object run() throws Exception {
+					Builder builder =
+							new Builder().initialice(resource.getFileName(),
+									projection);
+					resource.notifyOpen();
+					builder.begin();
+					builder.create();
+					builder.end();
+					resource.notifyClose();
+
+					resource.setData(null); // FIXME: Seguro que hay que ponerlo
+											// a null ??
+					resource.notifyChanges();
+					return null;
+				}
+			});
+		} catch (Exception e) {
+			throw new CreateException(params.getFileName(), e);
+		} finally {
+			resource.removeConsumer(this);
+		}
+	}
+
+	public class Builder {
+		private String fileName;
+		private IProjection projection;
+
+		public Builder initialice(String fileName, IProjection projection) {
+			this.fileName = fileName;
+			this.projection = projection;
+			return this;
+		}
+
+		public void begin() {
+
+		}
+
+		public void end() {
+
+		}
+
+		public void create() throws IOException {
+			DxfEntityMaker entityMaker = new DxfEntityMaker(projection);
+			DxfFile dxfFile = new DxfFile(null, fileName, entityMaker);
+			dxfFile.setCadFlag(true);
+			dxfFile.setDxf3DFlag(false);
+			dxfFile.save(fileName);
+		}
+	}
+
+	public NewDataStoreParameters getCreateParameters() throws DataException {
+		return (NewFeatureStoreParameters) DALLocator.getDataManager()
+				.createStoreParameters(this.getDataStoreProviderName());
+	}
+
+	public void initialize(
+			FilesystemServerExplorerProviderServices serverExplorer) {
+		this.serverExplorer = serverExplorer;
+	}
+
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		File file = new File(((DXFStoreParameters) parameters).getFileName());
+		if (!file.exists()) {
+			throw new RemoveException(this.getDataStoreProviderName(),
+					new FileNotFoundException(file));
+		}
+		if (!file.delete()) {
+			// FIXME throws ???
+		}
+
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		// while it is using a resource anyone can't close it
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
+	 */
+	public void resourceChanged(ResourceProvider resource) {
+		//Do nothing
+
+	}
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFFilesystemServerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java	(revision 38736)
@@ -0,0 +1,1628 @@
+package org.gvsig.fmap.dal.store.dxf;
+
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.dxf.geo.Point3D;
+import org.gvsig.dxf.io.DxfFile;
+import org.gvsig.dxf.io.DxfGroup;
+import org.gvsig.dxf.io.DxfGroupVector;
+import org.gvsig.dxf.px.IObjList;
+import org.gvsig.dxf.px.dxf.DxfEntityMaker;
+import org.gvsig.dxf.px.dxf.DxfFeatureMaker;
+import org.gvsig.dxf.px.dxf.DxfHeaderManager;
+import org.gvsig.dxf.px.gml.Feature;
+import org.gvsig.dxf.px.gml.LineString;
+import org.gvsig.dxf.px.gml.LineString3D;
+import org.gvsig.dxf.px.gml.Point;
+import org.gvsig.dxf.px.gml.Polygon;
+import org.gvsig.dxf.px.gml.Polygon3D;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.LoadException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.operation.GeometryOperationContext;
+import org.gvsig.fmap.geom.operation.distance.PointDistance;
+import org.gvsig.fmap.geom.operation.utils.PointGetAngle;
+import org.gvsig.fmap.geom.primitive.Arc;
+import org.gvsig.fmap.geom.primitive.Circle;
+import org.gvsig.fmap.geom.primitive.Curve;
+import org.gvsig.fmap.geom.primitive.Ellipse;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.Surface;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.NotYetImplemented;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.gvsig.tools.task.TaskStatusManager;
+
+public class DXFStoreProvider extends AbstractMemoryStoreProvider implements
+ResourceConsumer {
+    private static final Logger logger = LoggerFactory.getLogger(DXFStoreProvider.class);
+
+    public static final String NAME = "DXF";
+    public static final String DESCRIPTION = "DXF file";
+
+    public static final String METADATA_DEFINITION_NAME = NAME;
+
+    public static final String NAME_FIELD_ID = "ID";
+    public static final String NAME_FIELD_GEOMETRY = "Geometry";
+    public static final String NAME_FIELD_ENTITY = "Entity";
+    public static final String NAME_FIELD_LAYER = "Layer";
+    public static final String NAME_FIELD_COLOR = "Color";
+    public static final String NAME_FIELD_ELEVATION = "Elevation";
+    public static final String NAME_FIELD_THICKNESS = "Thickness";
+    public static final String NAME_FIELD_TEXT = "Text";
+    public static final String NAME_FIELD_HEIGHTTEXT = "HeightText";
+    public static final String NAME_FIELD_ROTATIONTEXT = "Rotation";
+
+    private static final int ID_FIELD_ID = 0;
+    private static final int ID_FIELD_GEOMETRY = 1;
+    private static final int ID_FIELD_ENTITY = 2;
+    private static final int ID_FIELD_LAYER = 3;
+    private static final int ID_FIELD_COLOR = 4;
+    private static final int ID_FIELD_ELEVATION = 5;
+    private static final int ID_FIELD_THICKNESS = 6;
+    private static final int ID_FIELD_TEXT = 7;
+    private static final int ID_FIELD_HEIGHTTEXT = 8;
+    private static final int ID_FIELD_ROTATIONTEXT = 9;
+
+    private IProjection projection;
+    private ResourceProvider resource;
+    private LegendBuilder legendBuilder;
+
+    private long counterNewsOIDs = 0;
+    private Envelope envelope;
+    private Writer writer;
+    protected GeometryManager geomManager = GeometryLocator.getGeometryManager();
+
+    private SimpleTaskStatus taskStatus;
+
+
+    public DXFStoreProvider(DXFStoreParameters parameters,
+        DataStoreProviderServices storeServices) throws InitializeException {
+        super(
+            parameters, 
+            storeServices,
+            FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME)
+        );
+
+        TaskStatusManager manager = ToolsLocator.getTaskStatusManager();
+        this.taskStatus = manager.creteDefaultSimpleTaskStatus("DXF");
+
+        counterNewsOIDs = 0;
+        //		projection = CRSFactory.getCRS(getParameters().getSRSID());
+
+        File file = getDXFParameters().getFile();
+        resource = this.createResource(
+            FileResource.NAME,
+            new Object[] { file.getAbsolutePath() }
+        );
+
+        resource.addConsumer(this);
+
+        this.projection = this.getDXFParameters().getCRS();
+
+
+        try {
+            legendBuilder = (LegendBuilder) this.invokeDynMethod(
+                LegendBuilder.DYNMETHOD_BUILDER_NAME, null);
+        } catch (DynMethodException e) {
+            legendBuilder = null;
+        } catch (Exception e) {
+            throw new InitializeException(e);
+        }
+
+        this.initializeFeatureTypes();
+
+    }
+
+    private DXFStoreParameters getDXFParameters() {
+        return (DXFStoreParameters) this.getParameters();
+    }
+
+    public String getProviderName() {
+        return NAME;
+    }
+
+    public boolean allowWrite() {
+        return true;
+    }
+
+    public Object getLegend() throws OpenException {
+        this.open();
+        if (legendBuilder == null) {
+            return null;
+        }
+        return legendBuilder.getLegend();
+    }
+
+    public Object getLabeling() throws OpenException {
+        this.open();
+        if (legendBuilder == null) {
+            return null;
+        }
+        return legendBuilder.getLabeling();
+    }
+
+    private class DXFData {
+        public List data = null;
+        public FeatureType defaultFType = null;
+        public List fTypes = null;
+        public Envelope envelope = null;
+        public IProjection projection;
+        public LegendBuilder legendBuilder;
+        public Envelope getEnvelopeCopy() throws CreateEnvelopeException {
+            if (envelope == null) {
+                return null;
+            }
+            Envelope newEnvelope;
+            if (envelope.getDimension() == 2) {
+                newEnvelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
+            } else {
+                newEnvelope = geomManager.createEnvelope(SUBTYPES.GEOM3D);
+
+            }
+            newEnvelope.setLowerCorner(envelope.getLowerCorner());
+            newEnvelope.setUpperCorner(envelope.getUpperCorner());
+            return newEnvelope;
+        }
+    }
+
+    public void open() throws OpenException {
+        if (this.data != null) {
+            return;
+        }
+        openEver();
+    }
+
+    private void openEver() throws OpenException {
+        try {
+            this.taskStatus.add();
+            getResource().execute(new ResourceAction() {
+                public Object run() throws Exception {
+                    DXFData dxfData = null;
+                    resource.setData(new HashMap());
+                    FeatureStoreProviderServices store = getStoreServices();
+                    dxfData = new DXFData();
+                    dxfData.data = new ArrayList();
+                    data = dxfData.data;
+                    counterNewsOIDs = 0;
+                    Reader reader = new Reader().initialice(
+                        getMemoryProvider(),
+                        (File) resource.get(),
+                        projection,
+                        legendBuilder
+                    );
+                    reader.begin(store);
+                    dxfData.defaultFType = reader.getDefaultType()
+                    .getNotEditableCopy();
+                    ArrayList types = new ArrayList();
+                    Iterator it = reader.getTypes().iterator();
+                    EditableFeatureType fType;
+                    while (it.hasNext()) {
+                        fType = (EditableFeatureType) it.next();
+                        if (fType.getId().equals(dxfData.defaultFType.getId())) {
+                            types.add(dxfData.defaultFType);
+                        } else {
+                            types.add(fType.getNotEditableCopy());
+                        }
+                    }
+                    dxfData.fTypes = types;
+
+                    resource.notifyOpen();
+                    store.setFeatureTypes(dxfData.fTypes, dxfData.defaultFType);
+                    reader.load();
+
+                    dxfData.envelope = reader.getEnvelope();
+
+                    dxfData.legendBuilder = legendBuilder;
+
+                    dxfData.projection = projection;
+
+                    reader.end();
+                    resource.notifyClose();
+                    ((Map) resource.getData()).put(projection.getAbrev(),
+                        dxfData); // OJO la reproyeccion
+
+                    data = dxfData.data;
+                    store.setFeatureTypes(dxfData.fTypes, dxfData.defaultFType);
+                    legendBuilder = dxfData.legendBuilder;
+                    envelope= dxfData.getEnvelopeCopy();
+                    // setDynValue("CRS", projection.getAbrev());
+                    counterNewsOIDs = data.size();
+                    return null;
+                }
+            });
+            this.taskStatus.terminate();
+        } catch (Exception e) {
+            data = null;
+            this.taskStatus.abort();
+            try {
+                throw new OpenException(resource.getName(), e);
+            } catch (AccessResourceException e1) {
+                throw new OpenException(getProviderName(), e);
+            }
+        } finally {
+            this.taskStatus.remove();
+        }
+    }
+
+
+    public DataServerExplorer getExplorer() throws ReadException {
+        DataManager manager = DALLocator.getDataManager();
+        FilesystemServerExplorerParameters params;
+        try {
+            params = (FilesystemServerExplorerParameters) manager
+            .createServerExplorerParameters(FilesystemServerExplorer.NAME);
+            params.setRoot(this.getDXFParameters().getFile().getParent());
+            return manager.openServerExplorer(FilesystemServerExplorer.NAME,params);
+        } catch (DataException e) {
+            throw new ReadException(this.getProviderName(), e);
+        } catch (ValidateDataParametersException e) {
+            throw new ReadException(this.getProviderName(), e);
+        }
+
+    }
+
+
+
+    public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator originalFeatureTypesUpdated) throws PerformEditingException {
+
+        try {
+            this.taskStatus.add();
+            taskStatus.message("_preparing");
+            getResource().execute(new ResourceAction() {
+                public Object run() throws Exception {
+                    FeatureSet features = null;
+                    DisposableIterator it = null;
+                    try {
+                        File file = (File) resource.get();
+                        String fileName = file.getAbsolutePath();
+                        writer = new Writer().initialice(file, projection);
+                        features =
+                            getStoreServices().getFeatureStore()
+                            .getFeatureSet();
+                        List newdata = new ArrayList();
+                        writer.begin();
+                        it = features.fastIterator();
+                        taskStatus.setRangeOfValues(0,0);
+                        long counter=0;
+                        while (it.hasNext()) {
+                            taskStatus.setCurValue(counter++);
+                            FeatureProvider feature = getStoreServices().getFeatureProviderFromFeature(
+                                (org.gvsig.fmap.dal.feature.Feature) it.next());
+                            writer.add(feature);
+                            if (feature.getOID() == null){
+                                logger.warn("feature without OID");
+                                feature.setOID(createNewOID());
+                            }
+                            newdata.add(feature);
+                        }
+                        data = newdata;
+                        writer.end();
+                        if (writer.getEnvelope() != null){
+                            envelope = writer.getEnvelope().getGeometry().getEnvelope();
+                        }
+                        resource.notifyChanges();
+                        //					counterNewsOIDs = 0;
+                    } finally {
+                        if (it != null) {
+                            it.dispose();
+                        }
+                        if (features != null) {
+                            features.dispose();
+                        }
+                    }
+                    return null;
+                }
+            });
+            this.taskStatus.terminate();
+        } catch (Exception e) {
+            this.taskStatus.abort();
+            throw new PerformEditingException(getResource().toString(), e);
+        } finally {
+            this.taskStatus.remove();
+        }
+    }
+
+    public static EditableFeatureType createFeatureType(IProjection projection, int geometrySubtype){
+    	DataManager manager = DALLocator.getDataManager();
+    	EditableFeatureType featureType = manager.createFeatureType();
+
+        featureType.setHasOID(true);
+
+//        ID_FIELD_ID = 0;
+        featureType.add(NAME_FIELD_ID, DataTypes.INT)
+        .setDefaultValue(Integer.valueOf(0))
+        .getIndex();
+
+        EditableFeatureAttributeDescriptor attr = featureType.add(
+            NAME_FIELD_GEOMETRY, DataTypes.GEOMETRY);
+        attr.setSRS(projection);
+        attr.setGeometryType(Geometry.TYPES.GEOMETRY);			
+        //If is a 3D file, set the geometry subtype
+        attr.setGeometrySubType(geometrySubtype);
+        
+//        ID_FIELD_GEOMETRY = 1; //attr.getIndex();
+
+        featureType.setDefaultGeometryAttributeName(NAME_FIELD_GEOMETRY);
+
+        // FIXME: Cual es el size y el valor por defecto para Entity ?
+//        ID_FIELD_ENTITY = 2; 
+        featureType.add(NAME_FIELD_ENTITY,
+            DataTypes.STRING, 100)
+            .setDefaultValue("")
+            .getIndex();
+
+        // FIXME: Cual es el size de Layer ?
+//        ID_FIELD_LAYER = 3;
+        featureType.add(NAME_FIELD_LAYER,
+            DataTypes.STRING, 100)
+            .setDefaultValue(
+            "default").getIndex();
+
+//        ID_FIELD_COLOR = 4;
+        featureType.add(NAME_FIELD_COLOR,
+            DataTypes.INT)
+            .setDefaultValue(
+                Integer.valueOf(0)).getIndex();
+
+//        ID_FIELD_ELEVATION = 5;
+        featureType.add(NAME_FIELD_ELEVATION,
+            DataTypes.DOUBLE)
+            .setDefaultValue(
+                Double.valueOf(0)).getIndex();
+
+//        ID_FIELD_THICKNESS = 6;
+        featureType.add(NAME_FIELD_THICKNESS,
+            DataTypes.DOUBLE)
+            .setDefaultValue(
+                Double.valueOf(0)).getIndex();
+
+        // FIXME: Cual es el size de Text ?
+//        ID_FIELD_TEXT = 7;
+        featureType.add(NAME_FIELD_TEXT,
+            DataTypes.STRING, 100)
+            .setDefaultValue("")
+            .getIndex();
+
+//        ID_FIELD_HEIGHTTEXT = 8;
+        featureType.add(NAME_FIELD_HEIGHTTEXT,
+            DataTypes.DOUBLE).setDefaultValue(
+                Double.valueOf(10)).getIndex();
+
+//        ID_FIELD_ROTATIONTEXT = 9;
+        featureType.add(NAME_FIELD_ROTATIONTEXT,
+            DataTypes.DOUBLE).setDefaultValue(
+                Double.valueOf(0)).getIndex();
+
+        // FIXME: Parece que el DXF puede tener mas atributos opcionales.
+        // Habria que ver de pillarlos ?
+
+        return featureType;
+    }
+    public class Reader {
+        private File file;
+        private String fileName;
+        private IProjection projection;
+        private List types;
+        private LegendBuilder leyendBuilder;
+        private AbstractMemoryStoreProvider store;
+        private Envelope envelope;
+
+        //Next two variables are used to read the DXF file
+        private DxfFile.EntityFactory featureMaker;
+        private DxfFile.VarSettings headerManager;
+
+        public Reader initialice(AbstractMemoryStoreProvider store, File file,
+            IProjection projection,
+            LegendBuilder leyendBuilder) {
+            this.store = store;
+            this.file = file;
+            this.fileName = file.getAbsolutePath();
+            this.projection = projection;
+            this.leyendBuilder = leyendBuilder;
+            if (leyendBuilder != null) {
+                leyendBuilder.initialize(store);
+            }
+            return this;
+        }
+
+        public Envelope getEnvelope() {
+            return this.envelope;
+        }
+
+        public void begin(FeatureStoreProviderServices store) throws LoadException {
+            taskStatus.message("_preloading_data");
+            featureMaker = new DxfFeatureMaker(projection);
+            headerManager = new DxfHeaderManager();
+            DxfFile dxfFeatureFile = new DxfFile(projection, file
+                .getAbsolutePath(), featureMaker, headerManager);
+
+            try {
+                dxfFeatureFile.load();
+            } catch (Exception e1) {
+                throw new LoadException(e1, fileName);
+            }
+
+            taskStatus.message("_preparing_featureType");
+            int geometrySubtype;
+			if (featureMaker.isDxf3DFile() && headerManager.isWritedDxf3D()){
+                geometrySubtype = Geometry.SUBTYPES.GEOM3D;
+            }else{
+            	geometrySubtype = Geometry.SUBTYPES.GEOM2D;
+            }			
+            EditableFeatureType featureType = createFeatureType(this.projection, geometrySubtype);
+
+            types = new ArrayList();
+            types.add(featureType);
+
+            if (leyendBuilder != null) {
+                taskStatus.message("_preparing_leyend");
+                leyendBuilder.begin();
+            }
+
+        }
+
+        public void end() {
+            if (leyendBuilder != null) {
+                leyendBuilder.end();
+            }
+        }
+
+        public List getTypes() {
+            return types;
+        }
+
+        public EditableFeatureType getDefaultType() {
+            return (EditableFeatureType) types.get(0);
+        }
+
+        private Double toDouble(String value) {
+            if (value == null) {
+                return Double.valueOf(0);
+            }
+            return Double.valueOf(value);
+        }
+
+        public void load() throws DataException {
+
+            this.envelope = null;
+
+            IObjList.vector features = (IObjList.vector) ((DxfFeatureMaker) featureMaker)
+            .getObjects();
+            String acadVersion = ((DxfHeaderManager) headerManager)
+            .getAcadVersion();
+
+
+            logger.info("load: acadVersion = '" + acadVersion + "'");
+
+            GeometryManager gManager = GeometryLocator.getGeometryManager();
+
+            taskStatus.setRangeOfValues(0,features.size());
+
+            if (!featureMaker.isDxf3DFile() && !headerManager.isWritedDxf3D()) {
+                // y no est�n todos a 9999
+                taskStatus.message("_fixing_3dgeometries");
+                Feature[] features2D = new Feature[features.size()];
+                for (int i = 0; i < features.size(); i++) {
+                    taskStatus.setCurValue(i);
+                    Feature fea = (Feature) features.get(i);
+                    if (fea.getGeometry() instanceof org.gvsig.dxf.px.gml.Point3D) {
+                        Point point = (Point) fea.getGeometry();
+                        Point point2 = new Point();
+                        for (int j = 0; j < point.pointNr(); j++) {
+                            point2.add(point.get(j));
+                        }
+                        point2.setTextPoint(point.isTextPoint());
+                        fea.setGeometry(point2);
+                        features2D[i] = fea;
+
+                    } else if (fea.getGeometry() instanceof LineString3D) {
+                        LineString lineString = (LineString) fea.getGeometry();
+                        LineString lineString2 = new LineString();
+                        for (int j = 0; j < lineString.pointNr(); j++) {
+                            lineString2.add(lineString.get(j));
+                        }
+                        fea.setGeometry(lineString2);
+                        features2D[i] = fea;
+                    } else if (fea.getGeometry() instanceof Polygon3D) {
+                        Polygon polygon = (Polygon) fea.getGeometry();
+                        Polygon polygon2 = new Polygon();
+                        for (int j = 0; j < polygon.pointNr(); j++) {
+                            polygon2.add(polygon.get(j));
+                        }
+                        fea.setGeometry(polygon2);
+                        features2D[i] = fea;
+                    }
+                }
+                features.clear();
+                for (int i = 0; i < features2D.length; i++) {
+                    features.add(features2D[i]);
+                }
+            }
+
+
+
+            taskStatus.message("_loading");
+            for (int i = 0; i < features.size(); i++) {
+
+                taskStatus.setCurValue(i);
+
+                FeatureProvider feature = store.createFeatureProvider(store
+                    .getStoreServices().getDefaultFeatureType());
+
+                Feature fea = (Feature) features.get(i);
+                try {
+
+                    feature.setOID(new Long(i));
+                    feature.set(ID_FIELD_ID, Integer.valueOf(i));
+                    feature.set(ID_FIELD_ENTITY, fea.getProp("dxfEntity"));
+                    feature.set(ID_FIELD_LAYER, fea.getProp("layer"));
+                    feature.set(ID_FIELD_COLOR, Integer.valueOf(fea
+                        .getProp("color")));
+                    feature.set(ID_FIELD_TEXT, fea.getProp("text"));
+                    feature.set(ID_FIELD_HEIGHTTEXT, toDouble(fea
+                        .getProp("textHeight")));
+                    feature.set(ID_FIELD_ROTATIONTEXT, toDouble(fea
+                        .getProp("textRotation")));
+                    feature.set(ID_FIELD_ELEVATION, toDouble(fea
+                        .getProp("elevation")));
+                    feature.set(ID_FIELD_THICKNESS, toDouble(fea
+                        .getProp("thickness")));
+                    feature.set(ID_FIELD_GEOMETRY, null);
+                    // FIXME: Abria que pillar el resto de atributos del DXF.
+
+                    // FIXME: Habia una incongruencia en el codigo ya que al
+                    // campo
+                    // ID_FIELD_GEOMETRY igual le asignaba una geometria que un
+                    // valor de cadena como 'Point3D', 'Polyline2D' o
+                    // 'Polyline3D'
+                    // Faltaria un atributo ID_FIELD_FSHAPE ?
+                    //
+
+                    Geometry geometry = null;
+
+                    if (fea.getGeometry() instanceof Point
+                        && !(fea.getGeometry() instanceof org.gvsig.dxf.px.gml.Point3D)) {
+                        Point point = (Point) fea.getGeometry();
+                        Point2D pto = new Point2D.Double();
+                        pto = point.get(0);
+
+                        geometry = gManager.createPoint(pto.getX(), pto.getY(),SUBTYPES.GEOM2D);
+
+                        if (point.isTextPoint()) {
+                            /// TODO labeling
+                        }
+                    } else if (fea.getGeometry() instanceof org.gvsig.dxf.px.gml.Point3D) {
+                        org.gvsig.dxf.px.gml.Point3D point = (org.gvsig.dxf.px.gml.Point3D) fea.getGeometry();
+                        Point3D pto = new Point3D();
+                        pto = point.getPoint3D(0);
+                        org.gvsig.fmap.geom.primitive.Point geom = gManager.createPoint(pto.getX(), pto.getY(),SUBTYPES.GEOM3D);
+                        geom.setCoordinateAt(Geometry.DIMENSIONS.Z, pto.getZ());
+
+                        geometry = geom;
+                        
+                        if (point.isTextPoint()) {
+                            /// TODO labeling
+                        }
+                    } else if (fea.getGeometry() instanceof LineString
+                        && !(fea.getGeometry() instanceof LineString3D)) {
+                        Point2D[] pts = new Point2D[fea.getGeometry().pointNr()];
+                        for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
+                            pts[j] = fea.getGeometry().get(j);
+                        }
+
+                        Curve curve = (Curve)gManager.create(TYPES.CURVE , SUBTYPES.GEOM2D);
+                        curve.addMoveToVertex(gManager.createPoint(pts[0].getX(), pts[0].getY(), SUBTYPES.GEOM2D));                        
+                        for (int j = 1; j < pts.length; j++) {
+                            curve.addVertex(gManager.createPoint(pts[j].getX(), pts[j].getY(), SUBTYPES.GEOM2D));
+                        }
+
+                        geometry = curve;                        
+
+                    } else if (fea.getGeometry() instanceof LineString3D) {                        
+                        Point3D[] pts = new Point3D[fea.getGeometry().pointNr()];
+                        for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
+                            pts[j] = ((LineString3D) fea.getGeometry()).getPoint3D(j);
+                        }
+                        double[] elevations = new double[pts.length];
+                        for (int j = 0; j < pts.length; j++) {
+                            elevations[j] = pts[j].getZ();
+                        }
+
+                        Curve curve = (Curve)gManager.create(TYPES.CURVE , SUBTYPES.GEOM2D);                   
+                        org.gvsig.fmap.geom.primitive.Point point = gManager.createPoint(pts[0].getX(), pts[0].getY(), SUBTYPES.GEOM3D);            
+                        point.setCoordinateAt(Geometry.DIMENSIONS.Z, elevations[0]);
+                        curve.addMoveToVertex(point);
+                        for (int j = 1; j < pts.length; j++) {
+                            point = gManager.createPoint(pts[j].getX(), pts[j].getY(), SUBTYPES.GEOM3D);            
+                            point.setCoordinateAt(Geometry.DIMENSIONS.Z, elevations[j]);
+                            curve.addVertex(point);
+                        }
+                        geometry = curve;                       
+
+                    } else if (fea.getGeometry() instanceof Polygon
+                        && !(fea.getGeometry() instanceof Polygon3D)) {
+
+                        Point2D firstPt = new Point2D.Double();
+                        firstPt = fea.getGeometry().get(0);
+                        Point2D[] pts = new Point2D[fea.getGeometry().pointNr() + 1];
+                        for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
+                            pts[j] = fea.getGeometry().get(j);
+                        }
+                        pts[fea.getGeometry().pointNr()] = firstPt;
+
+                        Surface surface = (Surface)gManager.create(TYPES.SURFACE , SUBTYPES.GEOM2D);
+                        surface.addMoveToVertex(gManager.createPoint(pts[0].getX(), pts[0].getY(), SUBTYPES.GEOM2D));
+                        for (int j = 1; j < pts.length; j++) {
+                            surface.addVertex(gManager.createPoint(pts[j].getX(), pts[j].getY(), SUBTYPES.GEOM2D));
+                        }
+                        surface.closePrimitive();
+
+                        geometry = surface;
+
+                    } else if (fea.getGeometry() instanceof Polygon3D) {                       
+                        Point3D firstPt = new Point3D();
+                        firstPt = ((Polygon3D) fea.getGeometry()).getPoint3D(0);
+                        Point3D[] pts = new Point3D[fea.getGeometry().pointNr() + 1];
+                        for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
+                            pts[j] = ((Polygon3D) fea.getGeometry()).getPoint3D(j);
+                        }
+                        pts[fea.getGeometry().pointNr()] = firstPt;
+                        double[] elevations = new double[pts.length];
+                        for (int j = 0; j < pts.length; j++) {
+                            elevations[j] = pts[j].getZ();
+                        }
+                        
+                        Surface surface = (Surface)gManager.create(TYPES.SURFACE , SUBTYPES.GEOM3D);                   
+                        org.gvsig.fmap.geom.primitive.Point point = gManager.createPoint(pts[0].getX(), pts[0].getY(), SUBTYPES.GEOM3D);            
+                        point.setCoordinateAt(Geometry.DIMENSIONS.Z, elevations[0]);
+                        surface.addMoveToVertex(point);                        
+                        
+                        for (int j = 1; j < pts.length; j++) {
+                            point = gManager.createPoint(pts[j].getX(), pts[j].getY(), SUBTYPES.GEOM3D);            
+                            point.setCoordinateAt(Geometry.DIMENSIONS.Z, elevations[0]);                            
+                            surface.addVertex(point);
+                        }
+                        surface.closePrimitive();
+                    
+                       geometry = surface;                        
+                    } else {					    
+                        logger.warn(
+                            MessageFormat.format(
+                                "load: geometry type {1} not supported",
+                                new Object[] { fea.getGeometry().getClass().getName() }
+                            )
+                        );
+                    }
+
+                    if (geometry != null){
+                        feature.set(ID_FIELD_GEOMETRY, geometry);
+                        feature.setDefaultGeometry(geometry);
+                        if (this.envelope == null) {
+                            this.envelope = geometry.getEnvelope();
+                        } else {
+                            this.envelope.add(geometry.getEnvelope());
+                        }
+                    }else{
+                        geometry = gManager.createNullGeometry(SUBTYPES.GEOM2D);
+                    }
+
+                    //Add the feature to the store
+                    store.addFeatureProvider(feature);
+
+                } catch (Exception e) {
+                    //throw new LoadException(e, fileName);
+                    // FIXME: add to log max 10
+                }
+                if (leyendBuilder != null) {
+                    try {
+                        leyendBuilder.process(feature);
+                    } catch (Exception e) {
+                        logger.warn(
+                            MessageFormat.format(
+                                "load: legendBuilder process fails in the feature {1}",
+                                fea
+                            )
+                        );
+                    }
+                }
+
+            }
+        }
+
+    }
+
+    public class Writer {
+        private Double DEFAULT_ELEVATION = new Double(0);
+
+        private DxfFile.EntityFactory entityMaker;
+
+        private IProjection proj = null;
+
+        private int handle = 40; // Revisar porqu� es 40.
+
+        private int k = 0;
+
+        private boolean dxf3DFile = false;
+        private String fileName;
+        private Envelope envelope;
+
+        public Writer initialice(File file, IProjection projection) {
+            this.proj = projection;
+            this.fileName = file.getAbsolutePath();
+            entityMaker = new DxfEntityMaker(proj);
+            return this;
+        }
+
+        public void begin() {
+            envelope = null;
+            entityMaker = new DxfEntityMaker(proj);
+        }
+
+        public void end() throws WriteException {
+            try {
+                DxfFile dxfFile = new DxfFile(null, fileName, entityMaker);
+                dxfFile.setCadFlag(true);
+                if (dxf3DFile) {
+                    dxfFile.setDxf3DFlag(true);
+                }
+                dxfFile.save(fileName);
+                dxfFile.close();
+            } catch (Exception e) {
+                throw new WriteException(fileName, e);
+            }
+        }
+
+        public void add(FeatureProvider feature) throws WriteException {
+            try {
+                Geometry geom = feature.getDefaultGeometry();
+                if(geom == null){
+                    //FIXME: tirar al log y avisar al usuario
+                    return;
+                }
+                GeometryType type = geom.getGeometryType();
+                boolean geometrySupported = true;
+
+                if ((TYPES.POINT == type.getType()) && (SUBTYPES.GEOM3D == type.getSubType())) {
+                    dxf3DFile = true;
+                    k = createPoint3D(handle, k, feature);
+
+                } else if ((TYPES.POINT == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createPoint2D(handle, k, feature);
+
+                } else if ((TYPES.CURVE == type.getType()) && (SUBTYPES.GEOM3D == type.getSubType())) {
+                    dxf3DFile = true;
+                    k = createPolyline3D(handle, k, feature);
+
+                } else if ((TYPES.ARC == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createArc2D(handle, k, feature);
+
+                } else if ((TYPES.CURVE == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createLwPolyline2D(handle, k, feature, false);
+
+                } else if ((TYPES.SURFACE == type.getType()) && (SUBTYPES.GEOM3D == type.getSubType())) {
+                    dxf3DFile = true;
+                    k = createPolyline3D(handle, k, feature);
+
+                } else if ((TYPES.CIRCLE == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createCircle2D(handle, k, feature);
+
+                } else if ((TYPES.ELLIPSE == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createEllipse2D(handle, k, feature);
+
+                } else if ((TYPES.SURFACE == type.getType()) && (SUBTYPES.GEOM2D == type.getSubType())) {
+                    k = createLwPolyline2D(handle, k, feature, true);
+
+                } else {
+                    geometrySupported = false;
+                    logger.warn(
+                        MessageFormat.format(
+                            "Geometry '{1}' not yet supported",
+                            new Object[] {geom.getClass().getName()}
+                        )
+                    );
+                    k++;
+                }
+                if (geometrySupported){
+                    if (this.envelope != null){
+                        this.envelope.add(feature.getDefaultEnvelope());
+                    } else {
+                        this.envelope = feature.getDefaultEnvelope().getGeometry().getEnvelope();
+                    }
+                }
+            } catch (Exception e) {
+                throw new WriteException(fileName, e);
+            }
+
+        }
+
+        private boolean hasText(FeatureProvider feature) {
+            if (feature.isNull(ID_FIELD_TEXT)) {
+                return false;
+            }
+            if (feature.get(ID_FIELD_TEXT).equals("")) {
+                return false;
+            }
+            return true;
+        }
+
+        private DxfGroupVector updateProperties(FeatureProvider feature, int k) {
+            DxfGroupVector polv = new DxfGroupVector();
+
+            String layer = (String) feature.get(ID_FIELD_LAYER);
+            Integer color = (Integer) feature.get(ID_FIELD_COLOR);
+            Double thickness = (Double) feature.get(ID_FIELD_THICKNESS);
+
+            DxfGroup geometryLayer = new DxfGroup(8, layer);
+
+            DxfGroup handleGroup = new DxfGroup();
+            handleGroup.setCode(5);
+            handleGroup.setData(new Integer(handle + k).toString());
+
+            DxfGroup handleColor = new DxfGroup();
+            handleColor.setCode(62);
+            handleColor.setData(color);
+
+            DxfGroup handleThickness = new DxfGroup();
+            handleThickness.setCode(39);
+            handleThickness.setData(thickness);
+
+            polv.add(geometryLayer);
+            polv.add(handleGroup);
+            polv.add(handleColor);
+            return polv;
+        }
+
+        private int createPoint2D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+
+            if (hasText(feature)) {
+                return createText2D(handle, k, feature);
+            }
+            org.gvsig.fmap.geom.primitive.Point point = geomManager.createPoint(0, 0, SUBTYPES.GEOM2D);
+            double[] pointCoords = new double[6];
+            PathIterator pointIt = (feature.getDefaultGeometry())
+            .getPathIterator(null);
+            while (!pointIt.isDone()) {
+                pointIt.currentSegment(pointCoords);
+                point = geomManager.createPoint(pointCoords[0], pointCoords[1], SUBTYPES.GEOM2D);
+                pointIt.next();
+            }
+            Point2D pto = new Point2D.Double(point.getX(), point.getY());
+
+            DxfGroup px = new DxfGroup();
+            DxfGroup py = new DxfGroup();
+            DxfGroup pz = new DxfGroup();
+            px.setCode(10);
+            px.setData(new Double(pto.getX()));
+            py.setCode(20);
+            py.setData(new Double(pto.getY()));
+            pz.setCode(30);
+            // FIXME: POINT del DXF tiene cota. Le asigno cero arbitrariamente.
+            pz.setData(new Double(0.0));
+            DxfGroupVector pv = updateProperties(feature, k);
+            pv.add(px);
+            pv.add(py);
+            pv.add(pz);
+            entityMaker.createPoint(pv);
+            k++;
+            return k;
+        }
+
+        private int createText2D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+
+            String text = feature.get(ID_FIELD_TEXT).toString();
+            Double heightText = (Double) feature.get(ID_FIELD_HEIGHTTEXT);
+            Double rotationText = (Double) feature.get(ID_FIELD_ROTATIONTEXT);
+
+            DxfGroup handleText = new DxfGroup();
+            handleText.setCode(1);
+            handleText.setData(text);
+
+            DxfGroup handleHeightText = new DxfGroup();
+            handleHeightText.setCode(40);
+            handleHeightText.setData(heightText);
+
+            DxfGroup handleRotationText = new DxfGroup();
+            handleRotationText.setCode(50);
+            handleRotationText.setData(rotationText);
+
+            org.gvsig.fmap.geom.primitive.Point point = geomManager.createPoint(0, 0, SUBTYPES.GEOM2D);
+            double[] pointCoords = new double[6];
+            PathIterator pointIt = (feature.getDefaultGeometry())
+            .getPathIterator(null);
+            while (!pointIt.isDone()) {
+                pointIt.currentSegment(pointCoords);
+                point = geomManager.createPoint(pointCoords[0], pointCoords[1], SUBTYPES.GEOM2D);
+                pointIt.next();
+            }
+            Point2D pto = new Point2D.Double(point.getX(), point.getY());
+            DxfGroup handleGroup = new DxfGroup();
+            handleGroup.setCode(5);
+            handleGroup.setData(new Integer(handle + k).toString());
+            DxfGroup px = new DxfGroup();
+            DxfGroup py = new DxfGroup();
+            DxfGroup pz = new DxfGroup();
+            px.setCode(10);
+            px.setData(new Double(pto.getX()));
+            py.setCode(20);
+            py.setData(new Double(pto.getY()));
+            pz.setCode(30);
+            // FIXME: POINT del DXF tiene cota. Le asigno cero arbitrariamente.
+            pz.setData(new Double(0.0));
+            DxfGroupVector pv = updateProperties(feature, k);
+            pv.add(handleText);
+            pv.add(handleHeightText);
+            pv.add(handleRotationText);
+            pv.add(handleGroup);
+            pv.add(px);
+            pv.add(py);
+            pv.add(pz);
+            entityMaker.createText(pv);
+            k++;
+            return k;
+        }
+
+        private int createPoint3D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+            if (hasText(feature)) {
+                return createText3D(handle, k, feature);
+            }
+            org.gvsig.fmap.geom.primitive.Point point = (org.gvsig.fmap.geom.primitive.Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
+            double[] pointCoords = new double[6];
+            PathIterator pointIt = (feature.getDefaultGeometry())
+            .getPathIterator(null);
+            while (!pointIt.isDone()) {
+                pointIt.currentSegment(pointCoords);
+                point = (org.gvsig.fmap.geom.primitive.Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
+                point.setCoordinateAt(0, pointCoords[0]);
+                point.setCoordinateAt(1, pointCoords[1]);
+                point.setCoordinateAt(2, pointCoords[2]);
+                pointIt.next();
+            }
+            org.gvsig.fmap.geom.primitive.Point pto = (org.gvsig.fmap.geom.primitive.Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
+            pto.setCoordinateAt(0, point.getCoordinateAt(0));
+            pto.setCoordinateAt(1,  point.getCoordinateAt(1));
+            pto.setCoordinateAt(2, point.getCoordinateAt(2));
+            DxfGroup px = new DxfGroup();
+            DxfGroup py = new DxfGroup();
+            DxfGroup pz = new DxfGroup();
+            px.setCode(10);
+            px.setData(new Double(pto.getX()));
+            py.setCode(20);
+            py.setData(new Double(pto.getY()));
+            pz.setCode(30);
+            pz.setData(new Double(pto.getCoordinateAt(2)));
+            double velev = ((org.gvsig.fmap.geom.primitive.Point) feature.getDefaultGeometry())
+            .getCoordinateAt(2);
+            Double elevation = DEFAULT_ELEVATION;
+            elevation = new Double(velev);
+            DxfGroup handleElevation = new DxfGroup();
+            handleElevation.setCode(38);
+            handleElevation.setData(elevation);
+
+            DxfGroupVector pv = updateProperties(feature, k);
+            pv.add(handleElevation);
+            pv.add(px);
+            pv.add(py);
+            pv.add(pz);
+            entityMaker.createPoint(pv);
+            k++;
+            return k;
+        }
+
+        private int createText3D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+
+            double velev = ((org.gvsig.fmap.geom.primitive.Point) feature.getDefaultGeometry())
+            .getCoordinateAt(0);
+
+            Double elevation = new Double(velev);
+            String text = feature.get(ID_FIELD_TEXT).toString();
+            Double heightText = (Double) feature.get(ID_FIELD_HEIGHTTEXT);
+            Double rotationText = (Double) feature.get(ID_FIELD_ROTATIONTEXT);
+
+            DxfGroup handleText = new DxfGroup();
+            handleText.setCode(1);
+            handleText.setData(text);
+
+            DxfGroup handleHeightText = new DxfGroup();
+            handleHeightText.setCode(40);
+            handleHeightText.setData(heightText);
+
+            DxfGroup handleRotationText = new DxfGroup();
+            handleRotationText.setCode(50);
+            handleRotationText.setData(rotationText);
+
+            DxfGroup handleElevation = new DxfGroup();
+            handleElevation.setCode(38);
+            handleElevation.setData(elevation);
+
+            org.gvsig.fmap.geom.primitive.Point point =
+                (org.gvsig.fmap.geom.primitive.Point) (feature
+                    .getDefaultGeometry()).getInternalShape();
+
+            DxfGroup handleGroup = new DxfGroup();
+            handleGroup.setCode(5);
+            handleGroup.setData(new Integer(handle + k).toString());
+            DxfGroup px = new DxfGroup();
+            DxfGroup py = new DxfGroup();
+            DxfGroup pz = new DxfGroup();
+            px.setCode(10);
+            px.setData(new Double(point.getX()));
+            py.setCode(20);
+            py.setData(new Double(point.getY()));
+            pz.setCode(30);
+            pz.setData(new Double(point.getCoordinateAt(2)));
+            DxfGroupVector pv = updateProperties(feature, k);
+            pv.add(handleElevation);
+            pv.add(handleText);
+            pv.add(handleHeightText);
+            pv.add(handleRotationText);
+            pv.add(handleGroup);
+            pv.add(px);
+            pv.add(py);
+            pv.add(pz);
+            entityMaker.createText(pv);
+            k++;
+            return k;
+        }
+
+        private int createLwPolyline2D(int handle, int k, FeatureProvider feature,
+            boolean isPolygon) throws Exception {
+            boolean first = true;
+            DxfGroupVector polv = updateProperties(feature, k);
+            Vector vpoints = new Vector();
+
+            DxfGroup polylineFlag = new DxfGroup();
+            polylineFlag.setCode(70);
+            if (isPolygon) {
+                polylineFlag.setData(new Integer(1)); // cerrada
+            } else {
+                polylineFlag.setData(new Integer(0)); // abierta
+            }
+
+            PathIterator theIterator = (feature.getDefaultGeometry())
+            .getPathIterator(null, geomManager.getFlatness()); // polyLine.
+            // getPathIterator
+            // (null,
+            // flatness);
+
+            double[] theData = new double[6];
+            while (!theIterator.isDone()) {
+                int theType = theIterator.currentSegment(theData);
+                switch (theType) {
+                case PathIterator.SEG_MOVETO:
+                    if (!first) {
+                        for (int j = 0; j < vpoints.size(); j++) {
+                            DxfGroup xvertex = new DxfGroup();
+                            xvertex.setCode(10);
+                            xvertex
+                            .setData(new Double(
+                                ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                                    .get(j)).getX()));
+                            DxfGroup yvertex = new DxfGroup();
+                            yvertex.setCode(20);
+                            yvertex
+                            .setData(new Double(
+                                ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                                    .get(j)).getY()));
+                            polv.add(xvertex);
+                            polv.add(yvertex);
+                        }
+
+                        entityMaker.createLwPolyline(polv);
+                        k++;
+                        polv = updateProperties(feature, k);
+
+                    }
+                    first = false;
+                    polv.add(polylineFlag);
+                    vpoints.clear();
+                    vpoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+                    break;
+                case PathIterator.SEG_LINETO:
+                    vpoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+                    break;
+                case PathIterator.SEG_QUADTO:
+                    break;
+                case PathIterator.SEG_CUBICTO:
+                    break;
+                case PathIterator.SEG_CLOSE:
+                    polylineFlag.setData(new Integer(1)); // cerrada
+                    break;
+
+                }
+                theIterator.next();
+            }
+
+            for (int j = 0; j < vpoints.size(); j++) {
+                DxfGroup xvertex = new DxfGroup();
+                xvertex.setCode(10);
+                xvertex
+                .setData(new Double(
+                    ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                        .get(j)).getX()));
+                DxfGroup yvertex = new DxfGroup();
+                yvertex.setCode(20);
+                yvertex
+                .setData(new Double(
+                    ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                        .get(j)).getY()));
+                polv.add(xvertex);
+                polv.add(yvertex);
+            }
+
+            entityMaker.createLwPolyline(polv);
+            k++;
+            return k;
+        }
+
+        private int createPolyline3D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+            DxfGroupVector polv = updateProperties(feature, k);
+            Vector vpoints = new Vector();
+            PathIterator theIterator = (feature.getDefaultGeometry())
+            .getPathIterator(null, geomManager.getFlatness()); // polyLine.
+            // getPathIterator
+            // (null,
+            // flatness);
+            double[] theData = new double[6];
+            Curve curve = (Curve) feature.getDefaultGeometry();
+            double[] velev = new double[curve.getNumVertices()];
+            for (int i = 0; i < curve.getNumVertices(); i++) {
+                velev[i] = curve.getCoordinateAt(i, 2);
+            }
+
+            while (!theIterator.isDone()) {
+                int theType = theIterator.currentSegment(theData);
+                switch (theType) {
+                case PathIterator.SEG_MOVETO:
+                    vpoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+                    break;
+                case PathIterator.SEG_LINETO:
+                    vpoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+                    break;
+                }
+                theIterator.next();
+            }
+            if (constantElevation(velev)) {
+                DxfGroup polylineFlag = new DxfGroup();
+                polylineFlag.setCode(70);
+                polylineFlag.setData(new Integer(0));
+                polv.add(polylineFlag);
+                DxfGroup elevation = new DxfGroup();
+                elevation.setCode(38);
+                elevation.setData(new Double(velev[0]));
+                polv.add(elevation);
+                for (int j = 0; j < vpoints.size(); j++) {
+                    DxfGroup xvertex = new DxfGroup();
+                    xvertex.setCode(10);
+                    xvertex.setData(new Double(
+                        ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                            .get(j)).getX()));
+                    DxfGroup yvertex = new DxfGroup();
+                    yvertex.setCode(20);
+                    yvertex.setData(new Double(
+                        ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                            .get(j)).getY()));
+                    polv.add(xvertex);
+                    polv.add(yvertex);
+                }
+                entityMaker.createLwPolyline(polv);
+                k++;
+            } else {
+                DxfGroup polylineFlag = new DxfGroup();
+                polylineFlag.setCode(70);
+                polylineFlag.setData(new Integer(8));
+                polv.add(polylineFlag);
+                DxfGroup xgroup = new DxfGroup();
+                xgroup.setCode(10);
+                xgroup.setData(new Double(0.0));
+                polv.add(xgroup);
+                DxfGroup ygroup = new DxfGroup();
+                ygroup.setCode(20);
+                ygroup.setData(new Double(0.0));
+                polv.add(ygroup);
+                DxfGroup elevation = new DxfGroup();
+                elevation.setCode(30);
+                elevation.setData(new Double(0.0));
+                polv.add(elevation);
+                DxfGroup subclassMarker = new DxfGroup(100, "AcDb3dPolyline");
+                polv.add(subclassMarker);
+                entityMaker.createPolyline(polv);
+                k++;
+                for (int j = 0; j < vpoints.size(); j++) {
+                    DxfGroupVector verv = new DxfGroupVector();
+                    DxfGroup entityType = new DxfGroup(0, "VERTEX");
+                    verv.add(entityType);
+                    DxfGroup generalSubclassMarker = new DxfGroup(100,
+                    "AcDbEntity");
+                    verv.add(generalSubclassMarker);
+                    DxfGroup layerName = new DxfGroup(8, "default");
+                    verv.add(layerName);
+                    DxfGroup vertexSubclassMarker = new DxfGroup(100,
+                    "AcDbVertex");
+                    verv.add(vertexSubclassMarker);
+                    DxfGroup xvertex = new DxfGroup();
+                    xvertex.setCode(10);
+                    xvertex.setData(new Double(
+                        ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                            .get(j)).getX()));
+                    DxfGroup yvertex = new DxfGroup();
+                    yvertex.setCode(20);
+                    yvertex.setData(new Double(
+                        ((org.gvsig.fmap.geom.primitive.Point) vpoints
+                            .get(j)).getY()));
+                    DxfGroup zvertex = new DxfGroup();
+                    zvertex.setCode(30);
+                    zvertex.setData(new Double(velev[j]));
+                    verv.add(xvertex);
+                    verv.add(yvertex);
+                    verv.add(zvertex);
+                    entityMaker.addVertex(verv);
+                    k++;
+                }
+                DxfGroupVector seqv = new DxfGroupVector();
+                DxfGroup entityType = new DxfGroup(0, "SEQEND");
+                seqv.add(entityType);
+                DxfGroup generalSubclassMarker = new DxfGroup(100, "AcDbEntity");
+                seqv.add(generalSubclassMarker);
+                DxfGroup layerName = new DxfGroup(8, "default");
+                seqv.add(layerName);
+                DxfGroup handleSeqGroup = new DxfGroup();
+                handleSeqGroup.setCode(5);
+                handleSeqGroup.setData(new Integer(handle + k).toString());
+                seqv.add(handleSeqGroup);
+                entityMaker.endSeq();
+                k++;
+            }
+            return k;
+        }
+
+        private boolean constantElevation(double[] velev) {
+            boolean constant = true;
+            for (int i = 0; i < velev.length; i++) {
+                for (int j = 0; j < velev.length; j++) {
+                    if (j > i) {
+                        if (velev[i] != velev[j]) {
+                            constant = false;
+                            break;
+                        }
+                    }
+                }
+                break;
+            }
+            return constant;
+        }
+
+        private int createCircle2D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+            DxfGroupVector polv = updateProperties(feature, k);
+            DxfGroup circleFlag = new DxfGroup();
+            circleFlag.setCode(100);
+            polv.add(circleFlag);
+
+            DxfGroup xvertex = new DxfGroup();
+            xvertex.setCode(10);
+            Circle circle = (Circle) (feature
+                .getDefaultGeometry()).getInternalShape();
+            xvertex.setData(new Double(circle.getCenter().getX()));
+            DxfGroup yvertex = new DxfGroup();
+            yvertex.setCode(20);
+            yvertex.setData(new Double(circle.getCenter().getY()));
+            DxfGroup zvertex = new DxfGroup();
+            zvertex.setCode(30);
+            // TODO: COORDENADA Z. REVISAR ESTO PARA ENTIDADES 3D
+            zvertex.setData(new Double(0));
+
+            DxfGroup radius = new DxfGroup();
+            radius.setCode(40);
+            radius.setData(new Double(circle.getRadious()));
+
+            polv.add(xvertex);
+            polv.add(yvertex);
+            polv.add(zvertex);
+            polv.add(radius);
+
+            entityMaker.createCircle(polv);
+            k++;
+            return k;
+        }
+
+        private int createArc2D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+            Arc arc = (Arc) (feature.getDefaultGeometry())
+            .getInternalShape();
+            org.gvsig.fmap.geom.primitive.Point[] pts = new org.gvsig.fmap.geom.primitive.Point[3];
+            pts[0] = arc.getInitPoint();
+            pts[1] = arc.getCenterPoint();
+            pts[2] = arc.getEndPoint();
+            org.gvsig.fmap.geom.primitive.Point center = arc.getCenterPoint();
+            GeometryOperationContext ctx = new GeometryOperationContext();
+            ctx.setAttribute("geom", pts[0]);
+            double radius = ((Double)geomManager.invokeOperation(PointDistance.CODE, center, ctx)).doubleValue();
+
+            double initAngle = ((Double)geomManager.invokeOperation(PointGetAngle.CODE, center, ctx)).doubleValue();
+            initAngle = Math.toDegrees(initAngle);
+            ctx.setAttribute("geom", pts[1]);
+            double midAngle = ((Double)geomManager.invokeOperation(PointGetAngle.CODE, center, ctx)).doubleValue();
+            midAngle = Math.toDegrees(midAngle);
+            ctx.setAttribute("geom", pts[2]);
+            double endAngle = ((Double)geomManager.invokeOperation(PointGetAngle.CODE, center, ctx)).doubleValue();
+            endAngle = Math.toDegrees(endAngle);
+
+            DxfGroup ax = new DxfGroup();
+            DxfGroup ay = new DxfGroup();
+            DxfGroup ac = new DxfGroup();
+            DxfGroup ai = new DxfGroup();
+            DxfGroup ae = new DxfGroup();
+            ax.setCode(10);
+            ax.setData(new Double(center.getX()));
+            ay.setCode(20);
+            ay.setData(new Double(center.getY()));
+            ac.setCode(40);
+            ac.setData(new Double(radius));
+            ai.setCode(50);
+            ai.setData(new Double(initAngle));
+            ae.setCode(51);
+            ae.setData(new Double(endAngle));
+            DxfGroupVector av = updateProperties(feature, k);
+            av.add(ax);
+            av.add(ay);
+            av.add(ac);
+            av.add(ai);
+            av.add(ae);
+            entityMaker.createArc(av);
+            k++;
+            return k;
+        }
+
+        private int createEllipse2D(int handle, int k, FeatureProvider feature)
+        throws Exception {
+            Ellipse ellipse = (Ellipse) (feature
+                .getDefaultGeometry()).getInternalShape();
+
+            org.gvsig.fmap.geom.primitive.Point center = (org.gvsig.fmap.geom.primitive.Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
+            center.setCoordinateAt(0, (ellipse.getAxis1Start().getX() + ellipse.getAxis1End().getX()) / 2);
+            center.setCoordinateAt(1, (ellipse.getAxis1Start().getY() + ellipse.getAxis1End().getY()) / 2);
+
+            double mAxisL = ellipse.getAxis2Dist() * 2;
+            GeometryOperationContext ctx = new GeometryOperationContext();
+            ctx.setAttribute("geom", ellipse.getAxis1End());
+            double maAxisL = ((Double)geomManager.invokeOperation(PointDistance.CODE, ellipse.getAxis1Start(), ctx)).doubleValue();
+
+            Point2D endPointOfMajorAxis = new Point2D.Double(ellipse.getAxis1End().getX(), ellipse.getAxis1End().getY());
+            double azimut = Math
+            .atan2(endPointOfMajorAxis.getX() - center.getX(),
+                endPointOfMajorAxis.getY() - center.getY());
+            double azimut2 = azimut + Math.PI / 2.0;
+            if (azimut2 >= Math.PI * 2) {
+                azimut2 = azimut2 - Math.PI * 2;
+            }
+            Point2D endPointOfMinorAxis = new Point2D.Double(center.getX()
+                + (ellipse.getAxis2Dist() * Math.sin(azimut2)), center.getY()
+                + (ellipse.getAxis2Dist() * Math.cos(azimut2)));
+
+            if (mAxisL >= maAxisL) {
+                // El menor debe ser menor que el mayor. Los cambiamos.
+                double aux = mAxisL;
+                mAxisL = maAxisL;
+                maAxisL = aux;
+                // Tambi�n cambiamos los puntos finales de los ejes.
+                Point2D pAux = endPointOfMinorAxis;
+                endPointOfMinorAxis = endPointOfMajorAxis;
+                endPointOfMajorAxis = pAux;
+            }
+            double mToMAR = mAxisL / maAxisL;
+            DxfGroup x = new DxfGroup();
+            DxfGroup y = new DxfGroup();
+            DxfGroup xc = new DxfGroup();
+            DxfGroup yc = new DxfGroup();
+            DxfGroup minToMaj = new DxfGroup();
+            x.setCode(10);
+            x.setData(new Double(center.getX()));
+            y.setCode(20);
+            y.setData(new Double(center.getY()));
+            xc.setCode(11);
+            xc.setData(new Double(endPointOfMajorAxis.getX() - center.getX()));
+            yc.setCode(21);
+            yc.setData(new Double(endPointOfMajorAxis.getY() - center.getY()));
+            minToMaj.setCode(40);
+            minToMaj.setData(new Double(mToMAR));
+            DxfGroupVector av = updateProperties(feature, k);
+            av.add(x);
+            av.add(y);
+            av.add(xc);
+            av.add(yc);
+            av.add(minToMaj);
+            entityMaker.createEllipse(av);
+            k++;
+            return k;
+        }
+
+        public Envelope getEnvelope() {
+            return this.envelope;
+        }
+
+    }
+
+    public boolean closeResourceRequested(ResourceProvider resource) {
+        return true;
+    }
+
+    public int getOIDType() {
+        return DataTypes.LONG;
+    }
+
+    public boolean supportsAppendMode() {
+        return false;
+    }
+
+    public void append(FeatureProvider featureProvider) {
+        try {
+            writer.add(featureProvider);
+        } catch (WriteException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public void beginAppend() {
+        try {
+            writer = new Writer().initialice((File) resource.get(), projection);
+            writer.begin();
+        } catch (AccessResourceException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public void endAppend() {
+        try {
+            resource.notifyOpen();
+            writer.end();
+            resource.notifyClose();
+            counterNewsOIDs = 0;
+        } catch (ResourceNotifyOpenException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (ResourceNotifyCloseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (WriteException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+        // TODO Auto-generated method stub
+        throw new NotYetImplemented();
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+        // TODO Auto-generated method stub
+        throw new NotYetImplemented();
+    }
+
+    public Object createNewOID() {
+        return new Long(counterNewsOIDs++);
+    }
+
+    protected void initializeFeatureTypes() throws InitializeException {
+        try {
+            this.open();
+        } catch (OpenException e) {
+            throw new InitializeException(this.getProviderName(), e);
+        }
+    }
+
+    public Envelope getEnvelope() throws DataException {
+        this.open();
+        return this.envelope;
+    }
+
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        if( DataStore.METADATA_ENVELOPE.equalsIgnoreCase(name) ) {
+            try {
+                return this.getEnvelope();
+            } catch (DataException e) {
+                return null;
+            }
+        }
+        return super.getDynValue(name);
+    }
+
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+     * gvsig.fmap.dal.resource.spi.ResourceProvider)
+     */
+    public void resourceChanged(ResourceProvider resource) {
+        this.getStoreServices().notifyChange(
+            DataStoreNotification.RESOURCE_CHANGED,
+            resource);
+    }
+
+
+    public Object getSourceId() {
+        return this.getDXFParameters().getFile();
+    }
+
+    public String getName() {
+        String name = this.getDXFParameters().getFile().getName();
+        int n = name.lastIndexOf(".");
+        if( n<1 ) {
+            return name;
+        }
+        return name.substring(0, n);
+    }
+
+    public String getFullName() {
+        return this.getDXFParameters().getFile().getAbsolutePath();
+    }
+
+    public ResourceProvider getResource() {
+        return resource;
+    }
+
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.java	(revision 38736)
@@ -0,0 +1,76 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn.legend;
+
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
+import org.gvsig.fmap.dal.store.dxf.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DGNGetLabeling implements DynMethod {
+	private static int code = DynObjectManager.NULLCODE;
+
+	static void register(DynClass DGNDynClass) {
+		if (code != DynObjectManager.NULLCODE) {
+			return;
+		}
+		code = ToolsLocator.getDynObjectManager().registerDynMethod(
+			DGNDynClass, 
+			new DGNGetLabeling()
+		);
+
+	}
+	public int getCode() throws DynMethodNotSupportedException {
+		return code;
+	}
+
+	public String getDescription() {
+		return "DGN Labeling";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_GETLABELING_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		try {
+			return ((DGNStoreProvider) self).getLabeling();
+		} catch (OpenException e) {
+			//FIXME
+			throw new RuntimeException(e);
+		}
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.java	(revision 38736)
@@ -0,0 +1,75 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn.legend;
+
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
+import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DGNGetLegend implements DynMethod {
+	private static int code = DynObjectManager.NULLCODE;
+
+	static void register(DynClass DGNDynClass) {
+		if (code != DynObjectManager.NULLCODE) {
+			return;
+		}
+		code = ToolsLocator.getDynObjectManager().registerDynMethod(
+			DGNDynClass, 
+			new DGNGetLegend()
+		);
+
+	}
+	public int getCode() throws DynMethodNotSupportedException {
+		return code;
+	}
+
+	public String getDescription() {
+		return "DGN Legend";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_GETLEGEND_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		try {
+			return ((DGNStoreProvider) self).getLegend();
+		} catch (OpenException e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.java	(revision 38736)
@@ -0,0 +1,67 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.store.dgn.legend;
+
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.store.dgn.DGNLibrary;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
+import org.gvsig.metadata.MetadataLibrary;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DGNLegendLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DGNLibrary.class);
+        require(MetadataLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
+			.getDefinition(DGNStoreProvider.METADATA_DEFINITION_NAME);
+		DGNGetLegendBuilder.register(metadataDefinition);
+		DGNGetLegend.register(metadataDefinition);
+		DGNGetLabeling.register(metadataDefinition);
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.java	(revision 38736)
@@ -0,0 +1,70 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn.legend;
+
+import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public class DGNGetLegendBuilder implements DynMethod {
+	private static int code = DynObjectManager.NULLCODE;
+
+	static void register(DynClass DGNDynClass) {
+		if (code != DynObjectManager.NULLCODE) {
+			return;
+		}
+		code = ToolsLocator.getDynObjectManager().registerDynMethod(
+			DGNDynClass, 
+			new DGNGetLegendBuilder()
+		);
+
+	}
+	
+	public int getCode() throws DynMethodNotSupportedException {
+		return code;
+	}
+
+	public String getDescription() {
+		return "DGN LegendBuilder creator";
+	}
+
+	public String getName() {
+		return LegendBuilder.DYNMETHOD_BUILDER_NAME;
+	}
+
+	public Object invoke(Object self, DynObject context)
+			throws DynMethodException {
+		return new DGNLegendBuilder();
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.java	(revision 38736)
@@ -0,0 +1,136 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn.legend;
+
+import java.awt.Color;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
+import org.gvsig.fmap.dal.store.dgn.LegendBuilder;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.symbology.SymbologyLocator;
+import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy;
+import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
+import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
+import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
+
+public class DGNLegendBuilder implements LegendBuilder {
+
+	private MapContextManager mapContextManager = MapContextLocator
+			.getMapContextManager();
+
+	private IVectorialUniqueValueLegend defaultLegend = null;
+	private IAttrInTableLabelingStrategy labelingStragegy = null;
+
+	public void begin() {
+		// Nothing to do
+	}
+
+	public void end() {
+		// Nothing to do
+	}
+
+	public Object getLegend() {
+		return defaultLegend;
+	}
+
+	public LegendBuilder initialize(FeatureStoreProvider store) {
+		defaultLegend = (IVectorialUniqueValueLegend) mapContextManager.createLegend(
+						IVectorialUniqueValueLegend.LEGEND_NAME);
+		defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY);
+		defaultLegend
+				.setClassifyingFieldNames(new String[] { DGNStoreProvider.NAME_FIELD_COLOR });
+		defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT });
+
+		ISymbol myDefaultSymbol =
+				mapContextManager.getSymbolManager()
+				.createSymbol(Geometry.TYPES.GEOMETRY); 
+
+		defaultLegend.setDefaultSymbol(myDefaultSymbol);
+		defaultLegend.useDefaultSymbol(true);
+
+		labelingStragegy = SymbologyLocator.getSymbologyManager().createAttrInTableLabelingStrategy();
+		labelingStragegy.setTextField(DGNStoreProvider.NAME_FIELD_TEXT);
+		labelingStragegy
+				.setRotationField(DGNStoreProvider.NAME_FIELD_ROTATIONTEXT);
+		labelingStragegy.setHeightField(DGNStoreProvider.NAME_FIELD_HEIGHTTEXT);
+		labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters)
+		return this;
+	}
+
+	public void process(FeatureProvider feature, DGNReader dgnReader) {
+		Integer clave = (Integer) feature.get("Color");
+		if (clave == null) {
+			return;
+		}
+
+		defaultLegend.useDefaultSymbol(false);
+		if (defaultLegend.getSymbolByValue(clave) == null) {
+			ISymbol theSymbol;
+			Color color = dgnReader.DGNLookupColor(clave.intValue());
+			theSymbol =
+					mapContextManager.getSymbolManager().createSymbol(
+					Geometry.TYPES.GEOMETRY, color); 
+
+			theSymbol.setDescription(clave.toString());
+
+			if (theSymbol instanceof IMarkerSymbol) {
+				((IMarkerSymbol) theSymbol).setSize(1);
+			}
+
+			if (theSymbol instanceof ILineSymbol) {
+				ILineSymbol lineSymbol = (ILineSymbol) theSymbol;
+				lineSymbol.setLineWidth(1);
+				lineSymbol.setLineColor(color);
+			}
+
+			if (theSymbol instanceof IFillSymbol) {
+				IFillSymbol fillSymbol = (IFillSymbol) theSymbol;
+				fillSymbol.getOutline().setLineColor(color);
+				fillSymbol.getOutline().setLineWidth(1);
+				fillSymbol.setFillColor(null);
+			}
+			if (theSymbol != null) {
+				defaultLegend.addSymbol(clave, theSymbol);
+			}
+		}
+	}
+
+	public Object getLabeling() {
+		return labelingStragegy;
+	}
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNFilesystemServerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNFilesystemServerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNFilesystemServerProvider.java	(revision 38736)
@@ -0,0 +1,102 @@
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.io.File;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
+
+public class DGNFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider 
+	implements FilesystemServerExplorerProvider, ResourceConsumer {
+
+//	private FilesystemServerExplorerProviderServices serverExplorer;
+
+	public String getDataStoreProviderName() {
+		return DGNStoreProvider.NAME;
+	}
+
+	public int getMode() {
+		return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
+	}
+
+	public boolean accept(File pathname) {
+		return (pathname.getName().toLowerCase().endsWith(".dgn"));
+	}
+
+	public String getDescription() {
+		return DGNStoreProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		DGNStoreParameters params = (DGNStoreParameters) manager
+				.createStoreParameters(this
+				.getDataStoreProviderName());
+		params.setFile(file);
+		return params;
+	}
+
+	public boolean canCreate() {
+		return false;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		return this.canCreate();
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+		throw new UnsupportedOperationException();
+	}
+
+	public NewDataStoreParameters getCreateParameters() throws DataException {
+		return null;
+	}
+
+	public void initialize(
+			FilesystemServerExplorerProviderServices serverExplorer) {
+//		this.serverExplorer = serverExplorer;
+	}
+
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		File file = new File(((DGNStoreParameters) parameters).getFileName());
+		if (!file.exists()) {
+			throw new RemoveException(this.getDataStoreProviderName(),
+					new FileNotFoundException(file));
+		}
+		if (!file.delete()) {
+			// FIXME throws ???
+		}
+
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		// while it is using a resource anyone can't close it
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
+	 */
+	public void resourceChanged(ResourceProvider resource) {
+		//Do nothing
+
+	}
+
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNFilesystemServerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProvider.java	(revision 38736)
@@ -0,0 +1,994 @@
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNElemArc;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNElemComplexHeader;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNElemCore;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNElemMultiPoint;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNElemText;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNFileHeader;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+public class DGNStoreProvider extends AbstractMemoryStoreProvider implements
+		ResourceConsumer {
+//	private static final Logger logger = LoggerFactory.getLogger(DGNStoreProvider.class);
+
+	public static final String NAME = "DGN";
+	public static final String DESCRIPTION = "DGN file";
+	
+	public static final String METADATA_DEFINITION_NAME = NAME;
+	private static final String METADATA_DEFINITION_DESCRIPTION = "DGN File Store";
+
+	private static final String NAME_FIELD_ID = "ID";
+	private static final String NAME_FIELD_GEOMETRY = "Geometry";
+	private static final String NAME_FIELD_ENTITY = "Entity";
+	private static final String NAME_FIELD_LAYER = "Layer";
+	public static final String NAME_FIELD_COLOR = "Color";
+//	private static final String NAME_FIELD_ELEVATION = "Elevation";
+//	private static final String NAME_FIELD_THICKNESS = "Thickness";
+	public static final String NAME_FIELD_TEXT = "Text";
+	public static final String NAME_FIELD_HEIGHTTEXT = "HeightText";
+	public static final String NAME_FIELD_ROTATIONTEXT = "Rotation";
+
+
+	private int ID_FIELD_ID = 0;
+	private int ID_FIELD_ENTITY = 1;
+	private int ID_FIELD_LAYER = 2;
+	private int ID_FIELD_COLOR = 3;
+//	private int ID_FIELD_ELEVATION = 4;
+//	private int ID_FIELD_THICKNESS = 5;
+	private int ID_FIELD_TEXT = 6;
+	private int ID_FIELD_HEIGHTTEXT = 7;
+	private int ID_FIELD_ROTATIONTEXT = 8;
+//	private int ID_FIELD_GEOMETRY = 9;
+
+	private IProjection projection;
+	private ResourceProvider resource;
+	private LegendBuilder legendBuilder;
+
+	private long counterNewsOIDs = 0;
+	protected GeometryManager geomManager = GeometryLocator.getGeometryManager();
+
+	public DGNStoreProvider(DGNStoreParameters parameters,
+			DataStoreProviderServices storeServices) throws InitializeException {
+		super(
+			parameters, 
+			storeServices, 
+			FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME)
+		);
+
+		counterNewsOIDs = 0;
+		//		projection = CRSFactory.getCRS(getParameters().getSRSID());
+
+		File file = getDGNParameters().getFile();
+		resource = this.createResource(
+				FileResource.NAME,
+				new Object[] { file.getAbsolutePath() }
+			);
+
+		resource.addConsumer(this);
+
+		this.projection = this.getDGNParameters().getCRS();
+
+
+		try {
+			legendBuilder = (LegendBuilder) this.invokeDynMethod(
+					LegendBuilder.DYNMETHOD_BUILDER_NAME, null);
+		} catch (DynMethodException e) {
+			legendBuilder = null;
+		} catch (Exception e) {
+			throw new InitializeException(e);
+		}
+
+		this.initializeFeatureTypes();
+
+	}
+
+	private DGNStoreParameters getDGNParameters() {
+		return (DGNStoreParameters) this.getParameters();
+	}
+
+
+	public String getProviderName() {
+		return NAME;
+	}
+
+	public boolean allowWrite() {
+		return true;
+	}
+
+	public Object getLegend() throws OpenException {
+		this.open();
+		if (legendBuilder == null) {
+			return null;
+		}
+		return legendBuilder.getLegend();
+	}
+
+	public Object getLabeling() throws OpenException {
+		this.open();
+		if (legendBuilder == null) {
+			return null;
+		}
+		return legendBuilder.getLabeling();
+	}
+
+	private class DGNData {
+		public List data = null;
+		public FeatureType defaultFType = null;
+		public List fTypes = null;
+		public Envelope envelope = null;
+		public IProjection projection;
+		public LegendBuilder legendBuilder;
+		public Envelope getEnvelopeCopy() throws CreateEnvelopeException {
+			if (envelope == null) {
+				return null;
+			}
+			Envelope newEnvelope;
+			if (envelope.getDimension() == 2) {
+				newEnvelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
+			} else {
+				newEnvelope = geomManager.createEnvelope(SUBTYPES.GEOM3D);
+
+			}
+			newEnvelope.setLowerCorner(envelope.getLowerCorner());
+			newEnvelope.setUpperCorner(envelope.getUpperCorner());
+			return newEnvelope;
+		}
+	}
+
+	public void open() throws OpenException {
+		if (this.data != null) {
+			return;
+		}
+		try {
+			getResource().execute(new ResourceAction() {
+				public Object run() throws Exception {
+					FeatureStoreProviderServices store = getStoreServices();
+					DGNData DGNData = null;
+					if (resource.getData() != null) {
+						DGNData =
+								(DGNData) ((Map) resource.getData()).get(projection.getAbrev()); // OJO
+						// no es del todo correcto (puede llevar reproyeccion)
+					} else {
+						resource.setData(new HashMap());
+					}
+					if (DGNData == null) {
+						DGNData = new DGNData();
+						DGNData.data = new ArrayList();
+						data = DGNData.data;
+						counterNewsOIDs = 0;
+						Reader reader =
+								new Reader().initialice(getMemoryProvider(),
+										(File)resource.get(),
+										projection, legendBuilder);
+						reader.begin(store);
+						DGNData.defaultFType =
+								reader.getDefaultType().getNotEditableCopy();
+						List types = new ArrayList();
+						Iterator it = reader.getTypes().iterator();
+						EditableFeatureType fType;
+						while (it.hasNext()) {
+							fType = (EditableFeatureType) it.next();
+							if (fType.getId().equals(
+									DGNData.defaultFType.getId())) {
+								types.add(DGNData.defaultFType);
+							} else {
+								types.add(fType.getNotEditableCopy());
+							}
+						}
+						DGNData.fTypes = types;
+
+						resource.notifyOpen();
+						store.setFeatureTypes(DGNData.fTypes,
+								DGNData.defaultFType);
+						reader.load();
+						// envelope = reader.getEnvelope();
+
+						DGNData.envelope = reader.getEnvelope();
+
+						DGNData.legendBuilder = legendBuilder;
+
+						DGNData.projection = projection;
+
+						reader.end();
+						resource.notifyClose();
+						((Map) resource.getData()).put(projection.getAbrev(),
+								DGNData); // OJO la
+						// reproyeccion
+					}
+
+					data = DGNData.data;
+					store.setFeatureTypes(DGNData.fTypes, DGNData.defaultFType);
+					legendBuilder = DGNData.legendBuilder;
+					setDynValue("Envelope", DGNData.getEnvelopeCopy());
+					setDynValue("CRS", projection);
+					counterNewsOIDs = data.size();
+					return null;
+				}
+			});
+		} catch (Exception e) {
+			data = null;
+			try {
+				throw new OpenException(resource.getName(), e);
+			} catch (AccessResourceException e1) {
+				throw new OpenException(getProviderName(), e);
+			}
+		}
+	}
+
+
+	public DataServerExplorer getExplorer() throws ReadException {
+		DataManager manager = DALLocator.getDataManager();
+		FilesystemServerExplorerParameters params;
+		try {
+			params = (FilesystemServerExplorerParameters) manager
+				.createServerExplorerParameters(FilesystemServerExplorer.NAME);
+			params.setRoot(this.getDGNParameters().getFile().getParent());
+			return manager.openServerExplorer(FilesystemServerExplorer.NAME, params);
+		} catch (DataException e) {
+			throw new ReadException(this.getProviderName(), e);
+		} catch (ValidateDataParametersException e) {
+			throw new ReadException(this.getProviderName(), e);
+		}
+
+	}
+
+
+
+	public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator originalFeatureTypesUpdated) throws PerformEditingException {
+		// FIXME Exception
+		throw new UnsupportedOperationException();
+	}
+
+	public class Reader {
+		private File file;
+//		private String fileName;
+		private IProjection projection;
+		private List types;
+		private LegendBuilder leyendBuilder;
+		private AbstractMemoryStoreProvider store;
+		private Envelope envelope;
+
+		public Reader initialice(AbstractMemoryStoreProvider store, File file,
+				IProjection projection,
+				LegendBuilder leyendBuilder) {
+			this.store = store;
+			this.file = file;
+//			this.fileName = file.getAbsolutePath();
+			this.projection = projection;
+			this.leyendBuilder = leyendBuilder;
+			if (leyendBuilder != null) {
+				leyendBuilder.initialize(store);
+			}
+			return this;
+		}
+
+		public Envelope getEnvelope() {
+			return this.envelope;
+		}
+
+		public void begin(FeatureStoreProviderServices store) {
+
+			EditableFeatureType featureType = store.createFeatureType();
+
+			featureType.setHasOID(true);
+
+			ID_FIELD_ID = featureType.add(NAME_FIELD_ID, DataTypes.INT)
+					.setDefaultValue(Integer.valueOf(0))
+				.getIndex();
+
+			// FIXME: Cual es el size y el valor por defecto para Entity ?
+			ID_FIELD_ENTITY = featureType.add(NAME_FIELD_ENTITY,
+					DataTypes.STRING, 100)
+					.setDefaultValue("")
+					.getIndex();
+
+			// FIXME: Cual es el size de Layer ?
+			ID_FIELD_LAYER = featureType.add(NAME_FIELD_LAYER,
+					DataTypes.STRING, 100)
+					.setDefaultValue(
+					"default").getIndex();
+
+			ID_FIELD_COLOR = featureType.add(NAME_FIELD_COLOR,
+					DataTypes.INT)
+					.setDefaultValue(
+					Integer.valueOf(0)).getIndex();
+
+//			ID_FIELD_ELEVATION = featureType.add(NAME_FIELD_ELEVATION,
+//					DataTypes.DOUBLE)
+//					.setDefaultValue(
+//					Double.valueOf(0)).getIndex();
+//
+//			ID_FIELD_THICKNESS = featureType.add(NAME_FIELD_THICKNESS,
+//					DataTypes.DOUBLE)
+//					.setDefaultValue(
+//					Double.valueOf(0)).getIndex();
+//
+			// FIXME: Cual es el size de Text ?
+			ID_FIELD_TEXT = featureType.add(NAME_FIELD_TEXT,
+					DataTypes.STRING, 100)
+					.setDefaultValue("")
+					.getIndex();
+
+			ID_FIELD_HEIGHTTEXT = featureType.add(NAME_FIELD_HEIGHTTEXT,
+					DataTypes.DOUBLE).setDefaultValue(
+					Double.valueOf(10)).getIndex();
+
+			ID_FIELD_ROTATIONTEXT = featureType.add(NAME_FIELD_ROTATIONTEXT,
+					DataTypes.DOUBLE).setDefaultValue(
+					Double.valueOf(0)).getIndex();
+
+
+			EditableFeatureAttributeDescriptor attr = featureType.add(
+					NAME_FIELD_GEOMETRY, DataTypes.GEOMETRY);
+			attr.setSRS(this.projection);
+			attr.setGeometryType(Geometry.TYPES.GEOMETRY);
+			attr.setGeometrySubType(Geometry.SUBTYPES.GEOM3D);
+//			ID_FIELD_GEOMETRY = attr.getIndex();
+
+			featureType.setDefaultGeometryAttributeName(NAME_FIELD_GEOMETRY);
+
+
+			// FIXME: Parece que el DGN puede tener mas atributos opcionales.
+			// Habria que ver de pillarlos ?
+
+			types = new ArrayList();
+			types.add(featureType);
+
+			if (leyendBuilder != null) {
+				leyendBuilder.begin();
+			}
+
+		}
+
+		public void end() {
+			if (leyendBuilder != null) {
+				leyendBuilder.end();
+			}
+		}
+
+		public List getTypes() {
+			return types;
+		}
+
+		public EditableFeatureType getDefaultType() {
+			return (EditableFeatureType) types.get(0);
+		}
+
+//		private Double toDouble(String value) {
+//			if (value == null) {
+//				return Double.valueOf(0);
+//			}
+//			return Double.valueOf(value);
+//		}
+
+		public void load() throws DataException {
+
+			this.envelope = null;
+
+			DGNReader dgnReader = new DGNReader(file.getAbsolutePath());
+
+			FeatureType type = getDefaultType().getNotEditableCopy();
+			int fTypeSize = type.size();
+			Object[] auxRow = new Object[fTypeSize];
+			Object[] cellRow = new Object[fTypeSize];
+			Object[] complexRow = new Object[fTypeSize];
+
+			boolean bElementoCompuesto = false;
+			boolean bEsPoligono = false;
+			boolean bInsideCell = false;
+			boolean bFirstHoleEntity = false;
+			boolean bConnect = false; // Se usa para que los pol�gonos cierren
+										// bien cuando son formas compuestas
+//			int contadorSubElementos = 0;
+//			int numSubElementos = 0;
+			int complex_index_fill_color = -1;
+			int nClass; // Para filtrar los elementos de construcci�n, etc.
+			GeneralPathX elementoCompuesto = new GeneralPathX(
+					GeneralPathX.WIND_EVEN_ODD);
+
+			for (int id = 0; id < dgnReader.getNumEntities(); id++) {
+				// System.out.println("Elemento " + id + " de " +
+				// dgnReader.getNumEntities());
+				dgnReader.DGNGotoElement(id);
+
+				DGNElemCore elemento = dgnReader.DGNReadElement();
+				nClass = 0;
+				auxRow[ID_FIELD_HEIGHTTEXT] = new Double(0);
+				auxRow[ID_FIELD_ROTATIONTEXT] = new Double(0);
+				auxRow[ID_FIELD_TEXT] = null;
+
+				if (elemento.properties != 0) {
+					nClass = elemento.properties & DGNFileHeader.DGNPF_CLASS;
+				}
+
+				if ((elemento != null) && (elemento.deleted == 0)
+						&& (nClass == 0)) // Leer un elemento
+				{
+
+					// if ((elemento.element_id > 3800) && (elemento.element_id
+					// < 3850))
+					// dgnReader.DGNDumpElement(dgnReader.getInfo(),elemento,"");
+					if ((elemento.stype == DGNFileHeader.DGNST_MULTIPOINT)
+							|| (elemento.stype == DGNFileHeader.DGNST_ARC)
+							|| (elemento.stype == DGNFileHeader.DGNST_CELL_HEADER)
+							|| (elemento.stype == DGNFileHeader.DGNST_SHARED_CELL_DEFN)
+							|| (elemento.stype == DGNFileHeader.DGNST_COMPLEX_HEADER)) {
+						if (elemento.complex != 0) {
+							bElementoCompuesto = true;
+						} else {
+							if (bElementoCompuesto) {
+								if (bInsideCell) {
+									auxRow[ID_FIELD_ENTITY] = cellRow[ID_FIELD_ENTITY];
+								} else {
+									auxRow = complexRow;
+								}
+
+								// System.err.println("Entidad compuesta. bInsideCell = "
+								// + bInsideCell + " auxRow = " +
+								// auxRow[ID_FIELD_ENTITY]);
+								// addShape(new FPolyline2D(elementoCompuesto),
+								// auxRow);
+								addShape(createMultiCurve(elementoCompuesto),
+										auxRow, type, dgnReader);
+
+								if (bEsPoligono) {
+									if (complex_index_fill_color != -1) {
+										auxRow[ID_FIELD_COLOR] = complex_index_fill_color;
+									}
+
+									addShape(
+											createMultiSurface(elementoCompuesto),
+											auxRow, type, dgnReader);
+								}
+
+								elementoCompuesto = new GeneralPathX(
+										GeneralPathX.WIND_EVEN_ODD);
+							}
+
+							// System.err.println("Entidad simple");
+							bElementoCompuesto = false;
+							bEsPoligono = false;
+							bConnect = false;
+
+							// elementoCompuesto = new GeneralPathX();
+							bInsideCell = false;
+						}
+					}
+
+					switch (elemento.stype) {
+					case DGNFileHeader.DGNST_SHARED_CELL_DEFN:
+						bInsideCell = true;
+						cellRow[ID_FIELD_ID] = elemento.element_id;
+						cellRow[ID_FIELD_LAYER] = String
+								.valueOf(elemento.level);
+						cellRow[ID_FIELD_COLOR] = elemento.color;
+						cellRow[ID_FIELD_ENTITY] = "Shared Cell";
+
+						break;
+
+					case DGNFileHeader.DGNST_CELL_HEADER:
+						bInsideCell = true;
+
+//						DGNElemCellHeader psCellHeader = (DGNElemCellHeader) elemento;
+						cellRow[ID_FIELD_ID] = elemento.element_id;
+						cellRow[ID_FIELD_LAYER] = String
+								.valueOf(elemento.level);
+						cellRow[ID_FIELD_COLOR] = elemento.color;
+						cellRow[ID_FIELD_ENTITY] = "Cell";
+						complex_index_fill_color = dgnReader
+								.DGNGetShapeFillInfo(elemento);
+
+						// System.err.println("Cell Header " +
+						// complex_index_fill_color);
+						break;
+
+					case DGNFileHeader.DGNST_COMPLEX_HEADER:
+
+						// bElementoCompuesto = true;
+						// System.err.println("Complex Header");
+//						contadorSubElementos = 0;
+
+						DGNElemComplexHeader psComplexHeader = (DGNElemComplexHeader) elemento;
+//						numSubElementos = psComplexHeader.numelems;
+						complexRow[ID_FIELD_ID] = elemento.element_id;
+						complexRow[ID_FIELD_LAYER] = String
+								.valueOf(elemento.level);
+						complexRow[ID_FIELD_COLOR] = elemento.color;
+						complexRow[ID_FIELD_ENTITY] = "Complex";
+
+						if (psComplexHeader.type == DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER) {
+							bEsPoligono = true;
+
+							// Si es un agujero, no conectamos con el anterior
+							if ((psComplexHeader.properties & 0x8000) != 0) {
+								bFirstHoleEntity = true;
+							} else {
+								// Miramos si tiene color de relleno
+								// complex_index_fill_color = -1;
+								// if (elemento.attr_bytes > 0) {
+								complex_index_fill_color = dgnReader
+										.DGNGetShapeFillInfo(elemento);
+
+								// System.err.println("complex shape fill color = "
+								// + elemento.color);
+								// }
+							}
+
+							bConnect = true;
+						} else {
+							bEsPoligono = false;
+							bConnect = false;
+						}
+
+						break;
+
+					case DGNFileHeader.DGNST_MULTIPOINT:
+
+						// OJO: Si lo que viene en este multipoint es un
+						// elemento con type=11 (curve), se trata de una
+						// "parametric
+						// spline curve". La vamos a tratar como si no fuera
+						// curva, pero seg�n la documentaci�n, los 2 primeros
+						// puntos
+						// y los 2 �ltimos puntos definen "endpoint derivatives"
+						// y NO se muestran.
+						// TODAV�A HAY UN PEQUE�O FALLO CON EL FICHERO
+						// dgn-sample.dgn, pero lo dejo por ahora.
+						// Es posible que tenga que ver con lo de los arcos
+						// (arco distorsionado), que
+						// todav�a no est� metido.
+						DGNElemMultiPoint psLine = (DGNElemMultiPoint) elemento;
+						auxRow[ID_FIELD_ID] = elemento.element_id;
+						auxRow[ID_FIELD_ENTITY] = "Multipoint";
+						auxRow[ID_FIELD_LAYER] = String.valueOf(elemento.level);
+						auxRow[ID_FIELD_COLOR] = elemento.color;
+
+						if ((psLine.num_vertices == 2)
+								&& (psLine.vertices[0].x == psLine.vertices[1].x)
+								&& (psLine.vertices[0].y == psLine.vertices[1].y)) {
+							auxRow[ID_FIELD_ENTITY] = "Point";
+							addShape(
+									createPoint3D(psLine.vertices[0].x,
+											psLine.vertices[0].y,
+											psLine.vertices[0].z), auxRow,
+									type, dgnReader);
+						} else {
+							GeneralPathX elShape = new GeneralPathX(
+									GeneralPathX.WIND_EVEN_ODD);
+
+							if (psLine.type == DGNFileHeader.DGNT_CURVE) {
+								psLine.num_vertices = psLine.num_vertices - 4;
+
+								for (int aux_n = 0; aux_n < psLine.num_vertices; aux_n++) {
+									psLine.vertices[aux_n] = psLine.vertices[aux_n + 2];
+								}
+							}
+
+							if ((psLine.type == DGNFileHeader.DGNT_SHAPE)
+									&& ((psLine.properties & 0x8000) != 0)) {
+								// Invertimos el orden porque es un agujero
+								elShape
+										.moveTo(
+												psLine.vertices[psLine.num_vertices - 1].x,
+												psLine.vertices[psLine.num_vertices - 1].y);
+
+								for (int i = psLine.num_vertices - 2; i >= 0; i--) {
+									elShape.lineTo(psLine.vertices[i].x,
+											psLine.vertices[i].y);
+								}
+							} else {
+								elShape.moveTo(psLine.vertices[0].x,
+										psLine.vertices[0].y);
+
+								for (int i = 1; i < psLine.num_vertices; i++) {
+									elShape.lineTo(psLine.vertices[i].x,
+											psLine.vertices[i].y);
+								}
+							}
+
+							if ((psLine.vertices[0].x == psLine.vertices[psLine.num_vertices - 1].x)
+									&& (psLine.vertices[0].y == psLine.vertices[psLine.num_vertices - 1].y)) {
+								// Lo a�adimos tambi�n como pol�gono
+								bEsPoligono = true;
+
+								// Miramos si tiene color de relleno
+								if (elemento.attr_bytes > 0) {
+									elemento.color = dgnReader
+											.DGNGetShapeFillInfo(elemento);
+
+									// System.err.println("fill color = " +
+									// elemento.color);
+									if (elemento.color != -1) {
+										auxRow[ID_FIELD_COLOR] = elemento.color;
+									}
+								}
+
+								if (elemento.complex == 0) {
+									addShape(createSurface(elShape), auxRow,
+											type, dgnReader);
+								}
+							}
+
+							if (elemento.complex != 0) {
+								// Si es un agujero o
+								// es la primera entidad del agujero, lo
+								// a�adimos sin unir al anterior
+								if (bFirstHoleEntity
+										|| ((psLine.type == DGNFileHeader.DGNT_SHAPE) && ((psLine.properties & 0x8000) != 0))) {
+									elementoCompuesto.append(elShape.getPathIterator(null), false);
+									bFirstHoleEntity = false;
+								} else {
+									elementoCompuesto.append(elShape.getPathIterator(null), bConnect);
+								}
+							} else {
+								addShape(createMultiCurve(elShape), auxRow,
+										type, dgnReader);
+							}
+						}
+
+						break;
+
+					case DGNFileHeader.DGNST_ARC:
+
+						// dgnReader.DGNDumpElement(dgnReader.getInfo(),
+						// elemento,"");
+						DGNElemArc psArc = (DGNElemArc) elemento;
+
+						// La definici�n de arco de MicroStation es distinta a
+						// la de Java.
+						// En el dgn el origin se entiende que es el centro del
+						// arco,
+						// y a la hora de crear un Arc2D las 2 primeras
+						// coordenadas son
+						// la esquina inferior izquierda del rect�ngulo que
+						// rodea al arco.
+						// 1.- Creamos la elipse sin rotaci�n.
+						// 2.- Creamos el arco
+						// 3.- Rotamos el resultado
+
+						/*
+						 * System.out.println("Arco con primari axis: " +
+						 * psArc.primary_axis + " start angle: " +
+						 * psArc.startang + " sweepang = " + psArc.sweepang);
+						 * System.out.println("secondaria axis: " +
+						 * psArc.secondary_axis + " rotation = " +
+						 * psArc.rotation);
+						 */
+						AffineTransform mT = AffineTransform.getRotateInstance(
+								Math.toRadians(psArc.rotation), psArc.origin.x,
+								psArc.origin.y);
+
+						// mT.preConcatenate(AffineTransform.getScaleInstance(100.0,100.0));
+						Arc2D.Double elArco = new Arc2D.Double(psArc.origin.x
+								- psArc.primary_axis, psArc.origin.y
+								- psArc.secondary_axis,
+								2.0 * psArc.primary_axis,
+								2.0 * psArc.secondary_axis, -psArc.startang,
+								-psArc.sweepang, Arc2D.OPEN);
+
+						// Ellipse2D.Double elArco = new
+						// Ellipse2D.Double(psArc.origin.x - psArc.primary_axis,
+						// psArc.origin.y - psArc.secondary_axis,2.0 *
+						// psArc.primary_axis, 2.0 * psArc.secondary_axis);
+						GeneralPathX elShapeArc = new GeneralPathX(elArco.getPathIterator(null));
+
+						// Transformamos el GeneralPahtX porque si transformamos
+						// elArco nos lo convierte
+						// a GeneralPath y nos guarda las coordenadas en float,
+						// con la correspondiente p�rdida de precisi�n
+						elShapeArc.transform(mT);
+
+						if (dgnReader.getInfo().dimension == 3) {
+							// Aqu� podr�amos hacer cosas con la coordenada Z
+						}
+
+						auxRow[ID_FIELD_ID] = elemento.element_id;
+						auxRow[ID_FIELD_ENTITY] = "Arc";
+						auxRow[ID_FIELD_LAYER] = String.valueOf(elemento.level);
+						auxRow[ID_FIELD_COLOR] = elemento.color;
+
+						/*
+						 * Line2D.Double ejeMayor = new
+						 * Line2D.Double(psArc.origin.x - psArc.primary_axis,
+						 * psArc.origin.y, psArc.origin.x + psArc.primary_axis,
+						 * psArc.origin.y);
+						 *
+						 * lyrLines.addShape(new
+						 * FShape(FConstant.SHAPE_TYPE_POLYLINE, new
+						 * GeneralPathX(ejeMayor)), auxRow);
+						 */
+
+						// lyrLines.addShape(new
+						// FShape(FConstant.SHAPE_TYPE_POLYLINE, elShapeArc),
+						// auxRow);
+						if (elemento.complex != 0) {
+							// Esto es una posible fuente de fallos si detr�s de
+							// una
+							// elipse vienen m�s cosas pegadas. Deber�amos
+							// volver
+							// a conectar una vez pasada la elipse.
+							if (elemento.type == DGNFileHeader.DGNT_ELLIPSE) {
+								bConnect = false;
+							}
+
+							// SI LA ELIPSE ES UN AGUJERO, SE A�ADE SIN PEGAR
+							// Y EL ELEMENTO ES UN POLIGONO
+							if (bFirstHoleEntity
+									|| ((elemento.type == DGNFileHeader.DGNT_SHAPE) && ((elemento.properties & 0x8000) != 0))) {
+								elementoCompuesto.append(elShapeArc.getPathIterator(null), false);
+								bFirstHoleEntity = false;
+							} else {
+								elementoCompuesto.append(elShapeArc.getPathIterator(null), bConnect);
+							}
+						} else {
+							addShape(createMultiCurve(elShapeArc), auxRow,
+									type, dgnReader);
+
+							if (psArc.type == DGNFileHeader.DGNT_ELLIPSE) {
+								addShape(createSurface(elShapeArc), auxRow,
+										type, dgnReader);
+							}
+						}
+
+						// System.err.println("Entra un Arco");
+						break;
+
+					case DGNFileHeader.DGNST_TEXT:
+
+						DGNElemText psText = (DGNElemText) elemento;
+						Geometry elShapeTxt = createPoint3D(psText.origin.x,
+								psText.origin.y, psText.origin.z);
+
+						auxRow[ID_FIELD_ID] = elemento.element_id;
+						auxRow[ID_FIELD_ENTITY] = "Text";
+						auxRow[ID_FIELD_LAYER] = String.valueOf(elemento.level);
+						auxRow[ID_FIELD_COLOR] = elemento.color;
+						auxRow[ID_FIELD_HEIGHTTEXT] = psText.height_mult;
+						auxRow[ID_FIELD_ROTATIONTEXT] = psText.rotation;
+						auxRow[ID_FIELD_TEXT] = psText.string; // .trim();
+						addShape(elShapeTxt, auxRow, type, dgnReader);
+
+						// System.out.println("Rotaci�n texto: " +
+						// psText.rotation + "Altura Texto = " + heightText);
+
+						/*
+						 * System.out.println("  origin=(" + psText.origin.x +
+						 * ", " + psText.origin.y + ") rotation=" +
+						 * psText.rotation + "\n" + "  font=" + psText.font_id +
+						 * " just=" + psText.justification + "length_mult=" +
+						 * psText.length_mult + " height_mult=" +
+						 * psText.height_mult + "\n" + "  string =" + new
+						 * String(psText.string).toString().trim() + "\n");
+						 */
+						break;
+
+					/*
+					 * default:
+					 * dgnReader.DGNDumpElement(dgnReader.getInfo(),
+					 * elemento, "");
+					 */
+					} // switch
+				} // if
+			} // for
+
+			if (bElementoCompuesto) {
+				if (bInsideCell) {
+					auxRow = cellRow;
+				} else {
+					auxRow = complexRow;
+				}
+
+				// System.err.println("Entidad compuesta. bInsideCell = " +
+				// bInsideCell + " auxRow = " + auxRow[ID_FIELD_ENTITY]);
+				addShape(createMultiCurve(elementoCompuesto), auxRow, type,
+						dgnReader);
+
+				if (bEsPoligono) {
+					if (complex_index_fill_color != -1) {
+						auxRow[ID_FIELD_COLOR] = complex_index_fill_color;
+					}
+
+					addShape(createSurface(elementoCompuesto), auxRow, type,
+							dgnReader);
+				}
+			}
+
+		}
+
+		private Geometry createMultiSurface(GeneralPathX elementoCompuesto)
+				throws DataException {
+			try {
+				return geomManager.createMultiSurface(elementoCompuesto,
+						SUBTYPES.GEOM2D);
+			} catch (CreateGeometryException e) {
+				throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(
+						e);
+			}
+
+		}
+
+		private Geometry createPoint3D(double x, double y, double z)
+				throws DataException {
+			Point point;
+			try {
+				// point = (Point) geomManager.create(TYPES.POINT,
+				// SUBTYPES.GEOM3D);
+				point = (Point) geomManager.create(TYPES.POINT,
+						SUBTYPES.GEOM3D);
+			} catch (CreateGeometryException e) {
+				throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(
+						e);
+			}
+			point.setCoordinates(new double[] { x, y, z });
+
+			return point;
+		}
+
+		private void addShape(Geometry geometry, Object[] auxRow,
+				FeatureType type, DGNReader dgnReader) throws DataException {
+			FeatureProvider data = createFeatureProvider(type);
+			for (int i=0;i<type.size();i++){
+				data.set(i, auxRow[i]);
+			}
+			data.setDefaultGeometry(geometry);
+			addFeatureProvider(data);
+			if (this.envelope == null) {
+				this.envelope = geometry.getEnvelope();
+			} else {
+				this.envelope.add(geometry.getEnvelope());
+			}
+			if (this.leyendBuilder != null) {
+				this.leyendBuilder.process(data, dgnReader);
+			}
+		}
+
+		private Geometry createMultiCurve(GeneralPathX elementoCompuesto)
+				throws DataException {
+			try {
+				return geomManager.createMultiCurve(elementoCompuesto,
+						SUBTYPES.GEOM2D);
+			} catch (CreateGeometryException e) {
+				throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(
+						e);
+			}
+		}
+
+		private Geometry createSurface(GeneralPathX elementoCompuesto)
+				throws DataException {
+			try {
+				return geomManager.createCurve(elementoCompuesto,
+						SUBTYPES.GEOM2D);
+			} catch (CreateGeometryException e) {
+				throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(
+						e);
+			}
+
+		}
+
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		return true;
+	}
+
+	public int getOIDType() {
+		return DataTypes.LONG;
+	}
+
+	public boolean supportsAppendMode() {
+		return false;
+	}
+
+	public void append(FeatureProvider featureProvider) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void beginAppend() {
+		throw new UnsupportedOperationException();
+	}
+
+	public void endAppend() {
+		throw new UnsupportedOperationException();
+	}
+
+	public Object createNewOID() {
+		return new Long(counterNewsOIDs++);
+	}
+
+	protected void initializeFeatureTypes() throws InitializeException {
+		try {
+			this.open();
+		} catch (OpenException e) {
+			throw new InitializeException(this.getProviderName(), e);
+		}
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		this.open();
+		return (Envelope) this.getDynValue("Envelope");
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
+	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
+	 */
+	public void resourceChanged(ResourceProvider resource) {
+		this.getStoreServices().notifyChange(
+				DataStoreNotification.RESOURCE_CHANGED,
+				resource);
+	}
+
+	public Object getSourceId() {
+		return this.getDGNParameters().getFile();
+	}
+	
+	public String getName() {
+		String name = this.getDGNParameters().getFile().getName();
+		int n = name.lastIndexOf(".");
+		if( n<1 ) {
+			return name;
+		}
+		return name.substring(0, n);
+	}
+	
+	public String getFullName() {
+		return this.getDGNParameters().getFile().getAbsolutePath();
+	}
+	
+	public ResourceProvider getResource() {
+		return resource;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java	(revision 38736)
@@ -0,0 +1,25 @@
+package org.gvsig.fmap.dal.store.dgn;
+
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.store.dgn.lib.DGNReader;
+
+
+public interface LegendBuilder {
+
+	final public static String DYNMETHOD_BUILDER_NAME = "getLegendBuilder";
+	final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend";
+	final public static String DYNMETHOD_GETLABELING_NAME = "getLabeling";
+
+	public LegendBuilder initialize(FeatureStoreProvider store);
+
+	public void begin();
+
+	public void process(FeatureProvider feature, DGNReader dgnReader);
+
+	public void end();
+
+	public Object getLegend();
+	public Object getLabeling();
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemGroup.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemGroup.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemGroup.java	(revision 38736)
@@ -0,0 +1,96 @@
+/*
+ * Created on 07-jul-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo Group.
+ *
+ * @author FJP
+ */
+public class DGNElemGroup extends DGNElemCore {
+	/*                 typedef struct
+	   {
+	   Elm_hdr ehdr; // element header
+	   Disp_hdr dhdr; // display header
+	   short file_chars; // no. of chars. in file spec
+	   char file_spec[65] //file specification
+	   byte file_num; // file number
+	   Fb_opts fb_opts; // file builder options mask
+	   Fd_opts fd_opts; // file displayer options mask
+	   byte disp_flags[16]; // display flags
+	   short lev_flags[8][4]; // level on/off flags
+	   long ref_org[3]; // origin in ref file uors
+	   double trns_mtrx[9]; // transformation matrix
+	   double cnvrs_fact; // conversion factor
+	   Group Data Elements (Type 5)
+	   long mast_org[3]; // origin in master file uors
+	   short log_chars; // characters in logical name
+	   char log_name[22]; // logical name (padded)
+	   short desc_chars; // characters in description
+	   char description[42]; /* description (padded)
+	   short lev_sym_mask; // level symbology enable mask
+	   short lev_sym[63]; // level symbology descriptor
+	   long z_delta; // Z-direction delta
+	   short clip_vertices; // clipping vertices
+	   Point2d clip_poly[1]; // clipping polygon
+	   } Ref_file_type5; */
+
+	//DGNElemCore 	core=new DGNElemCore();
+	public DGNPoint origin = new DGNPoint(); /*!< Origin of ellipse */
+	public double primary_axis;
+
+	//=new double[4];	/*!< Primary axis length */
+	public double secondary_axis;
+
+	//=new double[4]; /*!< Secondary axis length */
+	public double rotation; /*!< Counterclockwise rotation in degrees */
+	public double[] quat = new double[4]; //4
+	public double startang;
+
+	/*!< Start angle (degrees counterclockwise of primary axis) */
+	public double sweepang; /*!< Sweep angle (degrees) */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNReader.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNReader.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNReader.java	(revision 38736)
@@ -0,0 +1,3386 @@
+/*
+ * Created on 14-jun-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.text.MessageFormat;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Clase dedicada a leer del fichero DGN.
+ * 
+ * @author FJP
+ */
+public class DGNReader {
+	private static Logger logger = LoggerFactory.getLogger(DGNReader.class);
+	static int[][] abyDefaultPCT = { { 255, 255, 255 }, { 0, 0, 255 },
+			{ 0, 255, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 255 },
+			{ 255, 127, 0 }, { 0, 255, 255 }, { 64, 64, 64 },
+			{ 192, 192, 192 }, { 254, 0, 96 }, { 160, 224, 0 },
+			{ 0, 254, 160 }, { 128, 0, 160 }, { 176, 176, 176 },
+			{ 0, 240, 240 }, { 240, 240, 240 }, { 0, 0, 240 }, { 0, 240, 0 },
+			{ 240, 0, 0 }, { 240, 240, 0 }, { 240, 0, 240 }, { 240, 122, 0 },
+			{ 0, 240, 240 }, { 240, 240, 240 }, { 0, 0, 240 }, { 0, 240, 0 },
+			{ 240, 0, 0 }, { 240, 240, 0 }, { 240, 0, 240 }, { 240, 122, 0 },
+			{ 0, 225, 225 }, { 225, 225, 225 }, { 0, 0, 225 }, { 0, 225, 0 },
+			{ 225, 0, 0 }, { 225, 225, 0 }, { 225, 0, 225 }, { 225, 117, 0 },
+			{ 0, 225, 225 }, { 225, 225, 225 }, { 0, 0, 225 }, { 0, 225, 0 },
+			{ 225, 0, 0 }, { 225, 225, 0 }, { 225, 0, 225 }, { 225, 117, 0 },
+			{ 0, 210, 210 }, { 210, 210, 210 }, { 0, 0, 210 }, { 0, 210, 0 },
+			{ 210, 0, 0 }, { 210, 210, 0 }, { 210, 0, 210 }, { 210, 112, 0 },
+			{ 0, 210, 210 }, { 210, 210, 210 }, { 0, 0, 210 }, { 0, 210, 0 },
+			{ 210, 0, 0 }, { 210, 210, 0 }, { 210, 0, 210 }, { 210, 112, 0 },
+			{ 0, 195, 195 }, { 195, 195, 195 }, { 0, 0, 195 }, { 0, 195, 0 },
+			{ 195, 0, 0 }, { 195, 195, 0 }, { 195, 0, 195 }, { 195, 107, 0 },
+			{ 0, 195, 195 }, { 195, 195, 195 }, { 0, 0, 195 }, { 0, 195, 0 },
+			{ 195, 0, 0 }, { 195, 195, 0 }, { 195, 0, 195 }, { 195, 107, 0 },
+			{ 0, 180, 180 }, { 180, 180, 180 }, { 0, 0, 180 }, { 0, 180, 0 },
+			{ 180, 0, 0 }, { 180, 180, 0 }, { 180, 0, 180 }, { 180, 102, 0 },
+			{ 0, 180, 180 }, { 180, 180, 180 }, { 0, 0, 180 }, { 0, 180, 0 },
+			{ 180, 0, 0 }, { 180, 180, 0 }, { 180, 0, 180 }, { 180, 102, 0 },
+			{ 0, 165, 165 }, { 165, 165, 165 }, { 0, 0, 165 }, { 0, 165, 0 },
+			{ 165, 0, 0 }, { 165, 165, 0 }, { 165, 0, 165 }, { 165, 97, 0 },
+			{ 0, 165, 165 }, { 165, 165, 165 }, { 0, 0, 165 }, { 0, 165, 0 },
+			{ 165, 0, 0 }, { 165, 165, 0 }, { 165, 0, 165 }, { 165, 97, 0 },
+			{ 0, 150, 150 }, { 150, 150, 150 }, { 0, 0, 150 }, { 0, 150, 0 },
+			{ 150, 0, 0 }, { 150, 150, 0 }, { 150, 0, 150 }, { 150, 92, 0 },
+			{ 0, 150, 150 }, { 150, 150, 150 }, { 0, 0, 150 }, { 0, 150, 0 },
+			{ 150, 0, 0 }, { 150, 150, 0 }, { 150, 0, 150 }, { 150, 92, 0 },
+			{ 0, 135, 135 }, { 135, 135, 135 }, { 0, 0, 135 }, { 0, 135, 0 },
+			{ 135, 0, 0 }, { 135, 135, 0 }, { 135, 0, 135 }, { 135, 87, 0 },
+			{ 0, 135, 135 }, { 135, 135, 135 }, { 0, 0, 135 }, { 0, 135, 0 },
+			{ 135, 0, 0 }, { 135, 135, 0 }, { 135, 0, 135 }, { 135, 87, 0 },
+			{ 0, 120, 120 }, { 120, 120, 120 }, { 0, 0, 120 }, { 0, 120, 0 },
+			{ 120, 0, 0 }, { 120, 120, 0 }, { 120, 0, 120 }, { 120, 82, 0 },
+			{ 0, 120, 120 }, { 120, 120, 120 }, { 0, 0, 120 }, { 0, 120, 0 },
+			{ 120, 0, 0 }, { 120, 120, 0 }, { 120, 0, 120 }, { 120, 82, 0 },
+			{ 0, 105, 105 }, { 105, 105, 105 }, { 0, 0, 105 }, { 0, 105, 0 },
+			{ 105, 0, 0 }, { 105, 105, 0 }, { 105, 0, 105 }, { 105, 77, 0 },
+			{ 0, 105, 105 }, { 105, 105, 105 }, { 0, 0, 105 }, { 0, 105, 0 },
+			{ 105, 0, 0 }, { 105, 105, 0 }, { 105, 0, 105 }, { 105, 77, 0 },
+			{ 0, 90, 90 }, { 90, 90, 90 }, { 0, 0, 90 }, { 0, 90, 0 },
+			{ 90, 0, 0 }, { 90, 90, 0 }, { 90, 0, 90 }, { 90, 72, 0 },
+			{ 0, 90, 90 }, { 90, 90, 90 }, { 0, 0, 90 }, { 0, 90, 0 },
+			{ 90, 0, 0 }, { 90, 90, 0 }, { 90, 0, 90 }, { 90, 72, 0 },
+			{ 0, 75, 75 }, { 75, 75, 75 }, { 0, 0, 75 }, { 0, 75, 0 },
+			{ 75, 0, 0 }, { 75, 75, 0 }, { 75, 0, 75 }, { 75, 67, 0 },
+			{ 0, 75, 75 }, { 75, 75, 75 }, { 0, 0, 75 }, { 0, 75, 0 },
+			{ 75, 0, 0 }, { 75, 75, 0 }, { 75, 0, 75 }, { 75, 67, 0 },
+			{ 0, 60, 60 }, { 60, 60, 60 }, { 0, 0, 60 }, { 0, 60, 0 },
+			{ 60, 0, 0 }, { 60, 60, 0 }, { 60, 0, 60 }, { 60, 62, 0 },
+			{ 0, 60, 60 }, { 60, 60, 60 }, { 0, 0, 60 }, { 0, 60, 0 },
+			{ 60, 0, 0 }, { 60, 60, 0 }, { 60, 0, 60 }, { 60, 62, 0 },
+			{ 0, 45, 45 }, { 45, 45, 45 }, { 0, 0, 45 }, { 0, 45, 0 },
+			{ 45, 0, 0 }, { 45, 45, 0 }, { 45, 0, 45 }, { 45, 57, 0 },
+			{ 0, 45, 45 }, { 45, 45, 45 }, { 0, 0, 45 }, { 0, 45, 0 },
+			{ 45, 0, 0 }, { 45, 45, 0 }, { 45, 0, 45 }, { 45, 57, 0 },
+			{ 0, 30, 30 }, { 30, 30, 30 }, { 0, 0, 30 }, { 0, 30, 0 },
+			{ 30, 0, 0 }, { 30, 30, 0 }, { 30, 0, 30 }, { 30, 52, 0 },
+			{ 0, 30, 30 }, { 30, 30, 30 }, { 0, 0, 30 }, { 0, 30, 0 },
+			{ 30, 0, 0 }, { 30, 30, 0 }, { 30, 0, 30 }, { 192, 192, 192 },
+			{ 28, 0, 100 } };
+	private int LSB;
+	private FileInputStream fin;
+
+	// private LEDataInputStream input;
+	private MappedByteBuffer bb;
+	private int FALSE = 0;
+	private int TRUE = 1;
+	private DGNElemCore elemento;
+	private DGNInfo info; // Contiene el path y otras cosas
+	private Rectangle2D.Double m_BoundingBox;
+	private DGNElemColorTable m_colorTable;
+
+	/**
+	 * Crea un nuevo DGNReader.
+	 * 
+	 * @param pathFich
+	 *            DOCUMENT ME!
+	 */
+	public DGNReader(String pathFich) throws DataException {
+		info = new DGNInfo();
+
+		DGNElemCore elemento = new DGNElemCore();
+		int iArg;
+		int bReportExtents = 0;
+		byte[] achRaw = new byte[64];
+		achRaw[63] = 1;
+
+		double dfSFXMin = 0.0;
+		double dfSFXMax = 0.0;
+		double dfSFYMin = 0.0;
+		double dfSFYMax = 0.0;
+
+		info.fp = pathFich;
+		info = DGNOpen(info, 0);
+
+		bb.rewind();
+		DGNSetSpatialFilter(info, dfSFXMin, dfSFYMin, dfSFXMax, dfSFYMax);
+
+		int nLevel;
+		int nType;
+		int[] anLevelTypeCount = new int[128 * 64];
+		int[] anLevelCount = new int[64];
+		int[] anTypeCount = new int[128];
+		double[] adfExtents = new double[6];
+		int[] nCount = new int[1];
+		nCount[0] = 0;
+
+		DGNGetExtents(info, adfExtents); // extender
+		System.out.println("X Range:" + adfExtents[0] + ", " + adfExtents[3]);
+		System.out.println("Y Range:" + adfExtents[1] + ", " + adfExtents[4]);
+		System.out.println("Z Range:" + adfExtents[2] + ", " + adfExtents[5]);
+
+		m_BoundingBox = new Rectangle2D.Double();
+		m_BoundingBox.setRect(adfExtents[0], adfExtents[1],
+				(adfExtents[3] - adfExtents[0]),
+				(adfExtents[4] - adfExtents[1]));
+
+		/* m_Renderer = new FRenderer(this); */
+		DGNElementInfo[] pasEI; // =new DGNElementInfo[nCount+1];
+		pasEI = DGNGetElementIndex(info, nCount);
+
+		System.out.println("Total Elements:" + nCount[0]);
+
+		for (int i = 0; i < nCount[0]; i++) {
+			anLevelTypeCount[(pasEI[i].level * 128) + pasEI[i].type]++;
+			anLevelCount[pasEI[i].level]++;
+			anTypeCount[pasEI[i].type]++;
+		}
+
+		// //System.out.println("\n");
+		System.out.println("Per Type Report\n");
+		System.out.println("===============\n");
+
+		for (nType = 0; nType < 128; nType++) {
+			if (anTypeCount[nType] != 0) {
+				System.out.println("Type:" + DGNTypeToName(nType) + ":"
+						+ anTypeCount[nType] + "\n");
+			}
+		}
+
+		// System.out.println("\n");
+		// System.out.println("Per Level Report\n");
+		// System.out.println("================\n");
+		for (nLevel = 0; nLevel < 64; nLevel++) {
+			if (anLevelCount[nLevel] == 0) {
+				continue;
+			}
+
+			// System.out.println("Level " + nLevel + "," + anLevelCount[nLevel]
+			// +"elements:\n");
+			for (nType = 0; nType < 128; nType++) {
+				if (anLevelTypeCount[(nLevel * 128) + nType] != 0) {
+					// System.out.println("  Type " + DGNTypeToName(nType) +
+					// ","anLevelTypeCount[(nLevel * 128) + nType] + "\n");
+				}
+			}
+
+			// System.out.println("\n");
+		}
+
+		bb.rewind();
+	}
+
+	/*
+	 * public Color getColor(int indexColor) { int r,g,b; //
+	 * System.err.println("indexcolor = " + indexColor); // Si no hay tabla de
+	 * colores, interpretamos que todas las cosas son negras if (m_colorTable ==
+	 * null) return new Color(0,0,0);
+	 * 
+	 * r = ByteUtils.getUnsigned(m_colorTable.color_info[indexColor][0]); g =
+	 * ByteUtils.getUnsigned(m_colorTable.color_info[indexColor][1]); b =
+	 * ByteUtils.getUnsigned(m_colorTable.color_info[indexColor][2]);
+	 * 
+	 * if ((r==255) && (g==255) & (b==255)) { r=g=b=0; // El color blanco lo
+	 * devolvemos como negro. }
+	 * 
+	 * return new Color(r,g,b); }
+	 */
+
+	/**
+	 * Devuelve la informaci�n del DGN.
+	 * 
+	 * @return DGNInfo Informaci�n.
+	 */
+	public DGNInfo getInfo() {
+		return info;
+	}
+
+	/**
+	 * Devuelve el n�mero de elementos.
+	 * 
+	 * @return N�mero de elementos.
+	 */
+	public int getNumEntities() {
+		return info.element_count;
+	}
+
+	/**
+	 * Devuelve el rect�ngulo del extent.
+	 * 
+	 * @return Rect�ngulo.
+	 */
+	public Rectangle2D getBoundingBox() {
+		return m_BoundingBox;
+	}
+
+	/************************************************************************/
+	/* DGNGotoElement() */
+	/************************************************************************/
+
+	/**
+	 * Seek to indicated element. Changes what element will be read on the next
+	 * call to DGNReadElement(). Note that this function requires and index, and
+	 * one will be built if not already available.
+	 * 
+	 * @param element_id
+	 *            the element to seek to. These values are sequentially ordered
+	 *            starting at zero for the first element.
+	 * 
+	 * @return returns TRUE on success or FALSE on failure.
+	 */
+	public int DGNGotoElement(int element_id) {
+		DGNBuildIndex(info);
+
+		if ((element_id < 0) || (element_id >= info.element_count)) {
+			return FALSE;
+		}
+
+		// System.out.println("Posicionamos en " +
+		// info.element_index[element_id].offset);
+		bb.position((int) info.element_index[element_id].offset);
+
+		info.next_element_id = element_id;
+		info.in_complex_group = FALSE;
+
+		return TRUE;
+	}
+
+	/**
+	 * DGNOpen
+	 * 
+	 * @param info
+	 *            DOCUMENT ME!
+	 * @param bUpdate
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private DGNInfo DGNOpen(DGNInfo info, int bUpdate) throws DataException {
+		int pos = 0;
+		byte[] abyHeader = new byte[512];
+		info.next_element_id = 0;
+		info.got_tcb = FALSE;
+		info.scale = 1.0;
+		info.origin_x = 0.0;
+		info.origin_y = 0.0;
+		info.origin_z = 0.0;
+		info.index_built = FALSE;
+		info.element_count = 0;
+		info.element_index = null;
+		info.got_bounds = FALSE;
+
+		try {
+			fin = new FileInputStream(info.fp);
+
+			FileChannel fc = fin.getChannel();
+
+			long sz = fc.size();
+			int numReg;
+
+			// Get the file's size and then map it into memory
+			bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
+			bb.order(ByteOrder.nativeOrder());
+			bb.get(abyHeader, pos, abyHeader.length);
+
+			info.ftall = (int) (sz / 16);
+
+			if (bb.order() == ByteOrder.LITTLE_ENDIAN) {
+				LSB = TRUE;
+			}
+
+			if (DGNTestOpen(abyHeader, abyHeader.length) != FALSE) {
+				if (abyHeader[0] == (byte) 0xC8) {
+					info.dimension = 3; // 0xC8
+				} else {
+					info.dimension = 2;
+				}
+
+				info.has_spatial_filter = FALSE;
+				info.sf_converted_to_uor = FALSE;
+				info.select_complex_group = FALSE;
+				info.in_complex_group = FALSE;
+			}
+		} catch (FileNotFoundException e) {
+			throw new org.gvsig.fmap.dal.exception.FileNotFoundException(
+					info.fp);
+		} catch (Exception e) {
+			throw new ReadException("DGNReader error", e);
+		}
+
+		return info;
+	}
+
+	/**
+	 * Comprobaci�n si se puede abrir el fichero.
+	 * 
+	 * @param pabyHeader
+	 *            Vector byte con el header.
+	 * @param nByteCount
+	 *            n�mero de bytes.
+	 * 
+	 * @return Devuelve un enteor que muestra si no hay errores.
+	 */
+	private int DGNTestOpen(byte[] pabyHeader, int nByteCount) {
+		if (nByteCount < 4) {
+			return TRUE;
+		}
+
+		// Is it a cell library?
+		if ((pabyHeader[0] == (byte) 0x08) && (pabyHeader[1] == (byte) 0x05)
+				&& (pabyHeader[2] == (byte) 0x17)
+				&& (pabyHeader[3] == (byte) 0x00)) {
+			return TRUE;
+		}
+
+		// Is it not a regular 2D or 3D file?
+		if (((pabyHeader[0] != (byte) 0x08) && (pabyHeader[0] != (byte) 0xC8))
+				|| (pabyHeader[1] != (byte) 0x09)
+				|| (pabyHeader[2] != (byte) 0xFE)
+				|| (pabyHeader[3] != (byte) 0x02)) {
+			return FALSE;
+		}
+
+		return TRUE;
+	}
+
+	/**
+	 * Lee una fila del elemento.
+	 * 
+	 * @param info
+	 *            Informaci�n del DGN.
+	 * @param core
+	 *            Elemento.
+	 * 
+	 * @return Devuelve un entero que muestra si se ha calculado correctamente.
+	 */
+	private int DGNLoadRawElement(DGNInfo info, DGNElemCore core) {
+		/* -------------------------------------------------------------------- */
+		/* Read the first four bytes to get the level, type, and word */
+		/* count. */
+		/* -------------------------------------------------------------------- */
+
+		// int nType, nWords, nLevel;
+		int nType = 0;
+		int nWords = 0;
+		int nLevel = 0;
+		int bytesCount = 0;
+
+		try {
+			// input=new LEDataInputStream(fin);
+			for (int i = 0; i < 4; i++) {
+				info.abyElem[i] = bb.get();
+				if (i == 1) {
+					if ((info.abyElem[0] == -1) && (info.abyElem[1] == -1)) {
+						return FALSE;
+					}
+				}
+
+				// info.temporal[i]=input.readByte();
+			}
+
+			// //System.out.println(ByteUtils.byteToUnsignedInt(info.abyElem[2])+";"+ByteUtils.byteToUnsignedInt(info.abyElem[3]));
+
+			nWords = ByteUtils.byteToUnsignedInt(info.abyElem[2])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[3]) * 256);
+			nType = ByteUtils.byteToUnsignedInt(info.abyElem[1]) & 0x7f;
+			nLevel = ByteUtils.byteToUnsignedInt(info.abyElem[0]) & 0x3f;
+
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			/* Read the rest of the element data into the working buffer. */
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			if (((nWords * 2) + 4) > info.abyElem.length) {
+				return FALSE;
+			}
+
+			// CPLAssert( nWords * 2 + 4 <= (int) sizeof(psDGN->abyElem) );
+			// byte[] temp = new byte[131072];
+			// //System.out.println(nWords);
+			for (; bytesCount < (nWords * 2) && bb.hasRemaining(); bytesCount++) {
+				info.abyElem[bytesCount + 4] = bb.get();
+			}
+
+			// input.close();
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			/* Read the rest of the element data into the working buffer. */
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			/*
+			 * CPLAssert( nWords * 2 + 4 <= (int) sizeof(psDGN->abyElem) ); if(
+			 * (int) VSIFRead( psDGN->abyElem + 4, 2, nWords, psDGN->fp ) !=
+			 * nWords ) return FALSE;
+			 */
+			info.ftall = bb.position();
+		} catch (Exception e) {
+			logger.warn(MessageFormat.format("The DGN file {0} may not be loaded correctly.\n" +
+					"Error loading:\n" +
+					"nWords = {1}\n" +
+					"info.next_element_id {2}\n" +
+					"info.abyElem.length =  {3}\n" +
+					"bb.position() =  {4}",
+					info.fp,
+					nWords,
+					info.next_element_id,
+					info.abyElem.length,
+					bb.position()), e);
+
+			return FALSE;
+		}
+
+		// info.nElemBytes = (nWords * 2) + 4;
+		info.nElemBytes = bytesCount + 4;
+		info.next_element_id++;
+
+		/* -------------------------------------------------------------------- */
+		/* Return requested info. */
+		/* -------------------------------------------------------------------- */
+		// if( core.type != null )
+		core.type = nType;
+
+		// if( core.level != null )
+		core.level = nLevel;
+
+		return TRUE;
+	}
+
+	/**
+	 * Calcula el filtro espacial al rect�ngulo del elemento.
+	 * 
+	 * @param info
+	 *            Informaci�n del DGN.
+	 */
+	private void DGNSpatialFilterToUOR(DGNInfo info) {
+		DGNPoint sMin = new DGNPoint();
+		DGNPoint sMax = new DGNPoint();
+
+		if ((info.sf_converted_to_uor == 1)
+				|| (!(info.has_spatial_filter == 1)) || (!(info.got_tcb == 1))) {
+			return;
+		}
+
+		sMin.x = info.sf_min_x_geo;
+		sMin.y = info.sf_min_y_geo;
+		sMin.z = 0;
+
+		sMax.x = info.sf_max_x_geo;
+		sMax.y = info.sf_max_y_geo;
+		sMax.z = 0;
+
+		DGNInverseTransformPoint(info, sMin);
+		DGNInverseTransformPoint(info, sMax);
+
+		info.sf_min_x = (long) (sMin.x + 2147483648.0);
+		info.sf_min_y = (long) (sMin.y + 2147483648.0);
+		info.sf_max_x = (long) (sMax.x + 2147483648.0);
+		info.sf_max_y = (long) (sMax.y + 2147483648.0);
+
+		info.sf_converted_to_uor = TRUE;
+	}
+
+	/**
+	 * Calcula un punto aplicandole la transformaci�n.
+	 * 
+	 * @param info
+	 *            Informaci�n del DGN.
+	 * @param punto
+	 *            Punto.
+	 */
+	private void DGNInverseTransformPoint(DGNInfo info, DGNPoint punto) {
+		punto.x = (punto.x + info.origin_x) / info.scale;
+		punto.y = (punto.y + info.origin_y) / info.scale;
+		punto.z = (punto.z + info.origin_z) / info.scale;
+
+		punto.x = Math.max(-2147483647, Math.min(2147483647, punto.x));
+		punto.y = Math.max(-2147483647, Math.min(2147483647, punto.y));
+		punto.z = Math.max(-2147483647, Math.min(2147483647, punto.z));
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	public DGNElemCore DGNReadElement() {
+		DGNElemCore elemento = new DGNElemCore();
+		int nType;
+		int nLevel;
+		int bInsideFilter;
+
+		/* -------------------------------------------------------------------- */
+		/* Load the element data into the current buffer. If a spatial */
+		/* filter is in effect, loop until we get something within our */
+		/* spatial constraints. */
+		/* -------------------------------------------------------------------- */
+		do {
+			bInsideFilter = TRUE;
+
+			int fin_fichero = DGNLoadRawElement(info, elemento);
+
+			if (fin_fichero == FALSE) {
+				return null;
+			}
+
+			if (info.has_spatial_filter != FALSE) {
+				// long nXMin, nXMax, nYMin, nYMax;
+				if (info.sf_converted_to_uor == FALSE) {
+					DGNSpatialFilterToUOR(info);
+				}
+
+				if (DGNGetRawExtents(info, null, elemento) == null) {
+					bInsideFilter = TRUE;
+				} else if ((info.min_x > info.sf_max_x)
+						|| (info.min_y > info.sf_max_y)
+						|| (info.max_x < info.sf_min_x)
+						|| (info.max_y < info.sf_min_y)) {
+					bInsideFilter = FALSE;
+				}
+
+				if ((elemento.type == DGNFileHeader.DGNT_COMPLEX_CHAIN_HEADER)
+						|| (elemento.type == DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER)) {
+					info.in_complex_group = TRUE;
+					info.select_complex_group = bInsideFilter;
+				} else if ((info.abyElem[0] & (byte) 0x80) != FALSE) {
+					if (info.in_complex_group == TRUE) {
+						bInsideFilter = info.select_complex_group;
+					}
+				} else {
+					info.in_complex_group = FALSE;
+				}
+			}
+		} while (bInsideFilter == FALSE);
+
+		elemento = DGNProcessElement(info, elemento.type, elemento.level);
+
+		return elemento;
+	}
+
+	/**
+	 * Devuelve los extent de una fila.
+	 * 
+	 * @param info
+	 *            Informaci�n del DGN.
+	 * @param pabyRawData
+	 *            Vector de byte.
+	 * @param elemento
+	 *            Elemento.
+	 * 
+	 * @return Vector de double.
+	 */
+	public double[] DGNGetRawExtents(DGNInfo info, byte[] pabyRawData,
+			DGNElemCore elemento) {
+		// byte[] pabyRawData = new byte[info.abyElem.length];
+		if (pabyRawData == null) {
+			pabyRawData = info.abyElem;
+		}
+
+		double[] tempo = new double[6];
+
+		switch (elemento.type) {
+		case DGNFileHeader.DGNT_LINE:
+		case DGNFileHeader.DGNT_LINE_STRING:
+		case DGNFileHeader.DGNT_SHAPE:
+		case DGNFileHeader.DGNT_CURVE:
+		case DGNFileHeader.DGNT_BSPLINE:
+		case DGNFileHeader.DGNT_ELLIPSE:
+		case DGNFileHeader.DGNT_ARC:
+		case DGNFileHeader.DGNT_TEXT:
+		case DGNFileHeader.DGNT_COMPLEX_CHAIN_HEADER:
+		case DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER:
+
+			byte[] temp = new byte[4];
+			System.arraycopy(pabyRawData, 4, temp, 0, 4);
+			tempo[0] = DGN_INT32(temp); // 4
+
+			System.arraycopy(pabyRawData, 8, temp, 0, 4);
+			tempo[1] = DGN_INT32(temp);
+
+			System.arraycopy(pabyRawData, 12, temp, 0, 4);
+			tempo[2] = DGN_INT32(temp);
+
+			System.arraycopy(pabyRawData, 16, temp, 0, 4);
+			tempo[3] = DGN_INT32(temp);
+
+			System.arraycopy(pabyRawData, 20, temp, 0, 4);
+			tempo[4] = DGN_INT32(temp);
+
+			System.arraycopy(pabyRawData, 24, temp, 0, 4);
+			tempo[5] = DGN_INT32(temp);
+
+			// System.out.println("tempo = " + tempo[0] + " " + tempo[1] + " " +
+			// tempo[2]);
+			return tempo;
+
+		default:
+			return null;
+		}
+	}
+
+	/**
+	 * A partir de un vector de byte devuelve un double.
+	 * 
+	 * @param p
+	 *            Vector de byte.
+	 * 
+	 * @return double.
+	 */
+	private double DGN_INT32(byte[] p) {
+		int x = 256;
+		int x0;
+		int x1;
+		int x2;
+		int x3;
+		x0 = p[0];
+		x1 = p[1];
+		x2 = p[2];
+		x3 = p[3];
+
+		if (p[0] < 0) {
+			x0 = x + p[0];
+		}
+
+		if (p[1] < 0) {
+			x1 = x + p[1];
+		}
+
+		if (p[2] < 0) {
+			x2 = x + p[2];
+		}
+
+		if (p[3] < 0) {
+			x3 = x + p[3];
+		}
+
+		return (x2 + (x3 * 256) + (x1 * 65536 * 256) + (x0 * 65536));
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param info
+	 *            DOCUMENT ME!
+	 * @param nType
+	 *            DOCUMENT ME!
+	 * @param nLevel
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private DGNElemCore DGNProcessElement(DGNInfo info, int nType, int nLevel) {
+		DGNElemCore elemento = new DGNElemCore();
+
+		// if (info.next_element_id < 100)
+		// System.out.println("nType = " + nType);
+		switch (nType) {
+		case DGNFileHeader.DGNT_SHARED_CELL_DEFN:
+			System.err.println(DGNTypeToName(nType));
+			elemento.stype = DGNFileHeader.DGNST_SHARED_CELL_DEFN;
+			DGNParseCore(info, elemento);
+
+			break;
+
+		case DGNFileHeader.DGNT_CELL_HEADER: {
+			// System.err.println("DGNT_CELL_HEADER");
+			DGNElemCellHeader psCell = new DGNElemCellHeader();
+			psCell.stype = DGNFileHeader.DGNST_CELL_HEADER;
+			DGNParseCore(info, psCell);
+			psCell.totlength = ByteUtils.getUnsigned(info.abyElem[36])
+					+ (ByteUtils.getUnsigned(info.abyElem[37]) * 256);
+
+			byte[] temp = new byte[psCell.name.length];
+			System.arraycopy(psCell.name, 0, temp, 0, psCell.name.length);
+			DGNRad50ToAscii(ByteUtils.byteToUnsignedInt(info.abyElem[38])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[39]) * 256),
+					temp);
+
+			System.arraycopy(psCell.name, 3, temp, 0, psCell.name.length - 3); // esta
+																				// linea
+																				// puede
+																				// tener
+																				// problemas.
+			DGNRad50ToAscii(ByteUtils.byteToUnsignedInt(info.abyElem[40])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[41]) * 256),
+					temp);
+			psCell.cclass = ByteUtils.byteToUnsignedInt(info.abyElem[42])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[43]) * 256);
+			psCell.levels[0] = ByteUtils.byteToUnsignedInt(info.abyElem[44])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[45]) * 256);
+			psCell.levels[1] = ByteUtils.byteToUnsignedInt(info.abyElem[46])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[47]) * 256);
+			psCell.levels[2] = ByteUtils.byteToUnsignedInt(info.abyElem[48])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[49]) * 256);
+			psCell.levels[3] = ByteUtils.byteToUnsignedInt(info.abyElem[50])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[51]) * 256);
+			psCell.color = info.abyElem[35];
+
+			if (info.dimension == 2) {
+				byte[] temp1 = new byte[4];
+				System.arraycopy(info.abyElem, 52, temp1, 0, 4);
+				psCell.rnglow.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 56, temp1, 0, 4);
+				psCell.rnglow.y = DGN_INT32(temp);
+				System.arraycopy(info.abyElem, 60, temp1, 0, 4);
+				psCell.rnghigh.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 64, temp1, 0, 4);
+				psCell.rnghigh.y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 84, temp1, 0, 4);
+				psCell.origin.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 88, temp1, 0, 4);
+				psCell.origin.y = DGN_INT32(temp1);
+
+				{
+					double a;
+					double b;
+					double c;
+					double d;
+					double a2;
+					double c2;
+					System.arraycopy(info.abyElem, 68, temp1, 0, 4);
+					a = DGN_INT32(temp1);
+					System.arraycopy(info.abyElem, 72, temp1, 0, 4);
+					b = DGN_INT32(temp1);
+					System.arraycopy(info.abyElem, 76, temp1, 0, 4);
+					c = DGN_INT32(temp1);
+					System.arraycopy(info.abyElem, 80, temp1, 0, 4);
+					d = DGN_INT32(temp1);
+					a2 = a * a;
+					c2 = c * c;
+					psCell.xscale = Math.sqrt(a2 + c2) / 214748;
+					psCell.yscale = Math.sqrt((b * b) + (d * d)) / 214748;
+					psCell.rotation = Math.acos(a / Math.sqrt(a2 + c2));
+
+					if (b <= 0) {
+						psCell.rotation = (psCell.rotation * 180) / Math.PI;
+					} else {
+						psCell.rotation = 360 - ((psCell.rotation * 180) / Math.PI);
+					}
+				}
+			} else {
+				byte[] temp1 = new byte[4];
+				System.arraycopy(info.abyElem, 52, temp1, 0, 4);
+				psCell.rnglow.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 56, temp1, 0, 4);
+				psCell.rnglow.y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 60, temp1, 0, 4);
+				psCell.rnglow.z = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 64, temp1, 0, 4);
+				psCell.rnghigh.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 68, temp1, 0, 4);
+				psCell.rnghigh.y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 72, temp1, 0, 4);
+				psCell.rnghigh.z = DGN_INT32(temp1);
+
+				System.arraycopy(info.abyElem, 112, temp1, 0, 4);
+				psCell.origin.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 116, temp1, 0, 4);
+				psCell.origin.y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 120, temp1, 0, 4);
+				psCell.origin.z = DGN_INT32(temp1);
+			}
+
+			DGNTransformPoint(info, psCell.rnglow);
+			DGNTransformPoint(info, psCell.rnghigh);
+			DGNTransformPoint(info, psCell.origin);
+			elemento = psCell;
+
+			// DGNDumpElement(info,elemento,"");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_CELL_LIBRARY: {
+			System.err.println("DGNT_CELL_LIBRARY");
+
+			DGNElemCellLibrary psCell = new DGNElemCellLibrary();
+			int iWord;
+			psCell.stype = DGNFileHeader.DGNST_CELL_LIBRARY;
+			DGNParseCore(info, psCell);
+
+			byte[] temp = new byte[psCell.name.length];
+			System.arraycopy(psCell.name, 0, temp, 0, psCell.name.length);
+			DGNRad50ToAscii(ByteUtils.byteToUnsignedInt(info.abyElem[32])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[33]) * 256),
+					temp);
+			System.arraycopy(psCell.name, 3, temp, 0, psCell.name.length);
+			DGNRad50ToAscii(ByteUtils.byteToUnsignedInt(info.abyElem[34])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[35]) * 256),
+					temp);
+			psCell.properties = info.abyElem[38] + (info.abyElem[39] * 256);
+			psCell.dispsymb = ByteUtils.byteToUnsignedInt(info.abyElem[40])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[41]) * 256);
+			psCell.cclass = ByteUtils.byteToUnsignedInt(info.abyElem[42])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[43]) * 256);
+			psCell.levels[0] = ByteUtils.byteToUnsignedInt(info.abyElem[44])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[45]) * 256);
+			psCell.levels[1] = ByteUtils.byteToUnsignedInt(info.abyElem[46])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[47]) * 256);
+			psCell.levels[2] = ByteUtils.byteToUnsignedInt(info.abyElem[48])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[49]) * 256);
+			psCell.levels[3] = ByteUtils.byteToUnsignedInt(info.abyElem[50])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[51]) * 256);
+			psCell.numwords = ByteUtils.byteToUnsignedInt(info.abyElem[36])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[37]) * 256);
+
+			for (iWord = 0; iWord < 9; iWord++) {
+				int iOffset = 52 + (iWord * 2);
+				System.arraycopy(psCell.name, iWord * 3, temp, 0,
+						psCell.description.length);
+				DGNRad50ToAscii(
+						ByteUtils.byteToUnsignedInt(info.abyElem[iOffset])
+								+ (ByteUtils
+										.byteToUnsignedInt(info.abyElem[iOffset + 1]) * 256),
+						temp);
+			}
+
+			elemento = psCell;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_LINE: {
+			DGNElemMultiPoint psLine = new DGNElemMultiPoint();
+			psLine.stype = DGNFileHeader.DGNST_MULTIPOINT;
+			DGNParseCore(info, psLine);
+			psLine.num_vertices = 2;
+			psLine.vertices = new DGNPoint[psLine.num_vertices];
+
+			if (info.dimension == 2) {
+				byte[] temp1 = new byte[4];
+				System.arraycopy(info.abyElem, 36, temp1, 0, 4);
+				psLine.vertices[0] = new DGNPoint();
+				psLine.vertices[0].x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 40, temp1, 0, 4);
+				psLine.vertices[0].y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 44, temp1, 0, 4);
+				psLine.vertices[1] = new DGNPoint();
+				psLine.vertices[1].x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 48, temp1, 0, 4);
+				psLine.vertices[1].y = DGN_INT32(temp1);
+			} else {
+				byte[] temp1 = new byte[4];
+				System.arraycopy(info.abyElem, 36, temp1, 0, 4);
+				psLine.vertices[0] = new DGNPoint();
+				psLine.vertices[0].x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 40, temp1, 0, 4);
+				psLine.vertices[0].y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 44, temp1, 0, 4);
+				psLine.vertices[0].z = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 48, temp1, 0, 4);
+				psLine.vertices[1] = new DGNPoint();
+				psLine.vertices[1].x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 52, temp1, 0, 4);
+				psLine.vertices[1].y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 56, temp1, 0, 4);
+				psLine.vertices[1].z = DGN_INT32(temp1);
+			}
+
+			DGNTransformPoint(info, psLine.vertices[0]);
+			DGNTransformPoint(info, psLine.vertices[1]);
+			elemento = psLine;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_LINE_STRING:
+		case DGNFileHeader.DGNT_SHAPE: // regular
+		case DGNFileHeader.DGNT_CURVE: // mal
+		case DGNFileHeader.DGNT_BSPLINE: // aceptable
+		{
+			DGNElemMultiPoint psLine = new DGNElemMultiPoint();
+			int i;
+			int count;
+			int pntsize = info.dimension * 4;
+
+			count = ByteUtils.byteToUnsignedInt(info.abyElem[36])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[37]) * 256);
+			psLine.stype = DGNFileHeader.DGNST_MULTIPOINT;
+			DGNParseCore(info, psLine);
+
+			if (info.nElemBytes < (38 + (count * pntsize))) {
+				System.err.println("Error en los vertices de multipunto");
+				count = (info.nElemBytes - 38) / pntsize;
+
+				return null;
+			}
+
+			psLine.num_vertices = count;
+			psLine.vertices = new DGNPoint[psLine.num_vertices];
+
+			for (i = 0; i < psLine.num_vertices; i++) {
+				byte[] temp1 = new byte[4];
+				System.arraycopy(info.abyElem, 38 + (i * pntsize), temp1, 0, 4);
+				psLine.vertices[i] = new DGNPoint();
+				psLine.vertices[i].x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 42 + (i * pntsize), temp1, 0, 4);
+				psLine.vertices[i].y = DGN_INT32(temp1);
+
+				if (info.dimension == 3) {
+					System.arraycopy(info.abyElem, 46 + (i * pntsize), temp1,
+							0, 4);
+					psLine.vertices[i].z = DGN_INT32(temp1);
+				}
+
+				DGNTransformPoint(info, psLine.vertices[i]);
+			}
+
+			elemento = psLine;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_GROUP_DATA:
+
+			if (nLevel == DGNFileHeader.DGN_GDL_COLOR_TABLE) {
+				elemento = DGNParseColorTable(info);
+			} else {
+				elemento.stype = DGNFileHeader.DGNST_CORE;
+				DGNParseCore(info, elemento);
+			}
+
+			// System.err.println("DGNT_GROUP_DATA (nType = 5)");
+			// DGNDumpElement(info, elemento,"");
+			break;
+
+		case DGNFileHeader.DGNT_ELLIPSE: {
+			DGNElemArc psEllipse = new DGNElemArc();
+
+			psEllipse.stype = DGNFileHeader.DGNST_ARC;
+			DGNParseCore(info, psEllipse);
+
+			int[] fin = new int[1];
+			fin[0] = 0;
+
+			byte[] temp1 = new byte[8];
+			System.arraycopy(info.abyElem, 36, temp1, 0, 8);
+
+			fin[0] = 0;
+			psEllipse.primary_axis = DGNParseIEEE(temp1);
+
+			psEllipse.primary_axis *= info.scale;
+			System.arraycopy(info.abyElem, 44, temp1, 0, 8);
+			fin[0] = 0;
+
+			psEllipse.secondary_axis = DGNParseIEEE(temp1);
+			psEllipse.secondary_axis *= info.scale;
+
+			if (info.dimension == 2) {
+				System.arraycopy(info.abyElem, 52, temp1, 0, 4);
+				psEllipse.rotation = DGN_INT32(temp1);
+				psEllipse.rotation = psEllipse.rotation / 360000.0;
+				System.arraycopy(info.abyElem, 56, temp1, 0, 8);
+				fin[0] = 0;
+
+				psEllipse.origin.x = DGNParseIEEE(temp1);
+				System.arraycopy(info.abyElem, 64, temp1, 0, 8);
+				fin[0] = 0;
+
+				psEllipse.origin.y = DGNParseIEEE(temp1);
+			} else {
+				// leave quaternion for later
+				System.arraycopy(info.abyElem, 68, temp1, 0, 8);
+				fin[0] = 0;
+				psEllipse.origin.x = DGNParseIEEE(temp1);
+
+				System.arraycopy(info.abyElem, 76, temp1, 0, 8);
+				fin[0] = 0;
+				psEllipse.origin.y = DGNParseIEEE(temp1);
+
+				System.arraycopy(info.abyElem, 84, temp1, 0, 8);
+				fin[0] = 0;
+				psEllipse.origin.z = DGNParseIEEE(temp1);
+
+				System.arraycopy(info.abyElem, 52, temp1, 0, 4);
+				psEllipse.quat[0] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 56, temp1, 0, 4);
+				psEllipse.quat[1] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 60, temp1, 0, 4);
+				psEllipse.quat[2] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 64, temp1, 0, 4);
+				psEllipse.quat[3] = DGN_INT32(temp1);
+			}
+
+			// System.err.println("Punto antes de transformar:" +
+			// psEllipse.origin.x + " " + psEllipse.origin.y);
+			DGNTransformPoint(info, (psEllipse.origin));
+
+			// System.err.println("Punto DESPUES de transformar:" +
+			// psEllipse.origin.x + " " + psEllipse.origin.y);
+			psEllipse.startang = 0.0;
+			psEllipse.sweepang = 360.0;
+			elemento = psEllipse;
+
+			// DGNDumpElement(info, elemento,"");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_ARC: {
+			DGNElemArc psEllipse = new DGNElemArc();
+			double nSweepVal;
+
+			psEllipse.stype = DGNFileHeader.DGNST_ARC;
+			DGNParseCore(info, psEllipse);
+
+			int[] fin = new int[1];
+			fin[0] = 0;
+
+			byte[] temp1 = new byte[8];
+			System.arraycopy(info.abyElem, 36, temp1, 0, 4);
+			psEllipse.startang = DGN_INT32(temp1);
+			psEllipse.startang = psEllipse.startang / 360000.0;
+
+			/*
+			 * if ((info.abyElem[41] & (byte) 0x80) != FALSE) { info.abyElem[41]
+			 * &= (byte) 0x7f; System.arraycopy(info.abyElem, 40, temp1, 0, 4);
+			 * nSweepVal = -1 * DGN_INT32(temp1); } else {
+			 * System.arraycopy(info.abyElem, 40, temp1, 0, 4); } nSweepVal =
+			 * DGN_INT32(temp1);
+			 */
+			if ((info.abyElem[41] & (byte) 0x80) != FALSE) {
+				info.abyElem[41] &= (byte) 0x7f;
+				System.arraycopy(info.abyElem, 40, temp1, 0, 4);
+				nSweepVal = -1 * DGN_INT32(temp1);
+			} else {
+				System.arraycopy(info.abyElem, 40, temp1, 0, 4);
+				nSweepVal = DGN_INT32(temp1);
+			}
+
+			if (nSweepVal == 0) {
+				psEllipse.sweepang = 360.0;
+			} else {
+				psEllipse.sweepang = nSweepVal / 360000.0;
+			}
+
+			System.arraycopy(info.abyElem, 44, temp1, 0, 8);
+			fin[0] = 0;
+			psEllipse.primary_axis = DGNParseIEEE(temp1);
+
+			psEllipse.primary_axis *= info.scale;
+			System.arraycopy(info.abyElem, 52, temp1, 0, 8);
+			fin[0] = 0;
+			psEllipse.secondary_axis = DGNParseIEEE(temp1);
+
+			psEllipse.secondary_axis *= info.scale;
+
+			if (info.dimension == 2) {
+				System.arraycopy(info.abyElem, 60, temp1, 0, 4);
+				psEllipse.rotation = DGN_INT32(temp1);
+				psEllipse.rotation = psEllipse.rotation / 360000.0;
+				System.arraycopy(info.abyElem, 64, temp1, 0, 8);
+				fin[0] = 0;
+				psEllipse.origin.x = DGNParseIEEE(temp1);
+
+				System.arraycopy(info.abyElem, 72, temp1, 0, 8);
+				fin[0] = 0;
+				psEllipse.origin.y = DGNParseIEEE(temp1);
+			} else {
+				// for now we don't try to handle quaternion
+				psEllipse.rotation = 0;
+				System.arraycopy(info.abyElem, 76, temp1, 0, 8);
+				fin[0] = 0;
+
+				psEllipse.origin.x = DGNParseIEEE(temp1);
+				System.arraycopy(info.abyElem, 84, temp1, 0, 8);
+				fin[0] = 0;
+
+				psEllipse.origin.y = DGNParseIEEE(temp1);
+				System.arraycopy(info.abyElem, 92, temp1, 0, 8);
+				fin[0] = 0;
+
+				psEllipse.origin.z = DGNParseIEEE(temp1);
+				System.arraycopy(info.abyElem, 60, temp1, 0, 4);
+				psEllipse.quat[0] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 64, temp1, 0, 4);
+				psEllipse.quat[1] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 68, temp1, 0, 4);
+				psEllipse.quat[2] = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 72, temp1, 0, 4);
+				psEllipse.quat[3] = DGN_INT32(temp1);
+			}
+
+			DGNTransformPoint(info, (psEllipse.origin));
+			elemento = psEllipse;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_TEXT: {
+			DGNElemText psText = new DGNElemText();
+			int num_chars;
+			int text_off;
+
+			if (info.dimension == 2) {
+				num_chars = ByteUtils.byteToUnsignedInt(info.abyElem[58]);
+			} else {
+				num_chars = ByteUtils.byteToUnsignedInt(info.abyElem[74]);
+			}
+
+			psText.stype = DGNFileHeader.DGNST_TEXT;
+			DGNParseCore(info, psText);
+
+			psText.font_id = ByteUtils.byteToUnsignedInt(info.abyElem[36]);
+			psText.justification = ByteUtils
+					.byteToUnsignedInt(info.abyElem[37]);
+
+			byte[] temp1 = new byte[8];
+			System.arraycopy(info.abyElem, 38, temp1, 0, 4);
+			psText.length_mult = (DGN_INT32(temp1) * info.scale * 6.0) / 1000.0;
+			System.arraycopy(info.abyElem, 42, temp1, 0, 4);
+			psText.height_mult = (DGN_INT32(temp1) * info.scale * 6.0) / 1000.0;
+
+			int[] fin = new int[1];
+			fin[0] = 0;
+
+			if (info.dimension == 2) {
+				System.arraycopy(info.abyElem, 46, temp1, 0, 4);
+				psText.rotation = DGN_INT32(temp1);
+				psText.rotation = psText.rotation / 360000.0;
+				System.arraycopy(info.abyElem, 50, temp1, 0, 4);
+				psText.origin.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 54, temp1, 0, 4);
+				psText.origin.y = DGN_INT32(temp1);
+				text_off = 60;
+			} else {
+				/* leave quaternion for later */
+				System.arraycopy(info.abyElem, 62, temp1, 0, 4);
+				psText.origin.x = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 66, temp1, 0, 4);
+				psText.origin.y = DGN_INT32(temp1);
+				System.arraycopy(info.abyElem, 70, temp1, 0, 4);
+				psText.origin.z = DGN_INT32(temp1);
+				text_off = 76;
+			}
+
+			// System.err.println("Punto antes de transformar:" +
+			// psText.origin.x + " " + psText.origin.y);
+			DGNTransformPoint(info, (psText.origin));
+
+			// AQUI FALTA METER ALGO PARA SOPORTAR TEXTOS MULTYBYTE
+			byte[] temp = new byte[num_chars];
+			System.arraycopy(info.abyElem, text_off, temp, 0, num_chars);
+
+			// fin[0] = 0;
+			String strAux = null;
+
+			try {
+				psText.string = new String(temp, "ISO-8859-1");
+
+				// System.err.println(strAux);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+
+			elemento = psText;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_TCB:
+			if (info.got_tcb == FALSE) {
+				elemento = DGNParseTCB(info);
+				elemento.level = nLevel;
+				elemento.type = nType;
+			}
+			break;
+
+		case DGNFileHeader.DGNT_COMPLEX_CHAIN_HEADER:
+		case DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER: {
+			DGNElemComplexHeader psHdr = new DGNElemComplexHeader();
+
+			psHdr.stype = DGNFileHeader.DGNST_COMPLEX_HEADER;
+			DGNParseCore(info, psHdr);
+
+			psHdr.totlength = ByteUtils.byteToUnsignedInt(info.abyElem[36])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[37]) * 256);
+			psHdr.numelems = ByteUtils.byteToUnsignedInt(info.abyElem[38])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[39]) * 256);
+			elemento = psHdr;
+		}
+
+			break;
+
+		case DGNFileHeader.DGNT_TAG_VALUE: {
+			DGNElemTagValue psTag = new DGNElemTagValue();
+
+			psTag.stype = DGNFileHeader.DGNST_TAG_VALUE;
+			DGNParseCore(info, psTag);
+
+			int[] fin = new int[1];
+			fin[0] = 0;
+
+			byte[] temp1 = new byte[8];
+			psTag.tagType = ByteUtils.byteToUnsignedInt(info.abyElem[74])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[75]) * 256);
+			System.arraycopy(info.abyElem, 68, temp1, 0, 4);
+			fin[0] = 0;
+			psTag.tagSet = ByteUtils.bytesToInt(temp1, fin);
+
+			psTag.tagSet = CPL_LSBWORD32(psTag.tagSet);
+			psTag.tagIndex = ByteUtils.byteToUnsignedInt(info.abyElem[72])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[73]) * 256);
+			psTag.tagLength = ByteUtils.byteToUnsignedInt(info.abyElem[150])
+					+ (ByteUtils.byteToUnsignedInt(info.abyElem[151]) * 256);
+
+			if (psTag.tagType == 1) {
+				byte[] temp = new byte[info.abyElem.length - 154];
+				System.arraycopy(info.abyElem, 4, temp1, 0, // 154
+						4); // info.abyElem.length - 154
+				fin[0] = 0;
+				psTag.tagValue.string = CPLStrdup(ByteUtils.bytesToString(
+						temp1, fin).toCharArray());
+			} else if (psTag.tagType == 3) {
+				byte[] temp = new byte[4];
+				System.arraycopy(info.abyElem, 154, temp1, 0, 4);
+				fin[0] = 0;
+				psTag.tagValue.integer = ByteUtils.bytesToInt(temp1, fin);
+
+				psTag.tagValue.integer = CPL_LSBWORD32((int) psTag.tagValue.integer);
+			} else if (psTag.tagType == 4) {
+				byte[] temp = new byte[8];
+				System.arraycopy(info.abyElem, 154, temp1, 0, 8);
+				fin[0] = 0;
+				psTag.tagValue.real = DGNParseIEEE(temp1);
+			}
+
+			elemento = psTag;
+		}
+
+			break;
+
+		/*
+		 * case DGNFileHeader.DGNT_APPLICATION_ELEM: if (nLevel == 24) {
+		 * elemento = DGNParseTagSet(info); } else { elemento.stype =
+		 * DGNFileHeader.DGNST_CORE; DGNParseCore(info, elemento); } break;
+		 */
+		default: {
+			// System.err.println("Entra un " + nType +
+			// " en DGNProcessElement");
+			elemento.stype = DGNFileHeader.DGNST_CORE;
+			DGNParseCore(info, elemento);
+		}
+
+			break;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* If the element structure type is "core" or if we are running */
+		/* in "capture all" mode, record the complete binary image of */
+		/* the element. */
+		/* -------------------------------------------------------------------- */
+		if ((elemento.stype == DGNFileHeader.DGNST_CORE)
+				|| ((info.options & DGNFileHeader.DGNO_CAPTURE_RAW_DATA) != FALSE)) {
+			elemento.raw_bytes = info.nElemBytes;
+
+			elemento.raw_data = new byte[elemento.raw_bytes];
+
+			int[] fin = new int[1];
+			fin[0] = 0;
+			System.arraycopy(info.abyElem, 0, elemento.raw_data, 0,
+					elemento.raw_bytes);
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Collect some additional generic information. */
+		/* -------------------------------------------------------------------- */
+		elemento.element_id = info.next_element_id - 1;
+
+		elemento.offset = info.ftall - info.nElemBytes;
+		elemento.size = info.nElemBytes;
+
+		// DGNDumpElement(info, elemento,"");
+		return elemento;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param d
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private double DGNParseIEEE(double d) {
+		byte[] temp = new byte[8];
+		int[] f = { 0 };
+		ByteUtils.doubleToBytes(d, temp, f);
+
+		return DGNParseIEEE(temp);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param b
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private double DGNParseIEEE(byte[] b) {
+		byte BYTE2 = b[7];
+		byte BYTE3 = b[6];
+		byte BYTE0 = b[5];
+		byte BYTE1 = b[4];
+		byte BYTE6 = b[3];
+		byte BYTE7 = b[2];
+		byte BYTE4 = b[1];
+		byte BYTE5 = b[0];
+		int sign;
+		int exponent;
+		int fraction;
+		double value;
+		int hi;
+		int lo;
+		int rndbits;
+
+		/* -------------------------------------------------------------------- */
+		/* Save the sign of the double */
+		/* -------------------------------------------------------------------- */
+		byte[] temp = new byte[4];
+		byte[] temp1 = new byte[4];
+
+		temp[3] = BYTE7;
+		temp[2] = BYTE6;
+		temp[1] = BYTE5;
+		temp[0] = BYTE4;
+
+		int[] f = { 0 };
+		hi = ByteUtils.bytesToInt(temp, f);
+		sign = hi & 0x80000000;
+
+		/* -------------------------------------------------------------------- */
+		/* Adjust the exponent so that we may work with it */
+		/* -------------------------------------------------------------------- */
+		exponent = hi >> 23;
+		exponent = exponent & 0x000000ff;
+
+		if (exponent != 0) {
+			exponent = exponent - 129 + 1023;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Save the bits that we are discarding so we can round properly */
+		/* -------------------------------------------------------------------- */
+		temp[3] = BYTE3;
+		temp[2] = BYTE2;
+		temp[1] = BYTE1;
+		temp[0] = BYTE0;
+
+		f[0] = 0;
+		lo = ByteUtils.bytesToInt(temp, f);
+		rndbits = lo & 0x00000007;
+
+		lo = lo >> 3;
+		lo = (lo & 0x1fffffff) | (hi << 29);
+
+		if (rndbits != 0) {
+			lo = lo | 0x00000001;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Shift the hi-order int over 3 and insert the exponent and sign */
+		/* -------------------------------------------------------------------- */
+		hi = hi >> 3;
+		hi = hi & 0x000fffff;
+		hi = hi | (exponent << 20) | sign;
+		f[0] = 0;
+		ByteUtils.intToBytes(hi, temp, f);
+		f[0] = 0;
+		ByteUtils.intToBytes(lo, temp1, f);
+
+		byte[] result = new byte[8];
+		result[7] = temp1[3];
+		result[6] = temp1[2];
+		result[5] = temp1[1];
+		result[4] = temp1[0];
+		result[3] = temp[3];
+		result[2] = temp[2];
+		result[1] = temp[1];
+		result[0] = temp[0];
+
+		f[0] = 0;
+
+		value = ByteUtils.bytesToDouble(result, f);
+
+		return value;
+	}
+
+	/************************************************************************/
+	/* DGN2IEEEDouble() */
+	/************************************************************************/
+	/**
+	 * Cambia el double a IEEDouble.
+	 * 
+	 * @param dbl
+	 *            double de entrada.
+	 */
+	private double DGN2IEEEDouble(double dbl) {
+		int tempInt = (int) Double.doubleToLongBits(dbl);
+		int low = (tempInt & 0xffff0000) >>> 16; // >>>: Right shift without
+		// sign extension
+		int high = (tempInt & 0x0000ffff) << 16;
+		tempInt = high | low;
+		int s = ((tempInt >> 31) == 0) ? 1 : -1;
+		int e = ((tempInt >> 23) & 0xff);
+		int m = (tempInt & 0x7fffff) | 0x800000;
+		return ((s * m * 2 * Math.pow(2, e - 128 - 25)));
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param dbl
+	 *            DOCUMENT ME!
+	 */
+	private double IEEE2DGNDouble(double dbl) {
+		double64 dt = new double64();
+
+		dt.hi = 0;
+		dt.lo = 0;
+
+		long sign;
+		long exponent;
+		long rndbits;
+		byte[] srclo = new byte[4];
+		byte[] srchi = new byte[4];
+		byte[] destlo = new byte[4];
+		byte[] desthi = new byte[4];
+		byte[] src = new byte[8];
+		byte[] dest = new byte[8];
+
+		for (int i = 0; i < 8; i++) {
+			src[i] = '0';
+			dest[i] = '0';
+		}
+
+		int[] fin = new int[1];
+
+		if (LSB == TRUE) {
+			fin[0] = 0;
+			ByteUtils.doubleToBytes(dbl, src, fin);
+			dest[0] = src[4];
+			dest[1] = src[5];
+			dest[2] = src[6];
+			dest[3] = src[7];
+			dest[4] = src[0];
+			dest[5] = src[1];
+			dest[6] = src[2];
+			dest[7] = src[3];
+		} else {
+			// memcpy( &dt, dbl, 8 );
+		}
+
+		sign = dt.hi & 0x80000000;
+		exponent = dt.hi >> 20;
+		exponent = exponent & 0x000007ff;
+
+		/* -------------------------------------------------------------------- */
+		/* An exponent of zero means a zero value. */
+		/* -------------------------------------------------------------------- */
+		if (exponent != FALSE) {
+			exponent = exponent - 1023 + 129;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* In the case of overflow, return the largest number we can */
+		/* -------------------------------------------------------------------- */
+		if (exponent > 255) {
+			fin[0] = 0;
+			ByteUtils.doubleToBytes(dbl, dest, fin);
+
+			if (sign != FALSE) {
+				dest[1] = 0xf;
+			} else {
+				dest[1] = 0x7f;
+			}
+
+			dest[0] = 0xf;
+			dest[2] = 0xf;
+			dest[3] = 0xf;
+			dest[4] = 0xf;
+			dest[5] = 0xf;
+			dest[6] = 0xf;
+			dest[7] = 0xf;
+
+			return ByteUtils.bytesToDouble(dest, new int[0]);
+		}
+		/* -------------------------------------------------------------------- */
+		/* In the case of of underflow return zero */
+		/* -------------------------------------------------------------------- */
+		else if ((exponent < 0) || ((exponent == 0) && (sign == 0))) {
+			fin[0] = 0;
+			ByteUtils.doubleToBytes(dbl, dest, fin);
+			dest[0] = 0x00;
+			dest[1] = 0x00;
+			dest[2] = 0x00;
+			dest[3] = 0x00;
+			dest[4] = 0x00;
+			dest[5] = 0x00;
+			dest[6] = 0x00;
+			dest[7] = 0x00;
+
+			return 0.0;
+		} else {
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			/* Shift the fraction 3 bits left and set the exponent and sign */
+			/*
+			 * ------------------------------------------------------------------
+			 * --
+			 */
+			System.arraycopy(dest, 0, destlo, 0, 4);
+			fin[0] = 0;
+			dt.lo = ByteUtils.bytesToLong(destlo, fin);
+			System.arraycopy(dest, 4, desthi, 0, 4);
+			fin[0] = 0;
+			dt.hi = ByteUtils.bytesToLong(desthi, fin);
+
+			dt.hi = dt.hi << 3;
+			dt.hi = dt.hi | (dt.lo >> 29);
+			dt.hi = dt.hi & 0x007fffff;
+			dt.hi = dt.hi | (exponent << 23) | sign;
+
+			dt.lo = dt.lo << 3;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Convert the double back to VAX format */
+		/* -------------------------------------------------------------------- */
+		fin[0] = 0;
+
+		ByteUtils.longToBytes(dt.lo, srclo, fin);
+
+		fin[0] = 0;
+		ByteUtils.longToBytes(dt.hi, srchi, fin);
+
+		if (LSB == TRUE) {
+			dest[2] = srclo[0];
+			dest[3] = srclo[1];
+			dest[0] = srclo[2];
+			dest[1] = srclo[3];
+			dest[6] = srchi[0];
+			dest[7] = srchi[1];
+			dest[4] = srchi[2];
+			dest[5] = srchi[3];
+		} else {
+			dest[1] = srclo[0];
+			dest[0] = srclo[1];
+			dest[3] = srclo[2];
+			dest[2] = srclo[3];
+			dest[5] = srchi[0];
+			dest[4] = srchi[1];
+			dest[7] = srchi[2];
+			dest[6] = srchi[3];
+		}
+
+		fin[0] = 0;
+		dbl = ByteUtils.bytesToDouble(dest, fin);
+		return dbl;
+
+		// //System.out.println("dbl=  " + dbl);
+	}
+
+	/************************************************************************/
+	/* DGNElemTypeHasDispHdr() */
+	/************************************************************************/
+
+	/**
+	 * Does element type have display header.
+	 * 
+	 * @param nElemType
+	 *            element type (0-63) to test.
+	 * 
+	 * @return TRUE if elements of passed in type have a display header after
+	 *         the core element header, or FALSE otherwise.
+	 */
+	private int DGNElemTypeHasDispHdr(int nElemType) {
+		switch (nElemType) {
+		case 0:
+		case DGNFileHeader.DGNT_TCB:
+		case DGNFileHeader.DGNT_CELL_LIBRARY:
+		case DGNFileHeader.DGNT_LEVEL_SYMBOLOGY:
+		case 32:
+		case 44:
+		case 48:
+		case 49:
+		case 50:
+		case 51:
+		case 57:
+		case 63:
+			return FALSE;
+
+		default:
+			return TRUE;
+		}
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param info
+	 *            DOCUMENT ME!
+	 * @param elemento
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private int DGNParseCore(DGNInfo info, DGNElemCore elemento) {
+		byte[] psData = info.abyElem; // 0
+
+		elemento.level = psData[0] & (byte) 0x3f;
+		elemento.complex = psData[0] & (byte) 0x80;
+		elemento.deleted = psData[1] & (byte) 0x80;
+		elemento.type = psData[1] & (byte) 0x7f;
+
+		if ((info.nElemBytes >= 36)
+				&& (DGNElemTypeHasDispHdr(elemento.type) == TRUE)) {
+			// (elemento.type != DGNFileHeader.DGNT_CELL_LIBRARY)) {
+			elemento.graphic_group = psData[28] + (psData[29] * 256);
+			elemento.properties = psData[32] + (psData[33] * 256);
+
+			elemento.style = psData[34] & (byte) 0x7;
+			elemento.weight = (psData[34] & (byte) 0xf8) >> 3;
+
+			byte aux = psData[35];
+
+			// System.out.println("aux = " + aux);
+			elemento.color = ByteUtils.getUnsigned(aux);
+
+			// elemento.color = psData[35];
+			// System.out.println("elemento.color = " + elemento.color);
+		} else {
+			elemento.graphic_group = 0;
+			elemento.properties = 0;
+			elemento.style = 0;
+			elemento.weight = 0;
+			elemento.color = 0;
+		}
+
+		if ((elemento.properties & DGNFileHeader.DGNPF_ATTRIBUTES) != 0) {
+			// if ((elemento.properties & DGNFileHeader.DGNPF_ATTRIBUTES) ==
+			// TRUE) {
+			int nAttIndex;
+
+			nAttIndex = ByteUtils.getUnsigned(psData[30])
+					+ (ByteUtils.getUnsigned(psData[31]) * 256);
+
+			int numBytes = info.nElemBytes - (nAttIndex * 2) - 32;
+
+			if ((numBytes > 0)) {
+				// Como m�ximo guardamos 10 bytes (Total, lo queremos para el
+				// color....
+				// if (numBytes > 10) numBytes = 10;
+				elemento.attr_bytes = numBytes;
+
+				elemento.attr_data = new byte[elemento.attr_bytes];
+
+				// System.out.println("nAttIndex = " + nAttIndex +
+				// " numBytes = " + numBytes );
+				System.arraycopy(psData, (nAttIndex * 2) + 32,
+						elemento.attr_data, 0, elemento.attr_bytes);
+			}
+		}
+
+		return TRUE;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param rad50
+	 *            DOCUMENT ME!
+	 * @param str
+	 *            DOCUMENT ME!
+	 */
+	private void DGNRad50ToAscii(int rad50, byte[] str) {
+		byte cTimes;
+		int value;
+		int temp;
+		byte ch = '\0';
+		int i = 0;
+
+		while (rad50 > 0) {
+			value = rad50;
+			cTimes = 0;
+
+			while (value >= 40) {
+				value /= 40;
+				cTimes++;
+			}
+
+			byte[] abc = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+					'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
+					'W', 'X', 'Y', 'Z' };
+			byte[] num = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
+
+			/* Map 0..39 to ASCII */
+			if (value == 0) {
+				ch = ' '; /* space */
+			} else if ((value >= 1) && (value <= 26)) {
+				ch = abc[value - 1]; /* printable alpha A..Z */
+			} else if (value == 27) {
+				ch = '$'; /* dollar */
+			} else if (value == 28) {
+				ch = '.'; /* period */
+			} else if (value == 29) {
+				ch = ' '; /* unused char, emit a space instead */
+			} else if ((value >= 30) && (value <= 39)) {
+				ch = num[value - 30]; /* digit 0..9 */
+			}
+
+			str[i] = ch;
+			i++;
+
+			temp = 1;
+
+			while (cTimes-- > 0) {
+				temp *= 40;
+			}
+
+			rad50 -= (value * temp);
+		}
+
+		/* Do zero-terminate */
+		str[i] = '\0';
+	}
+
+	/**
+	 * Transforma el punto.
+	 * 
+	 * @param info
+	 *            Informaci�n del DGN.
+	 * @param psPoint
+	 *            Punto.
+	 */
+	private void DGNTransformPoint(DGNInfo info, DGNPoint psPoint) {
+		psPoint.x = (psPoint.x * info.scale) - info.origin_x;
+
+		// System.out.println("info.scale= "+info.scale+"info.origin_x= "+info.origin_x);
+		psPoint.y = (psPoint.y * info.scale) - info.origin_y;
+
+		// System.out.println("info.origin_y= "+info.origin_y);
+		psPoint.z = (psPoint.z * info.scale) - info.origin_z;
+
+		// System.out.println("x= "+psPoint.x+"y= "+psPoint.y);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param psDGN
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private DGNElemCore DGNParseColorTable(DGNInfo psDGN) {
+		DGNElemColorTable psColorTable = new DGNElemColorTable();
+
+		psColorTable.stype = DGNFileHeader.DGNST_COLORTABLE;
+
+		DGNParseCore(psDGN, psColorTable);
+
+		psColorTable.screen_flag = ByteUtils
+				.byteToUnsignedInt(psDGN.abyElem[36])
+				+ (ByteUtils.byteToUnsignedInt(psDGN.abyElem[37]) * 256);
+
+		int[] fin = new int[1];
+		fin[0] = 0;
+
+		byte[] temp = new byte[3];
+		System.arraycopy(psDGN.abyElem, 38, temp, 0, 3);
+		psColorTable.color_info[255] = temp;
+
+		byte[] temp2 = new byte[765];
+		System.arraycopy(psDGN.abyElem, 41, temp2, 0, 765);
+
+		int k = 0;
+
+		for (int i = 0; i < 255; i++) {
+			for (int j = 0; j < 3; j++) {
+				psColorTable.color_info[i][j] = temp2[k];
+				k++;
+			}
+
+			// System.err.println("Color " + psColorTable.color_info[i][0] + " "
+			// +
+			// psColorTable.color_info[i][1] + " " +
+			// psColorTable.color_info[i][2]);
+		}
+
+		if (psDGN.got_color_table == FALSE) {
+			psDGN.color_table = psColorTable.color_info;
+
+			psDGN.got_color_table = 1;
+		}
+
+		return psColorTable;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param psDGN
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private DGNElemCore DGNParseTCB(DGNInfo psDGN) {
+		DGNElemTCB psTCB = new DGNElemTCB();
+		int iView;
+		int[] fin = new int[1];
+		psTCB.stype = DGNFileHeader.DGNST_TCB;
+		DGNParseCore(psDGN, psTCB);
+
+		if ((psDGN.abyElem[1214] & (byte) 0x40) != FALSE) {
+			psTCB.dimension = 3;
+		} else {
+			psTCB.dimension = 2;
+		}
+
+		// psTCB.dimension = 3;
+		fin[0] = 0;
+
+		byte[] temp1 = new byte[8];
+		System.arraycopy(psDGN.abyElem, 1112, temp1, 0, 4);
+		psTCB.subunits_per_master = DGN_INT32(temp1);
+
+		psTCB.master_units[0] = (char) (psDGN.abyElem[1120]);
+		psTCB.master_units[1] = (char) (psDGN.abyElem[1121]);
+		psTCB.master_units[2] = '\0';
+
+		System.arraycopy(psDGN.abyElem, 1116, temp1, 0, 4);
+		psTCB.uor_per_subunit = DGN_INT32(temp1);
+
+		psTCB.sub_units[0] = (char) (psDGN.abyElem[1122]);
+		psTCB.sub_units[1] = (char) (psDGN.abyElem[1123]);
+		psTCB.sub_units[2] = '\0';
+
+		/* Get global origin */
+		System.arraycopy(psDGN.abyElem, 1240, temp1, 0, 8);
+		ByteBuffer buffer = ByteBuffer.wrap(psDGN.abyElem);
+		buffer.order(ByteOrder.LITTLE_ENDIAN);
+		psTCB.origin_x = buffer.getDouble(1240);
+		psTCB.origin_y = buffer.getDouble(1248);
+		psTCB.origin_z = buffer.getDouble(1256);
+
+		/* Transform to IEEE */
+		psTCB.origin_x = DGN2IEEEDouble(psTCB.origin_x);
+		psTCB.origin_y = DGN2IEEEDouble(psTCB.origin_y);
+		psTCB.origin_z = DGN2IEEEDouble(psTCB.origin_z);
+
+		/* Convert from UORs to master units. */
+		if ((psTCB.uor_per_subunit != 0) && (psTCB.subunits_per_master != 0)) {
+			psTCB.origin_x = psTCB.origin_x
+					/ (psTCB.uor_per_subunit * psTCB.subunits_per_master);
+			psTCB.origin_y = psTCB.origin_y
+					/ (psTCB.uor_per_subunit * psTCB.subunits_per_master);
+			psTCB.origin_z = psTCB.origin_z
+					/ (psTCB.uor_per_subunit * psTCB.subunits_per_master);
+		}
+
+		// psDGN.dimension = psTCB.dimension;
+		if (psDGN.got_tcb == FALSE) {
+			psDGN.got_tcb = TRUE;
+
+			psDGN.origin_x = psTCB.origin_x;
+			psDGN.origin_y = psTCB.origin_y;
+			psDGN.origin_z = psTCB.origin_z;
+			if ((psTCB.uor_per_subunit != 0)
+					&& (psTCB.subunits_per_master != 0)) {
+				psDGN.scale = 1.0 / (psTCB.uor_per_subunit * psTCB.subunits_per_master);
+			}
+		}
+
+		System.err.println("Ojo: HAY TCB!!");
+		System.out.println("Datos del TCB: " + psTCB.origin_x + " "
+				+ psTCB.origin_y);
+		System.out.println("psTCB.uor_per_subunit: " + psTCB.uor_per_subunit
+				+ " psTCB.subunits_per_master: " + psTCB.subunits_per_master);
+		// System.out.println("psTCB.master_units = " + new
+		// String(psTCB.master_units) +
+		// " psTCB.sub_units = " + new String(psTCB.sub_units));
+		System.out.println("psTCB.origen = " + psTCB.origin_x + " "
+				+ psTCB.origin_y);
+		System.out.println("psDGN.scale = " + psDGN.scale);
+		System.out.println("psDGN.origen = " + psDGN.origin_x + " "
+				+ psDGN.origin_y);
+		System.out.println("psDGN.dimension = " + psDGN.dimension);
+		/* Collect views */
+		for (iView = 0; iView < 8; iView++) {
+			byte[] pabyRawView = new byte[psDGN.abyElem.length];
+			fin[0] = 0;
+			System.arraycopy(psDGN.abyElem, (46 + (iView * 118)), pabyRawView,
+					0, psDGN.abyElem.length - (46 + (iView * 118)));
+
+			psTCB.views[iView] = new DGNViewInfo();
+			psTCB.views[iView].flags = ByteUtils
+					.byteToUnsignedInt(pabyRawView[0])
+					+ (ByteUtils.byteToUnsignedInt(pabyRawView[1]) * 256);
+
+			byte[] temp2 = new byte[4];
+			int f = 0;
+
+			for (int j = 0; j < 8; j++) {
+				System.arraycopy(pabyRawView, j + 2, temp2, 0, 1);
+				fin[0] = 0;
+				psTCB.views[iView].levels[f] = temp2[0];
+				f++;
+			}
+
+			psTCB.views[iView].origin = new DGNPoint();
+			System.arraycopy(pabyRawView, 10, temp1, 0, 4);
+			psTCB.views[iView].origin.x = DGN_INT32(temp1);
+
+			System.arraycopy(pabyRawView, 14, temp1, 0, 4);
+			psTCB.views[iView].origin.y = DGN_INT32(temp1);
+			System.arraycopy(pabyRawView, 18, temp1, 0, 4);
+			psTCB.views[iView].origin.z = DGN_INT32(temp1);
+			DGNTransformPoint(psDGN, (psTCB.views[iView].origin));
+
+			psTCB.views[iView].delta = new DGNPoint();
+			System.arraycopy(pabyRawView, 22, temp1, 0, 4);
+			psTCB.views[iView].delta.x = DGN_INT32(temp1);
+			System.arraycopy(pabyRawView, 26, temp1, 0, 4);
+			psTCB.views[iView].delta.y = DGN_INT32(temp1);
+			System.arraycopy(pabyRawView, 30, temp1, 0, 4);
+			psTCB.views[iView].delta.z = DGN_INT32(temp1);
+
+			psTCB.views[iView].delta.x *= psDGN.scale;
+			psTCB.views[iView].delta.y *= psDGN.scale;
+			psTCB.views[iView].delta.z *= psDGN.scale;
+
+			// memcpy( psTCB.views[iView].transmatrx, pabyRawView + 34,
+			// sizeof(double) * 9 );
+			psTCB.views[iView].transmatrx = new double[9];
+
+			for (int k = 0; k < 9; k++) {
+				System.arraycopy(pabyRawView, (34 + (8 * k)), temp1, 0, 8);
+
+				// fin[0]=0;
+				// double d=ByteUtils.bytesToDouble(temp1,fin);
+				fin[0] = 0;
+				psTCB.views[iView].transmatrx[k] = DGNParseIEEE(temp1);
+
+				// nuevo método
+			}
+
+			System.arraycopy(pabyRawView, 106, temp1, 0, 8);
+			fin[0] = 0;
+			psTCB.views[iView].conversion = ByteUtils.bytesToLong(temp1, fin);
+			fin[0] = 0;
+			psTCB.views[iView].conversion = ByteUtils.bytesToDouble(temp1, fin);
+
+			// memcpy( (psTCB.views[iView].conversion), pabyRawView + 106,
+			// sizeof(double) );
+			DGNParseIEEE(psTCB.views[iView].conversion);
+			System.arraycopy(pabyRawView, 114, temp1, 0, 8);
+			psTCB.views[iView].activez = DGN_INT32(temp1);
+		}
+
+		// DGNDumpElement(psDGN, psTCB,"");
+		return psTCB;
+	}
+
+	/**
+	 * Cambia un entero a LitterIndian.
+	 * 
+	 * @param x
+	 *            Entero de entrada.
+	 * 
+	 * @return Entero de salida.
+	 */
+	private int CPL_LSBWORD32(int x) {
+		return (((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)
+				| (((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24)));
+	}
+
+	/**
+	 * Cambia el vector de char de entrada en el caso de ser null por el
+	 * caracter vacio.
+	 * 
+	 * @param pszString
+	 *            Vector de char.
+	 * 
+	 * @return Vector de char.
+	 */
+	private char[] CPLStrdup(char[] pszString) {
+		char[] pszReturn;
+
+		if (pszString == null) {
+			pszString[0] = ' ';
+		}
+
+		pszReturn = new char[pszString.length];
+
+		// pszReturn = VSIStrdup( pszString );
+		pszReturn = pszString;
+
+		if (pszReturn == null) {
+			System.out.println("error");
+
+			/*
+			 * CPLError( CE_Fatal, CPLE_OutOfMemory,
+			 * "CPLStrdup(): Out of memory allocating %d bytes.\n",
+			 * strlen(pszString) );
+			 */
+		}
+
+		return (pszReturn);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param psDGN
+	 *            DOCUMENT ME!
+	 * 
+	 * @return DOCUMENT ME!
+	 */
+	private DGNElemCore DGNParseTagSet(DGNInfo psDGN) {
+		// DGNElemCore psElement;
+		DGNElemTagSet psTagSet = new DGNElemTagSet();
+		int nDataOffset;
+		int iTag;
+
+		// psTagSet = (DGNElemTagSet *) CPLCalloc(sizeof(DGNElemTagSet),1);
+		// psElement = (DGNElemCore *) psTagSet;
+		psTagSet.stype = DGNFileHeader.DGNST_TAG_SET;
+
+		DGNParseCore(psDGN, psTagSet);
+
+		/* -------------------------------------------------------------------- */
+		/* Parse the overall information. */
+		/* -------------------------------------------------------------------- */
+		psTagSet.tagCount = ByteUtils.byteToUnsignedInt(psDGN.abyElem[44])
+				+ (ByteUtils.byteToUnsignedInt(psDGN.abyElem[45]) * 256);
+		psTagSet.flags = ByteUtils.byteToUnsignedInt(psDGN.abyElem[46])
+				+ (ByteUtils.byteToUnsignedInt(psDGN.abyElem[47]) * 256);
+
+		int[] fin = new int[1];
+		fin[0] = 0;
+
+		byte[] temp = new byte[elemento.attr_bytes];
+		System.arraycopy(psDGN.abyElem, 48, temp, 0, psDGN.abyElem.length - 48);
+
+		psTagSet.tagSetName = CPLStrdup(ByteUtils.bytesToString(temp, fin)
+				.toCharArray());
+
+		/* -------------------------------------------------------------------- */
+		/* Get the tag set number out of the attributes, if available. */
+		/* -------------------------------------------------------------------- */
+		psTagSet.tagSet = -1;
+
+		if ((psTagSet.attr_bytes >= 8)
+				&& (psTagSet.attr_data[0] == (byte) 0x03)
+				&& (psTagSet.attr_data[1] == (byte) 0x10)
+				&& (psTagSet.attr_data[2] == (byte) 0x2f)
+				&& (psTagSet.attr_data[3] == (byte) 0x7d)) {
+			psTagSet.tagSet = psTagSet.attr_data[4]
+					+ (psTagSet.attr_data[5] * 256);
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Parse each of the tag definitions. */
+		/* -------------------------------------------------------------------- */
+		// psTagSet.tagList = (DGNTagDef *) CPLMalloc(sizeof(DGNTagDef) *
+		// psTagSet->tagCount);
+		nDataOffset = 48 + psTagSet.tagSetName.length + 1 + 1;
+
+		for (iTag = 0; iTag < psTagSet.tagCount; iTag++) {
+			DGNTagDef tagDef = new DGNTagDef();
+
+			// = psTagSet.tagList + iTag;
+			tagDef.id = iTag;
+
+			// CPLAssert( nDataOffset < psDGN.nElemBytes );
+			/* collect tag name. */
+			System.arraycopy(psDGN.abyElem, nDataOffset, temp, 0,
+					psDGN.abyElem.length);
+			fin[0] = 0;
+			tagDef.name = CPLStrdup(ByteUtils.bytesToString(temp, fin)
+					.toCharArray());
+			nDataOffset += ((tagDef.name.length) + 1);
+
+			/* Get tag id */
+			tagDef.id = ByteUtils.byteToUnsignedInt(psDGN.abyElem[nDataOffset])
+					+ (ByteUtils
+							.byteToUnsignedInt(psDGN.abyElem[nDataOffset + 1]) * 256);
+			nDataOffset += 2;
+
+			/* Get User Prompt */
+			System.arraycopy(psDGN.abyElem, nDataOffset, temp, 0,
+					psDGN.abyElem.length);
+			fin[0] = 0;
+			tagDef.prompt = CPLStrdup(ByteUtils.bytesToString(temp, fin)
+					.toCharArray());
+			nDataOffset += ((tagDef.prompt.length) + 1);
+
+			/* Get type */
+			tagDef.type = ByteUtils
+					.byteToUnsignedInt(psDGN.abyElem[nDataOffset])
+					+ (ByteUtils
+							.byteToUnsignedInt(psDGN.abyElem[nDataOffset + 1]) * 256);
+			nDataOffset += 2;
+
+			/* skip five zeros */
+			nDataOffset += 5;
+
+			/* Get the default */
+			if (tagDef.type == 1) {
+				System.arraycopy(psDGN.abyElem, nDataOffset, temp, 0,
+						psDGN.abyElem.length);
+				fin[0] = 0;
+				tagDef.defaultValue.string = CPLStrdup(ByteUtils.bytesToString(
+						temp, fin).toCharArray());
+				nDataOffset += (tagDef.defaultValue.string.length + 1);
+			} else if ((tagDef.type == 3) || (tagDef.type == 5)) {
+				System.arraycopy(psDGN.abyElem, nDataOffset, temp, 0, 4);
+				fin[0] = 0;
+				tagDef.defaultValue.integer = ByteUtils.bytesToLong(temp, fin);
+
+				// memcpy( (tagDef.defaultValue.integer),psDGN.abyElem +
+				// nDataOffset, 4 );
+				tagDef.defaultValue.integer = CPL_LSBWORD32((int) tagDef.defaultValue.integer);
+				nDataOffset += 4;
+			} else if (tagDef.type == 4) {
+				System.arraycopy(psDGN.abyElem, nDataOffset, temp, 0, 8);
+				fin[0] = 0;
+				tagDef.defaultValue.real = ByteUtils.bytesToDouble(temp, fin);
+
+				// memcpy( (tagDef.defaultValue.real), psDGN.abyElem +
+				// nDataOffset, 8 );
+				DGNParseIEEE(tagDef.defaultValue.real);
+				nDataOffset += 8;
+			} else {
+				nDataOffset += 4;
+			}
+		}
+
+		return psTagSet;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param psDGN
+	 *            DOCUMENT ME!
+	 * @param nOptions
+	 *            DOCUMENT ME!
+	 */
+	private void DGNSetOptions(DGNInfo psDGN, int nOptions) {
+		psDGN.options = nOptions;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 * 
+	 * @param psDGN
+	 *            DOCUMENT ME!
+	 * @param dfXMin
+	 *            DOCUMENT ME!
+	 * @param dfYMin
+	 *            DOCUMENT ME!
+	 * @param dfXMax
+	 *            DOCUMENT ME!
+	 * @param dfYMax
+	 *            DOCUMENT ME!
+	 */
+	private void DGNSetSpatialFilter(DGNInfo psDGN, double dfXMin,
+			double dfYMin, double dfXMax, double dfYMax) {
+		if ((dfXMin == 0.0) && (dfXMax == 0.0) && (dfYMin == 0.0)
+				&& (dfYMax == 0.0)) {
+			psDGN.has_spatial_filter = FALSE;
+
+			return;
+		}
+
+		psDGN.has_spatial_filter = TRUE;
+		psDGN.sf_converted_to_uor = FALSE;
+
+		psDGN.sf_min_x_geo = dfXMin;
+		psDGN.sf_min_y_geo = dfYMin;
+		psDGN.sf_max_x_geo = dfXMax;
+		psDGN.sf_max_y_geo = dfYMax;
+
+		DGNSpatialFilterToUOR(psDGN);
+	}
+
+	/**
+	 * Muestra por consola los elementos que contiene el DGN.
+	 * 
+	 * @param psInfo
+	 *            Informaci�n del DGN.
+	 * @param psElement
+	 *            elemento
+	 * @param fp
+	 *            path del fichero.
+	 */
+	public void DGNDumpElement(DGNInfo psInfo, DGNElemCore psElement, String fp) {
+		// DGNInfo *psInfo = (DGNInfo *) hDGN;
+		// System.out.println("\n");
+		System.out.println("Element:" + DGNTypeToName(psElement.type)
+				+ " Level:" + psElement.level + " id:" + psElement.element_id);
+
+		if (psElement.complex != 0) {
+			System.out.println("(Complex) ");
+		}
+
+		if (psElement.deleted != 0) {
+			System.out.println("(DELETED) ");
+		}
+
+		System.out.println("  offset=" + psElement.offset + " size="
+				+ psElement.size + " bytes\n");
+
+		System.out.println("  graphic_group:" + psElement.graphic_group
+				+ " color:" + psElement.color + " weight:" + psElement.weight
+				+ "style:" + psElement.style + "\n");
+
+		if (psElement.properties != 0) {
+			int nClass;
+
+			System.out.println("  properties=" + psElement.properties);
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_HOLE) != 0) {
+				System.out.println(",HOLE");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_SNAPPABLE) != 0) {
+				System.out.println(",SNAPPABLE");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_PLANAR) != 0) {
+				System.out.println(",PLANAR");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_ORIENTATION) != 0) {
+				System.out.println(",ORIENTATION");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_ATTRIBUTES) != 0) {
+				System.out.println(",ATTRIBUTES");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_MODIFIED) != 0) {
+				System.out.println(",MODIFIED");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_NEW) != 0) {
+				System.out.println(",NEW");
+			}
+
+			if ((psElement.properties & DGNFileHeader.DGNPF_LOCKED) != 0) {
+				System.out.println(",LOCKED");
+			}
+
+			nClass = psElement.properties & DGNFileHeader.DGNPF_CLASS;
+
+			if (nClass == DGNFileHeader.DGNC_PATTERN_COMPONENT) {
+				System.out.println(",PATTERN_COMPONENT");
+			} else if (nClass == DGNFileHeader.DGNC_CONSTRUCTION_ELEMENT) {
+				System.out.println(",CONSTRUCTION ELEMENT");
+			} else if (nClass == DGNFileHeader.DGNC_DIMENSION_ELEMENT) {
+				System.out.println(",DIMENSION ELEMENT");
+			} else if (nClass == DGNFileHeader.DGNC_PRIMARY_RULE_ELEMENT) {
+				System.out.println(",PRIMARY RULE ELEMENT");
+			} else if (nClass == DGNFileHeader.DGNC_LINEAR_PATTERNED_ELEMENT) {
+				System.out.println(",LINEAR PATTERNED ELEMENT");
+			} else if (nClass == DGNFileHeader.DGNC_CONSTRUCTION_RULE_ELEMENT) {
+				System.out.println(",CONSTRUCTION_RULE_ELEMENT");
+			}
+
+			// System.out.println("\n");
+		}
+
+		switch (psElement.stype) {
+		case DGNFileHeader.DGNST_MULTIPOINT: {
+			DGNElemMultiPoint psLine = new DGNElemMultiPoint();
+			psLine = (DGNElemMultiPoint) psElement;
+
+			int i;
+
+			for (i = 0; i < psLine.num_vertices; i++) {
+				System.out.println(psLine.vertices[i].x + ","
+						+ psLine.vertices[i].y + "," + psLine.vertices[i].z);
+			}
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_CELL_HEADER: {
+			DGNElemCellHeader psCell = new DGNElemCellHeader();
+			psCell = (DGNElemCellHeader) psElement;
+
+			System.out.println("  totlength=" + psCell.totlength + ", name="
+					+ psCell.name.toString() + " class=" + psCell.cclass
+					+ " levels=" + psCell.levels[0] + psCell.levels[1]
+					+ psCell.levels[2] + psCell.levels[3] + "\n");
+			System.out.println("  rnglow=(" + psCell.rnglow.x + ","
+					+ psCell.rnglow.y + "), rnghigh=(" + psCell.rnghigh.x + ","
+					+ psCell.rnghigh.y + ")\n");
+			System.out.println("  origin=(" + psCell.origin.x + ","
+					+ psCell.origin.y + ")\n");
+			System.out.println("  xscale=" + psCell.xscale + ",yscale="
+					+ psCell.yscale + ", rotation=" + psCell.rotation + "\n");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_CELL_LIBRARY: {
+			DGNElemCellLibrary psCell = new DGNElemCellLibrary();
+			psCell = (DGNElemCellLibrary) psElement;
+
+			System.out.println("  name=" + psCell.name.toString() + " class="
+					+ psCell.cclass + " levels=" + psCell.levels[0]
+					+ psCell.levels[1] + psCell.levels[2] + psCell.levels[3]
+					+ " numwords=" + psCell.numwords + "\n");
+			System.out.println("  dispsymb=" + psCell.dispsymb
+					+ ", description=" + psCell.description + "\n");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_ARC: {
+			DGNElemArc psArc = new DGNElemArc();
+			psArc = (DGNElemArc) psElement;
+
+			if (psInfo.dimension == 2) {
+				System.out.println("  origin=(" + psArc.origin.x + ","
+						+ psArc.origin.y + "), rotation=" + psArc.rotation
+						+ "\n");
+			} else {
+				System.out.println("  origin=(" + psArc.origin.x + ","
+						+ psArc.origin.y + "," + psArc.origin.z + "), quat="
+						+ psArc.quat[0] + "," + psArc.quat[1] + ","
+						+ psArc.quat[2] + "," + psArc.quat[3] + "\n");
+			}
+
+			System.out.println("  axes=(" + psArc.primary_axis + ","
+					+ psArc.secondary_axis + "), start angle=" + psArc.startang
+					+ ", sweep=" + psArc.sweepang + "\n");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_TEXT: {
+			DGNElemText psText = new DGNElemText();
+			psText = (DGNElemText) psElement;
+
+			System.out.println("  origin=(" + psText.origin.x + psText.origin.y
+					+ ") rotation=" + psText.rotation + "\n" + "  font="
+					+ psText.font_id + " just=" + psText.justification
+					+ "length_mult=" + psText.length_mult + " height_mult="
+					+ psText.height_mult + "\n" + "  string ="
+					+ new String(psText.string).toString() + "\n");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_COMPLEX_HEADER: {
+			DGNElemComplexHeader psHdr = new DGNElemComplexHeader();
+			psHdr = (DGNElemComplexHeader) psElement;
+
+			System.out.println("  totlength=" + psHdr.totlength + "numelems="
+					+ psHdr.numelems + "\n");
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_COLORTABLE: {
+			DGNElemColorTable psCT = new DGNElemColorTable();
+			psCT = (DGNElemColorTable) psElement;
+
+			int i;
+
+			System.out.println("  screen_flag:" + psCT.screen_flag + "\n");
+
+			for (i = 0; i < 256; i++) {
+				System.out.println(i + ": (" + psCT.color_info[i][0] + ","
+						+ psCT.color_info[i][1] + "," + psCT.color_info[i][2]
+						+ ")\n");
+			}
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_TCB: {
+			DGNElemTCB psTCB = new DGNElemTCB();
+			psTCB = (DGNElemTCB) psElement;
+
+			int iView;
+
+			// psTCB.dimension=psInfo.dimension;
+			System.out.println("  dimension =" + psTCB.dimension + "\n");
+			System.out.println("  uor_per_subunit =" + psTCB.uor_per_subunit); // +
+
+			// " subunits = `" + psTCB.sub_units[0] + psTCB.sub_units[1] +
+			// psTCB.sub_units[2] + "'\n");
+			System.out.println("  subunits_per_master ="
+					+ psTCB.subunits_per_master); // + " master_units = `" +
+
+			// psTCB.master_units[0] + psTCB.master_units[1] +
+			// psTCB.master_units[2] + "'\n");
+			System.out.println("  origin = (" + psTCB.origin_x + ","
+					+ psTCB.origin_y + "," + psTCB.origin_z + ")\n");
+
+			for (iView = 0; iView < 8; iView++) {
+				DGNViewInfo psView = psTCB.views[iView];
+
+				// DGNParseTCB(psInfo);
+				System.out.println("View  " + iView + ": flags= "
+						+ Integer.toHexString(psView.flags) + " levels= "
+						+ psView.levels[0] + "" + psView.levels[1] + ""
+						+ psView.levels[2] + "" + psView.levels[3] + ""
+						+ psView.levels[4] + "" + psView.levels[5] + ""
+						+ psView.levels[6] + "" + psView.levels[7] + "\n");
+				System.out.println("origin=( " + psView.origin.x + ","
+						+ psView.origin.y + "," + psView.origin.z
+						+ ")\n        delta=(" + psView.delta.x + ","
+						+ psView.delta.y + "," + psView.delta.z + ")\n");
+
+				System.out.println("trans=( " + psView.transmatrx[0] + ","
+						+ psView.transmatrx[1] + "," + psView.transmatrx[2]
+						+ "," + psView.transmatrx[3] + ","
+						+ psView.transmatrx[4] + "," + psView.transmatrx[5]
+						+ "," + psView.transmatrx[6] + ","
+						+ psView.transmatrx[7] + "," + psView.transmatrx[8]
+						+ ")\n");
+			}
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_TAG_SET: {
+			DGNElemTagSet psTagSet = new DGNElemTagSet();
+			psTagSet = (DGNElemTagSet) psElement;
+
+			int iTag;
+
+			System.out.println("  tagSetName=" + psTagSet.tagSetName.toString()
+					+ " tagSet=" + psTagSet.tagSet + " tagCount="
+					+ psTagSet.tagCount + " flags=" + psTagSet.flags + "\n");
+
+			for (iTag = 0; iTag < psTagSet.tagCount; iTag++) {
+				DGNTagDef psTagDef = psTagSet.tagList[iTag];
+
+				System.out.println(psTagDef.id + ": name="
+						+ psTagDef.name.toString() + ", type=" + psTagDef.type
+						+ ", prompt=" + psTagDef.prompt.toString());
+
+				if (psTagDef.type == 1) {
+					System.out.println(", default="
+							+ psTagDef.defaultValue.string.toString() + "\n");
+				} else if ((psTagDef.type == 3) || (psTagDef.type == 5)) {
+					System.out.println(", default="
+							+ psTagDef.defaultValue.integer + "\n");
+				} else if (psTagDef.type == 4) {
+					System.out.println(", default="
+							+ psTagDef.defaultValue.real + "\n");
+				} else {
+					System.out.println(", default=<unknown>\n");
+				}
+			}
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_TAG_VALUE: {
+			DGNElemTagValue psTag = new DGNElemTagValue();
+			psTag = (DGNElemTagValue) psElement;
+
+			System.out.println("  tagType=" + psTag.tagType + ", tagSet="
+					+ psTag.tagSet + ", tagIndex=" + psTag.tagIndex
+					+ ", tagLength=" + psTag.tagLength + "\n");
+
+			if (psTag.tagType == 1) {
+				System.out.println("  value="
+						+ psTag.tagValue.string.toString() + "\n");
+			} else if (psTag.tagType == 3) {
+				System.out.println("  value=" + psTag.tagValue.integer + "\n");
+			} else if (psTag.tagType == 4) {
+				System.out.println("  value=" + psTag.tagValue.real + "\n");
+			}
+		}
+
+			break;
+
+		case DGNFileHeader.DGNST_GROUP_DATA: {
+			// TODO
+		}
+
+			break;
+
+		default:
+			break;
+		}
+
+		if (psElement.attr_bytes > 0) {
+			int iLink;
+
+			System.out.println("Attributes:" + psElement.attr_bytes + "\n");
+
+			for (iLink = 0; true; iLink++) {
+				int[] nLinkType = new int[1];
+				int[] nEntityNum = new int[1];
+				int[] nMSLink = new int[1];
+				int[] nLinkSize = new int[1];
+				int i;
+				nEntityNum[0] = 0;
+				nMSLink[0] = 0;
+
+				byte[] pabyData;
+
+				pabyData = DGNGetLinkage(psInfo, psElement, iLink, nLinkType,
+						nEntityNum, nMSLink, nLinkSize);
+
+				if (pabyData == null) {
+					break;
+				}
+
+				System.out.println("Type=0x" + nLinkType);
+
+				if ((nMSLink[0] != 0) || (nEntityNum[0] != 0)) {
+					System.out.println(", EntityNum=" + nEntityNum[0]
+							+ ", MSLink=" + nMSLink[0]);
+				}
+
+				System.out.println("\n  0x");
+
+				for (i = 0; i < nLinkSize[0]; i++) {
+					System.out.println(pabyData[i]);
+				}
+
+				System.out.println("\n");
+			}
+		}
+	}
+
+	/**
+	 * Returns requested linkage raw data. A pointer to the raw data for the
+	 * requested attribute linkage is returned as well as (potentially) various
+	 * information about the linkage including the linkage type, database entity
+	 * number and MSLink value, and the length of the raw linkage data in bytes.
+	 * If the requested linkage (iIndex) does not exist a value of zero is
+	 * returned. The entity number is (loosely speaking) the index of the table
+	 * within the current database to which the MSLINK value will refer. The
+	 * entity number should be used to lookup the table name in the MSCATALOG
+	 * table. The MSLINK value is the key value for the record in the target
+	 * table.
+	 * 
+	 * @param psDGN
+	 *            the file from which the element originated.
+	 * @param psElement
+	 *            the element to report on.
+	 * @param iIndex
+	 *            the zero based index of the linkage to fetch.
+	 * @param pnLinkageType
+	 *            variable to return linkage type. This may be one of the
+	 *            predefined DGNLT_ values or a different value. This pointer
+	 *            may be NULL.
+	 * @param pnEntityNum
+	 *            variable to return the entity number in or NULL if not
+	 *            required.
+	 * @param pnMSLink
+	 *            variable to return the MSLINK value in, or NULL if not
+	 *            required.
+	 * @param pnLength
+	 *            variable to returned the linkage size in bytes or NULL.
+	 * 
+	 * @return pointer to raw internal linkage data. This data should not be
+	 *         altered or freed. NULL returned on failure.
+	 */
+	private byte[] DGNGetLinkage(DGNInfo psDGN, DGNElemCore psElement,
+			int iIndex, int[] pnLinkageType, int[] pnEntityNum, int[] pnMSLink,
+			int[] pnLength) {
+		int nAttrOffset;
+		int iLinkage;
+		int nLinkSize;
+
+		for (iLinkage = 0, nAttrOffset = 0; (nLinkSize = DGNGetAttrLinkSize(
+				psDGN, psElement, nAttrOffset)) != 0; iLinkage++, nAttrOffset += nLinkSize) {
+			if (iLinkage == iIndex) {
+				int nLinkageType = 0;
+				int nEntityNum = 0;
+				int nMSLink = 0;
+
+				// CPLAssert( nLinkSize > 4 );
+				if ((psElement.attr_data[nAttrOffset + 0] == (byte) 0x00)
+						&& ((psElement.attr_data[nAttrOffset + 1] == (byte) 0x00) || (psElement.attr_data[nAttrOffset + 1] == (byte) 0x80))) {
+					nLinkageType = DGNFileHeader.DGNLT_DMRS;
+					nEntityNum = psElement.attr_data[nAttrOffset + 2]
+							+ (psElement.attr_data[nAttrOffset + 3] * 256);
+					nMSLink = psElement.attr_data[nAttrOffset + 4]
+							+ (psElement.attr_data[nAttrOffset + 5] * 256)
+							+ (psElement.attr_data[nAttrOffset + 6] * 65536);
+				} else {
+					nLinkageType = psElement.attr_data[nAttrOffset + 2]
+							+ (psElement.attr_data[nAttrOffset + 3] * 256);
+				}
+
+				// Possibly an external database linkage?
+				if ((nLinkSize == 16)
+						&& (nLinkageType != DGNFileHeader.DGNLT_SHAPE_FILL)) {
+					nEntityNum = psElement.attr_data[nAttrOffset + 6]
+							+ (psElement.attr_data[nAttrOffset + 7] * 256);
+					nMSLink = psElement.attr_data[nAttrOffset + 8]
+							+ (psElement.attr_data[nAttrOffset + 9] * 256)
+							+ (psElement.attr_data[nAttrOffset + 10] * 65536)
+							+ (psElement.attr_data[nAttrOffset + 11] * 65536 * 256);
+				}
+
+				if (pnLinkageType != null) {
+					pnLinkageType[0] = nLinkageType;
+				}
+
+				if (pnEntityNum != null) {
+					pnEntityNum[0] = nEntityNum;
+				}
+
+				if (pnMSLink != null) {
+					pnMSLink[0] = nMSLink;
+				}
+
+				if (pnLength != null) {
+					pnLength[0] = nLinkSize;
+				}
+
+				byte[] temp = new byte[psElement.attr_data.length - nAttrOffset];
+				System.arraycopy(psElement.attr_data, nAttrOffset, temp, 0,
+						psElement.attr_data.length - nAttrOffset);
+
+				return temp;
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Devuelve el tama�o de los atributos de un elemento.
+	 * 
+	 * @param psDGN
+	 *            Informaci�n del DGN.
+	 * @param psElement
+	 *            elemento.
+	 * @param nOffset
+	 *            indice donde se encuentra el elemento.
+	 * 
+	 * @return Entero que representa el Tama�o.
+	 */
+	private int DGNGetAttrLinkSize(DGNInfo psDGN, DGNElemCore psElement,
+			int nOffset) {
+		if (psElement.attr_bytes < (nOffset + 4)) {
+			return 0;
+		}
+
+		/* DMRS Linkage */
+		if (((psElement.attr_data[nOffset + 0] == 0) && (psElement.attr_data[nOffset + 1] == 0))
+				|| ((psElement.attr_data[nOffset + 0] == 0) && (psElement.attr_data[nOffset + 1] == (byte) 0x80))) {
+			return 8;
+		}
+
+		/* If low order bit of second byte is set, first byte is length */
+		if ((psElement.attr_data[nOffset + 1] & (byte) 0x10) != FALSE) {
+			return (psElement.attr_data[nOffset + 0] * 2) + 2;
+		}
+
+		/* unknown */
+		return 0;
+	}
+
+	/**
+	 * A partir de un entero devuelve el un String con el tipo del elemento.
+	 * 
+	 * @param nType
+	 *            tipo.
+	 * 
+	 * @return String con el nombre del elemento.
+	 */
+	private String DGNTypeToName(int nType) {
+		// char[] szNumericResult=new char[16];
+		switch (nType) {
+		case DGNFileHeader.DGNT_CELL_LIBRARY:
+			return "Cell Library";
+
+		case DGNFileHeader.DGNT_CELL_HEADER:
+			return "Cell Header";
+
+		case DGNFileHeader.DGNT_LINE:
+			return "Line";
+
+		case DGNFileHeader.DGNT_LINE_STRING:
+			return "Line String";
+
+		case DGNFileHeader.DGNT_GROUP_DATA:
+			return "Group Data";
+
+		case DGNFileHeader.DGNT_SHAPE:
+			return "Shape";
+
+		case DGNFileHeader.DGNT_TEXT_NODE:
+			return "Text Node";
+
+		case DGNFileHeader.DGNT_DIGITIZER_SETUP:
+			return "Digitizer Setup";
+
+		case DGNFileHeader.DGNT_TCB:
+			return "TCB";
+
+		case DGNFileHeader.DGNT_LEVEL_SYMBOLOGY:
+			return "Level Symbology";
+
+		case DGNFileHeader.DGNT_CURVE:
+			return "Curve";
+
+		case DGNFileHeader.DGNT_COMPLEX_CHAIN_HEADER:
+			return "Complex Chain Header";
+
+		case DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER:
+			return "Complex Shape Header";
+
+		case DGNFileHeader.DGNT_ELLIPSE:
+			return "Ellipse";
+
+		case DGNFileHeader.DGNT_ARC:
+			return "Arc";
+
+		case DGNFileHeader.DGNT_TEXT:
+			return "Text";
+
+		case DGNFileHeader.DGNT_BSPLINE:
+			return "B-Spline";
+
+		case DGNFileHeader.DGNT_APPLICATION_ELEM:
+			return "Application Element";
+
+		case DGNFileHeader.DGNT_SHARED_CELL_DEFN:
+			return "Shared Cell Definition";
+
+		case DGNFileHeader.DGNT_SHARED_CELL_ELEM:
+			return "Shared Cell Element";
+
+		case DGNFileHeader.DGNT_TAG_VALUE:
+			return "Tag Value";
+
+		default:
+			System.out.println(nType);
+
+			return "Fallo";
+		}
+	}
+
+	/**
+	 * Muestra por consola la fila de un elemento.
+	 * 
+	 * @param psDGN
+	 *            informaci�n del DGN.
+	 * @param psCore
+	 *            elemento
+	 * @param fpOut
+	 *            path del fichero DGN.
+	 */
+	private void DGNDumpRawElement(DGNInfo psDGN, DGNElemCore psCore,
+			String fpOut) {
+		int i;
+		int iChar = 0;
+		byte[] szLine = new byte[80];
+
+		// System.out.println("  Raw Data (" + psCore.raw_bytes + " bytes):\n");
+		for (i = 0; i < psCore.raw_bytes; i++) {
+			byte[] szHex = new byte[3];
+
+			if ((i % 16) == 0) {
+				int[] f = new int[1];
+				byte[] temp = new byte[4];
+				f[0] = 0;
+				ByteUtils.intToBytes(i, temp, f);
+				System.arraycopy(temp, 0, szLine, 0, 4);
+
+				// //System.out.println( szLine.toString()+","+ i );
+				iChar = 0;
+			}
+
+			szHex[0] = psCore.raw_data[i];
+			szHex[1] = (byte) 0x00;
+
+			// System.arraycopy(psCore.raw_data,0,szHex,0,3);
+			// //System.out.println(
+			// szHex.toString()+","+psCore.raw_data.toString() );
+			// strncpy( szLine+8+iChar*2, szHex, 2 );/**no se */
+			System.arraycopy(szHex, 0, szLine, 8 + (iChar * 2), 2);
+
+			if ((psCore.raw_data[i] < 32) || (psCore.raw_data[i] > 127)) {
+				szLine[42 + iChar] = '.';
+			} else {
+				szLine[42 + iChar] = psCore.raw_data[i];
+			}
+
+			if ((i == (psCore.raw_bytes - 1)) || (((i + 1) % 16) == 0)) {
+				// //System.out.println(szLine.toString()+"\n" );
+				int[] f = new int[1];
+				f[0] = 0;
+
+				// ByteUtils.bytesToInt(szLine,f);
+				// System.out.println(ByteUtils.bytesToInt(szLine, f) + " : ");
+				// ByteUtils.print_bytes(szLine,8,74);
+				byte[] temp = new byte[1];
+				byte[] temp1 = new byte[16];
+				int k = 0;
+
+				for (int j = 1; j < 32; j = j + 2) {
+					System.arraycopy(szLine, j + 7, temp, 0, 1);
+					temp1[k] = temp[0];
+					k++;
+				}
+
+				// System.out.println(ByteUtils.print_bytes(temp1));
+				// //System.out.println(ByteUtils.print_bytes(szLine,7,41));
+				f[0] = 42;
+
+				char[] tempchar = new char[16];
+
+				for (int j = 0; j < 16; j++) {
+					tempchar[j] = (char) szLine[42 + j];
+				}
+
+				// System.out.println(String.copyValueOf(tempchar));
+			}
+
+			iChar++;
+		}
+	}
+
+	/**
+	 * Devuelve el extent del elemento.
+	 * 
+	 * @param psDGN
+	 *            Informaci�n del DGN.
+	 * @param padfExtents
+	 *            doubles que representan el rect�ngulo del extent.
+	 * 
+	 * @return Entero que muestra si se ha calculado correctamente.
+	 */
+	private int DGNGetExtents(DGNInfo psDGN, double[] padfExtents) {
+		// DGNInfo *psDGN = (DGNInfo *) hDGN;
+		DGNPoint sMin = new DGNPoint();
+		DGNPoint sMax = new DGNPoint();
+
+		DGNBuildIndex(psDGN);
+
+		if (psDGN.got_bounds == FALSE) {
+			return FALSE;
+		}
+
+		double minX = psDGN.min_x;
+		double minY = psDGN.min_y;
+		double minZ = psDGN.min_z;
+		System.out.println("psDGN.min" + " x= " + psDGN.min_x + " y= "
+				+ psDGN.min_y);
+
+		if (minX < 0) {
+			minX = minX + (2 * ((long) Integer.MAX_VALUE + 1));
+			System.out.println("minX" + minX);
+		}
+
+		if (minY < 0) {
+			minY = minY + (2 * ((long) Integer.MAX_VALUE + 1));
+			System.out.println("minY " + minY);
+		}
+
+		if (minZ < 0) {
+			minZ = minZ + (2 * ((long) Integer.MAX_VALUE + 1));
+		}
+
+		sMin.x = minX - 2147483648.0;
+		sMin.y = minY - 2147483648.0;
+		sMin.z = minZ - 2147483648.0;
+
+		DGNTransformPoint(psDGN, sMin);
+
+		padfExtents[0] = sMin.x;
+		padfExtents[1] = sMin.y;
+		padfExtents[2] = sMin.z;
+
+		double maxX = psDGN.max_x;
+		double maxY = psDGN.max_y;
+		double maxZ = psDGN.max_z;
+
+		// System.out.println("psDGN.max"+
+		// " x= "+psDGN.max_x+" y= "+psDGN.max_y);
+		if (maxX < 0) {
+			maxX = maxX + (2 * ((long) Integer.MAX_VALUE + 1));
+
+			// System.out.println("maxX"+maxX);
+		}
+
+		if (maxY < 0) {
+			maxY = maxY + (2 * ((long) Integer.MAX_VALUE + 1));
+
+			// System.out.println("maxY"+maxY);
+		}
+
+		if (maxZ < 0) {
+			maxZ = maxZ + (2 * ((long) Integer.MAX_VALUE + 1));
+		}
+
+		sMax.x = maxX - 2147483648.0;
+		sMax.y = maxY - 2147483648.0;
+		sMax.z = maxZ - 2147483648.0;
+
+		DGNTransformPoint(psDGN, sMax);
+
+		padfExtents[3] = sMax.x;
+		padfExtents[4] = sMax.y;
+		padfExtents[5] = sMax.z;
+
+		return TRUE;
+	}
+
+	/**
+	 * Construye un �ndice al DGN.
+	 * 
+	 * @param psDGN
+	 *            Informaci�n del DGN.
+	 */
+	private void DGNBuildIndex(DGNInfo psDGN) {
+		DGNElemCore elemento = new DGNElemCore();
+		int nMaxElements;
+		int nType;
+		int nLevel;
+		long nLastOffset;
+
+		if (psDGN.index_built != FALSE) {
+			return;
+		}
+
+		psDGN.index_built = TRUE;
+
+		// DGNRewind( psDGN );
+		nMaxElements = 0;
+
+		// nLastOffset = VSIFTell( psDGN.fp );
+		nLastOffset = bb.position(); // psDGN.ftall;
+
+		while (DGNLoadRawElement(psDGN, elemento) != FALSE) {
+			DGNElementInfo psEI; // = new DGNElementInfo();
+
+			if (psDGN.element_count == nMaxElements) {
+				int oldMax = nMaxElements;
+				nMaxElements = (int) (nMaxElements * 1.5) + 500;
+
+				DGNElementInfo[] nuevo = new DGNElementInfo[nMaxElements];
+
+				for (int i = 0; i < oldMax; i++) {
+					nuevo[i] = psDGN.element_index[i];
+				}
+
+				psDGN.element_index = nuevo;
+
+				// psDGN.element_index = (DGNElementInfo *) CPLRealloc(
+				// psDGN.element_index,
+				// nMaxElements * sizeof(DGNElementInfo) );
+			}
+
+			psDGN.element_index[psDGN.element_count] = new DGNElementInfo();
+			psEI = psDGN.element_index[psDGN.element_count];
+			psEI.level = elemento.level;
+			psEI.type = elemento.type;
+			psEI.flags = 0;
+			psEI.offset = nLastOffset;
+
+			if ((psDGN.abyElem[0] * (byte) 0x80) == (byte) 0x80) {
+				psEI.flags |= DGNFileHeader.DGNEIF_COMPLEX;
+			}
+
+			if ((psDGN.abyElem[1] * (byte) 0x80) == (byte) 0x80) {
+				psEI.flags |= DGNFileHeader.DGNEIF_DELETED;
+			}
+
+			if ((elemento.type == DGNFileHeader.DGNT_LINE)
+					|| (elemento.type == DGNFileHeader.DGNT_LINE_STRING)
+					|| (elemento.type == DGNFileHeader.DGNT_SHAPE)
+					|| (elemento.type == DGNFileHeader.DGNT_CURVE)
+					|| (elemento.type == DGNFileHeader.DGNT_BSPLINE)) {
+				psEI.stype = DGNFileHeader.DGNST_MULTIPOINT;
+			} else if ((elemento.type == DGNFileHeader.DGNT_GROUP_DATA)
+					&& (elemento.level == DGNFileHeader.DGN_GDL_COLOR_TABLE)) {
+				DGNElemCore psCT = DGNParseColorTable(psDGN);
+
+				// DGNFreeElement( psDGN, psCT );
+				System.err.println("TABLA DE COLORES!!");
+				psEI.stype = DGNFileHeader.DGNST_COLORTABLE;
+				m_colorTable = (DGNElemColorTable) psCT;
+
+				// DGNDumpElement(psDGN,psCT,"");
+			} else if ((elemento.type == DGNFileHeader.DGNT_ELLIPSE)
+					|| (elemento.type == DGNFileHeader.DGNT_ARC)) {
+				psEI.stype = DGNFileHeader.DGNST_ARC;
+			} else if ((elemento.type == DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER)
+					|| (elemento.type == DGNFileHeader.DGNT_COMPLEX_CHAIN_HEADER)) {
+				psEI.stype = DGNFileHeader.DGNST_COMPLEX_HEADER;
+			} else if (elemento.type == DGNFileHeader.DGNT_TEXT) {
+				psEI.stype = DGNFileHeader.DGNST_TEXT;
+			} else if (elemento.type == DGNFileHeader.DGNT_TAG_VALUE) {
+				psEI.stype = DGNFileHeader.DGNST_TAG_VALUE;
+			} else if (elemento.type == DGNFileHeader.DGNT_APPLICATION_ELEM) {
+				if (elemento.level == 24) {
+					psEI.stype = DGNFileHeader.DGNST_TAG_SET;
+				} else {
+					psEI.stype = DGNFileHeader.DGNST_CORE;
+				}
+			} else if (elemento.type == DGNFileHeader.DGNT_TCB) {
+				DGNElemCore psTCB = DGNParseTCB(psDGN);
+
+				// DGNFreeElement( psDGN, psTCB );
+				psEI.stype = DGNFileHeader.DGNST_TCB;
+			} else {
+				psEI.stype = DGNFileHeader.DGNST_CORE;
+			}
+
+			// DGNInfo tempo = new DGNInfo();
+			double[] anRegion;
+
+			if (((psEI.flags & DGNFileHeader.DGNEIF_DELETED) == FALSE)
+					& ((psEI.flags & DGNFileHeader.DGNEIF_COMPLEX) == FALSE)
+					& ((anRegion = DGNGetRawExtents(psDGN, null, elemento)) != null)) {
+				// #ifdef notdef
+				// System.out.println(
+				// "element_count"+psDGN.element_count+"anRegion[]"+("xmin"+anRegion[0])+"xmax"+anRegion[1]+"ymin"+anRegion[3]+"ymax"+anRegion[4]+
+				// 2147483648.0 );
+				// #endif
+
+				/*
+				 * double aux=0; if (anRegion[0]>anRegion[3]){ aux=anRegion[3];
+				 * anRegion[3]=anRegion[0]; anRegion[0]=anRegion[3]; } if
+				 * (anRegion[1]>anRegion[4]){ aux=anRegion[4];
+				 * anRegion[4]=anRegion[1]; anRegion[1]=anRegion[4]; }
+				 */
+				if (psDGN.got_bounds != FALSE) {
+					psDGN.min_x = Math.min(psDGN.min_x, anRegion[0]);
+					psDGN.min_y = Math.min(psDGN.min_y, anRegion[1]);
+					psDGN.min_z = Math.min(psDGN.min_z, anRegion[2]);
+					psDGN.max_x = Math.max(psDGN.max_x, anRegion[3]);
+					psDGN.max_y = Math.max(psDGN.max_y, anRegion[4]);
+					psDGN.max_z = Math.max(psDGN.max_z, anRegion[5]);
+				} else {
+					psDGN.min_x = anRegion[0];
+					psDGN.min_y = anRegion[1];
+					psDGN.min_z = anRegion[2];
+					psDGN.max_x = anRegion[3];
+					psDGN.max_y = anRegion[4];
+					psDGN.max_z = anRegion[5];
+
+					// memcpy( (psDGN.min_x), anRegion, sizeof(long) * 6 );
+					psDGN.got_bounds = TRUE;
+				}
+
+				// System.out.println("xmin"+anRegion[0]+"xmax"+anRegion[3]+"ymin"+anRegion[1]+"ymax"+anRegion[4]+
+				// "      "+2147483648.0 );
+			}
+
+			psDGN.element_count++;
+
+			// nLastOffset = VSIFTell( psDGN.fp );
+			nLastOffset = bb.position(); // psDGN.ftall;
+		}
+
+		// DGNRewind( psDGN );
+		psDGN.max_element_count = nMaxElements;
+	}
+
+	/**
+	 * Devuelve el rect�ngulo que representa el extent del elemento.
+	 * 
+	 * @param psDGN
+	 *            informaci�n del DGN.
+	 * @param psElement
+	 *            elemento.
+	 * @param psMin
+	 *            punto m�nimo.
+	 * @param psMax
+	 *            punto m�ximo.
+	 * 
+	 * @return Entero para comprobar si se ha calculado correctamente.
+	 */
+	private int DGNGetElementExtents(DGNInfo psDGN, DGNElemCore psElement,
+			DGNPoint psMin, DGNPoint psMax) {
+		// DGNInfo *psDGN = (DGNInfo *) hDGN;
+		long[] anMin = new long[3];
+		long[] anMax = new long[3];
+		DGNInfo tempo = new DGNInfo();
+		double[] bResult;
+
+		/* -------------------------------------------------------------------- */
+		/* Get the extents if we have raw data in the element, or */
+		/* loaded in the file buffer. */
+		/* -------------------------------------------------------------------- */
+		if (psElement.raw_data != null) {
+			bResult = DGNGetRawExtents(psDGN, psElement.raw_data, psElement);
+		} else {
+			if (psElement.element_id == (psDGN.next_element_id - 1)) {
+				bResult = DGNGetRawExtents(psDGN, psDGN.abyElem, psElement);
+			} else {
+				/*
+				 * CPLError(CE_Warning, CPLE_AppDefined,
+				 * "DGNGetElementExtents() fails because the requested element\n"
+				 * " does not have raw data available." );
+				 */
+				return FALSE;
+			}
+		}
+
+		if (bResult == null) {
+			return FALSE;
+		}
+
+		/* -------------------------------------------------------------------- */
+		/* Transform to user coordinate system and return. The offset */
+		/* is to convert from "binary offset" form to twos complement. */
+		/* -------------------------------------------------------------------- */
+		psMin.x = tempo.min_x - 2147483648.0;
+		psMin.y = tempo.min_y - 2147483648.0;
+		psMin.z = tempo.min_z - 2147483648.0;
+
+		psMax.x = tempo.max_x - 2147483648.0;
+		psMax.y = tempo.max_y - 2147483648.0;
+		psMax.z = tempo.max_z - 2147483648.0;
+
+		DGNTransformPoint(psDGN, psMin);
+		DGNTransformPoint(psDGN, psMax);
+
+		return TRUE;
+	}
+
+	/**
+	 * Devuelve los �ndices de los elementos del DGN.
+	 * 
+	 * @param psDGN
+	 *            Informaci�n del DGN.
+	 * @param pnElementCount
+	 *            N�mero de elementos.
+	 * 
+	 * @return �ndices.
+	 */
+	private DGNElementInfo[] DGNGetElementIndex(DGNInfo psDGN,
+			int[] pnElementCount) {
+		// DGNInfo *psDGN = (DGNInfo *) hDGN;
+		DGNBuildIndex(psDGN);
+
+		if (pnElementCount[0] != -1) {
+			pnElementCount[0] = psDGN.element_count;
+		}
+
+		return psDGN.element_index;
+	}
+
+	/************************************************************************/
+	/* DGNLookupColor() */
+	/************************************************************************/
+
+	/**
+	 * Translate color index into RGB values. If no color table has yet been
+	 * encountered in the file a hard-coded "default" color table will be used.
+	 * This seems to be what Microstation uses as a color table when there isn't
+	 * one in a DGN file but I am not absolutely convinced it is appropriate.
+	 * 
+	 * @param color_index
+	 *            the color index to lookup.
+	 * 
+	 * @return TRUE on success or FALSE on failure. May fail if color_index is
+	 *         out of range.
+	 */
+	public Color DGNLookupColor(int color_index) {
+		int r;
+		int g;
+		int b;
+
+		if ((color_index < 0) || (color_index > 255)) {
+			return null;
+		}
+
+		if (info.got_color_table == 0) {
+			r = abyDefaultPCT[color_index][0];
+			g = abyDefaultPCT[color_index][1];
+			b = abyDefaultPCT[color_index][2];
+		} else {
+			r = ByteUtils.getUnsigned(m_colorTable.color_info[color_index][0]);
+			g = ByteUtils.getUnsigned(m_colorTable.color_info[color_index][1]);
+			b = ByteUtils.getUnsigned(m_colorTable.color_info[color_index][2]);
+		}
+		if ((r == 255) && (g == 255) && (b == 255)) {
+			r = g = b = 0; // El color blanco lo devolvemos como negro.
+		}
+
+		return new Color(r, g, b);
+	}
+
+	/************************************************************************/
+	/* DGNGetShapeFillInfo() */
+	/************************************************************************/
+
+	/**
+	 * Fetch fill color for a shape. This method will check for a 0x0041 user
+	 * attribute linkaged with fill color information for the element. If found
+	 * the function returns TRUE, and places the fill color in pnColor,
+	 * otherwise FALSE is returned and pnColor is not updated.
+	 * 
+	 * @param psElem
+	 *            the element.
+	 * 
+	 * @return index of color on success or -1 on failure.
+	 */
+	public int DGNGetShapeFillInfo(DGNElemCore psElem) {
+		int iLink;
+		int color_index = -1;
+
+		for (iLink = 0; true; iLink++) {
+			int[] nLinkType = new int[1];
+			int[] nEntityNum = new int[1];
+			int[] nMSLink = new int[1];
+			int[] nLinkSize = new int[1];
+			int i;
+			nEntityNum[0] = 0;
+			nMSLink[0] = 0;
+
+			byte[] pabyData;
+
+			pabyData = DGNGetLinkage(info, psElem, iLink, nLinkType,
+					nEntityNum, nMSLink, nLinkSize);
+
+			if (pabyData == null) {
+				return -1;
+			}
+
+			if ((nLinkType[0] == DGNFileHeader.DGNLT_SHAPE_FILL)
+					&& (nLinkSize[0] >= 7)) {
+				color_index = ByteUtils.getUnsigned(pabyData[8]);
+
+				break;
+			}
+		}
+
+		return color_index;
+	}
+
+	/************************************************************************/
+	/* DGNGetAssocID() */
+	/************************************************************************/
+
+	/**
+	 * Fetch association id for an element. This method will check if an element
+	 * has an association id, and if so returns it, otherwise returning -1.
+	 * Association ids are kept as a user attribute linkage where present.
+	 * 
+	 * @param psElem
+	 *            the element.
+	 * 
+	 * @return The id or -1 on failure.
+	 */
+	int DGNGetAssocID(DGNElemCore psElem) {
+		int iLink;
+
+		for (iLink = 0; true; iLink++) {
+			int[] nLinkType = new int[1];
+			int[] nEntityNum = new int[1];
+			int[] nMSLink = new int[1];
+			int[] nLinkSize = new int[1];
+			int i;
+			nEntityNum[0] = 0;
+			nMSLink[0] = 0;
+
+			byte[] pabyData;
+
+			pabyData = DGNGetLinkage(info, psElem, iLink, nLinkType,
+					nEntityNum, nMSLink, nLinkSize);
+
+			if (pabyData == null) {
+				return -1;
+			}
+
+			if ((nLinkType[0] == DGNFileHeader.DGNLT_ASSOC_ID)
+					&& (nLinkSize[0] >= 8)) {
+				return ByteUtils.getUnsigned(pabyData[4])
+						+ (ByteUtils.getUnsigned(pabyData[5]) * 256)
+						+ (ByteUtils.getUnsigned(pabyData[6]) * 256 * 256)
+						+ (ByteUtils.getUnsigned(pabyData[7]) * 256 * 256 * 256);
+			}
+		}
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElementInfo.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElementInfo.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElementInfo.java	(revision 38736)
@@ -0,0 +1,66 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo Info.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElementInfo {
+	public int level; /*!< Element Level: 0-63 */
+	public int type; /*!< Element type (DGNT_*) */
+	public int stype; /*!< Structure type (DGNST_*) */
+	public int flags; /*!< Other flags */
+	public long offset; /*!< Offset within file (private) */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElementInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellLibrary.java	(revision 38736)
@@ -0,0 +1,70 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo CellLibrary.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemCellLibrary extends DGNElemCore {
+	//DGNElemCore core;
+	public int celltype; /*!< Cell type. */
+	public int attindx; /*!< Attribute linkage. */
+	public byte[] name = new byte[7]; //7           /*!< Cell name */
+	public int numwords; /*!< Number of words in cell definition */
+	public int dispsymb; /*!< Display symbol */
+	public int cclass; /*!< Class bitmap */
+	public int[] levels = new int[4]; //4         /*!< Levels used in cell */
+	public byte[] description = new byte[28]; //28   /*!< Description */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemMultiPoint.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemMultiPoint.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemMultiPoint.java	(revision 38736)
@@ -0,0 +1,66 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo MultiPoint.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemMultiPoint extends DGNElemCore {
+	//DGNElemCore 	core=new DGNElemCore();
+	public int num_vertices; /*!< Number of vertices in "vertices" */
+	public DGNPoint[] vertices;
+
+	//=new DGNPoint[2];//2   /*!< Array of two or more vertices */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemMultiPoint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemArc.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemArc.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemArc.java	(revision 38736)
@@ -0,0 +1,75 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo Arc.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemArc extends DGNElemCore {
+	//DGNElemCore 	core=new DGNElemCore();
+	public DGNPoint origin = new DGNPoint(); /*!< Origin of ellipse */
+	public double primary_axis;
+
+	//=new double[4];	/*!< Primary axis length */
+	public double secondary_axis;
+
+	//=new double[4]; /*!< Secondary axis length */
+	public double rotation; /*!< Counterclockwise rotation in degrees */
+	public double[] quat = new double[4]; //4
+	public double startang;
+
+	/*!< Start angle (degrees counterclockwise of primary axis) */
+	public double sweepang; /*!< Sweep angle (degrees) */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemArc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTCB.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTCB.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTCB.java	(revision 38736)
@@ -0,0 +1,75 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo TCB.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemTCB extends DGNElemCore {
+	//DGNElemCore core=new DGNElemCore();
+	public int dimension; /*!< Dimension (2 or 3) */
+	public double origin_x; /*!< X origin of UOR space in master units(?)*/
+	public double origin_y; /*!< Y origin of UOR space in master units(?)*/
+	public double origin_z; /*!< Z origin of UOR space in master units(?)*/
+	public double uor_per_subunit; /*!< UOR per subunit. */
+	public char[] sub_units = new char[3];
+
+	//3      /*!< User name for subunits (2 chars)*/
+	public double subunits_per_master; /*!< Subunits per master unit. */
+	public char[] master_units = new char[3];
+
+	//3   /*!< User name for master units (2 chars)*/
+	public DGNViewInfo[] views = new DGNViewInfo[8]; //8
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTCB.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagValue.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagValue.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagValue.java	(revision 38736)
@@ -0,0 +1,67 @@
+/*
+ * Created on 21-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo TagValue.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemTagValue extends DGNElemCore {
+	//DGNElemCore core=new DGNElemCore();
+	public int tagType; /*!< Tag type indicator, DGNTT_* */
+	public int tagSet; /*!< Which tag set does this relate to? */
+	public int tagIndex; /*!< Tag index within tag set. */
+	public int tagLength; /*!< Length of tag information (text) */
+	public tagValueUnion tagValue = new tagValueUnion();
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagValue.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemComplexHeader.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemComplexHeader.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemComplexHeader.java	(revision 38736)
@@ -0,0 +1,64 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo ComplexHeader.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemComplexHeader extends DGNElemCore {
+	//DGNElemCore core=new DGNElemCore();
+	public int totlength; /*!< Total length of surface */
+	public int numelems; /*!< # of elements in surface */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemComplexHeader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNViewInfo.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNViewInfo.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNViewInfo.java	(revision 38736)
@@ -0,0 +1,68 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Informaci�n sobre la vista.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNViewInfo {
+	public int flags;
+	public short[] levels = new short[8]; //8
+	public DGNPoint origin = new DGNPoint();
+	public DGNPoint delta = new DGNPoint();
+	public double[] transmatrx = new double[9]; //9
+	public double conversion;
+	public double activez;
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNViewInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemText.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemText.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemText.java	(revision 38736)
@@ -0,0 +1,73 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo Text.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemText extends DGNElemCore {
+	//DGNElemCore core;
+	public int font_id; /*!< Microstation font id, no list available*/
+	public int justification; /*!< Justification, see DGNJ_* */
+	public double length_mult; /*!< Char width in master (if square) */
+	public double height_mult; /*!< Char height in master units */
+	public double rotation; /*!< Counterclockwise rotation in degrees */
+	public DGNPoint origin = new DGNPoint();
+
+	/*!< Bottom left corner of text. */
+	public String string;
+
+	/*!< Actual text (length varies, \0 terminated*/
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemText.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/tagValueUnion.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/tagValueUnion.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/tagValueUnion.java	(revision 38736)
@@ -0,0 +1,64 @@
+/*
+ * Created on 21-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Uni�n del valor del tag.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class tagValueUnion {
+	public char[] string;
+	public long integer;
+	public double real;
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/tagValueUnion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNFileHeader.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNFileHeader.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNFileHeader.java	(revision 38736)
@@ -0,0 +1,446 @@
+/*
+ * Created on 16-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+import java.nio.MappedByteBuffer;
+
+
+/**
+ * Clase Header del DGN.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNFileHeader {
+	/** DGNElemCore style: Element uses DGNElemCore structure */
+	public static final int DGNST_CORE = 1;
+
+	/** DGNElemCore style: Element uses DGNElemMultiPoint structure */
+	public static final int DGNST_MULTIPOINT = 2;
+
+	/** DGNElemCore style: Element uses DGNElemColorTable structure */
+	public static final int DGNST_COLORTABLE = 3;
+
+	/** DGNElemCore style: Element uses DGNElemTCB structure */
+	public static final int DGNST_TCB = 4;
+
+	/** DGNElemCore style: Element uses DGNElemArc structure */
+	public static final int DGNST_ARC = 5;
+
+	/** DGNElemCore style: Element uses DGNElemText structure */
+	public static final int DGNST_TEXT = 6;
+
+	/** DGNElemCore style: Element uses DGNElemComplexHeader structure */
+	public static final int DGNST_COMPLEX_HEADER = 7;
+
+	/** DGNElemCore style: Element uses DGNElemCellHeader structure */
+	public static final int DGNST_CELL_HEADER = 8;
+
+	/** DGNElemCore style: Element uses DGNElemTagValue structure */
+	public static final int DGNST_TAG_VALUE = 9;
+
+	/** DGNElemCore style: Element uses DGNElemTagSet structure */
+	public static final int DGNST_TAG_SET = 10;
+
+	/** DGNElemCore style: Element uses DGNElemCellLibrary structure */
+	public static final int DGNST_CELL_LIBRARY = 11;
+
+	/** DGNElemCore style: Element uses DGNElemGroup structure */
+	public static final int DGNST_GROUP_DATA = 12;
+	public static final int DGNST_SHARED_CELL_DEFN = 13;
+
+	/* -------------------------------------------------------------------- */
+	/*      Element types                                                   */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNT_NULL = 0;
+	public static final int DGNT_CELL_LIBRARY = 1;
+	public static final int DGNT_CELL_HEADER = 2;
+	public static final int DGNT_LINE = 3;
+	public static final int DGNT_LINE_STRING = 4;
+	public static final int DGNT_GROUP_DATA = 5;
+	public static final int DGNT_SHAPE = 6;
+	public static final int DGNT_TEXT_NODE = 7;
+	public static final int DGNT_DIGITIZER_SETUP = 8;
+	public static final int DGNT_TCB = 9;
+	public static final int DGNT_LEVEL_SYMBOLOGY = 10;
+	public static final int DGNT_CURVE = 11;
+	public static final int DGNT_COMPLEX_CHAIN_HEADER = 12;
+	public static final int DGNT_COMPLEX_SHAPE_HEADER = 14;
+	public static final int DGNT_ELLIPSE = 15;
+	public static final int DGNT_ARC = 16;
+	public static final int DGNT_TEXT = 17;
+	public static final int DGNT_BSPLINE = 21;
+	public static final int DGNT_SHARED_CELL_DEFN = 34;
+	public static final int DGNT_SHARED_CELL_ELEM = 35; // REVISAR
+	public static final int DGNT_TAG_VALUE = 37;
+	public static final int DGNT_APPLICATION_ELEM = 66;
+
+	/* -------------------------------------------------------------------- */
+	/*      Line Styles                                                     */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNS_SOLID = 0;
+	public static final int DGNS_DOTTED = 1;
+	public static final int DGNS_MEDIUM_DASH = 2;
+	public static final int DGNS_LONG_DASH = 3;
+	public static final int DGNS_DOT_DASH = 4;
+	public static final int DGNS_SHORT_DASH = 5;
+	public static final int DGNS_DASH_DOUBLE_DOT = 6;
+	public static final int DGNS_LONG_DASH_SHORT_DASH = 7;
+
+	/* -------------------------------------------------------------------- */
+	/*      Class                                                           */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNC_PRIMARY = 0;
+	public static final int DGNC_PATTERN_COMPONENT = 1;
+	public static final int DGNC_CONSTRUCTION_ELEMENT = 2;
+	public static final int DGNC_DIMENSION_ELEMENT = 3;
+	public static final int DGNC_PRIMARY_RULE_ELEMENT = 4;
+	public static final int DGNC_LINEAR_PATTERNED_ELEMENT = 5;
+	public static final int DGNC_CONSTRUCTION_RULE_ELEMENT = 6;
+
+	/* -------------------------------------------------------------------- */
+	/*      Group Data level numbers.                                       */
+	/*                                                                      */
+	/*      These are symbolic values for the typ 5 (DGNT_GROUP_DATA)       */
+	/*      level values that have special meanings.                        */
+	/* -------------------------------------------------------------------- */
+	public static final int DGN_GDL_COLOR_TABLE = 1;
+	public static final int DGN_GDL_NAMED_VIEW = 3;
+	public static final int DGN_GDL_REF_FILE = 9;
+
+	/* -------------------------------------------------------------------- */
+	/*      Word 17 property flags.                                         */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNPF_HOLE = 0x8000;
+	public static final int DGNPF_SNAPPABLE = 0x4000;
+	public static final int DGNPF_PLANAR = 0x2000;
+	public static final int DGNPF_ORIENTATION = 0x1000;
+	public static final int DGNPF_ATTRIBUTES = 0x0800;
+	public static final int DGNPF_MODIFIED = 0x0400;
+	public static final int DGNPF_NEW = 0x0200;
+	public static final int DGNPF_LOCKED = 0x0100;
+	public static final int DGNPF_CLASS = 0x000f;
+
+	/* -------------------------------------------------------------------- */
+	/*      DGNElementInfo flag values.                                     */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNEIF_DELETED = 0x01;
+	public static final int DGNEIF_COMPLEX = 0x02;
+
+	/* -------------------------------------------------------------------- */
+	/*      Justifications                                                  */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNJ_LEFT_TOP = 0;
+	public static final int DGNJ_LEFT_CENTER = 1;
+	public static final int DGNJ_LEFT_BOTTOM = 2;
+	public static final int DGNJ_LEFTMARGIN_TOP = 3;
+
+	/* text node header only */
+	public static final int DGNJ_LEFTMARGIN_CENTER = 4;
+
+	/* text node header only */
+	public static final int DGNJ_LEFTMARGIN_BOTTOM = 5;
+
+	/* text node header only */
+	public static final int DGNJ_CENTER_TOP = 6;
+	public static final int DGNJ_CENTER_CENTER = 6;
+	public static final int DGNJ_CENTER_BOTTOM = 8;
+	public static final int DGNJ_RIGHTMARGIN_TOP = 9;
+
+	/* text node header only */
+	public static final int DGNJ_RIGHTMARGIN_CENTER = 10;
+
+	/* text node header only */
+	public static final int DGNJ_RIGHTMARGIN_BOTTOM = 11;
+
+	/* text node header only */
+	public static final int DGNJ_RIGHT_TOP = 12;
+	public static final int DGNJ_RIGHT_CENTER = 13;
+	public static final int DGNJ_RIGHT_BOTTOM = 14;
+
+	/* -------------------------------------------------------------------- */
+	/*      DGN file reading options.                                       */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNO_CAPTURE_RAW_DATA = 0x01;
+
+	/* -------------------------------------------------------------------- */
+	/*      Known attribute linkage types, including my synthetic ones.     */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNLT_DMRS = 0x0000;
+	public static final int DGNLT_INFORMIX = 0x3848;
+	public static final int DGNLT_ODBC = 0x5e62;
+	public static final int DGNLT_ORACLE = 0x6091;
+	public static final int DGNLT_RIS = 0x71FB;
+	public static final int DGNLT_SYBASE = 0x4f58;
+	public static final int DGNLT_XBASE = 0x1971;
+	public static final int DGNLT_SHAPE_FILL = 0x0041;
+	public static final int DGNLT_ASSOC_ID = 0x7D2F;
+
+	/* -------------------------------------------------------------------- */
+	/*      File creation options.                                          */
+	/* -------------------------------------------------------------------- */
+	public static final int DGNCF_USE_SEED_UNITS = 0x01;
+	public static final int DGNCF_USE_SEED_ORIGIN = 0x02;
+	public static final int DGNCF_COPY_SEED_FILE_COLOR_TABLE = 0x04;
+	public static final int DGNCF_COPY_WHOLE_SEED_FILE = 0x08;
+	public static final int SIZE_LONG = 4;
+
+	/*
+	   int         offset;
+	   int         size;
+	   int         element_id;
+	   int         stype;
+	   int                level;
+	   int                type;
+	   int                complex;
+	   int                deleted;
+	   int                graphic_group;
+	   int                properties;
+	   int         color;
+	   int         weight;
+	   int         style;
+	   int                attr_bytes;
+	   byte attr_data;
+	   int         raw_bytes;
+	   byte raw_data;
+	   //} DGNElemCore;
+	 */
+
+	/** File Length; */
+	int myFileLength = 0;
+
+	/** Version of the file. */
+	int myVersion = 1000;
+
+	/*
+	   public static final int SHAPE_NULL = 0;
+	    public static final int SHAPE_POINT = 1;
+	    public static final int SHAPE_POLYLINE = 3;
+	    public static final int SHAPE_POLYGON = 5;
+	    public static final int SHAPE_MULTIPOINT = 8;
+	    public static final int SHAPE_POINTZ = 11;
+	    public static final int SHAPE_POLYLINEZ = 13;
+	    public static final int SHAPE_POLYGONZ = 15;
+	    public static final int SHAPE_MULTIPOINTZ = 18;
+	    public static final int SHAPE_POINTM = 21;
+	    public static final int SHAPE_POLYLINEM = 23;
+	    public static final int SHAPE_POLYGONM = 25;
+	    public static final int SHAPE_MULTIPOINTM = 28;
+	    public static final int SHAPE_MULTIPATCH = 31;
+	 */
+	int myDGNType = 0;
+	double myXmin = 0;
+	double myYmin = 0;
+	double myXmax = 0;
+	double myYmax = 0;
+	double myZmin = 0;
+	double myZmax = 0;
+	double myMmin = 0;
+	double myMmax = 0;
+
+	// notify about warnings.
+	private boolean myWarning = true;
+
+	/**
+	 * ShapeFileHeader constructor comment.
+	 */
+	public DGNFileHeader() {
+		super();
+	}
+
+	/**
+	 * Return the version of the file.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getVersion() {
+		return myVersion;
+	}
+
+	/**
+	 * Devuelve el rect�ngulo del fichero.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public java.awt.geom.Rectangle2D.Double getFileExtents() {
+		return new java.awt.geom.Rectangle2D.Double(myXmin, myYmin,
+			myXmax - myXmin, myYmax - myYmin);
+	}
+
+	/**
+	 * Print warnings to system.out.
+	 *
+	 * @param inWarning DOCUMENT ME!
+	 */
+	public void setWarnings(boolean inWarning) {
+		myWarning = inWarning;
+	}
+
+	/**
+	 * Return the length of the header in 16 bit words..
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getHeaderLength() {
+		return 50;
+	}
+
+	/**
+	 * Return the number of 16 bit words in the shape file as recorded in the
+	 * header
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public int getFileLength() {
+		return myFileLength;
+	}
+
+	/**
+	 * Read the header from the shape file.
+	 *
+	 * @param in DOCUMENT ME!
+	 */
+	public void readHeader(MappedByteBuffer in) {
+		//in.order(ByteOrder.BIG_ENDIAN);
+
+		/*
+		   offset=in.getInt();
+		   System.out.println("offset     "+offset);
+		   size=in.getInt();
+		   System.out.println("size        "+size);
+		                   element_id=in.getInt();
+		   System.out.println("element_id          "+element_id);
+		                   stype=in.getInt();
+		   System.out.println("stype        "+stype);
+		                   level=in.getInt();
+		   System.out.println("level          "+level);
+		                   type=in.getInt();
+		   System.out.println("type          "+type);
+		                   complex=in.getInt();
+		   System.out.println("complex          "+complex);
+		                   deleted=in.getInt();
+		   System.out.println("deleted          "+deleted);
+		                   graphic_group=in.getInt();
+		   System.out.println("graphic_group          "+graphic_group);
+		                   properties=in.getInt();
+		   System.out.println("properties          "+properties);
+		                   color=in.getInt();
+		   System.out.println("color          "+color);
+		                   weight=in.getInt();
+		   System.out.println("weight          "+weight);
+		                   style=in.getInt();
+		   System.out.println("style          "+style);
+		                   attr_bytes=in.getInt();
+		   System.out.println("attr_bytes          "+attr_bytes);
+		                   //attr_data=in.get(attr_bytes);
+		   //System.out.println("attr_data          "+attr_data);
+		                   raw_bytes=in.getInt();
+		   System.out.println("raw_bytes          "+raw_bytes);
+		                   //raw_data=in.get(raw_bytes);
+		   //System.out.println("raw_data          "+raw_data);
+		 */
+
+		// the first four bytes are integers
+		// in.setLittleEndianMode(false);
+
+		/*  in.order(ByteOrder.BIG_ENDIAN);
+		   myFileCode = in.getInt();
+		   if (myFileCode != 9994) warn("File Code = "+myFileCode+" Not equal to 9994");
+		   // From 4 to 8 are unused.
+		   myUnused1 = in.getInt();
+		   // From 8 to 12 are unused.
+		   myUnused2 = in.getInt();
+		   // From 12 to 16 are unused.
+		   myUnused3 = in.getInt();
+		   // From 16 to 20 are unused.
+		   myUnused4 = in.getInt();
+		   // From 20 to 24 are unused.
+		   myUnused5 = in.getInt();
+		   // From 24 to 28 are the file length.
+		   myFileLength = in.getInt();
+		   // From 28 to 32 are the File Version.
+		   in.order(ByteOrder.LITTLE_ENDIAN);
+		   myVersion = in.getInt();
+		   // From 32 to 36 are the Shape Type.
+		   myShapeType = in.getInt();
+		   // From 36 to 44 are Xmin.
+		   myXmin = in.getDouble(); // Double.longBitsToDouble(in.getLong());
+		   // From 44 to 52 are Ymin.
+		   myYmin = in.getDouble();
+		   // From 52 to 60 are Xmax.
+		   myXmax = in.getDouble();
+		   // From 60 to 68 are Ymax.
+		   myYmax = in.getDouble();
+		   // From 68 to 76 are Zmin.
+		   myZmin = in.getDouble();
+		   // From 76 to 84 are Zmax.
+		   myZmax = in.getDouble();
+		   // From 84 to 92 are Mmin.
+		   myMmin = in.getDouble();
+		   // From 92 to 100 are Mmax.
+		   myMmax = in.getDouble();
+		   // that is all 100 bytes of the header.
+		 */
+	}
+
+	/**
+	 * Muestra por consola el warning.
+	 *
+	 * @param inWarn DOCUMENT ME!
+	 */
+	private void warn(String inWarn) {
+		if (myWarning) {
+			System.out.print("WARNING: ");
+			System.out.println(inWarn);
+		}
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNFileHeader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNPoint.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNPoint.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNPoint.java	(revision 38736)
@@ -0,0 +1,64 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Punto 3D.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNPoint {
+	public double x; /*!< X (normally eastwards) coordinate. */
+	public double y; /*!< y (normally northwards) coordinate. */
+	public double z; /*!< z, up coordinate.  Zero for 2D objects. */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNPoint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemColorTable.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemColorTable.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemColorTable.java	(revision 38736)
@@ -0,0 +1,66 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo ColorTable.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemColorTable extends DGNElemCore {
+	//DGNElemCore 	core=new DGNElemCore();
+	public int screen_flag;
+	public byte[][] color_info = new byte[256][3];
+
+	//256 3 /*!< Color table, 256 colors by red (0), green(1) and blue(2) component. */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemColorTable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNTagDef.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNTagDef.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNTagDef.java	(revision 38736)
@@ -0,0 +1,68 @@
+/*
+ * Created on 22-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Definici�n de Tag.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNTagDef {
+	public char[] name; /*!< Name of this tag. */
+	public int id; /*!< Tag index/identifier. */
+	public char[] prompt; /*!< User prompt when requesting value. */
+	public int type;
+
+	/*!< Tag type (one of DGNTT_STRING(1), DGNTT_INTEGER(3) or DGNTT_FLOAT(4). */
+	public tagValueUnion defaultValue; /*!< Default tag value */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNTagDef.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagSet.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagSet.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagSet.java	(revision 38736)
@@ -0,0 +1,67 @@
+/*
+ * Created on 22-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo TagSet.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemTagSet extends DGNElemCore {
+	//DGNElemCore core=new DGNElemCore();
+	public int tagCount; /*!< Number of tags in tagList. */
+	public int tagSet; /*!< Tag set index. */
+	public int flags; /*!< Tag flags - not too much known. */
+	public char[] tagSetName;
+	public DGNTagDef[] tagList; /*!< List of tag definitions in this set. */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemTagSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNInfo.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNInfo.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNInfo.java	(revision 38736)
@@ -0,0 +1,100 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase que almacena informaci�n del elemento.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNInfo {
+	public String fp;
+	public int ftall;
+	public int next_element_id;
+	public int nElemBytes;
+	public byte[] abyElem = new byte[131076]; //131076
+
+	//byte[] temporal=new byte[4];
+	public int got_tcb;
+	public int dimension;
+	public int options;
+	public double scale;
+	public double origin_x;
+	public double origin_y;
+	public double origin_z;
+	public int index_built;
+	public int element_count;
+	public int max_element_count;
+	public DGNElementInfo[] element_index;
+	public int got_color_table;
+	public byte[][] color_table = new byte[256][3]; //256 3
+	public int got_bounds;
+	public double min_x;
+	public double min_y;
+	public double min_z;
+	public double max_x;
+	public double max_y;
+	public double max_z;
+	public int has_spatial_filter;
+	public int sf_converted_to_uor;
+	public int select_complex_group;
+	public int in_complex_group;
+	public long sf_min_x;
+	public long sf_min_y;
+	public long sf_max_x;
+	public long sf_max_y;
+	public double sf_min_x_geo;
+	public double sf_min_y_geo;
+	public double sf_max_x_geo;
+	public double sf_max_y_geo;
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCore.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCore.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCore.java	(revision 38736)
@@ -0,0 +1,79 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo Base del cual extienden los
+ * dem�s tipos.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemCore {
+	public int offset;
+	public int size;
+	public int element_id; /*!< Element number (zero based) */
+	public int stype; /*!< Structure type: (DGNST_*) */
+	public int level; /*!< Element Level: 0-63 */
+	public int type; /*!< Element type (DGNT_) */
+	public int complex; /*!< Is element complex? */
+	public int deleted; /*!< Is element deleted? */
+	public int graphic_group; /*!< Graphic group number */
+	public int properties; /*!< Properties: ORing of DGNPF_ flags */
+	public int color; /*!< Color index (0-255) */
+	public int weight; /*!< Line Weight (0-31) */
+	public int style; /*!< Line Style: One of DGNS_* values */
+	public int attr_bytes; /*!< Bytes of attribute data, usually zero. */
+	public byte[] attr_data; /*!< Raw attribute data */
+	public int raw_bytes; /*!< Bytes of raw data, usually zero. */
+	public byte[] raw_data; /*!< All raw element data including header. */
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellHeader.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellHeader.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellHeader.java	(revision 38736)
@@ -0,0 +1,75 @@
+/*
+ * Created on 17-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * Clase utilizada para guardar un elemento de tipo CellHeader.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DGNElemCellHeader extends DGNElemCore {
+	//DGNElemCore core;
+	public int totlength; /*!< Total length of cell */
+	public byte[] name = new byte[7]; //7           /*!< Cell name */
+	public int cclass; /*!< Class bitmap */
+	public int[] levels = new int[4]; //4         /*!< Levels used in cell */
+	public DGNPoint rnglow = new DGNPoint(); /*!< X/Y/Z minimums for cell */
+	public DGNPoint rnghigh = new DGNPoint(); /*!< X/Y/Z minimums for cell */
+	public double[] trans = new double[9];
+
+	//9          /*!< 2D/3D Transformation Matrix */
+	public DGNPoint origin = new DGNPoint(); /*!< Cell Origin */
+	public double xscale;
+	public double yscale;
+	public double rotation;
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/DGNElemCellHeader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/ByteUtils.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/ByteUtils.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/ByteUtils.java	(revision 38736)
@@ -0,0 +1,771 @@
+/*
+ * Created on 21-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+import java.math.BigInteger;
+
+
+/**
+ * Clase que engloba m�todos para trabajar con bytes.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ByteUtils {
+	public static final int SIZE_BOOL = 1;
+	public static final int SIZE_SHORT = 2;
+	public static final int SIZE_INT = 4;
+	public static final int SIZE_LONG = 8;
+	public static final int SIZE_DOUBLE = 8;
+
+	/** A nibble->char mapping for printing out bytes. */
+	public static final char[] digits = {
+			'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
+			'e', 'f'
+		};
+
+	/**
+	 * Return the <code>int</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes read.
+	 *
+	 * @return the value of the <code>int</code> decoded
+	 */
+	public static final int bytesToInt(byte[] data, int[] offset) {
+		/**
+		 * TODO: We use network-order within OceanStore, but temporarily
+		 * supporting intel-order to work with some JNI code until JNI code is
+		 * set to interoperate with network-order.
+		 */
+		int result = 0;
+
+		for (int i = 0; i < SIZE_INT; ++i) {
+			result <<= 8;
+			result |= byteToUnsignedInt(data[offset[0]++]);
+		}
+
+		return result;
+	}
+
+	/**
+	 * Write the bytes representing <code>i</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param i the <code>int</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void intToBytes(int i, byte[] data, int[] offset) {
+		/**
+		 * TODO: We use network-order within OceanStore, but temporarily
+		 * supporting intel-order to work with some JNI code until JNI code is
+		 * set to interoperate with network-order.
+		 */
+		if (data != null) {
+			for (int j = (offset[0] + SIZE_INT) - 1; j >= offset[0]; --j) {
+				data[j] = (byte) i;
+				i >>= 8;
+			}
+		}
+
+		offset[0] += SIZE_INT;
+	}
+
+	/**
+	 * Return the <code>short</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes read.
+	 *
+	 * @return the value of the <code>short</code> decoded
+	 */
+	public static final short bytesToShort(byte[] data, int[] offset) {
+		/**
+		 * TODO: We use network-order within OceanStore, but temporarily
+		 * supporting intel-order to work with some JNI code until JNI code is
+		 * set to interoperate with network-order.
+		 */
+		short result = 0;
+
+		for (int i = 0; i < SIZE_SHORT; ++i) {
+			result <<= 8;
+			result |= (short) byteToUnsignedInt(data[offset[0]++]);
+		}
+
+		return result;
+	}
+
+	/**
+	 * Write the bytes representing <code>s</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param s the <code>short</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void shortToBytes(short s, byte[] data, int[] offset) {
+		/**
+		 * TODO: We use network-order within OceanStore, but temporarily
+		 * supporting intel-order to work with some JNI code until JNI code is
+		 * set to interoperate with network-order.
+		 */
+		if (data != null) {
+			data[offset[0] + 1] = (byte) s;
+			data[offset[0]] = (byte) (s >> 8);
+		}
+
+		offset[0] += SIZE_SHORT;
+	}
+
+	/**
+	 * Return the <code>long</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on  function entry, and which
+	 * 		  on function exit has been incremented by the number of bytes
+	 * 		  read.
+	 *
+	 * @return the value of the <code>long</code> decoded
+	 */
+	public static final long bytesToLong(byte[] data, int[] offset) {
+		long result = 0;
+
+		for (int i = 0; i < SIZE_LONG; ++i) {
+			result <<= 8;
+
+			int res = byteToUnsignedInt(data[offset[0]++]);
+			result = result | res;
+		}
+
+		return result;
+	}
+
+	/**
+	 * Write the bytes representing <code>l</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param l the <code>long</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void longToBytes(long l, byte[] data, int[] offset) {
+		/**
+		 * TODO: We use network-order within OceanStore, but temporarily
+		 * supporting intel-order to work with some JNI code until JNI code is
+		 * set to interoperate with network-order.
+		 */
+		if (data != null) {
+			for (int j = (offset[0] + SIZE_LONG) - 1; j >= offset[0]; --j) {
+				data[j] = (byte) l;
+				l >>= 8;
+			}
+		}
+
+		offset[0] += SIZE_LONG;
+	}
+
+	/**
+	 * Return the <code>double</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on  function entry, and which
+	 * 		  on function exit has been incremented by the number of bytes
+	 * 		  read.
+	 *
+	 * @return the value of the <code>double</code> decoded
+	 */
+	public static final double bytesToDouble(byte[] data, int[] offset) {
+		long bits = bytesToLong(data, offset);
+
+		return Double.longBitsToDouble(bits);
+	}
+
+	/**
+	 * Write the bytes representing <code>d</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param d the <code>double</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void doubleToBytes(double d, byte[] data, int[] offset) {
+		long bits = Double.doubleToLongBits(d);
+		longToBytes(bits, data, offset);
+	}
+
+	/**
+	 * Return the <code>String</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>. This method
+	 * relies on the user using the corresponding <code>stringToBytes</code>
+	 * method to encode the <code>String</code>, so that it may properly
+	 * retrieve the <code>String</code> length.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes read.
+	 *
+	 * @return the value of the <code>String</code> decoded
+	 */
+	public static final String bytesToString(byte[] data, int[] offset) {
+		offset[0] = 0;
+
+		int length = bytesToInt(data, offset);
+		String st = null;
+
+		if ((length < 0) || (length > data.length)) {
+			st = new String(data);
+		} else {
+			st = new String(data, offset[0], length);
+		}
+
+		offset[0] += length;
+
+		return st;
+	}
+
+	/**
+	 * Write the bytes representing <code>s</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param s the <code>String</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void stringToBytes(String s, byte[] data, int[] offset) {
+		byte[] s_bytes = s.getBytes();
+
+		if (data != null) {
+			intToBytes(s_bytes.length, data, offset);
+			memcpy(data, offset[0], s_bytes, 0, s_bytes.length);
+		} else {
+			offset[0] += SIZE_INT;
+		}
+
+		offset[0] += s_bytes.length;
+	}
+
+	/**
+	 * Return the <code>boolean</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on  function entry, and which
+	 * 		  on function exit has been incremented by the number of bytes
+	 * 		  read.
+	 *
+	 * @return the value of the <code>boolean</code> decoded
+	 */
+	public static final boolean bytesToBool(byte[] data, int[] offset) {
+		boolean result = true;
+
+		if (data[offset[0]] == 0) {
+			result = false;
+		}
+
+		offset[0] += SIZE_BOOL;
+
+		return result;
+	}
+
+	/**
+	 * Write the bytes representing <code>b</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param b the <code>boolean</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void boolToBytes(boolean b, byte[] data, int[] offset) {
+		if (data != null) {
+			data[offset[0]] = (byte) (b ? 1 : 0);
+		}
+
+		offset[0] += SIZE_BOOL;
+	}
+
+	/**
+	 * Return the <code>BigInteger</code> represented by the bytes in
+	 * <code>data</code> staring at offset <code>offset[0]</code>.
+	 *
+	 * @param data the array from which to read
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data from which to begin reading on  function entry, and which
+	 * 		  on function exit has been incremented by the number of bytes
+	 * 		  read.
+	 *
+	 * @return the <code>BigInteger</code> decoded
+	 */
+	public static final BigInteger bytesToBigInteger(byte[] data, int[] offset) {
+		int length = bytesToInt(data, offset);
+		byte[] bytes = new byte[length];
+		offset[0] += memcpy(bytes, 0, data, offset[0], length);
+
+		return new BigInteger(bytes);
+	}
+
+	/**
+	 * Write the bytes representing <code>n</code> into the byte array
+	 * <code>data</code>, starting at index <code>offset [0]</code>, and
+	 * increment <code>offset [0]</code> by the number of bytes written; if
+	 * <code>data == null</code>, increment <code>offset [0]</code> by the
+	 * number of bytes that would have been written otherwise.
+	 *
+	 * @param n the <code>BigInteger</code> to encode
+	 * @param data The byte array to store into, or <code>null</code>.
+	 * @param offset A single element array whose first element is the index in
+	 * 		  data to begin writing at on function entry, and which on
+	 * 		  function exit has been incremented by the number of bytes
+	 * 		  written.
+	 */
+	public static final void bigIntegerToBytes(BigInteger n, byte[] data,
+		int[] offset) {
+		byte[] bytes = n.toByteArray();
+		intToBytes(bytes.length, data, offset);
+		offset[0] += memcpy(data, offset[0], bytes, 0, bytes.length);
+	}
+
+	/**
+	 * Convert an array of <code>bytes</code>s into an array of
+	 * <code>ints</code>.
+	 *
+	 * @param dst the array to write
+	 * @param dst_offset the start offset in <code>dst</code>, times 4. This
+	 * 		  measures the offset as if <code>dst</code> were an array of
+	 * 		  <code>byte</code>s (rather than <code>int</code>s).
+	 * @param src the array to read
+	 * @param src_offset the start offset in <code>src</code>
+	 * @param length the number of <code>byte</code>s to copy.
+	 */
+	public static final void bytesToInts(int[] dst, int dst_offset, byte[] src,
+		int src_offset, int length) {
+		if ((src == null) || (dst == null) ||
+				((src_offset + length) > src.length) ||
+				((dst_offset + length) > (dst.length * 4)) ||
+				((dst_offset % 4) != 0) || ((length % 4) != 0)) {
+			croak("bytesToInts parameters are invalid" + " src==" + src +
+				" dst==" + dst +
+				(((src == null) || (dst == null)) ? " "
+												  : (" (src_offset+length)>src.length==" +
+				(src_offset + length) + ">" + src.length +
+				" (dst_offset+length)>(dst.length*4)==" +
+				(dst_offset + length) + ">" + (dst.length * 4) +
+				" (dst_offset%4)==" + (dst_offset % 4) + " (length%4)==" +
+				(length % 4) + " dest.length==" + dst.length + " length==" +
+				length)));
+		}
+
+		// Convert parameters to normal format
+		int[] offset = new int[1];
+		offset[0] = src_offset;
+
+		int int_dst_offset = dst_offset / 4;
+
+		for (int i = 0; i < (length / 4); ++i) {
+			dst[int_dst_offset++] = bytesToInt(src, offset);
+		}
+	}
+
+	/**
+	 * Convert an array of <code>int</code>s into an array of
+	 * <code>bytes</code>.
+	 *
+	 * @param dst the array to write
+	 * @param dst_offset the start offset in <code>dst</code>
+	 * @param src the array to read
+	 * @param src_offset the start offset in <code>src</code>, times 4. This
+	 * 		  measures the offset as if <code>src</code> were an array of
+	 * 		  <code>byte</code>s (rather than <code>int</code>s).
+	 * @param length the number of <code>byte</code>s to copy.
+	 */
+	public static final void intsToBytes(byte[] dst, int dst_offset, int[] src,
+		int src_offset, int length) {
+		if ((src == null) || (dst == null) ||
+				((dst_offset + length) > dst.length) ||
+				((src_offset + length) > (src.length * 4)) ||
+				((src_offset % 4) != 0) || ((length % 4) != 0)) {
+			croak("intsToBytes parameters are invalid:" + " src=" + src +
+				" dst=" + dst + " (dst_offset=" + dst_offset + " + length=" +
+				length + ")=" + (dst_offset + length) + " > dst.length=" +
+				((dst == null) ? 0 : dst.length) + " (src_offset=" +
+				src_offset + " + length=" + length + ")=" +
+				(src_offset + length) + " > (src.length=" +
+				((src == null) ? 0 : src.length) + "*4)=" +
+				((src == null) ? 0 : (src.length * 4)) + " (src_offset=" +
+				src_offset + " % 4)=" + (src_offset % 4) + " != 0" +
+				" (length=" + length + " % 4)=" + (length % 4) + " != 0");
+		}
+
+		// Convert parameters to normal format
+		int[] offset = new int[1];
+		offset[0] = dst_offset;
+
+		int int_src_offset = src_offset / 4;
+
+		for (int i = 0; i < (length / 4); ++i) {
+			intToBytes(src[int_src_offset++], dst, offset);
+		}
+	}
+
+	/**
+	 * Convert a <code>byte</code> into an unsigned integer.
+	 *
+	 * @param b the <code>byte</code> to cast
+	 *
+	 * @return a postiive <code>int</code> whose lowest byte contains the bits
+	 * 		   of <code>b</code>.
+	 */
+	public static final int byteToUnsignedInt(byte b) {
+		return (b) & 0xff;
+	}
+
+	/**
+	 * Copy contents of one array of <code>bytes</code> into another. If either
+	 * array is <code>null</code>, simply return the <code>length</code>
+	 * parameter directly.
+	 *
+	 * @param dst the array to write, or <code>null</code>
+	 * @param dst_offset the start offset in <code>dst</code>
+	 * @param src the array to read, or <code>null</code>
+	 * @param src_offset the start offset in <code>src</code>
+	 * @param length the number of <code>byte</code>s to copy.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static int memcpy(byte[] dst, int dst_offset, byte[] src,
+		int src_offset, int length) {
+		if ((dst != null) && (src != null)) {
+			if (dst.length < (dst_offset + length)) {
+				croak("dst.length = " + dst.length + ", but " +
+					"dst_offset = " + dst_offset + " and length = " + length +
+					".");
+			}
+
+			if (src.length < (src_offset + length)) {
+				croak("src.length = " + src.length + ", but " +
+					"src_offset = " + src_offset + " and length = " + length +
+					".");
+			}
+
+			for (int i = 0; i < length; ++i, ++dst_offset, ++src_offset) {
+				dst[dst_offset] = src[src_offset];
+			}
+		}
+
+		return length;
+	}
+
+	/**
+	 * Compare the contents of one array of <code>bytes</code> to another.
+	 *
+	 * @param a the first array
+	 * @param a_offset the start offset in <code>a</code>
+	 * @param b the second array
+	 * @param b_offset the start offset in <code>b</code>
+	 * @param length the number of <code>byte</code>s to compare.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static boolean memcmp(byte[] a, int a_offset, byte[] b,
+		int b_offset, int length) {
+		if ((a == null) && (b == null)) {
+			return true;
+		}
+
+		if ((a == null) || (b == null)) {
+			return false;
+		}
+
+		for (int i = 0; i < length; ++i, ++a_offset, ++b_offset) {
+			if (a[a_offset] != b[b_offset]) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Fill the given array with zeros.
+	 *
+	 * @param array the array to clear
+	 * @param offset the start offset
+	 * @param length the number of <code>byte</code>s to clear.
+	 */
+	public static void memclr(byte[] array, int offset, int length) {
+		for (int i = 0; i < length; ++i, ++offset) {
+			array[offset] = 0;
+		}
+	}
+
+	/**
+	 * Round a number up to a given multiple.
+	 *
+	 * @param value the number to be rounded
+	 * @param multiple the number to which to be rounded
+	 *
+	 * @return the smallest <code>int</code> greater than or equal to
+	 * 		   <code>value</code> which divides <code>multiple</code> exactly.
+	 */
+	public static int round_up(int value, int multiple) {
+		return (((value - 1) / multiple) + 1) * multiple;
+	}
+
+	/**
+	 * Return a new array equal to original except zero-padded to an integral
+	 * mulitple of blocks.  If the original is already an integral multiple of
+	 * blocks, just return it.
+	 *
+	 * @param original the array of <code>byte</code>s to be padded
+	 * @param block_size the size of the blocks
+	 *
+	 * @return an array whose size divides <code>block_size</code> exactly. The
+	 * 		   array is either <code>original</code> itself, or a copy whose
+	 * 		   first <code>original.length</code> bytes are equal to
+	 * 		   <code>original</code>.
+	 */
+	public static byte[] zero_pad(byte[] original, int block_size) {
+		if ((original.length % block_size) == 0) {
+			return original;
+		}
+
+		byte[] result = new byte[round_up(original.length, block_size)];
+		memcpy(result, 0, original, 0, original.length);
+
+		// Unnecessary - jvm sets bytes to 0.
+		// memclr (result, original.length, result.length - original.length);
+		return result;
+	}
+
+	/**
+	 * Determines whether two arrays of <code>byte</code>s contain the same
+	 * contents.
+	 *
+	 * @param b1 The first array
+	 * @param b2 The second array
+	 *
+	 * @return <code>true</code> if both arrays are <code>null</code>, both
+	 * 		   empty, or both of the same length with equal contents.
+	 */
+	public static boolean equals(byte[] b1, byte[] b2) {
+		if (b1 == b2) {
+			return true;
+		}
+
+		if ((b1 == null) || (b2 == null)) { // only one is null
+
+			return false;
+		}
+
+		if (b1.length != b2.length) {
+			return false;
+		}
+
+		for (int i = 0; i < b1.length; ++i) {
+			if (b1[i] != b2[i]) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Produce a <code>String</code> representation for the specified array of
+	 * <code>byte</code>s.  Print each <code>byte</code> as two hexadecimal
+	 * digits.
+	 *
+	 * @param data The array to print
+	 * @param offset the start offset in <code>data</code>
+	 * @param length the number of <code>byte</code>s to print
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static String print_bytes(byte[] data, int offset, int length) {
+		int size = 2 * length;
+		size += ((size / 8) + (size / 64));
+
+		char[] buf = new char[size];
+		int low_mask = 0x0f;
+		int high_mask = 0xf0;
+		int buf_pos = 0;
+		byte b;
+
+		int j = 0;
+
+		for (int i = offset; i < (offset + length); ++i) {
+			b = data[i];
+			buf[buf_pos++] = digits[(high_mask & b) >> 4];
+			buf[buf_pos++] = digits[(low_mask & b)];
+
+			if ((j % 4) == 3) {
+				buf[buf_pos++] = ' ';
+			}
+
+			if ((j % 32) == 31) {
+				buf[buf_pos++] = '\n';
+			}
+
+			++j;
+		}
+
+		return new String(buf);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param data DOCUMENT ME!
+	 * @param offset DOCUMENT ME!
+	 * @param length DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static String print_bytes_exact(byte[] data, int offset, int length) {
+		int size = 2 * length;
+		char[] buf = new char[size];
+		int low_mask = 0x0f;
+		int high_mask = 0xf0;
+		int buf_pos = 0;
+		byte b;
+
+		int j = 0;
+
+		for (int i = offset; i < (offset + length); ++i) {
+			b = data[i];
+			buf[buf_pos++] = digits[(high_mask & b) >> 4];
+			buf[buf_pos++] = digits[(low_mask & b)];
+			++j;
+		}
+
+		return new String(buf);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param data DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static String print_bytes(byte[] data) {
+		return print_bytes(data, 0, data.length);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param msg DOCUMENT ME!
+	 */
+	private static void croak(String msg) {
+		// throw new java.AssertionViolatedException(msg);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param b DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static int getUnsigned(byte b) {
+		return ((b & 0xff)); // >> 8);
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/ByteUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/double64.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/double64.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/double64.java	(revision 38736)
@@ -0,0 +1,63 @@
+/*
+ * Created on 18-jul-2003
+ *
+ * Copyright (c) 2003
+ * Francisco José Peñarrubia Martínez
+ * IVER Tecnologías de la Información S.A.
+ * Salamanca 50
+ * 46005 Valencia (        SPAIN )
+ * +34 963163400
+ * mailto:fran@iver.es
+ * http://www.iver.es
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.dgn.lib;
+
+/**
+ * double de 64.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class double64 {
+	public long hi;
+	public long lo;
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/lib/double64.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreProviderFactory.java	(revision 38736)
@@ -0,0 +1,57 @@
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.DataStoreProvider;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class DGNStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{
+
+	protected DGNStoreProviderFactory(String name, String description) {
+		super(name, description);
+	}
+
+	public DataStoreProvider createProvider(DataParameters parameters,
+			DataStoreProviderServices providerServices)
+			throws InitializeException {
+		return new DGNStoreProvider((DGNStoreParameters) parameters, providerServices);
+	}
+
+	public DynObject createParameters() {
+		return new DGNStoreParameters();
+	}
+	
+	public int allowCreate() {
+		return NO;
+	}
+	
+	public int allowWrite() {
+		return NO;
+	}
+
+	public int allowRead() {
+		return YES;
+	}
+	
+	public int hasRasterSupport() {
+		return NO;
+	}
+	
+	public int hasTabularSupport() {
+		return YES;
+	}
+	
+	public int hasVectorialSupport() {
+		return YES;
+	}
+
+	public int allowMultipleGeometryTypes() {
+		return YES;
+	}
+	
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreParameters.java	(revision 38736)
@@ -0,0 +1,100 @@
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.io.File;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+
+public class DGNStoreParameters extends AbstractDataParameters implements
+		DataStoreParameters, FilesystemStoreParameters,
+		NewFeatureStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME = "DGNStoreParameters";
+
+    private static final String FIELD_FILE = "file";
+    private static final String FIELD_CRS = "CRS";
+
+	private DelegatedDynObject parameters;
+
+	
+	public DGNStoreParameters() {
+		this(PARAMETERS_DEFINITION_NAME);
+	}
+
+	protected DGNStoreParameters(String parametersDefinitionName) {
+		this(parametersDefinitionName, DGNStoreProvider.NAME);
+	}
+
+	public DGNStoreParameters(String parametersDefinitionName, String name) {
+		super();
+		this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
+		this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
+	}
+
+	public String getDataStoreName() {
+		return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
+	}
+
+	public String getDescription() {
+		return this.getDynClass().getDescription();
+	}
+
+
+	public void setCRS(IProjection srs) {
+		setDynValue(FIELD_CRS, srs);
+	}
+
+	public void setCRS(String srs) {
+		setDynValue(FIELD_CRS, srs);
+	}
+
+	public IProjection getCRS() {
+		return (IProjection) getDynValue(FIELD_CRS);
+	}
+
+	public String getFileName() {
+		return this.getFile().getPath();
+	}
+
+	public boolean isValid() {
+		if (getCRS() == null ) {
+			return false;
+		}
+		if (getFile() == null) {
+			return false;
+		}
+		return true;
+	}
+
+	public File getFile() {
+		return (File) this.getDynValue(FIELD_FILE);
+	}
+
+	public void setFile(File file) {
+		this.setDynValue(FIELD_FILE, file);
+	}
+
+	public void setFile(String file) {
+		this.setDynValue(FIELD_FILE, file);
+	}
+
+	public EditableFeatureType getDefaultFeatureType() {
+		return null; //TODO ????
+	}
+
+	public void setDefaultFeatureType(FeatureType defaultFeatureType) {
+		throw new UnsupportedOperationException();
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return parameters;
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNLibrary.java	(revision 38736)
@@ -0,0 +1,100 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.dgn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.metadata.MetadataLibrary;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DGNLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DALFileLibrary.class);
+        require(MetadataLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		List<Throwable> exs = new ArrayList<Throwable>();
+				
+		FileHelper.registerParametersDefinition(
+				DGNStoreParameters.PARAMETERS_DEFINITION_NAME, 
+				DGNStoreParameters.class,
+				"DGNParameters.xml"
+		);
+		try {
+			FileHelper.registerMetadataDefinition(
+					DGNStoreProvider.METADATA_DEFINITION_NAME, 
+					DGNStoreProvider.class,
+					"DGNMetadata.xml"
+			);
+		} catch (MetadataException e) {
+			exs.add(e);
+		}
+
+        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+				.getDataManager();
+
+		try {
+			if (!dataman.getStoreProviders().contains(DGNStoreProvider.NAME)) {
+				dataman.registerStoreProviderFactory(new DGNStoreProviderFactory(DGNStoreProvider.NAME, DGNStoreProvider.DESCRIPTION));
+			}
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		try {
+			DALFileLocator.getFilesystemServerExplorerManager()
+					.registerProvider(DGNStoreProvider.NAME,
+							DGNStoreProvider.DESCRIPTION,
+							DGNFilesystemServerProvider.class);
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		if( exs.size()>0 ) {
+			throw new LibraryException(this.getClass(), exs);
+		}
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dgn/DGNLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPLibrary.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPLibrary.java	(revision 38736)
@@ -0,0 +1,104 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.store.shp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALFileLibrary;
+import org.gvsig.fmap.dal.DALFileLocator;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.store.dbf.DBFLibrary;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider;
+import org.gvsig.fmap.dal.store.dgn.DGNStoreProviderFactory;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class SHPLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+        require(DALFileLibrary.class);
+        require(DBFLibrary.class);
+    }
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		List<Throwable> exs = new ArrayList<Throwable>();
+
+		FileHelper.registerParametersDefinition(
+				SHPStoreParameters.PARAMETERS_DEFINITION_NAME,
+				SHPStoreParameters.class, "SHPParameters.xml");
+		FileHelper.registerParametersDefinition(
+				SHPNewStoreParameters.PARAMETERS_DEFINITION_NAME,
+				SHPNewStoreParameters.class, "SHPParameters.xml");
+		try {
+			FileHelper.registerMetadataDefinition(
+					SHPStoreProvider.METADATA_DEFINITION_NAME,
+					SHPStoreProvider.class, "SHPMetadata.xml");
+		} catch (MetadataException e1) {
+			exs.add(e1);
+		}
+		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+				.getDataManager();
+
+		try {
+			if (!dataman.getStoreProviders().contains(SHPStoreProvider.NAME)) {
+				dataman.registerStoreProviderFactory(new SHPStoreProviderFactory(SHPStoreProvider.NAME, SHPStoreProvider.DESCRIPTION));
+
+			}
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		try {
+			DALFileLocator.getFilesystemServerExplorerManager()
+					.registerProvider(SHPStoreProvider.NAME,
+							SHPStoreProvider.DESCRIPTION,
+							SHPFilesystemServerProvider.class);
+		} catch (RuntimeException e) {
+			exs.add(e);
+		}
+
+		if (exs.size() > 0) {
+			throw new LibraryException(this.getClass(), exs);
+		}
+	}
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+		// Do nothing
+		
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiPoint.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiPoint.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiPoint.java	(revision 38736)
@@ -0,0 +1,255 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.util.ArrayList;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.aggregate.MultiPoint;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.util.UtilFunctions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Elemento shape de tipo multipunto.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHPMultiPoint implements SHPShape {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(SHPMultiPoint.class);
+	private int m_type;
+	private int numpoints;
+	private Point2D[] points;
+	private double[] zs;
+
+	/**
+	 * Crea un nuevo SHPMultiPoint.
+	 */
+	public SHPMultiPoint() {
+		m_type = SHP.MULTIPOINT2D;
+	}
+
+	/**
+	 * Crea un nuevo SHPMultiPoint.
+	 *
+	 * @param type Tipo de multipunto.
+	 *
+	 * @throws ShapefileException
+	 */
+	public SHPMultiPoint(int type) {
+		if ((type != SHP.MULTIPOINT2D) &&
+				(type != SHP.MULTIPOINTM) &&
+				(type != SHP.MULTIPOINT3D)) {
+//			throw new ShapefileException("No es de tipo 8, 18, o 28");
+		}
+
+		m_type = type;
+	}
+
+	/**
+	 * Devuelve el tipo de multipoint en concreto.
+	 *
+	 * @return Tipo de multipoint.
+	 */
+	public int getShapeType() {
+		return m_type;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#read(MappedByteBuffer, int)
+	 */
+	public Geometry read(MappedByteBuffer buffer, int type) {
+		double minX = buffer.getDouble();
+		double minY = buffer.getDouble();
+		double maxX = buffer.getDouble();
+		double maxY = buffer.getDouble();
+		Rectangle2D rec = new Rectangle2D.Double(minX, minY, maxX - minX,
+				maxY - maxY);
+		int numpoints = buffer.getInt();
+		org.gvsig.fmap.geom.primitive.Point[] p = new org.gvsig.fmap.geom.primitive.Point[numpoints];
+
+		for (int t = 0; t < numpoints; t++) {
+			double x = buffer.getDouble();
+			double y = buffer.getDouble();
+			try {
+				p[t] = geomManager.createPoint(x, y, SUBTYPES.GEOM2D);
+			} catch (CreateGeometryException e) {
+				logger.error("Error creating a point", e);
+			}
+		}
+
+		/*   if (m_type == FConstant.SHAPE_TYPE_MULTIPOINTZ) {
+		   buffer.position(buffer.position() + (2 * 8));
+		   for (int t = 0; t < numpoints; t++) {
+		       p[t].z = buffer.getDouble(); //z
+		   }
+		   }
+		 */
+		MultiPoint multipoint = null;
+		try {
+			multipoint = (MultiPoint)geomManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
+			for (int i=0 ; i<p.length ; i++){
+				multipoint.addPoint(p[i]);
+			}			
+		} catch (CreateGeometryException e) {
+			logger.error("Error creating the multipoint", e);
+		}
+		return multipoint;		
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry)
+	 */
+	public void write(ByteBuffer buffer, Geometry geometry) {
+		// FMultiPoint2D mp = (FMultiPoint2D) geometry.getShape();
+//		int p = buffer.position();
+
+		Envelope env = geometry.getEnvelope();
+
+		buffer.putDouble(env.getMinimum(0));
+		buffer.putDouble(env.getMinimum(1));
+		buffer.putDouble(env.getMaximum(0));
+		buffer.putDouble(env.getMaximum(1));
+		///obtainsPoints(geometry.getGeneralPathXIterator());
+		buffer.putInt(numpoints);
+
+		for (int t = 0, tt = numpoints; t < tt; t++) {
+			Point2D point = points[t];
+			buffer.putDouble(point.getX());
+			buffer.putDouble(point.getY());
+		}
+
+		  if (m_type == SHP.MULTIPOINT3D) {
+		   double[] zExtreame = SHP.getZMinMax(zs);
+		   if (Double.isNaN(zExtreame[0])) {
+		       buffer.putDouble(0.0);
+		       buffer.putDouble(0.0);
+		   } else {
+		       buffer.putDouble(zExtreame[0]);
+		       buffer.putDouble(zExtreame[1]);
+		   }
+		   for (int t = 0; t < numpoints; t++) {
+		       double z = zs[t];
+		       if (Double.isNaN(z)) {
+		           buffer.putDouble(0.0);
+		       } else {
+		           buffer.putDouble(z);
+		       }
+		   }
+		   }
+		   if ((m_type == SHP.MULTIPOINTM) ||
+		           (m_type == SHP.MULTIPOINT3D)) {
+		       buffer.putDouble(-10E40);
+		       buffer.putDouble(-10E40);
+		       for (int t = 0; t < numpoints; t++) {
+		           buffer.putDouble(-10E40);
+		       }
+		   }
+
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(com.iver.cit.gvsig.core.BasicShape.FGeometry)
+	 */
+	public int getLength(Geometry fgeometry) {
+		//FMultiPoint2D mp = (FMultiPoint2D) fgeometry.getShape();
+		///obtainsPoints(fgeometry.getGeneralPathXIterator());
+
+		int length;
+
+		if (m_type == SHP.MULTIPOINT2D) {
+			// two doubles per coord (16 * numgeoms) + 40 for header
+			length = (numpoints * 16) + 40;
+		} else if (m_type == SHP.MULTIPOINTM) {
+			// add the additional MMin, MMax for 16, then 8 per measure
+			length = (numpoints * 16) + 40 + 16 + (8 * numpoints);
+		} else if (m_type == SHP.MULTIPOINT3D) {
+			// add the additional ZMin,ZMax, plus 8 per Z
+			length = (numpoints * 16) + 40 + 16 + (8 * numpoints);
+		} else {
+			throw new IllegalStateException("Expected ShapeType of Arc, got " +
+				m_type);
+		}
+
+		return length;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.drivers.shp.write.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
+	 */
+	public void obtainsPoints(Geometry g) {
+		if (SHP.MULTIPOINT3D == m_type){
+			MultiPoint multipoint = (MultiPoint)g;
+			zs = new double[multipoint.getPrimitivesNumber()];
+			for (int i=0 ; i<zs.length ; i++){
+				zs[i] = multipoint.getPointAt(i).getCoordinateAt(2);
+			}		
+		}
+		PathIterator theIterator = g.getPathIterator(null); //polyLine.getPathIterator(null, flatness);
+		double[] theData = new double[6];
+		ArrayList ps=new ArrayList();
+		while (!theIterator.isDone()) {
+			//while not done
+//			int theType = theIterator.currentSegment(theData);
+			theIterator.currentSegment(theData);
+
+			ps.add(new Point2D.Double(theData[0], theData[1]));
+			theIterator.next();
+		} //end while loop
+		points=(Point2D[])ps.toArray(new Point2D.Double[0]);
+		numpoints=points.length;
+	}
+//	public void setFlatness(double flatness) {
+//		//this.flatness=flatness;
+//	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiPoint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPolygon.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPolygon.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPolygon.java	(revision 38736)
@@ -0,0 +1,288 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.util.UtilFunctions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Elemento shape de tipo Pol�gono.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHPPolygon extends SHPMultiLine {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(SHPPolygon.class);
+
+	/**
+	 * Crea un nuevo SHPPolygon.
+	 */
+	public SHPPolygon() {
+		m_type = SHP.POLYGON2D;
+	}
+
+	/**
+	 * Crea un nuevo SHPPolygon.
+	 *
+	 * @param type Tipo de shape.
+	 *
+	 * @throws ShapefileException
+	 */
+	public SHPPolygon(int type) {
+		if ((type != SHP.POLYGON2D) &&
+				(type != SHP.POLYGONM) &&
+				(type != SHP.POLYGON3D)) {
+//			throw new ShapefileException("No es de tipo 5, 15, o 25");
+		}
+
+		m_type = type;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getShapeType()
+	 */
+	public int getShapeType() {
+		return m_type;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#read(MappedByteBuffer, int)
+	 */
+	public synchronized Geometry read(MappedByteBuffer buffer, int type) {
+		double minX = buffer.getDouble();
+		double minY = buffer.getDouble();
+		double maxX = buffer.getDouble();
+		double maxY = buffer.getDouble();
+		Rectangle2D rec = new Rectangle2D.Double(minX, minY, maxX - minX,
+				maxY - maxY);
+		int numParts = buffer.getInt();
+		int numPoints = buffer.getInt();
+
+		int[] partOffsets = new int[numParts];
+
+		for (int i = 0; i < numParts; i++) {
+			partOffsets[i] = buffer.getInt();
+		}
+
+		Point[] points = readPoints(buffer, numPoints);
+
+		/* if (m_type == FConstant.SHAPE_TYPE_POLYGONZ) {
+		   //z
+		   buffer.position(buffer.position() + (2 * 8));
+		   for (int t = 0; t < numPoints; t++) {
+		       points[t].z = buffer.getDouble();
+		   }
+		   }
+		 */
+		int offset = 0;
+		int start;
+		int finish;
+		int length;
+
+		for (int part = 0; part < numParts; part++) {
+			start = partOffsets[part];
+
+			if (part == (numParts - 1)) {
+				finish = numPoints;
+			} else {
+				finish = partOffsets[part + 1];
+			}
+
+			length = finish - start;
+
+			Point[] pointsPart = new Point[length];
+
+			for (int i = 0; i < length; i++) {
+				pointsPart[i] = points[offset++];
+			}
+		}
+
+		try {
+			return geomManager.createSurface(getGeneralPathX(points, partOffsets), SUBTYPES.GEOM2D);
+		} catch (CreateGeometryException e) {
+			logger.error("Error creating a surface", e);
+			return null;
+		}
+	}
+
+	/**
+	 * Lee los puntos del buffer.
+	 *
+	 * @param buffer
+	 * @param numPoints N�mero de puntos.
+	 *
+	 * @return Vector de Puntos.
+	 */
+	private synchronized Point[] readPoints(final MappedByteBuffer buffer,
+		final int numPoints) {
+		Point[] points = new Point[numPoints];
+
+		for (int t = 0; t < numPoints; t++) {
+			try {
+				points[t] = geomManager.createPoint(buffer.getDouble(), buffer.getDouble(), SUBTYPES.GEOM2D);
+			} catch (CreateGeometryException e) {
+				logger.error("Error creating a point", e);
+			}
+		}
+
+		return points;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry)
+	 */
+	public synchronized void write(ByteBuffer buffer, Geometry geometry) {
+		//FPolygon2D polyLine;
+		//polyLine = (FPolygon2D) geometry.getShape();
+		Envelope env = geometry.getEnvelope();
+
+		buffer.putDouble(env.getMinimum(0));
+		buffer.putDouble(env.getMinimum(1));
+		buffer.putDouble(env.getMaximum(0));
+		buffer.putDouble(env.getMaximum(1));
+		//////
+		///obtainsPoints(geometry.getGeneralPathXIterator());
+
+		//int[] parts=polyLine.getParts();
+		//FPoint2D[] points=polyLine.getPoints();
+		int nparts = parts.length;
+		int npoints = points.length;
+
+		//////
+		///int npoints = polyLine.getNumPoints();
+		///int nparts = polyLine.getNumParts();
+		buffer.putInt(nparts);
+		buffer.putInt(npoints);
+
+//		int count = 0;
+
+		for (int t = 0; t < nparts; t++) {
+			///buffer.putInt(polyLine.getPart(t));
+			buffer.putInt(parts[t]);
+		}
+
+		///FPoint[] points = polyLine.getPoints();
+		for (int t = 0; t < points.length; t++) {
+			///buffer.putDouble(points[t].x);
+			///buffer.putDouble(points[t].y);
+			buffer.putDouble(points[t].getX());
+			buffer.putDouble(points[t].getY());
+		}
+
+		if (m_type == SHP.POLYGON3D) {
+			double[] zExtreame = SHP.getZMinMax(zs);
+			if (Double.isNaN(zExtreame[0])) {
+				buffer.putDouble(0.0);
+				buffer.putDouble(0.0);
+			} else {
+				buffer.putDouble(zExtreame[0]);
+				buffer.putDouble(zExtreame[1]);
+			}
+			for (int t = 0; t < npoints; t++) {
+				double z = zs[t];
+				if (Double.isNaN(z)) {
+					buffer.putDouble(0.0);
+				} else {
+					buffer.putDouble(z);
+				}
+			}
+		}
+
+		if ((m_type == SHP.POLYGONM) ||
+				(m_type == SHP.POLYGON3D)) {
+			buffer.putDouble(-10E40);
+			buffer.putDouble(-10E40);
+
+			for (int t = 0; t < npoints; t++) {
+				buffer.putDouble(-10E40);
+			}
+		}
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(com.iver.cit.gvsig.core.BasicShape.FGeometry)
+	 */
+	public synchronized int getLength(Geometry fgeometry) {
+		// FPolygon2D multi;
+		//multi = (FPolygon2D) fgeometry.getShape();
+		///int nrings = 0;
+		///obtainsPoints(fgeometry.getGeneralPathXIterator());
+
+		//int[] parts=multi.getParts();
+		//FPoint2D[] points;
+		/////////
+		//points = multi.getPoints();
+		int npoints = points.length;
+
+		///////////
+		///nrings = multi.getNumParts();
+		///int npoints = multi.getNumPoints();
+		int length;
+
+		if (m_type == SHP.POLYGON3D) {
+			length = 44 + (4 * parts.length) + (16 * npoints) + (8 * npoints) +
+				16;
+		} else if (m_type == SHP.POLYGONM) {
+			length = 44 + (4 * parts.length) + (16 * npoints) + (8 * npoints) +
+				16;
+		} else if (m_type == SHP.POLYGON2D) {
+			length = 44 + (4 * parts.length) + (16 * npoints);
+		} else {
+			throw new IllegalStateException(
+				"Expected ShapeType of Polygon, got " + m_type);
+		}
+
+		return length;
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPolygon.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPoint.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPoint.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPoint.java	(revision 38736)
@@ -0,0 +1,194 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.awt.geom.PathIterator;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.util.UtilFunctions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHPPoint implements SHPShape {
+    private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+    private static final Logger logger = LoggerFactory.getLogger(SHPPoint.class);
+    private int m_type;
+    private Point point;
+    private double z;
+
+    /**
+     * Crea un nuevo SHPPoint.
+     *
+     * @param type DOCUMENT ME!
+     *
+     * @throws ShapefileException DOCUMENT ME!
+     */
+    public SHPPoint(int type)  {
+        if ((type != SHP.POINT2D) &&
+            (type != SHP.POINTM) &&
+            (type != SHP.POINT3D)) { // 2d, 2d+m, 3d+m
+            //			throw new ShapefileException("No es un punto 1,11 ni 21");
+        }
+
+        m_type = type;
+    }
+
+    /**
+     * Crea un nuevo SHPPoint.
+     */
+    public SHPPoint() {
+        m_type = SHP.POINT2D; //2d
+    }
+
+    /**
+     * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getShapeType()
+     */
+    public int getShapeType() {
+        return m_type;
+    }
+
+    /**
+     * @see com.iver.cit.gvsig.fmap.shp.SHPShape#read(MappedByteBuffer, int)
+     */
+    public Geometry read(MappedByteBuffer buffer, int type) {
+        double x = buffer.getDouble();
+        double y = buffer.getDouble();
+        double z = Double.NaN;
+
+        if (m_type == SHP.POINTM) {
+            buffer.getDouble();
+        }
+
+        if (m_type == SHP.POINT3D) {
+            z = buffer.getDouble();
+            Point point;
+            try {
+                point = geomManager.createPoint(x, y, SUBTYPES.GEOM3D);
+                point.setCoordinateAt(2, z);
+                return point;
+                //FIXME que hacems con esto
+            } catch (CreateGeometryException e) {
+                logger.error("Error creating a point", e);
+            }			
+        }
+        try {
+            return geomManager.createPoint(x, y, SUBTYPES.GEOM2D);
+        } catch (CreateGeometryException e) {
+            logger.error("Error creating a point", e);
+        }
+        return null;
+    }
+
+    /**
+     * @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry)
+     */
+    public void write(ByteBuffer buffer, Geometry geometry) {
+        buffer.putDouble(point.getX());
+        buffer.putDouble(point.getY());
+
+        if ((m_type == SHP.POINT3D) ||  (m_type == SHP.POINTM)){
+            if (Double.isNaN(z)) { // nan means not defined
+                buffer.putDouble(0.0);
+            } else {
+                buffer.putDouble(z);
+            }
+        }
+    }
+
+    /**
+     * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(int)
+     */
+    public int getLength(Geometry fgeometry) {
+        int length;
+
+        if (m_type == SHP.POINT2D) {
+            length = 20;
+        } else if (m_type == SHP.POINTM || m_type == SHP.POINT3D) {
+            length = 28;
+        } else {
+            throw new IllegalStateException("Expected ShapeType of Point, got" +
+                m_type);
+        }
+
+        return length;
+    }
+
+    /**
+     * @see com.iver.cit.gvsig.fmap.drivers.shp.write.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
+     */
+    public void obtainsPoints(Geometry g) {
+        if (m_type == SHP.POINTM || m_type == SHP.POINT3D){
+            z = ((Point)g).getCoordinateAt(2);
+        }
+        PathIterator theIterator = g.getPathIterator(null); //polyLine.getPathIterator(null, flatness);
+        double[] theData = new double[6];
+
+        while (!theIterator.isDone()) {
+            //while not done
+            //			int theType = theIterator.currentSegment(theData);
+            theIterator.currentSegment(theData);
+
+            try {
+                point = geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D);
+            } catch (CreateGeometryException e) {
+                logger.error("Error creating a point", e);
+            }
+
+            theIterator.next();
+        } //end while loop
+    }
+    //	public void setFlatness(double flatness) {
+    //	//	this.flatness=flatness;
+    //	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPoint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFileWrite.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFileWrite.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFileWrite.java	(revision 38736)
@@ -0,0 +1,372 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHPFileWrite {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(SHPFileWrite.class);
+	private SHPShape m_shape = null;
+	private ByteBuffer m_bb = null;
+	private ByteBuffer m_indexBuffer = null;
+	private int m_pos = 0;
+	private int m_offset;
+	//	private int m_type;
+	private int m_cnt;
+	private FileChannel shpChannel;
+	private FileChannel shxChannel;
+//	private double flatness;
+
+	/**
+	 * Crea un nuevo SHPFileWrite.
+	 *
+	 * @param shpChannel DOCUMENT ME!
+	 * @param shxChannel DOCUMENT ME!
+	 */
+	public SHPFileWrite(FileChannel shpChannel, FileChannel shxChannel) {
+		this.shpChannel = shpChannel;
+		this.shxChannel = shxChannel;
+	}
+
+	/**
+	 * Make sure our buffer is of size.
+	 *
+	 * @param size DOCUMENT ME!
+	 */
+	private void checkShapeBuffer(int size) {
+		if (m_bb.capacity() < size) {
+			m_bb = ByteBuffer.allocateDirect(size);
+		}
+	}
+
+	/**
+	 * Drain internal buffers into underlying channels.
+	 * @throws WriteException
+	 *
+	 * @throws IOException DOCUMENT ME!
+	 */
+	private void drain() throws WriteException {
+		m_bb.flip();
+		m_indexBuffer.flip();
+		try{
+		while (m_bb.remaining() > 0) {
+			shpChannel.write(m_bb);
+		}
+
+		while (m_indexBuffer.remaining() > 0) {
+			shxChannel.write(m_indexBuffer);
+		}
+		}catch (IOException e) {
+			throw new WriteException("SHP File Write Drain", e);
+		}
+		m_bb.flip().limit(m_bb.capacity());
+		m_indexBuffer.flip().limit(m_indexBuffer.capacity());
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 */
+	private void allocateBuffers() {
+		m_bb = ByteBuffer.allocateDirect(16 * 1024);
+		m_indexBuffer = ByteBuffer.allocateDirect(100);
+	}
+
+	/**
+	 * Close the underlying Channels.
+	 */
+	public void close() throws WriteException {
+		try {
+			shpChannel.close();
+			shxChannel.close();
+		} catch (IOException e) {
+			throw new WriteException("SHP File Write Close", e);
+		}
+		shpChannel = null;
+		shxChannel = null;
+		m_shape = null;
+
+		if (m_indexBuffer instanceof ByteBuffer) {
+			if (m_indexBuffer != null) {
+				///NIOUtilities.clean(m_indexBuffer);
+			}
+		}
+
+		if (m_indexBuffer instanceof ByteBuffer) {
+			if (m_indexBuffer != null) {
+				///NIOUtilities.clean(m_bb);
+			}
+		}
+
+		m_indexBuffer = null;
+		m_bb = null;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param geometries DOCUMENT ME!
+	 * @param type DOCUMENT ME!
+	 *
+	 */
+	public void write(Geometry[] geometries, int type)
+			throws WriteException {
+		m_shape = SHP.create(type);
+//		m_shape.setFlatness(flatness);
+		writeHeaders(geometries, type);
+
+		m_pos = m_bb.position();
+
+		for (int i = 0, ii = geometries.length; i < ii; i++) {
+			writeGeometry(geometries[i]);
+		}
+
+		close();
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param geometries DOCUMENT ME!
+	 * @param type DOCUMENT ME!
+	 * @throws WriteException
+	 *
+	 */
+	private void writeHeaders(Geometry[] geometries, int type)
+			throws WriteException {
+		int fileLength = 100;		
+		Envelope envelope = null;
+		try {
+		    envelope = geomManager.createEnvelope(SUBTYPES.GEOM2D);
+        } catch (CreateEnvelopeException e) {
+            logger.error("Error creating the envelope", e);
+        }
+
+		for (int i = geometries.length - 1; i >= 0; i--) {
+			Geometry fgeometry = geometries[i];
+			m_shape.obtainsPoints(fgeometry);
+			int size = m_shape.getLength(fgeometry) + 8;
+			fileLength += size;
+			envelope.add(fgeometry.getEnvelope());			
+		}
+
+		writeHeaders(envelope, type, geometries.length, fileLength);
+	}
+
+	/**
+	 * Writes shape header (100 bytes)
+	 *
+	 * @param bounds DOCUMENT ME!
+	 * @param type DOCUMENT ME!
+	 * @param numberOfGeometries DOCUMENT ME!
+	 * @param fileLength DOCUMENT ME!
+	 */
+	public void writeHeaders(Envelope bounds, int type,
+		int numberOfGeometries,
+			int fileLength) throws WriteException {
+		/*try {
+		   handler = type.getShapeHandler();
+		   } catch (ShapefileException se) {
+		     throw new RuntimeException("unexpected Exception",se);
+		   }
+		 */
+		if (m_bb == null) {
+			allocateBuffers();
+		}
+		// Posicionamos al principio.
+		m_bb.position(0);
+		m_indexBuffer.position(0);
+
+		ShapeFileHeader2 header = new ShapeFileHeader2();
+
+		header.write(m_bb, type, numberOfGeometries, fileLength / 2,
+			bounds
+				.getMinimum(0), bounds.getMinimum(1), bounds.getMaximum(0),
+			bounds.getMaximum(1), 0, 0, 0, 0);
+
+		header.write(m_indexBuffer, type, numberOfGeometries,
+			50 + (4 * numberOfGeometries), bounds.getMinimum(0), bounds.getMinimum(1),
+			bounds.getMaximum(0), bounds.getMaximum(1), 0, 0, 0, 0);
+
+		m_offset = 50;
+//		m_type = type;
+		m_cnt = 0;
+
+		try {
+			shpChannel.position(0);
+			shxChannel.position(0);
+		} catch (IOException e) {
+			throw new WriteException("SHP File Write Headers", e);
+		}
+		drain();
+	}
+	public int writeIGeometry(Geometry g) throws WriteException {
+		int shapeType = getShapeType(g.getType(), g.getGeometryType().getSubType());
+		m_shape = SHP.create(shapeType);
+//		m_shape.setFlatness(flatness);
+		// System.out.println("writeIGeometry: type="+ g.getType());
+		return writeGeometry(g);
+	}
+
+	/**
+	 * Writes a single Geometry.
+	 *
+	 * @param g
+	 * @return the position of buffer (after the last geometry, it will allow you to
+	 * write the file size in the header.
+	 */
+	public synchronized int writeGeometry(Geometry g)
+			throws WriteException {
+		if (m_bb == null) {
+			allocateBuffers();
+			m_offset = 50;
+			m_cnt = 0;
+
+			try {
+				shpChannel.position(0);
+				shxChannel.position(0);
+			} catch (IOException e) {
+				throw new WriteException("SHP File Write", e);
+			}
+			// throw new IOException("Must write headers first");
+		}
+
+		m_pos = m_bb.position();
+		m_shape.obtainsPoints(g);
+		int length = m_shape.getLength(g);
+
+		// must allocate enough for shape + header (2 ints)
+		checkShapeBuffer(length + 8);
+
+		length /= 2;
+
+		m_bb.order(ByteOrder.BIG_ENDIAN);
+		m_bb.putInt(++m_cnt);
+		m_bb.putInt(length);
+		m_bb.order(ByteOrder.LITTLE_ENDIAN);
+		m_bb.putInt(m_shape.getShapeType());
+		m_shape.write(m_bb, g);
+
+		///assert (length * 2 == (m_bb.position() - m_pos) - 8);
+		m_pos = m_bb.position();
+
+		// write to the shx
+		m_indexBuffer.putInt(m_offset);
+		m_indexBuffer.putInt(length);
+		m_offset += (length + 4);
+		drain();
+
+		///assert(m_bb.position() == 0);
+		return m_pos; // Devolvemos hasta donde hemos escrito
+	}
+
+	/**
+	 * Returns a shapeType compatible with shapeFile constants from a gvSIG's IGeometry type
+	 * @param geometryType
+	 * @return a shapeType compatible with shapeFile constants from a gvSIG's IGeometry type
+	 */
+	public int getShapeType(int geometryType, int geometrySubType) {
+
+		if (geometrySubType == Geometry.SUBTYPES.GEOM3D){
+			switch (geometryType) {
+			case Geometry.TYPES.POINT:
+				return SHP.POINT3D;
+
+			case Geometry.TYPES.CURVE:
+			case Geometry.TYPES.MULTICURVE:
+			case Geometry.TYPES.ELLIPSE:
+			case Geometry.TYPES.CIRCLE:
+			case Geometry.TYPES.ARC:
+			case Geometry.TYPES.SPLINE: 
+				return SHP.POLYLINE3D;
+
+			case Geometry.TYPES.SURFACE:
+			case Geometry.TYPES.MULTISURFACE:
+				return SHP.POLYGON3D;
+
+			case Geometry.TYPES.MULTIPOINT:
+				return SHP.MULTIPOINT3D; //TODO falta aclarar cosas aqu�.
+		}
+
+		}else{
+			switch (geometryType) {
+				case Geometry.TYPES.POINT:
+					return SHP.POINT2D;
+
+				case Geometry.TYPES.CURVE:
+				case Geometry.TYPES.MULTICURVE:
+				case Geometry.TYPES.ELLIPSE:
+				case Geometry.TYPES.CIRCLE:
+				case Geometry.TYPES.ARC:
+				case Geometry.TYPES.SPLINE: 
+					return SHP.POLYLINE2D;
+
+				case Geometry.TYPES.SURFACE:
+				case Geometry.TYPES.MULTISURFACE:
+					return SHP.POLYGON2D;
+
+				case Geometry.TYPES.MULTIPOINT:
+					return SHP.MULTIPOINT2D; //TODO falta aclarar cosas aqu�.
+			}
+		}
+			return SHP.NULL;
+		}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFileWrite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPNull.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPNull.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPNull.java	(revision 38736)
@@ -0,0 +1,31 @@
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+import org.gvsig.fmap.geom.Geometry;
+
+public class SHPNull implements SHPShape {
+	public int getShapeType() {
+        return SHP.NULL;
+	}
+
+	public SHPNull(int type)  {
+	}
+	public SHPNull() {
+	}
+	public Geometry read(MappedByteBuffer buffer, int type) {
+		return null;
+	}
+
+	public void write(ByteBuffer buffer, Geometry geometry) {
+	}
+
+	public int getLength(Geometry fgeometry) {
+		return 4;
+	}
+
+	public void obtainsPoints(Geometry g) {
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPNull.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHP.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHP.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHP.java	(revision 38736)
@@ -0,0 +1,263 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.io.File;
+
+
+
+/**
+ * Clase con las constantes que representan los diferentes tipos de Shape y
+ * m�todos est�ticos relativos a los shapes.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHP {
+
+    public static final int NULL = 0;
+    public static final int POINT2D = 1;
+    public static final int POLYLINE2D = 3;
+    public static final int POLYGON2D = 5;
+    public static final int MULTIPOINT2D = 8;
+    public static final int POINT3D = 11;
+    public static final int POLYLINE3D = 13;
+    public static final int POLYGON3D = 15;
+    public static final int MULTIPOINT3D = 18;
+	public final static int POINTM = 21;
+	public final static int POLYLINEM = 23;
+	public final static int POLYGONM = 25;
+	public final static int MULTIPOINTM = 28;
+    /**
+     * Crea a partir del tipo de geometr�a un shape del tipo m�s adecuado.
+     *
+     * @param type Tipo de geometr�a.
+     *
+     * @return Geometr�a m�s adecuada.
+     *
+     * @throws ShapefileException Se lanza cuando es causada por la creaci�n
+     *         del shape.
+     */
+    public static SHPShape create(int type) {
+        SHPShape shape;
+
+        switch (type) {
+        	case 0:
+        		shape = new SHPNull(type);
+        		break;
+
+            case 1:
+            case 11:
+            case 21:
+                shape = new SHPPoint(type);
+
+                break;
+
+            case 3:
+            case 13:
+            case 23:
+                shape = new SHPMultiLine(type);
+
+                break;
+
+            case 5:
+            case 15:
+            case 25:
+                shape = new SHPPolygon(type);
+
+                break;
+
+            case 8:
+            case 18:
+            case 28:
+                shape = new SHPMultiPoint(type);
+
+                break;
+
+            default:
+                shape = null;
+        }
+
+        return shape;
+    }
+
+    /**
+     * Devuelve un array con dos doubles, el primero representa el m�nimo valor
+     * y el segundo el m�ximo de entre los valores que se pasan como par�metro
+     * en forma de array.
+     *
+     * @param zs Valores a comprobar.
+     *
+     * @return Array de doubles con el valor m�nimo y el valor m�ximo.
+     */
+    public static double[] getZMinMax(double[] zs) {
+        if (zs == null) {
+            return null;
+        }
+
+        double min = Double.MAX_VALUE;
+        double max = Double.NEGATIVE_INFINITY;
+
+        for (int i = 0; i < zs.length; i++) {
+            if (zs[i] > max) {
+                max = zs[i];
+            }
+
+            if (zs[i] < min) {
+                min = zs[i];
+            }
+        }
+
+        return new double[] { min, max };
+    }
+    public static File getDbfFile(File shpFile){
+    	String str = shpFile.getAbsolutePath();
+		File directory=shpFile.getParentFile();
+		File[] files=new File[0];
+		if (directory!=null){
+			MyFileFilter myFileFilter = new MyFileFilter(str);
+			files=directory.listFiles(myFileFilter);
+		}
+		String[] ends=new String[] {"dbf","DBF","Dbf","dBf","DBf","dbF","DbF","dBF"};
+		File dbfFile=findEnd(str,files,ends);
+		return dbfFile;
+    }
+
+    public static File getShpFile(File dbfFile){
+    	String str = dbfFile.getAbsolutePath();
+		File directory=dbfFile.getParentFile();
+		File[] files=new File[0];
+		if (directory!=null){
+			MyFileFilter myFileFilter = new MyFileFilter(str);
+			files=directory.listFiles(myFileFilter);
+		}
+		String[] ends=new String[] {"shp","SHP","Shp","sHp","SHp","shP","ShP","sHP"};
+		File shpFile=findEnd(str,files,ends);
+		return shpFile;
+    }
+
+    public static File getShxFile(File shpFile){
+    	String str = shpFile.getAbsolutePath();
+		File directory=shpFile.getParentFile();
+		File[] files=new File[0];
+		if (directory!=null){
+			MyFileFilter myFileFilter = new MyFileFilter(str);
+			files=directory.listFiles(myFileFilter);
+		}
+		String[] ends=new String[] {"shx","SHX","Shx","sHx","SHx","shX","ShX","sHX"};
+		File shxFile=findEnd(str,files,ends);
+		return shxFile;
+    }
+
+    public static File getPrjFile(File shpFile) {
+		String str = shpFile.getAbsolutePath();
+		File directory = shpFile.getParentFile();
+		File[] files = new File[0];
+		if (directory != null) {
+			MyFileFilter myFileFilter = new MyFileFilter(str);
+			files = directory.listFiles(myFileFilter);
+		}
+		String[] ends = new String[] { "prj", "PRJ", "Prj", "pRj", "PRj",
+				"prJ", "PrJ", "pRJ" };
+		File shxFile = findEnd(str, files, ends);
+		return shxFile;
+	}
+
+    private static File findEnd(String str,File[] files, String[] ends) {
+    	for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[0])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[1])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[2])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[3])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[4])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[5])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[6])) {
+				return dbfFile;
+			}
+		}
+		for (int i=0;i<files.length;i++) {
+			File dbfFile=files[i];
+			if (dbfFile.getAbsolutePath().endsWith(ends[7])) {
+				return dbfFile;
+			}
+		}
+		return new File(removeExtension(str)+"."+ends[0]);
+    }
+    
+    private static String removeExtension(String fname){
+    	int i = fname.lastIndexOf(".");
+    	if (i<0){
+    		return fname;
+    	}
+    	return fname.substring(0,i);
+    }
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHP.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFile.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFile.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFile.java	(revision 38736)
@@ -0,0 +1,705 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.FileNotFoundException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.store.shp.SHPStoreParameters;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.aggregate.MultiPoint;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Curve;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.primitive.Surface;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException;
+import org.gvsig.fmap.geom.type.GeometryTypeNotValidException;
+import org.gvsig.utils.bigfile.BigByteBuffer2;
+
+/**
+ * @author jmvivo
+ * 
+ */
+public class SHPFile {
+
+    private static final Logger logger = LoggerFactory.getLogger(SHPFile.class);
+    private Envelope extent;
+    private int type;
+    private int subType;
+    private String srsParameters;
+
+    private FileInputStream fin;
+    private FileChannel channel;
+    private BigByteBuffer2 bb;
+    private FileInputStream finShx;
+    private FileChannel channelShx;
+    private BigByteBuffer2 bbShx;
+
+    private SHPStoreParameters params;
+
+    private int[] supportedGeometryTypes;
+    private final GeometryManager gManager = GeometryLocator
+        .getGeometryManager();
+
+    private GeometryType gtypeNull;
+    private GeometryType gtypePoint2D;
+    private GeometryType gtypeCurve2D;
+    private GeometryType gtypeSurface2D;
+    private GeometryType gtypeMultiPoint2D;
+
+    public SHPFile(SHPStoreParameters params) {
+        this.params = params;
+        try {
+            gtypeNull = gManager.getGeometryType(TYPES.NULL, SUBTYPES.GEOM2D);
+            gtypePoint2D =
+                gManager.getGeometryType(TYPES.POINT, SUBTYPES.GEOM2D);
+            gtypeCurve2D =
+                gManager.getGeometryType(TYPES.CURVE, SUBTYPES.GEOM2D);
+            gtypeSurface2D =
+                gManager.getGeometryType(TYPES.SURFACE, SUBTYPES.GEOM2D);
+            gtypeMultiPoint2D =
+                gManager.getGeometryType(TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
+
+        } catch (GeometryTypeNotSupportedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (GeometryTypeNotValidException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.fmap.dal.Resource#doClose()
+     */
+    public void close() throws CloseException {
+        CloseException ret = null;
+
+        // FIXME: Arreglar esto para que se acumulen los errores
+        try {
+            channel.close();
+            channelShx.close();
+        } catch (IOException e) {
+            ret = new CloseException("SHPFile.close", e);
+        } finally {
+            try {
+                fin.close();
+                finShx.close();
+            } catch (IOException e1) {
+                ret = new CloseException("SHPFile.close", e1);
+            }
+        }
+
+        if (ret != null) {
+            throw ret;
+        }
+        bb = null;
+        bbShx = null;
+        fin = null;
+        finShx = null;
+        channel = null;
+        channelShx = null;
+        srsParameters = null;
+    }
+
+    public boolean isOpen() {
+        return this.fin != null;
+    }
+
+    public synchronized void open() throws DataException {
+        try {
+            fin = new FileInputStream(this.params.getSHPFile());
+        } catch (java.io.FileNotFoundException e) {
+            throw new FileNotFoundException(this.params.getSHPFileName());
+        }
+
+        // Open the file and then get a channel from the stream
+        channel = fin.getChannel();
+
+        // long size = channel.size();
+
+        // Get the file's size and then map it into memory
+        // bb = channel.map(FileChannel.MapMode.READ_ONLY, 0, size);
+        try {
+            bb = new BigByteBuffer2(channel, FileChannel.MapMode.READ_ONLY);
+        } catch (IOException e) {
+            throw new ReadException(this.params.getSHPFileName(), e);
+
+        }
+        try {
+            finShx = new FileInputStream(this.params.getSHXFile());
+        } catch (java.io.FileNotFoundException e) {
+            throw new FileNotFoundException(this.params.getSHXFileName());
+        }
+
+        // Open the file and then get a channel from the stream
+        channelShx = finShx.getChannel();
+
+        // long sizeShx = channelShx.size();
+
+        // Get the file's size and then map it into memory
+        // bb = channel.map(FileChannel.MapMode.READ_ONLY, 0, size);
+        // bbShx = channelShx.map(FileChannel.MapMode.READ_ONLY, 0, sizeShx);
+        try {
+            bbShx =
+                new BigByteBuffer2(channelShx, FileChannel.MapMode.READ_ONLY);
+        } catch (IOException e) {
+            throw new ReadException(this.params.getSHXFileName(), e);
+
+        }
+        bbShx.order(ByteOrder.BIG_ENDIAN);
+
+        // create a new header.
+        ShapeFileHeader2 myHeader = new ShapeFileHeader2();
+
+        bb.position(0);
+
+        // read the header
+        myHeader.readHeader(bb);
+
+        double[] min = new double[2];
+        min[0] = myHeader.myXmin;
+        min[1] = myHeader.myYmin;
+        double[] max = new double[2];
+        max[0] = myHeader.myXmax;
+        max[1] = myHeader.myYmax;
+
+        try {
+            extent =
+                gManager.createEnvelope(min[0], min[1], max[0], max[1],
+                    SUBTYPES.GEOM2D);
+        } catch (CreateEnvelopeException e1) {
+            logger.error("Error creating the envelope", e1);
+        }
+        // extent = new Rectangle2D.Double(myHeader.myXmin, myHeader.myYmin,
+        // myHeader.myXmax - myHeader.myXmin,
+        // myHeader.myYmax - myHeader.myYmin);
+
+        type = myHeader.myShapeType;
+        subType = getGeometrySubType();
+
+        this.initSupportedGeometryTypes();
+
+        double x = myHeader.myXmin;
+        double y = myHeader.myYmin;
+        double w = myHeader.myXmax - myHeader.myXmin;
+        double h = myHeader.myYmax - myHeader.myYmin;
+
+        if (w == 0) {
+            x -= 0.1;
+            w = 0.2;
+        }
+
+        if (h == 0) {
+            y -= 0.1;
+            h = 0.2;
+        }
+
+        // TODO: SRS
+        File prjFile = SHP.getPrjFile(this.params.getSHPFile());
+        if (prjFile.exists()) {
+            BufferedReader input = null;
+            try {
+                input = new BufferedReader(new FileReader(prjFile));
+            } catch (java.io.FileNotFoundException e) {
+                throw new FileNotFoundException(prjFile.getAbsolutePath());
+            }
+
+            try {
+                this.srsParameters = input.readLine();
+            } catch (IOException e) {
+                throw new ReadException("SHPFile.open prj", e);
+            } finally {
+                try {
+                    input.close();
+                } catch (IOException e) {
+                    // TODO ???
+                }
+            }
+
+        } else {
+            this.srsParameters = null;
+        }
+    }
+
+    public Envelope getFullExtent() throws ReadException {
+        return this.extent;
+    }
+
+    public boolean isEditable() {
+        return this.params.getDBFFile().canWrite()
+            && this.params.getSHPFile().canWrite()
+            && this.params.getSHXFile().canWrite();
+    }
+
+    public int getGeometryType() throws ReadException {
+        int auxType = 0;
+
+        switch (type) {
+        case (SHP.POINT2D):
+        case (SHP.POINT3D):
+            auxType = auxType | Geometry.TYPES.POINT;
+
+            break;
+
+        case (SHP.POLYLINE2D):
+        case (SHP.POLYLINE3D):
+            auxType = auxType | Geometry.TYPES.MULTICURVE;
+
+            break;
+
+        case (SHP.POLYGON2D):
+        case (SHP.POLYGON3D):
+            auxType = auxType | Geometry.TYPES.MULTISURFACE;
+
+            break;
+        case (SHP.MULTIPOINT2D):
+        case (SHP.MULTIPOINT3D):
+            auxType = auxType | Geometry.TYPES.MULTIPOINT;
+
+            break;
+        }
+
+        return auxType;
+    }
+
+    public int getGeometrySubType() throws ReadException {
+        switch (type) {
+        case (SHP.POINT2D):
+        case (SHP.POLYLINE2D):
+        case (SHP.POLYGON2D):
+        case (SHP.MULTIPOINT2D):
+            return SUBTYPES.GEOM2D;
+        case (SHP.POINT3D):
+        case (SHP.POLYLINE3D):
+        case (SHP.POLYGON3D):
+        case (SHP.MULTIPOINT3D):
+            return SUBTYPES.GEOM3D;
+        case (SHP.POINTM):
+        case (SHP.POLYLINEM):
+        case (SHP.POLYGONM):
+        case (SHP.MULTIPOINTM):
+            return SUBTYPES.GEOM2DM;
+        }
+
+        return SUBTYPES.UNKNOWN;
+    }
+
+    public synchronized Geometry getGeometry(long position)
+        throws ReadException, CreateGeometryException {
+        int shapeType;
+
+        bb.position(getPositionForRecord(position));
+        bb.order(ByteOrder.LITTLE_ENDIAN);
+
+        shapeType = bb.getInt();
+        // el shape tal con tema tal y n�mro tal es null
+        if (shapeType == SHP.NULL) {
+            return gtypeNull.create();
+        }
+
+        // retrieve that shape.
+        // tempRecord.setShape(readShape(tempShapeType, tempContentLength, in));
+        switch (type) {
+        case (SHP.POINT2D):
+        case (SHP.POINT3D):
+        case (SHP.POINTM):
+            Point point = readPoint(bb);
+            fillPoint(point);
+            return point;
+
+        case (SHP.POLYLINE2D):
+            Curve curve = (Curve) gtypeCurve2D.create();
+            fillCurve(curve);
+            return curve;
+
+        case (SHP.POLYGON2D):
+            Surface surface = (Surface) gtypeSurface2D.create();
+            fillSurface(surface);
+            return surface;
+
+        case (SHP.POLYLINE3D):
+            Curve curve3D =
+                (Curve) gManager.create(TYPES.CURVE, SUBTYPES.GEOM3D);
+            fillCurve(curve3D);
+            fillZ(curve3D);
+            return curve3D;
+
+        case (SHP.POLYGON3D):
+            Surface surface3D =
+                (Surface) gManager.create(TYPES.SURFACE, SUBTYPES.GEOM3D);
+            fillSurface(surface3D);
+            fillZ(surface3D);
+            return surface3D;
+
+        case (SHP.MULTIPOINT2D):
+
+            Point p = null;
+            int numPoints;
+            int i;
+            int j;
+            bb.position(bb.position() + 32);
+            numPoints = bb.getInt();
+
+            Point[] points = new Point[numPoints];
+
+            for (i = 0; i < numPoints; i++) {
+                points[i] =
+                    (Point) gManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
+                points[i].setX(bb.getDouble());
+                points[i].setY(bb.getDouble());
+            }
+
+            MultiPoint multipoint = (MultiPoint) gtypeMultiPoint2D.create();
+            // MultiPoint multipoint =
+            // (MultiPoint)GeometryLocator.getGeometryManager().create(TYPES.MULTIPOINT,
+            // SUBTYPES.GEOM2D);
+            for (int k = 0; k < points.length; k++) {
+                multipoint.addPoint(points[k]);
+            }
+
+            return multipoint;
+
+        case (SHP.MULTIPOINT3D):
+            bb.position(bb.position() + 32);
+            numPoints = bb.getInt();
+
+            double[] temX = new double[numPoints];
+            double[] temY = new double[numPoints];
+            double[] temZ = new double[numPoints];
+
+            for (i = 0; i < numPoints; i++) {
+                temX[i] = bb.getDouble();
+                temY[i] = bb.getDouble();
+                // temZ[i] = bb.getDouble();
+            }
+
+            for (i = 0; i < numPoints; i++) {
+                temZ[i] = bb.getDouble();
+            }
+
+            MultiPoint multipoint3D =
+                (MultiPoint) gManager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM3D);
+            for (int k = 0; k < temX.length; k++) {
+                Point pointAux =
+                    (Point) gManager.create(TYPES.POINT, SUBTYPES.GEOM3D);
+                pointAux.setX(temX[k]);
+                pointAux.setY(temY[k]);
+                pointAux.setCoordinateAt(2, temZ[k]);
+                multipoint3D.addPoint(pointAux);
+            }
+            return multipoint3D;
+        }
+
+        return null;
+    }
+
+    private synchronized void fillPoint(Point point) throws ReadException {
+        if (subType == Geometry.SUBTYPES.GEOM3D) {
+            point.setCoordinateAt(Geometry.DIMENSIONS.Z, bb.getDouble());
+        } else
+            if (subType == Geometry.SUBTYPES.GEOM2DM) {
+                point.setCoordinateAt(2, bb.getDouble());
+            }
+    }
+
+    private synchronized void fillCurve(Curve curve)
+        throws CreateGeometryException, ReadException {
+        Point p = null;
+        int numParts;
+        int numPoints;
+        int i;
+        int j;
+
+        bb.position(bb.position() + 32);
+        numParts = bb.getInt();
+        numPoints = bb.getInt();
+
+        int[] tempParts = new int[numParts];
+
+        for (i = 0; i < numParts; i++) {
+            tempParts[i] = bb.getInt();
+        }
+
+        j = 0;
+
+        for (i = 0; i < numPoints; i++) {
+            p = readPoint(bb);
+
+            if (i == tempParts[j]) {
+                curve.addMoveToVertex(p);
+
+                if (j < (numParts - 1)) {
+                    j++;
+                }
+            } else {
+                curve.addVertex(p);
+            }
+        }
+    }
+
+    private synchronized void fillSurface(Surface surface)
+        throws CreateGeometryException, ReadException {
+        Point p = null;
+        int numParts;
+        int numPoints;
+        int i;
+        int partIndex;
+
+        bb.position(bb.position() + 32);
+        numParts = bb.getInt();
+        numPoints = bb.getInt();
+
+        int[] tempParts = new int[numParts];
+
+        for (i = 0; i < numParts; i++) {
+            tempParts[i] = bb.getInt();
+        }
+
+        partIndex = 0;
+
+        for (i = 0; i < numPoints; i++) {
+            p = readPoint(bb);
+
+            if (i == tempParts[partIndex]) {
+                surface.addMoveToVertex(p);
+                if (partIndex < (numParts - 1)) {
+                    partIndex++;
+                }
+            } else {
+                if ((i == tempParts[partIndex] - 1) || (i == numPoints - 1)) {
+                    surface.closePrimitive();
+                } else {
+                    surface.addVertex(p);
+                }
+            }
+        }
+    }
+
+    private synchronized void fillZ(OrientablePrimitive orientablePrimitive)
+        throws CreateGeometryException, ReadException {
+        double[] boxZ = new double[2];
+        boxZ[0] = bb.getDouble();
+        boxZ[1] = bb.getDouble();
+
+        for (int i = 0; i < orientablePrimitive.getNumVertices(); i++) {
+            orientablePrimitive.setCoordinateAt(i, 2, bb.getDouble());
+        }
+    }
+
+    private long getPositionForRecord(long numRec) {
+        // shx file has a 100 bytes header, then, records
+        // 8 bytes length, one for each entity.
+        // first 4 bytes are the offset
+        // next 4 bytes are length
+
+        int posIndex = 100 + ((int) numRec * 8);
+        // bbShx.position(posIndex);
+        long pos = 8 + 2 * bbShx.getInt(posIndex);
+
+        return pos;
+    }
+
+    /**
+     * Reads the Point from the shape file.
+     * 
+     * @param in
+     *            ByteBuffer.
+     * 
+     * @return Point2D.
+     * @throws ReadException
+     * @throws CreateGeometryException
+     */
+    private synchronized Point readPoint(BigByteBuffer2 in)
+        throws CreateGeometryException, ReadException {
+        // create a new point
+        // Point2D.Double tempPoint = new Point2D.Double();
+
+        // bytes 1 to 4 are the type and have already been read.
+        // bytes 4 to 12 are the X coordinate
+        in.order(ByteOrder.LITTLE_ENDIAN);
+        return gManager.createPoint(in.getDouble(), in.getDouble(), subType);
+    }
+
+    /**
+     * Lee un rect�ngulo del fichero.
+     * 
+     * @param in
+     *            ByteBuffer.
+     * 
+     * @return Rect�ngulo.
+     * @throws CreateEnvelopeException
+     * 
+     * @throws IOException
+     */
+    private synchronized Envelope readRectangle(BigByteBuffer2 in)
+        throws CreateEnvelopeException {
+        in.order(ByteOrder.LITTLE_ENDIAN);
+        double x = in.getDouble();
+        double y = in.getDouble();
+
+        double x2 = in.getDouble();
+
+        if (x2 - x == 0) {
+            x2 += 0.2;
+            x -= 0.1;
+        }
+
+        double y2 = in.getDouble();
+
+        if (y2 - y == 0) {
+            y2 += 0.2;
+            y -= 0.1;
+        }
+        Envelope tempEnvelope =
+            gManager.createEnvelope(x, y, x2, y2, SUBTYPES.GEOM2D);
+        return tempEnvelope;
+    }
+
+    public synchronized Envelope getBoundingBox(long featureIndex)
+        throws ReadException, CreateEnvelopeException, CreateGeometryException {
+        Point p = null;
+        Envelope BoundingBox = null;
+        try {
+            bb.position(getPositionForRecord(featureIndex));
+        } catch (Exception e) {
+            throw new ReadException("getBondingBox (" + featureIndex + ")", e);
+            // logger.error(" Shapefile is corrupted. Drawing aborted. ="+e+
+            // "  "+"index = "+index);
+        }
+        bb.order(ByteOrder.LITTLE_ENDIAN);
+
+        int tipoShape = bb.getInt();
+
+        // AZABALA: si tipoShape viene con valores erroneos deja de funcionar
+        // el metodo getShape(i)
+        // if (tipoShape != SHP.NULL) {
+        // type = tipoShape;
+
+        // }
+
+        // retrieve that shape.
+        // tempRecord.setShape(readShape(tempShapeType, tempContentLength, in));
+        switch (tipoShape) {
+        case (SHP.POINT2D):
+        case (SHP.POINT3D):
+            p = readPoint(bb);
+            BoundingBox =
+                gManager.createEnvelope(p.getX() - 0.1, p.getY() - 0.1,
+                    p.getX() + 0.2, p.getY() + 0.2, SUBTYPES.GEOM2D);
+            // new Rectangle2D.Double(p.getX() - 0.1,
+            // p.getY() - 0.1, 0.2, 0.2);
+
+            break;
+
+        case (SHP.POLYLINE2D):
+        case (SHP.POLYGON2D):
+        case (SHP.MULTIPOINT2D):
+        case (SHP.POLYLINE3D):
+        case (SHP.POLYGON3D):
+        case (SHP.MULTIPOINT3D):
+
+            // BoundingBox
+            BoundingBox = readRectangle(bb);
+
+            break;
+        }
+
+        return BoundingBox;
+    }
+
+    /**
+     * @return
+     */
+    public String getSRSParameters() {
+        return this.srsParameters;
+    }
+
+    private void initSupportedGeometryTypes() throws ReadException {
+        switch (this.getGeometryType()) {
+        case Geometry.TYPES.POINT:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.POINT, Geometry.TYPES.NULL };
+            break;
+        case Geometry.TYPES.MULTIPOINT:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.MULTIPOINT, Geometry.TYPES.NULL };
+            break;
+        case Geometry.TYPES.MULTICURVE:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.CURVE, Geometry.TYPES.ELLIPSE,
+                    Geometry.TYPES.ARC, Geometry.TYPES.CIRCLE,
+                    Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
+                    Geometry.TYPES.MULTICURVE };
+            break;
+        case Geometry.TYPES.MULTISURFACE:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.ELLIPSE, Geometry.TYPES.CIRCLE,
+                    Geometry.TYPES.SURFACE, Geometry.TYPES.NULL,
+                    Geometry.TYPES.MULTISURFACE };
+            break;
+
+        default:
+            supportedGeometryTypes = new int[] {};
+        }
+    }
+
+    public boolean canWriteGeometry(int gvSIGgeometryType) {
+        for (int i = 0; i < supportedGeometryTypes.length; i++) {
+            if (gvSIGgeometryType == supportedGeometryTypes[i]) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPFile.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/MyFileFilter.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/MyFileFilter.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/MyFileFilter.java	(revision 38736)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.io.File;
+import java.io.FileFilter;
+
+public class MyFileFilter implements FileFilter {
+	private String shpPath;
+	public MyFileFilter(String shpPath){
+		this.shpPath=shpPath;
+	}
+	public boolean accept(File pathname) {
+		String strend=pathname.getAbsolutePath();
+		strend=strend.substring(0,strend.length()-3);
+		String strshp=shpPath.substring(0, shpPath.length() - 3);
+		if (strend.equals(strshp)) {
+			return true;
+		}
+		return false;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/MyFileFilter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPShape.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPShape.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPShape.java	(revision 38736)
@@ -0,0 +1,96 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+import org.gvsig.fmap.geom.Geometry;
+
+/**
+ * Interfaz de todos los tipos de formato shape.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public interface SHPShape {
+	/**
+	 * Devuelve el tipo de shape de que se trata.
+	 *
+	 * @return Tipo de shape.
+	 */
+	public int getShapeType();
+
+	/**
+	 * Lee del buffer el shape y crea una nueva geometr�a.
+	 *
+	 * @param buffer Buffer de donde se lee.
+	 * @param type Tipo de shape en concreto.
+	 *
+	 * @return Nueva geometr�a.
+	 */
+	public Geometry read(MappedByteBuffer buffer, int type);
+
+	/**
+	 * Escribe en el buffer la geometr�a que se pasa como par�metro.
+	 *
+	 * @param buffer Buffer donde escribir.
+	 * @param geometry Geometr�a a escribir.
+	 */
+	public void write(ByteBuffer buffer, Geometry geometry);
+
+	/**
+	 * Devuelve el tama�o de la geometr�a.
+	 *
+	 * @param fgeometry Geometr�a a medir.
+	 *
+	 * @return Tama�o de la geometr�a.
+	 */
+	public int getLength(Geometry fgeometry);
+
+	/**
+	 * Obtiene los puntos y partes del GeneralPathXIterator del shape.
+	 *
+	 * @param iter
+	 */
+	public void obtainsPoints(Geometry g);
+
+//	public void setFlatness(double flatness);
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPShape.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/ShapeFileHeader2.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/ShapeFileHeader2.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/ShapeFileHeader2.java	(revision 38736)
@@ -0,0 +1,321 @@
+/*
+ *    GISToolkit - Geographical Information System Toolkit
+ *    (C) 2002, Ithaqua Enterprises Inc.
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.gvsig.utils.bigfile.BigByteBuffer2;
+
+
+
+/**
+ * Class to represent the header in the shape file.
+ */
+public class ShapeFileHeader2 {
+    /**
+     * Shape Type Value Shape Type 0 Null Shape 1 Point 3 PolyLine 5 Polygon 8
+     * MultiPoint 11 PointZ 13 PolyLineZ 15 PolygonZ 18 MultiPointZ 21 PointM
+     * 23 PolyLineM 25 PolygonM 28 MultiPointM 31 MultiPatch
+     */
+
+    /* The null shape type, there is no shape for this record. */
+    public static final int SHAPE_NULL = 0;
+    public static final int SHAPE_POINT = 1;
+    public static final int SHAPE_POLYLINE = 3;
+    public static final int SHAPE_POLYGON = 5;
+    public static final int SHAPE_MULTIPOINT = 8;
+    public static final int SHAPE_POINTZ = 11;
+    public static final int SHAPE_POLYLINEZ = 13;
+    public static final int SHAPE_POLYGONZ = 15;
+    public static final int SHAPE_MULTIPOINTZ = 18;
+    public static final int SHAPE_POINTM = 21;
+    public static final int SHAPE_POLYLINEM = 23;
+    public static final int SHAPE_POLYGONM = 25;
+    public static final int SHAPE_MULTIPOINTM = 28;
+    public static final int SHAPE_MULTIPATCH = 31;
+
+    /** File Code, must be the value 9994 */
+    public int myFileCode = 9994;
+
+    /** Unused 1; */
+    public int myUnused1 = 0;
+
+    /** Unused 2; */
+    public int myUnused2 = 0;
+
+    /** Unused 3; */
+    public int myUnused3 = 0;
+
+    /** Unused 4; */
+    public int myUnused4 = 0;
+
+    /** Unused 5; */
+    public int myUnused5 = 0;
+
+    /** File Length; */
+    public int myFileLength = 0;
+
+    /** Version of the file. */
+    public int myVersion = 1000;
+    public int myShapeType = 0;
+
+    /** BoundingBox Xmin */
+    public double myXmin = 0;
+
+    /** BoundingBox Ymin */
+    public double myYmin = 0;
+
+    /** BoundingBox Xmax */
+    public double myXmax = 0;
+
+    /** BoundingBox Ymax */
+    public double myYmax = 0;
+
+    /** BoundingBox Zmin */
+    public double myZmin = 0;
+
+    /** BoundingBox Zmax */
+    public double myZmax = 0;
+
+    /** BoundingBox Zmin */
+    public double myMmin = 0;
+
+    /** BoundingBox Zmax */
+    public double myMmax = 0;
+
+    // notify about warnings.
+    private boolean myWarning = true;
+
+    /**
+     * ShapeFileHeader constructor comment.
+     */
+    public ShapeFileHeader2() {
+        super();
+    }
+
+    /**
+     * Return the file code.
+     *
+     * @return Entero.
+     */
+    public int getFileCode() {
+        return myFileCode;
+    }
+
+    /**
+     * Return the version of the file.
+     *
+     * @return Versi�n.
+     */
+    public int getVersion() {
+        return myVersion;
+    }
+
+    /**
+     * Get the extents of the shape file.
+     *
+     * @return FullExtent.
+     */
+    public java.awt.geom.Rectangle2D.Double getFileExtents() {
+        return new java.awt.geom.Rectangle2D.Double(myXmin, myYmin,
+            myXmax - myXmin, myYmax - myYmin);
+    }
+
+    /**
+     * Print warnings to system.out.
+     *
+     * @param inWarning boolean.
+     */
+    public void setWarnings(boolean inWarning) {
+        myWarning = inWarning;
+    }
+
+    /**
+     * Return the length of the header in 16 bit words..
+     *
+     * @return Longitud de la cabecera.
+     */
+    public int getHeaderLength() {
+        return 50;
+    }
+
+    /**
+     * Return the number of 16 bit words in the shape file as recorded in the
+     * header
+     *
+     * @return Longitud del fichero.
+     */
+    public int getFileLength() {
+        return myFileLength;
+    }
+
+    /**
+     * Read the header from the shape file.
+     *
+     * @param in ByteBuffer.
+     */
+    public void readHeader(BigByteBuffer2 in) {
+        // the first four bytes are integers
+        // in.setLittleEndianMode(false);
+        in.order(ByteOrder.BIG_ENDIAN);
+        myFileCode = in.getInt();
+
+        if (myFileCode != 9994) {
+            warn("File Code = " + myFileCode + " Not equal to 9994");
+        }
+
+        // From 4 to 8 are unused.
+        myUnused1 = in.getInt();
+
+        // From 8 to 12 are unused.
+        myUnused2 = in.getInt();
+
+        // From 12 to 16 are unused.
+        myUnused3 = in.getInt();
+
+        // From 16 to 20 are unused.
+        myUnused4 = in.getInt();
+
+        // From 20 to 24 are unused.
+        myUnused5 = in.getInt();
+
+        // From 24 to 28 are the file length.
+        myFileLength = in.getInt();
+
+        // From 28 to 32 are the File Version.
+        in.order(ByteOrder.LITTLE_ENDIAN);
+        myVersion = in.getInt();
+
+        // From 32 to 36 are the Shape Type.
+        myShapeType = in.getInt();
+
+        // From 36 to 44 are Xmin.
+        myXmin = in.getDouble(); // Double.longBitsToDouble(in.getLong());
+
+        // From 44 to 52 are Ymin.
+        myYmin = in.getDouble();
+
+        // From 52 to 60 are Xmax.
+        myXmax = in.getDouble();
+
+        // From 60 to 68 are Ymax.
+        myYmax = in.getDouble();
+
+        // From 68 to 76 are Zmin.
+        myZmin = in.getDouble();
+
+        // From 76 to 84 are Zmax.
+        myZmax = in.getDouble();
+
+        // From 84 to 92 are Mmin.
+        myMmin = in.getDouble();
+
+        // From 92 to 100 are Mmax.
+        myMmax = in.getDouble();
+
+        // that is all 100 bytes of the header.
+    }
+    public void write(ByteBuffer out,int type,
+  		  int numGeoms,int length,double minX,double minY,double maxX,double maxY,double minZ,double maxZ,double minM,double maxM){
+  		    out.order(ByteOrder.BIG_ENDIAN);
+
+  		    out.putInt(myFileCode);
+
+  		    for (int i = 0; i < 5; i++) {
+  		      out.putInt(0); //Skip unused part of header
+  		    }
+
+  		    out.putInt(length);
+
+  		    out.order(ByteOrder.LITTLE_ENDIAN);
+
+  		    out.putInt(myVersion);
+  		    out.putInt(type);
+
+  		    //write the bounding box
+  		    out.putDouble(minX);
+  		    out.putDouble(minY);
+  		    out.putDouble(maxX);
+  		    out.putDouble(maxY);
+  		    /*
+  		    out.putDouble(minZ);
+  		    out.putDouble(minZ);
+  		    out.putDouble(maxM);
+  		    out.putDouble(maxM);*/
+  		    out.order(ByteOrder.BIG_ENDIAN);
+  		    for (int i = 0; i < 8; i++) {
+  		      out.putInt(0); //Skip unused part of header
+  		    }
+
+  		  }
+
+    /**
+     * Muestra por consola los warning.
+     *
+     * @param inWarn warning.
+     */
+    private void warn(String inWarn) {
+        if (myWarning) {
+            System.out.print("WARNING: ");
+            System.out.println(inWarn);
+        }
+    }
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/ShapeFileHeader2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiLine.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiLine.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiLine.java	(revision 38736)
@@ -0,0 +1,406 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.store.shp.utils;
+
+import java.awt.geom.PathIterator;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Curve;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.primitive.Primitive;
+
+
+/**
+ * Elemento shape de tipo multil�nea.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SHPMultiLine implements SHPShape {
+	protected int m_type;
+	protected int[] parts;
+	protected Point[] points;
+	protected double[] zs;
+	//double flatness = 0.8; // Por ejemplo. Cuanto m�s peque�o, m�s segmentos necesitar� la curva
+	private GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(SHPShape.class);
+
+	/**
+	 * Crea un nuevo SHPMultiLine.
+	 */
+	public SHPMultiLine() {
+		m_type = SHP.POLYLINE2D;
+	}
+
+	/**
+	 * Crea un nuevo SHPMultiLine.
+	 *
+	 * @param type Tipo de multil�nea.
+	 *
+	 * @throws ShapefileException
+	 */
+	public SHPMultiLine(int type) {
+		if ((type != SHP.POLYLINE2D) &&
+				(type != SHP.POLYLINEM) &&
+				(type != SHP.POLYLINE3D)) {
+//			throw new ShapefileException("No es de tipo 3,13 ni 23");
+		}
+
+		m_type = type;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getShapeType()
+	 */
+	public int getShapeType() {
+		return m_type;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#read(MappedByteBuffer, int)
+	 */
+	public Geometry read(MappedByteBuffer buffer, int type) {
+//		double minX = buffer.getDouble();
+//		double minY = buffer.getDouble();
+//		double maxX = buffer.getDouble();
+//		double maxY = buffer.getDouble();
+//		Rectangle2D rec = new Rectangle2D.Double(minX, minY, maxX - minX, maxY
+//				- maxY);
+
+		int numParts = buffer.getInt();
+		int numPoints = buffer.getInt(); //total number of points
+
+		int[] partOffsets = new int[numParts];
+
+		for (int i = 0; i < numParts; i++) {
+			partOffsets[i] = buffer.getInt();
+		}
+
+		Point[] points = new Point[numPoints];
+
+		for (int t = 0; t < numPoints; t++) {
+			try {
+				points[t] = (Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
+				points[t] = (Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
+				points[t].setX(buffer.getDouble());
+				points[t].setY(buffer.getDouble());
+			} catch (CreateGeometryException e) {
+				logger.error("Error creating a point",e);
+			}
+		}
+
+		/*   if (type == FConstant.SHAPE_TYPE_POLYLINEZ) {
+		   //z min, max
+		   buffer.position(buffer.position() + (2 * 8));
+		   for (int t = 0; t < numPoints; t++) {
+		       points[t].z = buffer.getDouble(); //z value
+		   }
+		   }
+		 */
+		Curve curve = null;
+		try {
+			curve = (Curve)geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
+			curve.setGeneralPath(getGeneralPathX(points, partOffsets));
+		} catch (CreateGeometryException e) {
+			logger.error("Error creating the curve",e);
+		}
+		return curve;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry)
+	 */
+	public void write(ByteBuffer buffer, Geometry geometry) {
+		Envelope env = geometry.getEnvelope();
+
+		buffer.putDouble(env.getMinimum(0));
+		buffer.putDouble(env.getMinimum(1));
+		buffer.putDouble(env.getMaximum(0));
+		buffer.putDouble(env.getMaximum(1));
+		int numParts = parts.length;
+		int npoints = points.length;
+		buffer.putInt(numParts);
+		buffer.putInt(npoints);
+
+		for (int i = 0; i < numParts; i++) {
+			buffer.putInt(parts[i]);
+		}
+
+		for (int t = 0; t < npoints; t++) {
+			buffer.putDouble(points[t].getX());
+			buffer.putDouble(points[t].getY());
+		}
+
+		  if (m_type == SHP.POLYLINE3D) {
+		   double[] zExtreame = SHP.getZMinMax(zs);
+		   if (Double.isNaN(zExtreame[0])) {
+		       buffer.putDouble(0.0);
+		       buffer.putDouble(0.0);
+		   } else {
+		       buffer.putDouble(zExtreame[0]);
+		       buffer.putDouble(zExtreame[1]);
+		   }
+		   for (int t = 0; t < npoints; t++) {
+		       double z = zs[t];
+		       if (Double.isNaN(z)) {
+		           buffer.putDouble(0.0);
+		       } else {
+		           buffer.putDouble(z);
+		       }
+		   }
+
+		   }
+		   if (m_type == SHP.POLYLINEM) {
+		       buffer.putDouble(-10E40);
+		       buffer.putDouble(-10E40);
+		       for (int t = 0; t < npoints; t++) {
+		           buffer.putDouble(-10E40);
+		       }
+		   }
+
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(int)
+	 */
+	public int getLength(Geometry fgeometry) {
+		int numlines;
+		int numpoints;
+		int length;
+
+		numlines = parts.length;
+		numpoints = points.length;
+		if (m_type == SHP.POLYLINE2D) {
+			length = 44 + (4 * numlines) + (numpoints * 16);
+		} else if (m_type == SHP.POLYLINEM) {
+			length = 44 + (4 * numlines) + (numpoints * 16) +
+				(8 * numpoints) + 16;
+		} else if (m_type == SHP.POLYLINE3D) {
+			length = 44 + (4 * numlines) + (numpoints * 16) +
+				(8 * numpoints) + 16;
+		} else {
+			throw new IllegalStateException("Expected ShapeType of Arc, got " +
+				m_type);
+		}
+
+		return length;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param po DOCUMENT ME!
+	 * @param pa DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	protected GeneralPathX getGeneralPathX(Point[] po, int[] pa) {
+		GeneralPathX gPX = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
+				po.length);
+		int j = 0;
+
+		for (int i = 0; i < po.length; i++) {
+			if (i == pa[j]) {
+				gPX.moveTo(po[i].getX(), po[i].getY());
+
+				if (j < (pa.length - 1)) {
+					j++;
+				}
+			} else {
+				gPX.lineTo(po[i].getX(), po[i].getY());
+			}
+		}
+
+		return gPX;
+	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
+	 */
+	public void obtainsPoints(Geometry g) {
+		boolean is3D=false;
+		if ((SHP.POLYLINE3D == m_type) || (SHP.POLYGON3D == m_type)){
+			OrientablePrimitive orientablePrimitive = (OrientablePrimitive)g;
+			zs = new double[orientablePrimitive.getNumVertices()];
+			for (int i=0 ; i<zs.length ; i++){
+				zs[i] = orientablePrimitive.getCoordinateAt(i, 2);
+			}
+			is3D=true;
+		}
+		ArrayList arrayPoints = new ArrayList();
+		ArrayList arrayParts = new ArrayList();
+		ArrayList arrayZs = new ArrayList();
+		
+		if (g.getGeometryType().isTypeOf(Geometry.TYPES.AGGREGATE)){
+		    MultiPrimitive multiPrimitive = (MultiPrimitive)g;
+		    int index = 0;
+		    for (int i=0 ; i<multiPrimitive.getPrimitivesNumber() ; i++){
+		        obtainsPoints(multiPrimitive.getPrimitiveAt(i), arrayPoints, arrayParts, arrayZs, is3D, index);
+		        index += multiPrimitive.getPrimitiveAt(i).getGeneralPath().getNumCoords();
+		    }
+		}else{
+		    obtainsPoints((Primitive)g, arrayPoints, arrayParts, arrayZs, is3D, 0);
+		}	
+		
+		Integer[] integers = (Integer[]) arrayParts.toArray(new Integer[0]);
+        parts = new int[integers.length];
+        for (int i = 0; i < integers.length; i++) {
+            parts[i] = integers[i].intValue();
+        }
+        if (arrayPoints==null){
+            points = new Point[0];
+            return;
+        }
+        points = (Point[]) arrayPoints.toArray(new Point[0]);
+        if (is3D){
+            Double[] doubleZs = (Double[])arrayZs.toArray(new Double[0]);
+            zs = new double[doubleZs.length];
+            for (int i=0;i<doubleZs.length;i++){
+                zs[i]=doubleZs[i].doubleValue();
+            }
+        }
+	}
+	
+	private void obtainsPoints(Primitive primitive, List arrayPoints, List arrayParts, List arrayZs, boolean is3D, int index) {		
+		PathIterator theIterator = primitive.getPathIterator(null, geomManager.getFlatness()); 
+		double[] theData = new double[6];
+		java.awt.geom.Point2D pFirst = null;
+		int pos=0;
+				
+		boolean first = true;
+		
+		Double firstZ = null;
+		while (!theIterator.isDone()) {
+			int theType = theIterator.currentSegment(theData);
+			switch (theType) {
+				case PathIterator.SEG_MOVETO:
+					if (first) {
+						first = false;
+						arrayParts.add(new Integer(index));
+					} else {
+						if (m_type==SHP.POLYGON2D ||
+								m_type==SHP.POLYGON3D ||
+								m_type==SHP.POLYGONM){
+							try {
+								Point point = geomManager.createPoint(pFirst.getX(), pFirst.getY(), SUBTYPES.GEOM2D);
+								if (!arrayPoints.get(arrayPoints.size()-1).equals(point)){
+									arrayPoints.add(point);
+									if (is3D){
+										arrayZs.add(firstZ);
+									}
+								}
+								arrayParts.add(new Integer(arrayPoints.size()));
+							} catch (CreateGeometryException e) {
+								logger.error("Error creating a point", e);
+							}
+						}
+						
+					}
+
+					pFirst = new java.awt.geom.Point2D.Double(theData[0], theData[1]);
+					try {
+						arrayPoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+					} catch (CreateGeometryException e1) {
+						logger.error("Error creating a point", e1);
+					}
+					if (is3D){
+						firstZ=new Double(zs[pos]);
+						arrayZs.add(new Double(zs[pos]));
+						pos++;
+					}
+					break;
+
+				case PathIterator.SEG_LINETO:
+					try {
+						arrayPoints.add(geomManager.createPoint(theData[0], theData[1], SUBTYPES.GEOM2D));
+					} catch (CreateGeometryException e) {
+						logger.error("Error creating a point", e);
+					}
+					if (is3D){
+						arrayZs.add(new Double(zs[pos]));
+						pos++;
+					}
+					break;
+
+				case PathIterator.SEG_QUADTO:
+					System.out.println("Not supported here");
+
+					break;
+
+				case PathIterator.SEG_CUBICTO:
+					System.out.println("Not supported here");
+
+					break;
+
+				case PathIterator.SEG_CLOSE:
+					try{
+						Point point=geomManager.createPoint(pFirst.getX(), pFirst.getY(), SUBTYPES.GEOM2D);
+						if (!arrayPoints.get(arrayPoints.size()-1).equals(point)){
+							arrayPoints.add(point);
+							if (is3D){
+								arrayZs.add(firstZ);
+							}
+						}
+					} catch (CreateGeometryException e) {
+						logger.error("Error creating a point", e);
+					}
+					break;
+			} //end switch
+			index++;
+			theIterator.next();
+		}		
+	}
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPMultiLine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureProvider.java	(revision 38736)
@@ -0,0 +1,78 @@
+package org.gvsig.fmap.dal.store.shp;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadRuntimeException;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+public class SHPFeatureProvider extends DefaultFeatureProvider {
+	protected SHPStoreProvider store;
+	protected boolean loading;
+	protected boolean loaded;
+
+
+	public SHPFeatureProvider(SHPStoreProvider store, FeatureType type) {
+		super(type);
+		this.store = store;
+		loading = false;
+		loaded = false;
+	}
+
+	protected void load() {
+		if (loading || loaded || this.isNew()) {
+			return;
+		}
+		loading = true;
+		try {
+			this.store.loadFeatureProviderByIndex(this);
+		} catch (DataException e) {
+			throw new ReadRuntimeException("DBFFeatureProvider.load", e);
+		} finally {
+			loading = false;
+			loaded = true;
+		}
+	}
+
+	public void set(int i, Object value) {
+		this.load();
+		super.set(i, value);
+	}
+
+	public void set(String name, Object value) {
+		this.load();
+		super.set(featureType.getIndex(name), value);
+	}
+
+	public Object get(int i) {
+		this.load();
+		return super.get(i);
+	}
+
+	public Object get(String name) {
+		this.load();
+		return super.get(name);
+	}
+
+	public Geometry getDefaultGeometry() {
+		this.load();
+		return this.defaultGeometry;
+	}
+
+	public Envelope getDefaultEnvelope() {
+		return this.envelope;
+	}
+
+	public void setOID(Object oid) {
+		this.loaded = false;
+		super.setOID(oid);
+	}
+
+	public FeatureProvider getCopy() {
+		this.load();
+		return super.getCopy();
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFilesystemServerProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFilesystemServerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFilesystemServerProvider.java	(revision 38736)
@@ -0,0 +1,384 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.MultiResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.serverexplorer.filesystem.AbsolutePathRequiredException;
+import org.gvsig.fmap.dal.store.dbf.DBFFilesystemServerProvider;
+
+/**
+ * @author jmvivo
+ * 
+ */
+public class SHPFilesystemServerProvider extends DBFFilesystemServerProvider {
+
+	public boolean accept(File pathname) {
+		return pathname.getName().toLowerCase().endsWith(".shp");
+	}
+	
+	public int getMode() {
+		return DataServerExplorer.MODE_GEOMETRY|DataServerExplorer.MODE_FEATURE;
+	}
+	
+	public boolean canCreate() {
+		return true;
+	}
+
+	// private FileResource[] createResources(File[] files)
+	// throws InitializeException {
+	// FileResource[] result = new FileResource[files.length];
+	// for (int i = 0; i < files.length; i++) {
+	// result[i] = this.createResource(files[i]);
+	// }
+	//
+	// return result;
+	// }
+
+	private ResourceProvider createResource(File shpFile, File[] otherFiles)
+			throws InitializeException {
+
+		Object[] shpParams = new Object[] { shpFile.getAbsolutePath() };
+
+		MultiResource resource =
+				(MultiResource) serverExplorer.getServerExplorerProviderServices()
+						.createResource(MultiResource.TYPE_NAME, shpParams);
+
+		resource.addResource(FileResource.NAME, shpParams, true);
+
+		for (int i = 0; i < otherFiles.length; i++) {
+			resource.addResource(FileResource.NAME,
+					new Object[] { otherFiles[i].getAbsolutePath() }, false);
+		}
+
+		resource.addConsumer(this);
+		return resource;
+	}
+
+	// private FileResource createResource(File file) throws InitializeException
+	// {
+	// FileResource resource;
+	// resource =
+	// (FileResource) this.serverExplorer.getServerExplorerProviderServices()
+	// .createResource(FileResource.NAME,
+	// new Object[] { file.getAbsolutePath() });
+	// resource.addConsumer(this);
+	// return resource;
+	// }
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		if (!super.canCreate(parameters)) {
+			return false;
+		}
+		SHPNewStoreParameters params = (SHPNewStoreParameters) parameters;
+		if (params.getSHPFile().getParentFile().canWrite()) {
+			return false;
+		}
+		if (params.getSHPFile().exists()) {
+			if (!params.getSHPFile().canWrite()) {
+				return false;
+			}
+		}
+		if (params.getSHXFile().getParentFile().canWrite()) {
+			return false;
+		}
+		if (params.getSHXFile().exists()) {
+			if (!params.getSHXFile().canWrite()) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public boolean closeResourceRequested(ResourceProvider resource) {
+		// while it is using a resource anyone can't close it
+		return false;
+	}
+
+	public void create(NewDataStoreParameters parameters, boolean overwrite)
+			throws CreateException {
+
+		final SHPNewStoreParameters params = (SHPNewStoreParameters) parameters;
+		final FeatureType fType;
+		// TODO Comprobar que el campo de geometria
+		final EditableFeatureType dbfFtype;
+		if (params.getDefaultFeatureType() instanceof EditableFeatureType) {
+			fType = params.getDefaultFeatureType();
+			dbfFtype = (EditableFeatureType) fType.getCopy();
+		} else {
+			fType = params.getDefaultFeatureType();
+			dbfFtype = fType.getEditable();
+			params.setDefaultFeatureType(fType.getEditable());
+		}
+
+		SHPStoreProvider.removeGeometryColumn(dbfFtype);
+		EditableFeatureAttributeDescriptor efad = SHPStoreProvider.addGeometryColumn((EditableFeatureType) fType);
+		efad.setGeometryType(params.getGeometryType());
+		
+		File dbfFile = params.getDBFFile();
+		File shpFile = params.getSHPFile();
+		File shxFile = params.getSHXFile();
+		
+		if (!shpFile.isAbsolute()) {
+			throw new AbsolutePathRequiredException(shpFile.getPath());
+		}
+
+		if (!dbfFile.isAbsolute()) {
+			throw new AbsolutePathRequiredException(dbfFile.getPath());
+		}
+		
+		if (!shxFile.isAbsolute()) {
+			throw new AbsolutePathRequiredException(shxFile.getPath());
+		}
+
+		// File[] files = new File[] { shpFile, shxFile, dbfFile };
+		// TODO .prj file
+
+		// FileResource[] resources;
+		ResourceProvider resource;
+		try {
+			// resources =
+			resource = createResource(shpFile, new File[] { shxFile, dbfFile });
+			resource.closeRequest();
+			// closeResources(resources);
+		} catch (DataException e1) {
+			throw new CreateException(shpFile.getPath(), e1);
+		}
+
+		if (shpFile.exists()) {
+			if (overwrite) {
+				// FIXME
+				// if (!shpFile.delete()) {
+				// throw new CreateException(this.getDataStoreProviderName(),
+				// new IOException(
+				// "cannot delete file: " + shpFile.getPath()));
+				// }
+				// if (shxFile.exists()) {
+				// if (!shxFile.delete()) {
+				// throw new CreateException(this.getDataStoreProviderName(),
+				// new IOException("cannot delete file: "
+				// + shxFile.getPath()));
+				// }
+				//
+				// }
+			} else {
+				throw new CreateException(this.getDataStoreProviderName(),
+						new IOException("file already exist"));
+			}
+		}
+
+		try {
+			
+//			beginResources(resources);
+
+			resource.execute(new ResourceAction() {
+				public Object run() throws Exception {
+					SHPFeatureWriter writer =
+							new SHPFeatureWriter(getDataStoreProviderName());
+					
+					writer.begin(params, fType, dbfFtype, 0);
+					
+					writer.end();
+					return null;
+				}
+			});
+
+//			notifyChangesResources(resources);
+			resource.notifyChanges();
+		} catch (Exception e) {
+			throw new CreateException(this.getDataStoreProviderName(), e);
+		} finally {
+			// endResources(resources);
+			// removeConsumer(resources);
+			resource.removeConsumer(this);
+		}
+	}
+
+	// private boolean closeResources(FileResource[] resources)
+	// throws ResourceException {
+	// for (int i = 0; i < resources.length; i++) {
+	// // TODO
+	// // if (!resources[i].closeRequest()){
+	// // return false;
+	// // }
+	// resources[i].closeRequest();
+	// }
+	// return true;
+	//
+	// }
+
+	private void removeConsumer(FileResource[] resources) {
+		for (int i = 0; i < resources.length; i++) {
+			resources[i].removeConsumer(this);
+		}
+	}
+
+	// private void endResources(FileResource[] resources) {
+	// for (int i = 0; i < resources.length; i++) {
+	// resources[i].end();
+	// }
+	// }
+
+	private void notifyChangesResources(FileResource[] resources)
+			throws ResourceNotifyChangesException {
+		for (int i = 0; i < resources.length; i++) {
+			resources[i].notifyChanges();
+		}
+
+	}
+
+	// private void beginResources(FileResource[] resources)
+	// throws ResourceExecuteException {
+	// for (int i = 0; i < resources.length; i++) {
+	// resources[i].begin();
+	// }
+	//
+	// }
+
+	public NewDataStoreParameters getCreateParameters() {
+		SHPNewStoreParameters params =
+				(SHPNewStoreParameters) super.getCreateParameters();
+
+		EditableFeatureType fType =
+				(EditableFeatureType) params.getDefaultFeatureType();
+		// SHPStoreProvider.addGeometryColumn(fType);
+		// params.setDefaultFeatureType(fType);
+		return params;
+	}
+
+	protected NewDataStoreParameters createInstanceNewDataStoreParameters() {
+		return new SHPNewStoreParameters();
+	}
+
+	public String getDataStoreProviderName() {
+		return SHPStoreProvider.NAME;
+	}
+
+	public String getDescription() {
+		return SHPStoreProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		SHPStoreParameters params =
+				(SHPStoreParameters) manager.createStoreParameters(this.getDataStoreProviderName());
+		params.setSHPFile(file.getPath());
+		return params;
+
+	}
+
+	public void remove(DataStoreParameters parameters) throws RemoveException {
+		SHPStoreParameters params = (SHPStoreParameters) parameters;
+
+		final File dbfFile = params.getDBFFile();
+		final File shpFile = params.getSHPFile();
+		final File shxFile = params.getSHXFile();
+		// TODO .prj file
+
+		// File[] files = new File[] { shpFile, shxFile, dbfFile };
+		//
+		// FileResource[] resources;
+
+		File[] otherFiles = new File[] { shxFile, dbfFile };
+		final ResourceProvider resource;
+		try {
+			// resources = this.createResources(files);
+			resource = createResource(shpFile, otherFiles);
+			resource.closeRequest();
+			resource.closeRequest();
+			// closeResources(resources);
+		} catch (DataException e1) {
+			throw new RemoveException(shpFile.getPath(), e1);
+		}
+
+		try {
+//			beginResources(resources);
+			resource.execute(new ResourceAction() {
+				public Object run() throws Exception {
+					deleteFile(shpFile);
+					deleteFile(dbfFile);
+					deleteFile(shxFile);
+					resource.notifyChanges();
+					return null;
+				}
+			});
+			// for (int i = 0; i < files.length; i++) {
+			// if (!files[i].exists()) {
+			// continue;
+			// }
+			// if (!files[i].delete()) {
+			// throw new RemoveException(this.getDataStoreProviderName(),
+			// new IOException()); // FIXME Exception
+			// }
+			// }
+
+			// notifyChangesResources(resources);
+		} catch (Exception e) {
+			throw new RemoveException(this.getDataStoreProviderName(), e);
+		} finally {
+//			endResources(resources);
+//			removeConsumer(resources);
+			resource.removeConsumer(this);
+		}
+	}
+
+	private void deleteFile(File file) throws RemoveException {
+		if (file.exists() && !file.delete()) {
+			throw new RemoveException(this.getDataStoreProviderName(),
+					new IOException()); // FIXME Exception
+		}
+	}
+	
+	public String getResourceRootPathName(DataStore dataStore) {
+		SHPStoreParameters shpParams = (SHPStoreParameters) dataStore.getParameters();
+		return removeFileExtension(shpParams.getSHPFile());			
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFilesystemServerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java	(revision 38736)
@@ -0,0 +1,620 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.FileHelper;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.gvsig.fmap.dal.resource.file.FileResource;
+import org.gvsig.fmap.dal.resource.spi.MultiResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider;
+import org.gvsig.fmap.dal.store.shp.utils.SHPFile;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.exception.BaseException;
+
+public class SHPStoreProvider extends DBFStoreProvider {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(GeometryManager.class);
+	public static String NAME = "Shape";
+	public static String DESCRIPTION = "Shape file";
+	private SHPFile shpFile;
+
+	private MultiResource resource;
+
+	protected static final String GEOMETRY_ATTIBUTE_NAME = "GEOMETRY";
+
+	public static final String METADATA_DEFINITION_NAME = NAME;
+
+	private SHPFeatureWriter writer = null;
+
+	public SHPStoreProvider(SHPStoreParameters params,
+			DataStoreProviderServices storeServices)
+			throws InitializeException {
+		super(
+			params, 
+			storeServices,
+			FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME)
+		);
+	}
+
+	protected void init(DBFStoreParameters params,
+			DataStoreProviderServices storeServices) throws InitializeException {
+
+		this.shpFile = new SHPFile((SHPStoreParameters) params);
+		super.init(params, storeServices);
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		if( DataStore.METADATA_CRS.equalsIgnoreCase(name) ) {
+			String srs =  this.shpFile.getSRSParameters();
+			if (srs == null){
+			    return this.getShpParameters().getCRS();
+			}
+		} else if( DataStore.METADATA_ENVELOPE.equalsIgnoreCase(name) ) {
+			try {
+				return this.shpFile.getFullExtent();
+			} catch (ReadException e) {
+				return null;
+			}
+		}
+		return super.getDynValue(name);
+	}
+	
+	protected void initResource(DBFStoreParameters params,
+			DataStoreProviderServices storeServices) throws InitializeException {
+
+		SHPStoreParameters shpParams = (SHPStoreParameters) params;
+		resource =
+				(MultiResource) createResource(MultiResource.TYPE_NAME,
+						new Object[] { shpParams.getSHPFileName() });
+
+		resource.addResource(FileResource.NAME,
+				new Object[] { shpParams.getSHPFileName() }, true);
+		resource.addResource(FileResource.NAME,
+				new Object[] { shpParams.getSHXFileName() }, true);
+		resource.addResource(FileResource.NAME,
+				new Object[] { shpParams.getDBFFileName() }, true);
+
+		resource.addConsumer(this);
+	};
+
+	public ResourceProvider getResource() {
+		return resource;
+	}
+
+	/**
+	 *
+	 * @throws ResourceNotifyChangesException
+	 */
+	protected void resourcesNotifyChanges()
+			throws ResourceNotifyChangesException {
+		// super.resourcesNotifyChanges();
+		// this.shpResource.notifyChanges();
+		// this.shxResource.notifyChanges();
+		getResource().notifyChanges();
+		// TODO .prj
+
+	}
+
+	/**
+	 * @throws ResourceNotifyCloseException
+	 *
+	 */
+	protected void resourcesNotifyClose() throws ResourceNotifyCloseException {
+//		super.resourcesNotifyClose();
+//		this.shpResource.notifyClose();
+//		this.shxResource.notifyClose();
+		getResource().notifyClose();
+		// TODO .prj
+
+	}
+
+	@Override
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		getResource().removeConsumer(this);
+		this.writer = null;
+		this.shpFile = null;
+	}
+
+	protected void disposeResource() {
+		getResource().removeConsumer(this);
+	}
+
+	/**
+	 * @throws ResourceNotifyOpenException
+	 *
+	 */
+	protected void resourcesOpen() throws ResourceNotifyOpenException {
+		// super.resourcesOpen();
+		// this.shpResource.notifyOpen();
+		// this.shxResource.notifyOpen();
+		getResource().notifyOpen();
+	}
+
+	protected static EditableFeatureAttributeDescriptor addGeometryColumn(
+			EditableFeatureType fType) {
+
+		EditableFeatureAttributeDescriptor attrTmp = null;
+		EditableFeatureAttributeDescriptor attr = null;
+		Iterator iter = fType.iterator();
+		while (iter.hasNext()) {
+			attrTmp = (EditableFeatureAttributeDescriptor) iter.next();
+			if (attrTmp.getType() == DataTypes.GEOMETRY) {
+				if (attr != null) {
+					// Two geom fields not allowed
+					fType.remove(attrTmp.getName());
+				} else {
+					attr = attrTmp;
+					attr.setName(GEOMETRY_ATTIBUTE_NAME);
+				}
+			}
+		}
+
+
+		if (attr == null){
+			attr = fType.add(
+					GEOMETRY_ATTIBUTE_NAME, DataTypes.GEOMETRY);
+			try {
+				attr.setDefaultValue(geomManager
+						.createNullGeometry(SUBTYPES.GEOM2D));
+			} catch (CreateGeometryException e) {
+				logger.error("Error creating the envelope", e);
+			}
+		}
+
+		attr.setObjectClass(Geometry.class);		
+		fType.setDefaultGeometryAttributeName(attr.getName());
+		return attr;
+
+	}
+
+	protected static FeatureType removeGeometryColumn(
+			EditableFeatureType fType) {
+		Iterator iter = fType.iterator();
+		FeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (attr.getType() == DataTypes.GEOMETRY) {
+				iter.remove();
+			}
+		}
+		fType.setDefaultGeometryAttributeName(null);
+		return fType.getNotEditableCopy();
+	}
+
+	protected EditableFeatureType getTheFeatureType()
+			throws InitializeException, OpenException {
+		final EditableFeatureType fType = super.getTheFeatureType();
+		this.open();
+		// try {
+		// this.resourcesBegin();
+		// } catch (DataException e) {
+		// throw new InitializeException(this.getName(), e);
+		// }
+		try {
+			getResource().execute(new ResourceAction() {
+				public Object run() throws Exception {
+					EditableFeatureAttributeDescriptor attr =
+							addGeometryColumn(fType);
+					attr.setGeometryType(shpFile.getGeometryType());
+					attr.setGeometrySubType(shpFile.getGeometrySubType());
+					// String srs =
+					// this.getSRSFromPrj(this.shpFile.getSRSParameters());
+					// if (srs == null){
+					// // TODO petar ??
+					// srs = "EPSG:23030";
+					// }
+					IProjection srs = getShpParameters().getCRS();
+					if (srs == null) {
+						srs = CRSFactory.getCRS("EPSG:23030");
+					}
+
+					attr.setSRS(srs);
+
+					return null;
+				}
+			});
+			return fType;
+		} catch (ResourceExecuteException e) {
+			throw new InitializeException(e);
+			// } finally {
+			// this.resourcesEnd();
+		}
+	}
+
+//	private String getSRSFromPrj(String srsParameters) {
+//		// TODO identificar que SRS hay que usar, ya sea
+//		// el que se recibe de los parametros o el que
+//		// conicida con el que se ha encontrado en el
+//		// prg... y si ninguna de las dos que?
+//		return null;
+//	}
+
+	protected SHPStoreParameters getShpParameters() {
+		return (SHPStoreParameters) getParameters();
+	}
+
+	public String getProviderName() {
+		return NAME;
+	}
+
+	public boolean allowWrite() {
+		return this.shpFile.isEditable();
+	}
+
+	/**
+	 *
+	 * @param index
+	 * @param featureType
+	 * @return
+	 * @throws ReadException
+	 */
+	protected FeatureProvider getFeatureProviderByIndex(long index,
+			FeatureType featureType) throws DataException {
+		// this.open();
+		// this.resourcesBegin();
+		try {
+
+			FeatureProvider featureProvider = super.getFeatureProviderByIndex(index,
+					featureType);
+			featureProvider.setDefaultEnvelope(this.shpFile.getBoundingBox(index));
+			return featureProvider;
+		} catch (DataException e) {
+			throw e;
+		} catch (CreateEnvelopeException e) {
+			throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(e);		
+		} catch (CreateGeometryException e) {
+		    throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(e);
+        }
+
+	}
+
+	protected void initFeatureProviderByIndex(FeatureProvider featureProvider,
+			long index, FeatureType featureType) throws DataException {
+		// this.open();
+		// this.resourcesBegin();
+		try {
+			super.initFeatureProviderByIndex(featureProvider, index, featureType);
+			featureProvider.setDefaultEnvelope(this.shpFile.getBoundingBox(index));
+		} catch (CreateEnvelopeException e) {
+			throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(e);			
+		} catch (CreateGeometryException e) {
+		    throw new org.gvsig.fmap.dal.feature.exception.CreateGeometryException(e);       
+        }
+	}
+
+	/**
+	 *
+	 * @param featureProvider
+	 * @throws DataException
+	 */
+	protected void loadFeatureProviderByIndex(FeatureProvider featureProvider)
+			throws DataException {
+		// this.open();
+		// this.resourcesBegin();
+		// try {
+			FeatureType featureType = featureProvider.getType();
+			long index = ((Long) featureProvider.getOID()).longValue();
+			boolean hasGeometry = false;
+			if (featureType.getIndex(featureType.getDefaultGeometryAttributeName()) >= 0) {
+				try {
+					featureProvider.setDefaultGeometry(this.shpFile.getGeometry(index));
+					hasGeometry = true;
+				} catch (CreateGeometryException e) {
+					throw new ReadException(getProviderName(), e);
+				}
+			}
+			if (hasDBFAttributes(featureType, hasGeometry)) {
+				super.loadFeatureProviderByIndex(featureProvider);
+			}
+
+		// } finally {
+		// this.resourcesEnd();
+		// }
+
+	}
+
+	private boolean hasDBFAttributes(FeatureType featureType,
+			boolean hasGeometry) {
+		FeatureAttributeDescriptor[] attributes =
+				featureType.getAttributeDescriptors();
+		// If there aren't any attributes, nor has any DBF attributes
+		if (attributes == null || attributes.length == 0) {
+			return false;
+		}
+		// If there is only one attribute and it is the geometry one
+		if (attributes.length == 1 && hasGeometry) {
+			return false;
+		}
+		// In any other case
+		return true;
+	}
+
+	protected void loadValue(FeatureProvider featureProvider, int rowIndex,
+			FeatureAttributeDescriptor descriptor) throws ReadException {
+		if (descriptor.getType() == DataTypes.GEOMETRY) {
+			return;
+		} else {
+			super.loadValue(featureProvider, rowIndex, descriptor);
+		}
+	}
+
+	public FeatureProvider createFeatureProvider(FeatureType type) throws DataException {
+		FeatureProvider data = new SHPFeatureProvider(this, type);
+		return data;
+	}
+
+
+	protected void openFile() throws IOException, DataException {
+		super.openFile();
+		this.shpFile.open();
+
+	}
+
+	protected void closeFile() throws CloseException {
+		super.closeFile();
+		if (!this.shpFile.isOpen()) {
+			return;
+		}
+		this.shpFile.close();
+	}
+
+	public boolean canWriteGeometry(final int geometryType, int geometrySubType)
+			throws DataException {
+		this.open();
+		return ((Boolean) getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				boolean value = shpFile.canWriteGeometry(geometryType);
+				return value ? Boolean.TRUE : Boolean.FALSE;
+			}
+		})).booleanValue();
+//		this.resourcesBegin();
+//		try {
+//			return this.shpFile.canWriteGeometry(geometryType);
+//
+//		} finally {
+//			this.resourcesEnd();
+//		}
+	}
+
+	public void performChanges(Iterator deleteds, Iterator inserteds,
+			Iterator updateds, Iterator originalFeatureTypesUpdated) throws PerformEditingException {
+		final FeatureType fType;
+		try {
+			fType = this.getStoreServices().getDefaultFeatureType();
+		} catch (DataException e) {
+			throw new PerformEditingException(this.getProviderName(), e);
+		}
+		// TODO Comprobar el campo de geometria
+
+		final EditableFeatureType dbfFtype = fType.getEditable();
+
+		removeGeometryColumn(dbfFtype);
+
+		// try {
+		// this.resourcesBegin();
+		// } catch (ResourceExecuteException e1) {
+		// throw new PerformEditingException(this.getName(), e1);
+		// }
+
+		try {
+
+			getResource().execute(new ResourceAction() {
+				public Object run() throws Exception {
+					FeatureSet set = null;
+					DisposableIterator iter = null;
+					try {
+						set = getFeatureStore().getFeatureSet();
+						writer = new SHPFeatureWriter(getProviderName());
+
+						SHPStoreParameters shpParams = getShpParameters();
+						SHPStoreParameters tmpParams =
+								(SHPStoreParameters) shpParams.getCopy();
+						tmpParams.setDBFFile(tmpParams.getDBFFileName()
+								+ ".tmp");
+						tmpParams.setSHPFile(tmpParams.getSHPFileName()
+								+ ".tmp");
+						tmpParams.setSHXFile(tmpParams.getSHXFileName()
+								+ ".tmp");
+
+						writer.begin(tmpParams, fType, dbfFtype, set.getSize());
+
+						iter = set.fastIterator();
+						while (iter.hasNext()) {
+							Feature feature = (Feature) iter.next();
+							writer.append(feature);
+						}
+
+						writer.end();
+
+						close();
+						resourceCloseRequest();
+
+						if (!shpParams.getDBFFile().delete()) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getDBFFileName()));
+						}
+						if (!shpParams.getSHPFile().delete()) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getSHPFileName()));
+						}
+						if (!shpParams.getSHXFile().delete()) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getSHXFileName()));
+						}
+						if (!tmpParams.getDBFFile().renameTo(
+								shpParams.getDBFFile())) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getSHPFileName()));
+						}
+						if (!tmpParams.getSHPFile().renameTo(
+								shpParams.getSHPFile())) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getSHPFileName()));
+						}
+						if (!tmpParams.getSHXFile().renameTo(
+								shpParams.getSHXFile())) {
+							throw new PerformEditingException(getProviderName(),
+									new IOException(shpParams.getSHXFileName()));
+						}
+
+						resourcesNotifyChanges();
+						initFeatureType();
+						return null;
+					} finally {
+						dispose(set);
+						dispose(iter);
+					}
+				}
+			});
+
+		} catch (Exception e) {
+			throw new PerformEditingException(this.getProviderName(), e);
+			// } finally {
+			// this.resourcesEnd();
+		}
+
+
+	}
+
+	protected void resourceCloseRequest() throws ResourceException {
+		// super.resourceCloseRequest();
+		// this.shpResource.closeRequest();
+		// this.shxResource.closeRequest();
+		getResource().closeRequest();
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		this.open();
+		return (Envelope) this.getDynValue("Envelope");
+	}
+
+	public void append(final FeatureProvider featureProvider) throws DataException {
+//		this.resourcesBegin();
+//		try {
+
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				writer.append(getStoreServices().createFeature(featureProvider));
+				return null;
+			}
+		});
+//		} finally {
+//			this.resourcesEnd();
+//		}
+
+	}
+
+	public void beginAppend() throws DataException {
+		// this.resourcesBegin();
+		// try {
+
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				FeatureStore store = getFeatureStore();
+				FeatureType fType = store.getDefaultFeatureType();
+
+				// TODO Comprobar el campo de geometria
+
+				EditableFeatureType dbfFtype = fType.getEditable();
+
+				removeGeometryColumn(dbfFtype);
+				FeatureSet set = store.getFeatureSet();
+
+				writer = new SHPFeatureWriter(getProviderName());
+
+				writer.begin(getShpParameters(), fType, dbfFtype, set.getSize());
+				return null;
+			}
+		});
+		// } finally {
+		// this.resourcesEnd();
+		// }
+
+	}
+
+	public void endAppend() throws DataException {
+//		this.resourcesBegin();
+//		try {
+		getResource().execute(new ResourceAction() {
+			public Object run() throws Exception {
+				writer.end();
+				resourcesNotifyChanges();
+				return null;
+			}
+		});
+//		} finally {
+//			this.resourcesEnd();
+//		}
+
+	}
+
+	public Object getSourceId() {
+		return this.getShpParameters().getFile();
+	}
+}
\ No newline at end of file

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java	(revision 38736)
@@ -0,0 +1,216 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.WriteException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.store.dbf.DBFFeatureWriter;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
+import org.gvsig.fmap.dal.store.shp.utils.SHPFileWrite;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+public class SHPFeatureWriter extends DBFFeatureWriter {
+
+    private static final GeometryManager geomManager = GeometryLocator
+        .getGeometryManager();
+    private static final Logger logger = LoggerFactory
+        .getLogger(GeometryManager.class);
+
+    private SHPFileWrite shpWrite;
+    private Envelope envelope = null;
+    private int[] supportedGeometryTypes;
+    private Geometry defaultGeometry;
+    private int fileSize;
+    private FeatureType shpFeatureType;
+
+    protected SHPFeatureWriter(String name) {
+        super(name);
+        try {
+            this.defaultGeometry =
+                geomManager.createNullGeometry(SUBTYPES.GEOM2D);
+        } catch (CreateGeometryException e) {
+            logger.error("Creating a NullGeometry", e);
+        }
+    }
+
+    public void begin(DBFStoreParameters dbfParameters,
+        FeatureType featureType, FeatureType dbfFeatureType, long numRows)
+        throws DataException {
+        SHPStoreParameters shpParameters = (SHPStoreParameters) dbfParameters;
+        File shpFile = shpParameters.getSHPFile();
+        File shxFile = shpParameters.getSHXFile();
+
+        FileChannel shpChannel = null;
+        FileChannel shxChannel = null;
+
+        try {
+            shpChannel =
+                (FileChannel) getWriteChannel(shpFile.getAbsolutePath());
+            shxChannel =
+                (FileChannel) getWriteChannel(shxFile.getAbsolutePath());
+        } catch (IOException e) {
+            throw new WriteException(this.name, e);
+        }
+
+        shpWrite = new SHPFileWrite(shpChannel, shxChannel);
+        int shapeType = getShapeTypeAndSetSupportedGeometries(featureType);
+        try {
+            shpWrite.writeHeaders(
+                geomManager.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D),
+                shapeType, 0, 0);
+        } catch (CreateEnvelopeException e) {
+            logger.error("Error creating the envelope", e);
+        }
+
+        this.shpFeatureType = featureType;
+        super.begin(dbfParameters, dbfFeatureType, numRows);
+
+    }
+
+    private int getShapeTypeAndSetSupportedGeometries(FeatureType featureType) {
+
+        FeatureAttributeDescriptor geometryAttr =
+            featureType.getAttributeDescriptor(featureType
+                .getDefaultGeometryAttributeIndex());
+        int gvSIG_geometryType = geometryAttr.getGeometryType();
+        int gvSIG_geometrySubType = geometryAttr.getGeometrySubType();
+        this.setSupportedGeometryTypes(gvSIG_geometryType);
+        int shapeType = 0;
+        shapeType =
+            shpWrite.getShapeType(gvSIG_geometryType, gvSIG_geometrySubType);
+        return shapeType;
+    }
+
+    public void dispose() {
+        super.dispose();
+        this.envelope = null;
+        this.shpWrite = null;
+    }
+
+    public void end() throws DataException {
+        if (envelope == null) {
+            try {
+                envelope =
+                    geomManager.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                logger.error("Error creating the envelope", e);
+            }
+        }
+        int shapeType = getShapeTypeAndSetSupportedGeometries(shpFeatureType);
+        shpWrite.writeHeaders(envelope, shapeType, super.getRowCount(),
+            fileSize);
+        super.end();
+        shpWrite.close();
+    }
+
+    public void append(Feature feature) throws DataException {
+
+        Geometry theGeom = feature.getDefaultGeometry();
+        if (theGeom == null) {
+            theGeom = this.defaultGeometry;
+        }
+        if (!canWriteGeometry(theGeom.getType())) {
+            throw new WriteException(this.name, // FIXME Excepcion correcta
+                new RuntimeException("UnsupportedGeometryType: "
+                    + theGeom.getGeometryType().getName()));
+        }
+        // numRows++;
+        super.append(feature);
+
+        // fileSize = shpWrite.writeIGeometry(theGeom);
+        fileSize = shpWrite.writeIGeometry(theGeom);
+        Envelope envelope = theGeom.getEnvelope();
+        if (envelope != null) {
+            if (this.envelope != null) {
+                this.envelope.add(envelope);
+            } else {
+                this.envelope = envelope;
+            }
+        }
+    }
+
+    private void setSupportedGeometryTypes(int gvSIG_geometryType) {
+        switch (gvSIG_geometryType) {
+        case Geometry.TYPES.POINT:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.POINT, Geometry.TYPES.NULL };
+            break;
+        case Geometry.TYPES.MULTIPOINT:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.MULTIPOINT, Geometry.TYPES.NULL };
+            break;
+        case Geometry.TYPES.MULTICURVE:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.CURVE, Geometry.TYPES.ELLIPSE,
+                    Geometry.TYPES.ARC, Geometry.TYPES.CIRCLE,
+                    Geometry.TYPES.ELLIPSE, Geometry.TYPES.MULTICURVE,
+                    Geometry.TYPES.SPLINE, Geometry.TYPES.NULL };
+            break;
+        case Geometry.TYPES.MULTISURFACE:
+            supportedGeometryTypes =
+                new int[] { Geometry.TYPES.SURFACE, Geometry.TYPES.CIRCLE,
+                    Geometry.TYPES.ELLIPSE, Geometry.TYPES.MULTISURFACE,
+                    Geometry.TYPES.SPLINE, Geometry.TYPES.NULL };
+            break;
+
+        default:
+            supportedGeometryTypes = new int[] {};
+        }
+    }
+
+    public boolean canWriteGeometry(int gvSIGgeometryType) {
+        for (int i = 0; i < supportedGeometryTypes.length; i++) {
+            if (gvSIGgeometryType == supportedGeometryTypes[i]) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void begin(DBFStoreParameters storeParameters,
+        FeatureType featureType, long numRows) throws DataException {
+        throw new UnsupportedOperationException();
+    }
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java	(revision 38736)
@@ -0,0 +1,107 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.store.shp;
+
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.store.dbf.DBFNewStoreParameters;
+import org.gvsig.fmap.geom.Geometry;
+
+public class SHPNewStoreParameters extends SHPStoreParameters implements
+    NewFeatureStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME =
+        "SHPNewStoreParameters";
+    public static final String FEATURETYPE_PARAMTER_NAME = "FeatureType";
+    protected static final String GEOMETRYTYPE_PARAMETER_NAME = "geometryType";
+
+    public SHPNewStoreParameters() {
+        super(PARAMETERS_DEFINITION_NAME);
+    }
+
+    public byte getCodePage() {
+        return ((Byte) this
+            .getDynValue(DBFNewStoreParameters.CODEPAGE_PARAMTER_NAME))
+            .byteValue();
+    }
+
+    public void setCodePage(byte value) {
+        setDynValue(DBFNewStoreParameters.CODEPAGE_PARAMTER_NAME, new Byte(
+            value));
+    }
+
+    public int getGeometryType() {
+        Integer type = (Integer) this.getDynValue(GEOMETRYTYPE_PARAMETER_NAME);
+        if (type == null) {
+            return Geometry.TYPES.NULL;
+        }
+        return type.intValue();
+    }
+
+    public void setGeometryType(int type) {
+        this.setDynValue(GEOMETRYTYPE_PARAMETER_NAME, new Integer(type));
+    }
+
+    public EditableFeatureType getDefaultFeatureType() {
+        return (EditableFeatureType) this
+            .getDynValue(FEATURETYPE_PARAMTER_NAME);
+    }
+
+    public void setDefaultFeatureType(FeatureType featureType) {
+        this.setDynValue(FEATURETYPE_PARAMTER_NAME, featureType);
+    }
+
+    @Override
+    public void fixParameters() {
+        super.fixParameters();
+        EditableFeatureType featureType = getDefaultFeatureType();
+        if (featureType != null) {
+            FeatureAttributeDescriptor geometryAttribute =
+                featureType.getDefaultGeometryAttribute();
+            if (geometryAttribute != null) {                
+                if (this.getDynValue(GEOMETRYTYPE_PARAMETER_NAME) == null) {
+                    //Set the geometryType parameter              
+                    int geometryType =
+                        featureType.getAttributeDescriptor(
+                            geometryAttribute.getName())
+                            .getGeometryType();
+                    setGeometryType(geometryType);
+                }
+             
+                //If the CRS parameter has not been fixed, but there is 
+                //a geometric attribute with the CRS, this attribute
+                //can be used.
+                if (getCRS() == null) {               
+                    setCRS(geometryAttribute.getSRS());
+                }
+            }
+        }      
+    }
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProviderFactory.java	(revision 38736)
@@ -0,0 +1,203 @@
+package org.gvsig.fmap.dal.store.shp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.DataStoreProvider;
+import org.gvsig.fmap.dal.DataStoreProviderFactory;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class SHPStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{
+
+    private static final Logger logger = LoggerFactory.getLogger(SHPStoreProviderFactory.class);
+    
+    public static final String DEFAULT_GEOMETRY_FIELD_NAME = "GEOMETRY";
+    public static final int DEFAULT_GEOMETRY_TYPE = Geometry.TYPES.SURFACE;
+    public static final int DEFAULT_GEOMETRY_SUBTYPE = Geometry.SUBTYPES.GEOM2D;
+    
+	protected SHPStoreProviderFactory(String name, String description) {
+		super(name, description);
+	}
+
+	public DataStoreProvider createProvider(DataParameters parameters,
+			DataStoreProviderServices providerServices)
+			throws InitializeException {
+		return new SHPStoreProvider((SHPStoreParameters) parameters, providerServices);
+	}
+
+	public DynObject createParameters() {
+		return new SHPStoreParameters();
+	}
+	
+	public int allowCreate() {
+		return YES;
+	}
+	
+	public int allowWrite() {
+		return YES;
+	}
+
+	public int allowRead() {
+		return YES;
+	}
+	
+	public int hasRasterSupport() {
+		return NO;
+	}
+	
+	public int hasTabularSupport() {
+		return YES;
+	}
+	
+	public int hasVectorialSupport() {
+		return YES;
+	}
+
+	public int allowMultipleGeometryTypes() {
+		return NO;
+	}
+	
+	
+    public int allowEditableFeatureType() {
+        return YES;
+    }
+    
+    public List getSupportedDataTypes() {
+        
+        DataTypesManager manager = ToolsLocator.getDataTypesManager();
+
+        List resp = new ArrayList<Integer>();
+        resp.add(manager.get(DataTypes.STRING));
+        resp.add(manager.get(DataTypes.INT));
+        resp.add(manager.get(DataTypes.FLOAT));
+        resp.add(manager.get(DataTypes.DATE));
+        resp.add(manager.get(DataTypes.GEOMETRY));
+        return resp;
+    }
+    
+    public List getSupportedGeometryTypesSubtypes() {
+        // null means all supported
+        int[] item = null;
+        List resp = new ArrayList<int[]>();
+        // ====================================== 2d
+        item = new int[2];
+        item[0] = Geometry.TYPES.POINT;
+        item[1] = Geometry.SUBTYPES.GEOM2D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.CURVE;
+        item[1] = Geometry.SUBTYPES.GEOM2D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.SURFACE;
+        item[1] = Geometry.SUBTYPES.GEOM2D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.MULTIPOINT;
+        item[1] = Geometry.SUBTYPES.GEOM2D;
+        resp.add(item);
+        // ====================================== 3d
+        item = new int[2];
+        item[0] = Geometry.TYPES.POINT;
+        item[1] = Geometry.SUBTYPES.GEOM3D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.CURVE;
+        item[1] = Geometry.SUBTYPES.GEOM3D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.SURFACE;
+        item[1] = Geometry.SUBTYPES.GEOM3D;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.MULTIPOINT;
+        item[1] = Geometry.SUBTYPES.GEOM3D;
+        resp.add(item);
+        // ====================================== 2dm
+        item = new int[2];
+        item[0] = Geometry.TYPES.POINT;
+        item[1] = Geometry.SUBTYPES.GEOM2DM;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.CURVE;
+        item[1] = Geometry.SUBTYPES.GEOM2DM;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.SURFACE;
+        item[1] = Geometry.SUBTYPES.GEOM2DM;
+        resp.add(item);
+        
+        item = new int[2];
+        item[0] = Geometry.TYPES.MULTIPOINT;
+        item[1] = Geometry.SUBTYPES.GEOM2DM;
+        resp.add(item);
+        // ======================================
+        
+        return resp;
+    }
+    
+    public boolean allowsMandatoryAttributes() {
+        return false;
+    }
+    
+    public boolean allowsPrimaryKeyAttributes() {
+        return false;
+    }
+
+    /**
+     * @return  dummy feature type. Must be overridden by subclasses
+     * 
+     */
+    public FeatureType createDefaultFeatureType() {
+        DataManager dm = DALLocator.getDataManager();
+        EditableFeatureType eft = dm.createFeatureType();
+        
+        EditableFeatureAttributeDescriptor efatd =
+            eft.add(DEFAULT_GEOMETRY_FIELD_NAME, DataTypes.GEOMETRY);
+
+        GeometryType gt = null;
+        try {
+            gt = GeometryLocator.getGeometryManager().getGeometryType(
+                DEFAULT_GEOMETRY_TYPE,
+                DEFAULT_GEOMETRY_SUBTYPE);
+            efatd.setGeometryType(gt);
+        } catch (Exception ex) {
+            logger.info("Error while setting geom type: " + ex.getMessage());
+            logger.info("Trying deprecated way...");
+            efatd.setGeometryType(DEFAULT_GEOMETRY_TYPE);
+            efatd.setGeometrySubType(DEFAULT_GEOMETRY_SUBTYPE);
+        }
+        eft.setDefaultGeometryAttributeName(DEFAULT_GEOMETRY_FIELD_NAME);
+        return eft.getNotEditableCopy();
+    }
+
+	
+}
Index: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java	(revision 38736)
@@ -0,0 +1,149 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.store.shp;
+
+import java.io.File;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
+import org.gvsig.fmap.dal.store.shp.utils.SHP;
+
+public class SHPStoreParameters extends DBFStoreParameters {
+
+    public static final String PARAMETERS_DEFINITION_NAME = "SHPStoreParameters";
+
+	private static final String SHXFILE_PARAMTER_NAME = "shxfile";
+    private static final String SHPFILE_PARAMTER_NAME = "shpfile";
+	private static final String CRS_PARAMTER_NAME = "CRS";
+
+	public SHPStoreParameters() {
+		this(PARAMETERS_DEFINITION_NAME);
+	}
+
+	@Override
+	public void validate() throws ValidateDataParametersException {
+		fixParameters();
+		super.validate();
+	}
+	
+	public void fixParameters() {
+		File file = this.getSHPFile();
+		if( file!=null ) {
+			if (this.getDBFFile() == null){
+				this.setDBFFile(SHP.getDbfFile(file));
+			}
+			if (this.getSHXFile() == null) {
+				this.setSHXFile(SHP.getShxFile(file));
+			}
+		}
+	}
+	
+	public SHPStoreParameters(String parametersDefinitionName) {
+		super(parametersDefinitionName, SHPStoreProvider.NAME);
+	}
+
+	public boolean isValid() {
+		return super.isValid() && (this.getSHPFileName() != null);
+	}
+
+	public File getFile() {
+		return this.getSHPFile();
+	}
+
+	public void setFile(File file) {
+		this.setSHPFile(file);
+	}
+	public void setFile(String fileName) {
+		this.setSHPFile(fileName);
+	}
+	
+	
+	public String getSHPFileName() {
+		if( this.getSHPFile()==null ) {
+			return null;
+		}
+		return this.getSHPFile().getAbsolutePath();
+	}
+
+	public File getSHPFile() {
+		return (File) this.getDynValue(SHPFILE_PARAMTER_NAME);
+	}
+
+	public void setSHPFile(File file) {
+		this.setDynValue(SHPFILE_PARAMTER_NAME, file);
+		if (this.getDBFFile() == null){
+			this.setDBFFile(SHP.getDbfFile(file));
+		}
+		if (this.getSHXFile() == null) {
+			this.setSHXFile(SHP.getShxFile(file));
+		}
+	}
+
+	public void setSHPFile(String fileName) {
+		this.setDynValue(SHPFILE_PARAMTER_NAME, fileName);
+		File file = (File) this.getDynValue(SHPFILE_PARAMTER_NAME);
+		if (this.getDBFFile() == null){
+			this.setDBFFile(SHP.getDbfFile(file));
+		}
+		if (this.getSHXFile() == null) {
+			this.setSHXFile(SHP.getShxFile(file));
+		}
+	}
+
+	public String getSHXFileName() {
+		if( this.getSHXFile()==null ) {
+			return null;
+		}
+		return this.getSHXFile().getPath();
+	}
+
+	public File getSHXFile() {
+		return (File) this.getDynValue(SHXFILE_PARAMTER_NAME);
+	}
+	public void setSHXFile(File file) {
+		this.setDynValue(SHXFILE_PARAMTER_NAME, file);
+	}
+
+	public void setSHXFile(String fileName) {
+		this.setDynValue(SHXFILE_PARAMTER_NAME, fileName);
+	}
+
+	public void setCRS(IProjection srs) {
+		setDynValue(CRS_PARAMTER_NAME, srs);
+	}
+
+	public void setCRS(String srs) {
+		setDynValue(CRS_PARAMTER_NAME, srs);
+	}
+
+	public IProjection getCRS() {
+		return (IProjection) getDynValue(CRS_PARAMTER_NAME);
+	}
+
+}

Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: tags/v2_0_0_Build_2051/libraries/libFMap_dalfile
___________________________________________________________________
Added: svn:ignore
   + .classpath 
.project 
.settings 
maven-eclipse.xml
target
bin
hs_err_pid*
.externalToolBuilders
.settings
.classpath
.project


