Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/pom.xml	(revision 435)
@@ -0,0 +1,20 @@
+<?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.dwg.app</artifactId>
+  <packaging>pom</packaging>
+  <name>${project.artifactId}</name>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg</artifactId>
+      <version>2.0.98</version>
+  </parent>
+
+  <modules>
+    <module>org.gvsig.dwg.app.mainplugin</module>
+  </modules>
+
+
+</project>
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties	(revision 435)
@@ -0,0 +1,2 @@
+#Sun Mar 31 03:27:03 CEST 2019
+buildNumber=2166
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java	(revision 435)
@@ -0,0 +1,88 @@
+/* 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.dwg.fmap.dal.store.dwg;
+
+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 TestDWG extends BaseTestFeatureStore {
+
+
+	protected boolean testDXFInitialized = false;
+
+	public static File file_prueba = new File(TestDWG.class.getResource(
+			"data/V2000.dwg").getFile());
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
+	 * ()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException {
+		DWGStoreParameters dwgParameters = null;
+
+		dwgParameters = (DWGStoreParameters) dataManager
+				.createStoreParameters(DWGStoreProvider.NAME);
+
+		dwgParameters.setFile(file_prueba);
+		dwgParameters.setCRS("EPSG:23030");
+		return dwgParameters;
+	}
+
+	/*
+	 * (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 {
+		DataStoreParameters params = getDefaultDataStoreParameters();
+		FeatureStore store = (FeatureStore) dataManager.openStore(params
+				.getDataStoreName(), params);
+
+		assertNotNull(store.invokeDynMethod("getLegend", null));
+		assertNotNull(store.invokeDynMethod("getLabeling", null));
+		store.dispose();
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java	(revision 435)
@@ -0,0 +1,35 @@
+/* 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.dwg.fmap.dal.store.dwg;
+
+import java.io.File;
+
+public class TestDWG2004 extends TestDWG {
+	public static File file_prueba = new File(TestDWG.class.getResource(
+			"data/V2004.dwg").getFile());
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2000.dwg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2000.dwg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2004.dwg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2004.dwg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml	(revision 435)
@@ -0,0 +1,38 @@
+<assembly>
+  <id>gvsig-plugin-package</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <baseDirectory>${project.artifactId}</baseDirectory>
+  <includeBaseDirectory>true</includeBaseDirectory>
+  <files>
+    <file>
+      <source>target/${project.artifactId}-${project.version}.jar</source>
+      <outputDirectory>lib</outputDirectory>
+    </file>
+    <file>
+      <source>target/package.info</source>
+    </file>
+  </files>
+
+  <fileSets>
+    <fileSet>
+      <directory>src/main/resources-plugin</directory>
+      <outputDirectory>.</outputDirectory>
+    </fileSet>
+  </fileSets>
+
+  <dependencySets>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+      <outputDirectory>lib</outputDirectory>
+      <includes>
+        <include>org.gvsig:org.gvsig.dwg.provider.legend</include>
+        <include>org.gvsig:org.gvsig.dwg.provider</include>
+        <include>org.gvsig:org.gvsig.dwg.lib</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+
+</assembly>
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/java/org/gvsig/dwg/DWGRegisterExtension.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/java/org/gvsig/dwg/DWGRegisterExtension.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/java/org/gvsig/dwg/DWGRegisterExtension.java	(revision 435)
@@ -0,0 +1,59 @@
+/* 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.dwg;
+
+import org.gvsig.andami.IconThemeHelper;
+import org.gvsig.andami.plugins.Extension;
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+
+/**
+ * Dummy DWG extension, as all the registration happens in the
+ * {@link DWGLibrary}.
+ *
+ * @author gvSIG Team
+ */
+public class DWGRegisterExtension extends Extension {
+
+	public void execute(String actionCommand) {
+		// Nothing to do
+	}
+
+	public void initialize() {
+		IconThemeHelper.registerIcon("layer", "layer-icon-dwg", this);
+	}
+
+	public void postInitialize() {
+		MapContextLocator.getMapContextManager().registerIconLayer(DWGStoreProvider.NAME, "layer-icon-dwg");
+	}
+
+	public boolean isEnabled() {
+		// Nothing to do
+		return false;
+	}
+
+	public boolean isVisible() {
+		// Nothing to do
+		return false;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/config.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/config.xml	(revision 435)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<plugin-config>
+	<libraries library-dir="lib">
+	</libraries>
+	<depends plugin-name="org.gvsig.app.mainplugin"/>
+		<resourceBundle name="text"/>
+	<extensions>
+		<extension class-name="org.gvsig.dwg.DWGRegisterExtension"
+			description="DWG Driver"
+			active="true">
+		</extension>
+
+	</extensions>
+</plugin-config>
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/images/layer/layer-icon-dwg.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/images/layer/layer-icon-dwg.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/pom.xml	(revision 435)
@@ -0,0 +1,116 @@
+<?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.dwg.app.mainplugin</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+  <description>
+DWG file format support (read-only)
+
+Supported versions:
+- v12
+- v14
+- v15
+- v2004
+
+  </description>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg.app</artifactId>
+      <version>2.0.98</version>
+  </parent>
+
+  <dependencies>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.lib</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.andami</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.dwg.provider</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.dwg.provider.legend</artifactId>
+        <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.dwg.lib</artifactId>
+        <scope>runtime</scope>
+    </dependency>
+
+    <!-- Tests -->
+
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
+      <type>jar</type>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+    <properties>
+        <!-- Package info property values -->
+        <!-- Default values in org.gvsig.desktop -->
+        <gvsig.package.info.name>Formats: dwg file format support (read-only)</gvsig.package.info.name>
+        <gvsig.package.info.state>testing</gvsig.package.info.state>
+        <gvsig.package.info.official>true</gvsig.package.info.official>
+        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies>
+        <gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories>
+        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-dwg/pool</gvsig.package.info.poolURL>
+    </properties>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <!-- Skip compilation tests -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-testCompile</id>
+            <phase>process-test-sources</phase>
+            <goals>
+              <goal>testCompile</goal>
+            </goals>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <!-- Skip test execution -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>
+

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin
___________________________________________________________________
Added: svn:ignore
   + target


Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/data/Un_punto.dwg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/data/Un_punto.dwg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgTestSuite.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgTestSuite.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgTestSuite.java	(revision 435)
@@ -0,0 +1,72 @@
+/*
+ * Created on 08-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgTestSuite.java 28970 2009-05-25 13:27:14Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-02-28 07:35:10  jmvivo
+* Actualizado desde el HEAD.
+*
+* Revision 1.1  2007/02/08 20:27:57  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class DwgTestSuite {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Test for com.iver.cit.jdwglib.dwg");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(DwgFileTest.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgFileTest.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgFileTest.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgFileTest.java	(revision 435)
@@ -0,0 +1,322 @@
+package org.gvsig.dwg.lib;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+public class DwgFileTest extends TestCase {
+	private File baseDataPath;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		URL url = this.getClass().getResource("data");
+		if (url == null) {
+			throw new Exception("Can't find 'data' dir");
+		}
+
+		baseDataPath = new File(url.getFile());
+		if (!baseDataPath.exists()) {
+			throw new Exception("Can't find 'data' dir");
+		}
+
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+	public void test1() throws IOException, DwgVersionNotSupportedException {
+//		String fileName = baseDataPath.getAbsolutePath()+"/Un punto.dwg";
+//		DwgFile dwg = new DwgFile(fileName);
+//
+//		dwg.read();
+//		dwg.calculateGisModelDwgPolylines();
+//		dwg.blockManagement();
+//		LinkedList dwgObjects = dwg.getDwgObjects();
+	}
+
+	public void test2() throws RuntimeException, CorruptedDwgEntityException{
+        //Dwg Object that is supposed to be
+        //an LWPOLYLINE in V14 version
+		/*
+        int[] data = new int[]{61,64,64,183,19,227,104,16
+                            ,0,5,8,59,72,32,252,47,90,142,
+                            234,145,50,10,71,11,213,36,229,
+                            162,130,10,228,126,23,174,130,
+                            145,50,15,98,141,196,244,229,
+                            162,130,12,126,23,169,66,58,
+                            145,50,12,47,90,138,68,229,
+                            162,130,8,0,0,4,7,74,137,50,
+                            15,177,66,231,252,221,162,130,
+                            9,130,151,21,242,151,21,190,
+                            8,21,8,56};
+         */
+//		int[] data = new int[]{62,128,64,71,99,
+//							   40,48,0,5,8,27,72,
+//							   100,126,23,169,68,
+//							   178,105,50,13,114,
+//							   63,11,82,165,162,130,
+//							   13,114,63,11,210,138,
+//							   105,50,8,173,114,59,
+//							   138,205,162,130,15,98,
+//							   141,192,241,58,105,50,
+//							   11,51,51,52,178,229,162,
+//							   130,14,110,102,98,97,234,
+//							   105,50,11,51,51,52,179,21,
+//							   162,130,10,149,192,240,42,
+//							   162,105,50,14,189,27,131,
+//							   107,69,162,130,14,31,169,
+//							   66,227,74,105,50,9,240,86,
+//							   185,27,117,162,130,11,59,
+//							   51,51,52,234,105,50,13,114,
+//							   63,11,83,85,162,130,9,74,228,
+//							   126,22,186,105,50,11,51,51,50,
+//							   51,53,162,130,11,137,232,82,190,
+//							   58,105,50,9,74,228,122,147,13,162,
+//							   130,11,137,232,82,189,106,105,50,9,
+//							   74,228,122,146,213,162,130,9,74,228,122,20,202,105,50,12,126,23,171,194,173,162,130,12,126,23,169,68,178,105,50,13,114,63,11,82,165,162,130,9,130,151,22,10,136,182,8,21,8,120};
+//        //1er intento: suponemos que la LWPOLYLINE cumple la especificaci�n
+//        //a rajatabla
+//        int bitPos = 0;
+//        List val = DwgUtil.getBitShort(data, bitPos);
+//        bitPos = ((Integer) val.get(0)).intValue();
+//        int type = ((Integer) val.get(1)).intValue();
+//        System.out.println("type = " + type);
+//
+//        DwgHandleReference hr = new DwgHandleReference();
+//        bitPos = hr.read(data, bitPos);
+//        System.out.println("handle, code="+
+//                    hr.getCode()+
+//                    " ,offset="+
+//                    hr.getOffset());
+//
+//        //Ahora pasamos a la extended data
+//        val = DwgUtil.getBitShort(data, bitPos);
+//        bitPos = ((Integer) val.get(0)).intValue();
+//        int extendedDataSize = ((Integer) val.get(1)).intValue();
+//        System.out.println("EED size="+extendedDataSize);
+//        //como el size es 0, me lo salto
+//
+//        //ver si tiene datos graficos
+//        val = DwgUtil.testBit(data, bitPos);
+//        bitPos = ((Integer) val.get(0)).intValue();
+//        boolean hasGraphicsData = ((Boolean) val.get(1))
+//                .booleanValue();
+//        System.out.println("graphics = "+hasGraphicsData);
+//
+//        //como se que no hay graphics me lo salto
+//        //tama�o en bits
+//        val = DwgUtil.getRawLong(data, bitPos);
+//        bitPos = ((Integer) val.get(0)).intValue();
+//        int sizeInBits = ((Integer) val.get(1)).intValue();
+//        System.out.println("sizeInBits = "+sizeInBits);
+//
+//        /*
+//         * Ahora, lo que viene es lo que en la spec se dice
+//         * "Common entity data". Revisar bien pues PythonCAD no lo lee
+//         * como en la spec.
+//         *
+//         * pag 42.
+//          R13-R14 Only:
+//          	RL	:	Size of object data in bits
+//          	6B	:	Flags (FEDCBA)
+//          	6B	:	Common parameters (CCSSII)
+//          	Segun esto, deberia leer 6 bits y 6 bits
+//
+//          	FLAGS
+//	      	Mas adelante (pag 43), dice:
+//	      	DC	:	This is the number of reactors attached to an
+//	      	entity as a bitshort.
+//	      	This feature may have been dormant in R13,
+//	      	but it appears in R14, and in files saved as R13 by R14.
+//
+//	      	Ahora bien, pythoncad las est� leyendo como bitLong
+//          	�En que quedamos, son 2 bits, 1 bitLong o 1 bitShort?
+//          	TODO REVISAR
+//
+//          	COMMON PARAMETERS
+//          	Al principio, dice que son 6 bits (CC, SS, II)
+//          	pero luego dice (pag 43):
+//          	CC	:	Color bitshort
+//          	SS	:	Linetype scale bitdouble
+//          	II	:	"Invisible" flag bitshort
+//
+//			Pythoncad, en vez de como 2 bits, los est� leyendo
+//			como BitShort, BitDouble y BitShort
+//
+//         * */
+//
+//        Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos);
+//		bitPos += 2;
+//		System.out.println("mode = "+mode);
+//
+//	/*
+//		val = DwgUtil.getBitLong(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int rnum = ((Integer) val.get(1)).intValue();
+//		System.out.println("numReactors = "+rnum);
+//*/
+//		val = DwgUtil.getBitShort(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int rnum = ((Integer) val.get(1)).intValue();
+//		System.out.println("numReactors = "+rnum);
+//
+//
+//		val = DwgUtil.testBit(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		boolean isLyrByLineType = ((Boolean) val.get(1)).booleanValue();
+//		System.out.println("isLyrByLineType="+isLyrByLineType);
+//
+//		val = DwgUtil.testBit(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		boolean noLinks = ((Boolean) val.get(1)).booleanValue();
+//		System.out.println("noLinks="+noLinks);
+//
+//
+//		val = DwgUtil.getBitShort(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int color = ((Integer) val.get(1)).intValue();
+//		System.out.println("color="+color);
+//
+//
+//		val = DwgUtil.getBitDouble(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		float ltscale = ((Double) val.get(1)).floatValue();
+//		System.out.println("ltscale="+ltscale);
+//
+//		val = DwgUtil.getBitShort(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int invis = ((Integer) val.get(1)).intValue();
+//		System.out.println("invis="+invis);
+//
+//		val = DwgUtil.getBitShort(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int flag = ((Integer) val.get(1)).intValue();
+//		System.out.println("flag="+flag);
+//
+//		double dVal = 0d;
+//		if((flag & 0x4) > 0){
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dVal = ((Double) val.get(1)).doubleValue();
+//		}
+//		System.out.println("constWidth="+dVal);
+//
+//		dVal = 0d;
+//		if((flag & 0x8) > 0){
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dVal = ((Double) val.get(1)).doubleValue();
+//		}
+//		System.out.println("elevation="+dVal);
+//
+//		dVal = 0d;
+//		if ((flag & 0x2) > 0){
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dVal = ((Double) val.get(1)).doubleValue();
+//		}
+//		System.out.println("thickness="+dVal);
+//
+//		double x, y, z ;
+//		x = 0d;
+//		y = 0d;
+//		z = 0d;
+//
+//		if ((flag & 0x1) > 0){
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			x = ((Double) val.get(1)).doubleValue();
+//
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			y = ((Double) val.get(1)).doubleValue();
+//
+//			val = DwgUtil.getBitDouble(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			z = ((Double) val.get(1)).doubleValue();
+//		}
+//		System.out.println("normal="+x+","+y+","+z);
+//
+//		val = DwgUtil.getBitLong(data, bitPos);
+//		bitPos = ((Integer) val.get(0)).intValue();
+//		int np = ((Integer) val.get(1)).intValue();
+//		System.out.println("numPoints="+np);
+//
+//		int nb = 0;
+//		if((flag & 0x10) > 0){
+//			val = DwgUtil.getBitLong(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			nb = ((Integer) val.get(1)).intValue();
+//		}
+//		System.out.println("numBulges="+nb);
+//		int nw = 0;
+//		if((flag & 0x20) > 0){
+//			val = DwgUtil.getBitLong(data, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			nw = ((Integer) val.get(1)).intValue();
+//		}
+//		System.out.println("numWidths="+nw);
+//		if(np > 0){
+//			Point2D[] points = new Point2D[np];
+//			for(int i = 0; i < np; i++){
+//				val = DwgUtil.getRawDouble(data, bitPos);
+//				bitPos = ((Integer) val.get(0)).intValue();
+//				x = ((Double) val.get(1)).doubleValue();
+//
+//				val = DwgUtil.getRawDouble(data, bitPos);
+//				bitPos = ((Integer) val.get(0)).intValue();
+//				y = ((Double) val.get(1)).doubleValue();
+//
+//				points[i] = new Point2D.Double(x, y);
+//				System.out.println("Punto"+i+"="+x+","+y);
+//			}//for
+//		}//if np
+//
+//		if(nb > 0){
+//			double[] bulges = new double[nb];
+//			for(int i = 0; i < nb; i++){
+//				val = DwgUtil.getRawDouble(data, bitPos);
+//				bitPos = ((Integer) val.get(0)).intValue();
+//				bulges[i] = ((Double) val.get(1)).doubleValue();
+//				System.out.println("Bulge"+i+"="+bulges[i]);
+//			}//for
+//
+//		}//if nb
+//
+//		if(nw > 0){
+//			double[][] widths = new double[nw][2];
+//			for(int i = 0; i < nw; i++){
+//				val = DwgUtil.getBitDouble(data, bitPos);
+//				bitPos = ((Integer) val.get(0)).intValue();
+//				double sw = ((Double) val.get(1)).doubleValue();
+//
+//				val = DwgUtil.getBitDouble(data, bitPos);
+//				bitPos = ((Integer) val.get(0)).intValue();
+//				double ew = ((Double) val.get(1)).doubleValue();
+//
+//				widths[i][0] = sw;
+//				widths[i][1] = ew;
+//				System.out.println("Width"+i+"="+sw+","+ew);
+//			}//for
+//		}
+     }
+
+	public void test3(){
+		//test of extrusion
+		double[] coord = null;
+		double[] extrusion = null;
+		double[] extrusion2 = new double[]{0, 0, 1};
+
+		coord = new double[]{790089.65, 4477974.75, 9.560000000114087};
+		extrusion = new double[]{-0.5037965987025721, 0.07005064807841195, 0.8609772899673451};
+		//1. algoritmo original, vector normal distinto
+//		double[] newCoord = AcadExtrusionCalculator.extrude(coord, extrusion);
+//		newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion);
+//
+		//2� ahora con vector normal coincidente con eje Z
+//		newCoord = AcadExtrusionCalculator.extrude(coord, extrusion2);
+//		newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion2);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg2FMap.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg2FMap.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg2FMap.java	(revision 435)
@@ -0,0 +1,91 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: IDwg2FMap.java 29001 2009-05-26 15:32:46Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.3  2007/03/20 19:55:27  azabala
+* source code cleaning
+*
+* Revision 1.2  2007/01/18 13:35:22  azabala
+* Refactoring general para evitar dar tantas pasadas en la carga, y para incrementar
+* la legibilidad del codigo (demasiados if-else-if en vez de usar polimorfismo)
+*
+* Revision 1.1  2007/01/12 19:29:58  azabala
+* first version in cvs
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+/**
+ * All dwg objects that are drawing entities
+ * and that can be converted to a fmap geometry
+ * implements this interface.
+ *
+ * */
+/*
+ * TODO
+ * Esta solucion tiene el problema de que es mas simple
+ * (cada entidad dwg se ocupa de su conversion a fmap),pero acopla
+ * libDwg con fmap
+ * (una clase Dwg2FMap lo desacoplar�a, pero llenar�a el codigo de
+ * infinitos if(dwg instanceof ...) else if.....
+ *
+ * */
+public interface IDwg2FMap {
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException;
+	public String toFMapString(boolean is3DFile);
+	public int getGeometryType();
+	public int getGeometrySubType(boolean is3DFile);
+	public String toString();
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgFile.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgFile.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgFile.java	(revision 435)
@@ -0,0 +1,881 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+import org.gvsig.dwg.lib.readers.DwgFileV12Reader;
+import org.gvsig.dwg.lib.readers.DwgFileV14Reader;
+import org.gvsig.dwg.lib.readers.DwgFileV15Reader;
+import org.gvsig.dwg.lib.readers.DwgFileVR2004Reader;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The DwgFile class provides a revision-neutral interface for reading and handling
+ * DWG files
+ * Reading methods are useful for reading DWG files, and handling methods like
+ * calculateDwgPolylines() are useful for handling more complex
+ * objects in the DWG file
+ *
+ * @author jmorell
+ * @author azabala
+ */
+public class DwgFile {
+	/**
+	 * It has all known DWG version's header.
+	 * Extracted from Autodesk web.
+	 */
+	private static HashMap acadVersions = new HashMap();
+	static{
+		acadVersions.put("AC1004", "Autocad R9");
+		acadVersions.put("AC1006", "Autocad R10");
+		acadVersions.put("AC1007", "Autocad pre-R11");
+		acadVersions.put("AC1007", "Autocad pre-R11");
+		acadVersions.put("AC1008", "Autocad pre-R11b");
+		acadVersions.put("AC1009", "Autocad R12");
+		acadVersions.put("AC1010", "Autocad pre-R13 a");
+		acadVersions.put("AC1011", "Autocad pre-R13 b");
+		acadVersions.put("AC1012", "Autocad R13");
+		acadVersions.put("AC1013", "Autocad pre-R14");
+		acadVersions.put("AC1014", "Autocad R14");
+		acadVersions.put("AC1500", "Autocad pre-2000");
+		acadVersions.put("AC1015", "Autocad R2000, R2000i, R2002");
+		acadVersions.put("AC402a", "Autocad pre-2004a");
+		acadVersions.put("AC402b", "Autocad pre-2004b");
+		acadVersions.put("AC1018", "Autocad R2004, R2005, R2006");
+		acadVersions.put("AC1021", "Autocad R2007");
+
+	}
+
+	private static Logger logger = LoggerFactory.getLogger(DwgFile.class.getName());
+	/**
+	 * Path and name of the dwg file
+	 * */
+	private String fileName;
+	/**
+	 * DWG version of the file (AC1013, AC1018, etc.)
+	 * */
+	private String dwgVersion;
+
+	/**
+	 * Offsets to the DWG sections
+	 */
+	private ArrayList dwgSectionOffsets;
+	/**
+	 * Header vars readed from the HEADER section of the DWG file
+	 * */
+	private Map headerVars;
+
+	/**
+	 * This list contains what in OpenDWG specification is called
+	 * the object map ( a collection of entries where each entry contains
+	 * the seek of each object, and its size)
+	 * */
+	private ArrayList dwgObjectOffsets;
+
+	/**
+	 * For each entry in dwgObjectOffsets, we have an instance of
+	 * DwgObject in the dwgObjects collection
+	 *
+	 * */
+	private List dwgObjects;
+	private HashMap handle_objects;
+
+
+	private ArrayList dwgClasses;
+
+
+	/**
+	 * hash map that indexes all DwgLayer objects
+	 * by its handle property
+	 * */
+	private HashMap layerTable;
+
+	/**
+	 * Specific reader of the DWG file version (12, 13, 14, 2000, etc., each
+	 * version will have an specific reader)
+	 * */
+	private IDwgFileReader dwgReader;
+	private boolean dwg3DFile = false;
+	/**
+	 * Memory mapped byte buffer of the whole DWG file
+	 * */
+	private ByteBuffer bb;
+
+	/*
+	 * Optimizaciones para evitar leer el fichero completo en cada
+	 * pasada.
+	 * */
+	/**
+	 * Contains all IDwgPolyline implementations
+	 * */
+	private List dwgPolylines;
+	/**
+	 * Contains all INSERT entities of the dwg file
+	 * (these entities must be processed in a second pass)
+	 *
+	 * */
+	private List insertList;
+
+	private List blockList;
+
+
+	/**
+	 * Constructor.
+	 * @param fileName an absolute path to the DWG file
+	 */
+	public DwgFile(String fileName) {
+		this.fileName = fileName;
+
+		dwgSectionOffsets = new ArrayList();
+		dwgObjectOffsets = new ArrayList();
+		headerVars = new HashMap();
+
+		dwgClasses = new ArrayList();
+
+		dwgObjects = new ArrayList();
+		handle_objects = new HashMap();
+
+		layerTable = new HashMap();
+
+		dwgPolylines = new ArrayList();
+		insertList = new ArrayList();
+
+		blockList = new ArrayList();
+
+	}
+
+	public String getDwgVersion() {
+		return dwgVersion;
+	}
+
+	/**
+	 * Reads a DWG file and put its objects in the dwgObjects Vector
+	 * This method is version independent
+	 *
+	 * @throws IOException If the file location is wrong
+	 */
+	public void read() throws IOException,
+				DwgVersionNotSupportedException
+	{
+		setDwgVersion();
+		if (dwgVersion.equalsIgnoreCase("Autocad R2000, R2000i, R2002")) {
+			dwgReader = new DwgFileV15Reader();
+		}else if (dwgVersion.equalsIgnoreCase("Autocad pre-R14")||
+				dwgVersion.equalsIgnoreCase("Autocad R14") ||
+				dwgVersion.equalsIgnoreCase("Autocad R13")) {
+			dwgReader = new DwgFileV14Reader();
+		}else if (dwgVersion.equalsIgnoreCase("Autocad R2004, R2005, R2006")){
+			dwgReader = new DwgFileVR2004Reader();
+		} else if (dwgVersion.equalsIgnoreCase("Autocad R12")||
+				dwgVersion.equalsIgnoreCase("Autocad pre-R13 a") ||
+				dwgVersion.equalsIgnoreCase("Autocad pre-R13 b")) {
+
+			boolean isR13 = true;
+			if(dwgVersion.equalsIgnoreCase("Autocad R12"))
+					isR13 = false;
+			dwgReader = new DwgFileV12Reader(isR13);
+		}else {
+			DwgVersionNotSupportedException exception =
+				new DwgVersionNotSupportedException("Version de DWG no soportada");
+			exception.setDwgVersion(dwgVersion);
+			throw exception;
+		}
+		try{
+		dwgReader.read(this, bb);
+		}catch(Throwable t){
+			t.printStackTrace();
+			throw new IOException("Error leyendo dwg");
+		}
+	}
+
+	private void setDwgVersion() throws IOException {
+		File file = new File(fileName);
+		FileInputStream fileInputStream = new FileInputStream(file);
+		FileChannel fileChannel = fileInputStream.getChannel();
+		long channelSize = fileChannel.size();
+		bb = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, channelSize);
+		byte[] versionBytes = {bb.get(0),
+								bb.get(1),
+								bb.get(2),
+								bb.get(3),
+								bb.get(4),
+								bb.get(5)};
+		ByteBuffer versionByteBuffer = ByteBuffer.wrap(versionBytes);
+		String[] bs = new String[versionByteBuffer.capacity()];
+		String versionString = "";
+		for (int i=0; i<versionByteBuffer.capacity(); i++) {
+			bs[i] = new String(new byte[]{(byte)(versionByteBuffer.get(i))});
+			versionString = versionString + bs[i];
+		}
+		String version = (String) acadVersions.get(versionString);
+		if(version == null)
+			version = "Unknown Dwg format";
+		this.dwgVersion = version;
+	}
+
+	public void setHeader(String key, Object value){
+		headerVars.put(key, value);
+	}
+
+	public Object getHeader(String key){
+		return headerVars.get(key);
+	}
+
+	/*
+	 * A DwgLayer is a DWG drawing entity, so all DwgLayer objects are
+	 * saved in dwgObjects collection.
+	 * Instead of iterate over the full collection, is faster check every object
+	 * and save all the DwgLayer instances in their own collection.
+	 *
+	 */
+	protected void addDwgLayer(DwgLayer dwgLayer){
+		layerTable.put(new Integer(dwgLayer.getHandle().getOffset()),
+				dwgLayer);
+	}
+
+	private void printInfoOfAObject (DwgObject entity){
+		logger.info("index = "+entity.getIndex() + " entity.type = " + entity.type + " entityClassName = "+ entity.getClass().getName());
+		logger.info("handleCode = "+entity.getHandle().getCode());
+		logger.info("entityLayerHandle = "+entity.getHandle().getOffset());
+		if(entity.hasLayerHandle()){
+			logger.info("layerHandleCode = "+entity.getLayerHandle().getCode());
+			logger.info("layerHandle = "+entity.getLayerHandle().getOffset());
+		}
+		if(entity.hasSubEntityHandle()){
+			logger.info("subEntityHandleCode = "+entity.getSubEntityHandle().getCode());
+			logger.info("subEntityHandle = "+entity.getSubEntityHandle().getOffset());
+		}
+		if(entity.hasNextHandle()){
+			logger.info("nextHandleCode = "+entity.getNextHandle().getCode());
+			logger.info("nextHandle = "+entity.getNextHandle().getOffset());
+		}
+		if(entity.hasPreviousHandle()){
+			logger.info ("previousHandleCode = "+entity.getPreviousHandle().getCode());
+			logger.info ("previousHandle = "+entity.getPreviousHandle().getOffset());
+		}
+		if(entity.hasXDicObjHandle()){
+			logger.info ("xDicObjHandleCode = "+entity.getXDicObjHandle());
+			logger.info ("xDicObjHandle = "+entity.getXDicObjHandle());
+		}
+		if(entity.hasReactorsHandles()){
+			ArrayList reactorsHandles = entity.getReactorsHandles();
+			int size = reactorsHandles.size();
+			logger.info ("NUMERO DE reactors = "+size);
+			DwgHandleReference hr;
+			for(int i=0; i<size; i++){
+				hr=(DwgHandleReference)reactorsHandles.get(i);
+				logger.info ("reactorHandleCode = "+hr.getCode());
+				logger.info (" reactorHandle = "+hr.getOffset());
+			}
+		}
+
+	}
+	public DwgLayer getDwgLayer(DwgObject entity){
+		DwgHandleReference handle = entity.getLayerHandle();
+		if(handle == null){
+			return null;
+		}
+		int	handleCode = handle.getCode();
+		int	entityLayerHandle = entity.getLayerHandle().getOffset();
+		int layerHandle = -1;
+
+		int entityRecord;
+		DwgObject object;
+
+
+		/*
+		 * OpenDWG spec, v3, page 11. HANDLE REFERENCES
+		 *
+		 * A handle is formed by this fields:
+		 * a) CODE (4 bits)
+		 * b) COUNTER (4 bits)
+		 * c) OFFSET of the object (handle itself).
+		 *
+		 * CODE could take these values:
+		 * 1) 0x2, 0x3, 0x4, 0x5 -> offset is the handle of the layer
+		 * 2) 0x6 -> offset is the next object handle
+		 * 3) 0x8 -> offset is the previous object handle
+		 * 4) 0xA -> result is reference handle plus offset
+ 		 * 5) 0xC -> result is reference handle minus offset
+		 *
+		 * */
+
+		// FIXME: Esto no esta terminado. Falta considerar los codigo
+		// 0x2, 0x3, 0x6, 0xA que no han aparecido en los archivos de prueba.
+		switch(handleCode){
+		case 0x4:
+			if (entity.hasNextHandle()){
+				int nextHandleCode = entity.getNextHandle().getCode();
+				if (nextHandleCode == 0x5) {
+					layerHandle = entity.getNextHandle().getOffset();
+				} else {
+					//TODO: No se han previsto nextHandleCode != 0x5
+//					System.out.println ("DwgFile.getDwgLayer: handleCode "+handleCode+
+//							" con nextHandleCode "+ nextHandleCode +" no implementado.");
+				}
+			} else {
+				layerHandle = entity.getLayerHandle().getOffset();
+			}
+			break;
+		case 0x5:
+			layerHandle = entity.getLayerHandle().getOffset();
+			break;
+		case 0x8:
+			if (entity.hasNextHandle()){
+				int nextHandleCode = entity.getNextHandle().getCode();
+				if (nextHandleCode == 0x5) {
+					layerHandle = entity.getNextHandle().getOffset();
+				} else {
+					//TODO No se han previsto nextHandleCode != 0x5
+//					System.out.println ("DwgFile.getDwgLayer: handleCode "+handleCode+
+//							" con nextHandleCode "+ nextHandleCode +" no implementado.");
+				}
+			} else {
+				layerHandle = entity.getHandle().getOffset() - 1;
+			}
+			break;
+		case 0xC:
+			if (entity.hasNextHandle()){
+				int nextHandleCode = entity.getNextHandle().getCode();
+				if (nextHandleCode == 0x5) {
+					layerHandle = entity.getNextHandle().getOffset();
+				} else {
+					//TODO: No se han previsto nextHandleCode != 0x5
+//					System.out.println ("DwgFile.getDwgLayer: handleCode "+handleCode+
+//							" con nextHandleCode "+ nextHandleCode +" no implementado.");
+				}
+			} else {
+				layerHandle = entity.getHandle().getOffset() - entity.getLayerHandle().getOffset() + 1;
+			}
+			break;
+		default:
+//			System.out.println ("DwgFile.getDwgLayer: handleCode "+handleCode+" no implementado. entityLayerHandle="+entityLayerHandle);
+		}
+
+		if(layerHandle != -1){
+			Iterator lyrIterator = layerTable.values().iterator();
+			while(lyrIterator.hasNext()){
+				DwgLayer lyr = (DwgLayer) lyrIterator.next();
+				int lyrHdl = lyr.getHandle().getOffset();
+				if (lyrHdl == layerHandle){
+					return lyr;
+				}
+			}
+		}
+//		System.out.println("NO SE HA ENCONTRADO UNA CAPA CON HANDLE " + layerHandle);
+//		printInfoOfAObject(entity);
+		return null;
+	}
+
+	public DwgObject getDwgSuperEntity(DwgObject entity) {
+		if(entity.hasSubEntityHandle()){
+			int handleCode = entity.subEntityHandle.getCode();
+			int offset = entity.subEntityHandle.getOffset();
+			int handle = -1;
+
+			DwgObject object;
+
+			switch(handleCode){
+			// TODO: case 0x2:
+			// TODO: case 0x3:
+			case 0x4:
+			case 0x5:
+				handle = offset;
+				break;
+			// TODO: case 0x6:
+			case 0x8:
+				handle=entity.getHandle().getOffset() - 1;
+				break;
+			case 0xA:
+				handle = entity.getHandle().getOffset() + offset;
+				break;
+			case 0xC:
+				handle = entity.getHandle().getOffset() - offset;
+				break;
+			default:
+				logger.warn ("DwgObject.getDwgSuperEntity: handleCode "+handleCode+" no implementado. offset = "+offset);
+			}
+			if(handle != -1){
+				object = getDwgObjectFromHandle(handle);
+				if(object != null)
+					return object;
+			}
+		}
+		return null;
+	}
+
+	public String getLayerName(DwgObject entity) {
+		DwgLayer dwgLayer = getDwgLayer(entity);
+		if(dwgLayer == null){
+			return "";
+		}else{
+			return dwgLayer.getName();
+		}
+	}
+
+	/**
+     * Returns the color of the layer of a DWG object
+	 *
+     * @param entity DWG object which we want to know its layer color
+	 * @return int Layer color of the DWG object in the Autocad color code
+	 */
+	public int getColorByLayer(DwgObject entity) {
+		int colorByLayer;
+		DwgLayer dwgLyr = getDwgLayer(entity);
+		if(dwgLyr == null)
+			colorByLayer = 0;
+		else
+			colorByLayer = dwgLyr.getColor();
+		return colorByLayer;
+	}
+	/**
+	 * Configure the geometry of the polylines in a DWG file from the vertex list in
+	 * this DWG file. This geometry is given by an array of Points.
+	 * Besides, manage closed polylines and polylines with bulges in a GIS Data model.
+     * It means that the arcs of the polylines will be done through a set of points and
+     * a distance between these points.
+	 */
+	public void calculateGisModelDwgPolylines() {
+		/*
+		 * In Dwg 12 format, all vertices of a polyline are between polyline entity
+		 * and endsec entity. Also, polylines dont save any handle of their vertices (first and last).
+		 *
+		 * After Dwg 12 version, we have the opposite case: polylines have handles/pointers to their
+		 * first and last vertices.
+		 *
+		 * If dwg file is not V12, we must look for all polyline vertices (and we must to wait until
+		 * all entities are readed).
+		 * If dwg file is V12, all polylines already have their vertices.
+		 * */
+		if(! (dwgReader instanceof DwgFileV12Reader)){
+			for (int i = 0; i < dwgPolylines.size(); i++){
+				DwgObject pol = (DwgObject)dwgPolylines.get(i);
+				if (pol instanceof IDwgPolyline) {
+					((IDwgPolyline)pol).calculateGisModel(this);
+				}//if
+			}//for
+		}
+	}
+
+    /**
+     * Configure the geometry of the polylines in a DWG file from the vertex list in
+     * this DWG file. This geometry is given by an array of Points
+     * Besides, manage closed polylines and polylines with bulges in a GIS Data model.
+     * It means that the arcs of the polylines will be done through a curvature
+     * parameter called bulge associated with the points of the polyline.
+     */
+	//TODO Refactorizar para que solo se aplique a las Polilineas
+
+//	public void calculateCadModelDwgPolylines() {
+//		for (int i=0;i<dwgObjects.size();i++) {
+//			DwgObject pol = (DwgObject)dwgObjects.get(i);
+//			if (pol instanceof DwgPolyline2D) {
+//				int flags = ((DwgPolyline2D)pol).getFlags();
+//				int firstHandle = ((DwgPolyline2D)pol).getFirstVertexHandle().getOffset();
+//				int lastHandle = ((DwgPolyline2D)pol).getLastVertexHandle().getOffset();
+//				ArrayList pts = new ArrayList();
+//				ArrayList bulges = new ArrayList();
+//				double[] pt = new double[3];
+//				for (int j=0;j<dwgObjects.size();j++) {
+//					DwgObject firstVertex = (DwgObject)dwgObjects.get(j);
+//					if (firstVertex instanceof DwgVertex2D) {
+//						int vertexHandle = firstVertex.getHandle().getOffset();
+//						if (vertexHandle==firstHandle) {
+//							int k=0;
+//							while (true) {
+//								DwgObject vertex = (DwgObject)dwgObjects.get(j+k);
+//								int vHandle = vertex.getHandle().getOffset();
+//								if (vertex instanceof DwgVertex2D) {
+//									pt = ((DwgVertex2D)vertex).getPoint();
+//									pts.add(new Point2D.Double(pt[0], pt[1]));
+//									double bulge = ((DwgVertex2D)vertex).getBulge();
+//									bulges.add(new Double(bulge));
+//									k++;
+//									if (vHandle==lastHandle && vertex instanceof DwgVertex2D) {
+//										break;
+//									}
+//								} else if (vertex instanceof DwgSeqend) {
+//									break;
+//								}
+//							}
+//						}
+//					}
+//				}
+//				if (pts.size()>0) {
+//					/*Point2D[] newPts = new Point2D[pts.size()];
+//					if ((flags & 0x1)==0x1) {
+//						newPts = new Point2D[pts.size()+1];
+//						for (int j=0;j<pts.size();j++) {
+//							newPts[j] = (Point2D)pts.get(j);
+//						}
+//						newPts[pts.size()] = (Point2D)pts.get(0);
+//						bulges.add(new Double(0));
+//					} else {
+//						for (int j=0;j<pts.size();j++) {
+//							newPts[j] = (Point2D)pts.get(j);
+//						}
+//					}*/
+//					double[] bs = new double[bulges.size()];
+//					for (int j=0;j<bulges.size();j++) {
+//						bs[j] = ((Double)bulges.get(j)).doubleValue();
+//					}
+//					((DwgPolyline2D)pol).setBulges(bs);
+//					//Point2D[] points = GisModelCurveCalculator.calculateGisModelBulge(newPts, bs);
+//					Point2D[] points = new Point2D[pts.size()];
+//					for (int j=0;j<pts.size();j++) {
+//					    points[j] = (Point2D)pts.get(j);
+//					}
+//					((DwgPolyline2D)pol).setPts(points);
+//				} else {
+////					System.out.println("Encontrada polil�nea sin puntos ...");
+//					// TODO: No se debe mandar nunca una polil�nea sin puntos, si esto
+//					// ocurre es porque existe un error que hay que corregir ...
+//				}
+//			} else if (pol instanceof DwgPolyline3D) {
+//			} else if (pol instanceof DwgLwPolyline && ((DwgLwPolyline)pol).getVertices()!=null) {
+//			}
+//		}
+//	}
+
+	/*
+	 * TODO Revisar los bloques que son XREF
+	 * */
+	public void blockManagement2(){
+		Iterator it = null;
+
+
+		//dwg v12 blocks already has their entities added
+		//for the rest of versions, we add block entities to their owner block
+		if(! (dwgReader instanceof DwgFileV12Reader)){
+			//once we have read all dwg entities, we look for all of them
+			//that has a superentity that is a block (to fill in the entity list
+			//of each block
+			it = dwgObjects.iterator();
+			int i = 0;
+			while(it.hasNext()){
+				DwgObject entity = (DwgObject)it.next();
+				DwgObject superEnt = getDwgSuperEntity(entity);
+				if(superEnt instanceof DwgBlockHeader){
+					DwgBlockHeader blk = (DwgBlockHeader)superEnt;
+					blk.addObject(entity);
+					it.remove();//TODO Creo que esto es lento, mejor
+					//el metodo original (en java solo se duplican las referencias)
+					i++;
+				}
+			}//while
+		}//if dwgfilev12
+
+		//after that, we process the INSERTs
+		it = insertList.iterator();
+		while(it.hasNext()){
+			DwgInsert insert = (DwgInsert) it.next();
+			if(insert.isProcessed()){
+				//It has been processed nexted to other insert
+				continue;
+			}
+			insert.setProcessed(true);
+			double[] p = insert.getInsertionPoint();
+			Point2D point = new Point2D.Double(p[0], p[1]);
+			double[] scale = insert.getScale();
+			double rot = insert.getRotation();
+			int blockHandle = insert.getBlockHeaderHandle().getOffset();
+			manageInsert2(point, scale,
+					rot, blockHandle,
+					dwgObjects, handle_objects);
+		}
+
+}
+
+
+
+	public void manageInsert2(Point2D insPoint, double[] scale,
+			double rot, int bHandle,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjectsWithoutBlocks) {
+
+		DwgObject object = (DwgObject) handle_objects.get(new Integer(bHandle));
+		if(object == null){
+			logger.error("No hemos encontrado el BlockHeader cuyo handle es "+bHandle);
+			return;
+		}else if(! (object instanceof DwgBlockHeader)){
+			//Hay un problema con la asignaci�n de handle
+			//Un INSERT tiene como handle de Block una entidad que no es block
+			logger.error("handle incorrecto." + object.getClass().getName() + " no es un blockheader");
+			return;
+		}
+
+		DwgBlockHeader blockHeader = (DwgBlockHeader)object;
+		double[] bPoint = blockHeader.getBasePoint();
+		String bname = blockHeader.getName();
+		if (bname.startsWith("*"))
+			return;
+
+		//TODO Cambiar por List. Done.
+		List entities = blockHeader.getObjects();
+		if(entities.size() == 0){
+			logger.warn("El bloque "+blockHeader.getName()+" no tiene ninguna entidad");
+		}
+		Iterator blkEntIt = entities.iterator();
+		while(blkEntIt.hasNext()){
+			DwgObject obj = (DwgObject) blkEntIt.next();
+			 manageBlockEntity(obj, bPoint,
+			 		  insPoint, scale,
+			 		  rot, dwgObjectsWithoutBlocks,
+			 		  handleObjectsWithoutBlocks);
+		}//while
+	}
+
+
+	public int getIndexOf(DwgObject dwgObject){
+		return dwgObjects.indexOf(dwgObject);
+	}
+
+
+
+    /**
+     * Changes the location of an object extracted from a block. This location will be
+     * obtained through the insertion parameters from the block and the corresponding
+     * insert.
+     * @param entity, the entity extracted from the block.
+     * @param bPoint, offset for the coordinates of the entity.
+     * @param insPoint, coordinates of the insertion point for the entity.
+     * @param scale, scale for the entity.
+     * @param rot, rotation angle for the entity.
+     * @param id, a count as a id.
+     * @param dwgObjectsWithoutBlocks, a object list with the elements extracted from
+     * the blocks.
+     */
+	private void manageBlockEntity(DwgObject entity,
+									double[] bPoint,
+									Point2D insPoint,
+									double[] scale,
+									double rot,
+									List dwgObjectsWithoutBlocks,
+									Map handleObjectsWithoutBlocks) {
+
+		if(entity instanceof IDwgBlockMember){
+			IDwgBlockMember blockMember = (IDwgBlockMember)entity;
+			blockMember.transform2Block(bPoint, insPoint, scale, rot,
+					dwgObjectsWithoutBlocks,
+					handleObjectsWithoutBlocks,this);
+		}
+
+	}
+
+
+	/**
+	 * Add a DWG section offset to the dwgSectionOffsets vector
+	 *
+	 * @param key Define the DWG section
+	 * @param seek Offset of the section
+	 * @param size Size of the section
+	 */
+	public void addDwgSectionOffset(String key, int seek, int size) {
+		DwgSectionOffset dso = new DwgSectionOffset(key, seek, size);
+		dwgSectionOffsets.add(dso);
+	}
+
+	/**
+     * Returns the offset of DWG section given by its key
+	 *
+     * @param key Define the DWG section
+	 * @return int Offset of the section in the DWG file
+	 */
+	public int getDwgSectionOffset(String key) {
+		int offset = 0;
+		for (int i=0; i<dwgSectionOffsets.size(); i++) {
+			DwgSectionOffset dso = (DwgSectionOffset)dwgSectionOffsets.get(i);
+			String ikey = dso.getKey();
+			if (key.equals(ikey)) {
+				offset = dso.getSeek();
+				break;
+			}
+		}
+		return offset;
+	}
+
+	/**
+	 * Add a DWG object offset to the dwgObjectOffsets vector
+	 *
+	 * @param handle Object handle
+	 * @param offset Offset of the object data in the DWG file
+	 */
+	public void addDwgObjectOffset(int handle, int offset) {
+		DwgObjectOffset doo = new DwgObjectOffset(handle, offset);
+		dwgObjectOffsets.add(doo);
+	}
+
+	/**
+	 *
+	 * Add a DWG object to the dwgObject vector
+	 *
+	 * @param dwgObject DWG object
+	 */
+	public void addDwgObject(DwgObject dwgObject){
+		//TODO Ver si puedo inicializar las listas especificas
+		//(IDwgPolyline, etc) aqu�
+		dwgObjects.add(dwgObject);
+		/*
+		 * TODO Quitar todos estos if-then y sustituirlos por un metodo callback
+		 *
+		 *
+		 * (dwgObject.init(this), y que cada objeto haga lo que tenga que hacer
+		 * */
+		if(dwgObject instanceof DwgLayer){
+			this.addDwgLayer((DwgLayer) dwgObject);
+		}
+
+		//Probamos a no aplicar las extrusiones
+
+		if(dwgObject instanceof IDwgExtrusionable){
+			((IDwgExtrusionable)dwgObject).applyExtrussion();
+
+		}
+
+		if(dwgObject instanceof IDwgPolyline){
+			dwgPolylines.add(dwgObject);
+		}
+		if(dwgObject instanceof IDwg3DTestable){
+			if(!isDwg3DFile()){//if its true, we dont check again
+				setDwg3DFile(((IDwg3DTestable)dwgObject).has3DData());
+			}
+		}
+		if(dwgObject instanceof DwgInsert){
+			insertList.add(dwgObject);
+		}
+
+		if(dwgObject instanceof DwgBlockHeader){
+			blockList.add(dwgObject);
+		}
+		handle_objects.put(new Integer(dwgObject.getHandle().getOffset()), dwgObject);
+
+
+	}
+
+	/**
+	 * Returns dwgObjects from its insertion order (position
+	 * in the dwg file)
+	 *
+	 * @param index order in the dwg file
+	 * @return position
+	 * */
+	public DwgObject getDwgObject(int index){
+		return (DwgObject) dwgObjects.get(index);
+	}
+
+	public DwgObject getDwgObjectFromHandle(int handle){
+		return (DwgObject) handle_objects.get(new Integer(handle));
+	}
+
+	/**
+	 * Add a DWG class to the dwgClasses vector
+	 *
+	 * @param dwgClass DWG class
+	 */
+	public void addDwgClass(DwgClass dwgClass){
+		dwgClasses.add(dwgClass);
+	}
+
+	/**
+	 * Add a DWG class to the dwgClasses vector
+	 *
+	 * @param dwgClass DWG class
+	 */
+	public void addDwgClass(DwgClass2004 dwgClass){
+		dwgClasses.add(dwgClass);
+	}
+
+
+	public void printClasses(){
+		logger.info("#### CLASSES ####");
+		for(int i = 0; i < dwgClasses.size(); i++){
+			DwgClass clazz = (DwgClass) dwgClasses.get(i);
+			logger.info(clazz.toString());
+		}
+		logger.info("#############");
+	}
+
+	public List getDwgClasses(){
+		return dwgClasses;
+	}
+
+    /**
+     * @return Returns the dwgObjectOffsets.
+     */
+    public ArrayList getDwgObjectOffsets() {
+        return dwgObjectOffsets;
+    }
+    /**
+     * @return Returns the dwgObjects.
+     */
+    public List getDwgObjects() {
+        return dwgObjects;
+    }
+    /**
+     * @return Returns the fileName.
+     */
+    public String getFileName() {
+        return fileName;
+    }
+    /**
+     * @return Returns the dwg3DFile.
+     */
+    public boolean isDwg3DFile() {
+        return dwg3DFile;
+    }
+    /**
+     * @param dwg3DFile The dwg3DFile to set.
+     */
+    public void setDwg3DFile(boolean dwg3DFile) {
+        this.dwg3DFile = dwg3DFile;
+    }
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/ByteUtils.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/ByteUtils.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/ByteUtils.java	(revision 435)
@@ -0,0 +1,754 @@
+/* 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.dwg.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 ((int) 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);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/CorruptedDwgEntityException.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/CorruptedDwgEntityException.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/CorruptedDwgEntityException.java	(revision 435)
@@ -0,0 +1,65 @@
+/*
+ * Created on 01-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: CorruptedDwgEntityException.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/02/01 20:00:27  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+public class CorruptedDwgEntityException extends Exception {
+
+	public CorruptedDwgEntityException(String string) {
+		super(string);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgVertex.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgVertex.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgVertex.java	(revision 435)
@@ -0,0 +1,71 @@
+/*
+ * Created on 04-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwgVertex.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/03/20 19:55:27  azabala
+* source code cleaning
+*
+* Revision 1.1  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+/**
+ * Base interface for all DWG vertices. 
+ * 
+ * @author azabala
+ * 
+ * */
+public interface IDwgVertex {
+	public double[] getPoint();
+	public void setPoint(double[] point);
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHeader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHeader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHeader.java	(revision 435)
@@ -0,0 +1,43 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+/**
+ * The DwgHeader class implements the Header of a DWG file
+ * 
+ * @author jmorell
+ */
+public class DwgHeader {
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Point3D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Point3D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Point3D.java	(revision 435)
@@ -0,0 +1,129 @@
+/*
+ *
+ * Este codigo se distribuye bajo licencia GPL
+ * de GNU. Para obtener una c�pia integra de esta
+ * licencia acude a www.gnu.org.
+ * 
+ * Este software se distribuye "como es". AGIL
+ * solo  pretende desarrollar herramientas para
+ * la promoci�n del GIS Libre.
+ * AGIL no se responsabiliza de las perdidas econ�micas o de 
+ * informaci�n derivadas del uso de este software.
+ */
+
+
+package org.gvsig.dwg.lib.util;
+
+/**
+ *  3dim double point. A point is transformed different than a vector.
+ *  The class is now declared final to allow a more aggresive optimization.
+ *
+ *  @see       dxfviewer.math.Vector3D;
+ *
+ *  @version   1.10,�01/13/99
+ */
+public final class Point3D {
+  public double   x, y, z;     // coordinates, allowing direct access
+
+  /**
+   *
+   */
+  public Point3D() {
+  }
+
+  /**
+   *  Copy constructor.
+   *  @param  p    point to copy
+   */
+  public Point3D(Point3D p) {
+	x = p.x;
+	y = p.y;
+	z = p.z;
+  }
+
+  /**
+   *  @param   xx    x coord
+   *  @param   yy    y coord
+   *  @param   zz    z coord
+   */
+  public Point3D(double xx, double yy, double zz) {
+	x = xx;
+	y = yy;
+	z = zz;
+  }
+
+  /**
+   *  Scale.
+   *  @param   f     scaling factor
+   */
+  public void scale(double f) {
+	if (f != 1f) {
+	  x *= f;
+	  y *= f;
+	  z *= f;
+	}
+  }
+
+  /**
+   *  Add a vector.
+   *  @param  v      vector to add
+   */
+  public void add(Vector3D v) {
+	x += v.x;
+	y += v.y;
+	z += v.z;
+  }
+
+  /**
+   *  Get sum with vector.
+   *  @param  v     vector to add
+   *  @return this+v
+   */
+  public Point3D plus(Vector3D v) {
+	Point3D ret = new Point3D(this);
+	ret.add(v);
+	return ret;
+  }
+
+  /**
+   *  Substract a vector.
+   *  @param  v     vector to substract
+   */
+  public void sub(Vector3D v) {
+	x -= v.x;
+	y -= v.y;
+	z -= v.z;
+  }
+
+  /**
+   *  Get difference with vector.
+   *  @param  v     vector to substract
+   *  @return this-v
+   */
+  public Point3D minus(Vector3D v) {
+	Point3D ret = new Point3D(this);
+	ret.sub(v);
+	return ret;
+  }
+
+  /**
+   *  Get difference with point.
+   *  @param  p     point to substract
+   *  @return this-p
+   */
+  public Vector3D minus(Point3D p) {
+	Vector3D ret = new Vector3D(this);
+	ret.sub(new Vector3D(p));
+	return ret;
+  }
+
+  /**
+   *  Output.
+   *  @return  output string
+   */
+  public String toString() {
+	return new String(new StringBuffer().append("[").append(x).append(",").append(y).append(",").append(z).append("]"));
+  }
+}
+
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/FMapUtil.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/FMapUtil.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/FMapUtil.java	(revision 435)
@@ -0,0 +1,117 @@
+/*
+ * Created on 18-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.awt.geom.Point2D;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.aggregate.MultiCurve;
+import org.gvsig.fmap.geom.aggregate.MultiLine;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Line;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.primitive.Polygon;
+import org.gvsig.fmap.geom.primitive.Surface;
+
+/**
+ * @author alzabord
+ *
+ */
+public class FMapUtil {
+
+    private static final GeometryManager gManager = GeometryLocator
+            .getGeometryManager();
+
+    public static Line ptsToLine(List<double[]> pts, int subType)
+            throws CreateGeometryException {
+
+        if (pts.size() < 2) {
+            throw new IllegalArgumentException();
+        }
+        try {
+            boolean is3D = subType == Geometry.SUBTYPES.GEOM3D || subType == Geometry.SUBTYPES.GEOM3DM;
+            Line line = gManager.createLine(subType);
+            for (double[] p : pts) {
+                if( is3D ) {
+                    if( p.length<3 ) {
+                        line.addVertex(p[0],p[1],0);            
+                    } else {
+                        line.addVertex(p[0],p[1],p[2]);            
+                    }
+                } else {
+                    line.addVertex(p[0],p[1]);            
+                }
+            }
+            return line;
+        } catch(RuntimeException ex) {
+            throw ex;
+        }
+    }
+
+    public static Surface ptsToPolygon(List<double[]> pts, int subType)
+            throws CreateGeometryException {
+
+        if (pts.size() < 3) {
+            throw new IllegalArgumentException();
+        }
+
+        boolean is3D = subType == Geometry.SUBTYPES.GEOM3D || subType == Geometry.SUBTYPES.GEOM3DM;
+        Polygon polygon = gManager.createPolygon(subType);
+        for (double[] p : pts) {
+            if( is3D ) {
+                polygon.addVertex(p[0],p[1],p[2]);            
+            } else {
+                polygon.addVertex(p[0],p[1]);            
+            }
+        }
+        return polygon;
+    }
+
+    public static Point createPoint(int subType, double[] point) throws CreateGeometryException {
+        Point result = gManager.createPoint(point[0], point[1], subType);
+        if (subType == Geometry.SUBTYPES.GEOM3D) {
+            result.setCoordinateAt(Geometry.DIMENSIONS.Z, point[2]);
+        }
+        return result;
+    }
+
+    public static Point createPoint(int subType, Point2D point) throws CreateGeometryException {
+        Point result = gManager.createPoint(point.getX(), point.getY(), subType);
+        return result;
+    }
+
+    public static Point createPoint(int subType, IDwgVertex dwgvertex) throws CreateGeometryException {
+        double[] point = dwgvertex.getPoint();
+        Point result = gManager.createPoint(point[0], point[1], subType);
+        if (subType == Geometry.SUBTYPES.GEOM3D) {
+            result.setCoordinateAt(Geometry.DIMENSIONS.Z, point[2]);
+        }
+        return result;
+    }
+
+    /**
+     * Devuelve la distancia desde angle1 a angle2. Angulo en radianes de
+     * diferencia entre angle1 y angle2 en sentido antihorario
+     *
+     * @param angle1 angulo en radianes. Debe ser positivo y no dar ninguna
+     * vuelta a la circunferencia
+     * @param angle2 angulo en radianes. Debe ser positivo y no dar ninguna
+     * vuelta a la circunferencia
+     *
+     * @return distancia entre los �ngulos
+     */
+    public static double angleDistance(double angle1, double angle2) {
+        if (angle1 < angle2) {
+            return angle2 - angle1;
+        } else {
+            return ((Math.PI * 2) - angle1) + angle2;
+        }
+    }
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ArcFromBulgeCalculator.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ArcFromBulgeCalculator.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ArcFromBulgeCalculator.java	(revision 435)
@@ -0,0 +1,162 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.awt.geom.Point2D;
+import java.util.Vector;
+
+/**
+ * This class calculates an arc given by a start and end points and a bulge
+ * 
+ * @author jmorell
+ */
+public class ArcFromBulgeCalculator {
+	private double[] coord1, coord2;
+	private double[] center;
+	private double radio, empieza, acaba;
+	private double bulge;
+	private double d, dd, aci;
+	private double[] coordAux;
+	
+	/**
+	 * This method calculates an arc given by a start and end points and a bulge
+	 * 
+	 * @param p1 Start point of the arc given by a Point2D
+	 * @param p2 End point of the arc given by a Point2D
+	 * @param bulge Bulge of the arc given by a double value 
+	 */
+	public ArcFromBulgeCalculator(double[] p1, double[] p2, double bulge) {
+		this.bulge = bulge;
+		if (bulge < 0.0) {
+			coord1 = p2;
+			coord2 = p1;
+		} else {
+			coord1 = p1;
+			coord2 = p2;
+		}
+		calParams();
+	}
+	
+	private void calParams() {
+		d = Math.sqrt((coord2[0]-coord1[0])*(coord2[0]-coord1[0]) + 
+				(coord2[1]-coord1[1])*(coord2[1]-coord1[1]));
+		coordAux = new double[]{(coord1[0]+coord2[0])/2.0, (coord1[1]+coord2[1])/2.0};
+		double b = Math.abs(bulge);
+		double beta = Math.atan(b);
+		double alfa = beta*4.0;
+		double landa = alfa/2.0;
+		dd = (d/2.0)/(Math.tan(landa));
+		radio = (d/2.0)/(Math.sin(landa));		
+		aci = Math.atan((coord2[0]-coord1[0])/(coord2[1]-coord1[1]));
+		double aciDegree = aci*180.0/Math.PI;
+		if (coord2[1] > coord1[1]) {
+			aci += Math.PI;
+			aciDegree = aci*180.0/Math.PI;
+		}
+		center = new double[]{coordAux[0] + dd*Math.sin(aci+(Math.PI/2.0)), coordAux[1] + dd*Math.cos(aci+(Math.PI/2.0))};
+		calEA(alfa);
+	}
+	
+	private void calEA(double alfa){
+		empieza = Math.atan2(coord1[1]-center[1], coord1[0]-center[0]);
+		acaba = (empieza + alfa);
+		empieza = empieza*180.0/Math.PI;
+		acaba = acaba*180.0/Math.PI;
+	}
+	
+	/**
+	 * This method calculates an arc in a Gis geometry model. This arc is represented in
+	 * this model by a Vector of Point2D. The distance between points in the arc is given
+	 * as an argument
+	 * 
+	 * @param inc Distance between points in the arc
+	 * @return Vector Vector with the set of Point2D that represents the arc
+	 */
+	public Vector getPoints(double inc) {
+		Vector arc = new Vector();
+		double angulo;
+		int iempieza = (int) empieza + 1;
+		int iacaba = (int) acaba;
+		if (empieza <= acaba) {
+			addNode(arc, empieza);
+			for (angulo = iempieza; angulo <= iacaba; angulo += inc) {
+				addNode(arc, angulo);
+			}
+			addNode(arc, acaba);
+		} else {
+			addNode(arc, empieza);
+			for (angulo = iempieza ; angulo <= 360; angulo += inc) {
+				addNode(arc, angulo);
+			}
+			for (angulo = 1; angulo <= iacaba; angulo += inc) {
+				addNode(arc, angulo);
+			}
+			addNode(arc, angulo);
+		}
+		Point2D aux = (Point2D)arc.get(arc.size()-1);
+		double aux1 = Math.abs(aux.getX()-coord2[0]);
+		double aux2 = Math.abs(aux.getY()-coord2[1]);
+		return arc;
+	}
+	
+	/**
+	 * Method that allows to obtain a set of points located in the central zone of 
+	 * this arc object
+	 */
+	public Vector getCentralPoint() {
+		Vector arc = new Vector();
+		if (empieza <= acaba) {
+			addNode(arc, (empieza+acaba)/2.0);
+		} else {
+			addNode(arc, empieza);
+			double alfa = 360-empieza;
+			double beta = acaba;
+			double an = alfa + beta;
+			double mid = an/2.0;
+			if (mid<=alfa) {
+				addNode(arc, empieza+mid);
+			} else {
+				addNode(arc, mid-alfa);
+			}
+		}
+		return arc;
+	}
+	
+	private void addNode(Vector arc, double angulo) {
+		double yy = center[1] + radio * Math.sin(angulo*Math.PI/180.0);
+		double xx = center[0] + radio * Math.cos(angulo*Math.PI/180.0);		
+		arc.add(new Point2D.Double(xx,yy));
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/GisModelCurveCalculator.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/GisModelCurveCalculator.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/GisModelCurveCalculator.java	(revision 435)
@@ -0,0 +1,275 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * This class allows to obtain arcs and circles given by the most usual parameters, in a
+ * Gis geometry model. In this model, an arc or a circle is given by a set of points that
+ * defines it shape
+ * 
+ * @author jmorell
+ */
+public class GisModelCurveCalculator {
+    
+    /**
+     * This method calculates an array of Point2D that represents a circle. The distance
+     * between it points is 1 angular unit 
+     * 
+     * @param c Point2D that represents the center of the circle
+     * @param r double value that represents the radius of the circle
+     * @return Point2D[] An array of Point2D that represents the shape of the circle
+     */
+	public static List calculateGisModelCircle(Point2D c, double r) {
+		List pts = new ArrayList();
+		int angulo = 0;
+		for (angulo=0; angulo<360; angulo++) {
+			double[] pt = new double[]{c.getX(), c.getY()};
+			pt[0] = pt[0] + r * Math.sin(angulo*Math.PI/(double)180.0);
+			pt[1] = pt[1] + r * Math.cos(angulo*Math.PI/(double)180.0);
+			
+			pts.add(pt);
+		}
+		return pts;
+	}
+	
+    /**
+     * This method calculates an array of Point2D that represents a ellipse. The distance
+     * between it points is 1 angular unit 
+     * 
+     * @param center Point2D that represents the center of the ellipse
+     * @param majorAxisVector Point2D that represents the vector for the major axis
+     * @param axisRatio double value that represents the axis ratio
+	 * @param initAngle double value that represents the start angle of the ellipse arc
+	 * @param endAngle double value that represents the end angle of the ellipse arc
+     * @return Point2D[] An array of Point2D that represents the shape of the ellipse
+     */
+	public static List calculateGisModelEllipse(Point2D center, Point2D majorAxisVector, double axisRatio, double initAngle, double endAngle) {
+		Point2D majorPoint = new Point2D.Double(center.getX()+majorAxisVector.getX(), center.getY()+majorAxisVector.getY());
+		double orientation  = Math.atan(majorAxisVector.getY()/majorAxisVector.getX());
+	    double semiMajorAxisLength = center.distance(majorPoint);
+		double semiMinorAxisLength = semiMajorAxisLength*axisRatio;
+	    double eccentricity = Math.sqrt(1-((Math.pow(semiMinorAxisLength, 2))/(Math.pow(semiMajorAxisLength, 2))));
+		int isa = (int)initAngle;
+		int iea = (int)endAngle;
+		double angulo;
+		List pts = new ArrayList();
+		if (initAngle <= endAngle) {
+			angulo = initAngle;
+			double r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+		    double x = r*Math.cos(angulo*Math.PI/(double)180.0);
+		    double y = r*Math.sin(angulo*Math.PI/(double)180.0);
+		    double xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+		    double yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+			
+			double[] pt = new double[]{center.getX() + xrot, center.getY() + yrot };
+			pts.add(pt);
+			
+			for (int i=1; i<=(iea-isa)+1; i++) {
+				angulo = (double)(isa+i);
+				r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+			    x = r*Math.cos(angulo*Math.PI/(double)180.0);
+			    y = r*Math.sin(angulo*Math.PI/(double)180.0);
+			    xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+			    yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+			    
+			    pt = new double[]{center.getX() + xrot, center.getY() + yrot};
+			    pts.add(pt);
+			}
+			
+			angulo = endAngle;
+			r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+		    x = r*Math.cos(angulo*Math.PI/(double)180.0);
+		    y = r*Math.sin(angulo*Math.PI/(double)180.0);
+		    xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+		    yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+		    
+		    
+		    pt = new double[]{center.getX() + xrot, center.getY() + yrot};
+		    pts.add(pt);
+		    
+		} else {
+			angulo = initAngle;
+			double r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+		    double x = r*Math.cos(angulo*Math.PI/(double)180.0);
+		    double y = r*Math.sin(angulo*Math.PI/(double)180.0);
+		    double xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+		    double yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+		    
+		  
+			double[] pt = new double[]{center.getX() + r*Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r*Math.sin(angulo*Math.PI/(double)180.0)};
+		    pts.add(pt);
+		    
+		    for (int i=1; i<=(360-isa); i++) {
+				angulo = (double)(isa+i);
+				r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+			    x = r*Math.cos(angulo*Math.PI/(double)180.0);
+			    y = r*Math.sin(angulo*Math.PI/(double)180.0);
+			    xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+			    yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+			    
+			    pt = new double[]{center.getX() + xrot, center.getY() + yrot};
+			    pts.add(pt);
+			}
+		    
+		    
+			for (int i=(360-isa)+1; i<=(360-isa)+iea; i++) {
+				angulo = (double)(i-(360-isa));
+				r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+			    x = r*Math.cos(angulo*Math.PI/(double)180.0);
+			    y = r*Math.sin(angulo*Math.PI/(double)180.0);
+			    xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+			    yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+			    
+			    pt = new double[]{center.getX() + xrot, center.getY() + yrot};
+			    pts.add(pt);
+			    
+			}
+			
+			angulo = endAngle;
+			r = semiMinorAxisLength/Math.sqrt(1-((Math.pow(eccentricity, 2))*(Math.pow(Math.cos(angulo*Math.PI/(double)180.0), 2))));
+		    x = r*Math.cos(angulo*Math.PI/(double)180.0);
+		    y = r*Math.sin(angulo*Math.PI/(double)180.0);
+		    xrot = x*Math.cos(orientation) - y*Math.sin(orientation);
+		    yrot = x*Math.sin(orientation) + y*Math.cos(orientation);
+		    
+		    pt = new double[]{center.getX() + xrot, center.getY() + yrot};
+		    pts.add(pt);
+		}
+		return pts;
+	}
+	
+	/**
+     * This method calculates an array of Point2D that represents an arc. The distance
+     * between it points is 1 angular unit 
+	 * 
+     * @param c Point2D that represents the center of the arc
+     * @param r double value that represents the radius of the arc
+	 * @param sa double value that represents the start angle of the arc
+	 * @param ea double value that represents the end angle of the arc
+     * @return Point2D[] An array of Point2D that represents the shape of the arc
+	 */
+	public static List calculateGisModelArc(double[] center, double r, double sa, double ea) {
+		int isa = (int)sa;
+		int iea = (int)ea;
+		double angulo;
+		List pts = new ArrayList();
+		if (sa <= ea) {
+			angulo = sa;
+			pts.add(new double[]{center[0] + r * Math.cos(angulo*Math.PI/(double)180.0), 
+					center[1] + r * Math.sin(angulo*Math.PI/(double)180.0)});
+			for (int i=1; i <= (iea-isa)+1; i++) {
+				angulo = (double)(isa+i);
+				double x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+				double y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0);
+				pts.add(new double[]{x, y});
+			}
+			angulo = ea;
+			double x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+			double y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0);
+			pts.add(new double[]{x, y});
+		} else {
+			angulo = sa;
+			double x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+			double y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0);
+			pts.add(new double[]{x, y});
+			for (int i=1; i <= (360-isa); i++) {
+				angulo = (double)(isa+i);
+				x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+				y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0); 
+				pts.add(new double[]{x, y});
+			}
+			
+			for (int i=( 360-isa)+1; i <= (360-isa)+iea; i++) {
+				angulo = (double)(i-(360-isa));
+				x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+				y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0);
+				pts.add(new double[]{x, y});
+			}
+			angulo = ea;
+			x = center[0] + r * Math.cos(angulo*Math.PI/(double)180.0);
+			y = center[1] + r * Math.sin(angulo*Math.PI/(double)180.0);
+			pts.add(new double[]{x, y});
+		}
+		return pts;
+	}
+	
+	/**
+	 * This method applies an array of bulges to an array of Point2D that defines a
+	 * polyline. The result is a polyline with the input points with the addition of the
+	 * points that define the new arcs added to the polyline
+	 * 
+	 * @param newPts Base points of the polyline
+	 * @param bulges Array of bulge parameters
+	 * @return Polyline with a new set of arcs added and defined by the bulge parameters
+	 */
+	public static List calculateGisModelBulge(List newPts, double[] bulges) {
+		Vector ptspol = new Vector();
+		double[] init = null;
+		double[] end = null;
+		for (int j=0; j<newPts.size(); j++) {
+			init = (double[]) newPts.get(j);
+			if (j != newPts.size()-1) 
+				end = (double[]) newPts.get(j+1);
+			if (bulges[j]==0 || j== newPts.size()-1 || 
+				(init[0] == end[0] && init[1] == end[1])) {
+				ptspol.add(init);
+			} else {
+				ArcFromBulgeCalculator arcCalculator = new ArcFromBulgeCalculator(init, end, bulges[j]);
+				Vector arc = arcCalculator.getPoints(1);
+				if (bulges[j]<0) {
+					for (int k=arc.size()-1; k>=0; k--) {
+						ptspol.add(arc.get(k));
+					}
+					ptspol.remove(ptspol.size()-1);
+				} else {
+					for (int k=0;k<arc.size();k++) {
+						ptspol.add(arc.get(k));
+					}
+					ptspol.remove(ptspol.size()-1);
+				}
+			}
+		}
+		List points = new ArrayList();
+		for (int j=0;j<ptspol.size();j++) {
+			points.add(ptspol.get(j));
+		}
+		return points;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/HexUtil.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/HexUtil.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/HexUtil.java	(revision 435)
@@ -0,0 +1,172 @@
+package org.gvsig.dwg.lib.util;
+
+import java.util.BitSet;
+
+/**
+ * Number in hexadecimal format are used throughout Freenet.
+ * 
+ * <p>Unless otherwise stated, the conventions follow the rules outlined in the 
+ * Java Language Specification.</p>
+ * 
+ * @author syoung
+ */
+public class HexUtil {
+	private HexUtil() {		
+	}	
+	
+
+	/**
+	 * Converts a byte array into a string of upper case hex chars.
+	 * 
+	 * @param bs
+	 *            A byte array
+	 * @param off
+	 *            The index of the first byte to read
+	 * @param length
+	 *            The number of bytes to read.
+	 * @return the string of hex chars.
+	 */
+	public static final String bytesToHex(byte[] bs, int off, int length) {
+		StringBuffer sb = new StringBuffer(length * 2);
+		bytesToHexAppend(bs, off, length, sb);
+		return sb.toString();
+	}
+
+	public static final void bytesToHexAppend(
+		byte[] bs,
+		int off,
+		int length,
+		StringBuffer sb) {
+		sb.ensureCapacity(sb.length() + length * 2);
+		for (int i = off; i < (off + length) && i < bs.length; i++) {
+			sb.append(Character.forDigit((bs[i] >>> 4) & 0xf, 16));
+			sb.append(Character.forDigit(bs[i] & 0xf, 16));
+		}
+	}
+
+	public static final String bytesToHex(byte[] bs) {
+		return bytesToHex(bs, 0, bs.length);
+	}
+
+	public static final byte[] hexToBytes(String s) {
+		return hexToBytes(s, 0);
+	}
+
+	public static final byte[] hexToBytes(String s, int off) {
+		byte[] bs = new byte[off + (1 + s.length()) / 2];
+		hexToBytes(s, bs, off);
+		return bs;
+	}
+
+	/**
+	 * Converts a String of hex characters into an array of bytes.
+	 * 
+	 * @param s
+	 *            A string of hex characters (upper case or lower) of even
+	 *            length.
+	 * @param out
+	 *            A byte array of length at least s.length()/2 + off
+	 * @param off
+	 *            The first byte to write of the array
+	 */
+	public static final void hexToBytes(String s, byte[] out, int off)
+		throws NumberFormatException, IndexOutOfBoundsException {
+		int slen = s.length();
+		if ((slen % 2) != 0) {
+			s = '0' + s;
+		}
+
+		if (out.length < off + slen / 2) {
+			throw new IndexOutOfBoundsException(
+				"Output buffer too small for input ("
+					+ out.length
+					+ "<"
+					+ off
+					+ slen / 2
+					+ ")");
+		}
+
+		// Safe to assume the string is even length
+		byte b1, b2;
+		for (int i = 0; i < slen; i += 2) {
+			b1 = (byte) Character.digit(s.charAt(i), 16);
+			b2 = (byte) Character.digit(s.charAt(i + 1), 16);
+			if (b1 < 0 || b2 < 0) {
+				throw new NumberFormatException();
+			}
+			out[off + i / 2] = (byte) (b1 << 4 | b2);
+		}
+	}
+
+	/**
+	 * Pack the bits in ba into a byte[].
+	 */
+	public final static byte[] bitsToBytes(BitSet ba, int size) {
+		int bytesAlloc = countBytesForBits(size);
+		byte[] b = new byte[bytesAlloc];
+		StringBuffer sb = new StringBuffer();
+		for(int i=0;i<b.length;i++) {
+			short s = 0;
+			for(int j=0;j<8;j++) {
+				int idx = i*8+j;
+				boolean val = 
+					idx > size ? false :
+						ba.get(idx);
+				s |= val ? (1<<j) : 0;
+				sb.append(val ? '1' : '0');
+			}
+			if(s > 255) throw new IllegalStateException("WTF? s = "+s);
+			b[i] = (byte)s;
+		}
+		return b;
+	}
+
+	/**
+	 * Pack the bits in ba into a byte[] then convert that
+	 * to a hex string and return it.
+	 */
+	public final static String bitsToHexString(BitSet ba, int size) {
+		return bytesToHex(bitsToBytes(ba, size));
+	}
+
+
+	/**
+	 * @return the number of bytes required to represent the
+	 * bitset
+	 */
+	public static int countBytesForBits(int size) {
+		// Brackets matter here! == takes precedence over the rest
+		return (size/8) + ((size % 8) == 0 ? 0:1);
+	}
+
+
+	/**
+	 * Read bits from a byte array into a bitset
+	 * @param b the byte[] to read from
+	 * @param ba the bitset to write to
+	 */
+	public static void bytesToBits(byte[] b, BitSet ba, int maxSize) {
+		int x = 0;
+		for(int i=0;i<b.length;i++) {
+			for(int j=0;j<8;j++) {
+				if(x > maxSize) break;
+				int mask = 1 << j;
+				boolean value = (mask & b[i]) != 0;
+				ba.set(x, value);
+				x++;
+			}
+		}
+	}
+
+
+	/**
+	 * Read a hex string of bits and write it into a bitset
+	 * @param s hex string of the stored bits
+	 * @param ba the bitset to store the bits in
+	 * @param length the maximum number of bits to store 
+	 */
+	public static void hexToBits(String s, BitSet ba, int length) {
+		byte[] b = hexToBytes(s);
+		bytesToBits(b, ba, length);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadExtrusionCalculator.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadExtrusionCalculator.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadExtrusionCalculator.java	(revision 435)
@@ -0,0 +1,178 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.lang.Math;
+
+/**
+ * This class allows to apply the extrusion transformation of Autocad given by an array
+ * of doubles to a point given by an array of doubles too. 
+ * 
+ * @author azabala
+ */
+/*
+ * The maths behind all this stuff, and the reasons to do this could be complex.
+ * 
+ * Some links:
+ * http://www.autodesk.com/techpubs/autocad/acadr14/dxf/object_coordinate_systems_40ocs41_al_u05_c.htm
+ * http://www.autodesk.com/techpubs/autocad/acadr14/dxf/arbitrary_axis_algorithm_al_u05_c.htm 
+ * http://personales.unican.es/togoresr/Sco-en.html
+ * 
+ * In ACAD, 3D entities has their coordinates in World Coordinate System (WCS: utm, etc.)
+ * but 2D entities has their coordinates in an Object Coordinate System (OCS).
+ * 
+ * To work with the coordinates saved in the file, we must to transform them (extrude) from OCS
+ * to WCS
+ * 
+
+ * */
+public class AcadExtrusionCalculator {
+    
+	public static Matrix4D computeTransform(double[] extrusion, double[] coord)
+    {
+        
+        Vector3D Ax = null;
+        if(extrusion[0] == 0d && extrusion[1] == 0d && extrusion[2] > 0d && coord[2] == 0d)
+        	return null;
+        if((extrusion[0] >= 0f ? extrusion[0]:-extrusion[0]) < 0.015625F
+        		&&
+            (extrusion[1] >= 0f ? extrusion[1]:-extrusion[1]) < 0.015625F){
+         
+        	Ax = new Vector3D(extrusion[2], 0f, -extrusion[0]);
+         }else{
+        	 Ax = new Vector3D(-extrusion[1],extrusion[0], 0f);
+         }
+        double len = Ax.length();
+        Ax.scale(1d / len);
+        Vector3D upward = new Vector3D(extrusion[0], extrusion[1], extrusion[2]);
+        Vector3D Ay = upward.cross(Ax);
+  			
+        Matrix4D aaa = new Matrix4D(Ax.x, Ay.x, upward.x, coord[2] * upward.x, 
+  										Ax.y, Ay.y, upward.y, coord[2] * upward.y,
+  										Ax.z, Ay.z, upward.z, coord[2] * upward.z, 
+  											0.0F, 0.0F, 0.0F, 1.0F);
+  	
+        //Creo que la transformacion comentada es para pasar de WCS a OCS, y no al reves
+        
+        /*
+        Matrix4D aaa = new Matrix4D(Ax.x, Ax.y, Ax.z, 0f, 
+									Ay.x, Ay.y, Ay.z, 0f,
+									upward.x, upward.y, upward.z, 0f,
+									coord[2] * upward.x, coord[2] * upward.y, coord[2] * upward.z, 1f);
+        
+        */
+        return aaa;
+    }
+	
+	public static double[] extrude2(double[] coord_in, double[] xtru){
+		
+		//antes de cambiar el plano, aplicamos una extrusion con valor
+		//la altura del punto
+//		coord_in[0] += (xtru[0] * coord_in[2]);
+//		coord_in[1] += (xtru[1] * coord_in[2]);
+//		coord_in[2] += (xtru[2] * coord_in[2]);
+		
+		
+		
+		Matrix4D transform = computeTransform(xtru, coord_in);
+		if(transform == null)//xtru es el eje Z
+			return coord_in;
+		Point3D p = new Point3D(coord_in[0], coord_in[1], coord_in[2]);
+		transform.transform(p);
+		return new double[]{p.x, p.y, p.z};
+		
+	}
+	
+	
+	
+	/*
+    
+   llamamos a finalConv, y este llama a extrude internamente
+   
+    static DrawAble finalConv(DrawAble dl, DxfEntity entity, boolean doTransform)
+    {
+        if(dl == null)
+            return null;
+        DrawAble dr;
+        if(doTransform)
+        {
+            if(entity.getExtrusion() != 0.0F)
+                dr = dl.extrude(entity.getExtrusion());
+            else
+                dr = dl;
+            Matrix4D mat = entity.calcArbitMat();
+            if(mat != null)
+                dr.transformBy(mat);
+        } else
+        if(entity.getExtrusion() != 0.0F)
+            dr = dl.extrude(entity.getExtrusion(), entity.getUpwardVector());
+        else
+            dr = dl;
+        return dr;
+    }
+    
+     public DrawAble extrude(float dist, Vector3D up)
+    {
+        if(dist == 0.0F)
+            return this;
+        Vector3D ex = new Vector3D(dist * up.x, dist * up.y, dist * up.z);
+        DrawSet set = new DrawSet(2 + nrPoints);
+        DrawLines second = new DrawLines(nrPoints);
+        set.setLayer(super.layer);
+        set.setColor(super.color);
+        second.setLayer(super.layer);
+        second.setColor(super.color);
+        set.addDrawable(this);
+        for(int i = 0; i < nrPoints; i++)
+        {
+            second.addPoint(line[i].x + ex.x, line[i].y + ex.y, line[i].z + ex.z);
+            DrawLines conn = new DrawLines(2);
+            conn.setLayer(super.layer);
+            conn.setColor(super.color);
+            conn.addPoint(line[i]);
+            conn.addPoint(second.line[i]);
+            set.addDrawable(conn);
+        }
+
+        if(isClosed)
+            second.close();
+        set.addDrawable(second);
+        return set;
+    }
+
+    
+    
+*/
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ByteUtils.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ByteUtils.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/ByteUtils.java	(revision 435)
@@ -0,0 +1,754 @@
+/* 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.dwg.lib.util;
+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 ((int) 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);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/TextToUnicodeConverter.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/TextToUnicodeConverter.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/TextToUnicodeConverter.java	(revision 435)
@@ -0,0 +1,131 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.text.StringCharacterIterator;
+
+/**
+ * This class allows to convert an Autocad text in an Unicode text
+ * 
+ * @author jmorell
+ */
+public class TextToUnicodeConverter {
+    
+    /**
+     * This method allows to convert an Autocad text in an Unicode text
+     * 
+     * @param s Autocad text
+     * @return String Unicode text
+     */
+	public static String convertText(String s) {
+        StringCharacterIterator stringcharacteriterator = new StringCharacterIterator(s);
+        StringBuffer stringbuffer = new StringBuffer();
+        int ai[] = new int[s.length()];
+        int i = 0;
+        int j = 0;
+        for(char c = stringcharacteriterator.first(); c != '\uFFFF'; c = stringcharacteriterator.next())
+            if(c == '%')
+            {
+                c = stringcharacteriterator.next();
+                if(c != '%')
+                {
+                    stringbuffer.append('%');
+                    c = stringcharacteriterator.previous();
+                } else
+                {
+                    c = stringcharacteriterator.next();
+                    switch(c)
+                    {
+                    case 37: // '%'
+                        stringbuffer.append('%');
+                        break;
+
+                    case 80: // 'P'
+                    case 112: // 'p'
+                        stringbuffer.append('\361');
+                        break;
+
+                    case 67: // 'C'
+                    case 99: // 'c'
+                        stringbuffer.append('\355');
+                        break;
+
+                    case 68: // 'D'
+                    case 100: // 'd'
+                        stringbuffer.append('\u00b0');
+                        break;
+
+                    case 85: // 'U'
+                    case 117: // 'u'
+                        ai[stringbuffer.length()] ^= 1;
+                        i++;
+                        break;
+
+                    case 79: // 'O'
+                    case 111: // 'o'
+                        ai[stringbuffer.length()] ^= 2;
+                        j++;
+                        break;
+
+                    default:
+                        if(c >= '0' && c <= '9')
+                        {
+                            int k = 3;
+                            char c1 = (char)(c - 48);
+                            for(c = stringcharacteriterator.next(); c >= '0' && c <= '9' && --k > 0; c = stringcharacteriterator.next())
+                                c1 = (char)(10 * c1 + (c - 48));
+
+                            stringbuffer.append(c1);
+                        }
+                        c = stringcharacteriterator.previous();
+                        break;
+                    }
+                }
+            } else
+            if(c == '^')
+            {
+                c = stringcharacteriterator.next();
+                if(c == ' ')
+                    stringbuffer.append('^');
+            } else
+            {
+                stringbuffer.append(c);
+            }
+        s = Unicode.char2DOS437(stringbuffer, 2, '?');
+
+		String ss = s;
+		return ss;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Unicode.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Unicode.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Unicode.java	(revision 435)
@@ -0,0 +1,463 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+/**
+ * Class that contains the tables for Autocad to Unicode text conversions
+ * 
+ * @author jmorell
+ */
+class Unicode {
+    private static final char UCNONE = 65535;
+    private static final char unicode[][] = {
+        {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\177', '\200', '\201', 
+            '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', 
+            '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', 
+            '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', 
+            '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', 
+            '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', 
+            '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', 
+            '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', 
+            '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', 
+            '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', 
+            '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', 
+            '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', 
+            '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', 
+            '\372', '\373', '\374', '\375', '\376', '\377'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\177', '\200', '\201', 
+            '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', 
+            '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', 
+            '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', 
+            '\240', '\u0104', '\u02D8', '\u0141', '\244', '\u013D', '\u015A', '\247', '\250', '\u0160', 
+            '\u015E', '\u0164', '\u0179', '\255', '\u017D', '\u017B', '\260', '\u0105', '\u02DB', '\u0142', 
+            '\264', '\u013E', '\u015B', '\u02C7', '\270', '\u0161', '\u015F', '\u0165', '\u017A', '\u02DD', 
+            '\u017E', '\u017C', '\u0154', '\301', '\302', '\u0102', '\304', '\u0139', '\u0106', '\307', 
+            '\u010C', '\311', '\u0118', '\313', '\u011A', '\315', '\316', '\u010E', '\u0110', '\u0143', 
+            '\u0147', '\323', '\324', '\u0150', '\326', '\327', '\u0158', '\u016E', '\332', '\u0170', 
+            '\334', '\335', '\u0162', '\337', '\u0155', '\341', '\342', '\u0103', '\344', '\u013A', 
+            '\u0107', '\347', '\u010D', '\351', '\u0119', '\353', '\u011B', '\355', '\356', '\u010F', 
+            '\u0111', '\u0144', '\u0148', '\363', '\364', '\u0151', '\366', '\367', '\u0159', '\u016F', 
+            '\372', '\u0171', '\374', '\375', '\u0163', '\u02D9'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\344', '\340', '\345', '\347', '\352', '\353', '\350', '\357', 
+            '\356', '\354', '\304', '\305', '\311', '\346', '\306', '\364', '\366', '\362', 
+            '\373', '\371', '\377', '\326', '\334', '\242', '\243', '\245', '\u20A7', '\u0192', 
+            '\341', '\355', '\363', '\372', '\361', '\321', '\252', '\272', '\277', '\u2310', 
+            '\254', '\275', '\274', '\241', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', 
+            '\u255B', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', 
+            '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u258C', '\u2590', '\u2580', '\u03B1', '\337', '\u0393', '\u03C0', '\u03A3', '\u03C3', 
+            '\265', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', 
+            '\u2261', '\261', '\u2265', '\u2264', '\u2320', '\u2321', '\367', '\u2248', '\260', '\u2219', 
+            '\267', '\u221A', '\u207F', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\344', '\340', '\345', '\347', '\352', '\353', '\350', '\357', 
+            '\356', '\354', '\304', '\305', '\311', '\346', '\306', '\364', '\366', '\362', 
+            '\373', '\371', '\377', '\326', '\334', '\370', '\243', '\330', '\327', '\u0192', 
+            '\341', '\355', '\363', '\372', '\361', '\321', '\252', '\272', '\277', '\256', 
+            '\254', '\275', '\274', '\241', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\301', '\302', '\300', '\251', '\u2563', '\u2551', '\u2557', '\u255D', '\242', 
+            '\245', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\343', '\303', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\244', '\360', '\320', 
+            '\312', '\313', '\310', '\u0131', '\315', '\316', '\317', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\246', '\314', '\u2580', '\323', '\337', '\324', '\322', '\365', '\325', 
+            '\265', '\376', '\336', '\332', '\333', '\331', '\375', '\335', '\257', '\264', 
+            '\255', '\261', '\u2017', '\276', '\266', '\247', '\367', '\270', '\260', '\250', 
+            '\267', '\271', '\263', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\344', '\u016F', '\u0107', '\347', '\u0142', '\353', '\u0150', '\u0151', 
+            '\356', '\u0179', '\304', '\u0106', '\311', '\u0139', '\u013A', '\364', '\366', '\u013D', 
+            '\u013E', '\u015A', '\u015B', '\326', '\334', '\u0164', '\u0165', '\u0141', '\327', '\u010D', 
+            '\341', '\355', '\363', '\372', '\u0104', '\u0105', '\u017D', '\u017E', '\u0118', '\u0119', 
+            '\254', '\u017A', '\u010C', '\u015F', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\301', '\302', '\u011A', '\u015E', '\u2563', '\u2551', '\u2557', '\u255D', '\u017B', 
+            '\u017C', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u0102', '\u0103', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\244', '\u0111', '\u0110', 
+            '\u010E', '\313', '\u010F', '\u0147', '\315', '\316', '\u011B', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u0162', '\u016E', '\u2580', '\323', '\337', '\324', '\u0143', '\u0144', '\u0148', 
+            '\u0160', '\u0161', '\u0154', '\332', '\u0155', '\u0170', '\375', '\335', '\u0163', '\264', 
+            '\255', '\u02DD', '\u02DB', '\u02C7', '\u02D8', '\247', '\367', '\270', '\260', '\250', 
+            '\u02D9', '\u0171', '\u0158', '\u0159', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\u0452', '\u0402', 
+            '\u0453', '\u0403', '\u0451', '\u0401', '\u0454', '\u0404', '\u0455', '\u0405', '\u0456', '\u0406', 
+            '\u0457', '\u0407', '\u0456', '\u0408', '\u0459', '\u0409', '\u045A', '\u040A', '\u045B', '\u040B', 
+            '\u045C', '\u040C', '\u045E', '\u040E', '\u045F', '\u040F', '\u044E', '\u042E', '\u044A', '\u042A', 
+            '\u0430', '\u0410', '\u0431', '\u0411', '\u0446', '\u0426', '\u0434', '\u0414', '\u0435', '\u0415', 
+            '\u0444', '\u0424', '\u0433', '\u0413', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u0445', '\u0425', '\u0438', '\u0418', '\u2563', '\u2551', '\u2557', '\u255D', '\u0439', 
+            '\u0419', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u043A', '\u041A', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\244', '\u043B', '\u041B', 
+            '\u043C', '\u041C', '\u043D', '\u041D', '\u043E', '\u041E', '\u043F', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u041F', '\u044F', '\u2580', '\u042F', '\u0440', '\u0420', '\u0441', '\u0421', '\u0442', 
+            '\u0422', '\u0443', '\u0423', '\u0436', '\u0416', '\u0432', '\u0412', '\u044C', '\u042C', '\u2116', 
+            '\255', '\u044B', '\u042B', '\u0437', '\u0417', '\u0448', '\u0428', '\u044D', '\u042D', '\u0449', 
+            '\u0429', '\u0447', '\u0427', '\uFFFF', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\344', '\340', '\345', '\347', '\352', '\353', '\350', '\357', 
+            '\356', '\u0131', '\304', '\305', '\311', '\346', '\306', '\364', '\366', '\362', 
+            '\373', '\371', '\u0130', '\326', '\334', '\370', '\243', '\330', '\u015E', '\u015F', 
+            '\341', '\355', '\363', '\372', '\361', '\321', '\u011E', '\u011F', '\277', '\256', 
+            '\254', '\275', '\274', '\241', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\301', '\302', '\300', '\251', '\u2563', '\u2551', '\u2557', '\u255D', '\242', 
+            '\245', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\343', '\303', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\244', '\272', '\252', 
+            '\312', '\313', '\310', '\uFFFF', '\315', '\316', '\317', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\246', '\314', '\u2580', '\323', '\337', '\324', '\322', '\365', '\325', 
+            '\265', '\uFFFF', '\327', '\332', '\333', '\331', '\354', '\377', '\257', '\264', 
+            '\255', '\261', '\uFFFF', '\276', '\266', '\247', '\367', '\270', '\260', '\250', 
+            '\267', '\271', '\263', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\343', '\340', '\301', '\347', '\352', '\312', '\350', '\315', 
+            '\324', '\354', '\303', '\302', '\311', '\300', '\310', '\364', '\365', '\362', 
+            '\332', '\371', '\314', '\325', '\334', '\242', '\243', '\331', '\u20A7', '\323', 
+            '\341', '\355', '\363', '\372', '\361', '\321', '\252', '\272', '\277', '\322', 
+            '\254', '\275', '\274', '\241', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', 
+            '\u255B', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', 
+            '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u258C', '\u2590', '\u2580', '\u03B1', '\337', '\u0393', '\u03C0', '\u03A3', '\u03C3', 
+            '\265', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', 
+            '\u2261', '\261', '\u2265', '\u2264', '\u2320', '\u2321', '\367', '\u2248', '\260', '\u2219', 
+            '\267', '\u221A', '\u207F', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\343', '\340', '\345', '\347', '\352', '\353', '\350', '\320', 
+            '\360', '\336', '\304', '\305', '\311', '\346', '\306', '\364', '\366', '\376', 
+            '\373', '\335', '\375', '\326', '\334', '\370', '\243', '\330', '\u20A7', '\u0192', 
+            '\341', '\355', '\363', '\372', '\301', '\315', '\323', '\332', '\277', '\u2310', 
+            '\254', '\275', '\274', '\241', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', 
+            '\u255B', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', 
+            '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u258C', '\u2590', '\u2580', '\u03B1', '\337', '\u0393', '\u03C0', '\u03A3', '\u03C3', 
+            '\265', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', 
+            '\u2261', '\261', '\u2265', '\u2264', '\u2320', '\u2321', '\367', '\u2248', '\260', '\u2219', 
+            '\267', '\u221A', '\u207F', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\343', '\340', '\266', '\347', '\352', '\353', '\350', '\357', 
+            '\356', '\u2017', '\300', '\247', '\311', '\310', '\312', '\364', '\313', '\317', 
+            '\373', '\371', '\244', '\324', '\334', '\242', '\243', '\331', '\333', '\u0192', 
+            '\246', '\264', '\363', '\372', '\250', '\270', '\263', '\257', '\316', '\u2310', 
+            '\254', '\275', '\274', '\276', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', 
+            '\u255B', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', 
+            '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u258C', '\u2590', '\u2580', '\u03B1', '\337', '\u0393', '\u03C0', '\u03A3', '\u03C3', 
+            '\265', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', 
+            '\u2261', '\261', '\u2265', '\u2264', '\u2320', '\u2321', '\367', '\u2248', '\260', '\u2219', 
+            '\267', '\u221A', '\u207F', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\260', '\267', 
+            '\u2219', '\u221A', '\u2592', '\u2500', '\u2502', '\u253C', '\u2524', '\u252C', '\u251C', '\u2534', 
+            '\u2510', '\u250C', '\u2514', '\u2518', '\u03B2', '\u221E', '\u03C6', '\261', '\275', '\274', 
+            '\u2248', '\253', '\273', '\uFEF7', '\uFEF8', '\uFFFF', '\uFFFF', '\uFEFB', '\uFEFC', '\uFFFF', 
+            '\240', '\255', '\uFE82', '\243', '\244', '\uFE84', '\uFFFF', '\uFFFF', '\uFE8E', '\uFE8F', 
+            '\uFE95', '\uFE99', '\u060C', '\uFE9D', '\uFEA1', '\uFEA5', '\u0660', '\u0661', '\u0662', '\u0663', 
+            '\u0664', '\u0665', '\u0666', '\u0667', '\u0668', '\u0669', '\uFED1', '\u061B', '\uFEB1', '\uFEB5', 
+            '\uFEB9', '\u061F', '\242', '\uFE80', '\uFE81', '\uFE83', '\uFE85', '\uFECC', '\uFE8A', '\uFE8D', 
+            '\uFE90', '\uFE93', '\uFE96', '\uFE9A', '\uFE9E', '\uFEA2', '\uFEA6', '\uFEA9', '\uFEAB', '\uFEAD', 
+            '\uFEAF', '\uFEB2', '\uFEB6', '\uFEBA', '\uFEBE', '\uFEC1', '\uFEC5', '\uFECA', '\uFECE', '\246', 
+            '\254', '\367', '\327', '\uFEC9', '\u0640', '\uFED2', '\uFED6', '\uFEDA', '\uFEDE', '\uFEE2', 
+            '\uFEE6', '\uFEEA', '\uFEED', '\uFEEF', '\uFEF2', '\uFEBD', '\uFECB', '\uFED0', '\uFECD', '\uFEE1', 
+            '\uFE7D', '\u0651', '\uFEE5', '\uFEE9', '\uFEEB', '\uFEF0', '\uFEF4', '\uFECF', '\uFED5', '\uFEF5', 
+            '\uFEF6', '\uFEDD', '\uFED9', '\uFEF1', '\u25A0', '\uFFFF'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\307', '\374', 
+            '\351', '\342', '\344', '\340', '\265', '\347', '\352', '\353', '\350', '\357', 
+            '\356', '\354', '\304', '\305', '\311', '\346', '\306', '\364', '\366', '\362', 
+            '\373', '\371', '\377', '\326', '\334', '\370', '\243', '\330', '\u20A7', '\u0192', 
+            '\341', '\355', '\363', '\372', '\361', '\321', '\252', '\272', '\277', '\u2310', 
+            '\254', '\275', '\274', '\241', '\253', '\244', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', 
+            '\u255B', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', 
+            '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u258C', '\u2590', '\u2580', '\u03B1', '\337', '\u0393', '\u03C0', '\u03A3', '\u03C3', 
+            '\265', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', 
+            '\u2261', '\261', '\u2265', '\u2264', '\u2320', '\u2321', '\367', '\u2248', '\260', '\u2219', 
+            '\267', '\u221A', '\u207F', '\262', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\u2302', '\uFFFF', '\uFFFF', 
+            '\uFFFF', '\uFFFF', '\uFFFF', '\uFFFF', '\u0386', '\uFFFF', '\267', '\254', '\246', '\u2018', 
+            '\u2019', '\u0388', '\u2015', '\u0389', '\u038A', '\u03AA', '\u038C', '\uFFFF', '\uFFFF', '\u038E', 
+            '\u03AB', '\251', '\u038F', '\262', '\263', '\u03AC', '\243', '\u03AD', '\u03AE', '\u03AF', 
+            '\u03CA', '\u0390', '\u03CC', '\u03CD', '\u0391', '\u0392', '\u0393', '\u0394', '\u0395', '\u0396', 
+            '\u0397', '\275', '\u0398', '\u0399', '\253', '\273', '\u2591', '\u2592', '\u2593', '\u2502', 
+            '\u2524', '\u039A', '\u039B', '\u039C', '\u039D', '\u2563', '\u2551', '\u2557', '\u255D', '\u039E', 
+            '\u039F', '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u03A0', '\u03A1', 
+            '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u03A3', '\u03A4', '\u03A5', 
+            '\u03A6', '\u03A7', '\u03A8', '\u03A9', '\u03B1', '\u03B2', '\u03B3', '\u2518', '\u250C', '\u2588', 
+            '\u2584', '\u03B4', '\u03B5', '\u2580', '\u03B6', '\u03B7', '\u03B8', '\u03B9', '\u03BA', '\u03BB', 
+            '\u03BC', '\u03BD', '\u03BE', '\u03BF', '\u03C0', '\u03C1', '\u03C3', '\u03C2', '\u03C4', '\264', 
+            '\255', '\261', '\u03C5', '\u03C6', '\u03C7', '\247', '\u03C8', '\u03F4', '\260', '\250', 
+            '\u03C9', '\u03CB', '\u03B0', '\u03CE', '\u25A0', '\240'
+        }, {
+            '\0', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\b', '\t', 
+            '\n', '\013', '\f', '\r', '\016', '\017', '\020', '\021', '\022', '\023', 
+            '\024', '\025', '\026', '\027', '\030', '\031', '\032', '\033', '\034', '\035', 
+            '\036', '\037', ' ', '!', '"', '#', '$', '%', '&', '\'', 
+            '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', 
+            '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', 
+            '<', '=', '>', '?', '@', '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', '[', '\\', ']', '^', '_', '`', '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', '{', '|', '}', '~', '\177', '\304', '\305', 
+            '\307', '\311', '\321', '\326', '\334', '\341', '\340', '\342', '\344', '\343', 
+            '\345', '\347', '\351', '\350', '\352', '\353', '\355', '\354', '\356', '\357', 
+            '\361', '\363', '\362', '\364', '\366', '\365', '\372', '\371', '\373', '\374', 
+            '\u2020', '\260', '\242', '\243', '\247', '\u2022', '\266', '\337', '\256', '\251', 
+            '\u2122', '\264', '\250', '\u2260', '\306', '\330', '\u221E', '\261', '\u2264', '\u2265', 
+            '\245', '\265', '\u2202', '\u2211', '\u220F', '\u03C0', '\u222B', '\252', '\272', '\u2126', 
+            '\346', '\370', '\277', '\241', '\254', '\u221A', '\u0192', '\u2248', '\u2206', '\253', 
+            '\273', '\u2026', '\240', '\300', '\303', '\325', '\u0152', '\u0153', '\u2010', '\u2014', 
+            '\u201C', '\u201D', '\u2018', '\u2019', '\367', '\u25CA', '\377', '\u0178', '\u2044', '\244', 
+            '\u2039', '\u203A', 'f', 'f', '\u2021', '\267', '\u201A', '\u201E', '\u2030', '\302', 
+            '\312', '\301', '\313', '\310', '\315', '\316', '\317', '\314', '\323', '\324', 
+            '\uFDFF', '\322', '\332', '\333', '\331', '\u0131', '\u02C6', '\u02DC', '\257', '\u02D8', 
+            '\u02D9', '\u02DA', '\270', '\u02DD', '\u02DB', '\u02C7'
+        }
+    };
+    private static char unicode2DOS437[];
+	
+    /**
+     * Char to DOS437 converter
+     * 
+     * @param stringbuffer
+     * @param i
+     * @param c
+     * @return String 
+     */
+    public static String char2DOS437(StringBuffer stringbuffer, int i, char c)
+    {
+        if(unicode2DOS437 == null)
+        {
+            unicode2DOS437 = new char[0x10000];
+            for(int j = 0; j < 256; j++)
+            {
+                char c1;
+                if((c1 = unicode[2][j]) != '\uFFFF')
+                    unicode2DOS437[c1] = (char)j;
+            }
+
+        }
+        if(i != 2)
+        {
+            StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length());
+            for(int k = 0; k < stringbuffer.length(); k++)
+            {
+                char c2 = unicode2DOS437[stringbuffer.charAt(k)];
+                stringbuffer1.append(c2 == 0 ? c : c2);
+            }
+
+            return new String(stringbuffer1);
+        } else
+        {
+            return new String(stringbuffer);
+        }
+    }
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadColor.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadColor.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/AcadColor.java	(revision 435)
@@ -0,0 +1,359 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.util;
+
+import java.awt.Color;
+
+/**
+ * This class allows to convert Autocad colors in Java colors
+ * 
+ * @author jmorell
+ */
+public class AcadColor {
+    /**
+     * When Autocad color is 256, then the color of the object is the color of it
+     * layer
+     */
+	public final static int BYLAYER = 256;
+    /**
+     * When Autocad color is 0, then the color of the object is the color of the
+     * block where it is placed
+     */
+	public final static int BYBLOCK = 0;
+	private static AcadColor[] colors = initTable();
+	private int code;
+	private float r0, g0, b0;
+	private int r, g, b;
+	private Color color = null;
+	
+	/**
+	 * This method is used to build the Autocad color table
+	 * 
+	 * @param code Code is the Autocad color number
+	 * @param r0 r0 is the red component (0-1)
+	 * @param g0 g0 is the green component (0-1)
+	 * @param b0 b0 is the blue component (0-1)
+	 * @param r r0 is the red component (0-255)
+	 * @param g g0 is the green component (0-255)
+	 * @param b b0 is the blue component (0-255)
+	 */
+	public AcadColor(int code, double r0, double g0, double b0, double r, double g, double b) {
+		this.code = code;
+		this.r0 = (float) r0; this.g0 = (float) g0; this.b0 = (float) b0;
+		this.r = (int) r; this.g = (int) g; this.b = (int) b;
+		this.color = new Color(this.r, this.g, this.b);
+		colors[code] = this;
+	}
+	
+	/**
+	 * This method uses Autocad color table for convert a color in the Autocad color
+	 * code in a java Color
+	 * 
+	 * @param code This int is the Autocad color number
+	 * @return Color Java Color corresponding to the Autocad color number argument
+	 */
+	public static Color getColor(int code) {
+		return colors[code].color;
+	}
+	
+	/**
+	 * Initialize an Autocad color table
+	 * 
+	 * @return AcadColor[] Object of this class that represents Acad color to Java color
+	 * 		   conversion
+	 */
+	public static AcadColor[] initTable() {
+		colors = new AcadColor[256];
+
+		new AcadColor(0, 0, 0, 0, 0, 0, 0);
+		
+		new AcadColor(1, 1, 0, 0, 255, 0, 0);
+		new AcadColor(2, 1, 1, 0, 255, 255, 0);
+		new AcadColor(3, 0, 1, 0, 0, 255, 0);
+		new AcadColor(4, 0, 1, 1, 0, 255, 255);
+		new AcadColor(5, 0, 0, 1, 0, 0, 255);
+		new AcadColor(6, 1, 0, 1, 255, 0, 255);
+		new AcadColor(7, 0, 0, 0, 0, 0, 0);
+		new AcadColor(8, 0, 0, 0, 0, 0, 0);
+		new AcadColor(9, 0, 0, 0, 0, 0, 0);
+		new AcadColor(10, 1, 0, 0, 255, 0, 0);
+		new AcadColor(11, 1.0, 0.5, 0.5, 255.0, 127.5, 127.5);
+		new AcadColor(12, 0.65, 0, 0, 165.75, 0, 0);
+		new AcadColor(13, 0.65, 0.325, 0.325, 165.75, 82.875, 82.875);
+		new AcadColor(14, 0.5, 0, 0, 127.5, 0, 0);
+		new AcadColor(15, 0.5, 0.25, 0.25, 127.5, 63.75, 63.75);
+		new AcadColor(16, 0.3, 0, 0, 76.5, 0, 0);
+		new AcadColor(17, 0.3, 0.15, 0.15, 76.5, 38.25, 38.25);
+		new AcadColor(18, 0.15, 0, 0, 38.25, 0, 0);
+		new AcadColor(19, 0.15, 0.075, 0.075, 38.25, 19.125, 19.125);
+		new AcadColor(20, 1, 0.25, 0, 255, 63.75, 0);
+		new AcadColor(21, 1, 0.625, 0.5, 255, 159.375, 127.5);
+		new AcadColor(22, 0.65, 0.1625, 0, 165.75, 41.4375, 0);
+		new AcadColor(23, 0.65, 0.4063, 0.325, 165.75, 103.6065, 82.875);
+		new AcadColor(24, 0.5, 0.125, 0, 127.5, 31.875, 0);
+		new AcadColor(25, 0.5, 0.3125, 0.25, 127.5, 79.6875, 63.75);
+		new AcadColor(26, 0.3, 0.075, 0, 76.5, 19.125, 0);
+		new AcadColor(27, 0.3, 0.1875, 0.15, 76.5, 47.8125, 38.25);
+		new AcadColor(28, 0.15, 0.0375, 0, 38.25, 9.5625, 0);
+		new AcadColor(29, 0.15, 0.0938, 0.075, 38.25, 23.919, 19.125);
+		new AcadColor(30, 1, 0.5, 0, 255, 127.5, 0);
+		new AcadColor(31, 1, 0.75, 0.5, 255, 191.25, 127.5);
+		new AcadColor(32, 0.65, 0.325, 0, 165.75, 82.875, 0);
+		new AcadColor(33, 0.65, 0.4875, 0.325, 165.75, 124.3125, 82.875);
+		new AcadColor(34, 0.5, 0.25, 0, 127.5, 63.75, 0);
+		new AcadColor(35, 0.5, 0.375, 0.25, 127.5, 95.625, 63.75);
+		new AcadColor(36, 0.3, 0.15, 0, 76.5, 38.25, 0);
+		new AcadColor(37, 0.3, 0.225, 0.15, 76.5, 57.375, 38.25);
+		new AcadColor(38, 0.15, 0.075, 0, 38.25, 19.125, 0);
+		new AcadColor(39, 0.15, 0.1125, 0.075, 38.25, 28.6875, 19.125);
+		new AcadColor(40, 1, 0.75, 0, 255, 191.25, 0);
+		new AcadColor(41, 1, 0.875, 0.5, 255, 223.125, 127.5);
+		new AcadColor(42, 0.65, 0.4875, 0, 165.75, 124.3125, 0);
+		new AcadColor(43, 0.65, 0.5688, 0.325, 165.75, 145.044, 82.875);
+		new AcadColor(44, 0.5, 0.375, 0, 127.5, 95.625, 0);
+		new AcadColor(45, 0.5, 0.4375, 0.25, 127.5, 111.5625, 63.75);
+		new AcadColor(46, 0.3, 0.225, 0, 76.5, 57.375, 0);
+		new AcadColor(47, 0.3, 0.2625, 0.15, 76.5, 66.9375, 38.25);
+		new AcadColor(48, 0.15, 0.1125, 0, 38.25, 28.6875, 0);
+		new AcadColor(49, 0.15, 0.1313, 0.075, 38.25, 33.4815, 19.125);
+		new AcadColor(50, 1, 1, 0, 255, 255, 0);
+		new AcadColor(51, 1, 1, 0.5, 255, 255, 127.5);
+		new AcadColor(52, 0.65, 0.65, 0, 165.75, 165.75, 0);
+		new AcadColor(53, 0.65, 0.65, 0.325, 165.75, 165.75, 82.875);
+		new AcadColor(54, 0.5, 0.5, 0, 127.5, 127.5, 0);
+		new AcadColor(55, 0.5, 0.5, 0.25, 127.5, 127.5, 63.75);
+		new AcadColor(56, 0.3, 0.3, 0, 76.5, 76.5, 0);
+		new AcadColor(57, 0.3, 0.3, 0.15, 76.5, 76.5, 38.25);
+		new AcadColor(58, 0.15, 0.15, 0, 38.25, 38.25, 0);
+		new AcadColor(59, 0.15, 0.15, 0.075, 38.25, 38.25, 19.125);
+		new AcadColor(60, 0.75, 1, 0, 191.25, 255, 0);
+		new AcadColor(61, 0.875, 1, 0.5, 223.125, 255, 127.5);
+		new AcadColor(62, 0.4875, 0.65, 0, 124.3125, 165.75, 0);
+		new AcadColor(63, 0.5688, 0.65, 0.325, 145.044, 165.75, 82.875);
+		new AcadColor(64, 0.375, 0.5, 0, 95.625, 127.5, 0);
+		new AcadColor(65, 0.4375, 0.5, 0.25, 111.5625, 127.5, 63.75);
+		new AcadColor(66, 0.225, 0.3, 0, 57.375, 76.5, 0);
+		new AcadColor(67, 0.2625, 0.3, 0.15, 66.9375, 76.5, 38.25);
+		new AcadColor(68, 0.1125, 0.15, 0, 28.6875, 38.25, 0);
+		new AcadColor(69, 0.1313, 0.15, 0.075, 33.4815, 38.25, 19.125);
+		new AcadColor(70, 0.5, 1, 0, 127.5, 255, 0);
+		new AcadColor(71, 0.75, 1, 0.5, 191.25, 255, 127.5);
+		new AcadColor(72, 0.325, 0.65, 0, 82.875, 165.75, 0);
+		new AcadColor(73, 0.4875, 0.65, 0.325, 124.3125, 165.75, 82.875);
+		new AcadColor(74, 0.25, 0.5, 0, 63.75, 127.5, 0);
+		new AcadColor(75, 0.375, 0.5, 0.25, 95.625, 127.5, 63.75);
+		new AcadColor(76, 0.15, 0.3, 0, 38.25, 76.5, 0);
+		new AcadColor(77, 0.225, 0.3, 0.15, 57.375, 76.5, 38.25);
+		new AcadColor(78, 0.075, 0.15, 0, 19.125, 38.25, 0);
+		new AcadColor(79, 0.1125, 0.15, 0.075, 28.6875, 38.25, 19.125);
+		new AcadColor(80, 0.25, 1, 0, 63.75, 255, 0);
+		new AcadColor(81, 0.625, 1, 0.5, 159.375, 255, 127.5);
+		new AcadColor(82, 0.1625, 0.65, 0, 41.4375, 165.75, 0);
+		new AcadColor(83, 0.4063, 0.65, 0.325, 103.6065, 165.75, 82.875);
+		new AcadColor(84, 0.125, 0.5, 0, 31.875, 127.5, 0);
+		new AcadColor(85, 0.3125, 0.5, 0.25, 79.6875, 127.5, 63.75);
+		new AcadColor(86, 0.075, 0.3, 0, 19.125, 76.5, 0);
+		new AcadColor(87, 0.1875, 0.3, 0.15, 47.8125, 76.5, 38.25);
+		new AcadColor(88, 0.0375, 0.15, 0, 9.5625, 38.25, 0);
+		new AcadColor(89, 0.0938, 0.15, 0.075, 23.919, 38.25, 19.125);
+		new AcadColor(90, 0, 1, 0, 0, 255, 0);
+		new AcadColor(91, 0.5, 1, 0.5, 127.5, 255, 127.5);
+		new AcadColor(92, 0, 0.65, 0, 0, 165.75, 0);
+		new AcadColor(93, 0.325, 0.65, 0.325, 82.875, 165.75, 82.875);
+		new AcadColor(94, 0, 0.5, 0, 0, 127.5, 0);
+		new AcadColor(95, 0.25, 0.5, 0.25, 63.75, 127.5, 63.75);
+		new AcadColor(96, 0, 0.3, 0, 0, 76.5, 0);
+		new AcadColor(97, 0.15, 0.3, 0.15, 38.25, 76.5, 38.25);
+		new AcadColor(98, 0, 0.15, 0, 0, 38.25, 0);
+		new AcadColor(99, 0.075, 0.15, 0.075, 19.125, 38.25, 19.125);
+		new AcadColor(100, 0, 1, 0.25, 0, 255, 63.75);
+		new AcadColor(101, 0.5, 1, 0.625, 127.5, 255, 159.375);
+		new AcadColor(102, 0, 0.65, 0.1625, 0, 165.75, 41.4375);
+		new AcadColor(103, 0.325, 0.65, 0.4063, 82.875, 165.75, 103.6065);
+		new AcadColor(104, 0, 0.5, 0.125, 0, 127.5, 31.875);
+		new AcadColor(105, 0.25, 0.5, 0.3125, 63.75, 127.5, 79.6875);
+		new AcadColor(106, 0, 0.3, 0.075, 0, 76.5, 19.125);
+		new AcadColor(107, 0.15, 0.3, 0.1875, 38.25, 76.5, 47.8125);
+		new AcadColor(108, 0, 0.15, 0.0375, 0, 38.25, 9.5625);
+		new AcadColor(109, 0.075, 0.15, 0.0938, 19.125, 38.25, 23.919);
+		new AcadColor(110, 0, 1, 0.5, 0, 255, 127.5);
+		new AcadColor(111, 0.5, 1, 0.75, 127.5, 255, 191.25);
+		new AcadColor(112, 0, 0.65, 0.325, 0, 165.75, 82.875);
+		new AcadColor(113, 0.325, 0.65, 0.4875, 82.875, 165.75, 124.3125);
+		new AcadColor(114, 0, 0.5, 0.25, 0, 127.5, 63.75);
+		new AcadColor(115, 0.25, 0.5, 0.375, 63.75, 127.5, 95.625);
+		new AcadColor(116, 0, 0.3, 0.15, 0, 76.5, 38.25);
+		new AcadColor(117, 0.15, 0.3, 0.225, 38.25, 76.5, 57.375);
+		new AcadColor(118, 0, 0.15, 0.075, 0, 38.25, 19.125);
+		new AcadColor(119, 0.075, 0.15, 0.1125, 19.125, 38.25, 28.6875);
+		new AcadColor(120, 0, 1, 0.75, 0, 255, 191.25);
+		new AcadColor(121, 0.5, 1, 0.875, 127.5, 255, 223.125);
+		new AcadColor(122, 0, 0.65, 0.4875, 0, 165.75, 124.3125);
+		new AcadColor(123, 0.325, 0.65, 0.5688, 82.875, 165.75, 145.044);
+		new AcadColor(124, 0, 0.5, 0.375, 0, 127.5, 95.625);
+		new AcadColor(125, 0.25, 0.5, 0.4375, 63.75, 127.5, 111.5625);
+		new AcadColor(126, 0, 0.3, 0.225, 0, 76.5, 57.375);
+		new AcadColor(127, 0.15, 0.3, 0.2625, 38.25, 76.5, 66.9375);
+		new AcadColor(128, 0, 0.15, 0.1125, 0, 38.25, 28.6875);
+		new AcadColor(129, 0.075, 0.15, 0.1313, 19.125, 38.25, 33.4815);
+		new AcadColor(130, 0, 1, 1, 0, 255, 255);
+		new AcadColor(131, 0.5, 1, 1, 127.5, 255, 255);
+		new AcadColor(132, 0, 0.65, 0.65, 0, 165.75, 165.75);
+		new AcadColor(133, 0.325, 0.65, 0.65, 82.875, 165.75, 165.75);
+		new AcadColor(134, 0, 0.5, 0.5, 0, 127.5, 127.5);
+		new AcadColor(135, 0.25, 0.5, 0.5, 63.75, 127.5, 127.5);
+		new AcadColor(136, 0, 0.3, 0.3, 0, 76.5, 76.5);
+		new AcadColor(137, 0.15, 0.3, 0.3, 38.25, 76.5, 76.5);
+		new AcadColor(138, 0, 0.15, 0.15, 0, 38.25, 38.25);
+		new AcadColor(139, 0.075, 0.15, 0.15, 19.125, 38.25, 38.25);
+		new AcadColor(140, 0, 0.75, 1, 0, 191.25, 255);
+		new AcadColor(141, 0.5, 0.875, 1, 127.5, 223.125, 255);
+		new AcadColor(142, 0, 0.4875, 0.65, 0, 124.3125, 165.75);
+		new AcadColor(143, 0.325, 0.5688, 0.65, 82.875, 145.044, 165.75);
+		new AcadColor(144, 0, 0.375, 0.5, 0, 95.625, 127.5);
+		new AcadColor(145, 0.25, 0.4375, 0.5, 63.75, 111.5625, 127.5);
+		new AcadColor(146, 0, 0.225, 0.3, 0, 57.375, 76.5);
+		new AcadColor(147, 0.15, 0.2625, 0.3, 38.25, 66.9375, 76.5);
+		new AcadColor(148, 0, 0.1125, 0.15, 0, 28.6875, 38.25);
+		new AcadColor(149, 0.075, 0.1313, 0.15, 19.125, 33.4815, 38.25);
+		new AcadColor(150, 0, 0.5, 1, 0, 127.5, 255);
+		new AcadColor(151, 0.5, 0.75, 1, 127.5, 191.25, 255);
+		new AcadColor(152, 0, 0.325, 0.65, 0, 82.875, 165.75);
+		new AcadColor(153, 0.325, 0.4875, 0.65, 82.875, 124.3125, 165.75);
+		new AcadColor(154, 0, 0.25, 0.5, 0, 63.75, 127.5);
+		new AcadColor(155, 0.25, 0.375, 0.5, 63.75, 95.625, 127.5);
+		new AcadColor(156, 0, 0.15, 0.3, 0, 38.25, 76.5);
+		new AcadColor(157, 0.15, 0.225, 0.3, 38.25, 57.375, 76.5);
+		new AcadColor(158, 0, 0.075, 0.15, 0, 19.125, 38.25);
+		new AcadColor(159, 0.075, 0.1125, 0.15, 19.125, 28.6875, 38.25);
+		new AcadColor(160, 0, 0.25, 1, 0, 63.75, 255);
+		new AcadColor(161, 0.5, 0.625, 1, 127.5, 159.375, 255);
+		new AcadColor(162, 0, 0.1625, 0.65, 0, 41.4375, 165.75);
+		new AcadColor(163, 0.325, 0.4063, 0.65, 82.875, 103.6065, 165.75);
+		new AcadColor(164, 0, 0.125, 0.5, 0, 31.875, 127.5);
+		new AcadColor(165, 0.25, 0.3125, 0.5, 63.75, 79.6875, 127.5);
+		new AcadColor(166, 0, 0.075, 0.3, 0, 19.125, 76.5);
+		new AcadColor(167, 0.15, 0.1875, 0.3, 38.25, 47.8125, 76.5);
+		new AcadColor(168, 0, 0.0375, 0.15, 0, 9.5625, 38.25);
+		new AcadColor(169, 0.075, 0.0938, 0.15, 19.125, 23.919, 38.25);
+		new AcadColor(170, 0, 0, 1, 0, 0, 255);
+		new AcadColor(171, 0.5, 0.5, 1, 127.5, 127.5, 255);
+		new AcadColor(172, 0, 0, 0.65, 0, 0, 165.75);
+		new AcadColor(173, 0.325, 0.325, 0.65, 82.875, 82.875, 165.75);
+		new AcadColor(174, 0, 0, 0.5, 0, 0, 127.5);
+		new AcadColor(175, 0.25, 0.25, 0.5, 63.75, 63.75, 127.5);
+		new AcadColor(176, 0, 0, 0.3, 0, 0, 76.5);
+		new AcadColor(177, 0.15, 0.15, 0.3, 38.25, 38.25, 76.5);
+		new AcadColor(178, 0, 0, 0.15, 0, 0, 38.25);
+		new AcadColor(179, 0.075, 0.075, 0.15, 19.125, 19.125, 38.25);
+		new AcadColor(180, 0.25, 0, 1, 63.75, 0, 255);
+		new AcadColor(181, 0.625, 0.5, 1, 159.375, 127.5, 255);
+		new AcadColor(182, 0.1625, 0, 0.65, 41.4375, 0, 165.75);
+		new AcadColor(183, 0.4063, 0.325, 0.65, 103.6065, 82.875, 165.75);
+		new AcadColor(184, 0.125, 0, 0.5, 31.875, 0, 127.5);
+		new AcadColor(185, 0.3125, 0.25, 0.5, 79.6875, 63.75, 127.5);
+		new AcadColor(186, 0.075, 0, 0.3, 19.125, 0, 76.5);
+		new AcadColor(187, 0.1875, 0.15, 0.3, 47.8125, 38.25, 76.5);
+		new AcadColor(188, 0.0375, 0, 0.15, 9.5625, 0, 38.25);
+		new AcadColor(189, 0.0938, 0.075, 0.15, 23.919, 19.125, 38.25);
+		new AcadColor(190, 0.5, 0, 1, 127.5, 0, 255);
+		new AcadColor(191, 0.75, 0.5, 1, 191.25, 127.5, 255);
+		new AcadColor(192, 0.325, 0, 0.65, 82.875, 0, 165.75);
+		new AcadColor(193, 0.4875, 0.325, 0.65, 124.3125, 82.875, 165.75);
+		new AcadColor(194, 0.25, 0, 0.5, 63.75, 0, 127.5);
+		new AcadColor(195, 0.375, 0.25, 0.5, 95.625, 63.75, 127.5);
+		new AcadColor(196, 0.15, 0, 0.3, 38.25, 0, 76.5);
+		new AcadColor(197, 0.225, 0.15, 0.3, 57.375, 38.25, 76.5);
+		new AcadColor(198, 0.075, 0, 0.15, 19.125, 0, 38.25);
+		new AcadColor(199, 0.1125, 0.075, 0.15, 28.6875, 19.125, 38.25);
+		new AcadColor(200, 0.75, 0, 1, 191.25, 0, 255);
+		new AcadColor(201, 0.875, 0.5, 1, 223.125, 127.5, 255);
+		new AcadColor(202, 0.4875, 0, 0.65, 124.3125, 0, 165.75);
+		new AcadColor(203, 0.5688, 0.325, 0.65, 145.044, 82.875, 165.75);
+		new AcadColor(204, 0.375, 0, 0.5, 95.625, 0, 127.5);
+		new AcadColor(205, 0.4375, 0.25, 0.5, 111.5625, 63.75, 127.5);
+		new AcadColor(206, 0.225, 0, 0.3, 57.375, 0, 76.5);
+		new AcadColor(207, 0.2625, 0.15, 0.3, 66.9375, 38.25, 76.5);
+		new AcadColor(208, 0.1125, 0, 0.15, 28.6875, 0, 38.25);
+		new AcadColor(209, 0.1313, 0.075, 0.15, 33.4815, 19.125, 38.25);
+		new AcadColor(210, 1, 0, 1, 255, 0, 255);
+		new AcadColor(211, 1, 0.5, 1, 255, 127.5, 255);
+		new AcadColor(212, 0.65, 0, 0.65, 165.75, 0, 165.75);
+		new AcadColor(213, 0.65, 0.325, 0.65, 165.75, 82.875, 165.75);
+		new AcadColor(214, 0.5, 0, 0.5, 127.5, 0, 127.5);
+		new AcadColor(215, 0.5, 0.25, 0.5, 127.5, 63.75, 127.5);
+		new AcadColor(216, 0.3, 0, 0.3, 76.5, 0, 76.5);
+		new AcadColor(217, 0.3, 0.15, 0.3, 76.5, 38.25, 76.5);
+		new AcadColor(218, 0.15, 0, 0.15, 38.25, 0, 38.25);
+		new AcadColor(219, 0.15, 0.075, 0.15, 38.25, 19.125, 38.25);
+		new AcadColor(220, 1, 0, 0.75, 255, 0, 191.25);
+		new AcadColor(221, 1, 0.5, 0.875, 255, 127.5, 223.125);
+		new AcadColor(222, 0.65, 0, 0.4875, 165.75, 0, 124.3125);
+		new AcadColor(223, 0.65, 0.325, 0.5688, 165.75, 82.875, 145.044);
+		new AcadColor(224, 0.5, 0, 0.375, 127.5, 0, 95.625);
+		new AcadColor(225, 0.5, 0.25, 0.4375, 127.5, 63.75, 111.5625);
+		new AcadColor(226, 0.3, 0, 0.225, 76.5, 0, 57.375);
+		new AcadColor(227, 0.3, 0.15, 0.2625, 76.5, 38.25, 66.9375);
+		new AcadColor(228, 0.15, 0, 0.1125, 38.25, 0, 28.6875);
+		new AcadColor(229, 0.15, 0.075, 0.1313, 38.25, 19.125, 33.4815);
+		new AcadColor(230, 1, 0, 0.5, 255, 0, 127.5);
+		new AcadColor(231, 1, 0.5, 0.75, 255, 127.5, 191.25);
+		new AcadColor(232, 0.65, 0, 0.325, 165.75, 0, 82.875);
+		new AcadColor(233, 0.65, 0.325, 0.4875, 165.75, 82.875, 124.3125);
+		new AcadColor(234, 0.5, 0, 0.25, 127.5, 0, 63.75);
+		new AcadColor(235, 0.5, 0.25, 0.375, 127.5, 63.75, 95.625);
+		new AcadColor(236, 0.3, 0, 0.15, 76.5, 0, 38.25);
+		new AcadColor(237, 0.3, 0.15, 0.225, 76.5, 38.25, 57.375);
+		new AcadColor(238, 0.15, 0, 0.075, 38.25, 0, 19.125);
+		new AcadColor(239, 0.15, 0.075, 0.1125, 38.25, 19.125, 28.6875);
+		new AcadColor(240, 1, 0, 0.25, 255, 0, 63.75);
+		new AcadColor(241, 1, 0.5, 0.625, 255, 127.5, 159.375);
+		new AcadColor(242, 0.65, 0, 0.1625, 165.75, 0, 41.4375);
+		new AcadColor(243, 0.65, 0.325, 0.4063, 165.75, 82.875, 103.6065);
+		new AcadColor(244, 0.5, 0, 0.125, 127.5, 0, 31.875);
+		new AcadColor(245, 0.5, 0.25, 0.3125, 127.5, 63.75, 79.6875);
+		new AcadColor(246, 0.3, 0, 0.075, 76.5, 0, 19.125);
+		new AcadColor(247, 0.3, 0.15, 0.1875, 76.5, 38.25, 47.8125);
+		new AcadColor(248, 0.15, 0, 0.0375, 38.25, 0, 9.5625);
+		new AcadColor(249, 0.15, 0.075, 0.0938, 38.25, 19.125, 23.919);
+		new AcadColor(250, 0.33, 0.33, 0.33, 84.15, 84.15, 84.15);
+		new AcadColor(251, 0.464, 0.464, 0.464, 118.32, 118.32, 118.32);
+		new AcadColor(252, 0.598, 0.598, 0.598, 152.49, 152.49, 152.49);
+		new AcadColor(253, 0.732, 0.732, 0.732, 186.66, 186.66, 186.66);
+		new AcadColor(254, 0.866, 0.866, 0.866, 220.83, 220.83, 220.83);
+		new AcadColor(255, 1.0, 1.0, 1.0, 255.0, 255.0, 255.0);
+		return AcadColor.colors;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Vector3D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Vector3D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Vector3D.java	(revision 435)
@@ -0,0 +1,171 @@
+
+package org.gvsig.dwg.lib.util;
+
+/**
+ *  3dim double vector. A vector is transformed different than a point.
+ *  The class is now declared final to allow a more aggresive optimization.
+ *
+ *  @see       dxfviewer.math.Point3D;
+ *
+ *  @version   1.10,�01/13/99
+ */
+public final class Vector3D {
+  public double x, y, z;       // coordinates, allowing direct access
+
+  /**
+   *
+   */
+  public Vector3D() {
+  }
+
+  /**
+   *  Copy constructor.
+   *  @param  v    vector to copy
+   */
+  public Vector3D(Vector3D v) {
+    x = v.x;
+    y = v.y;
+    z = v.z;
+  }
+
+  /**
+   *  Copy from a point.
+   *  @param  p   point to copy
+   */
+  public Vector3D(Point3D p) {
+    x = p.x;
+    y = p.y;
+    z = p.z;
+  }
+
+  /**
+   *  @param   xx    x coord
+   *  @param   yy    y coord
+   *  @param   zz    z coord
+   */
+  public Vector3D(double xx, double yy, double zz) {
+    x = xx;
+    y = yy;
+    z = zz;
+  }
+
+  /**
+   *  Calculate the length.
+   *  @return  length of vector
+   */
+  public double length() {
+    return (double)Math.sqrt(x*x+y*y+z*z);
+  }
+
+  /**
+   *  Scale.
+   *  @param   f     scaling factor
+   */
+  public void scale(double f) {
+    if (f != 1f) {
+      x *= f;
+      y *= f;
+      z *= f;
+    }
+  }
+
+  /**
+   *  Normalize. Scale vector so it has length 1.
+   */
+  public void normalize() {
+    scale(1.0f/length());
+  }
+
+  /**
+   *  Add a vector.
+   *  @param  v      vector to add
+   */
+  public void add(Vector3D v) {
+    x += v.x;
+    y += v.y;
+    z += v.z;
+  }
+
+  /**
+   *  Get sum of vectors.
+   *  @param  v     vector to add
+   *  @return this+v
+   */
+  public Vector3D plus(Vector3D v) {
+    Vector3D ret = new Vector3D(this);
+    ret.add(v);
+    return ret;
+  }
+  /**
+   *  Get sum of this vector and point.
+   *  @param  p     point to add
+   *  @return this+p
+   */
+  public Point3D plus(Point3D p) {
+    Point3D ret = new Point3D(p);
+    ret.add(this);
+    return ret;
+  }
+
+  /**
+   *  Substract a vector from this.
+   *  @param  v     vector to substract
+   */
+  public void sub(Vector3D v) {
+    x -= v.x;
+    y -= v.y;
+    z -= v.z;
+  }
+
+  /**
+   *  Get difference with point.
+   *  @param  p     point to substract
+   *  @return this-p = -(p-this)
+   */
+  public Point3D minus(Point3D p) {
+    Point3D ret = new Point3D(p);
+    ret.sub(this);
+    ret.scale(-1f);
+    return ret;
+  }
+
+  /**
+   *  Get difference with vector.
+   *  @param  v     vector to substract
+   *  @return this-v
+   */
+  public Vector3D minus(Vector3D v) {
+    Vector3D ret = new Vector3D(this);
+    ret.sub(v);
+    return ret;
+  }
+
+  /**
+   *  Scalar product.
+   *  @param  v     vector to multiply
+   *  @return this*v
+   */
+  public double mult(Vector3D v) {
+    return x*v.x+y*v.y+z*v.z;
+  }
+
+  /**
+   *  Cross product.
+   *  @param  v     vector to multiply
+   *  @return this x v
+   */
+  public Vector3D cross(Vector3D v) {
+    return new Vector3D(y*v.z - z*v.y,
+			z*v.x - x*v.z,
+			x*v.y - y*v.x);
+  }
+
+  /**
+   *  Output.
+   *  @return  string representation
+   */
+  public String toString() {
+    return new String(new StringBuffer().append("<").append(x).append(",").append(y).append(",").append(z).append(">"));
+  }
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Matrix4D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Matrix4D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/Matrix4D.java	(revision 435)
@@ -0,0 +1,561 @@
+
+package org.gvsig.dwg.lib.util;
+
+
+/**
+ *  4x4dim double matrix used for perspective transformations.
+ *  The class is now declared final to allow a more aggresive optimization.
+ *
+ */
+public final class Matrix4D {
+  static private final double DEG2RAD = Math.PI/180.0;  // conversion from degree to radians
+
+  public double xx, xy, xz, xw,     // 1st row
+			   yx, yy, yz, yw,     // 2nd row
+			   zx, zy, zz, zw,     // 3rd row
+			   wx, wy, wz, ww;     // 4th row
+
+  /**
+   *  Create identity matrix.
+   */
+  public Matrix4D() {
+	// set to identity mat
+	xx = yy = zz = ww = 1f;
+  }
+
+  /**
+   *  Copy constructor.
+   *  @param  m   matrix to copy
+   */
+  public Matrix4D(Matrix4D m) {
+	xx = m.xx;
+	xy = m.xy;
+	xz = m.xz;
+	xw = m.xw;
+	yx = m.yx;
+	yy = m.yy;
+	yz = m.yz;
+	yw = m.yw;
+	zx = m.zx;
+	zy = m.zy;
+	zz = m.zz;
+	zw = m.zw;
+	wx = m.wx;
+	wy = m.wy;
+	wz = m.wz;
+	ww = m.ww;
+  }
+
+  /**
+   *  @param  mxx     1st elem in 1st row
+   *  @param  mxy     2nd elem in 1st row
+   *  @param  mxz     3rd elem in 1st row
+   *  @param  mxw     4th elem in 1st row
+   *  @param  myx     1st elem in 2nd row
+   *  @param  myy     2nd elem in 2nd row
+   *  @param  myz     3rd elem in 2nd row
+   *  @param  myw     4th elem in 2nd row
+   *  @param  mzx     1st elem in 3rd row
+   *  @param  mzy     2nd elem in 3rd row
+   *  @param  mzz     3rd elem in 3rd row
+   *  @param  mzw     4th elem in 3rd row
+   *  @param  mwx     1st elem in 4th row
+   *  @param  mwy     2nd elem in 4th row
+   *  @param  mwz     3rd elem in 4th row
+   *  @param  mww     4th elem in 4th row
+   */
+  public Matrix4D(double mxx, double mxy, double mxz, double mxw,
+		  double myx, double myy, double myz, double myw,
+		  double mzx, double mzy, double mzz, double mzw,
+		  double mwx, double mwy, double mwz, double mww) {
+	xx = mxx;
+	xy = mxy;
+	xz = mxz;
+	xw = mxw;
+	yx = myx;
+	yy = myy;
+	yz = myz;
+	yw = myw;
+	zx = mzx;
+	zy = mzy;
+	zz = mzz;
+	zw = mzw;
+	wx = mwx;
+	wy = mwy;
+	wz = mwz;
+	ww = mww;
+  }
+
+  /**
+   *  Reset to identity
+   */
+  public void identity() {
+	xx = yy = zz = ww = 1f;
+	xy = xz = xw =
+	  yx = yz = yw =
+	  zx = zy = zw =
+	  wx = wy = wz = 0f;
+  }
+
+  /**
+   *  Transponize.
+   */
+  public void transponize() {
+	// switch rows and columns
+	double t;
+	t = xy; xy = yx; yx = t;
+	t = xz; xz = zx; zx = t;
+	t = xw; xw = wx; wx = t;
+	t = yz; yz = zy; zy = t;
+	t = yw; yw = wy; wy = t;
+	t = zw; zw = wz; wz = t;
+  }
+
+  /**
+   *  Matrix multiplication of vector.
+   *  @param  v   vector to transform
+   *  @return transformed vector
+   */
+  public Vector3D mult(Vector3D v) {
+	return new Vector3D(xx*v.x + xy*v.y + xz*v.z,
+			yx*v.x + yy*v.y + yz*v.z,
+			zx*v.x + zy*v.y + zz*v.z);
+  }
+
+  /**
+   *  Transformation of 1 vector.
+   *  @param  v   vector to transform
+   */
+  public void transform(Vector3D v) {
+	double x = xx*v.x + xy*v.y + xz*v.z,
+		  y = yx*v.x + yy*v.y + yz*v.z,
+		  z = zx*v.x + zy*v.y + zz*v.z;
+
+	v.x = x;
+	v.y = y;
+	v.z = z;
+  }
+
+  /**
+   *  Matrix multiplication of point.
+   *  @param  p    point to transform
+   *  @return transformed point
+   */
+  public Point3D mult(Point3D p) {
+	Point3D ret = new Point3D(xx*p.x + xy*p.y + xz*p.z + xw,
+				  yx*p.x + yy*p.y + yz*p.z + yw,
+				  zx*p.x + zy*p.y + zz*p.z + zw);
+	ret.scale(1f/(wx*p.x + wy*p.y + wz*p.z + ww));
+	return ret;
+  }
+
+  /**
+   *  Transformation of 1 point.
+   *  @param  p   point to transform
+   */
+  public void transform(Point3D p) {
+	double  x = xx*p.x + xy*p.y + xz*p.z + xw,
+		   y = yx*p.x + yy*p.y + yz*p.z + yw,
+		   z = zx*p.x + zy*p.y + zz*p.z + zw,
+		   w = wx*p.x + wy*p.y + wz*p.z + ww;
+
+	p.x = x/w;
+	p.y = y/w;
+	p.z = z/w;
+  }
+
+  /**Transformacion de un punto considerando solo el plano horizontal
+   */
+   public void transformXY(Point3D p){
+		double  x = xx*p.x + xy*p.y+ xw,
+		y = yx*p.x + yy*p.y + yw,
+		w = wx*p.x + wy*p.y + ww;
+		p.x = x/w;
+		p.y = y/w;
+   }
+
+  /**
+   *  Matrix multiplication.
+   *  @param  m   matrix to multiply with
+   *  @return this * m
+   */
+  public Matrix4D mult(Matrix4D m) {
+	if (m != null) {
+	  return new Matrix4D(xx*m.xx + xy*m.yx + xz*m.zx + xw*m.wx,
+			  xx*m.xy + xy*m.yy + xz*m.zy + xw*m.wy,
+			  xx*m.xz + xy*m.yz + xz*m.zz + xw*m.wz,
+			  xx*m.xw + xy*m.yw + xz*m.zw + xw*m.ww,
+			  yx*m.xx + yy*m.yx + yz*m.zx + yw*m.wx,
+			  yx*m.xy + yy*m.yy + yz*m.zy + yw*m.wy,
+			  yx*m.xz + yy*m.yz + yz*m.zz + yw*m.wz,
+			  yx*m.xw + yy*m.yw + yz*m.zw + yw*m.ww,
+			  zx*m.xx + zy*m.yx + zz*m.zx + zw*m.wx,
+			  zx*m.xy + zy*m.yy + zz*m.zy + zw*m.wy,
+			  zx*m.xz + zy*m.yz + zz*m.zz + zw*m.wz,
+			  zx*m.xw + zy*m.yw + zz*m.zw + zw*m.ww,
+			  wx*m.xx + wy*m.yx + wz*m.zx + ww*m.wx,
+			  wx*m.xy + wy*m.yy + wz*m.zy + ww*m.wy,
+			  wx*m.xz + wy*m.yz + wz*m.zz + ww*m.wz,
+			  wx*m.xw + wy*m.yw + wz*m.zw + ww*m.ww);
+	}
+	else {
+	  return new Matrix4D(this);
+	}
+  }
+
+  /**
+   *  Matrix multiplication.
+   *  @param  m  matrix to multply with
+   */
+  public void multBy(Matrix4D m) {
+	double x = xx*m.xx + xy*m.yx + xz*m.zx + xw*m.wx,
+		  y = xx*m.xy + xy*m.yy + xz*m.zy + xw*m.wy,
+		  z = xx*m.xz + xy*m.yz + xz*m.zz + xw*m.wz,
+		  w = xx*m.xw + xy*m.yw + xz*m.zw + xw*m.ww;
+	xx = x;
+	xy = y;
+	xz = z;
+	xw = w;
+
+	x = yx*m.xx + yy*m.yx + yz*m.zx + yw*m.wx;
+	y = yx*m.xy + yy*m.yy + yz*m.zy + yw*m.wy;
+	z = yx*m.xz + yy*m.yz + yz*m.zz + yw*m.wz;
+	w = yx*m.xw + yy*m.yw + yz*m.zw + yw*m.ww;
+	yx = x;
+	yy = y;
+	yz = z;
+	yw = w;
+
+	x = zx*m.xx + zy*m.yx + zz*m.zx + zw*m.wx;
+	y = zx*m.xy + zy*m.yy + zz*m.zy + zw*m.wy;
+	z = zx*m.xz + zy*m.yz + zz*m.zz + zw*m.wz;
+	w = zx*m.xw + zy*m.yw + zz*m.zw + zw*m.ww;
+	zx = x;
+	zy = y;
+	zz = z;
+	zw = w;
+
+	x = wx*m.xx + wy*m.yx + wz*m.zx + ww*m.wx;
+	y = wx*m.xy + wy*m.yy + wz*m.zy + ww*m.wy;
+	z = wx*m.xz + wy*m.yz + wz*m.zz + ww*m.wz;
+	w = wx*m.xw + wy*m.yw + wz*m.zw + ww*m.ww;
+	wx = x;
+	wy = y;
+	wz = z;
+	ww = w;
+  }
+
+  /**
+   *  Matrix multiplication from left.
+   *  @param  m  matrix to multiply with.
+   */
+  public void multLeftBy(Matrix4D m) {
+	double x = m.xx*xx + m.xy*yx + m.xz*zx + m.xw*wx,
+		  y = m.yx*xx + m.yy*yx + m.yz*zx + m.yw*wx,
+		  z = m.zx*xx + m.zy*yx + m.zz*zx + m.zw*wx,
+		  w = m.wx*xx + m.wy*yx + m.wz*zx + m.ww*wx;
+	xx = x;
+	yx = y;
+	zx = z;
+	wx = w;
+
+	x = m.xx*xy + m.xy*yy + m.xz*zy + m.xw*wy;
+	y = m.yx*xy + m.yy*yy + m.yz*zy + m.yw*wy;
+	z = m.zx*xy + m.zy*yy + m.zz*zy + m.zw*wy;
+	w = m.wx*xy + m.wy*yy + m.wz*zy + m.ww*wy;
+	xy = x;
+	yy = y;
+	zy = z;
+	wy = w;
+
+	x = m.xx*xz + m.xy*yz + m.xz*zz + m.xw*wz;
+	y = m.yx*xz + m.yy*yz + m.yz*zz + m.yw*wz;
+	z = m.zx*xz + m.zy*yz + m.zz*zz + m.zw*wz;
+	w = m.wx*xz + m.wy*yz + m.wz*zz + m.ww*wz;
+	xz = x;
+	yz = y;
+	zz = z;
+	wz = w;
+
+	x = m.xx*xw + m.xy*yw + m.xz*zw + m.xw*ww;
+	y = m.yx*xw + m.yy*yw + m.yz*zw + m.yw*ww;
+	z = m.zx*xw + m.zy*yw + m.zz*zw + m.zw*ww;
+	w = m.wx*xw + m.wy*yw + m.wz*zw + m.ww*ww;
+	xw = x;
+	yw = y;
+	zw = z;
+	ww = w;
+  }
+
+  /**
+   *  Translate the origin.
+   *  @param  x   translation in x
+   *  @param  y   translation in y
+   *  @param  z   translation in z
+   */
+  public void translate(double x, double y, double z) {
+	xw += x*xx+y*xy+z*xz;
+	yw += x*yx+y*yy+z*yz;
+	zw += x*zx+y*zy+z*zz;
+	ww += x*wx+y*wy+z*wz;
+  }
+
+  /**
+   *  Translate the origin
+   *  @param  v   translation vector
+   */
+  public void translate(Vector3D v) {
+	translate(v.x, v.y, v.z);
+  }
+
+  /**
+   *  Translate.
+   *  @param  x   translation in x
+   *  @param  y   translation in y
+   *  @param  z   translation in z
+   */
+  public void translateLeft(double x, double y, double z) {
+	if (x != 0f) {
+	  xx += x*wx;  xy += x*wy;  xz += x*wz;  xw += x*ww;
+	}
+	if (y != 0f) {
+	  yx += y*wx;  yy += y*wy;  yz += y*wz;  yw += y*ww;
+	}
+	if (z != 0f) {
+	  zx += z*wx;  zy += z*wy;  zz += z*wz;  zw += z*ww;
+	}
+  }
+
+  /**
+   *  Translate the origin
+   *  @param  v   tranbslation vector
+   */
+  public void translateLeft(Vector3D v) {
+	translateLeft(v.x, v.y, v.z);
+  }
+
+
+  /**
+   *  Move the stuff.
+   *  @param  x   translation in x
+   *  @param  y   translation in y
+   *  @param  z   translation in z
+   */
+  public void moveBy(double x, double y, double z) {
+	if (x != 0f) {
+	  xx += x*xw;  yx += x*yw;  zx += x*zw;  wx += x*ww;
+	}
+	if (y != 0f) {
+	  xy += y*xw;  yy += y*yw;  zy += y*zw;  wy += y*ww;
+	}
+	if (z != 0f) {
+	  xz += z*xw;  yz += z*yw;  zz += z*zw;  wz += z*ww;
+	}
+  }
+
+  /**
+   *  Translate the origin
+   *  @param  v   translation vector
+   */
+  public void moveBy(Vector3D v) {
+	moveBy(v.x, v.y, v.z);
+  }
+
+
+  /**
+   *  Rotate theta degrees about the y axis.
+   *  @param  theta  rotation angle in rad
+   */
+  public void yrot(double theta) {
+	if (theta == 0.0) {
+	  return;
+	}
+	double ct = Math.cos(theta);
+	double st = -Math.sin(theta);
+
+	double Nx = (double) (xx * ct - zx * st);
+	double Nz = (double) (xx * st + zx * ct);
+	xx = Nx;
+	zx = Nz;
+
+	Nx = (double) (xy * ct - zy * st);
+	Nz = (double) (xy * st + zy * ct);
+	xy = Nx;
+	zy = Nz;
+
+	Nx = (double) (xz * ct - zz * st);
+	Nz = (double) (xz * st + zz * ct);
+	xz = Nx;
+	zz = Nz;
+
+	Nx = (double) (xw * ct - zw * st);
+	Nz = (double) (xw * st + zw * ct);
+	xw = Nx;
+	zw = Nz;
+  }
+
+  /**
+   *  Rotate theta degrees about the x axis.
+   *  @param  theta  rotation angle in rad
+   */
+  public void xrot(double theta) {
+	if (theta == 0.0) {
+	  return;
+	}
+	double ct = Math.cos(theta);
+	double st = Math.sin(theta);
+
+	double Ny = (double) (yx * ct - zx * st);
+	double Nz = (double) (yx * st + zx * ct);
+	yx = Ny;
+	zx = Nz;
+
+	Ny = (double) (yy * ct - zy * st);
+	Nz = (double) (yy * st + zy * ct);
+	yy = Ny;
+	zy = Nz;
+
+	Ny = (double) (yz * ct - zz * st);
+	Nz = (double) (yz * st + zz * ct);
+	yz = Ny;
+	zz = Nz;
+
+	Ny = (double) (yw * ct - zw * st);
+	Nz = (double) (yw * st + zw * ct);
+	yw = Ny;
+	zw = Nz;
+  }
+
+  /**
+   *  Rotate theta degrees about the z axis.
+   *  @param  theta  rotation angle in rad
+   */
+  public void zrot(double theta) {
+	if (theta == 0.0) {
+	  return;
+	}
+	double ct = Math.cos(theta);
+	double st = Math.sin(theta);
+
+	double Nx = (double) (xx * ct - yx * st);
+	double Ny = (double) (xx * st + yx * ct);
+	xx = Nx;
+	yx = Ny;
+
+	Nx = (double) (xy * ct - yy * st);
+	Ny = (double) (xy * st + yy * ct);
+	xy = Nx;
+	yy = Ny;
+
+	Nx = (double) (xz * ct - yz * st);
+	Ny = (double) (xz * st + yz * ct);
+	xz = Nx;
+	yz = Ny;
+
+	Nx = (double) (xw * ct - yw * st);
+	Ny = (double) (xw * st + yw * ct);
+	xw = Nx;
+	yw = Ny;
+  }
+
+  /**
+   *  Scale.
+   *  @param  f   factor to scale with.
+   */
+  public void scale(double f) {
+	xx *= f;
+	yx *= f;
+	zx *= f;
+	wx *= f;
+	xy *= f;
+	yy *= f;
+	zy *= f;
+	wy *= f;
+	xz *= f;
+	yz *= f;
+	zz *= f;
+	wz *= f;
+  }
+
+  /**
+   *  Scale different in x,y,z.
+   *  @param  fx   scaling factor in x
+   *  @param  fy   scaling factor in y
+   *  @param  fz   scaling factor in z
+   */
+  public void scale(double fx, double fy, double fz) {
+	xx *= fx;
+	yx *= fx;
+	zx *= fx;
+	wx *= fx;
+	xy *= fy;
+	yy *= fy;
+	zy *= fy;
+	wy *= fy;
+	xz *= fz;
+	yz *= fz;
+	zz *= fz;
+	wz *= fz;
+  }
+
+
+  private static final double MIN_INT = (double)Short.MIN_VALUE;
+  private static final double MAX_INT = (double)Short.MAX_VALUE;
+
+  /**
+   *  Transform some points.
+   *  @param  v       points to transform
+   *  @param  tx      transformed points x coord
+   *  @param  ty      transformed points y coord
+   *  @param  tz      transformed points z coord
+   *  @param  npoints nr of points to transform
+   */
+  public void transform(Point3D v[], int tx[], int ty[], int tz[], int npoints) {
+	Point3D tmp;
+
+	for (int i = npoints; --i >= 0;) {
+	  tmp = mult(v[i]);
+
+	  if (tmp.x < MIN_INT) {
+	tmp.x = MIN_INT;
+	  }
+	  else if (tmp.x > MAX_INT) {
+	tmp.x = MAX_INT;
+	  }
+	  if (tmp.y < MIN_INT) {
+	tmp.y = MIN_INT;
+	  }
+	  else if (tmp.y > MAX_INT) {
+	tmp.y = MAX_INT;
+	  }
+	  if (tmp.z < MIN_INT) {
+	tmp.z = MIN_INT;
+	  }
+	  else if (tmp.z > MAX_INT) {
+	tmp.z = MAX_INT;
+	  }
+
+	  tx[i] = (int) tmp.x;
+	  ty[i] = (int) tmp.y;
+	  tz[i] = (int) tmp.z;
+	}
+  }
+
+  /**
+   *  Output
+   *  @return String representing this.
+   */
+  public String toString() {
+	return new String(new StringBuffer().append("{{").
+	  append(xx).append(",").append(xy).append(",").append(xz).append(",").append(xw).
+	  append("},{").
+	  append(yx).append(",").append(yy).append(",").append(yz).append(",").append(yw).
+	  append("},{").
+	  append(zx).append(",").append(zy).append(",").append(zz).append(",").append(zw).
+	  append("},{").
+	  append(wx).append(",").append(wy).append(",").append(wz).append(",").append(ww).
+	  append("}}"));
+  }
+}
+
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlockMember.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlockMember.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlockMember.java	(revision 435)
@@ -0,0 +1,70 @@
+/*
+ * Created on 20-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwgBlockMember.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/09 13:15:57  azabala
+* changes in IDwgBlockMember
+*
+* Revision 1.1  2007/01/20 18:32:04  azabala
+* refactoring of blocks
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+public interface IDwgBlockMember {
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, 
+			double rot, List dwgObjectsWithoutBlocks,
+						Map handle_objectsWithoutBlocks, DwgFile callBack);
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgVersionNotSupportedException.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgVersionNotSupportedException.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgVersionNotSupportedException.java	(revision 435)
@@ -0,0 +1,73 @@
+/*
+ * Created on 07-sep-2006
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVersionNotSupportedException.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1  2006-09-07 18:24:34  azabala
+* throws a DwgNotSupportedVersion if dwg version is not supported
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+public class DwgVersionNotSupportedException extends Exception {
+	
+	String dwgVersion;
+	
+	
+	
+	public DwgVersionNotSupportedException(String text){
+		super(text);
+	}
+	
+	public void setDwgVersion(String text){
+		this.dwgVersion = text;
+	}
+	
+	public String getDwgVersion(){
+		return dwgVersion;
+	}
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgExtrusionable.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgExtrusionable.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgExtrusionable.java	(revision 435)
@@ -0,0 +1,98 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwgExtrusionable.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.3.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.3  2007/02/15 20:35:13  azabala
+* comments
+*
+* Revision 1.2  2007/02/15 15:32:51  azabala
+* added comments
+*
+* Revision 1.1  2007/01/12 19:29:58  azabala
+* first version in cvs
+*
+*
+*/
+package org.gvsig.dwg.lib;
+/**
+ * All dwg drawing entities that need to compute
+ * an extrussion before draw them must implement
+ * this interface.
+ * 
+ * This "extrusion" transforms coordinates from the 
+ * "Object Coordinate System" (OCS) to the
+ * "World Coordinate System" (WCS).
+ * 
+ *  For some entities, the OCS is equivalent to the 
+ *  WCS and all points are expressed in World coordinates. 
+
+		Entities 						Notes
+
+		3D entities such as 			These entities do not lie in a 
+		line, point, 3dface,			particular plane. All points are  
+		3D polyline,					expressed in world coordinates.  
+		3D vertex, 3D mesh, 			Of these entities, only lines and points can be extruded. 
+		3D mesh vertex
+	
+
+
+
+		2D entities such as circle, arc, 		These entities are planar in nature. 
+		solid, trace, text, attrib, attdef, 	All points are expressed in object coordinates. 
+		shape, insert, 2D polyline, 2D vertex, 	All of these entities can be extruded. 
+		lwpolyline, hatch, image
+	
+
+ * 
+ * 
+ * */
+public interface IDwgExtrusionable {
+	public void applyExtrussion();
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectFactory.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectFactory.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectFactory.java	(revision 435)
@@ -0,0 +1,444 @@
+/*
+ * Created on 27-dic-2006
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+ *
+ * $Id: DwgObjectFactory.java 28969 2009-05-25 13:23:12Z jmvivo $
+ * $Log$
+ * Revision 1.14.2.2  2007-03-21 19:49:16  azabala
+ * implementation of dwg 12, 13, 14.
+ *
+ * Revision 1.18  2007/03/20 19:55:27  azabala
+ * source code cleaning
+ *
+ * Revision 1.17  2007/03/06 19:39:38  azabala
+ * Changes to adapt dwg 12 to general architecture
+ *
+ * Revision 1.16  2007/03/02 20:31:22  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.15  2007/03/01 19:59:46  azabala
+ * source code cleaning
+ *
+ * Revision 1.14  2007/02/22 20:45:51  azabala
+ * changes to add dwg 12 entities creation
+ *
+ * Revision 1.13  2007/02/14 09:20:32  fdiaz
+ * Eliminado un comentario y habilitado de nuevo el else del final del metodo create.
+ *
+ * Revision 1.12  2007/02/08 20:27:06  azabala
+ * solved bug with lwpolylines
+ *
+ * Revision 1.11  2007/02/08 10:27:35  azabala
+ * if the type is unknown it returns NULL
+ *
+ * Revision 1.10  2007/02/06 20:17:29  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.9  2007/02/02 12:39:52  azabala
+ * Added new dwg entities
+ *
+ * Revision 1.8  2007/02/01 20:00:27  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.7  2007/01/31 18:20:58  fdiaz
+ * A�adido un return null al final de metodo create por si no entra en ninguna de las condiciones.
+ *
+ * Revision 1.6  2007/01/31 10:01:11  fdiaz
+ * A�adido el DwgDictionary.
+ *
+ * Revision 1.5  2007/01/30 19:40:23  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.4  2007/01/30 12:37:18  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.3  2007/01/24 20:14:31  azabala
+ * implementation of reader of V14
+ *
+ * Revision 1.2  2007/01/12 19:35:00  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2007/01/09 15:39:15  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package org.gvsig.dwg.lib;
+
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+import org.gvsig.dwg.lib.objects.DwgDictionary;
+import org.gvsig.dwg.lib.objects.DwgDictionaryVar;
+import org.gvsig.dwg.lib.objects.DwgDimOrd;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+import org.gvsig.dwg.lib.objects.DwgFace3D;
+import org.gvsig.dwg.lib.objects.DwgHatch;
+import org.gvsig.dwg.lib.objects.DwgIdBuffer;
+import org.gvsig.dwg.lib.objects.DwgImage;
+import org.gvsig.dwg.lib.objects.DwgImageDef;
+import org.gvsig.dwg.lib.objects.DwgImageDefReactor;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+import org.gvsig.dwg.lib.objects.DwgLayerControl;
+import org.gvsig.dwg.lib.objects.DwgLayerIndex;
+import org.gvsig.dwg.lib.objects.DwgLine;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+import org.gvsig.dwg.lib.objects.DwgMText;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+import org.gvsig.dwg.lib.objects.DwgOle2Frame;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+import org.gvsig.dwg.lib.objects.DwgRasterVariables;
+import org.gvsig.dwg.lib.objects.DwgSeqend;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+import org.gvsig.dwg.lib.objects.DwgSortEntStable;
+import org.gvsig.dwg.lib.objects.DwgSpatialFilter;
+import org.gvsig.dwg.lib.objects.DwgSpatialIndex;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+import org.gvsig.dwg.lib.objects.DwgVertexMesh;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+import org.gvsig.dwg.lib.objects.DwgXRecord;
+
+
+/**
+ * Factory that creates dwg entities from its code (int value).
+ * 
+ * Some DWG entities dont have a fixed "type code". Instead, their type
+ * is specified in the CLASSES section of the dwg file.
+ * 
+ * 
+ * 
+ * It's a singleton
+ *  
+ */
+public class DwgObjectFactory {
+
+	private static DwgObjectFactory _instance = new DwgObjectFactory();
+
+	private DwgObjectFactory() {
+	}
+	
+	/*
+	 * Constants to represent polyline2d, polyline3d,
+	 * vertex2d and vertex3d.
+	 * */
+//	public static final byte POLYLINE2D = 40;
+//	public static final byte POLYLINE3D = 41;
+//	public static final byte VERTEX2D = 50;
+//	public static final byte VERTEX3D = 51;
+
+	public static final DwgObjectFactory getInstance() {
+		return _instance;
+	}
+
+	
+	/**
+	 * Creates a Dwg object instance from its type.
+	 * 
+	 * This method is used for DWG 13, 14, 2000 and 2004 files.
+	 * 
+	 * */
+	public DwgObject create(int type, int index) {
+		DwgObject obj = null;
+
+		 if (type == 0x1) {
+			obj = new DwgText(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x2) {
+			obj = new DwgAttrib(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x3) {
+			obj = new DwgAttdef(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x4) {
+			obj = new DwgBlock(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x5) {
+			obj = new DwgEndblk(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x6) {
+			obj = new DwgSeqend(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x7) {
+			obj = new DwgInsert(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0A) {
+			obj = new DwgVertex2D(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0B) {
+			obj = new DwgVertex3D(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0C) {
+			obj = new DwgVertexMesh(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0D) {
+			obj = new DwgVertexPFace(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0E) {
+			obj = new DwgVertexPFaceFace(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x0F) {
+			obj = new DwgPolyline2D(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x10) {
+			obj = new DwgPolyline3D(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x11) {
+			obj = new DwgArc(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x12) {
+			obj = new DwgCircle(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x13) {
+			obj = new DwgLine(index);
+			obj.setGraphicsFlag(true);
+		}  else if (type == 0x1B) {
+			obj = new DwgPoint(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x1D) {
+			obj = new DwgPFacePolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x1E) {
+			obj = new DwgMeshPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x23) {
+			obj = new DwgEllipse(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x24) {
+			obj = new DwgSpline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x2A) {
+			obj = new DwgDictionary(index);
+			obj.setGraphicsFlag(false);
+		} else if (type == 0x2C) {
+			obj = new DwgMText(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x30) {
+			obj = new DwgBlockControl(index);
+			obj.setGraphicsFlag(false);
+		} else if (type == 0x31) {
+			obj = new DwgBlockHeader(index);
+			obj.setGraphicsFlag(false);
+		} else if (type == 0x32) {
+			obj = new DwgLayerControl(index);
+			obj.setGraphicsFlag(false);
+		} else if (type == 0x33) {
+			obj = new DwgLayer(index);
+			obj.setGraphicsFlag(false);
+		} else if (type == 0x4D) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x1F) {
+			obj = new DwgSolid(index);
+			obj.setGraphicsFlag(true);
+		} 
+		
+//		else if (type == 0x15) {
+//			obj = new DwgLinearDimension(index);
+//			obj.setGraphicsFlag(true);
+//		} 
+		/*
+		 * Segun los foros de OpenDWG:
+		 * OLE2FRAME - 74 -> 0X4A
+		   LWPOLYLINE - 77 -> 0X4D 
+		   HATCH - 78 -> 0X4E
+		 * 
+		 * 
+		 * */
+		
+		
+		/*
+		else if (type == 0x4A){
+			obj = new DwgOle2Frame(index);
+			obj.setGraphicsFlag(false);
+		}
+		
+		
+		else if (type == 0x4E){
+			obj = new DwgHatch(index);
+			obj.setGraphicsFlag(true);
+		}
+		
+		else if (type == 0x4E) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x4F) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x50) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x51) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x52) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} else if (type == 0x53) {
+			obj = new DwgLwPolyline(index);
+			obj.setGraphicsFlag(true);
+		} 
+		*/
+		
+		else {
+//			obj = new DwgObject(index);
+			return null;
+		}
+		obj.setType(type);
+		return obj;
+	}
+
+	/**
+	 * Creates a DwgObject from its DXF name.
+	 * 
+	 * This method is used to create entities without a fixed dwg code type
+	 * (entities whose type is > 500)
+	 * 
+	 * This method is used for DWG 13, 14 and 2000 files.
+	 *  
+	 */
+	public DwgObject create(String dxfName, int index) {
+		//TODO De todas estas ver cuales son graficas,
+		//para poner su graphicsFlag a true
+		//ESTO MEJOR VA A SER CADA CLASE QUIEN LO HAGA, EN VEZ
+		//DE LA FACTORIA
+		
+//		if (dxfName.equalsIgnoreCase("DICTIONARYVAR"))
+//			return new DwgDictionaryVar(index);
+//		else if (dxfName.equalsIgnoreCase("HATCH"))
+//			return new DwgHatch(index);
+//		else if (dxfName.equalsIgnoreCase("IDBUFFER"))
+//			return new DwgIdBuffer(index);
+//		else if (dxfName.equalsIgnoreCase("IMAGE"))
+//			return new DwgImage(index);
+//		else if (dxfName.equalsIgnoreCase("IMAGEDEF"))
+//			return new DwgImageDef(index);
+//		else if (dxfName.equalsIgnoreCase("IMAGEDEFREACTOR"))
+//			return new DwgImageDefReactor(index);
+//		else if (dxfName.equalsIgnoreCase("LAYER_INDEX"))
+//			return new DwgLayerIndex(index);
+//		else 
+		if (dxfName.equalsIgnoreCase("LWPOLYLINE")){
+			DwgLwPolyline solution = new DwgLwPolyline(index);
+			solution.setGraphicsFlag(true);
+			return solution;
+		}
+//		else if (dxfName.equalsIgnoreCase("OLE2FRAME"))
+//			return new DwgOle2Frame(index);
+//		else if (dxfName.equalsIgnoreCase("RASTERVARIABLES"))
+//			return new DwgRasterVariables(index);
+//		else if (dxfName.equalsIgnoreCase("SORTENTSTABLE"))
+//			return new DwgSortEntStable(index);
+//		else if (dxfName.equalsIgnoreCase("SPATIALFILTER"))
+//			return new DwgSpatialFilter(index);
+//		else if (dxfName.equalsIgnoreCase("SPATIALINDEX"))
+//			return new DwgSpatialIndex(index);
+//		else if (dxfName.equalsIgnoreCase("XRECORD"))
+//			return new DwgXRecord(index);
+		return null;
+	}
+	
+	/**
+	 * Creates a DWG object for DWG 12 files.
+	 *  
+	 * */
+	public DwgObject create(byte kind, int index){
+		switch(kind){
+		case 1:
+			return new DwgLine(index);
+		case 2:
+			return new DwgPoint(index);
+		case 3:
+			return new DwgCircle(index);
+//		case 4://un dxf shape es un fichero externo que define una forma
+			//(un tipo rudimentario de svg)
+//			return new DwgShape()
+		case 7:
+			return new DwgText(index);
+		case 8:
+			return new DwgArc(index);
+//		case 9: //It is a 3D quad
+//			return new DwgTrace(index);
+			
+		case 11:
+			return new DwgSolid(index);
+		case 12:
+			return new DwgBlockHeader(index);
+		case 13:
+			return new DwgEndblk(index);
+		case 14:
+			return new DwgInsert(index);
+		case 15:
+			return new DwgAttdef(index);
+		case 16:
+			return new DwgAttrib(index);	
+		case 17://no estoy seguro de q esto sea SbEnd
+			return new DwgSeqend(index);
+		case 19://polyline is a particular case. Creation responsability is of Reader
+			return null;
+		case 20://vertex like polyline
+			return null;
+		case 22:
+			return new DwgFace3D(index);
+		case 23: //esto es Dim ??
+			return new DwgDimOrd(index);
+//		case 25://no implementado
+//			return new DwgVPort(index);
+			default:
+				return null;
+		}
+	}
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLinearDimensionReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLinearDimensionReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLinearDimensionReader15.java	(revision 435)
@@ -0,0 +1,156 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLinearDimension;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLinearDimensionReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLinearDimension))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgLinearDimension");
+		DwgLinearDimension dim = (DwgLinearDimension) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		dim.setExtrusion(new double[]{x, y, z});
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		dim.setTextMidpoint(new Point2D.Double(x, y));
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		dim.setElevation(val);
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		dim.setFlags(flags);
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		dim.setText(text);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setRotation(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setHorizDir(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setInsScale(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setInsRotation(val);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ap = ((Integer)v.get(1)).intValue();
+		dim.setAttachmentPoint(ap);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int lss = ((Integer)v.get(1)).intValue();
+		dim.setLinespaceStyle(lss);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setLinespaceFactor(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setActualMeasurement(val);
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setPt12(new Point2D.Double(x, y));
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt10(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt13(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt14(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setExtRotation(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setDimensionRotation(val);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dim);
+		
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		dim.setDimstyleHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		dim.setAnonBlockHandle(hr);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttribReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttribReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttribReader15.java	(revision 435)
@@ -0,0 +1,161 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.gvsig.dwg.lib.readers.IDwgObjectReader;
+
+
+/**
+ * @author alzabord
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttribReader15 extends AbstractDwg15Reader {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+
+		if (!(dwgObj instanceof DwgAttrib))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgAttrib");
+		DwgAttrib att = (DwgAttrib) dwgObj;
+
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, att);
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int dflag = ((Integer) v.get(1)).intValue();
+		att.setDataFlag(dflag);
+		if ((dflag & 0x1) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double elev = ((Double) v.get(1)).doubleValue();
+			att.setElevation(elev);
+		}
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double x1 = ((Double) v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double y1 = ((Double) v.get(1)).doubleValue();
+		att.setInsertionPoint(new Point2D.Double(x1, y1));
+		double x = 0, y = 0, z = 0;
+		if ((dflag & 0x2) == 0) {
+			v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+			bitPos = ((Integer) v.get(0)).intValue();
+			x = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+			bitPos = ((Integer) v.get(0)).intValue();
+			y = ((Double) v.get(1)).doubleValue();
+		}
+		att.setAlignmentPoint(new Point2D.Double(x, y));
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		boolean flag = ((Boolean) v.get(1)).booleanValue();
+		if (flag) {
+			y = 0.0;
+			x = y;
+			z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			x = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			y = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			z = ((Double) v.get(1)).doubleValue();
+		}
+		att.setExtrusion(new double[] { x, y, z });
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		flag = ((Boolean) v.get(1)).booleanValue();
+		double th;
+		if (flag) {
+			th = 0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			th = ((Double) v.get(1)).doubleValue();
+		}
+		att.setThickness(th);
+		if ((dflag & 0x4) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double oblique = ((Double) v.get(1)).doubleValue();
+			att.setObliqueAngle(oblique);
+		}
+		if ((dflag & 0x8) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double rot = ((Double) v.get(1)).doubleValue();
+			att.setRotationAngle(rot);
+		}
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double height = ((Double) v.get(1)).doubleValue();
+		att.setHeight(height);
+		if ((dflag & 0x10) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double width = ((Double) v.get(1)).doubleValue();
+			att.setWidthFactor(width);
+		}
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		String text = (String) v.get(1);
+		att.setText(text);
+		if ((dflag & 0x20) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int gen = ((Integer) v.get(1)).intValue();
+			att.setGeneration(gen);
+		}
+		if ((dflag & 0x40) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int halign = ((Integer) v.get(1)).intValue();
+			att.setHalign(halign);
+		}
+		if ((dflag & 0x80) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int valign = ((Integer) v.get(1)).intValue();
+			att.setValign(valign);
+		}
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		String tag = (String) v.get(1);
+		att.setTag(tag);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int fl = ((Integer) v.get(1)).intValue();
+		att.setFieldLength(fl);
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int flags = ((Integer) v.get(1)).intValue();
+		att.setFlags(flags);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, att);
+		DwgHandleReference styleHandle = new DwgHandleReference();
+		bitPos = styleHandle.read(data, bitPos);
+		att.setStyleHandle(styleHandle);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPointReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPointReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPointReader15.java	(revision 435)
@@ -0,0 +1,80 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPointReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPoint))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgPoint");
+		DwgPoint pt = (DwgPoint) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, pt);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		pt.setPoint(coord);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		pt.setThickness(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		pt.setExtrusion(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		pt.setXAxisAngle(val);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, pt);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockReader15.java	(revision 435)
@@ -0,0 +1,41 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+
+
+/**
+ * @author alzabord
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgBlockReader15 extends AbstractDwg15Reader{
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException{
+			if(! (dwgObj instanceof DwgBlock))
+				throw new RuntimeException("DwgBlockReader15 solo puede leer DwgBlock");
+			DwgBlock blk = (DwgBlock) dwgObj;
+			int bitPos = offset;
+			bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+			ArrayList v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String text = (String)v.get(1);
+			blk.setName(text);
+			bitPos = headTailReader.readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSplineReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSplineReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSplineReader15.java	(revision 435)
@@ -0,0 +1,167 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSplineReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSpline))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgSpline");
+		DwgSpline spline = (DwgSpline) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, spline);
+		ArrayList v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int sc = ((Integer)v.get(1)).intValue();
+		spline.setScenario(sc);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int deg = ((Integer)v.get(1)).intValue();
+		spline.setDegree(deg);
+		int knotsNumber = 0;
+		int controlPointsNumber = 0;
+		int fitPointsNumber = 0;
+		boolean weight = false;
+		if (sc==2) {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ft = ((Double)v.get(1)).doubleValue();
+			spline.setFitTolerance(ft);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z = ((Double)v.get(1)).doubleValue();
+			double[] coord = new double[]{x, y, z};
+			spline.setBeginTanVector(coord);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+			coord = new double[]{x, y, z};
+			spline.setEndTanVector(coord);
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			fitPointsNumber = ((Integer)v.get(1)).intValue();
+		} else if (sc==1) {
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean rat = ((Boolean)v.get(1)).booleanValue();
+			spline.setRational(rat);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean closed = ((Boolean)v.get(1)).booleanValue();
+			spline.setClosed(closed);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean per = ((Boolean)v.get(1)).booleanValue();
+			spline.setPeriodic(per);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ktol = ((Double)v.get(1)).doubleValue();
+			spline.setKnotTolerance(ktol);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ctol = ((Double)v.get(1)).doubleValue();
+			spline.setControlTolerance(ctol);
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			knotsNumber = ((Integer)v.get(1)).intValue();
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			controlPointsNumber = ((Integer)v.get(1)).intValue();
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			weight = ((Boolean)v.get(1)).booleanValue();
+		} else {
+			System.out.println("ERROR: Escenario desconocido");
+		}
+		if (knotsNumber>0) {
+			double[] knotpts = new double[knotsNumber];
+			for (int i=0;i<knotsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				knotpts[i] = ((Double)v.get(1)).doubleValue();
+			}
+			spline.setKnotPoints(knotpts);
+		}
+		if (controlPointsNumber>0) {
+			// Si el n?mero de weights no coincide con el de ctrlpts habr? problemas ...
+			double[][] ctrlpts = new double[controlPointsNumber][3];
+			double[] weights = new double[controlPointsNumber];
+			for (int i=0;i<controlPointsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double z = ((Double)v.get(1)).doubleValue();
+				//double[] coord = new double[]{x, y, z};
+				ctrlpts[i][0] = x;
+				ctrlpts[i][1] = y;
+				ctrlpts[i][2] = z;
+				if (weight) {
+					v = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer)v.get(0)).intValue();
+					weights[i] = ((Double)v.get(1)).doubleValue();
+				}
+			}
+			spline.setControlPoints(ctrlpts);
+			if (weight) {
+				spline.setWeights(weights);
+			}
+		}
+		if (fitPointsNumber>0) {
+			double[][] fitpts = new double[fitPointsNumber][3];
+			for (int i=0;i<fitPointsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double z = ((Double)v.get(1)).doubleValue();
+				fitpts[i][0] = x;
+				fitpts[i][1] = y;
+				fitpts[i][2] = z;
+			}
+			spline.setFitPoints(fitpts);
+		}
+		bitPos = headTailReader.readObjectTailer(data, bitPos, spline);
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMeshReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMeshReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMeshReader15.java	(revision 435)
@@ -0,0 +1,123 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMeshReader15.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+
+
+public class DwgMeshReader15 extends AbstractDwg15Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMeshPolyline))
+	    	throw new RuntimeException("ArcReader 15 solo puede leer DwgMeshPolyline");
+		DwgMeshPolyline m = (DwgMeshPolyline) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, m);
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		m.setFlags(flags);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int curveType = ((Integer) val.get(1)).intValue();
+		m.setCurveType(curveType);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mVerticies = ((Integer) val.get(1)).intValue();
+		m.setMVerticies(mVerticies);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nVerticies = ((Integer) val.get(1)).intValue();
+		m.setNVerticies(nVerticies);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mDensity = ((Integer) val.get(1)).intValue();
+		m.setMDensity(mDensity);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nDensity = ((Integer) val.get(1)).intValue();
+		m.setNDensity(nDensity);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, m);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setFirstVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setLastVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLwPolylineReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLwPolylineReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLwPolylineReader15.java	(revision 435)
@@ -0,0 +1,237 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+
+
+/**
+ * @author alzabord
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLwPolylineReader15 extends AbstractDwg15Reader {
+
+	/*
+	 *TODO El metodo original de J.Morell daba excepciones (que eran
+	 *ocultadas con un catch(Exception){}...BUF!
+	 *
+	 * Este metodo trata de copiar literalmente el de Python, para ver
+	 * si somos capaces de resolver el bug.
+	 * 
+	 * */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		
+			if (!(dwgObj instanceof DwgLwPolyline))
+				throw new RuntimeException(
+						"ArcReader 15 solo puede leer DwgLwPolyLine");
+			DwgLwPolyline line = (DwgLwPolyline) dwgObj;
+			List val = null;
+			int bitPos = offset;
+			bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+			val = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int flag = ((Integer) val.get(1)).intValue();
+			line.setFlag(flag);
+			
+			/*
+			 * Flag son 4 bits que indican si la lwpline tiene ancho,
+			 * (3er bit), elevacion (4o bit), grosor (2� bit) y vector
+			 * de extrusion (1er bit).
+			 * 5� bit -> n� de bulges
+			 * 60 bit -> n� de widths
+			 * 
+			 * ahora se verifican y se van leyendo
+			 * */
+			
+			
+			double constWidth = 0d;
+		    if( (flag & 0x4) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				constWidth = ((Double) val.get(1)).doubleValue();
+		    }//if
+		    line.setConstWidth(constWidth);
+		    
+		    double elev = 0d;
+		    if ( (flag & 0x8) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	elev = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setElevation(elev);
+		    
+		    double thickness = 0d;
+		    if ( (flag & 0x2) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	thickness = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setThickness(thickness);
+		    
+		    double nx = 0d; 
+		    double ny = 0d;
+		    double nz = 0d;
+		    if( (flag & 0x1) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	nx = ((Double) val.get(1)).doubleValue();
+		    	
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	ny = ((Double) val.get(1)).doubleValue();
+		    	
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	nz = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setNormal(new double[]{nx, ny, nz});
+		  
+		    val = DwgUtil.getBitLong(data, bitPos);
+		    bitPos = ((Integer) val.get(0)).intValue();
+		    int numberOfPoints = ((Integer) val.get(1)).intValue();
+		    
+		    int numberOfBulges = 0;
+		    if ((flag & 0x10) > 0){
+		    	val = DwgUtil.getBitLong(data, bitPos);
+		 	    bitPos = ((Integer) val.get(0)).intValue();
+		 	    numberOfBulges = ((Integer) val.get(1)).intValue();
+		    }
+		    
+		    int numberOfWidths = 0;
+		    if ((flag & 0x20) > 0){
+		    	val = DwgUtil.getBitLong(data, bitPos);
+		 	    bitPos = ((Integer) val.get(0)).intValue();
+		 	    numberOfWidths = ((Integer) val.get(1)).intValue();
+		    }
+		    
+		    if(numberOfPoints > 0){
+		    	//Esto es una chapuza, pero las LwPolylines no se est�n
+		    	//leyendo bien y en ocasiones nos llegan entidades
+		    	//con MILLONES de puntos (OutOfMemoryException)
+		    	//Plantear en la lista de PythonCAD
+		    	if(numberOfPoints > 10000)
+		    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
+		    	List vertices = new ArrayList();
+		  	    val = DwgUtil.getRawDouble(data, bitPos);
+		  	    bitPos = ((Integer) val.get(0)).intValue();
+		  		double x0 = ((Double) val.get(1)).doubleValue();
+		  		
+		  		val = DwgUtil.getRawDouble(data, bitPos);
+		  		bitPos = ((Integer) val.get(0)).intValue();
+		  		double y0 = ((Double) val.get(1)).doubleValue();
+		  		
+		  		vertices.add(new double[]{x0, y0});
+		  		
+		  		
+		  		/*
+		  		 * TODO azabala 
+		  		 * Algunos metodos de DwgUtil lanzan excepciones inexperadas
+		  		 * cuando trabajan para rellenar clases de LwPolyline:
+		  		 * ->getDefaultDouble
+		  		 * ->getBits
+		  		 * etc
+		  		 * 
+		  		 * Estas excepciones son del tipo OutOfBounds (se intenta leer un bit
+		  		 * cuyo orden excede de la capacidad del array)
+		  		 * La especificaci�n 15 de DWG es seguida al pie de la letra por Pythoncad,
+		  		 * (y por nosotros) as� que puede ser que el problema est� en los metodos
+		  		 * de DwgUtil.
+		  		 * 
+		  		 * Intentar capturar la excepcion para que no se pierdan las entidades que las
+		  		 * provocan, y luego solucionar el error
+		  		 * 
+		  		 * 
+		  		 * */
+		  		for (int i = 1; i < numberOfPoints; i++) {
+		  			val = DwgUtil.getDefaultDouble(data, bitPos, x0);
+		  			bitPos = ((Integer) val.get(0)).intValue();
+		  			double x = ((Double) val.get(1)).doubleValue();
+		  			
+		  			val = DwgUtil.getDefaultDouble(data, bitPos, y0);
+		  			bitPos = ((Integer) val.get(0)).intValue();
+		  			double y = ((Double) val.get(1)).doubleValue();
+		  			
+		  			vertices.add(new double[]{x, y});
+		  			
+		  			x0 = x;//se proporcionan como valores por defecto las coordenadas del pto anterior
+		  			y0 = y;
+		  		}
+		  		line.setVertices(vertices);
+		    }else{
+		    	System.out.println("vertices == 0: lanzamos una excepcion??");
+		    }
+		    
+		  
+			
+			if(numberOfBulges > 0){
+				if (numberOfBulges != numberOfPoints){
+			    	System.out.println("bulges != vertices: lanzamos una excepcion??");
+			    }
+				double[] bulges = new double[numberOfBulges];
+				for(int i = 0; i < numberOfBulges; i++){
+					//TODO OJOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+					//En PythonCAD se hacia getRawDouble, pero en la especificacion
+					//(pagina 136) dice que es BitDouble (BD) 
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					bulges[i] = ((Double) val.get(1)).doubleValue();
+				}
+				line.setBulges(bulges);
+			}else{
+				double[] bulges = new double[numberOfPoints];
+				for(int i = 0; i < numberOfPoints; i++)
+					bulges[i] = 0d;
+				line.setBulges(bulges);
+			}
+			
+			if(numberOfWidths > 0){
+			    if (numberOfWidths != numberOfPoints){
+			    	System.out.println("widths != vertices: lanzamos una excepcion??");
+			    }
+				double[][] widths = new double[numberOfWidths][2];
+				for (int i = 0; i < numberOfWidths; i++) {
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					double sw = ((Double) val.get(1)).doubleValue();
+					
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					double ew = ((Double) val.get(1)).doubleValue();
+					widths[i][0] = sw;
+					widths[i][1] = ew;
+				}
+				line.setWidths(widths);
+			}else{
+				line.setWidths(new double[0][0]);
+			}
+			
+			
+			
+			/*
+			 * azabala: de siempre se producen excepciones al tratar de leer
+			 * LwPolyline (si no se veian es pq se capturaban y no se sacaba
+			 * traza)
+			 * 
+			 * Se producen siempre que numVertices == 0 ????
+			 * Probar a saltarmelos.
+			 * 
+			 * 
+			 * 
+			 * TODO Ver por qu� aparecen (y lo peor, pq una vez se da una se propagan 
+			 * todas)
+			 * 
+			 * */
+				bitPos = headTailReader.readObjectTailer(data, bitPos, line);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgCircleReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgCircleReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgCircleReader15.java	(revision 435)
@@ -0,0 +1,79 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgCircleReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgCircle))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgCircle");
+		DwgCircle circle = (DwgCircle) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		circle.setCenter(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		circle.setRadius(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+	    circle.setThickness(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		circle.setExtrusion(coord);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMTextReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMTextReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgMTextReader15.java	(revision 435)
@@ -0,0 +1,111 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMText;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgMTextReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMText))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgMText");
+		DwgMText txt = (DwgMText) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, txt);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		txt.setInsertionPoint(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		txt.setExtrusion(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		txt.setXAxisDirection(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		txt.setWidth(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setHeight(val);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ival = ((Integer)v.get(1)).intValue();
+		txt.setAttachment(ival);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		ival = ((Integer)v.get(1)).intValue();
+		txt.setDrawingDir(ival);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setExtHeight(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setExtWidth(val);
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		txt.setText(text);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		ival = ((Integer)v.get(1)).intValue();
+		txt.setLineSpacingStyle(ival);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setLineSpacingFactor(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		bitPos = headTailReader.readObjectTailer(data, bitPos, txt);
+		
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+	    txt.setStyleHandle(hr);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerControlReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerControlReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerControlReader15.java	(revision 435)
@@ -0,0 +1,22 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ */
+public class DwgLayerControlReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) {
+		//TODO Si no lo leemos, mejor ni considerarlo
+		//Ver la especificaci�n de este objeto
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPFaceReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPFaceReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPFaceReader15.java	(revision 435)
@@ -0,0 +1,103 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgPFaceReader15.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+
+
+public class DwgPFaceReader15 extends AbstractDwg15Reader {
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		if(! (dwgObj instanceof DwgPFacePolyline))
+	    	throw new RuntimeException("ArcReader 15 solo puede leer DwgPFacePolyline");
+		DwgPFacePolyline pface = (DwgPFacePolyline) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, pface);
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int vertexCount = ((Integer) val.get(1)).intValue();
+		pface.setVertexCount(vertexCount);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int faceCount = ((Integer) val.get(1)).intValue();
+		pface.setFaceCount(faceCount);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, pface);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setFirstVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setLastVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSeqEndReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSeqEndReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSeqEndReader15.java	(revision 435)
@@ -0,0 +1,28 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSeqEndReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	//TODO Algunos objetos no aportan nada al head y tail
+	//ver si quitarlo (o pasar la implementacion a la clase abstracta)
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline2DReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline2DReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline2DReader15.java	(revision 435)
@@ -0,0 +1,99 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPolyline2DReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline2D))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgPolyline2D");
+		DwgPolyline2D ln = (DwgPolyline2D) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ln);
+		ArrayList v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ln.setFlags(flags);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ctype = ((Integer)v.get(1)).intValue();
+		ln.setCurveType(ctype);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double sw = ((Double)v.get(1)).doubleValue();
+		ln.setInitWidth(sw);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double ew = ((Double)v.get(1)).doubleValue();
+		ln.setEndWidth(ew);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double th = 0.0;
+	    if (!flag) {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			th = ((Double)v.get(1)).doubleValue();
+	    }
+	    ln.setThickness(th);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double elev = ((Double)v.get(1)).doubleValue();
+		ln.setElevation(elev);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+	    double ex, ey, ez = 0.0;
+	    if (flag) {
+	    	ex = 0.0;
+	    	ey = 0.0;
+	    	ez = 1.0;
+	    } else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ex = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ey = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ez = ((Double)v.get(1)).doubleValue();
+	    }
+	    ln.setExtrusion(new double[]{ex, ey, ez});
+
+	    bitPos = headTailReader.readObjectTailer(data, bitPos, ln);
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ln.setFirstVertexHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ln.setLastVertexHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+	    ln.setSeqendHandle(hr);
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline3DReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline3DReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgPolyline3DReader15.java	(revision 435)
@@ -0,0 +1,52 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgPolyline3DReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline3D))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgPolyline3D");
+		DwgPolyline3D ln = (DwgPolyline3D) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ln);
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int sflags = ((Integer)v.get(1)).intValue();
+		ln.setSplineFlags(sflags);
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int cflags = ((Integer)v.get(1)).intValue();
+		ln.setClosedFlags(cflags);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ln);
+		
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ln.setFirstVertexHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ln.setLastVertexHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+	    ln.setSeqendHandle(hr);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgTextReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgTextReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgTextReader15.java	(revision 435)
@@ -0,0 +1,140 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.util.TextToUnicodeConverter;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgTextReader15 extends AbstractDwg15Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgText))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgText");
+		DwgText txt = (DwgText) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, txt);
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int dflag = ((Integer)v.get(1)).intValue();
+		txt.setDataFlag(dflag);
+		if ((dflag & 0x1)==0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double elev = ((Double)v.get(1)).doubleValue();
+			txt.setElevation(elev);
+		}
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y1 = ((Double)v.get(1)).doubleValue();
+		txt.setInsertionPoint(new Point2D.Double(x1, y1));
+		if ((dflag & 0x2)==0) {
+			v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double xa = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ya = ((Double)v.get(1)).doubleValue();
+			txt.setAlignmentPoint(new Point2D.Double(xa, ya));
+		}
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		double x, y, z;
+		if (flag) {
+			x = 0.0;
+			y = 0.0;
+			z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		txt.setExtrusion(new double[]{x, y, z});
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+	    double th;
+		if (flag) {
+			th=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			th = ((Double)v.get(1)).doubleValue();
+		}
+		txt.setThickness(th);
+		if ((dflag & 0x4) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double oblique = ((Double)v.get(1)).doubleValue();
+			txt.setObliqueAngle(oblique);
+		}
+		if ((dflag & 0x8) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double rot = ((Double)v.get(1)).doubleValue();
+			txt.setRotationAngle(rot);
+		}
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double height = ((Double)v.get(1)).doubleValue();
+		txt.setHeight(height);
+		if ((dflag & 0x10) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double width = ((Double)v.get(1)).doubleValue();
+			txt.setWidthFactor(width);
+		}
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		text = TextToUnicodeConverter.convertText(text);
+		txt.setText(text);
+		if ((dflag & 0x20) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int gen = ((Integer)v.get(1)).intValue();
+			txt.setGeneration(gen);
+		}
+		if ((dflag & 0x40) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int halign = ((Integer)v.get(1)).intValue();
+			txt.setHalign(halign);
+		}
+		if ((dflag & 0x80) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int valign = ((Integer)v.get(1)).intValue();
+			txt.setValign(valign);
+		}
+		bitPos = headTailReader.readObjectTailer(data, bitPos, txt);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLineReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLineReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLineReader15.java	(revision 435)
@@ -0,0 +1,99 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLine;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLineReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLine))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgLine");
+		DwgLine line = (DwgLine) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, line);
+		ArrayList v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		line.setZflag(((Boolean)v.get(1)).booleanValue());
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x2 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y2 = ((Double)v.get(1)).doubleValue();
+		double[] p1;
+		double[] p2;
+	    if (!line.isZflag()) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z1 = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, z1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z2 = ((Double)v.get(1)).doubleValue();
+			p1 = new double[]{x1, y1, z1};
+			p2 = new double[]{x2, y2, z2};
+		} else {
+			p1 = new double[]{x1, y1, 0d};
+			p2 = new double[]{x2, y2, 0d};
+		}
+	    line.setP1(p1);
+	    line.setP2(p2);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		line.setThickness(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		double x, y, z;
+	    if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		double[] coord = new double[]{x, y, z};
+		line.setExtrusion(coord);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, line);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexMeshReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexMeshReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexMeshReader15.java	(revision 435)
@@ -0,0 +1,100 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexMeshReader15.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexMesh;
+
+
+public class DwgVertexMeshReader15 extends AbstractDwg15Reader {
+	
+    //similar to DwgVertex3D (and all derived vertices...
+	//apply inheritance
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertexMesh))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgVertexMesh");
+		 DwgVertexMesh v = (DwgVertexMesh) dwgObj;
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flag = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flag);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockControlReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockControlReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockControlReader15.java	(revision 435)
@@ -0,0 +1,66 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+
+
+/**
+ * @author azabala
+ */
+public class DwgBlockControlReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException{
+		
+		 if(! (dwgObj instanceof DwgBlockControl))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgBlockControl");
+		    DwgBlockControl blk = (DwgBlockControl) dwgObj;
+			int bitPos = offset;
+			ArrayList v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numReactors = ((Integer)v.get(1)).intValue();
+			blk.setNumReactors(numReactors);
+			
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int enumeration = ((Integer)v.get(1)).intValue();
+			
+			DwgHandleReference hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setNullHandle(hr);
+			
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setXDicObjHandle(hr);
+		    
+			if (enumeration>0) {
+				Vector handles = new Vector();
+				for (int i=0;i<enumeration;i++) {
+					hr = new DwgHandleReference();
+					bitPos = hr.read(data, bitPos);
+					handles.add(hr);
+				}
+				blk.setCode2Handles(handles);
+			}
+			
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setModelSpaceHandle(hr);
+
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setPaperSpaceHandle(hr);
+		}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceFaceReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceFaceReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceFaceReader15.java	(revision 435)
@@ -0,0 +1,101 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceFaceReader15.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+
+
+public class DwgVertexPFaceFaceReader15 extends AbstractDwg15Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgVertexPFaceFace))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgVertexPFaceFace");
+		 DwgVertexPFaceFace v = (DwgVertexPFaceFace) dwgObj;
+		 
+		 int bitPos = offset;
+		 
+		 bitPos = headTailReader.readObjectHeader(data, offset, v);
+		 
+		 List val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v1 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v2 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v3 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v4 = ((Integer) val.get(1)).intValue();
+		 
+		 v.setVerticesidx(new int[]{v1, v2, v3, v4});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEllipseReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEllipseReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEllipseReader15.java	(revision 435)
@@ -0,0 +1,79 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgEllipseReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEllipse))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgEllipse");
+		DwgEllipse ell = (DwgEllipse) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ell);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ell.setCenter(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ell.setSemiMajorAxisVector(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ell.setExtrusion(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		ell.setAxisRatio(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		ell.setInitAngle(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		ell.setEndAngle(val);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ell);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEndBlkReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEndBlkReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgEndBlkReader15.java	(revision 435)
@@ -0,0 +1,31 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgEndBlkReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEndblk))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgEndBlk");
+		DwgEndblk end = (DwgEndblk) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, end);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, end);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockHeaderReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockHeaderReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgBlockHeaderReader15.java	(revision 435)
@@ -0,0 +1,176 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgBlockHeaderReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgBlockHeader))
+		    	throw new RuntimeException("DwgBlockHeaderReader15 solo puede leer DwgBlockControl");
+		DwgBlockHeader hdr = (DwgBlockHeader) dwgObj;
+		int bitPos = offset;
+		ArrayList v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int numReactors = ((Integer)v.get(1)).intValue();
+		hdr.setNumReactors(numReactors);
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String name = (String)v.get(1);
+		hdr.setName(name);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		hdr.setFlag64(flag);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int xrefplus1 = ((Integer)v.get(1)).intValue();
+		hdr.setXRefPlus(xrefplus1);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xdep = ((Boolean)v.get(1)).booleanValue();
+		hdr.setXdep(xdep);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean anon = ((Boolean)v.get(1)).booleanValue();
+		hdr.setAnonymous(anon);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean hasatts = ((Boolean)v.get(1)).booleanValue();
+		hdr.setHasAttrs(hasatts);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean bxref = ((Boolean)v.get(1)).booleanValue();
+		hdr.setBlkIsXRef(bxref);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xover = ((Boolean)v.get(1)).booleanValue();
+		hdr.setXRefOverLaid(xover);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean loaded = ((Boolean)v.get(1)).booleanValue();
+		hdr.setLoaded(loaded);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bx = ((Double)v.get(1)).doubleValue();
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double by = ((Double)v.get(1)).doubleValue();
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bz = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{bx, by, bz};
+		hdr.setBasePoint(coord);
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String pname = (String)v.get(1);
+		hdr.setXRefPName(pname);
+		int icount = 0;
+		while (true) {
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int val = ((Integer)v.get(1)).intValue();
+			if (val==0) {
+				break;
+			}
+			icount++;
+		}
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String desc = (String)v.get(1);
+		hdr.setBlockDescription(desc);
+		v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int pdsize = ((Integer)v.get(1)).intValue();
+		if (pdsize>0) {
+			int count = pdsize + icount;
+			//int pdata = ((Integer)DwgUtil.getBits(data, count, bitPos)).intValue();
+			//previewData = pdata;
+			bitPos = bitPos + count;
+		}
+
+		DwgHandleReference blkCtrlHdl = new DwgHandleReference();
+		bitPos = blkCtrlHdl.read(data, bitPos);
+		hdr.setBlockControlHandle(blkCtrlHdl);
+
+		for (int i=0;i<numReactors;i++) {
+			DwgHandleReference reactor = new DwgHandleReference();
+			bitPos = reactor.read(data, bitPos);
+
+		}
+
+		DwgHandleReference xdicObjHdl = new DwgHandleReference();
+		bitPos = xdicObjHdl.read(data, bitPos);
+		hdr.setXDicObjHandle(xdicObjHdl);
+
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setNullHandle(handle);
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setBlockEntityHandle(handle);
+
+		if ((!bxref) && (!xover)) {
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			hdr.setFirstEntityHandle(handle);
+
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			hdr.setLastEntityHandle(handle);
+		}//si el bloque es una referencia externa, es un fichero entero
+		//(no ninguna entidad del fichero actual)
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setEndBlkEntityHandle(handle);
+
+		if(icount > 0){
+			DwgHandleReference[] insertHandles = new
+				DwgHandleReference[icount];
+			for(int i = 0; i < icount; i++){
+				insertHandles[i] = new DwgHandleReference();
+				bitPos = insertHandles[i].read(data, bitPos);
+			}
+			hdr.setInsertHandles(insertHandles);
+		}
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setLayoutHandle(handle);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex2DReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex2DReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex2DReader15.java	(revision 435)
@@ -0,0 +1,70 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgVertex2DReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex2D))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgVertex2D");
+		 DwgVertex2D ver = (DwgVertex2D) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ver);
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ver.setFlags(flags);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		ver.setPoint(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double sw = ((Double)v.get(1)).doubleValue();
+		double ew = 0.0;
+		if (sw<0.0) {
+			ew = Math.abs(sw);
+			sw = ew;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ew = ((Double)v.get(1)).doubleValue();
+		}
+		ver.setInitWidth(sw);
+		ver.setEndWidth(ew);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bulge = ((Double)v.get(1)).doubleValue();
+		ver.setBulge(bulge);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double tandir = ((Double)v.get(1)).doubleValue();
+		ver.setTangentDir(tandir);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ver);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/AbstractDwg15Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/AbstractDwg15Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/AbstractDwg15Reader.java	(revision 435)
@@ -0,0 +1,72 @@
+/*
+ * Created on 25-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: AbstractDwg15Reader.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/01/25 20:05:58  azabala
+* start of implementation of specific versions' object readers
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import org.gvsig.dwg.lib.readers.DwgFileV15Reader;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.gvsig.dwg.lib.readers.IDwgObjectReader;
+
+public abstract class AbstractDwg15Reader implements IDwgObjectReader{
+	protected IDwgFileReader headTailReader;
+	public void setFileReader(IDwgFileReader headTailReader) {
+		if( ! (headTailReader instanceof DwgFileV15Reader))
+			throw new RuntimeException("Tratando de leer entidad de DWG 15 (2000) con"+
+					headTailReader.getClass().getName());
+		this.headTailReader = headTailReader;
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex3DReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex3DReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertex3DReader15.java	(revision 435)
@@ -0,0 +1,49 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgVertex3DReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex3D))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgVertex3D");
+		 DwgVertex3D ver = (DwgVertex3D) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ver);
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ver.setFlags(flags);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ver.setPoint(coord);
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ver);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgInsertReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgInsertReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgInsertReader15.java	(revision 435)
@@ -0,0 +1,119 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgInsertReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgInsert))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgInsert");
+		DwgInsert ins = (DwgInsert) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ins);
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ins.setInsertionPoint(coord);
+		int dflag = ((Integer)DwgUtil.getBits(data, 2, bitPos)).intValue();
+		bitPos = bitPos + 2;
+		if (dflag==0x0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		} else if (dflag==0x1) {
+			x = 1.0;
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		} else if (dflag==0x2) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			z = x;
+			y = z;
+		} else {
+			z = 1.0;
+			y = z;
+			x = y;
+		}
+		coord = new double[]{x, y, z};
+		ins.setScale(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double rot = ((Double)v.get(1)).doubleValue();
+		ins.setRotation(rot);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ins.setExtrusion(coord);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean hasattr = ((Boolean)v.get(1)).booleanValue();
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ins);
+		
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ins.setBlockHeaderHandle(hr);
+		
+		if (hasattr) {
+			
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			ins.setFirstAttribHandle(hr);
+			
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			ins.setLastAttribHandle(hr);
+			
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			ins.setSeqendHandle(hr);
+		}
+	}
+
+	
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgArcReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgArcReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgArcReader15.java	(revision 435)
@@ -0,0 +1,90 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgArcReader15 extends AbstractDwg15Reader{
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		    if(! (dwgObj instanceof DwgArc))
+		    	throw new RuntimeException("ArcReader 15 solo puede leer DwgArc");
+		    DwgArc arc = (DwgArc) dwgObj;
+		    
+			int bitPos = offset;
+			bitPos = headTailReader.readObjectHeader(data, bitPos, arc);
+			ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z = ((Double)v.get(1)).doubleValue();
+			double[] coord = new double[]{x, y, z};
+			arc.setCenter(coord);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double val = ((Double)v.get(1)).doubleValue();
+			arc.setRadius(val);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				val=0.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				val = ((Double)v.get(1)).doubleValue();
+			}
+			arc.setThickness(val);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				 x = y = 0.0;
+				 z = 1.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				z = ((Double)v.get(1)).doubleValue();
+			}
+			coord = new double[]{x, y, z};
+			arc.setExtrusion(coord);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+			arc.setInitAngle(val);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+			arc.setEndAngle(val);
+			bitPos = this.headTailReader.readObjectTailer(data, bitPos, arc);
+		}
+	
+
+	
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgDictionaryReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgDictionaryReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgDictionaryReader15.java	(revision 435)
@@ -0,0 +1,67 @@
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgDictionary;
+
+
+public class DwgDictionaryReader15 extends AbstractDwg15Reader{
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) {
+		// TODO Auto-generated method stub
+		if(! (dwgObj instanceof DwgDictionary))
+			throw new RuntimeException("DictionaryReader15 solo puede leer DwgDictionary");
+		DwgDictionary dict = (DwgDictionary) dwgObj;
+		try {
+			//System.out.println("LEYENDO UN DICCIONARIO");
+			int bitPos = offset;
+			ArrayList v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numReactors = ((Integer)v.get(1)).intValue();
+			dict.setNumReactors(numReactors);
+			//System.out.println("numReactors="+numReactors);
+			
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numItems = ((Integer)v.get(1)).intValue();
+			//System.out.println("numItems="+numItems);
+			
+			
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int cloningFlag = ((Integer)v.get(1)).intValue();
+			dict.setCloningFlag(cloningFlag);
+			//System.out.println("cloningFlag="+cloningFlag);
+			
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int hardOwnerFlag = ((Integer)v.get(1)).intValue();
+			dict.setHardOwnerFlag(hardOwnerFlag);
+			//System.out.println("hardOwnerFlag="+hardOwnerFlag);
+			
+			int handleCode;
+			int handleOffset;
+			ArrayList entradasTexto = new ArrayList();
+			for(int i=0; i<numItems; i++){
+				v = DwgUtil.getTextString(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				String text = ((String)v.get(1));
+				entradasTexto.add(text);
+			}
+			DwgHandleReference handle;
+			for(int i=0; i<numItems; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				//System.out.println("ENTRADA DE DICCIONARIO text= "+entradasTexto.get(i)+" handleCode ="+handle.getCode()+" handleOffset ="+handle.getOffset());
+				// A la vez que leemos los handles, rellenamos el diccionario.
+				dict.put(entradasTexto.get(i),handle);
+			}
+			//System.out.println("map.size ="+dict.size());
+		}catch (Exception e){
+			System.out.println("Se ha producido una excepion leyendo un diccionario."+e.getMessage());
+		}
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttdefReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttdefReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgAttdefReader15.java	(revision 435)
@@ -0,0 +1,157 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttdefReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+			if(!(dwgObj instanceof DwgAttdef))
+				throw new RuntimeException("AttdefReader 15 solo lee Attdef");
+			DwgAttdef att = (DwgAttdef) dwgObj;
+			int bitPos = offset;
+			bitPos = headTailReader.readObjectHeader(data, bitPos, att);
+			ArrayList v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int dflag = ((Integer)v.get(1)).intValue();
+			att.setDataFlag(dflag);
+			if ((dflag & 0x1)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double elev = ((Double)v.get(1)).doubleValue();
+				att.setElevation(elev);
+			}
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x1 = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y1 = ((Double)v.get(1)).doubleValue();
+			att.setInsertionPoint(new Point2D.Double(x1, y1));
+			double x=0, y=0, z=0;
+			if ((dflag & 0x2)==0) {
+				v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+			}
+			att.setAlignmentPoint(new Point2D.Double(x, y));
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				y = 0.0;
+				x = y;
+				z = 1.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				z = ((Double)v.get(1)).doubleValue();
+			}
+			att.setExtrusion(new double[]{x, y, z});
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			flag = ((Boolean)v.get(1)).booleanValue();
+		    double th;
+			if (flag) {
+				th=0.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				th = ((Double)v.get(1)).doubleValue();
+			}
+			att.setThickness(th);
+			if ((dflag & 0x4)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double oblique = ((Double)v.get(1)).doubleValue();
+				att.setObliqueAngle(oblique);
+			}
+			if ((dflag & 0x8)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double rot = ((Double)v.get(1)).doubleValue();
+				att.setRotationAngle(rot);
+			}
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double height = ((Double)v.get(1)).doubleValue();
+			att.setHeight(height);
+			if ((dflag & 0x10)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double width = ((Double)v.get(1)).doubleValue();
+				att.setWidthFactor(width);
+			}
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String text = (String)v.get(1);
+			att.setText(text);
+			if ((dflag & 0x20)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int gen = ((Integer)v.get(1)).intValue();
+				att.setGeneration(gen);
+			}
+			if ((dflag & 0x40)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int halign = ((Integer)v.get(1)).intValue();
+				att.setHalign(halign);
+			}
+			if ((dflag & 0x80)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int valign = ((Integer)v.get(1)).intValue();
+				att.setValign(valign);
+			}
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String tag = (String)v.get(1);
+			att.setTag(tag);
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int fl = ((Integer)v.get(1)).intValue();
+			att.setFieldLength(fl);
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int flags = ((Integer)v.get(1)).intValue();
+			att.setFlags(flags);
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String prompt = (String)v.get(1);
+			att.setPrompt(prompt);
+			bitPos = headTailReader.readObjectTailer(data, bitPos, att);
+			DwgHandleReference styleHandle = new DwgHandleReference();
+			bitPos = styleHandle.read(data, bitPos);
+			att.setStyleHandle(styleHandle);
+		}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSolidReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSolidReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgSolidReader15.java	(revision 435)
@@ -0,0 +1,111 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+
+
+/**
+ * @author azabala
+ */
+public class DwgSolidReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSolid))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgSolid");
+		DwgSolid sol = (DwgSolid) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, sol);
+		ArrayList v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		sol.setThickness(val);
+		
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		sol.setElevation(val);
+		
+		
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, val};
+		sol.setCorner1(coord);
+		
+		
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner2(coord);
+		
+		
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner3(coord);
+		
+		
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner4(coord);
+		
+		
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		double z;
+	    if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		sol.setExtrusion(coord);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, sol);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgLayerReader15.java	(revision 435)
@@ -0,0 +1,105 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLayerReader15 extends AbstractDwg15Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLayer))
+			throw new RuntimeException("LayerReader 15 solo puede leer DwgLayer");
+		//System.out.println("DwgLayer.readDwgLayerV15: offset = "+offset);
+		DwgLayer lyr = (DwgLayer) dwgObj;
+		int bitPos = offset;
+		ArrayList v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int numReactors = ((Integer)v.get(1)).intValue();
+		//System.out.println("DwgLayer.readDwgLayerV15: numReactors = "+numReactors);
+		lyr.setNumReactors(numReactors);
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String name = (String)v.get(1);
+		//System.out.println("DwgLayer.readDwgLayerV15: name = "+name);
+		lyr.setName(name);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		lyr.setFlag64(flag);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int xrefplus1 = ((Integer)v.get(1)).intValue();
+		lyr.setXRefPlus(xrefplus1);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xdep = ((Boolean)v.get(1)).booleanValue();
+		lyr.setXdep(xdep);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		lyr.setFlags(flags);
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int color = ((Integer)v.get(1)).intValue();
+		lyr.setColor(color);
+		
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		lyr.setLayerControlHandle(hr);
+		
+	    //System.out.println("DwgLayer.readDwgLayerV15: Layer Control: " + layerControlHandle);
+		
+		/*
+		 * Reactors handles
+		 * DwgObject
+		 */
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < lyr.getNumReactors(); i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			lyr.addReactorHandle(reactorHandle);
+		}
+		
+		/*
+		 * XDICOBJHANDLE
+		 */
+		DwgHandleReference xDicObjHandle = new DwgHandleReference();
+		bitPos = xDicObjHandle.read(data, bitPos);
+		lyr.setXDicObjHandle(xDicObjHandle);
+	    //System.out.println("DwgLayer.readDwgLayerV15: xdicobjhandle:" + xdicobjhandle);
+
+		DwgHandleReference nullHandle = new DwgHandleReference();
+		bitPos = nullHandle.read(data, bitPos);
+		lyr.setNullHandle(nullHandle);
+
+		DwgHandleReference plotStyleHandle = new DwgHandleReference();
+		bitPos = plotStyleHandle.read(data, bitPos);
+		lyr.setPlotStyleHandle(plotStyleHandle);
+			
+	    //System.out.println("DwgLayer.readDwgLayerV15: Plotstyle: " + plotstyleHandle);
+		DwgHandleReference lineTypeHandle = new DwgHandleReference();
+		bitPos = lineTypeHandle.read(data, bitPos);
+		lyr.setLineTypeHandle(lineTypeHandle);
+	    //System.out.println("DwgLayer.readDwgLayerV15: Linetype: " + linetypeHandle);
+	    
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceReader15.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceReader15.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v15/DwgVertexPFaceReader15.java	(revision 435)
@@ -0,0 +1,102 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceReader15.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v15;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+
+
+public class DwgVertexPFaceReader15 extends AbstractDwg15Reader {
+	//similar al reader de la versi�n 13-14
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgVertexPFace))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertexPFace");
+		 DwgVertexPFace v = (DwgVertexPFace) dwgObj;
+		
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flags = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flags);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
+
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLinearDimensionReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLinearDimensionReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLinearDimensionReader2004.java	(revision 435)
@@ -0,0 +1,176 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLinearDimension;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLinearDimensionReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLinearDimension))
+			throw new RuntimeException("DwgLinearDimensionReader2004 solo puede leer DwgLinearDimension");
+		DwgLinearDimension dim = (DwgLinearDimension) dwgObj;
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, dwgObj);
+
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		dim.setExtrusion(new double[]{x, y, z});
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		dim.setTextMidpoint(new Point2D.Double(x, y));
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		dim.setElevation(val);
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		dim.setFlags(flags);
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		dim.setText(text);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setRotation(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setHorizDir(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setInsScale(new double[]{x, y, z});
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setInsRotation(val);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ap = ((Integer)v.get(1)).intValue();
+		dim.setAttachmentPoint(ap);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int lss = ((Integer)v.get(1)).intValue();
+		dim.setLinespaceStyle(lss);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setLinespaceFactor(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setActualMeasurement(val);
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setPt12(new Point2D.Double(x, y));
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt10(new double[]{x, y, z});
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt13(new double[]{x, y, z});
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		dim.setPt14(new double[]{x, y, z});
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setExtRotation(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		dim.setDimensionRotation(val);
+
+		bitPos = readObjectTailer(data, bitPos, dim);
+
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		dim.setDimstyleHandle(hr);
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		dim.setAnonBlockHandle(hr);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttribReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttribReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttribReader2004.java	(revision 435)
@@ -0,0 +1,181 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttribReader2004 extends AbstractDwg2004Reader {
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+
+		if (!(dwgObj instanceof DwgAttrib))
+			throw new RuntimeException("ArcReader 2004 solo puede leer DwgAttrib");
+		DwgAttrib att = (DwgAttrib) dwgObj;
+
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, att);
+
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int dflag = ((Integer) v.get(1)).intValue();
+		att.setDataFlag(dflag);
+
+		if ((dflag & 0x1) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double elev = ((Double) v.get(1)).doubleValue();
+			att.setElevation(elev);
+		}
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double x1 = ((Double) v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double y1 = ((Double) v.get(1)).doubleValue();
+		att.setInsertionPoint(new Point2D.Double(x1, y1));
+
+		double x = 0, y = 0, z = 0;
+		if ((dflag & 0x2) == 0) {
+			v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+			bitPos = ((Integer) v.get(0)).intValue();
+			x = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+			bitPos = ((Integer) v.get(0)).intValue();
+			y = ((Double) v.get(1)).doubleValue();
+		}
+		att.setAlignmentPoint(new Point2D.Double(x, y));
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		boolean flag = ((Boolean) v.get(1)).booleanValue();
+		if (flag) {
+			x = 0.0;
+			y = 0.0;
+			z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			x = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			y = ((Double) v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			z = ((Double) v.get(1)).doubleValue();
+		}
+		att.setExtrusion(new double[] { x, y, z });
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		flag = ((Boolean) v.get(1)).booleanValue();
+		double th;
+		if (flag) {
+			th = 0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			th = ((Double) v.get(1)).doubleValue();
+		}
+		att.setThickness(th);
+
+		if ((dflag & 0x4) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double oblique = ((Double) v.get(1)).doubleValue();
+			att.setObliqueAngle(oblique);
+		}
+
+		if ((dflag & 0x8) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double rot = ((Double) v.get(1)).doubleValue();
+			att.setRotationAngle(rot);
+		}
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		double height = ((Double) v.get(1)).doubleValue();
+		att.setHeight(height);
+
+		System.out.println("DwgAttribReader bitPos = " + bitPos);
+
+		if ((dflag & 0x10) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			double width = ((Double) v.get(1)).doubleValue();
+			att.setWidthFactor(width);
+		}
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		String text = (String) v.get(1);
+		att.setText(text);
+
+		if ((dflag & 0x20) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int gen = ((Integer) v.get(1)).intValue();
+			att.setGeneration(gen);
+		}
+
+		if ((dflag & 0x40) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int halign = ((Integer) v.get(1)).intValue();
+			att.setHalign(halign);
+		}
+
+		if ((dflag & 0x80) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int valign = ((Integer) v.get(1)).intValue();
+			att.setValign(valign);
+		}
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		String tag = (String) v.get(1);
+		att.setTag(tag);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int fl = ((Integer) v.get(1)).intValue();
+		att.setFieldLength(fl);
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int flags = ((Integer) v.get(1)).intValue();
+		att.setFlags(flags);
+
+		bitPos = readObjectTailer(data, bitPos, att);
+
+		DwgHandleReference styleHandle = new DwgHandleReference();
+		bitPos = styleHandle.read(data, bitPos);
+		att.setStyleHandle(styleHandle);
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPointReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPointReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPointReader2004.java	(revision 435)
@@ -0,0 +1,91 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPointReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPoint))
+			throw new RuntimeException("PointReader 2004 solo puede leer DwgPoint");
+		DwgPoint pt = (DwgPoint) dwgObj;
+		pt.inserta();
+
+		int bitPos = offset;
+
+		ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, pt);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		pt.setPoint(coord);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		pt.setThickness(val);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		pt.setExtrusion(coord);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		pt.setXAxisAngle(val);
+
+		bitPos = readObjectTailer(data, bitPos, pt);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockReader2004.java	(revision 435)
@@ -0,0 +1,48 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgBlockReader2004 extends AbstractDwg2004Reader{
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException{
+			if(! (dwgObj instanceof DwgBlock))
+				throw new RuntimeException("DwgBlockReader2004 solo puede leer DwgBlock");
+			DwgBlock blk = (DwgBlock) dwgObj;
+			int bitPos = offset;
+			ArrayList v;
+
+			bitPos = readObjectHeader(data, bitPos, dwgObj);
+
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String text = (String)v.get(1);
+			blk.setName(text);
+
+
+			bitPos = readObjectTailer(data, bitPos, dwgObj);
+			blk.inserta();
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSplineReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSplineReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSplineReader2004.java	(revision 435)
@@ -0,0 +1,185 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSplineReader2004 extends AbstractDwg2004Reader{
+
+	private static Logger logger = LoggerFactory.getLogger(DwgSplineReader2004.class.getName());
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSpline))
+			throw new RuntimeException("DwgSplineReader2004 solo puede leer DwgSpline");
+		DwgSpline spline = (DwgSpline) dwgObj;
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, spline);
+		System.out.println("posActual = "+bitPos);
+		ArrayList v;
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int sc = ((Integer)v.get(1)).intValue();
+		spline.setScenario(sc);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int deg = ((Integer)v.get(1)).intValue();
+		spline.setDegree(deg);
+
+		int knotsNumber = 0;
+		int controlPointsNumber = 0;
+		int fitPointsNumber = 0;
+		boolean weight = false;
+		if (sc==2) {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ft = ((Double)v.get(1)).doubleValue();
+			spline.setFitTolerance(ft);
+
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z = ((Double)v.get(1)).doubleValue();
+			double[] coord = new double[]{x, y, z};
+			spline.setBeginTanVector(coord);
+
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+			coord = new double[]{x, y, z};
+			spline.setEndTanVector(coord);
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			fitPointsNumber = ((Integer)v.get(1)).intValue();
+
+		} else if (sc==1) {
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean rat = ((Boolean)v.get(1)).booleanValue();
+			spline.setRational(rat);
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean closed = ((Boolean)v.get(1)).booleanValue();
+			spline.setClosed(closed);
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean per = ((Boolean)v.get(1)).booleanValue();
+			spline.setPeriodic(per);
+
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ktol = ((Double)v.get(1)).doubleValue();
+			spline.setKnotTolerance(ktol);
+
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ctol = ((Double)v.get(1)).doubleValue();
+			spline.setControlTolerance(ctol);
+
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			knotsNumber = ((Integer)v.get(1)).intValue();
+
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			controlPointsNumber = ((Integer)v.get(1)).intValue();
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			weight = ((Boolean)v.get(1)).booleanValue();
+
+		} else {
+			logger.warn("ERROR: Escenario desconocido");
+		}
+		if (knotsNumber>0) {
+			double[] knotpts = new double[knotsNumber];
+			for (int i=0;i<knotsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				knotpts[i] = ((Double)v.get(1)).doubleValue();
+			}
+			spline.setKnotPoints(knotpts);
+		}
+		if (controlPointsNumber>0) {
+			// Si el número de weights no coincide con el de ctrlpts habrá problemas ...
+			double[][] ctrlpts = new double[controlPointsNumber][3];
+			double[] weights = new double[controlPointsNumber];
+			for (int i=0;i<controlPointsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double z = ((Double)v.get(1)).doubleValue();
+				ctrlpts[i][0] = x;
+				ctrlpts[i][1] = y;
+				ctrlpts[i][2] = z;
+				if (weight) {
+					v = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer)v.get(0)).intValue();
+					weights[i] = ((Double)v.get(1)).doubleValue();
+				}
+			}
+			spline.setControlPoints(ctrlpts);
+			if (weight) {
+				spline.setWeights(weights);
+			}
+		}
+		if (fitPointsNumber>0) {
+			double[][] fitpts = new double[fitPointsNumber][3];
+			for (int i=0;i<fitPointsNumber;i++) {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double z = ((Double)v.get(1)).doubleValue();
+				fitpts[i][0] = x;
+				fitpts[i][1] = y;
+				fitpts[i][2] = z;
+			}
+			spline.setFitPoints(fitpts);
+		}
+		bitPos = readObjectTailer(data, bitPos, spline);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMeshReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMeshReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMeshReader2004.java	(revision 435)
@@ -0,0 +1,179 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMeshReader15.java,v 1.1.2.1 2007/03/21 19:49:16 azabala Exp $
+* $Log: DwgMeshReader15.java,v $
+* Revision 1.1.2.1  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+
+
+public class DwgMeshReader2004 extends AbstractDwg2004Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMeshPolyline))
+	    	throw new RuntimeException("Meshr 2004 solo puede leer DwgMeshPolyline");
+		DwgMeshPolyline m = (DwgMeshPolyline) dwgObj;
+		int bitPos = offset;
+		ArrayList v;
+//		boolean dontRead = false;
+//
+//
+//		v = DwgUtil.getRawLong(data, bitPos);
+//		bitPos = ((Integer) v.get(0)).intValue();
+//		int objBSize = ((Integer) v.get(1)).intValue();
+//		m.setSizeInBits(objBSize);
+//
+//		DwgHandleReference entityHandle = new DwgHandleReference();
+//		entityHandle.read(data, bitPos);
+//		if(entityHandle.getCode()!=0 && entityHandle.getCounter()!=1)
+//			dontRead=true;
+//		if(!dontRead){
+//			entityHandle = new DwgHandleReference();
+//			bitPos = entityHandle.read(data, bitPos);
+//			m.setHandle(entityHandle);
+//			}
+//		if(dontRead) bitPos=bitPos + 16;
+//
+//
+//		v=DwgUtil.getBitShort(data, bitPos);
+//		double newBitPos=((Integer)v.get(0)).intValue();
+//		newBitPos=newBitPos-bitPos;
+//		newBitPos=Math.ceil((newBitPos/8));
+//		bitPos=(int) newBitPos;
+//
+//
+//		boolean gflag = false;
+//		gflag = m.isGraphicsFlag();
+//		if (gflag) {
+//			//lee un flag boolean
+//			v = DwgUtil.testBit(data, bitPos);
+//			bitPos = ((Integer) v.get(0)).intValue();
+//			boolean val = ((Boolean) v.get(1)).booleanValue();
+//			//si hay imagen asociada, se lee por completo
+//			if (val) {
+//				v = DwgUtil.getRawLong(data, bitPos);
+//				bitPos = ((Integer) v.get(0)).intValue();
+//				int size = ((Integer) v.get(1)).intValue();
+//				int bgSize = size * 8;
+//				Integer giData = (Integer) DwgUtil.getBits(data, bgSize,
+//						bitPos);
+//				m.setGraphicData(giData.intValue());
+//				bitPos = bitPos + bgSize;
+//			}
+//		}
+//
+
+		bitPos = readObjectHeader(data, bitPos, m);
+
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		m.setFlags(flags);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int curveType = ((Integer) val.get(1)).intValue();
+		m.setCurveType(curveType);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mVerticies = ((Integer) val.get(1)).intValue();
+		m.setMVerticies(mVerticies);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nVerticies = ((Integer) val.get(1)).intValue();
+		m.setNVerticies(nVerticies);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mDensity = ((Integer) val.get(1)).intValue();
+		m.setMDensity(mDensity);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nDensity = ((Integer) val.get(1)).intValue();
+		m.setNDensity(nDensity);
+
+		val = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+		bitPos = ((Integer)val.get(0)).intValue();
+		int OwnedObj = ((Integer)val.get(1)).intValue();
+
+		bitPos = readObjectTailer(data, bitPos, m);
+
+		DwgHandleReference handle;
+
+		if (OwnedObj>0) {
+			for (int i=0;i<OwnedObj;i++) {
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				m.addOwnedObjectHandle(handle);
+			}
+		}
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLwPolylineReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLwPolylineReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLwPolylineReader2004.java	(revision 435)
@@ -0,0 +1,223 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLwPolylineReader2004 extends AbstractDwg2004Reader {
+
+	/*
+	 *TODO El metodo original de J.Morell daba excepciones (que eran
+	 *ocultadas con un catch(Exception){}...BUF!
+	 *
+	 * Este metodo trata de copiar literalmente el de Python, para ver
+	 * si somos capaces de resolver el bug.
+	 *
+	 * */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+
+			if (!(dwgObj instanceof DwgLwPolyline))
+				throw new RuntimeException(
+						"ArcReader 2004 solo puede leer DwgLwPolyLine");
+			DwgLwPolyline line = (DwgLwPolyline) dwgObj;
+			int bitPos = offset;
+			ArrayList val;
+
+
+
+			bitPos = readObjectHeader(data, bitPos, dwgObj);
+
+			val = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int flag = ((Integer) val.get(1)).intValue();
+			line.setFlag(flag);
+
+			/*
+			 * Flag son 4 bits que indican si la lwpline tiene ancho,
+			 * (3er bit), elevacion (4o bit), grosor (2� bit) y vector
+			 * de extrusion (1er bit).
+			 * 5� bit -> n� de bulges
+			 * 60 bit -> n� de widths
+			 *
+			 * ahora se verifican y se van leyendo
+			 * */
+
+
+			double constWidth = 0d;
+		    if( (flag & 0x4) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				constWidth = ((Double) val.get(1)).doubleValue();
+		    }//if
+		    line.setConstWidth(constWidth);
+
+		    double elev = 0d;
+		    if ( (flag & 0x8) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	elev = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setElevation(elev);
+
+		    double thickness = 0d;
+		    if ( (flag & 0x2) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	thickness = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setThickness(thickness);
+
+		    double nx = 0d;
+		    double ny = 0d;
+		    double nz = 0d;
+		    if( (flag & 0x1) > 0){
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	nx = ((Double) val.get(1)).doubleValue();
+
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	ny = ((Double) val.get(1)).doubleValue();
+
+		    	val = DwgUtil.getBitDouble(data, bitPos);
+		    	bitPos = ((Integer) val.get(0)).intValue();
+		    	nz = ((Double) val.get(1)).doubleValue();
+		    }
+		    line.setNormal(new double[]{nx, ny, nz});
+
+		    val = DwgUtil.getBitLong(data, bitPos);
+		    bitPos = ((Integer) val.get(0)).intValue();
+		    int numberOfPoints = ((Integer) val.get(1)).intValue();
+
+		    int numberOfBulges = 0;
+		    if ((flag & 0x10) > 0){
+		    	val = DwgUtil.getBitLong(data, bitPos);
+		 	    bitPos = ((Integer) val.get(0)).intValue();
+		 	    numberOfBulges = ((Integer) val.get(1)).intValue();
+		    }
+
+		    int numberOfWidths = 0;
+		    if ((flag & 0x20) > 0){
+		    	val = DwgUtil.getBitLong(data, bitPos);
+		 	    bitPos = ((Integer) val.get(0)).intValue();
+		 	    numberOfWidths = ((Integer) val.get(1)).intValue();
+		    }
+
+		    if(numberOfPoints > 0){
+		    	//Esto es una chapuza, pero las LwPolylines no se est�n
+		    	//leyendo bien y en ocasiones nos llegan entidades
+		    	//con MILLONES de puntos (OutOfMemoryException)
+		    	//Plantear en la lista de PythonCAD
+		    	if(numberOfPoints > 10000)
+		    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
+		    	List vertices = new ArrayList();
+		  	    val = DwgUtil.getRawDouble(data, bitPos);
+		  	    bitPos = ((Integer) val.get(0)).intValue();
+		  		double x0 = ((Double) val.get(1)).doubleValue();
+
+		  		val = DwgUtil.getRawDouble(data, bitPos);
+		  		bitPos = ((Integer) val.get(0)).intValue();
+		  		double y0 = ((Double) val.get(1)).doubleValue();
+
+		  		vertices.add(new double[]{x0, y0});
+
+		  		for (int i = 1; i < numberOfPoints; i++) {
+		  			val = DwgUtil.getDefaultDouble(data, bitPos, x0);
+		  			bitPos = ((Integer) val.get(0)).intValue();
+		  			double x = ((Double) val.get(1)).doubleValue();
+
+		  			val = DwgUtil.getDefaultDouble(data, bitPos, y0);
+		  			bitPos = ((Integer) val.get(0)).intValue();
+		  			double y = ((Double) val.get(1)).doubleValue();
+
+		  			vertices.add(new double[]{x, y});
+
+		  			x0 = x;//se proporcionan como valores por defecto las coordenadas del pto anterior
+		  			y0 = y;
+		  		}
+		  		line.setVertices(vertices);
+		    }else{
+		    	System.out.println("vertices == 0: lanzamos una excepcion??");
+		    }
+
+
+
+			if(numberOfBulges > 0){
+				if (numberOfBulges != numberOfPoints){
+			    	System.out.println("bulges != vertices: lanzamos una excepcion??");
+			    }
+				double[] bulges = new double[numberOfBulges];
+				for(int i = 0; i < numberOfBulges; i++){
+					//TODO OJOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+					//En PythonCAD se hacia getRawDouble, pero en la especificacion
+					//(pagina 136) dice que es BitDouble (BD)
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					bulges[i] = ((Double) val.get(1)).doubleValue();
+				}
+				line.setBulges(bulges);
+			}else{
+				double[] bulges = new double[numberOfPoints];
+				for(int i = 0; i < numberOfPoints; i++)
+					bulges[i] = 0d;
+				line.setBulges(bulges);
+			}
+
+			if(numberOfWidths > 0){
+			    if (numberOfWidths != numberOfPoints){
+			    	System.out.println("widths != vertices: lanzamos una excepcion??");
+			    }
+				double[][] widths = new double[numberOfWidths][2];
+				for (int i = 0; i < numberOfWidths; i++) {
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					double sw = ((Double) val.get(1)).doubleValue();
+
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					double ew = ((Double) val.get(1)).doubleValue();
+					widths[i][0] = sw;
+					widths[i][1] = ew;
+				}
+				line.setWidths(widths);
+			}else{
+				line.setWidths(new double[0][0]);
+			}
+
+			line.inserta();
+
+
+			/*
+			 * azabala: de siempre se producen excepciones al tratar de leer
+			 * LwPolyline (si no se veian es pq se capturaban y no se sacaba
+			 * traza)
+			 *
+			 * Se producen siempre que numVertices == 0 ????
+			 * Probar a saltarmelos.
+			 *
+			 *
+			 *
+			 * TODO Ver por qu� aparecen (y lo peor, pq una vez se da una se propagan
+			 * todas)
+			 *
+			 * */
+				bitPos = readObjectTailer(data, bitPos, line);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgCircleReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgCircleReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgCircleReader2004.java	(revision 435)
@@ -0,0 +1,87 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgCircleReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgCircle))
+			throw new RuntimeException("CircleReader 2004 solo puede leer DwgCircle");
+		DwgCircle circle = (DwgCircle) dwgObj;
+		circle.inserta();
+
+		boolean dontRead=false;
+		int bitPos = offset;
+		ArrayList v;
+
+
+		bitPos = readObjectHeader(data, bitPos, dwgObj);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		circle.setCenter(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		circle.setRadius(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+	    circle.setThickness(val);
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		circle.setExtrusion(coord);
+		bitPos = readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMTextReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMTextReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgMTextReader2004.java	(revision 435)
@@ -0,0 +1,135 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMText;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgMTextReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMText))
+			throw new RuntimeException("ArcReader 2004 solo puede leer DwgMText");
+
+		DwgMText txt = (DwgMText) dwgObj;
+		int bitPos = offset;
+		ArrayList v;
+
+
+		bitPos =readObjectHeader(data, bitPos, txt);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		txt.setInsertionPoint(coord);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		txt.setExtrusion(coord);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		txt.setXAxisDirection(coord);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		txt.setWidth(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setHeight(val);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ival = ((Integer)v.get(1)).intValue();
+		txt.setAttachment(ival);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		ival = ((Integer)v.get(1)).intValue();
+		txt.setDrawingDir(ival);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setExtHeight(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setExtWidth(val);
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		txt.setText(text);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		ival = ((Integer)v.get(1)).intValue();
+		txt.setLineSpacingStyle(ival);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		txt.setLineSpacingFactor(val);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue(); //unknow
+
+		v = DwgUtil.getBitLong(data, bitPos); //UNKNOWN LONG DE MOMENTO NO SALE
+		bitPos = ((Integer)v.get(0)).intValue();
+		int Unknown  = ((Integer)v.get(1)).intValue();
+		bitPos = readObjectTailer(data, bitPos, txt);
+
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		txt.setStyleHandle(hr);
+
+		txt.inserta();
+
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerControlReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerControlReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerControlReader2004.java	(revision 435)
@@ -0,0 +1,70 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+import org.gvsig.dwg.lib.objects.DwgLayerControl;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgLayerControlReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)throws RuntimeException, CorruptedDwgEntityException
+		 {
+		//TODO Si no lo leemos, mejor ni considerarlo
+		//Ver la especificaci�n de este objeto
+
+		 if(! (dwgObj instanceof DwgLayerControl))
+		    	throw new RuntimeException(this.getClass().getName()+" solo puede leer DwgLAyerControl");
+
+		 DwgLayerControl blk = (DwgLayerControl) dwgObj;
+			int bitPos = offset;
+			blk.inserta();
+			ArrayList v;
+
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numReactors = ((Integer)v.get(1)).intValue();
+			blk.setNumReactors(numReactors);
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean XdicFlag = ((Boolean) v.get(1)).booleanValue();
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int enumeration = ((Integer)v.get(1)).intValue();
+
+			DwgHandleReference hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setNullHandle(hr);
+
+			if(!XdicFlag){
+				hr = new DwgHandleReference();
+				bitPos = hr.read(data, bitPos);
+				blk.setXDicObjHandle(hr);
+			}
+			Vector handles = new Vector();
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			handles.add(hr);
+
+			blk.setCode2Handles(handles);
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPFaceReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPFaceReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPFaceReader2004.java	(revision 435)
@@ -0,0 +1,167 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgPFaceReader15.java,v 1.1.2.1 2007/03/21 19:49:16 azabala Exp $
+* $Log: DwgPFaceReader15.java,v $
+* Revision 1.1.2.1  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+
+
+public class DwgPFaceReader2004 extends AbstractDwg2004Reader {
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+
+		if(! (dwgObj instanceof DwgPFacePolyline))
+	    	throw new RuntimeException("ArcReader 2004 solo puede leer DwgPFacePolyline");
+		DwgPFacePolyline pface = (DwgPFacePolyline) dwgObj;
+		int bitPos = offset;
+
+
+//		boolean dontRead = false;
+//
+//
+//		ArrayList v = DwgUtil.getRawLong(data, bitPos);
+//		bitPos = ((Integer) v.get(0)).intValue();
+//		int objBSize = ((Integer) v.get(1)).intValue();
+//		pface.setSizeInBits(objBSize);
+//
+//		DwgHandleReference entityHandle = new DwgHandleReference();
+//		entityHandle.read(data, bitPos);
+//		if(entityHandle.getCode()!=0 && entityHandle.getCounter()!=1)
+//			dontRead=true;
+//		if(!dontRead){
+//			entityHandle = new DwgHandleReference();
+//			bitPos = entityHandle.read(data, bitPos);
+//			pface.setHandle(entityHandle);
+//			}
+//		if(dontRead) bitPos=bitPos + 16;
+//
+//
+//
+//		v = DwgUtil.readExtendedData(data, bitPos);
+//		bitPos = ((Integer) v.get(0)).intValue();
+//		ArrayList extData = (ArrayList) v.get(1);
+//		pface.setExtendedData(extData);
+//
+//		boolean gflag = false;
+//		gflag = pface.isGraphicsFlag();
+//		if (gflag) {
+//			//lee un flag boolean
+//			v = DwgUtil.testBit(data, bitPos);
+//			bitPos = ((Integer) v.get(0)).intValue();
+//			boolean val = ((Boolean) v.get(1)).booleanValue();
+//			//si hay imagen asociada, se lee por completo
+//			if (val) {
+//				v = DwgUtil.getRawLong(data, bitPos);
+//				bitPos = ((Integer) v.get(0)).intValue();
+//				int size = ((Integer) v.get(1)).intValue();
+//				int bgSize = size * 8;
+//				Integer giData = (Integer) DwgUtil.getBits(data, bgSize,
+//						bitPos);
+//				pface.setGraphicData(giData.intValue());
+//				bitPos = bitPos + bgSize;
+//			}
+//		}
+//
+//
+		bitPos = readObjectHeader(data, bitPos, pface);
+
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int vertexCount = ((Integer) val.get(1)).intValue();
+		pface.setVertexCount(vertexCount);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int faceCount = ((Integer) val.get(1)).intValue();
+		pface.setFaceCount(faceCount);
+
+		val = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+		bitPos = ((Integer)val.get(0)).intValue();
+		int OwnedObj = ((Integer)val.get(1)).intValue();
+
+		bitPos = readObjectTailer(data, bitPos, pface);
+		DwgHandleReference handle; // = new DwgHandleReference();
+
+
+		if (OwnedObj>0) {
+			for (int i=0;i<OwnedObj;i++) {
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				pface.addOwnedObjectHandle(handle);
+			}
+
+		}
+
+//		DwgHandleReference handle = new DwgHandleReference();
+//		bitPos = handle.read(data, bitPos);
+//		pface.setFirstVertexHandle(handle);
+//
+//		handle = new DwgHandleReference();
+//		bitPos = handle.read(data, bitPos);
+//		pface.setLastVertexHandle(handle);
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSeqEndReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSeqEndReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSeqEndReader2004.java	(revision 435)
@@ -0,0 +1,28 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSeqEndReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	//TODO Algunos objetos no aportan nada al head y tail
+	//ver si quitarlo (o pasar la implementacion a la clase abstracta)
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, dwgObj);
+		bitPos = readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline2DReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline2DReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline2DReader2004.java	(revision 435)
@@ -0,0 +1,117 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPolyline2DReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline2D))
+			throw new RuntimeException(this.getClass().getName()+" solo puede leer DwgPolyline2D");
+		DwgPolyline2D ln = (DwgPolyline2D) dwgObj;
+		int bitPos = offset;
+		boolean dontRead = false;
+		ArrayList v;
+
+
+		bitPos = readObjectHeader(data, bitPos, ln);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ln.setFlags(flags);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int ctype = ((Integer)v.get(1)).intValue();
+		ln.setCurveType(ctype);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double sw = ((Double)v.get(1)).doubleValue();
+		ln.setInitWidth(sw);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double ew = ((Double)v.get(1)).doubleValue();
+		ln.setEndWidth(ew);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double th = 0.0;
+	    if (!flag) {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			th = ((Double)v.get(1)).doubleValue();
+	    }
+	    ln.setThickness(th);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double elev = ((Double)v.get(1)).doubleValue();
+		ln.setElevation(elev);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+	    double ex, ey, ez = 0.0;
+	    if (flag) {
+	    	ex = 0.0;
+	    	ey = 0.0;
+	    	ez = 1.0;
+	    } else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ex = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ey = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ez = ((Double)v.get(1)).doubleValue();
+	    }
+	    ln.setExtrusion(new double[]{ex, ey, ez});
+
+	    v = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+		bitPos = ((Integer)v.get(0)).intValue();
+		int OwnedObj = ((Integer)v.get(1)).intValue();
+
+	    bitPos = readObjectTailer(data, bitPos, ln);
+
+		DwgHandleReference hr;
+		if (OwnedObj>0) {
+			for (int i=0;i<OwnedObj;i++) {
+				hr = new DwgHandleReference();
+				bitPos = hr.read(data, bitPos);
+				ln.addVertexHandle(hr);
+			}
+		}
+
+		hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+	    ln.setSeqendHandle(hr);
+	    ln.inserta();
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline3DReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline3DReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgPolyline3DReader2004.java	(revision 435)
@@ -0,0 +1,68 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgPolyline3DReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline3D))
+			throw new RuntimeException(this.getClass().getName()+" solo puede leer DwgPolyline3D");
+		DwgPolyline3D ln = (DwgPolyline3D) dwgObj;
+		try{
+			int bitPos = offset;
+			ArrayList v;
+
+			bitPos = readObjectHeader(data, bitPos, ln);
+
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int sflags = ((Integer)v.get(1)).intValue();
+			ln.setSplineFlags(sflags);
+
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int cflags = ((Integer)v.get(1)).intValue();
+			ln.setClosedFlags(cflags);
+
+			v = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+			bitPos = ((Integer)v.get(0)).intValue();
+			int OwnedObj = ((Integer)v.get(1)).intValue();
+
+			bitPos = readObjectTailer(data, bitPos, ln);
+
+			DwgHandleReference handle= new DwgHandleReference();
+			if (OwnedObj>0) {
+				for (int i=0;i<OwnedObj;i++) {
+					handle = new DwgHandleReference();
+					bitPos = handle.read(data, bitPos);
+					ln.addVertexHandle(handle);
+				}
+			}
+
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			ln.setSeqendHandle(handle);
+			ln.inserta();
+
+		}catch(Exception e){
+			System.out.println("BAD POLYLINE 3D."+e.getMessage());
+		}
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgTextReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgTextReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgTextReader2004.java	(revision 435)
@@ -0,0 +1,155 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.util.TextToUnicodeConverter;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgTextReader2004 extends AbstractDwg2004Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgText))
+			throw new RuntimeException("TextReader 2004 solo puede leer DwgText");
+		DwgText txt = (DwgText) dwgObj;
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, txt);
+
+		ArrayList v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int dflag = ((Integer)v.get(1)).intValue();
+		txt.setDataFlag(dflag);
+
+		if ((dflag & 0x1)==0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double elev = ((Double)v.get(1)).doubleValue();
+			txt.setElevation(elev);
+		}
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y1 = ((Double)v.get(1)).doubleValue();
+		txt.setInsertionPoint(new Point2D.Double(x1, y1));
+
+		if ((dflag & 0x2)==0) {
+			v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double xa = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double ya = ((Double)v.get(1)).doubleValue();
+			txt.setAlignmentPoint(new Point2D.Double(xa, ya));
+		}
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		double x, y, z;
+		if (flag) {
+			x = 0.0;
+			y = 0.0;
+			z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		txt.setExtrusion(new double[]{x, y, z});
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+	    double th;
+		if (flag) {
+			th=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			th = ((Double)v.get(1)).doubleValue();
+		}
+		txt.setThickness(th);
+
+		if ((dflag & 0x4) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double oblique = ((Double)v.get(1)).doubleValue();
+			txt.setObliqueAngle(oblique);
+		}
+
+		if ((dflag & 0x8) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double rot = ((Double)v.get(1)).doubleValue();
+			txt.setRotationAngle(rot);
+		}
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double height = ((Double)v.get(1)).doubleValue();
+		txt.setHeight(height);
+
+		if ((dflag & 0x10) == 0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double width = ((Double)v.get(1)).doubleValue();
+			txt.setWidthFactor(width);
+		}
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String text = (String)v.get(1);
+		text = TextToUnicodeConverter.convertText(text);
+		txt.setText(text);
+
+		if ((dflag & 0x20) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int gen = ((Integer)v.get(1)).intValue();
+			txt.setGeneration(gen);
+		}
+
+		if ((dflag & 0x40) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int halign = ((Integer)v.get(1)).intValue();
+			txt.setHalign(halign);
+		}
+
+		if ((dflag & 0x80) == 0) {
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int valign = ((Integer)v.get(1)).intValue();
+			txt.setValign(valign);
+		}
+		txt.inserta();
+		bitPos = readObjectTailer(data, bitPos, txt);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLineReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLineReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLineReader2004.java	(revision 435)
@@ -0,0 +1,109 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLine;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLineReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLine))
+			throw new RuntimeException("LineReader 2004 solo puede leer DwgLine");
+		DwgLine line = (DwgLine) dwgObj;
+		line.inserta();
+
+		int bitPos = offset;
+		ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, line);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		line.setZflag(((Boolean)v.get(1)).booleanValue());
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x2 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y1 = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y2 = ((Double)v.get(1)).doubleValue();
+		double[] p1;
+		double[] p2;
+	    if (!line.isZflag()) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z1 = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, z1);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z2 = ((Double)v.get(1)).doubleValue();
+			p1 = new double[]{x1, y1, z1};
+			p2 = new double[]{x2, y2, z2};
+		} else {
+			p1 = new double[]{x1, y1, 0d};
+			p2 = new double[]{x2, y2, 0d};
+		}
+	    line.setP1(p1);
+	    line.setP2(p2);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		line.setThickness(val);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		double x, y, z;
+	    if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		double[] coord = new double[]{x, y, z};
+		line.setExtrusion(coord);
+		if(line.getAvanzar()) bitPos++;
+		bitPos = readObjectTailer(data, bitPos, line);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexMeshReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexMeshReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexMeshReader2004.java	(revision 435)
@@ -0,0 +1,100 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexMeshReader15.java,v 1.1.2.1 2007/03/21 19:49:16 azabala Exp $
+* $Log: DwgVertexMeshReader15.java,v $
+* Revision 1.1.2.1  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexMesh;
+
+
+public class DwgVertexMeshReader2004 extends AbstractDwg2004Reader {
+
+    //similar to DwgVertex3D (and all derived vertices...
+	//apply inheritance
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertexMesh))
+		    	throw new RuntimeException("DwgVertexMeshReader2004 solo puede leer DwgVertexMesh");
+		 DwgVertexMesh v = (DwgVertexMesh) dwgObj;
+		 int bitPos = offset;
+		 bitPos = readObjectHeader(data, bitPos, v);
+
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flag = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flag);
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+
+		 bitPos = readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceFaceReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceFaceReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceFaceReader2004.java	(revision 435)
@@ -0,0 +1,101 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceFaceReader15.java,v 1.1.2.1 2007/03/21 19:49:16 azabala Exp $
+* $Log: DwgVertexPFaceFaceReader15.java,v $
+* Revision 1.1.2.1  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+
+
+public class DwgVertexPFaceFaceReader2004 extends AbstractDwg2004Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgVertexPFaceFace))
+		    	throw new RuntimeException("DwgVertexPFaceFaceReader2004 solo puede leer DwgVertexPFaceFace");
+		 DwgVertexPFaceFace v = (DwgVertexPFaceFace) dwgObj;
+		 
+		 int bitPos = offset;
+		 
+		 bitPos = readObjectHeader(data, offset, v);
+		 
+		 List val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v1 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v2 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v3 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v4 = ((Integer) val.get(1)).intValue();
+		 
+		 v.setVerticesidx(new int[]{v1, v2, v3, v4});
+		 
+		 bitPos = readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockControlReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockControlReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockControlReader2004.java	(revision 435)
@@ -0,0 +1,78 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+
+
+/**
+ * @author azabala
+ */
+public class DwgBlockControlReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException{
+
+		 if(! (dwgObj instanceof DwgBlockControl))
+		    	throw new RuntimeException("ArcReader 2004 solo puede leer DwgBlockControl");
+		    DwgBlockControl blk = (DwgBlockControl) dwgObj;
+		    blk.inserta();
+			int bitPos = offset;
+
+			ArrayList v;
+
+
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numReactors = ((Integer)v.get(1)).intValue();
+			blk.setNumReactors(numReactors);
+
+//			FIXME: Asegurarse de esto
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean xdicFlag = ((Boolean)v.get(1)).booleanValue();
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int enumeration = ((Integer)v.get(1)).intValue();
+
+			DwgHandleReference hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setNullHandle(hr);
+
+			if(!xdicFlag){
+				hr = new DwgHandleReference();
+				bitPos = hr.read(data, bitPos);
+				blk.setXDicObjHandle(hr);
+			}
+
+			if (enumeration>0) {
+				Vector handles = new Vector();
+				for (int i=0;i<enumeration;i++) {
+					hr = new DwgHandleReference();
+					bitPos = hr.read(data, bitPos);
+					handles.add(hr);
+				}
+				blk.setCode2Handles(handles);
+			}
+
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setModelSpaceHandle(hr);
+
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			blk.setPaperSpaceHandle(hr);
+		}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEllipseReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEllipseReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEllipseReader2004.java	(revision 435)
@@ -0,0 +1,85 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgEllipseReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEllipse))
+			throw new RuntimeException("ArcReader 2004 solo puede leer DwgEllipse");
+		DwgEllipse ell = (DwgEllipse) dwgObj;
+		int bitPos = offset;
+		ell.inserta();
+		ArrayList v;
+
+
+		bitPos = readObjectHeader(data, bitPos, ell);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ell.setCenter(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ell.setSemiMajorAxisVector(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ell.setExtrusion(coord);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double val = ((Double)v.get(1)).doubleValue();
+		ell.setAxisRatio(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		ell.setInitAngle(val);
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		ell.setEndAngle(val);
+		bitPos = readObjectTailer(data, bitPos, ell);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEndBlkReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEndBlkReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgEndBlkReader2004.java	(revision 435)
@@ -0,0 +1,38 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgEndBlkReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEndblk))
+			throw new RuntimeException("ArcReader 2004 solo puede leer DwgEndBlk");
+		DwgEndblk blk = (DwgEndblk) dwgObj;
+		int bitPos = offset;
+		ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, blk);
+		bitPos = readObjectTailer(data, bitPos, blk);
+		blk.inserta();
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex2DReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex2DReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex2DReader2004.java	(revision 435)
@@ -0,0 +1,79 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgVertex2DReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex2D))
+		    	throw new RuntimeException("Vertex2D 2004 solo puede leer DwgVertex2D");
+		 DwgVertex2D ver = (DwgVertex2D) dwgObj;
+
+		 int bitPos = offset;
+		 ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, ver);
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ver.setFlags(flags);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		ver.setPoint(new double[]{x, y, z});
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double sw = ((Double)v.get(1)).doubleValue();
+		double ew = 0.0;
+		if (sw<0.0) {
+			ew = Math.abs(sw);
+			sw = ew;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			ew = ((Double)v.get(1)).doubleValue();
+		}
+		ver.setInitWidth(sw);
+		ver.setEndWidth(ew);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bulge = ((Double)v.get(1)).doubleValue();
+		ver.setBulge(bulge);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double tandir = ((Double)v.get(1)).doubleValue();
+		ver.setTangentDir(tandir);
+
+		bitPos = readObjectTailer(data, bitPos, ver);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/AbstractDwg2004Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/AbstractDwg2004Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/AbstractDwg2004Reader.java	(revision 435)
@@ -0,0 +1,268 @@
+/*
+ * Created on 25-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: AbstractDwg15Reader.java,v 1.1.2.2 2007/03/21 19:49:16 azabala Exp $
+* $Log: AbstractDwg15Reader.java,v $
+* Revision 1.1.2.2  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/01/25 20:05:58  azabala
+* start of implementation of specific versions' object readers
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgLine;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+import org.gvsig.dwg.lib.objects.DwgMText;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+import org.gvsig.dwg.lib.objects.DwgSeqend;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+import org.gvsig.dwg.lib.readers.DwgFileVR2004Reader;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.gvsig.dwg.lib.readers.IDwgObjectReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public abstract class AbstractDwg2004Reader implements IDwgObjectReader{
+
+	private static Logger logger = LoggerFactory.getLogger(AbstractDwg2004Reader.class.getName());
+
+
+	/**
+	 * Reads the header of a dwg object2004
+	 * */
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException{
+		int bitPos = offset;
+
+
+		Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		bitPos = bitPos + 2;
+		dwgObject.setMode(mode.intValue());
+
+
+//		ArrayList v = DwgUtil.getBitShort(data, bitPos);
+		ArrayList v = DwgUtil.getBitLong(data, bitPos); //Seg�n especificaciones
+		bitPos = ((Integer) v.get(0)).intValue();
+		int rnum = ((Integer) v.get(1)).intValue();
+		dwgObject.setNumReactors(rnum);
+
+		//FIXME: �Por qu� hace esto? Si entra en cualquiera de las condiciones
+		// se perder�a un bit.
+		// �Es correcto o, tal vez est�n equivocadas las especificaciones en este punto?
+		// Vale, en otro punto de las especificaciones dice "Only entities have this flag"
+		if(dwgObject instanceof DwgLine) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgPoint) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgCircle) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgArc) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgLwPolyline) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgEllipse) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgMText) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgText) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgBlock) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgEndblk) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgPolyline3D) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgVertex3D) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgSeqend) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgInsert) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgAttrib) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgSpline) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgAttdef) dwgObject.setXDicObjFlag(true);
+		else if(dwgObject instanceof DwgSolid) dwgObject.setXDicObjFlag(true);
+		else {
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean XdicFlag = ((Boolean) v.get(1)).booleanValue();
+			dwgObject.setXDicObjFlag(XdicFlag);
+		}
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		boolean nolinks = ((Boolean) v.get(1)).booleanValue();
+		dwgObject.setNoLinks(nolinks);
+
+//		Segun las especificaciones, en R2004+ el color se debe leer como un
+//		CMC, sin embargo aqu� no parece que sea as�
+//		v = DwgUtil.getCmColor(data, bitPos, dwgObject.getVersion());
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int color = ((Integer) v.get(1)).intValue();
+		dwgObject.setColor(color);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		float ltscale = ((Double) v.get(1)).floatValue();
+
+		Integer ltflag = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		/*
+		 * 00: bylayer;
+		 * 01: byblock;
+		 * 10: continuous;
+		 * 11: linetype handle present at end of object
+		 */
+		bitPos = bitPos + 2;
+
+		Integer psflag = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		/*
+		 * 00: bylayer;
+		 * 01: byblock;
+		 * 10: continuous;
+		 * 11: linetype handle present at end of object
+		 */
+		bitPos = bitPos + 2;
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int invis = ((Integer) v.get(1)).intValue();
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int weight = ((Integer) v.get(1)).intValue();
+
+		return bitPos;
+	}
+
+	/**
+	 * Reads the tailer of a dwg object2004
+	 * */
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException{
+		int bitPos = offset;
+		/*
+		 * Subentity ref handle. Esto se aplica sobre VERTEX, ATTRIB, SEQEND
+		 */
+		if (dwgObject.getMode() == 0x0) {
+			DwgHandleReference subEntityHandle = new DwgHandleReference();
+			bitPos = subEntityHandle.read(data, bitPos);
+			dwgObject.setSubEntityHandle(subEntityHandle);
+//		} else {
+//			logger.warn("entMode != 0 : "+dwgObject.getMode()+ " " + dwgObject.getClass().getName());
+		}
+
+		/*
+		 * Reactors handles TODO No se est�n usando para setear nada en
+		 * DwgObject
+		 */
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < dwgObject.getNumReactors(); i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			dwgObject.addReactorHandle(reactorHandle);
+		}
+
+		/*
+		 * XDICOBJHANDLE
+		 */
+		if(dwgObject.isXDicObjFlag()!= true){
+			DwgHandleReference xDicObjHandle = new DwgHandleReference();
+			bitPos = xDicObjHandle.read(data, bitPos);
+			dwgObject.setXDicObjHandle(xDicObjHandle);
+		}
+
+		if (!dwgObject.isNoLinks()) {
+
+			DwgHandleReference previousHandle = new DwgHandleReference();
+			bitPos = previousHandle.read(data, bitPos);
+			dwgObject.setPreviousHandle(previousHandle);
+
+			DwgHandleReference nextHandle = new DwgHandleReference();
+			bitPos = nextHandle.read(data, bitPos);
+			dwgObject.setNextHandle(nextHandle);
+
+		}
+
+
+		/*
+		 * Layer Handle code
+		 */
+
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dwgObject.setLayerHandle(handle);
+
+
+
+		if (dwgObject.getLinetypeFlags() == 0x3) {
+			DwgHandleReference lineTypeHandle = new DwgHandleReference();
+			bitPos = lineTypeHandle.read(data, bitPos);
+			dwgObject.setLineTypeHandle(lineTypeHandle);
+
+		}
+
+		if (dwgObject.getPlotstyleFlags() == 0x3) {
+			DwgHandleReference plotStyleHandle = new DwgHandleReference();
+			bitPos = plotStyleHandle.read(data, bitPos);
+			dwgObject.setPlotStyleHandle(plotStyleHandle);
+		}
+		return bitPos;
+	}
+
+	protected IDwgFileReader headTailReader;
+	public void setFileReader(IDwgFileReader headTailReader) {
+		if( ! (headTailReader instanceof DwgFileVR2004Reader))
+			throw new RuntimeException("Tratando de leer entidad de DWG 2004 con"+
+					headTailReader.getClass().getName());
+		this.headTailReader = headTailReader;
+	}
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockHeaderReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockHeaderReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgBlockHeaderReader2004.java	(revision 435)
@@ -0,0 +1,196 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgBlockHeaderReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgBlockHeader))
+		    	throw new RuntimeException("DwgBlockHeaderReader2004 solo puede leer DwgBlockHeader");
+		DwgBlockHeader hdr = (DwgBlockHeader) dwgObj;
+
+		int bitPos = offset;
+		ArrayList v;
+		try{
+
+		v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int numReactors = ((Integer)v.get(1)).intValue();
+		hdr.setNumReactors(numReactors);
+
+//		FIXME: Ver que pasa con esto
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean XdicFlag = ((Boolean) v.get(1)).booleanValue();
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String name = (String)v.get(1);
+		hdr.setName(name);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		hdr.setFlag64(flag);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int xrefplus1 = ((Integer)v.get(1)).intValue();
+		hdr.setXRefPlus(xrefplus1);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xdep = ((Boolean)v.get(1)).booleanValue();
+		hdr.setXdep(xdep);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean anon = ((Boolean)v.get(1)).booleanValue();
+		hdr.setAnonymous(anon);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean hasatts = ((Boolean)v.get(1)).booleanValue();
+		hdr.setHasAttrs(hasatts);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean bxref = ((Boolean)v.get(1)).booleanValue();
+		hdr.setBlkIsXRef(bxref);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xover = ((Boolean)v.get(1)).booleanValue();
+		hdr.setXRefOverLaid(xover);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean loaded = ((Boolean)v.get(1)).booleanValue();
+		hdr.setLoaded(loaded);
+
+		v = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+		bitPos = ((Integer)v.get(0)).intValue();
+		int OwnedObj = ((Integer)v.get(1)).intValue();
+
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bx = ((Double)v.get(1)).doubleValue();
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double by = ((Double)v.get(1)).doubleValue();
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double bz = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{bx, by, bz};
+		hdr.setBasePoint(coord);
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String pname = (String)v.get(1);
+		hdr.setXRefPName(pname);
+
+		int icount = 0;
+		while (true) {
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int val = ((Integer)v.get(1)).intValue();
+			if (val==0) {
+				break;
+			}
+			icount++;
+		}
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String desc = (String)v.get(1);
+		hdr.setBlockDescription(desc);
+
+		v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int pdsize = ((Integer)v.get(1)).intValue();
+		if (pdsize>0) {
+			int count = pdsize + icount;
+			//int pdata = ((Integer)DwgUtil.getBits(data, count, bitPos)).intValue();
+			//previewData = pdata;
+			bitPos = bitPos + count;
+		}
+
+		DwgHandleReference blkCtrlHdl = new DwgHandleReference();
+		bitPos = blkCtrlHdl.read(data, bitPos);
+		hdr.setBlockControlHandle(blkCtrlHdl);
+
+		for (int i=0;i<numReactors;i++) {
+			DwgHandleReference reactor = new DwgHandleReference();
+			bitPos = reactor.read(data, bitPos);
+
+		}
+
+		if(!XdicFlag){
+			DwgHandleReference xdicObjHdl = new DwgHandleReference();
+			bitPos = xdicObjHdl.read(data, bitPos);
+			hdr.setXDicObjHandle(xdicObjHdl);
+		}
+
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setNullHandle(handle);
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setBlockEntityHandle(handle);
+
+
+		if (OwnedObj>0) {
+			for (int i=0;i<OwnedObj;i++) {
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				hdr.addOwnedObjectHandle(handle);
+			}
+		}
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setEndBlkEntityHandle(handle);
+
+		if(icount > 0){
+			DwgHandleReference[] insertHandles = new
+				DwgHandleReference[icount];
+			for(int i = 0; i < icount; i++){
+				insertHandles[i] = new DwgHandleReference();
+				bitPos = insertHandles[i].read(data, bitPos);
+			}
+			hdr.setInsertHandles(insertHandles);
+		}
+
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		hdr.setLayoutHandle(handle);
+
+	}catch(Exception e){
+		System.out.println("BlockHeader not wanted");
+	};
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgInsertReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgInsertReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgInsertReader2004.java	(revision 435)
@@ -0,0 +1,129 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgInsertReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgInsert))
+			throw new RuntimeException("DwgInsertReader2004 solo puede leer DwgInsert");
+		DwgInsert ins = (DwgInsert) dwgObj;
+		int bitPos = offset;
+		bitPos = readObjectHeader(data, bitPos, ins);
+
+		ArrayList v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ins.setInsertionPoint(coord);
+
+		int dflag = ((Integer)DwgUtil.getBits(data, 2, bitPos)).intValue();
+		bitPos = bitPos + 2;
+		if (dflag==0x0) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		} else if (dflag==0x1) {
+			x = 1.0;
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getDefaultDouble(data, bitPos, x);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		} else if (dflag==0x2) {
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = y = z = ((Double)v.get(1)).doubleValue();
+		} else {
+			x = y = z = 1.0;
+		}
+		coord = new double[]{x, y, z};
+		ins.setScale(coord);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double rot = ((Double)v.get(1)).doubleValue();
+		ins.setRotation(rot);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		z = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, z};
+		ins.setExtrusion(coord);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean hasattr = ((Boolean)v.get(1)).booleanValue();
+
+//		FIXME: Aunque est� en las especificaciones, parece que esto no se lee
+//		v = DwgUtil.getBitLong(data, bitPos); //OWNED OBJECT COUNT
+//		bitPos = ((Integer)v.get(0)).intValue();
+//		int ownedObj = ((Integer)v.get(1)).intValue();
+
+//		System.out.println("ownedObj = "+ownedObj);
+
+
+		bitPos = readObjectTailer(data, bitPos, ins);
+
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		ins.setBlockHeaderHandle(hr);
+
+//		FIXME: Aunque est� en las especificaciones, parece que esto no se lee
+//		if (ownedObj>0) {
+//			for (int i=0;i<ownedObj;i++) {
+//				hr = new DwgHandleReference();
+//				bitPos = hr.read(data, bitPos);
+//				ins.addOwnedObjectHandle(hr);
+//			}
+//		}
+
+		if (hasattr) {
+			hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+			ins.setSeqendHandle(hr);
+		}
+	}
+
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex3DReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex3DReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertex3DReader2004.java	(revision 435)
@@ -0,0 +1,55 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgVertex3DReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex3D))
+		    	throw new RuntimeException("DwgVertex3DReader2004 solo puede leer DwgVertex3D");
+		 DwgVertex3D ver = (DwgVertex3D) dwgObj;
+		int bitPos = offset;
+		ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, ver);
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		ver.setFlags(flags);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double z = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, z};
+		ver.setPoint(coord);
+//		ver.inserta();
+		bitPos = readObjectTailer(data, bitPos, ver);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgDictionaryReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgDictionaryReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgDictionaryReader2004.java	(revision 435)
@@ -0,0 +1,65 @@
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgDictionary;
+
+
+public class DwgDictionaryReader2004 extends AbstractDwg2004Reader{
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) {
+		if(! (dwgObj instanceof DwgDictionary))
+			throw new RuntimeException("DictionaryReader2004 solo puede leer DwgDictionary");
+		DwgDictionary dict = (DwgDictionary) dwgObj;
+		try {
+			int bitPos = offset;
+
+			ArrayList v;
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numReactors = ((Integer)v.get(1)).intValue();
+			dict.setNumReactors(numReactors);
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean XdicFlag = ((Boolean) v.get(1)).booleanValue();
+
+			v = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int numItems = ((Integer)v.get(1)).intValue();
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int cloningFlag = ((Integer)v.get(1)).intValue();
+			dict.setCloningFlag(cloningFlag);
+
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int hardOwnerFlag = ((Integer)v.get(1)).intValue();
+			dict.setHardOwnerFlag(hardOwnerFlag);
+
+			dict.inserta();
+
+			ArrayList entradasTexto = new ArrayList();
+			for(int i=0; i<numItems; i++){
+				v = DwgUtil.getTextString(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				String text = ((String)v.get(1));
+				entradasTexto.add(text);
+			}
+			DwgHandleReference handle;
+			for(int i=0; i<numItems; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				// A la vez que leemos los handles, rellenamos el diccionario.
+				dict.put(entradasTexto.get(i),handle);
+			}
+		}catch (Exception e){
+			System.out.println("Se ha producido una excepion leyendo un diccionario."+e.getMessage());
+		}
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgArcReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgArcReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgArcReader2004.java	(revision 435)
@@ -0,0 +1,94 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgArcReader2004 extends AbstractDwg2004Reader{
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		    if(! (dwgObj instanceof DwgArc))
+		    	throw new RuntimeException("ArcReader 2004 solo puede leer DwgArc");
+		    DwgArc arc = (DwgArc) dwgObj;
+		    arc.inserta();
+
+			int bitPos = offset;
+			ArrayList v;
+
+			bitPos = readObjectHeader(data, bitPos, arc);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double z = ((Double)v.get(1)).doubleValue();
+			double[] coord = new double[]{x, y, z};
+			arc.setCenter(coord);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double val = ((Double)v.get(1)).doubleValue();
+			arc.setRadius(val);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				val=0.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				val = ((Double)v.get(1)).doubleValue();
+			}
+			arc.setThickness(val);
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				 x = y = 0.0;
+				 z = 1.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				z = ((Double)v.get(1)).doubleValue();
+			}
+			coord = new double[]{x, y, z};
+			arc.setExtrusion(coord);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+			arc.setInitAngle(val);
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+			arc.setEndAngle(val);
+			bitPos = readObjectTailer(data, bitPos, arc);
+		}
+
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttdefReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttdefReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgAttdefReader2004.java	(revision 435)
@@ -0,0 +1,177 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttdefReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+			if(!(dwgObj instanceof DwgAttdef))
+				throw new RuntimeException("DwgAttdefReader2004 solo lee Attdef");
+			DwgAttdef att = (DwgAttdef) dwgObj;
+			int bitPos = offset;
+			bitPos = readObjectHeader(data, bitPos, att);
+			ArrayList v;
+
+			v= DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int dflag = ((Integer)v.get(1)).intValue();
+			att.setDataFlag(dflag);
+
+			if ((dflag & 0x1)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double elev = ((Double)v.get(1)).doubleValue();
+				att.setElevation(elev);
+			}
+
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double x1 = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double y1 = ((Double)v.get(1)).doubleValue();
+			att.setInsertionPoint(new Point2D.Double(x1, y1));
+
+			double x=0, y=0, z=0;
+			if ((dflag & 0x2)==0) {
+				v = DwgUtil.getDefaultDouble(data, bitPos, x1);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getDefaultDouble(data, bitPos, y1);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+			}
+			att.setAlignmentPoint(new Point2D.Double(x, y));
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			boolean flag = ((Boolean)v.get(1)).booleanValue();
+			if (flag) {
+				y = 0.0;
+				x = y;
+				z = 1.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				x = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				y = ((Double)v.get(1)).doubleValue();
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				z = ((Double)v.get(1)).doubleValue();
+			}
+			att.setExtrusion(new double[]{x, y, z});
+
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			flag = ((Boolean)v.get(1)).booleanValue();
+		    double th;
+			if (flag) {
+				th=0.0;
+			} else {
+				v = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				th = ((Double)v.get(1)).doubleValue();
+			}
+			att.setThickness(th);
+
+			if ((dflag & 0x4)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double oblique = ((Double)v.get(1)).doubleValue();
+				att.setObliqueAngle(oblique);
+			}
+
+			if ((dflag & 0x8)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double rot = ((Double)v.get(1)).doubleValue();
+				att.setRotationAngle(rot);
+			}
+
+			v = DwgUtil.getRawDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			double height = ((Double)v.get(1)).doubleValue();
+			att.setHeight(height);
+
+			if ((dflag & 0x10)==0) {
+				v = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				double width = ((Double)v.get(1)).doubleValue();
+				att.setWidthFactor(width);
+			}
+
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String text = (String)v.get(1);
+			att.setText(text);
+
+			if ((dflag & 0x20)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int gen = ((Integer)v.get(1)).intValue();
+				att.setGeneration(gen);
+			}
+
+			if ((dflag & 0x40)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int halign = ((Integer)v.get(1)).intValue();
+				att.setHalign(halign);
+			}
+
+			if ((dflag & 0x80)==0) {
+				v = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)v.get(0)).intValue();
+				int valign = ((Integer)v.get(1)).intValue();
+				att.setValign(valign);
+			}
+
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String tag = (String)v.get(1);
+			att.setTag(tag);
+
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int fl = ((Integer)v.get(1)).intValue();
+			att.setFieldLength(fl);
+
+			v = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			int flags = ((Integer)v.get(1)).intValue();
+			att.setFlags(flags);
+
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			String prompt = (String)v.get(1);
+			att.setPrompt(prompt);
+
+			bitPos = readObjectTailer(data, bitPos, att);
+			DwgHandleReference styleHandle = new DwgHandleReference();
+			bitPos = styleHandle.read(data, bitPos);
+			att.setStyleHandle(styleHandle);
+		}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSolidReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSolidReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgSolidReader2004.java	(revision 435)
@@ -0,0 +1,117 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+
+
+/**
+ * @author azabala
+ */
+public class DwgSolidReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSolid))
+			throw new RuntimeException("ArcReader 2004 solo puede leer DwgSolid");
+		DwgSolid sol = (DwgSolid) dwgObj;
+		int bitPos = offset;
+
+		ArrayList v;
+
+		bitPos = readObjectHeader(data, bitPos, sol);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+	    double val;
+		if (flag) {
+			val=0.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			val = ((Double)v.get(1)).doubleValue();
+		}
+		sol.setThickness(val);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		val = ((Double)v.get(1)).doubleValue();
+		sol.setElevation(val);
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		double y = ((Double)v.get(1)).doubleValue();
+		double[] coord = new double[]{x, y, val};
+		sol.setCorner1(coord);
+
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner2(coord);
+
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner3(coord);
+
+
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		x = ((Double)v.get(1)).doubleValue();
+		v = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		y = ((Double)v.get(1)).doubleValue();
+		coord = new double[]{x, y, val};
+		sol.setCorner4(coord);
+
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		flag = ((Boolean)v.get(1)).booleanValue();
+		double z;
+	    if (flag) {
+			 x = y = 0.0;
+			 z = 1.0;
+		} else {
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			x = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			y = ((Double)v.get(1)).doubleValue();
+			v = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)v.get(0)).intValue();
+			z = ((Double)v.get(1)).doubleValue();
+		}
+		coord = new double[]{x, y, z};
+		sol.setExtrusion(coord);
+
+		sol.inserta();
+
+		bitPos = readObjectTailer(data, bitPos, sol);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgLayerReader2004.java	(revision 435)
@@ -0,0 +1,123 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLayerReader2004 extends AbstractDwg2004Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLayer))
+			throw new RuntimeException("LayerReader 2004 solo puede leer DwgLayer");
+
+		DwgLayer lyr = (DwgLayer) dwgObj;
+		int bitPos = offset;
+		ArrayList v;
+
+		v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int numReactors = ((Integer)v.get(1)).intValue();
+		lyr.setNumReactors(numReactors);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean XdicFlag = ((Boolean) v.get(1)).booleanValue();
+
+		v = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		String name = (String)v.get(1);
+		lyr.setName(name);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean flag = ((Boolean)v.get(1)).booleanValue();
+		lyr.setFlag64(flag);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int xrefplus1 = ((Integer)v.get(1)).intValue();
+		lyr.setXRefPlus(xrefplus1);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		boolean xdep = ((Boolean)v.get(1)).booleanValue();
+		lyr.setXdep(xdep);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)v.get(0)).intValue();
+		int flags = ((Integer)v.get(1)).intValue();
+		lyr.setFlags(flags);
+
+//		v = DwgUtil.getBitShort(data, bitPos);
+//		bitPos = ((Integer)v.get(0)).intValue();
+//		int color = ((Integer)v.get(1)).intValue();
+//		lyr.setColor(color);
+
+		//FIXME: De momento solo guardo el indice del color por compatibilidad.
+		// hay que ver qu� debemos hacer con el color
+		v = DwgUtil.getCmColor(data, bitPos, lyr.getVersion());
+		bitPos = ((Integer)v.get(0)).intValue();
+		int color = ((Integer)v.get(1)).intValue();
+		lyr.setColor(color);
+
+
+		DwgHandleReference hr = new DwgHandleReference();
+		bitPos = hr.read(data, bitPos);
+		lyr.setLayerControlHandle(hr);
+
+		lyr.inserta();
+		/*
+		 * Reactors handles
+		 * DwgObject
+		 */
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < lyr.getNumReactors(); i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			lyr.addReactorHandle(reactorHandle);
+		}
+
+		/*
+		 * XDICOBJHANDLE
+		 */
+		if(!XdicFlag){
+			DwgHandleReference xDicObjHandle = new DwgHandleReference();
+			bitPos = xDicObjHandle.read(data, bitPos);
+			lyr.setXDicObjHandle(xDicObjHandle);
+		}
+
+		DwgHandleReference nullHandle = new DwgHandleReference();
+		bitPos = nullHandle.read(data, bitPos);
+		lyr.setNullHandle(nullHandle);
+
+		DwgHandleReference plotStyleHandle = new DwgHandleReference();
+		bitPos = plotStyleHandle.read(data, bitPos);
+		lyr.setPlotStyleHandle(plotStyleHandle);
+
+
+		DwgHandleReference lineTypeHandle = new DwgHandleReference();
+		bitPos = lineTypeHandle.read(data, bitPos);
+		lyr.setLineTypeHandle(lineTypeHandle);
+
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceReader2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceReader2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v2004/DwgVertexPFaceReader2004.java	(revision 435)
@@ -0,0 +1,102 @@
+/*
+ * Created on 19-mar-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceReader15.java,v 1.1.2.1 2007/03/21 19:49:16 azabala Exp $
+* $Log: DwgVertexPFaceReader15.java,v $
+* Revision 1.1.2.1  2007/03/21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v2004;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+
+
+public class DwgVertexPFaceReader2004 extends AbstractDwg2004Reader {
+	//similar al reader de la versi�n 13-14
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+
+		 if(! (dwgObj instanceof DwgVertexPFace))
+		    	throw new RuntimeException("DwgVertexPFaceReader2004 solo puede leer DwgVertexPFace");
+		 DwgVertexPFace v = (DwgVertexPFace) dwgObj;
+
+		 int bitPos = offset;
+		 bitPos = readObjectHeader(data, bitPos, v);
+
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flags = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flags);
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+
+		 bitPos = readObjectTailer(data, bitPos, v);
+	}
+
+}
+
+
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV12Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV12Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV12Reader.java	(revision 435)
@@ -0,0 +1,2232 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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.dwg.lib.readers;
+
+import java.awt.geom.Point2D;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgObjectFactory;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+import org.gvsig.dwg.lib.objects.DwgLine;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+import org.gvsig.dwg.lib.objects.DwgSeqend;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+
+
+/**
+ * Reads version 12 dwg files.
+ * 
+ * DWG 13 and DWG 12 are very different formats (nor do DWG 13-14 and 2000).
+ * Thats the reason why this IDwgFileReader is very different from the rest. 
+ * 
+ * Documentation of reverse engineering of the format:
+ * 	http://www.iwriteiam.nl/DWG12.html
+ * 
+ * @author azabala
+ * 
+ */
+public class DwgFileV12Reader implements IDwgFileReader{
+
+	private DwgFile dwgFile;
+	private ByteBuffer bb;
+	ArrayList readers = new ArrayList();
+	private boolean r13 = false;
+	int index = 0;
+	
+	ArrayList blocks = new ArrayList();
+	
+	
+	/**
+	 * While DwgBlock is a DWG entity, readed from the DWG entities
+	 * section, a Block is an entry in the BLOCK Section of DWG 12 format.
+	 * 
+	 * Block has block name attribute (like DwgBlock), but its most
+	 * important attribute is its order in the Block section.
+	 * 
+	 * Inserts has a short number that we think is the order of its
+	 * referred block in the block table (the only approach to fech
+	 * the block of an insert)
+	 * */
+	class Block {
+		/*
+        |----------|--------------------------------------------|
+        | 1        | This is an anonymous Block generated by    |
+        |          | hatching, associative dimensioning, other  |
+        |          | internal operations, or an application     |
+        |----------|--------------------------------------------|
+        | 2        | This Block has Attributes                  |
+        |----------|--------------------------------------------|
+        | 4        | This Block is an external reference (Xref) |
+        |----------|--------------------------------------------|
+        | 8        | not used                                   |
+        |----------|--------------------------------------------|
+        | 16       | This Block is externally dependent         |
+        |----------|--------------------------------------------|
+        | 32       | This is a resolved external reference, or  |
+        |          | dependent of an external reference         |
+        |----------|--------------------------------------------|
+        | 64       | This definition is referenced              |
+        +-------------------------------------------------------+
+        */
+		byte flag;
+		String name;
+		short used;
+		
+		byte b1;
+		short w1;
+		byte b2;
+		short w3;
+		short crc;
+	}
+	
+	public DwgFileV12Reader(boolean isR13){
+		r13 = isR13;
+		readers.add(null);//0
+		readers.add(new LineReader());//1
+		readers.add(new PointReader());//2
+		readers.add(new CircleReader());//3
+		readers.add(new ShapeReader());//4
+		readers.add(null);//5
+		readers.add(null);//6
+		readers.add(new TextReader());//7
+		readers.add(new ArcReader());//8
+		readers.add(new TraceReader());//9
+		readers.add(null);//10
+		readers.add(new SolidReader());//11
+		readers.add(new BlkReader());//12
+		readers.add(new EndBlkReader());//13
+		readers.add(new InsertReader());//14
+		readers.add(new AttDefReader());//15
+		readers.add(new AttribReader());//16
+		readers.add(new SbEndReader());//17
+		readers.add(null);//18
+		readers.add(new PlineReader());//19
+		readers.add(new VertexReader());//20
+		readers.add(null);//21
+		readers.add(new Face3DReader());//22
+		readers.add(new DimReader());//23
+		readers.add(new VPortReader());//24
+	}
+	
+	
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgFileReader#read(com.iver.cit.jdwglib.dwg.DwgFile, java.nio.ByteBuffer)
+	 */
+	public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException {
+		this.dwgFile = dwgFile;
+		this.bb = bb;
+		try {
+////			handle.seek(6, 1) # skip rest of version
+//			bb.position(12);
+//			bb.position(bb.position() + 6);
+			bb.position(0);
+			byte[] header = new byte[12];
+			bb.get(header);
+			String headerStr = new String(header);
+			
+//		    (_b1, _w1, _w2, _w3, _b2) = struct.unpack("<BhhhB", handle.read(8))
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			byte b1 = bb.get();
+			short w1 = bb.getShort();
+			short w2 = bb.getShort();
+			short w3 = bb.getShort();
+			byte b2 = bb.get();
+			
+			
+			//To translate Python to Java, we must see the number
+			//of bytes of the reading
+			
+//			 _estart, _eend = struct.unpack("<ll", handle.read(8))
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			int eStart = bb.getInt();
+			int eEnd = bb.getInt();
+			
+//			_bsstart, _l1, _bsend, _l2 = struct.unpack("<llll", handle.read(16))
+			int bsStart = bb.getInt();
+			int l1 = bb.getInt();
+			
+			int bsEnd = bb.getInt();
+			int l2 = bb.getInt();
+			
+			Dwg12Table blockTable = getTable();
+			
+			Dwg12Table layerTable = getTable();
+			
+			Dwg12Table styleTable = getTable();
+			
+			Dwg12Table lineTypeTable = getTable();
+			
+			Dwg12Table viewTable = getTable();
+			
+			readHeader();
+			
+			Dwg12Table ucsTable = getTable();
+			
+			bb.position(0x500);
+			
+			Dwg12Table vportTable = getTable();
+			
+			bb.position(bb.position() + 8);
+			
+			Dwg12Table appidTable = getTable();
+			
+			bb.position(bb.position() + 6);
+			
+			Dwg12Table dimStyleTable = getTable();
+			bb.position(0x69f);
+			
+			Dwg12Table p13table = getTable();
+			
+			bb.position(bb.position() + 38);
+			
+			int currentPosition = bb.position();
+			if(currentPosition != eStart){
+				//Se supone que deber�amos estar en eStart
+				throw new RuntimeException("Error: no se ha llegado al principio de las entidades de dibujo");
+			}
+			
+			//lee primero entidades normales?
+			readEntities(eStart, eEnd);
+			
+			bb.position(bb.position() + 19);
+			
+			readBlockTable(blockTable);
+			readLayerTable(layerTable);
+			
+//de momento nos saltamos estas tablas
+//			readStyleTable(styleTable);
+//			readLTypeTable(lineTypeTable);
+//			readViewTable(viewTable);
+//			readUcsTable(ucsTable);
+//			readVportTable(vportTable);
+//			readAppidTable(appidTable);
+//			readDimStyleTable(dimStyleTable);
+//			readP13Table(p13table);
+			
+			//luego lee entidades de bloque
+			readEntities(bsStart, bsEnd);
+			
+			bb.position(bb.position() + 36);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			
+			int peStart, peEnd, pbStart, pbEnd;
+			
+			peStart = bb.getInt();
+			peEnd = bb.getInt();
+			pbStart = bb.getInt();
+			pbEnd = bb.getInt();
+			
+			if(peStart != eStart)
+				System.out.println("peStart="+peStart+" eStart="+eStart);
+			
+			if(peEnd != eEnd)
+				System.out.println("peStart="+peEnd+" eStart="+eEnd);
+			
+			if(pbStart != bsStart)
+				System.out.println("peStart="+pbStart+" eStart="+bsStart);
+			
+			if(bsEnd != pbEnd)
+				System.out.println("peStart="+pbStart+" eStart="+bsStart);
+		   
+			bb.position(bb.position() + 12);
+			
+			Dwg12TableTest bts = getTableTest();
+			
+			Dwg12TableTest lyrTs = getTableTest();
+			
+			Dwg12TableTest sts = getTableTest();
+			
+			Dwg12TableTest ltts = getTableTest();
+			
+			Dwg12TableTest vts = getTableTest();
+			
+			Dwg12TableTest uts = getTableTest();
+			
+			Dwg12TableTest vpts = getTableTest();
+			
+			Dwg12TableTest ats = getTableTest();
+			
+			Dwg12TableTest dts = getTableTest();
+			
+			Dwg12TableTest pts = getTableTest();
+			
+			
+			
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+//			logger.error(e);
+		}
+	}
+	
+	
+	private void readP13Table(Dwg12Table p13table) {
+		// TODO Auto-generated method stub
+	}
+
+
+
+	private void readDimStyleTable(Dwg12Table dimStyleTable) {
+		short size = dimStyleTable.s1;
+		int numRecs = dimStyleTable.i1;
+		int start = dimStyleTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short word = bb.getShort();
+			
+			double[] d4048 = new double[9];
+			for(int j = 0; j < 9; j++){
+				d4048[j] = bb.getDouble();
+			}
+			
+			double[] d40145 = new double[6];
+			for(int j = 0; j < 6; j++){
+				d40145[j] = bb.getDouble();
+			}
+			
+			byte[] b7078 = new byte[7];
+			for(int j = 0; j < 7; j++){
+				b7078[j] = bb.get();
+			}
+			
+			byte[] b170175 = new byte[6];
+			for(int j = 0; j < 6; j++){
+				b170175[j] = bb.get();
+			}
+			
+			bb.order(ByteOrder.nativeOrder());
+			byte[] s3 = new byte[16];
+			bb.get(s3);
+			
+			byte[] s4 = new byte[16];
+			bb.get(s4);
+			
+			byte[] s5 = new byte[32];
+			bb.get(s5);
+			
+			byte[] s6 = new byte[32];
+			bb.get(s6);
+			
+			byte[] s7 = new byte[32];
+			bb.get(s6);
+			
+			bb.position(bb.position() + 3);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w176 = bb.getShort();
+			short w177 = bb.getShort();
+			short w178 = bb.getShort();
+			
+			double d146 = bb.getDouble();
+			double d147 = bb.getDouble();
+			
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short crc = bb.getShort();
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	private void readAppidTable(Dwg12Table appidTable) {
+		short size = appidTable.s1;
+		int numRecs = appidTable.i1;
+		int start = appidTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short word = bb.getShort();
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short crc = bb.getShort();
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	private void readVportTable(Dwg12Table vportTable) {
+		short size = vportTable.s1;
+		int numRecs = vportTable.i1;
+		int start = vportTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short used = bb.getShort();
+			
+			double[] pt10 = getPoint(false);
+			double[] pt11 = getPoint(false);
+			double[] pt17 = getPoint(false);
+			double[] pt16 = getPoint(true);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			
+			double d50 = bb.getDouble();
+			double d40 = bb.getDouble();
+			
+			double[] pt12 = getPoint(false);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d41 = bb.getDouble();
+			double d42 = bb.getDouble();
+			double d43 = bb.getDouble();
+			double d44 = bb.getDouble();
+			
+			short[] w7178 = new short[8];
+			for(int j = 0; j < 8; j++){
+				w7178[j] = bb.getShort();
+			}
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d51 = bb.getDouble();
+			
+			double[] pt13 = getPoint(false);
+			double[] pt14 = getPoint(false);
+			double[] pt15 = getPoint(false);
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short crc = bb.getShort();
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	private void readUcsTable(Dwg12Table ucsTable) {
+		short size = ucsTable.s1;
+		int numRecs = ucsTable.i1;
+		int start = ucsTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short used = bb.getShort();
+			
+			double[] pt10 = getPoint(true);
+			double[] pt11 = getPoint(true);
+			double[] pt12 = getPoint(true);
+			
+			
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short crc = bb.getShort();
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+		
+		
+	}
+
+
+
+	private void readViewTable(Dwg12Table viewTable) {
+		short size = viewTable.s1;
+		int numRecs = viewTable.i1;
+		int start = viewTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short used = bb.getShort();
+			double db40 = bb.getDouble();
+			
+			double[] pt10 = getPoint(false);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double db41 = bb.getDouble();
+			
+			double[] pt11 = getPoint(true);
+			
+			double[] pt12 = getPoint(true);
+			
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w71 = bb.getShort();
+			double db42 = bb.getDouble();
+			double db43 = bb.getDouble();
+			double db44 = bb.getDouble();
+			double db50 = bb.getDouble();
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short crc = bb.getShort();
+			
+			
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	private void readLTypeTable(Dwg12Table lineTypeTable) {
+		short size = lineTypeTable.s1;
+		int numRecs = lineTypeTable.i1;
+		int start = lineTypeTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w1 = bb.getShort();
+			
+			byte[] s1 = new byte[48];
+			bb.get(s1);
+			String s1name = new String(s1);
+			
+			bb.order(ByteOrder.nativeOrder());
+			byte b1 = bb.get();
+			byte b2 = bb.get();
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double[] doubles = new double[13];
+			for(int j = 0; j < 13; j++){
+				doubles[j] = bb.getDouble();
+			}
+			
+			short crc = bb.getShort();
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	/**
+	 * @param styleTable
+	 */
+	private void readStyleTable(Dwg12Table styleTable) {
+		short size = styleTable.s1;
+		int numRecs = styleTable.i1;
+		int start = styleTable.i2;
+		int end = -1;
+		bb.position(start);
+		for(int i = 0; i < numRecs; i++){
+			end = bb.position() + size;
+			byte flag = bb.get();
+			byte[] nameBytes = new byte[32];
+			bb.get(nameBytes);
+			String name = new String(nameBytes);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w1 = bb.getShort();
+			double d1 = bb.getDouble();
+			double d2 = bb.getDouble();
+			double d3 = bb.getDouble();
+			byte b1 = bb.get();
+			double d4 = bb.getDouble();
+			
+			byte[] s1 = new byte[128];
+			bb.get(s1);
+			
+			short crc = bb.getShort();
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+
+	/**
+	 * @param layerTable
+	 */
+	private void readLayerTable(Dwg12Table layerTable) {
+		short size = layerTable.s1;
+		int numR = layerTable.i1;
+		int start = layerTable.i2;
+		
+		int begin = -1;
+		int end = -1;
+		
+		DwgLayer layer = null;
+		for(int i = 0; i < numR; i++){
+			begin = start + i * size;
+			bb.position(begin);
+			end = begin + size - 2;
+			
+			layer = new DwgLayer(index);
+			index++;
+			
+			byte flag = bb.get();
+			/*
+			 +=====================================================+
+          | Flag bit | Meaning                                  |
+          | value    |                                          |
+          |----------|------------------------------------------|
+          | 1        | If set, layer is frozen                  |
+          |----------|------------------------------------------|
+          | 2        | If set, layer is frozen by default in    |
+          |          | new Viewports                            |
+          |----------|------------------------------------------|
+          | 4        | If set, layer is locked                  |
+          +-----------------------------------------------------+
+			 * */
+			if((flag & 0x1) > 0){
+				layer.setFrozen(true);
+			}
+			if((flag & 0x2) > 0){
+				layer.setFrozenInNew(true);
+			}
+			if((flag & 0x4) > 0){
+				layer.setLocked(true);
+			}
+			
+			byte[] nameByte = new byte[32];
+			bb.get(nameByte);
+			String name = new String(nameByte).trim();
+			layer.setName(name);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short used = bb.getShort();
+			short color = bb.getShort();
+			layer.setColor(color);
+			short style = bb.getShort();
+			short crc = bb.getShort();
+
+			DwgHandleReference handle = new DwgHandleReference(0x5, i);
+			layer.setHandle(handle);
+			dwgFile.addDwgObject(layer);
+			
+			
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + offset);
+			
+		}
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+
+	interface EntityReader{
+		void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj);
+	}
+	
+	/**
+	 * In DWG 12 version, some kind of objects (Polylines and Vertex) cannot be
+	 * instanciated until the EntityReader has readed some stuff (flags and so)
+	 * from the file.
+	 * 
+	 * DefferedEntityReader has the responsability to create DwgObject instances,
+	 * and it has the precondition that DwgObject parameter of its method read must
+	 * be null.
+	 * */
+	abstract class DefferedEntityReader implements EntityReader{
+		abstract DwgObject getDwgObject(int index);
+		
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj){
+			if(dwgObj != null)
+				throw new RuntimeException("DefferedEntityReader es el encargado de construir los objetos, debe recibirlos a null");
+		}
+		
+	}
+	
+	class LineReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgLine))
+				throw new RuntimeException("No es entidad LINE");
+			DwgLine line = (DwgLine) dwgObj;
+			
+			boolean zflag = true;
+			if( (flags & 0x4) > 0)
+				zflag = false;
+			
+			double[] pt10 = getPoint(zflag);
+			double[] pt11 = getPoint(zflag);
+			
+			line.setP1(pt10);
+			line.setP2(pt11);
+			
+			if((opts & 0x1) > 0){
+				double[] pt210 = getPoint(true);
+				line.setExtrusion(pt210);
+			}
+			
+			if((opts & 0x2) > 0){
+				/*
+				 * This field is only found in DWG12 prev
+				 * files. Since DWG 12, elevation is saved
+				 * in third coordinate of points.
+				 * 
+				 * */
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+				line.getP1()[2] = db38;
+				line.getP2()[2] = db38;
+			}
+		}
+	}
+	
+	
+	
+	class PointReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgPoint))
+				throw new RuntimeException("No es entidad POINT");
+			DwgPoint point = (DwgPoint) dwgObj;
+			boolean zflag = true;
+			if((flags & 0x4) > 0)
+				zflag = false;
+			double[] pt10 = getPoint(zflag);
+			point.setPoint(pt10);
+			
+			if((opts & 0x1) > 0){
+				double[] pt210 = getPoint(true);
+				point.setExtrusion(pt210);
+			}
+			
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+				point.getPoint()[2] = db38;
+			}
+		}
+	}
+	
+	
+	class CircleReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgCircle))
+				throw new RuntimeException("No es entidad CIRCLE");
+			DwgCircle circle = (DwgCircle) dwgObj;
+			
+			boolean zflag = true;
+			if((flags & 0x4) > 0)
+				zflag = false;
+			double[] pt10 = getPoint(zflag);
+			circle.setCenter(pt10);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d40 = bb.getDouble();
+			circle.setRadius(d40);
+			
+			double[] pt210 = null;
+			if((opts & 0x1) > 0){
+				pt210 = getPoint(true);
+				
+			}else{
+				pt210 = new double[]{0,0,1};
+			}
+			circle.setExtrusion(pt210);
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+				circle.getCenter()[2] = db38;
+			}
+		}
+	}
+	
+	
+	
+	class ShapeReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			
+			//TODO POR IMPLEMENTAR DwgShape (referencia a un
+			//fichero de texto)
+			
+			double[] pt10 = getPoint(false);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w2 = bb.getShort();
+			if((opts & 0x1) > 0){
+				double[] pt210 = getPoint(true);
+			}
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+			}
+		}
+	}
+	
+	public String getString(){
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short len = bb.getShort();
+		byte[] bytes = new byte[len];
+		bb.order(ByteOrder.nativeOrder());
+		bb.get(bytes);
+		return new String(bytes);
+	}
+	
+	
+	class TextReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			
+			if(! (dwgObj instanceof DwgText))
+				throw new RuntimeException("No es entidad TEXT");
+			DwgText txt = (DwgText) dwgObj;
+			
+			
+			double[] pt10 = getPoint(false);
+			txt.setInsertionPoint(new Point2D.Double(pt10[0], pt10[1]));
+			
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double db40 = bb.getDouble();
+			txt.setHeight(db40);
+			
+			
+			
+			String text = getString();
+			txt.setText(text);
+			if((opts & 0x1) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db50 = bb.getDouble();
+				txt.setRotationAngle(db50);
+			}
+			if((opts & 0x2) > 0){
+				double db41 = bb.getDouble();
+				txt.setWidthFactor(db41);//TODO 41 es width factor seguro?
+			}
+			if((opts & 0x4) > 0){
+				double db51 = bb.getDouble();
+				txt.setObliqueAngle(db51);
+			}
+			if((opts & 0x8) > 0){
+				byte b7 = bb.get();
+			}
+			if((opts & 0x10) > 0){
+				byte b71 = bb.get();
+				//parametros de mirroring
+				txt.setGeneration(b71);
+			}
+			if((opts & 0x20) > 0){
+				byte b72 = bb.get();
+				txt.setHalign(b72);
+			}
+			if((opts & 0x40) > 0){
+				double[] pt11 = getPoint(false);
+				txt.setAlignmentPoint(new Point2D.Double(pt11[0], pt11[1]));
+			}
+			if((opts & 0x100) > 0){
+				byte b73 = bb.get();
+				txt.setValign(b73);
+			}
+			
+			//TODO La especificaci�n DXF 12 dice que la extrusion 
+			//codigos DXF 210, 220, 230 se aplica sobre:
+			/*
+			 Line, Point, Circle, Shape, Text, Arc, Trace,
+			 Solid, Block Reference, Polyline, 
+			  Dimension, Attribute, and Attribute Definition entity
+			  
+			  Pero aqu� no aparece por ningun lado la extrusion
+			 * */
+			double[] ext = new double[]{0, 0, 1};
+			txt.setExtrusion(ext);
+		}
+	}
+	
+	
+	class ArcReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgArc))
+				throw new RuntimeException("No es entidad ARC");
+			DwgArc arc = (DwgArc) dwgObj;
+			
+			double[] pt10 = getPoint(false);
+			arc.setCenter(pt10);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d40 = bb.getDouble();
+			arc.setRadius(d40);
+			
+			double d50 = bb.getDouble();
+			arc.setInitAngle(d50);
+			
+			double d51 = bb.getDouble();
+			arc.setEndAngle(51);
+			
+			double[] pt210 = null;
+			if((opts & 0x1) > 0){
+				pt210 = getPoint(true);
+				arc.setExtrusion(pt210);
+			}else{
+				pt210 = new double[]{1, 0, 0};
+			}
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+				arc.getCenter()[2] = db38;
+			}
+		}
+	}
+	
+	
+	
+	class TraceReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			//TODO Implementar DwgTrace
+			double[] pt10 = getPoint(false);
+			double[] pt11 = getPoint(false);
+			double[] pt12 = getPoint(false);
+			double[] pt13 = getPoint(false);
+			if((opts & 0x1) > 0){
+				double[] pt210 = getPoint(true);
+			}
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+			}
+		}
+	}
+	
+	class SolidReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgSolid))
+				throw new RuntimeException("No es entidad SOLID");
+			DwgSolid solid = (DwgSolid) dwgObj;
+			
+			
+			
+			double[] pt11 = getPoint(false);
+			solid.setCorner1(pt11);
+			
+			double[] pt12 = getPoint(false);
+			solid.setCorner2(pt12);
+			
+			double[] pt13 = getPoint(false);
+			solid.setCorner3(pt13);
+			
+			double[] pt14 = getPoint(false);
+			solid.setCorner4(pt14);
+			
+			
+			if((opts & 0x1) > 0){
+				double[] pt210 = getPoint(true);
+				solid.setExtrusion(pt210);
+			}
+			if((opts & 0x2) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double db38 = bb.getDouble();
+				solid.getCorner1()[2] = db38;
+				solid.getCorner2()[2] = db38;
+				solid.getCorner3()[2] = db38;
+				solid.getCorner4()[2] = db38;
+			}
+			
+			solid.setExtrusion(new double[]{0, 0, 1});
+		}
+	}
+	
+	
+	private Block getBlock(String blockName){
+		for(int i = 0; i < blocks.size(); i++){
+			Block block = (Block) blocks.get(i);
+			if(block.name.equalsIgnoreCase(blockName)){
+				return block;
+			}
+		}
+		return null;
+	}
+	
+	
+	
+	class BlkReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgBlockHeader))
+				throw new RuntimeException("No es entidad BLOCK");
+			DwgBlockHeader blk = (DwgBlockHeader) dwgObj;
+			
+			
+			double[] pt10 = getPoint(false);
+			blk.setBasePoint(pt10);
+			String blockName = getString();
+			blk.setName(blockName);
+			Block block = getBlock(blockName);
+			if(block == null){
+				System.out.println(blockName+" no encontrado en la tabla de bloques");
+			}
+			
+			if((opts & 0x2) > 0)
+			{
+				//puede ser que se trate de referencias
+				//externas??
+				String s3 = getString();
+			}
+			
+			if((flags & 1) > 0){
+				blk.setAnonymous(true);
+			}
+			
+			if((flags & 2) > 0){
+				blk.setHasAttrs(true);
+			}
+			
+			if((flags & 4) > 0){
+				blk.setBlkIsXRef(true);
+			}
+			
+			if((flags & 16) > 0){
+				blk.setXdep(true);
+			}
+			
+			if((flags & 32) > 0){
+				blk.setXRefOverLaid(true);
+			}
+			
+			if((flags & 64) > 0){
+				blk.setLoaded(true);
+			}
+			
+			
+			/*
+			
+			   1        | This is an anonymous Block generated by    |
+	          |          | hatching, associative dimensioning, other  |
+	          |          | internal operations, or an application     |
+	          |----------|--------------------------------------------|
+	          | 2        | This Block has Attributes                  |
+	          |----------|--------------------------------------------|
+	          | 4        | This Block is an external reference (Xref) |
+	          |----------|--------------------------------------------|
+	          | 8        | not used                                   |
+	          |----------|--------------------------------------------|
+	          | 16       | This Block is externally dependent         |
+	          |----------|--------------------------------------------|
+	          | 32       | This is a resolved external reference, or  |
+	          |          | dependent of an external reference         |
+	          |----------|--------------------------------------------|
+	          | 64       | This definition is referenced       
+			
+			*/
+		
+		}
+	}
+	class EndBlkReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+		}
+	}
+	
+	class InsertReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			if(! (dwgObj instanceof DwgInsert))
+				throw new RuntimeException("No es entidad INSERT");
+			DwgInsert insert = (DwgInsert) dwgObj;
+			
+			bb.order(ByteOrder.nativeOrder());
+			short w1 = bb.getShort();//Puede ser este el identificador de bloque???
+			
+			DwgHandleReference blockHandle = new 
+				DwgHandleReference(0x5, w1);
+			insert.setBlockHeaderHandle(blockHandle);
+			
+			double[] pt10 = getPoint(false);
+			insert.setInsertionPoint(pt10);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			
+			double x = 0d, y = 0d, z = 0d;
+			
+			if((opts & 0x1) > 0){
+				double db41 = bb.getDouble();
+				x = db41;
+			}
+			
+			if((opts & 0x2) > 0){
+				double db42 = bb.getDouble();
+				y = db42;
+			}
+			
+			if((opts & 0x4) > 0){
+				double db43 = bb.getDouble();
+				z = db43;
+			}
+			
+			insert.setScale(new double[]{x, y, z});
+			
+			if((opts & 0x8) > 0){
+				double db50 = bb.getDouble();
+				insert.setRotation(db50);
+			}
+			
+			if((opts & 0x10) > 0){
+				short w70 = bb.getShort();
+				//column counts
+			}
+			//creo que esto est� mal, y que debe poner 0x20
+			if((opts & 0x10) > 0){
+				short w71 = bb.getShort();
+				//row counts
+			}
+			
+			if((opts & 0x40) > 0){
+				double db44 = bb.getDouble();
+				//column spacing
+			}
+			
+			if((opts & 0x80) > 0){
+				double db45 = bb.getDouble();
+				//row spacing
+			}
+			insert.setExtrusion(new double[]{0, 0, 1});
+		}
+	}
+	
+	class AttDefReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			double[] p10 = getPoint(false);
+			String s1 = getString();
+			String s3 = getString();
+			String s2 = getString();
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			byte b70 = bb.get();
+			
+			if((opts & 0x1) > 0){
+				byte b73 = bb.get();
+			}
+			
+			if((opts & 0x2) > 0){
+				double d50 = bb.getDouble();
+			}
+			
+			if((opts & 0x4) > 0){
+				double d41 = bb.getDouble();
+			}
+			
+			if((opts & 0x8) > 0){
+				double d42 = bb.getDouble();
+			}
+			
+			if((opts & 0x10) > 0){
+				byte b7 = bb.get();
+			}
+			
+			if((opts & 0x20) > 0){
+				byte b71 = bb.get();
+			}
+			
+			if((opts & 0x40) > 0){
+				byte b72 = bb.get();
+			}
+			
+			if((opts & 0x80) > 0){
+				double[] p11 = getPoint(false);
+			}
+			
+			if((opts & 0x100) > 0){
+				double[] p210 = getPoint(true);
+			}
+			
+			if((opts & 0x200) > 0){
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				double d38 = bb.getDouble();
+			}
+		}
+	}
+	
+	class AttribReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			double[] p10 = getPoint(false);
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d40 = bb.getDouble();
+			
+			String s1 = getString();
+			String s2 = getString();
+			
+			if((opts & 0x1) > 0){
+				byte b73 = bb.get();
+			}
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			if((opts & 0x2) > 0){
+				double d50 = bb.getDouble();	
+			}
+			
+			if((opts & 0x4) > 0){
+				double d41 = bb.getDouble();	
+			}
+			
+			if((opts & 0x8) > 0){
+				double d42 = bb.getDouble();	
+			}
+			
+			if((opts & 0x10) > 0){
+				byte b7 = bb.get();
+			}
+			
+			if((opts & 0x20) > 0){
+				byte b71 = bb.get();
+			}
+			
+			if((opts & 0x40) > 0){
+				byte b72 = bb.get();
+			}
+			
+			if((opts & 0x80) > 0){
+				double[] p11 = getPoint(false);
+			}
+			double[] p210 = null;
+			if((opts & 0x100) > 0){
+				p210 = getPoint(true);
+			}else{
+				p210 = new double[]{0, 0, 1};
+			}
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			if((opts & 0x200) > 0){
+				double d38 = bb.getDouble();
+			}
+		}
+	}
+	
+	
+	class SbEndReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			int l = bb.getInt();
+		}
+	}
+	
+	class PlineReader extends DefferedEntityReader{
+		
+		/*
+		 * CURVE TYPE CONSTANTS
+		 * */
+		final static int CLOSED       = 0x01;//if line is a mesh, curve closed in M direction
+		final static int CURVE_FIT    = 0x02;
+		final static int SPLINE_FIT     = 0x04;
+		final static int PLINE3D    = 0x08;
+		final static int MESH          = 0x10;
+		final static int MESH_CLOSED   = 0x20;//curve closed in N direction
+		final static int ANY_MESH = 0x30;  //MESH | MESH_CLOSED
+		final static int PFACE          = 0x40;
+		final static int CONT_LTYPE   = 0x80;
+		
+		/*
+		 * polyline attributes
+		 * */
+		/**
+		 * flag: curve type (CLOSED, MESH,PFACE, etc.)
+		 * */
+		byte flag70;
+		/**
+		 * Number of points in M direction for a Mesh,
+		 * number of vertices for a PFace polyline
+		 * */
+		byte meshM71;
+		/**
+		 * Number of points in N direction for a Mesh,
+		 * number of faces for a PFace polyline
+		 * */
+		byte meshN72;
+		double startW40;
+		byte smoothM73;
+		byte smoothN74;
+		byte curveType75;
+		
+		
+		private void reset(){
+			flag70 = 0;
+			meshM71 = 0;
+			meshN72 = 0;
+			startW40 = 0;
+			smoothM73 = 0;
+			smoothN74 = 0;
+			curveType75 = 0;
+		}
+		
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			super.read(bb, flags, opts, dwgObj);
+			
+			//TODO El byte 70 es el que determina el tipo de Polyline
+			if( (opts & 0x1) > 0){
+				flag70 = bb.get();
+			}
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			if( (opts & 0x2) > 0){
+				startW40 = bb.getDouble();
+			}
+			
+			if( (opts & 0x4) > 0){
+				meshM71 = bb.get();
+			}
+			
+			if( (opts & 0x8) > 0){
+				meshN72 = bb.get();
+			}
+			
+			if( (opts & 0x10) > 0){
+				smoothM73 = bb.get();
+			}
+			
+			if( (opts & 0x20) > 0){
+				smoothN74 = bb.get();
+			}
+			
+			if( (opts & 0x40) > 0){
+				curveType75 = bb.get();
+			}
+		}
+
+		DwgObject getDwgObject(int index) {
+			DwgObject solution = null;
+			boolean isSpline = (flag70 & SPLINE_FIT) != 0 ? true: false;
+			if( (flag70 & PFACE) != 0){
+				//PFacePolyline
+				solution = new DwgPFacePolyline(index);
+//	often made wrong, so we have to correct...TODO Revisar
+				if(meshM71 <= 0)
+					meshM71 = 16;
+				if(meshN72 <= 0)
+					meshN72 = 4;
+				((DwgPFacePolyline)solution).setVertexCount(meshM71);
+				((DwgPFacePolyline)solution).setFaceCount(meshN72);
+			}else if((flag70 & ANY_MESH) != 0){
+				//Mesh, closed or not
+				solution = new DwgMeshPolyline(index);
+				boolean isClosedM = (flag70 & CLOSED) != 0 ? true: false;
+				boolean isClosedN = (flag70 & MESH_CLOSED) > 0 ? true: false;
+				
+				((DwgMeshPolyline)solution).setClosedM(isClosedM);
+				((DwgMeshPolyline)solution).setClosedN(isClosedN);
+				if(isSpline){
+					((DwgMeshPolyline)solution).setMVerticies(smoothM73);
+					((DwgMeshPolyline)solution).setNVerticies(smoothN74);
+				}else{
+					((DwgMeshPolyline)solution).setMVerticies(meshM71);
+					((DwgMeshPolyline)solution).setNVerticies(meshN72);
+				}
+				((DwgMeshPolyline)solution).setCurveType(curveType75);
+			}else{
+				//polyline
+				boolean is3DPolyline = (flag70 & PLINE3D) != 0 ? true: false;
+				if(is3DPolyline)
+				{
+					solution = new DwgPolyline3D(index);
+					boolean isClosed = (flag70 & CLOSED) != 0 ? true: false;
+					//for compatibility with dwg 13 and later, we use a byte flag for
+					//closed and spline properties
+					((DwgPolyline3D)solution).setClosedFlags(isClosed ? 0x1: 0x0);
+					((DwgPolyline3D)solution).setSplineFlags(isSpline ? 0x1: 0x0);
+					
+				}else{
+					solution = new DwgPolyline2D(index);
+					((DwgPolyline2D)solution).setCurveType(curveType75);
+					((DwgPolyline2D)solution).setInitWidth(startW40);
+				}
+			}
+			
+			reset();
+			
+			return solution;
+		}
+	}
+	
+	class VertexReader extends DefferedEntityReader{
+		final static int FIT_POINT    = 0x01;
+		final static int TANGENT      = 0x02;
+		final static int SPLINE_LINE_FIT     = 0x08;
+	    final static int SPLINE_CONTROL_POINT      = 0x10;
+	    final static int POLYLINE_3D      = 0x20;
+		final static int MESH_3D       = 0x40;
+		final static int PFACE_MESH  = 0x80;
+		
+		/**
+		 * Coordinates of the vertex
+		 * */
+		double[] pt10;
+		
+		/**
+		 * Start width of the vertex. If 0, it will
+		 * use the start with of the owner polyline.
+		 * */
+		double startWidth40;
+		/**
+		 * End width of the vertex. If 0, it will
+		 * use the end with of the owner polyline.
+		 * */
+		double endWidth41;
+		
+		/**
+		 * Bulge of the vertex
+		 * */
+		double tangentDir50;
+		
+		/**
+		 * Flag that maks what kind of vertex is:
+          1        | Extra vertex created by curve-fitting       |
+          2        | Curve-fit tangent defined for this vertex.  |
+          |          | A curve-fit tangent direction of 0 may be   |
+          |          | omitted from the DXF output, but is         |
+          |          | significant if this bit is set              |
+          |----------|---------------------------------------------|
+          | 4        | Unused (never set in DXF files)             |
+          |----------|---------------------------------------------|
+          | 8        | Spline vertex created by spline-fitting     |
+          |----------|---------------------------------------------|
+          | 16       | Spline frame control point                  |
+          |----------|---------------------------------------------|
+          | 32       | 3D Polyline vertex                          |
+          |----------|---------------------------------------------|
+          | 64       | 3D polygon mesh vertex                      |
+          |----------|---------------------------------------------|
+          | 128      | Polyface mesh vertex                        |
+          +--------------------------------------------------------+
+		 * */
+		byte vertexFlag70;
+		
+		/**
+		 * If the vertex is a pfaceface vertex it hasnt real coordinates.
+		 * Instead it has an index for each vertex of the mesh's face
+		 * */
+		int[] pfacefaceIndex;
+		
+		void reset(){
+			pt10 = null;
+			startWidth40 = 0;
+			endWidth41 = 0;
+			tangentDir50 = 0;
+			vertexFlag70 = 0;
+			pfacefaceIndex = null;
+		
+		}
+		
+		/*
+		 * azabala
+		 * Nos estabamos encontrando con vertices muy raros
+		 * (e incluso con valores NaN) cuando el valor de opts
+		 * es 16872, si seguiamos al pie de la letra la especificaci�n
+		 * de http://www.iwriteiam.nl/DWG12.html o Pythoncad.
+		 * 
+		 * Haciendo un poco de ingenieria inversa hemos visto que
+		 * si opts==16872, hay que modificar el algoritmo 
+		 * */
+		
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			super.read(bb, flags, opts, dwgObj);
+			if(opts != 16872){
+				int position = bb.position();
+				pt10 = getPoint(false);
+if(pt10[0] < 0 || pt10[0] < 600000 || pt10[0] > 800000){
+System.currentTimeMillis();
+}
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				if((opts & 0x1) > 0){
+					startWidth40 = bb.getDouble();
+				}
+				if((opts & 0x2) > 0){
+					endWidth41 = bb.getDouble();
+				}
+				if((opts & 0x4) > 0){
+					tangentDir50 = bb.getDouble();
+				}
+				if((opts & 0x8) > 0){
+					vertexFlag70 = bb.get();
+				}
+			}else{
+				//if opts == 16872 (decimal) we invert the
+				//order of the reading
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				if((opts & 0x1) > 0){
+					startWidth40 = bb.getDouble();
+				}
+				if((opts & 0x2) > 0){
+					endWidth41 = bb.getDouble();
+				}
+				if((opts & 0x4) > 0){
+					tangentDir50 = bb.getDouble();
+				}
+				if((opts & 0x8) > 0){
+					vertexFlag70 = bb.get();
+				}
+				int p1 = bb.getShort();
+				int p2 = bb.getShort();
+				int p3 = bb.getShort();
+				int p4 = bb.getShort();
+				
+				pfacefaceIndex = new int[]{p1,p2,p3,p4};
+			}
+			
+			
+			
+		}
+
+		DwgObject getDwgObject(int index) {
+			DwgObject solution = null;
+			if( (vertexFlag70 & PFACE_MESH) != 0){
+				//It is a PFace Mesh Vertex
+				if( (vertexFlag70 & MESH_3D) != 0){
+					solution = new DwgVertexPFace(index);
+					((DwgVertexPFace)solution).setPoint(pt10);
+					((DwgVertexPFace)solution).setFlags(vertexFlag70);
+				}else{
+					/*
+					azabala
+					 DXF 12 spec says:
+					 	"If the Vertex defines a face of the mesh, 
+					 	its Vertex flags (70) group has the 128 bit 
+					 	set but not the 64 bit. The 10, 
+					 	20, and 30 (location) groups of the face entity are 
+					 	irrelevant and are always written as zero in a DXF file. 
+					 	The vertex indexes that define the mesh are given by 71, 
+					 	72, 73, and 74 groups, the values of which are integers 
+					 	specifying one of the previously defined vertices by 
+					 	index. 
+					 	If the index is negative, the edge that begins with 
+					 	that vertex is invisible. 
+					 	
+					 	The first zero vertex marks the 
+					 	end of the vertices of the face. 
+					 	
+					 	Since the 71 through 74 
+					 	groups are optional fields with default values of zero, 
+					 	they are present in DXF only if nonzero."
+					 	
+					 But DWG 12 spec doesnt say anything about 71,72,73 and
+					 74 fields for VERTEX.	
+					 * */
+					solution = new DwgVertexPFaceFace(index);
+					((DwgVertexPFaceFace)solution).setVerticesidx(pfacefaceIndex);
+				}
+			}else if( (vertexFlag70 & POLYLINE_3D) != 0){
+				solution = new DwgVertex3D(index);
+				((DwgVertex3D)solution).setPoint(pt10);
+				((DwgVertex3D)solution).setFlags(vertexFlag70);
+			}else{
+				solution = new DwgVertex2D(index);
+				((DwgVertex2D)solution).setPoint(pt10);
+				((DwgVertex2D)solution).setFlags(vertexFlag70);
+			}
+			
+			reset();
+			return solution;
+		}
+	}
+	
+	class Face3DReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			boolean zflag = false;
+			if((flags & 0x4) > 0){
+				zflag = true;
+			}
+			double[] pt10 = getPoint(zflag);
+			double[] pt11 = getPoint(zflag);
+			double[] pt12 = getPoint(zflag);
+			double[] pt13 = getPoint(zflag);
+		
+		}
+	}
+	
+	class DimReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			short w1 = bb.getShort();
+			double[] pt10 = getPoint(true);
+			double[] pt11 = getPoint(false);
+			
+			if((opts & 0x2) > 0){
+				byte b70 = bb.get();
+			}
+			
+			if((opts & 0x1) > 0){
+				double[] pt12 = getPoint(true);
+			}
+			
+			if((opts & 0x4) > 0){
+				String s1 = getString();
+			}
+			
+			if((opts & 0x8) > 0){
+				double[] pt13 = getPoint(true);
+			}
+			
+			if((opts & 0x10) > 0){
+				double[] pt13 = getPoint(true);
+			}
+			
+			if((opts & 0x20) > 0){
+				double[] pt15 = getPoint(true);
+			}
+			
+			if((opts & 0x40) > 0){
+				double[] pt16 = getPoint(true);
+			}
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			if((opts & 0x80) > 0){
+				double d40 = bb.getDouble();
+			}
+			
+			if((opts & 0x100) > 0){
+				double d50 = bb.getDouble();
+			}
+			
+			if((opts & 0x200) > 0){
+				double d51 = bb.getDouble();
+			}
+			if((opts & 0x400) > 0){
+				double d52 = bb.getDouble();
+			}
+			if((opts & 0x800) > 0){
+				double d53 = bb.getDouble();
+			}
+		}
+	}
+	
+	class VPortReader implements EntityReader{
+		public void read(ByteBuffer bb, byte flags, short opts, DwgObject dwgObj) {
+			double[] pt10 = getPoint(true);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			double d40 = bb.getDouble();
+			double d41 = bb.getDouble();
+			short w68 = bb.getShort();
+		}
+	}
+	
+	/**
+	 * @param start
+	 * @param end
+	 */
+	private void readEntities(int start, int end) {
+		bb.position(start);
+		int ant = bb.position();
+		int emax = readers.size();
+		EntityReader reader = null;
+		
+		/*
+		 * it isnt null until well finish to read the vertices
+		 * of a given polyline (seqend found)
+		 * 
+		 */
+		IDwgPolyline currentPolyline = null;
+		
+		/*
+		 * Not null when a DwgBlock is found, it will be null
+		 * when a DwgEndBlk found. While this, all entities readed
+		 * will be added to currentBlock
+		 * */
+		DwgBlockHeader currentBlock = null;
+		
+		while(ant < (end - 32)){
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			
+			byte kind = bb.get();
+			if(kind < emax){
+				reader = (EntityReader) readers.get(kind);
+			}//if
+			
+			
+			//PROPERTIES COMMON TO ALL DWG 12 ENTITIES
+			byte flag = bb.get();
+			short lenght = bb.getShort();
+			
+			//segun esto los dos ultimos bytes son el CRC
+			int crcpos = ant + (lenght - 2);
+			
+			
+			short layer = bb.getShort();
+			short opts = bb.getShort();
+			
+			byte color = 0;
+			if ((flag & 0x1) > 0){
+				color = bb.get();
+			}
+			
+			byte extra = 0;
+			if ((flag & 0x40) > 0)
+				extra = bb.get();
+			
+			
+			String xdata = null;
+			if((extra & 0x2) > 0)
+				xdata = readXdata();
+			
+			
+			short type = 0;
+			if((flag & 0x2) > 0)
+				type = bb.getShort();
+			
+			
+			double z = 0d;
+			if( (flag & 0x4) > 0 && (kind > 2) && (kind != 22)){
+				z = bb.getDouble();
+			}
+			
+			double th = 0d;
+			if((flag & 0x8) > 0){
+				th = bb.getDouble();
+			}
+			
+			byte[] handle = null;
+			if((flag & 0x20) > 0)
+				handle = getHandle();
+			
+			short paper = 0;
+			if((extra & 0x4) > 0){
+				paper = bb.getShort();
+			}
+			
+			if(reader != null){
+				DwgObject entity = null;
+				
+				entity = DwgObjectFactory.
+							getInstance().
+							create(kind, index);
+				
+				//TODO Idem con el espacio papel o el espacio modelo
+				boolean paperSpace = false;
+				if(paper != 0){
+					paperSpace = true;
+				}
+				reader.read(bb, flag, opts, entity);
+				if(reader instanceof DefferedEntityReader){
+					entity = ((DefferedEntityReader)reader).getDwgObject(index);	
+				}
+				
+				if(entity instanceof IDwgPolyline){
+					currentPolyline = (IDwgPolyline) entity;
+				}
+				else if(entity instanceof DwgSeqend){
+					currentPolyline = null;
+				}else if(entity instanceof DwgBlockHeader){
+					currentBlock = (DwgBlockHeader) entity;
+				}else if(entity instanceof DwgEndblk){
+					currentBlock = null;
+				}
+				
+				DwgHandleReference hdl = null;
+				/*
+				In V12 format a handle has 2 bytes, while
+				in later formats a hande has 4 bytes. To avoid
+				rewriting a lot of code we are going to do some "tricks"
+				with handles.
+				*/
+				if(entity instanceof DwgBlockHeader){
+					/*
+					 * If entity is a block, in a later step we'll match
+					 * an insert with its block by handle.
+				     * In dwg 12 format, association insert-blocks is not
+				     * by handle (is from the order of the block in block table)
+				     * So here we use a little trick to avoid rewriting of
+				     * block and inserts management logic.
+					 * */
+					int order = -1;
+					DwgBlockHeader blk = (DwgBlockHeader) entity;
+					String blockName = blk.getName();
+					Block block = getBlock(blockName);
+					if(block != null){
+						order = blocks.indexOf(block);
+						hdl = new DwgHandleReference(0, order);
+					}else{
+						System.out.println("BLOQUE "+blockName+" NO EST� EN LA TABLA DE BLOQUES");
+						bb.position(crcpos);
+						short crc = bb.getShort();
+						continue;
+					}
+				}else{
+					if(handle != null){
+						int offset = handle.hashCode();
+						hdl = new DwgHandleReference(0, offset);
+					}else{
+						System.out.println("HANDLE A NULL");
+						bb.position(crcpos);
+						short crc = bb.getShort();
+						continue;
+					}
+				}
+				
+				entity.setColor(color);
+				entity.setType(type);//TODO Este type es el mismo que para DWG 13-14-2000?
+				entity.setSizeInBits(lenght);//TODO Este size es el mismo que para DWG 13-14-2000?
+				entity.setHandle(hdl);
+				/*
+				 * TODO
+				 * Parece ser que DWG 12 no gestiona las layers al igual que las
+				 * versiones sucesivas (hay que descifrar si 'layer' significa
+				 * un orden en la tabla de layers
+				 * 
+				 * De ser as�, y si indexamos las layers de esta forma
+				 * (con un HandleReference de code 0x5) ser� todo homogeneo
+				 * 
+				 * TODO Construir instancias de DwgLayer a partir de las entradas
+				 * de la tabla de layers, e indexarlas con un handle igual a su orden
+				 * */
+				
+				entity.setLayerHandle(new DwgHandleReference(0x5, layer));
+				
+				//TODO El valor de elevation en 12 es comun a todas, en 13 y ulteriores
+				//no. ver que se hace
+//				entity.setZ(z);
+				
+				List xdataAsList = new ArrayList();
+				xdataAsList.add(xdata);
+				entity.setExtendedData(xdataAsList);
+				
+				//TODO con thickness tenemos el mismo problema que con
+				//elevation. En dwg 12 es comun a todos
+//				entity.setThickness(th);
+				
+				ant = bb.position();
+//				if(ant < crcpos){
+				if(ant != crcpos){
+					bb.position(bb.position() + (crcpos - ant));
+				}
+				short crc = bb.getShort();
+				
+				if( (entity instanceof IDwgVertex) && (currentPolyline != null)){
+					currentPolyline.addVertex((IDwgVertex) entity);
+					
+				}else if( (entity instanceof IDwgBlockMember) && 
+						!(entity instanceof IDwgVertex) &&
+						(currentBlock != null)){
+					//In DWG 12 vertex is not part of Block.
+					//its part of a polyline (which is part of a block)
+					currentBlock.addObject(entity);
+				} else{
+//					if(! paperSpace)//TODO solo a�adimos las entidades en espacio modelo????
+					dwgFile.addDwgObject(entity);
+				}
+			}//if reader
+			else{
+				System.out.println("Reader a NULL. DWG 12 MAL LEIDO");
+				System.out.println("kind = " + kind);
+				bb.position(crcpos);
+				short crc = bb.getShort();
+				continue;
+				
+			}
+			ant = bb.position();
+//			byte[] crc32 = new byte[32];
+//			bb.get(crc32);
+			index++;
+		}//while
+		byte[] crc32 = new byte[32];//TODO va dentro o fuera del while??
+		bb.get(crc32);
+	}
+
+
+	/**
+	 * @return
+	 */
+	private byte[] getHandle() {
+		 byte[] bytes = null;
+		 bb.order(ByteOrder.nativeOrder());
+		 byte len = bb.get();
+		 bytes = new byte[len];
+		 bb.get(bytes);
+		 return bytes;
+//Ver si los handles de DWG 12 concurdan con nuestra clase
+//DwgHandleReference
+//	     return (5, _len) + tuple(_bytes)
+	}
+
+
+
+	/**
+	 * @return
+	 */
+	private String readXdata() {
+		String extData = "";
+		short xlen = bb.getShort();
+		while (xlen > 0){
+			byte xval = bb.get();
+			xlen--;
+			if(xval == 0){
+				if(xlen < 1)
+					break;
+				byte val = bb.get();
+				xlen--;
+				if(r13){
+					if(xlen < 1)
+						break;
+					byte codePage = bb.get();
+					xlen--;
+				}//if r13
+				if(xlen < val)
+					break;
+				byte[] strByte = new byte[val];
+				bb.get(strByte);
+				xlen -= val;
+				extData += new String(strByte);
+			}//if xval == 0
+			else if(xval == 1 || xval == 3 || xval == 70){
+				if(xlen < 2)
+					break;
+				short val = bb.getShort();
+				extData += val;
+				xlen += 2;
+			}else if(xval == 2){
+				if(xlen < 1)
+					break;
+				byte val = bb.get();
+				if(val == 0)
+					extData += "{";
+				else if(val == 1)
+					extData += "}";
+				else
+					System.out.println("Byte no esperado:"+val);
+			}else if(xval == 5){
+				if(xlen < 8)
+					break;
+				long val = bb.getLong();
+				//probably it is an entity handle
+				xlen -= 8;
+			}else if (xval == 40 || xval == 41 || xval == 42){
+				if (xlen < 8)
+					break;
+				double val = bb.getDouble();
+				xlen -= 8;
+				extData += val;
+				
+			}else if (xval == 10 || xval == 11 || xval == 12 || xval == 13){
+				//13 not in R12 spec, is in R13/R14
+				if(xlen < 24)
+					break;
+				Object point = getPoint(true);
+				extData += point.toString();
+				xlen -= 24;
+			}else if(xval == 71){
+				if (xlen < 4)
+					break;
+				int val = bb.getInt();
+				extData += val;
+				xlen -= 4;
+			}else
+				xlen = 0;
+			return extData;
+		}
+		/*
+
+           
+       
+        elif _xval == 71:
+            if _xlen < 4: break
+            _val = struct.unpack('<l', handle.read(4))[0]
+            _data.append(_val)
+            _xlen = _xlen - 4
+        else:
+            _xlen = 0
+    return _data
+		 * */
+		return null;
+	}
+
+
+
+	/**
+	 * @param b
+	 * @return
+	 */
+	private double[] getPoint(boolean b) {
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		double x = bb.getDouble();
+		double y = bb.getDouble();
+		double z = 0d;
+		if(b){
+			z = bb.getDouble();
+		}
+		return new double[]{x, y, z};
+	}
+
+
+
+	//TODO Que se hacen con los registros que se leen???
+	private void readBlockTable(Dwg12Table blockTable) {
+		short size = blockTable.s1;
+		int numRecords =  blockTable.i1;
+		int start = blockTable.i2;
+		
+		int begin = -1;
+		int end = -1;
+		
+		for(int i = 0; i < numRecords; i++){
+			
+			begin = start + i * size;
+			bb.position(begin);
+			
+			end = begin + size - 2;
+	
+			byte flag = bb.get();
+			byte[] nameByte = new byte[32];
+			bb.get(nameByte);
+			String name = new String(nameByte).trim();
+			
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			
+			short used = bb.getShort();
+			byte b1 = bb.get();
+			short w1 = bb.getShort();
+			byte b2 = bb.get();
+			
+			short w3 = bb.getShort();
+			short crc = bb.getShort();
+		
+			int offset = end - bb.position();
+			if(offset > 0)
+				bb.position(bb.position() + end);
+			
+			Block block = new Block();
+			block.flag = flag;
+			block.name = name;
+			block.used = used;
+			block.b1 = b1;
+			block.w1 = w1;
+			block.b2 = b2;
+			block.w3 = w3;
+			block.crc = crc;
+			blocks.add(block);
+		}//for
+		byte[] crc32 = new byte[32];
+		bb.get(crc32);
+	}
+
+	public void readHeader(){
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short w1 = bb.getShort();
+		double[] inBase = getPoint(true);
+		double[] extMin = getPoint(true);
+		dwgFile.setHeader("MSPACE_EXTMIN", extMin);
+		double[] extMax = getPoint(true);
+		dwgFile.setHeader("MSPACE_EXTMAX", extMax);
+		double[] limMin = getPoint(false);
+		double[] limMax = getPoint(false);
+		
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		double vcx = bb.getDouble();
+		double vcy = bb.getDouble();
+		double d3 = bb.getDouble();
+		double d4 = bb.getDouble();
+		
+		byte b1 = bb.get();
+		byte b2 = bb.get();
+		
+		double sx = bb.getDouble();
+		double sy = bb.getDouble();
+		
+		bb.order(ByteOrder.nativeOrder());
+		byte[] b56 = new byte[56];
+		bb.get(b56);
+		
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		double d7 = bb.getDouble();
+		double d8 = bb.getDouble();
+		double d9 = bb.getDouble();
+		
+		bb.order(ByteOrder.nativeOrder());
+		byte[] b18 = new byte[18];
+		bb.get(b18);
+		
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		double d10 = bb.getDouble();
+		
+		int at = bb.position();
+		
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short w2 = bb.getShort();
+		short w3 = bb.getShort();
+		
+		bb.order(ByteOrder.nativeOrder());
+		byte[] b44 = new byte[44];
+		bb.get(b44);
+		
+		at = bb.position();
+		
+		bb.order(ByteOrder.nativeOrder());
+		byte[] b354 = new byte[354];
+		bb.get(b354);
+		
+		if( (b354[0] == 0x61) && (b354[1] == 0x63) && (b354[2] == 0x61 ) && (b354[2] == 0x64 ))
+			System.out.println("Encontrada la cadena 'acad' al comienzo del bloque de 354 bytes");
+	
+		bb.position(0x3ef);
+	}
+	
+	class Dwg12Table{
+		short s1;
+		int i1;
+		int i2;
+	}
+	
+	public Dwg12Table getTable(){
+		
+		Dwg12Table solution = null;
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		
+		short s1 = bb.getShort();
+		int i1 = bb.getInt();
+		int i2 = bb.getInt();
+		
+		solution = new Dwg12Table();
+		solution.s1 = s1;
+		solution.i1 = i1;
+		solution.i2 = i2;
+		return solution;
+	}
+	
+	
+	class Dwg12TableTest{
+		short s1, s2, s3;
+		int i1;
+	}
+	public Dwg12TableTest getTableTest(){
+		Dwg12TableTest solution = null;
+		
+		
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short s1 = bb.getShort();
+		short s2 = bb.getShort();
+		short s3 = bb.getShort();
+		int i1 = bb.getInt();
+		
+		solution = new Dwg12TableTest();
+		solution.s1 = s1;
+		solution.s2 = s2;
+		solution.s3 = s3;
+		solution.i1 = i1;
+		
+		return solution;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgFileReader#readObjectHeader(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException {
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgFileReader#readObjectTailer(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException {
+		return 0;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgFileReader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgFileReader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgFileReader.java	(revision 435)
@@ -0,0 +1,70 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.readers;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * The IDwgFileReader reads all the DWG format versions
+ * 
+ * @author jmorell
+ */
+public interface IDwgFileReader {
+    
+    /**
+     * Reads all the DWG format versions
+     * 
+	 * @param dwgFile Represents the DWG file that we want to read
+     * @param bb  Memory mapped byte buffer of the whole DWG file
+     * @throws IOException When DWG file path is wrong
+     */
+	public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException;
+	
+	/**
+	 * Reads the header of a dwg object
+	 * */
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException;
+	
+	/**
+	 * Reads the tailer of a dwg object.
+	 * */
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException;
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgTextReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgTextReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgTextReader1314.java	(revision 435)
@@ -0,0 +1,125 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgText;
+
+
+/**
+ * It reads Text of dwg 13-14 version
+ * @author azabala
+ */
+public class DwgTextReader1314 extends AbstractDwg1314Reader {
+	
+	
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgText))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgHatch");
+		 DwgText txt = (DwgText) dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, dwgObj);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double elevation = ((Double)val.get(1)).doubleValue();
+		txt.setElevation(elevation);
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+		txt.setInsertionPoint(new Point2D.Double(x, y));
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		txt.setAlignmentPoint(new Point2D.Double(x,y));
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		txt.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double thickness = ((Double)val.get(1)).doubleValue();
+		txt.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double obliqueAngle = ((Double)val.get(1)).doubleValue();
+		txt.setObliqueAngle(obliqueAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double rotationAngle = ((Double)val.get(1)).doubleValue();
+		txt.setRotationAngle(rotationAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double height = ((Double)val.get(1)).doubleValue();
+		txt.setHeight(height);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double width = ((Double)val.get(1)).doubleValue();
+		txt.setWidthFactor(width);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String text = (String)val.get(1);
+		txt.setText(text);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int generation = ((Integer)val.get(1)).intValue();
+		txt.setGeneration(generation);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int halign = ((Integer)val.get(1)).intValue();
+		txt.setHalign(halign);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int valign = ((Integer)val.get(1)).intValue();
+		txt.setValign(valign);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, txt);
+		
+		DwgHandleReference styleHdl = new DwgHandleReference();
+		styleHdl.read(data, bitPos);
+		txt.setStyleHandle(styleHdl);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialIndexReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialIndexReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialIndexReader1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSpatialIndexReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLineReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLineReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLineReader1314.java	(revision 435)
@@ -0,0 +1,79 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLine;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLineReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLine))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgInsert");
+		DwgLine l = (DwgLine) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, l);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		l.setP1(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		l.setP2(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double thickness = ((Double) val.get(1)).doubleValue();
+		l.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		l.setExtrusion(new double[]{x, y, z});
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, l);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgHatchReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgHatchReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgHatchReader1314.java	(revision 435)
@@ -0,0 +1,519 @@
+/*
+ * Created on 30-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgHatchReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.4.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/02/02 12:00:00  azabala
+* first implementation
+*
+* Revision 1.2  2007/01/31 20:28:44  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2007/01/30 19:40:23  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgHatch;
+
+
+public class DwgHatchReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException{
+		
+		 if(! (dwgObj instanceof DwgHatch))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgHatch");
+		 DwgHatch h = (DwgHatch) dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double zCoord = ((Double)val.get(1)).doubleValue();
+		h.setZ(zCoord);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double xEx = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double yEx = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double zEx = ((Double)val.get(1)).doubleValue();
+		
+		h.setExtrusion(new double[]{xEx, yEx, zEx});
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String txt = (String)val.get(1);
+		h.setName(txt);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		boolean solidFill = ((Boolean)val.get(1)).booleanValue();
+		h.setSolidFill(solidFill);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		boolean associative = ((Boolean)val.get(1)).booleanValue();
+		h.setAssociative(associative);
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int numPaths =  ((Integer)val.get(1)).intValue();
+		
+//		TODO Esto lo pongo por analogia con las colecciones de Python
+		//pero hay que quitarlo
+		
+		/*
+		 * paths puede tener distintos tipos de paths:
+		 * a) del tipo polyline
+		 * b) del tipo stdpath
+		 * 
+		 * 
+		 * paths.put("polyline", pathSegments);
+		 * paths.put("stdpath", pathSegments);
+		
+		 * */
+		Map paths = new HashMap();
+		
+		int pathFlag = 0;
+		int pixel = 0;
+		int allBounds = 0;
+		for(int i = 0; i < numPaths; i++){
+			val = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			pathFlag = ((Integer)val.get(1)).intValue();
+			
+			if( (pathFlag  & 0x4) > 0){
+				pixel++;
+				//TODO La especificacion no dice esto (lo hace PythonCAD)
+				//la especificacion dice pixel = DwgUtil.getBitDouble(...etc)
+			}
+			
+			if( (pathFlag & 0x2) > 0){
+				
+				//POLYLINE PATH
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				boolean hasBulges = ((Boolean)val.get(1)).booleanValue();
+				
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				boolean isClosed = ((Boolean)val.get(1)).booleanValue();
+				
+				
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				int nps = ((Integer)val.get(1)).intValue();
+				
+				List pathSegments = new ArrayList();
+				for (int j = 0; j < nps; j++){
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer)val.get(0)).intValue();
+					double x = ((Double)val.get(1)).doubleValue();
+					
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer)val.get(0)).intValue();
+					double y = ((Double)val.get(1)).doubleValue();
+					double bulge = 0d;
+					if(hasBulges){
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						bulge = ((Double)val.get(1)).doubleValue();
+					}
+					pathSegments.add(new double[]{x, y, bulge});
+				}//for
+				paths.put("polyline", pathSegments);
+			}else{
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				int nps = ((Integer)val.get(1)).intValue();
+				Map pathSegments = new HashMap();
+				for(int j = 0; j < nps; j++){
+					val = DwgUtil.getRawChar(data, bitPos);
+					bitPos = ((Integer)val.get(0)).intValue();
+					int pts = ((Integer)val.get(1)).intValue();
+					
+					double x, y, r, sa, ea;
+					ArrayList list;
+					boolean isCcw;
+					
+					switch(pts){
+					case 1://LINE
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double x1 = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double y1 = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double x2 = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double y2 = ((Double)val.get(1)).doubleValue();
+						
+						pathSegments.put("line", new double[]{x1, y1, x2, y2});
+					
+					break;
+					
+					case 2://CIRCULAR ARC
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						x = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						y = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						r = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						sa = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						ea = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.testBit(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						isCcw = ((Boolean)val.get(1)).booleanValue();
+						//TODO Esto es una kk.
+						//CAMBIAR POR UNA JERARQUIA DE OBJETOS SEG�N EL SEGMENTO
+						list = new ArrayList();
+						list.add(new Double(x));
+						list.add(new Double(y));
+						list.add(new Double(r));
+						list.add(new Double(sa));
+						list.add(new Double(ea));
+						list.add(new Boolean(isCcw));
+						pathSegments.put("arc", list);
+						
+					break;
+					
+					case 3://ELLIPTICAL ARC
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						x = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						y = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double xe = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getRawDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						double ye = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						r = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						sa = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.getBitDouble(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						ea = ((Double)val.get(1)).doubleValue();
+						
+						val = DwgUtil.testBit(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						isCcw = ((Boolean)val.get(1)).booleanValue();
+						
+						list = new ArrayList();
+						list.add(new Double(x));
+						list.add(new Double(y));
+						list.add(new Double(xe));
+						list.add(new Double(ye));
+						list.add(new Double(r));
+						list.add(new Double(sa));
+						list.add(new Double(ea));
+						list.add(new Boolean(isCcw));
+						pathSegments.put("elliptical_arc", list);
+					break;
+					
+					case 4://SPLINE ARC
+						val = DwgUtil.getBitLong(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						int deg = ((Integer)val.get(1)).intValue();
+						
+						val = DwgUtil.testBit(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						boolean isRat = ((Boolean)val.get(1)).booleanValue();
+						
+						val = DwgUtil.testBit(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						boolean isPer = ((Boolean)val.get(1)).booleanValue();
+						
+						val = DwgUtil.getBitLong(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						int numKnokts = ((Integer)val.get(1)).intValue();
+						
+						val = DwgUtil.getBitLong(data, bitPos);
+						bitPos = ((Integer)val.get(0)).intValue();
+						int numCtrlPts = ((Integer)val.get(1)).intValue();
+						 
+						double[] knots = new double[numKnokts];
+						for(int z = 0;  z < numKnokts; z++){
+							val = DwgUtil.getBitDouble(data, bitPos);
+							bitPos = ((Integer)val.get(0)).intValue();
+							knots[z] = ((Double)val.get(1)).doubleValue();
+						}
+						
+						double[][] controlPoints = new double[3][numCtrlPts];
+						for(int z = 0; z < numCtrlPts; z++){
+							//x
+							val = DwgUtil.getRawDouble(data, bitPos);
+							bitPos = ((Integer)val.get(0)).intValue();
+							controlPoints[0][z] = ((Double)val.get(1)).doubleValue();
+							//y
+							val = DwgUtil.getRawDouble(data, bitPos);
+							bitPos = ((Integer)val.get(0)).intValue();
+							controlPoints[1][z] = ((Double)val.get(1)).doubleValue();
+							
+							//weight
+							if(isRat){
+								val = DwgUtil.getBitDouble(data, bitPos);
+								bitPos = ((Integer)val.get(0)).intValue();
+								controlPoints[2][z] = ((Double)val.get(1)).doubleValue();
+							}else{
+								controlPoints[2][z] = 0;
+							}
+							list = new ArrayList();
+							list.add(new Boolean(isRat));
+							list.add(new Boolean(isPer));
+							list.add(knots);
+							list.add(controlPoints);
+							pathSegments.put("spline", list);
+						}
+					break;
+					
+					default:
+						System.out.println("Error leyendo un segmento de hatch:codigo="+pts);
+					break;
+					}//switch
+				}//for
+				paths.put("stdpath", pathSegments);
+			}//else
+			
+			val = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			int nbh = ((Integer)val.get(1)).intValue();
+			allBounds += nbh;
+		}//for
+		
+		h.setPaths(paths);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int style = ((Integer)val.get(1)).intValue();
+		h.setStyle(style);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int patternType = ((Integer)val.get(1)).intValue();
+		h.setPatterType(patternType);
+		
+		if(!solidFill){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			double fillAngle = ((Double)val.get(1)).doubleValue();
+			h.setFillAngle(fillAngle);
+			
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			double fillScaleOrSpacion = 
+					((Double)val.get(1)).doubleValue();
+			h.setFillScale(fillScaleOrSpacion);
+			
+			val = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			boolean fileDoubleHath = 
+				((Boolean)val.get(1)).booleanValue();
+			h.setFileDoubleHath(fileDoubleHath);
+			
+			val = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			int ndf = ((Integer)val.get(1)).intValue();
+			
+			ArrayList[] lines = new ArrayList[ndf];
+			for(int i = 0; i < ndf; i++){
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				double x = ((Double)val.get(1)).doubleValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				double y = ((Double)val.get(1)).doubleValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				double x0 = ((Double)val.get(1)).doubleValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				double y0 = ((Double)val.get(1)).doubleValue();
+				
+				val = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer)val.get(0)).intValue();
+				int numDashes = ((Integer)val.get(1)).intValue();
+				double[] dashes = new double[numDashes];
+				for(int j = 0; j < numDashes; j++){
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer)val.get(0)).intValue();
+					dashes[j] = ((Double)val.get(1)).doubleValue();
+					/*TODO el original python decia 
+					 *  for _j in range(_nds):
+					 		_bitpos, _val = dwgutil.get_bit_double(data, _bitpos)
+					 		ent.setEntityData('dashlength', _val)
+					 	Aunque no le veo mucho sentido
+					 */
+				}//for j
+				//TODO Esto es horrible. Sustituir por orientaci�n a objetos
+				lines[i] = new ArrayList();
+				lines[i].add(new Double(x));
+				lines[i].add(new Double(y));
+				lines[i].add(new Double(x0));
+				lines[i].add(new Double(y0));
+				lines[i].add(dashes);
+			}//for i
+			h.setFillLines(lines);
+		}//if solidFill
+		
+		if(pixel > 0){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			double pixelSize = ((Double)val.get(1)).doubleValue();
+			h.setPixelSize(pixelSize);
+		}
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int numSeddPoints = ((Integer)val.get(1)).intValue();
+		double[][] seedPoints = new double[2][numSeddPoints];
+		for(int j = 0; j < numSeddPoints; j++){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			double x = ((Double)val.get(1)).doubleValue();
+			
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer)val.get(0)).intValue();
+			double y = ((Double)val.get(1)).doubleValue();
+			
+			seedPoints[0][j] = x;
+			seedPoints[1][j] = y;
+ 		}
+		h.setSeedPoints(seedPoints);
+		
+		DwgHandleReference handle = null;
+		for(int i = 0; i < h.getNumReactors(); i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			//los DwgObject ahora mismo estan pasando de los reactors
+		}
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		h.setXDicObjHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		h.setLayerHandle(handle);
+		
+		if(! h.isLyrByLineType()){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			h.setLineTypeHandle(handle);
+		}
+		
+		if (! h.isNoLinks()){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			h.setPreviousHandle(handle);
+			
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			h.setNextHandle(handle);
+		}
+		
+		if(allBounds > 0){
+			DwgHandleReference[] handles = new DwgHandleReference[allBounds];
+			for(int i = 0; i < allBounds; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				handles[i] = handle;
+			}//for
+			h.setBoundaryHandles(handles);
+		}
+	}
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPointReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPointReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPointReader1314.java	(revision 435)
@@ -0,0 +1,74 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPointReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPoint))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgPoint");
+		DwgPoint pt = (DwgPoint)dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj );
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		pt.setPoint(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double thickness = ((Double) val.get(1)).doubleValue();
+		pt.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		pt.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double xAxisAngle = ((Double) val.get(1)).doubleValue();
+		pt.setXAxisAngle(xAxisAngle);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, pt);
+		
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexMeshReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexMeshReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexMeshReader1314.java	(revision 435)
@@ -0,0 +1,98 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexMeshReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexMesh;
+
+
+public class DwgVertexMeshReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertexMesh))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertexMesh");
+		 DwgVertexMesh v = (DwgVertexMesh) dwgObj;
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flag = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flag);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockReader1314.java	(revision 435)
@@ -0,0 +1,41 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgBlockReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgBlock))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgBlock");
+		 DwgBlock blk = (DwgBlock) dwgObj;
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, offset, blk );
+		 
+		 List val = DwgUtil.getTextString(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 String name = (String) val.get(1);
+		 blk.setName(name);
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, blk);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockControlReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockControlReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockControlReader1314.java	(revision 435)
@@ -0,0 +1,66 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgBlockControlReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgBlockControl))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgBlockControl");
+		 DwgBlockControl blk = (DwgBlockControl) dwgObj;
+		 int bitPos = offset;
+		 
+		 List val = DwgUtil.getBitLong(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int numReactors = ((Integer) val.get(1)).intValue();
+		 blk.setNumReactors(numReactors);
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int numHdl = ((Integer) val.get(1)).intValue();
+		 
+		 DwgHandleReference handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setNullHandle(handle);
+		 
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setXDicObjHandle(handle);
+		 
+		 if(numHdl > 0){
+			 Vector handles = new Vector();
+			 for(int i = 0; i < numHdl; i++){
+				 handle = new DwgHandleReference();
+				 bitPos = handle.read(data, bitPos);
+				 handles.add(handle);
+			 }
+			 blk.setCode2Handles(handles);
+		 }
+		 
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setModelSpaceHandle(handle);
+		 
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setPaperSpaceHandle(handle);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReactor1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReactor1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReactor1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImageDefReactor1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEndBlkReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEndBlkReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEndBlkReader1314.java	(revision 435)
@@ -0,0 +1,30 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+
+
+/**
+ * @author alzabord
+ *
+ */
+public class DwgEndBlkReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEndblk))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgEndBlk");
+
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj );
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dwgObj);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMTextReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMTextReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMTextReader1314.java	(revision 435)
@@ -0,0 +1,115 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMText;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgMTextReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMText))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgMText");
+		DwgMText txt = (DwgMText) dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, txt);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		txt.setInsertionPoint(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		txt.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		txt.setXAxisDirection(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double width = ((Double)val.get(1)).doubleValue();
+		txt.setWidth(width);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double height = ((Double)val.get(1)).doubleValue();
+		txt.setHeight(height);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int attachment = ((Integer)val.get(1)).intValue();
+		txt.setAttachment(attachment);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int drawingDir = ((Integer)val.get(1)).intValue();
+		txt.setAttachment(drawingDir);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double extHeight = ((Double)val.get(1)).doubleValue();
+		txt.setExtHeight(extHeight);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double extWidth = ((Double)val.get(1)).doubleValue();
+		txt.setExtWidth(extWidth);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		txt.setText((String) val.get(1));
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, txt);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		txt.setStyleHandle(handle);	
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex2DReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex2DReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex2DReader1314.java	(revision 435)
@@ -0,0 +1,77 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+
+
+/**
+ * @author alzabord
+
+ */
+public class DwgVertex2DReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex2D))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgHatch");
+		 DwgVertex2D v = (DwgVertex2D) dwgObj;
+		 
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flags = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flags);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double sw = ((Double) val.get(1)).doubleValue();
+		 double ew = 0d;
+		 if(sw < 0d){
+			 sw = Math.abs(sw);
+			 ew = sw;
+		 }else{
+			 val = DwgUtil.getBitDouble(data, bitPos);
+			 bitPos = ((Integer) val.get(0)).intValue();
+			 ew = ((Double) val.get(1)).doubleValue();
+		 }
+		 v.setInitWidth(sw);
+		 v.setEndWidth(ew);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double bulge = ((Double) val.get(1)).doubleValue();
+		 v.setBulge(bulge);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double tangentDir = ((Double) val.get(1)).doubleValue();
+		 v.setTangentDir(tangentDir);
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/AbstractDwg1314Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/AbstractDwg1314Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/AbstractDwg1314Reader.java	(revision 435)
@@ -0,0 +1,73 @@
+/*
+ * Created on 30-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: AbstractDwg1314Reader.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/01/30 19:40:23  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.readers.DwgFileV14Reader;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.gvsig.dwg.lib.readers.IDwgObjectReader;
+
+public abstract class AbstractDwg1314Reader implements IDwgObjectReader {
+
+	protected IDwgFileReader headTailReader;
+	public void setFileReader(IDwgFileReader headTailReader) {
+		if( ! (headTailReader instanceof DwgFileV14Reader))
+			throw new RuntimeException("Tratando de leer entidad de DWG 13-14 con"+
+					headTailReader.getClass().getName());
+		this.headTailReader = headTailReader;
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialFilterReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialFilterReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSpatialFilterReader1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSpatialFilterReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex3DReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex3DReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertex3DReader1314.java	(revision 435)
@@ -0,0 +1,54 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgVertex3DReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgVertex3D))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertex3D");
+		 DwgVertex3D v = (DwgVertex3D) dwgObj;
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos); 
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flags = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flags);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos); 
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos); 
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos); 
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgInsertReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgInsertReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgInsertReader1314.java	(revision 435)
@@ -0,0 +1,100 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgInsertReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgInsert))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgInsert");
+		DwgInsert insert = (DwgInsert) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, insert);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		insert.setInsertionPoint(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		insert.setScale(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double rotation = ((Double)val.get(1)).doubleValue();
+		insert.setRotation(rotation);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		insert.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		boolean hasAttr = ((Boolean)val.get(1)).booleanValue();
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, insert);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		insert.setBlockHeaderHandle(handle);
+		
+		if(hasAttr){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setFirstAttribHandle(handle);
+			
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setLastAttribHandle(handle);
+			
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setSeqendHandle(handle);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerIndexReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerIndexReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerIndexReader1314.java	(revision 435)
@@ -0,0 +1,88 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLayerIndex;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLayerIndexReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		if(! (dwgObj instanceof DwgLayerIndex))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgLayer");
+		DwgLayerIndex lyr = (DwgLayerIndex) dwgObj;
+		int bitPos = offset;
+		
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int numReactors = ((Integer) val.get(1)).intValue();
+		lyr.setNumReactors(numReactors);
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int timestamp1 = ((Integer) val.get(1)).intValue();
+		lyr.setTimestamp1(timestamp1);
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int timestamp2 = ((Integer) val.get(1)).intValue();
+		lyr.setTimestamp2(timestamp1);
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int ne = ((Integer) val.get(1)).intValue();
+		if(ne > 0){
+			for(int i = 0; i < ne; i++){
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				int indexLong = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				String indexStr = (String) val.get(1);
+				
+				lyr.addIndex(indexLong, indexStr);
+			}//for
+		}//if
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setParentHandle(handle);
+		
+		for(int i = 0; i < numReactors; i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			lyr.addReactorHandle(handle);
+		}
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setXDicObjHandle(handle);
+		
+		if(ne > 0){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			lyr.addHandleEntry(handle);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryReader1314.java	(revision 435)
@@ -0,0 +1,130 @@
+/*
+ * Created on 05-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgDictionaryReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/06 20:17:29  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2007/02/05 19:44:00  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgDictionary;
+
+
+public class DwgDictionaryReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		if(! (dwgObj instanceof DwgDictionary))
+			throw new RuntimeException("ArcReader 15 solo puede leer DwgDictionary");
+		DwgDictionary dic = (DwgDictionary) dwgObj;
+		
+		int bitPos = offset;
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nr = ((Integer) val.get(1)).intValue();
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int ni = ((Integer) val.get(1)).intValue();
+		int u = 0;
+		//TODO Revisar que valores puede tomar el campo version
+		if(dic.getVersion() == "Autocad R14"){
+			val = DwgUtil.getRawChar(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			u = ((Integer) val.get(1)).intValue();
+		}
+		String[] texts = null;
+		if(ni > 0){
+			texts = new String[ni];
+			for(int i = 0; i < ni; i++){
+				val = DwgUtil.getTextString(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				texts[i] = (String) val.get(1);
+			}//for
+		}
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dic.setParentHandle(handle);
+		
+		for (int i = 0; i < nr; i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			dic.addReactorHandle(handle);
+		}
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dic.setXDicObjHandle(handle);
+		
+		if(ni > 0){
+			for(int i = 0; i < ni; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				
+				dic.put(texts[i], handle);
+			}
+		}
+	}
+
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttdefReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttdefReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttdefReader1314.java	(revision 435)
@@ -0,0 +1,150 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttdefReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgAttdef))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgAttdef");
+		DwgAttdef att = (DwgAttdef) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, att);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double elevation = ((Double)val.get(1)).doubleValue();
+		att.setElevation(elevation);
+		
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+		att.setInsertionPoint(new Point2D.Double(x,y));
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		att.setAlignmentPoint(new Point2D.Double(x,y));
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		att.setExtrusion(new double[]{x, y, z});
+		
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double thickness = ((Double)val.get(1)).doubleValue();
+		att.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double obliqueAngle = ((Double)val.get(1)).doubleValue();
+		att.setObliqueAngle(obliqueAngle);
+		
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double rotationAngle = ((Double)val.get(1)).doubleValue();
+		att.setRotationAngle(rotationAngle);
+		
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double height = ((Double)val.get(1)).doubleValue();
+		att.setHeight(height);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double width = ((Double)val.get(1)).doubleValue();
+		att.setWidthFactor(width);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String text = (String)val.get(1);
+		att.setText(text);
+		
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int generation = ((Integer)val.get(1)).intValue();
+		att.setGeneration(generation);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int halign = ((Integer)val.get(1)).intValue();
+		att.setHalign(halign);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int valign = ((Integer)val.get(1)).intValue();
+		att.setValign(valign);
+		
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String tag = (String)val.get(1);
+		att.setTag(tag);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int fieldLength = ((Integer)val.get(1)).intValue();
+		att.setFieldLength(fieldLength);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int flags = ((Integer)val.get(1)).intValue();
+		att.setFlags(flags);
+		
+		//Esta es la unica diferencia entre attdef y attrib
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String prompt = (String)val.get(1);
+		att.setPrompt(prompt);
+		
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, att);
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		att.setStyleHandle(handle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgOle2FrameReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgOle2FrameReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgOle2FrameReader1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgOle2FrameReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPFaceReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPFaceReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPFaceReader1314.java	(revision 435)
@@ -0,0 +1,110 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgPFaceReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.3  2007/03/20 19:57:09  azabala
+* source code cleaning
+*
+* Revision 1.2  2007/03/01 19:56:52  azabala
+* refactor of names
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+
+
+public class DwgPFaceReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		if(! (dwgObj instanceof DwgPFacePolyline))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgPFacePolyline");
+		DwgPFacePolyline pface = (DwgPFacePolyline) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, pface);
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int vertexCount = ((Integer) val.get(1)).intValue();
+		pface.setVertexCount(vertexCount);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int faceCount = ((Integer) val.get(1)).intValue();
+		pface.setFaceCount(faceCount);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, pface);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setFirstVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setLastVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		pface.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryVarReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryVarReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDictionaryVarReader1314.java	(revision 435)
@@ -0,0 +1,118 @@
+/*
+ * Created on 30-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgDictionaryVarReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.4.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/02/07 12:45:04  fdiaz
+* *** empty log message ***
+*
+* Revision 1.3  2007/02/02 11:46:35  azabala
+* changes in throwed exceptions
+*
+* Revision 1.2  2007/01/31 18:11:06  fdiaz
+* Refactorizacion para usar la clase DwgHandleReference
+*
+* Revision 1.1  2007/01/30 19:40:23  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgDictionaryVar;
+
+
+public class DwgDictionaryVarReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgDictionaryVar))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgDictionaryVar");
+		
+		DwgDictionaryVar dic = (DwgDictionaryVar) dwgObj;
+		int bitPos = offset;
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int numReactors = ((Integer)val.get(1)).intValue();
+		dic.setNumReactors(numReactors);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int intval = ((Integer)val.get(0)).intValue();
+		dic.setIntval(intval);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String text = ((String)val.get(1));
+		dic.setText(text);
+		
+		DwgHandleReference parentHandle = new DwgHandleReference();
+		bitPos = parentHandle.read(data, bitPos);
+		dic.setParentHandle(parentHandle);
+
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < numReactors; i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			dic.addReactorHandle(reactorHandle);
+		}
+
+		DwgHandleReference xDicObjHandle = new DwgHandleReference();
+		bitPos = xDicObjHandle.read(data, bitPos);
+		dic.setXDicObjHandle(xDicObjHandle);
+
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageReader1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImageReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttribReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttribReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgAttribReader1314.java	(revision 435)
@@ -0,0 +1,138 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgAttribReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgAttrib))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgAtrib");
+		DwgAttrib att = (DwgAttrib) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, att);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double elevation = ((Double)val.get(1)).doubleValue();
+		att.setElevation(elevation);
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+		att.setInsertionPoint(new Point2D.Double(x,y));
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		att.setAlignmentPoint(new Point2D.Double(x,y));
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		att.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double thickness = ((Double)val.get(1)).doubleValue();
+		att.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double obliqueAngle = ((Double)val.get(1)).doubleValue();
+		att.setObliqueAngle(obliqueAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double rotationAngle = ((Double)val.get(1)).doubleValue();
+		att.setRotationAngle(rotationAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double height = ((Double)val.get(1)).doubleValue();
+		att.setHeight(height);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double width = ((Double)val.get(1)).doubleValue();
+		att.setWidthFactor(width);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String text = (String)val.get(1);
+		att.setText(text);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int generation = ((Integer)val.get(1)).intValue();
+		att.setGeneration(generation);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int halign = ((Integer)val.get(1)).intValue();
+		att.setHalign(halign);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int valign = ((Integer)val.get(1)).intValue();
+		att.setValign(valign);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		String tag = (String)val.get(1);
+		att.setTag(tag);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int fieldLength = ((Integer)val.get(1)).intValue();
+		att.setFieldLength(fieldLength);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		int flags = ((Integer)val.get(1)).intValue();
+		att.setFlags(flags);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, att);
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		att.setStyleHandle(handle);
+		
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgFace3DReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgFace3DReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgFace3DReader1314.java	(revision 435)
@@ -0,0 +1,137 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgFace3DReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgFace3D;
+
+
+public class DwgFace3DReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgFace3D))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgFace3D");
+		DwgFace3D f = (DwgFace3D)dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj );
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		f.setCorner1(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		f.setCorner2(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		f.setCorner3(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		f.setCorner4(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		f.setFlags(flags);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, f);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgIdBufferReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgIdBufferReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgIdBufferReader1314.java	(revision 435)
@@ -0,0 +1,73 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgIdBuffer;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgIdBufferReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgIdBuffer))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgIdBuffer");
+		DwgIdBuffer idB = (DwgIdBuffer) dwgObj;
+		int bitPos = offset;
+		
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int numReactors = ((Integer) val.get(1)).intValue();
+		idB.setNumReactors(numReactors);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int rcharVal = ((Integer) val.get(1)).intValue();
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nids = ((Integer) val.get(1)).intValue();
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		idB.setParentHandle(handle);
+		
+		for(int i = 0; i < numReactors; i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			idB.addReactorHandle(handle);
+		}
+	
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		idB.setXDicObjHandle(handle);
+	    
+		if(nids > 0){
+			List handles = new ArrayList();
+			for(int i = 0; i < nids; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				handles.add(handle);
+			}
+			idB.setObjidHandles(handles);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgRasterVariablesReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgRasterVariablesReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgRasterVariablesReader1314.java	(revision 435)
@@ -0,0 +1,27 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgRasterVariablesReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSortEntsTableReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSortEntsTableReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSortEntsTableReader1314.java	(revision 435)
@@ -0,0 +1,72 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSortEntStable;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgSortEntsTableReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		if(! (dwgObj instanceof DwgSortEntStable))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSortEntStable");
+		DwgSortEntStable stable = (DwgSortEntStable) dwgObj;
+		int bitPos = offset;
+		
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int numReactors = ((Integer)val.get(1)).intValue();
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int ne = ((Integer)val.get(1)).intValue();
+		if(ne > 0){
+			DwgHandleReference[] handles = new DwgHandleReference[ne];
+			for(int i = 0; i < ne; i++){
+				handles[i] = new DwgHandleReference();
+				bitPos = handles[i].read(data, bitPos);
+			}//for
+			stable.setSortedHandles(handles);
+		}
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		stable.setParentHandle(handle);
+		
+		for(int i = 0; i < numReactors; i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			stable.addReactorHandle(handle);
+		}
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		stable.setXDicObjHandle(handle);
+		
+		if(ne > 0){
+			DwgHandleReference[] handles = new DwgHandleReference[ne];
+			for(int i = 0; i < ne; i++){
+				handles[i] = new DwgHandleReference();
+				bitPos = handles[i].read(data, bitPos);
+			}//for
+			stable.setObjHandles(handles);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSplineReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSplineReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSplineReader1314.java	(revision 435)
@@ -0,0 +1,191 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+
+
+/**
+ * @author azabala
+ */
+public class DwgSplineReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSpline))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSpline");
+		DwgSpline spline = (DwgSpline) dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, spline );
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int scenario = ((Integer) val.get(1)).intValue();
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int degree = ((Integer) val.get(1)).intValue();
+		spline.setDegree(degree);
+		
+		int knots = 0;
+		int numCtPts = 0;
+		int numFitPts = 0;
+		
+		boolean weight = false;
+		
+		switch(scenario){
+			case 2:
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double fitTolerance = ((Integer) val.get(1)).intValue();
+				spline.setFitTolerance(fitTolerance);
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double x = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double y = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double z = ((Integer) val.get(1)).intValue();
+				spline.setBeginTanVector(new double[]{x, y, z});
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				x = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				y = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				z = ((Integer) val.get(1)).intValue();
+				spline.setEndTanVector(new double[]{x, y, z});
+				
+				val = DwgUtil.getBitShort(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				numFitPts = ((Integer) val.get(1)).intValue();
+			break;
+			
+			case 1:
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				boolean rational  = ((Boolean) val.get(1)).booleanValue();
+				
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				boolean closed  = ((Boolean) val.get(1)).booleanValue();
+				
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				boolean periodic  = ((Boolean) val.get(1)).booleanValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double knotTolerance = ((Double) val.get(1)).doubleValue();
+				spline.setKnotTolerance(knotTolerance);
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double controlTolerance = ((Double) val.get(1)).doubleValue();
+				spline.setControlTolerance(controlTolerance);
+				
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				knots = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitLong(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				numCtPts = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				weight  = ((Boolean) val.get(1)).booleanValue();
+				
+			break;
+		
+		
+			default:
+				System.out.println("Unexpected spline scenario "+scenario);
+			break;
+		}
+		
+		if(knots > 0){
+			double[] knotsArray = new double[knots];
+			for(int i = 0; i < knots; i++){
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				knotsArray[i] = ((Double) val.get(1)).doubleValue();
+			}
+			spline.setKnotPoints(knotsArray);
+		}
+		
+		if(numCtPts > 0){
+			double[][] ctrlPoint = new double[3][numCtPts];
+			double[] weights = new double[numCtPts];
+			for(int i = 0; i < numCtPts; i++){
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double x = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double y = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double z = ((Integer) val.get(1)).intValue();
+				
+				ctrlPoint[0][i] = x;
+				ctrlPoint[1][i] = y;
+				ctrlPoint[2][i] = z;
+				
+				if(weight){
+					val = DwgUtil.getBitDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					weights[i] = ((Integer) val.get(1)).intValue();
+				}
+			}//for
+			spline.setControlPoints(ctrlPoint);
+			spline.setWeights(weights);
+		}//if
+		
+		
+		if(numFitPts > 0){
+			double[][] fitPoint = new double[3][numCtPts];
+			for(int i = 0; i < numFitPts; i++){
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double x = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double y = ((Integer) val.get(1)).intValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double z = ((Integer) val.get(1)).intValue();
+				
+				fitPoint[0][i] = x;
+				fitPoint[1][i] = y;
+				fitPoint[2][i] = z;
+			}
+			spline.setFitPoints(fitPoint);
+		}
+		bitPos = headTailReader.readObjectTailer(data, bitPos, spline);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceFaceReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceFaceReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceFaceReader1314.java	(revision 435)
@@ -0,0 +1,104 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceFaceReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/03/20 19:57:09  azabala
+* source code cleaning
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+
+
+public class DwgVertexPFaceFaceReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgVertexPFaceFace))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertexPFaceFace");
+		 DwgVertexPFaceFace v = (DwgVertexPFaceFace) dwgObj;
+		 
+		 int bitPos = offset;
+		 
+		 bitPos = headTailReader.readObjectHeader(data, offset, v);
+		 
+		 List val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v1 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v2 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v3 = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int v4 = ((Integer) val.get(1)).intValue();
+		 
+		 v.setVerticesidx(new int[]{v1, v2, v3, v4});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMeshReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMeshReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMeshReader1314.java	(revision 435)
@@ -0,0 +1,126 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMeshReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/03/01 19:56:52  azabala
+* refactor of names
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+
+
+public class DwgMeshReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgMeshPolyline))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgMeshPolyline");
+		DwgMeshPolyline m = (DwgMeshPolyline) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, m);
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		m.setFlags(flags);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int curveType = ((Integer) val.get(1)).intValue();
+		m.setCurveType(curveType);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mVerticies = ((Integer) val.get(1)).intValue();
+		m.setMVerticies(mVerticies);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nVerticies = ((Integer) val.get(1)).intValue();
+		m.setNVerticies(nVerticies);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int mDensity = ((Integer) val.get(1)).intValue();
+		m.setMDensity(mDensity);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int nDensity = ((Integer) val.get(1)).intValue();
+		m.setNDensity(nDensity);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, m);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setFirstVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setLastVertexHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		m.setSeqendHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEllipseReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEllipseReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEllipseReader1314.java	(revision 435)
@@ -0,0 +1,90 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgEllipseReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgEllipse))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgEllipse");
+		DwgEllipse ell = (DwgEllipse) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, ell);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		ell.setCenter(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		ell.setSemiMajorAxisVector(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		ell.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double axisRatio = ((Double) val.get(1)).doubleValue();
+		ell.setAxisRatio(axisRatio);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double startAngle = ((Double) val.get(1)).doubleValue();
+		ell.setInitAngle(startAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double endAngle = ((Double) val.get(1)).doubleValue();
+		ell.setEndAngle(endAngle);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, ell);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLwPolylineReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLwPolylineReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLwPolylineReader1314.java	(revision 435)
@@ -0,0 +1,155 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgLwPolylineReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLwPolyline))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgLwPolyline");
+		DwgLwPolyline l = (DwgLwPolyline) dwgObj;
+		int bitPos = offset;
+		
+		bitPos = headTailReader.readObjectHeader(data, bitPos, l);
+		
+	
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flag = ((Integer) val.get(1)).intValue();
+		l.setFlag(flag);
+		
+		double dVal = 0d;
+		if((flag & 0x4) > 0){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dVal = ((Double) val.get(1)).doubleValue();
+		}
+		l.setConstWidth(dVal);
+		
+		dVal = 0d;
+		if((flag & 0x8) > 0){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dVal = ((Double) val.get(1)).doubleValue();
+		}
+		l.setElevation(dVal);
+		
+		dVal = 0d;
+		if ((flag & 0x2) > 0){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dVal = ((Double) val.get(1)).doubleValue();
+		}
+		l.setThickness(dVal);
+		
+		double x, y, z ;
+		x = 0d;
+		y = 0d; 
+		z = 0d;
+		
+		if ((flag & 0x1) > 0){
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			x = ((Double) val.get(1)).doubleValue();
+			
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			y = ((Double) val.get(1)).doubleValue();
+			
+			val = DwgUtil.getBitDouble(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			z = ((Double) val.get(1)).doubleValue();
+		}
+		l.setNormal(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int np = ((Integer) val.get(1)).intValue();
+		
+		int nb = 0;
+		if((flag & 0x10) > 0){
+			val = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			nb = ((Integer) val.get(1)).intValue();
+		}
+		if(nb > 10000)
+    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
+		
+		int nw = 0;
+		if((flag & 0x20) > 0){
+			val = DwgUtil.getBitLong(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			nw = ((Integer) val.get(1)).intValue();
+		}
+		
+		if(nw > 10000)
+    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
+		
+		if(np > 0){
+			if(np > 10000)
+	    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
+			List points = new ArrayList();
+			for(int i = 0; i < np; i++){
+				val = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				x = ((Double) val.get(1)).doubleValue();
+				
+				val = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				y = ((Double) val.get(1)).doubleValue();
+				
+				points.add(new double[]{x,y});
+			}//for
+			l.setVertices(points);
+		}//if np
+		
+		if(nb > 0){
+			double[] bulges = new double[nb];
+			for(int i = 0; i < nb; i++){
+				val = DwgUtil.getRawDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				bulges[i] = ((Double) val.get(1)).doubleValue();
+			}//for
+			l.setBulges(bulges);
+		}//if nb
+		
+		if(nw > 0){
+			double[][] widths = new double[nw][2];
+			for(int i = 0; i < nw; i++){
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double sw = ((Double) val.get(1)).doubleValue();
+				
+				val = DwgUtil.getBitDouble(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				double ew = ((Double) val.get(1)).doubleValue();
+				
+				widths[i][0] = sw;
+				widths[i][1] = ew;
+			}//for
+			l.setWidths(widths);
+		}
+		bitPos = headTailReader.readObjectTailer(data, bitPos, l);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReader1314.java	(revision 435)
@@ -0,0 +1,26 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImageDefReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgCircleReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgCircleReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgCircleReader1314.java	(revision 435)
@@ -0,0 +1,71 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgCircleReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgCircle))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgCircle");
+		 DwgCircle circle = (DwgCircle) dwgObj;
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, offset, circle );
+		
+		 List val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 circle.setCenter(new double[]{x, y, z});
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double radius = ((Double) val.get(1)).doubleValue();
+		 circle.setRadius(radius);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double thickness = ((Double) val.get(1)).doubleValue();
+		 circle.setThickness(thickness);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 z = ((Double) val.get(1)).doubleValue();
+		 circle.setExtrusion(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, circle);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockHeaderReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockHeaderReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockHeaderReader1314.java	(revision 435)
@@ -0,0 +1,137 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+
+
+/**
+ * @author alzabord
+ *
+ */
+public class DwgBlockHeaderReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	
+	//TODO REVISAR COMO TRATAR LAS REFERENCIAS EXTERNAS
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgBlockHeader))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgBlockHeader");
+		 DwgBlockHeader blk = (DwgBlockHeader) dwgObj;
+		 int bitPos = offset;
+		 
+		 List val = DwgUtil.getBitLong(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int numReactors = ((Integer) val.get(1)).intValue();
+		 blk.setNumReactors(numReactors);
+		
+		 val = DwgUtil.getTextString(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 String name = (String) val.get(1);
+		 blk.setName(name);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean flag64 = ((Boolean) val.get(1)).booleanValue();
+		 blk.setFlag64(flag64);
+		 
+		 val = DwgUtil.getBitShort(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int xRefPlus = ((Integer) val.get(1)).intValue();
+		 blk.setXRefPlus(xRefPlus);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean xdep = ((Boolean) val.get(1)).booleanValue();
+		 blk.setXdep(xdep);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean anonymous = ((Boolean) val.get(1)).booleanValue();
+		 blk.setAnonymous(anonymous);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean hasAttr = ((Boolean) val.get(1)).booleanValue();
+		 blk.setHasAttrs(hasAttr);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean blkIsXref = ((Boolean) val.get(1)).booleanValue();
+		 blk.setBlkIsXRef(blkIsXref);
+		 
+		 val = DwgUtil.testBit(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 boolean xOver = ((Boolean) val.get(1)).booleanValue();
+		 blk.setXRefOverLaid(xOver);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 blk.setBasePoint(new double[]{x, y, z});
+		 
+		 val = DwgUtil.getTextString(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 String xRefPname = (String) val.get(1);
+		 blk.setXRefPName(xRefPname);
+		 
+		 DwgHandleReference handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setBlockControlHandle(handle);
+		 
+		 for( int i = 0; i < numReactors; i++){
+			 handle = new DwgHandleReference();
+			 bitPos = handle.read(data, bitPos);
+			 blk.addReactorHandle(handle);
+		 }
+		 
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setXDicObjHandle(handle);
+		 
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setNullHandle(handle);
+		 
+		 //En python no se llama a head ni tailer,
+		 //luego este debe ser el handle
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setHandle(handle);
+		 
+		 /*
+		  * Esto aclara algo: un bloque solo mantiene referencias
+		  * a sus entidades SI NO ES UNA REFERENCIA EXTERNA
+		  * */
+		 if(! blkIsXref && ! xOver){
+			 handle = new DwgHandleReference();
+			 bitPos = handle.read(data, bitPos);
+			 blk.setFirstEntityHandle(handle);
+			 
+			 handle = new DwgHandleReference();
+			 bitPos = handle.read(data, bitPos);
+			 blk.setLastEntityHandle(handle);
+		 }
+		 handle = new DwgHandleReference();
+		 bitPos = handle.read(data, bitPos);
+		 blk.setEndBlkEntityHandle(handle);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgArcReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgArcReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgArcReader1314.java	(revision 435)
@@ -0,0 +1,81 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgArc;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgArcReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgArc))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgArc");
+		DwgArc arc = (DwgArc) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, arc);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		arc.setCenter(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double radius = ((Double) val.get(1)).doubleValue();
+		arc.setRadius(radius);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double thickness = ((Double) val.get(1)).doubleValue();
+		arc.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		arc.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double startAngle = ((Double) val.get(1)).doubleValue();
+		arc.setInitAngle(startAngle);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double endAngle = ((Double) val.get(1)).doubleValue();
+		arc.setEndAngle(endAngle);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, arc);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgXrecordReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgXrecordReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgXrecordReader1314.java	(revision 435)
@@ -0,0 +1,44 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgXRecord;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgXrecordReader1314 extends AbstractDwg1314Reader {
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgXRecord))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgXrecord");
+		 DwgXRecord v = (DwgXRecord) dwgObj;
+		 int bitPos = offset;
+		 
+		 List val = DwgUtil.getBitLong(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int numReactors = ((Integer) val.get(1)).intValue();
+		 
+		 val = DwgUtil.getBitLong(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int numDataBytes = ((Integer) val.get(1)).intValue();
+		 
+		 //FIXME More stuff here....
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSolidReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSolidReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSolidReader1314.java	(revision 435)
@@ -0,0 +1,96 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSolidReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSolid))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSeqEnd");
+		DwgSolid s = (DwgSolid)dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj );
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double thickness = ((Double) val.get(1)).doubleValue(); 
+		s.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double elevation = ((Double) val.get(1)).doubleValue(); 
+		s.setElevation(elevation);
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue(); 
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue(); 
+		s.setCorner1(new double[]{x, y, elevation});
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue(); 
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue(); 
+		s.setCorner2(new double[]{x, y, elevation});
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue(); 
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue(); 
+		s.setCorner3(new double[]{x, y, elevation});
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue(); 
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue(); 
+		s.setCorner4(new double[]{x, y, elevation});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue(); 
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue(); 
+		s.setCorner3(new double[]{x, y, elevation});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue(); 
+		s.setExtrusion(new double[]{x, y, z});
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, s);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceReader1314.java	(revision 435)
@@ -0,0 +1,103 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/03/20 19:57:09  azabala
+* source code cleaning
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+
+
+public class DwgVertexPFaceReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		
+		 if(! (dwgObj instanceof DwgVertexPFace))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertexPFace");
+		 DwgVertexPFace v = (DwgVertexPFace) dwgObj;
+		
+		 int bitPos = offset;
+		 bitPos = headTailReader.readObjectHeader(data, bitPos, v);
+		 
+		 List val = DwgUtil.getRawChar(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 int flags = ((Integer) val.get(1)).intValue();
+		 v.setFlags(flags);
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double x = ((Double) val.get(1)).doubleValue();
+		
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double y = ((Double) val.get(1)).doubleValue();
+		 
+		 val = DwgUtil.getBitDouble(data, bitPos);
+		 bitPos = ((Integer) val.get(0)).intValue();
+		 double z = ((Double) val.get(1)).doubleValue();
+		 v.setPoint(new double[]{x, y, z});
+		 
+		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerReader1314.java	(revision 435)
@@ -0,0 +1,104 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgLayerReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLayer))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgLayer");
+		DwgLayer lyr = (DwgLayer) dwgObj;
+		int bitPos = offset;
+		
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int numReactors = ((Integer) val.get(1)).intValue(); 
+		lyr.setNumReactors(numReactors);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		String name = (String) val.get(1); 
+		lyr.setName(name);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean flag64 = ((Boolean) val.get(1)).booleanValue();
+		lyr.setFlag64(flag64);
+		
+		//TODO Las layers tb pueden ser referencia externa??
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int xRefPlus = ((Integer) val.get(1)).intValue();
+		lyr.setXRefPlus(xRefPlus);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean xdep = ((Boolean) val.get(1)).booleanValue();
+		lyr.setXdep(xdep);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean frozen = ((Boolean) val.get(1)).booleanValue();
+		lyr.setFrozen(frozen);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean on = ((Boolean) val.get(1)).booleanValue();
+		lyr.setOn(on);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean frozenInNew = ((Boolean) val.get(1)).booleanValue();
+		lyr.setFrozenInNew(frozenInNew);
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean locked = ((Boolean) val.get(1)).booleanValue();
+		lyr.setLocked(locked);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int color = ((Integer) val.get(1)).intValue();
+		lyr.setColor(color);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setLayerControlHandle(handle);
+		
+		for(int i = 0; i < numReactors; i++){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			lyr.addReactorHandle(handle);
+		}
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setXDicObjHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setNullHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setLineTypeHandle(handle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerControlReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerControlReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLayerControlReader1314.java	(revision 435)
@@ -0,0 +1,58 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgLayerControl;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgLayerControlReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgLayerControl))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgLayer");
+		DwgLayerControl lyr = (DwgLayerControl) dwgObj;
+		int bitPos = offset;
+		
+		List val = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int numReactors = ((Integer) val.get(1)).intValue();
+		lyr.setNumReactors(numReactors);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int ne = ((Integer) val.get(1)).intValue();
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setNullHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		lyr.setXDicObjHandle(handle);
+		
+		if(ne > 0){
+			List handles = new ArrayList();
+			for (int i = 0; i < ne; i++){
+				handle = new DwgHandleReference();
+				bitPos = handle.read(data, bitPos);
+				handles.add(handle);
+			}
+			lyr.setCode2Handles(handles);
+		}
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDimOrdReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDimOrdReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgDimOrdReader1314.java	(revision 435)
@@ -0,0 +1,209 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgDimOrdReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgDimOrd;
+
+
+public class DwgDimOrdReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		 if(! (dwgObj instanceof DwgDimOrd))
+		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgDimOrd");
+		
+		DwgDimOrd dim = (DwgDimOrd) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, dim);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		dim.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		dim.setTextMidPoint(new double[]{x, y});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double elevation = ((Double) val.get(1)).doubleValue();
+		dim.setElevation(elevation);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		dim.setFlags(flags);
+		
+		val = DwgUtil.getTextString(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		String txt = (String) val.get(1);
+		dim.setText(txt);
+		
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double textRotation = ((Double) val.get(1)).doubleValue();
+		dim.setTextRotation(textRotation);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double horizDir = ((Double) val.get(1)).doubleValue();
+		dim.setHorizDir(horizDir);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		z = ((Double) val.get(1)).doubleValue();
+		dim.setInsScale(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double insRotation = ((Double) val.get(1)).doubleValue();
+		dim.setInsRotation(insRotation);
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double v1 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getRawDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double v2 = ((Double) val.get(1)).doubleValue();
+		dim.set12Pt(new double[]{v1, v2});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v1 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v2 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double v3 = ((Double) val.get(1)).doubleValue();
+		dim.set10Pt(new double[]{v1, v2, v3});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v1 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v2 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v3 = ((Double) val.get(1)).doubleValue();
+		dim.set13Pt(new double[]{v1, v2, v3});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v1 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v2 = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v3 = ((Double) val.get(1)).doubleValue();
+		dim.set14Pt(new double[]{v1, v2, v3});
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		flags = ((Integer) val.get(1)).intValue();
+		dim.setFlags2(flags);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dim);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dim.setDimStyleHandle(handle);
+		
+		handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dim.setAnonBlockHandle(handle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSeqEndReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSeqEndReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSeqEndReader1314.java	(revision 435)
@@ -0,0 +1,28 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.objects.DwgSeqend;
+
+
+/**
+ * @author alzabord
+ */
+public class DwgSeqEndReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgSeqend))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSeqEnd");
+
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, dwgObj );
+		bitPos = headTailReader.readObjectTailer(data, bitPos, dwgObj);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLinearDimensionReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLinearDimensionReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLinearDimensionReader1314.java	(revision 435)
@@ -0,0 +1,34 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.readers.IDwgFileReader;
+import org.gvsig.dwg.lib.readers.IDwgObjectReader;
+
+
+/**
+ * @author alzabord
+ *
+ */
+public class DwgLinearDimensionReader1314 implements IDwgObjectReader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#setFileReader(com.iver.cit.jdwglib.dwg.readers.IDwgFileReader)
+	 */
+	public void setFileReader(IDwgFileReader headTailReader) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline2DReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline2DReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline2DReader1314.java	(revision 435)
@@ -0,0 +1,92 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPolyline2DReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline2D))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgPolyline2d");
+		DwgPolyline2D l = (DwgPolyline2D)dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, offset, l);
+		
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		l.setFlags(flags);
+		
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int curveType = ((Integer) val.get(1)).intValue();
+		l.setCurveType(curveType);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double startWidth = ((Double) val.get(1)).doubleValue();
+		l.setInitWidth(startWidth);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double endWidth = ((Double) val.get(1)).doubleValue();
+		l.setEndWidth(endWidth);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double thickness = ((Double) val.get(1)).doubleValue();
+		l.setThickness(thickness);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double elevation = ((Double) val.get(1)).doubleValue();
+		l.setElevation(elevation);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double x = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double y = ((Double) val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		double z = ((Double) val.get(1)).doubleValue();
+		l.setExtrusion(new double[]{x, y, z});
+		
+		bitPos = headTailReader.readObjectTailer(data, offset, l);
+		
+		DwgHandleReference firstVerHdl = new DwgHandleReference();
+		bitPos = firstVerHdl.read(data, bitPos);
+		l.setFirstVertexHandle(firstVerHdl);
+		
+		DwgHandleReference lastVerHdl = new DwgHandleReference();
+		bitPos = lastVerHdl.read(data, bitPos);
+		l.setLastVertexHandle(lastVerHdl);
+		
+		DwgHandleReference seqendHdl = new DwgHandleReference();
+		bitPos = seqendHdl.read(data, bitPos);
+		l.setSeqendHandle(seqendHdl);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMinsertReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMinsertReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMinsertReader1314.java	(revision 435)
@@ -0,0 +1,151 @@
+/*
+ * Created on 02-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMinsertReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/07 12:45:21  fdiaz
+* *** empty log message ***
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgMinsert;
+
+
+public class DwgMinsertReader1314 extends AbstractDwg1314Reader {
+
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
+			throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgInsert))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgMInsert");
+		DwgMinsert insert = (DwgMinsert) dwgObj;
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, insert);
+		
+		List val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double z = ((Double)val.get(1)).doubleValue();
+		insert.setInsertionPoint(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		insert.setScale(new double[]{x, y, z});
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		double rotation = ((Double)val.get(1)).doubleValue();
+		insert.setRotation(rotation);
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		x = ((Double)val.get(1)).doubleValue();
+		
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		y = ((Double)val.get(1)).doubleValue();
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		z = ((Double)val.get(1)).doubleValue();
+		insert.setExtrusion(new double[]{x, y, z});
+		
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer)val.get(0)).intValue();
+		boolean hasAttr = ((Boolean)val.get(1)).booleanValue();
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, insert);
+		
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		insert.setBlockHeaderHandle(handle);
+		
+		if(hasAttr){
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setFirstAttribHandle(handle);
+			
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setLastAttribHandle(handle);
+			
+			handle = new DwgHandleReference();
+			bitPos = handle.read(data, bitPos);
+			insert.setSeqEndHandle(handle);
+		}//if
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline3DReader1314.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline3DReader1314.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgPolyline3DReader1314.java	(revision 435)
@@ -0,0 +1,59 @@
+/*
+ * Created on 25-ene-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.readers.v1314;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgPolyline3DReader1314 extends AbstractDwg1314Reader{
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
+		if(! (dwgObj instanceof DwgPolyline3D))
+	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgPolyline3d");
+		DwgPolyline3D l = (DwgPolyline3D)dwgObj;
+		
+		int bitPos = offset;
+		bitPos = headTailReader.readObjectHeader(data, bitPos, l);
+		
+		List val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int flags = ((Integer) val.get(1)).intValue();
+		l.setSplineFlags(flags);
+		
+		val = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int closedFlags = ((Integer) val.get(1)).intValue();
+		l.setClosedFlags(closedFlags);
+		
+		bitPos = headTailReader.readObjectTailer(data, bitPos, l);
+		
+		DwgHandleReference firstVerHdl = new DwgHandleReference();
+		bitPos = firstVerHdl.read(data, bitPos);
+		l.setFirstVertexHandle(firstVerHdl);
+		
+		DwgHandleReference lastVerHdl = new DwgHandleReference();
+		bitPos = lastVerHdl.read(data, bitPos);
+		l.setLastVertexHandle(lastVerHdl);
+		
+		DwgHandleReference seqendHdl = new DwgHandleReference();
+		bitPos = seqendHdl.read(data, bitPos);
+		l.setSeqendHandle(seqendHdl);
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV14Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV14Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV14Reader.java	(revision 435)
@@ -0,0 +1,1914 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.readers;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgClass;
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgObjectFactory;
+import org.gvsig.dwg.lib.DwgObjectOffset;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * The DwgFileV14Reader reads the DWG version 14 format
+ *
+ * @author jmorell
+ */
+public class DwgFileV14Reader implements IDwgFileReader {
+
+	protected DwgFile dwgFile;
+
+	protected ByteBuffer bb;
+
+	private static Logger logger = LoggerFactory.getLogger(DwgFileV14Reader.class
+			.getName());
+	
+	/**
+	 * Reads the DWG version 15 format
+	 *
+	 * @param dwgFile
+	 *            Represents the DWG file that we want to read
+	 * @throws IOException
+	 *             When DWG file path is wrong
+	 */
+	public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException {
+		this.dwgFile = dwgFile;
+		this.bb = bb;
+		try {
+			readDwgSectionOffsets();
+			readHeaders();
+			readDwgClasses();
+			readDwgObjectOffsets();
+			readDwgObjects();
+		} catch (Exception e) {
+			e.printStackTrace();
+			logger.error(e.getMessage());
+		}
+
+	}
+
+	/**
+	 * It reads all HEADER section of a DWG 13-14 file.
+	 *
+	 * This method must be called only for debug purposes because we dont the
+	 * meaning (or the practical application) of the fields readed with it
+	 *
+	 * TODO Pasarlo a la clase abstracta comun que se haga de las versiones 15,
+	 * 13-14 (la cabecera es la misma practicamente)
+	 *
+	 *
+	 */
+	protected void readHeaders() {
+
+		int offset = dwgFile.getDwgSectionOffset("HEADERS");
+		bb.position(offset);
+
+		//1� leemos el sentinnel inicial
+		bb.order(ByteOrder.nativeOrder());
+		byte[] sentinel = new byte[16];
+		bb.get(sentinel);
+
+		if (sentinel[0] != 0xcf)
+			logger.warn("sentinel[0] != 0xcf");
+		if (sentinel[1] != 0x7b)
+			logger.warn("sentinel[1] != 0x7b");
+		if (sentinel[2] != 0x1f)
+			logger.warn("sentinel[2] != 0x1f");
+		if (sentinel[3] != 0x23)
+			logger.warn("sentinel[3] != 0x23");
+		if (sentinel[4] != 0xfd)
+			logger.warn("sentinel[4] != 0xfd");
+		if (sentinel[5] != 0xde)
+			logger.warn("sentinel[5] != 0xde");
+		if (sentinel[6] != 0x38)
+			logger.warn("sentinel[6] != 0x38");
+		if (sentinel[7] != 0xa9)
+			logger.warn("sentinel[7] != 0xa9");
+		if (sentinel[8] != 0x5f)
+			logger.warn("sentinel[8] != 0x5f");
+		if (sentinel[9] != 0x7c)
+			logger.warn("sentinel[9] != 0x7c");
+		if (sentinel[10] != 0x68)
+			logger.warn("sentinel[10] != 0x68");
+		if (sentinel[11] != 0xb8)
+			logger.warn("sentinel[11] != 0xb8");
+		if (sentinel[12] != 0x4e)
+			logger.warn("sentinel[12] != 0x4e");
+		if (sentinel[13] != 0x6d)
+			logger.warn("sentinel[13] != 0x6d");
+		if (sentinel[14] != 0x33)
+			logger.warn("sentinel[14] != 0x33");
+		if (sentinel[15] != 0x5f)
+			logger.warn("sentinel[15] != 0x5f");
+
+		//2� seguidamente leemos los datos
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int size = bb.getInt();
+
+		bb.order(ByteOrder.nativeOrder());
+		byte[] data = new byte[size];
+		bb.get(data);
+
+		int[] intData = DwgUtil.toIntArray(data);
+
+		//3� a continuacion el CRC de la seccion HEADER
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short crc = bb.getShort();
+
+		//Por ultimo, el sentinnel final
+		bb.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16];
+		bb.get(lastSentinnel);
+		if (lastSentinnel[0] != 0x30)
+			logger.warn("lastSentinnel[0] != 0x30");
+		if (lastSentinnel[1] != 0x84)
+			logger.warn("lastSentinnel[1] != 0x84");
+		if (lastSentinnel[2] != 0xe0)
+			logger.warn("lastSentinnel[2] != 0xe0");
+		if (lastSentinnel[3] != 0xdc)
+			logger.warn("lastSentinnel[3] != 0xdc");
+		if (lastSentinnel[4] != 0x02)
+			logger.warn("lastSentinnel[4] != 0x02");
+		if (lastSentinnel[5] != 0x21)
+			logger.warn("lastSentinnel[5] != 0x21");
+		if (lastSentinnel[6] != 0xc7)
+			logger.warn("lastSentinnel[6] != 0xc7");
+		if (lastSentinnel[7] != 0x56)
+			logger.warn("lastSentinnel[7] != 0x56");
+		if (lastSentinnel[8] != 0xa0)
+			logger.warn("lastSentinnel[8] != 0xa0");
+		if (lastSentinnel[9] != 0x83)
+			logger.warn("lastSentinnel[9] != 0x83");
+		if (lastSentinnel[10] != 0x97)
+			logger.warn("lastSentinnel[10] != 0x97");
+		if (lastSentinnel[11] != 0x47)
+			logger.warn("lastSentinnel[11] != 0x47");
+		if (lastSentinnel[12] != 0xb1)
+			logger.warn("lastSentinnel[12] != 0xb1");
+		if (lastSentinnel[13] != 0x92)
+			logger.warn("lastSentinnel[13] != 0x92");
+		if (lastSentinnel[14] != 0xcc)
+			logger.warn("lastSentinnel[14] != 0xcc");
+		if (lastSentinnel[15] != 0xa0)
+			logger.warn("lastSentinnel[15] != 0xa0");
+
+		//Ahora interpretamos los datos en bruto
+		int bitPos = 0;
+		try {
+			List val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL4", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING1", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING2", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING3", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING4", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG1", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHORT1", val.get(1));
+
+			//TODO REFACTORIZAR ESTO PARA USAR DWGHANDLEREFERENCE
+
+			//TODO Los handle se leen asi??
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HANDLE1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASO", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSHO", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSAV", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEGEN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ORTHOMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("REGENMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("QTEXTMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSLTSCALE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LIMCHECK", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("BLIPMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USER_TIMER", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKPOLY", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGDIR", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLFRAME", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ATTREQ", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ATTDIA", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MIRRTEXT", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("WORLDVIEW", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("WIREFRAME", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TILEMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLIMCHECK", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VISRETAIN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DELOBJ", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DISPSILH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PELLISE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			if (dwgFile.getDwgVersion() == "R14")
+				dwgFile.setHeader("PROXYGRAPH", val.get(1));
+			else
+				dwgFile.setHeader("SAVEIMAGES", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DRAGMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TREEDEPTH", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUPREC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUPREC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("OSMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ATTMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("COORDS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PICKSTYLE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI3", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI4", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI5", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINESEGS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFV", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINETYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDGE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDIF", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNITMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MAXACTVP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ISOLINES", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLJUST", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTQLTY", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LTSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TRACEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKETCHINC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLETRAD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("THICKNESS", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGBASE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR4", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR5", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERA", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERB", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FACETRES", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CELTSCALE", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MENUNAME", val.get(1));
+
+			int[] tdcreate = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[0] = ((Integer) val.get(1)).intValue();
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDCREATE", tdcreate);
+
+			int[] tdupdate = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[0] = ((Integer) val.get(1)).intValue();
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDUPDATE", tdupdate);
+
+			int[] tdindwg = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[0] = ((Integer) val.get(1)).intValue();
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDINDWG", tdindwg);
+
+			int[] tdusrtime = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[0] = ((Integer) val.get(1)).intValue();
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDUSRTIME", tdusrtime);
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CECOLOR", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("HANDSEED", new Integer(intHandle));
+
+			//creo que CLAYER marca la capa actualmente seleccionada en el menu
+			// de
+			// autocad
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("TEXSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CELLTYPE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CMLSTYLE", new Integer(intHandle));
+
+			double[] spaces1 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_INSBASE", spaces1);
+
+			double[] spaces2 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_EXTMIN", spaces2);
+
+			double[] spaces3 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_EXTMAX", spaces2);
+
+			double[] spaces4 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_LIMMIN", spaces4);
+
+			double[] spaces5 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_LIMMAX", spaces5);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSPACE_ELEVATION", val.get(1));
+
+			double[] spaces6 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSORG", spaces6);
+
+			double[] spaces7 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSXDIR", spaces7);
+
+			double[] spaces8 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSYDIR", spaces8);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PSPACE_UCSNAME", new Integer(intHandle));
+
+			double[] spaces9 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_INSBASE", spaces9);
+
+			double[] spaces10 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_EXTMIN", spaces10);
+
+			double[] spaces11 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_EXTMAX", spaces11);
+
+			double[] spaces12 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_LIMMIN", spaces12);
+
+			double[] spaces13 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_LIMMAX", spaces13);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MSPACE_ELEVATION", (Double) val.get(1));
+
+			double[] spaces14 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSORG", spaces14);
+
+			double[] spaces15 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSXDIR", spaces15);
+
+			double[] spaces16 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSYDIR", spaces16);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MSPACE_UCSNAME", new Integer(intHandle));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLIM", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSE1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTSE2", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALT", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOFL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSAH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIX", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSOXD", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTD", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMZIN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD2", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOLJ", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMJUST", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMFINT", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMUPT", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMZIN", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTZ", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTZ", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTAD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTD", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMTXSTY", new Integer(intHandle));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXO", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLI", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAND", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTM", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTXT", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCEN", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTF", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTVP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMGAP", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMPOST", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAPOST", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMBLK", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMBLK1", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMBLK2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRT", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("BLOCK_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LAYER_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("STYLE_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile
+					.setHeader("LINETYPE_CONTROL_OBJECT",
+							new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VIEW_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCS_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VPORT_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("APPID_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile
+					.setHeader("DIMSTYLE_CONTROL_OBJECT",
+							new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VIEWPORT_ENTITY_HEADER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_GROUP_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_MLINE_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile
+					.setHeader("NAMED_OBJECT_DICTIONARY",
+							new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PAPER_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MODEL_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYBLOCK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_CONTINUOUS", new Integer(intHandle));
+
+			//		    # remaing bits are unknown, and they end with possible
+			//		    # padding bits so that 16-bit CRC value after the data
+			//		    # is on a byte boundary - ignore them for now ...
+
+		} catch (Exception e) {
+			logger.error(e.getMessage());
+		}
+	}
+
+	/**
+	 * It read the SECTIONS from the header of the DWG file
+	 *
+	 * TODO Mover esto a una clase abstracta Reader, pues es similar para DWG 15
+	 * (o hacer que esta herede de DWG 15)
+	 *
+	 *
+	 *
+	 */
+	protected void readDwgSectionOffsets() {
+		//6 primeros bytes: version de autocad
+
+		//7 siguientes bytes: 6 ceros y un 1 (0000001)
+		//No obstante, la especificaci�n Python dice que los bytes que lee
+		//con _buf.fromfile(handle, 7) son bytes de la maquina. REVISAR
+
+		/*
+		 * Asi se hace copiando integramente Python. Ver si funciona NIO byte[]
+		 * chunk = {bb.get(), bb.get(), bb.get(), bb.get(), bb.get(), bb.get(),
+		 * bb.get()};
+		 */
+
+		bb.position(6);
+
+		bb.order(ByteOrder.nativeOrder());
+		byte[] chunk = new byte[7];
+		bb.get(chunk);
+
+		if (chunk[0] != 0)
+			logger.warn("chunk[0] != 0");
+		if (chunk[1] != 0)
+			logger.warn("chunk[1] != 0");
+		if (chunk[2] != 0)
+			logger.warn("chunk[2] != 0");
+		if (chunk[3] != 0)
+			logger.warn("chunk[3] != 0");
+		if (chunk[4] != 0)
+			logger.warn("chunk[4] != 0");
+		if (chunk[5] != 0)
+			logger.warn("chunk[5] != 0");
+		if (chunk[6] != 0)
+			logger.warn("chunk[6] != 0");
+
+		/*
+		 *
+		 */
+
+		//Siempre que en python una lectura se haga as� '<'+loquesea
+		//hay que poner little_endian. Si no, se dejan los de la maquina
+		// (y si aparece > se pone big endian)
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		byte _ub1 = bb.get();
+		byte _ub2 = bb.get();
+		int imageSeeker = bb.getInt();
+		/*
+		 * TRATAMIENTO DEL IMAGE_SEEKER: LECTURA DE IMAGENES BMP y WMF
+		 * incrustadas if _image_seeker != 0: _offsets['IMAGE'] = _image_seeker
+		 * _offset = handle.tell() _bmpdata, _wmfdata = read_image(handle,
+		 * _image_seeker) handle.seek(_offset, 0) print "image seeker to %#x" %
+		 * _image_seeker print "offset at %#x" % handle.tell()
+		 */
+
+		bb.position(19);//en realidad ya hemos leido 20 bytes
+
+		short codePage = bb.getShort();
+		int count = bb.getInt();
+
+		for (int i = 0; i < count; i++) {
+
+			byte rec = bb.get();
+			int seek = bb.getInt();
+			int size = bb.getInt();
+
+			String sectionName = "";
+			switch (rec) {
+			case 0:
+				sectionName = "HEADERS";
+				break;
+
+			case 1:
+				sectionName = "CLASSES";
+				break;
+
+			case 2:
+				sectionName = "OBJECTS";
+				break;
+			case 3:
+				sectionName = "UNKNOWN";
+				break;
+			case 4:
+				sectionName = "R14DATA";
+				break;
+			case 5:
+				sectionName = "R14_REC5";
+				break;
+			default:
+				logger.warn("Seccion con codigo desconocido:" + rec);
+				break;
+
+			}//switch
+			dwgFile.addDwgSectionOffset(sectionName, seek, size);
+		}//for
+
+		//finalmente se lee el CRC
+		short _crc = bb.getShort();
+		logger.info("CRC=" + _crc);
+
+		//Seguidamente aparece una seccion fija de 16 bytes
+		//Esto hay que leerlo como "bytes de la maquina"
+		//TODO Ver si esto afecta
+		bb.order(ByteOrder.nativeOrder());
+
+		byte[] c2 = new byte[16];
+		bb.get(c2);
+		if (c2[0] != 0x95)
+			logger.warn("c2[0] != 0x95");
+		if (c2[1] != 0xa0)
+			logger.warn("c2[1] != 0xa0");
+		if (c2[2] != 0x4e)
+			logger.warn("c2[2] != 0x4e");
+		if (c2[3] != 0x28)
+			logger.warn("c2[3] != 0x28");
+		if (c2[4] != 0x99)
+			logger.warn("c2[4] != 0x99");
+		if (c2[5] != 0x82)
+			logger.warn("c2[5] != 0x82");
+		if (c2[6] != 0x1a)
+			logger.warn("c2[6] != 0x1a");
+		if (c2[7] != 0xe5)
+			logger.warn("c2[7] != 0xe5");
+		if (c2[8] != 0x5e)
+			logger.warn("c2[8] != 0x5e");
+		if (c2[9] != 0x41)
+			logger.warn("c2[9] != 0x41");
+		if (c2[10] != 0xe0)
+			logger.warn("c2[10] != 0xe0");
+		if (c2[11] != 0x5f)
+			logger.warn("c2[11] != 0x5f");
+		if (c2[12] != 0x9d)
+			logger.warn("c2[12] != 0x9d");
+		if (c2[13] != 0x3a)
+			logger.warn("c2[13] != 0x3a");
+		if (c2[14] != 0x4d)
+			logger.warn("c2[14] != 0x4d");
+		if (c2[15] != 0x00)
+			logger.warn("c2[15] != 0x00");
+	}
+
+	/*
+	 * TODO Probar, y si no va, meter el codigo del lector de V15 (es SIMILAR,
+	 * llevar a clase abstracta comun)
+	 */
+	protected void readDwgObjectOffsets() throws Exception {
+		int offset = dwgFile.getDwgSectionOffset("OBJECTS");
+		bb.position(offset);
+		while (true) {
+			bb.order(ByteOrder.BIG_ENDIAN);
+			short size = bb.getShort();
+			if (size == 2)
+				break;
+			//TODO Cuando en Python no pone < ni >, es nativeOrder o
+			// little_endian??
+			//			bb.order(ByteOrder.LITTLE_ENDIAN);
+			bb.order(ByteOrder.nativeOrder());
+			byte[] dataBytes = new byte[size];
+			bb.get(dataBytes);
+
+			/*
+			 * TODO Creo q esto no hace falta, al estar en bytes nativos (no en
+			 * LITTLE_ENDIAN) int[] data =
+			 * DwgUtil.bytesToMachineBytes(dataBytes);
+			 */
+			int[] data = DwgUtil.toIntArray(dataBytes);
+			/*
+			 * the spec says 'last_handle' and 'last_loc' are initialized
+			 * outside the outer for loop - postings on OpenDWG forum say these
+			 * variables must be initialized for each section
+			 */
+			int lastHandle = 0;
+			int lastLoc = 0;
+			int bitPos = 0;
+			int bitMax = (size - 2) * 8;//se quitan 2 bytes por el CRC final
+			while (bitPos < bitMax) {
+				List v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				lastHandle = lastHandle + ((Integer) v.get(1)).intValue();
+				v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				lastLoc = lastLoc + ((Integer) v.get(1)).intValue();
+				dwgFile.addDwgObjectOffset(lastHandle, lastLoc);
+			}//while
+		}//while
+	}
+
+	protected void readDwgClasses() throws Exception {
+		int offset = dwgFile.getDwgSectionOffset("CLASSES");
+		bb.position(offset);
+		//1� leemos el sentinnel inicial
+		bb.order(ByteOrder.nativeOrder());
+		byte[] sentinel = new byte[16];
+		bb.get(sentinel);
+		if (sentinel[0] != 0x8d)
+			logger.warn("sentinel[0] != 0x8d");
+		if (sentinel[1] != 0xa1)
+			logger.warn("sentinel[1] != 0xa1");
+		if (sentinel[2] != 0xc4)
+			logger.warn("sentinel[2] != 0xc4");
+		if (sentinel[3] != 0xb8)
+			logger.warn("sentinel[3] != 0xb8");
+		if (sentinel[4] != 0xc4)
+			logger.warn("sentinel[4] != 0xc4");
+		if (sentinel[5] != 0xa9)
+			logger.warn("sentinel[5] != 0xa9");
+		if (sentinel[6] != 0xf8)
+			logger.warn("sentinel[6] != 0xf8");
+		if (sentinel[7] != 0xc5)
+			logger.warn("sentinel[7] != 0xc5");
+		if (sentinel[8] != 0xc0)
+			logger.warn("sentinel[8] != 0xc0");
+		if (sentinel[9] != 0xdc)
+			logger.warn("sentinel[9] != 0xdc");
+		if (sentinel[10] != 0xf4)
+			logger.warn("sentinel[10] != 0xf4");
+		if (sentinel[11] != 0x5f)
+			logger.warn("sentinel[11] != 0x5f");
+		if (sentinel[12] != 0xe7)
+			logger.warn("sentinel[12] != 0xe7");
+		if (sentinel[13] != 0xcf)
+			logger.warn("sentinel[13] != 0xcf");
+		if (sentinel[14] != 0xb6)
+			logger.warn("sentinel[14] != 0xb6");
+		if (sentinel[15] != 0x8a)
+			logger.warn("sentinel[15] != 0x8a");
+
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int size = bb.getInt();
+		byte[] data = new byte[size];
+		bb.get(data);
+		int[] intData = DwgUtil.toIntArray(data);
+		short crc = bb.getShort();
+
+		int maxBit = size * 8;
+		int bitPos = 0;
+		List val = null;
+		while ((bitPos + 8) < maxBit) {
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int classNum = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int version = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String appName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String cPlusPlusName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String dxfName = (String) val.get(1);
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			boolean isZombie = ((Boolean) val.get(1)).booleanValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int id = ((Integer) val.get(1)).intValue();
+
+			DwgClass dwgClass = new DwgClass(classNum, version, appName,
+					cPlusPlusName, dxfName, isZombie, id);
+			dwgFile.addDwgClass(dwgClass);
+
+		}//while
+		//		Por ultimo, el sentinnel final
+		bb.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16];
+		bb.get(lastSentinnel);
+		if (lastSentinnel[0] != 0x72)
+			logger.warn("lastSentinnel[0] != 0x72");
+		if (lastSentinnel[1] != 0x5e)
+			logger.warn("lastSentinnel[1] != 0x5e");
+		if (lastSentinnel[2] != 0x3b)
+			logger.warn("lastSentinnel[2] != 0x3b");
+		if (lastSentinnel[3] != 0x47)
+			logger.warn("lastSentinnel[3] != 0x47");
+		if (lastSentinnel[4] != 0x3b)
+			logger.warn("lastSentinnel[4] != 0x3b");
+		if (lastSentinnel[5] != 0x56)
+			logger.warn("lastSentinnel[5] != 0x56");
+		if (lastSentinnel[6] != 0x07)
+			logger.warn("lastSentinnel[6] != 0x07");
+		if (lastSentinnel[7] != 0x3a)
+			logger.warn("lastSentinnel[7] != 0x3a");
+		if (lastSentinnel[8] != 0x3f)
+			logger.warn("lastSentinnel[8] != 0x3f");
+		if (lastSentinnel[9] != 0x23)
+			logger.warn("lastSentinnel[9] != 0x23");
+		if (lastSentinnel[10] != 0x0b)
+			logger.warn("lastSentinnel[10] != 0x0b");
+		if (lastSentinnel[11] != 0xa0)
+			logger.warn("lastSentinnel[11] != 0xa0");
+		if (lastSentinnel[12] != 0x18)
+			logger.warn("lastSentinnel[12] != 0x18");
+		if (lastSentinnel[13] != 0x30)
+			logger.warn("lastSentinnel[13] != 0x30");
+		if (lastSentinnel[14] != 0x49)
+			logger.warn("lastSentinnel[14] != 0x49");
+		if (lastSentinnel[15] != 0x75)
+			logger.warn("lastSentinnel[15] != 0x75");
+	}
+
+	/**
+	 * Reads all the object referenced in the object map section of the DWG file
+	 * (using their object file obsets)
+	 */
+	protected void readDwgObjects() {
+		logger.info("Vamos a leer " + dwgFile.getDwgObjectOffsets().size()
+				+ " objetos");
+
+		for (int i = 0; i < dwgFile.getDwgObjectOffsets().size(); i++) {
+			DwgObjectOffset doo = (DwgObjectOffset) dwgFile
+					.getDwgObjectOffsets().get(i);
+			DwgObject obj = readDwgObject(doo.getOffset(), i);
+			if (obj != null && obj.getClass() != DwgObject.class) {
+				dwgFile.addDwgObject(obj);
+			}
+		}//for
+	}
+
+	/**
+	 * Return a dwg object from its index in the dwg file
+	 *
+	 * @param index
+	 *            of the requested dwg object in the dwg file
+	 *
+	 */
+	public DwgObject getDwgObjectByIndex(int index) {
+		DwgObjectOffset doo = (DwgObjectOffset) dwgFile.getDwgObjectOffsets()
+				.get(index);
+		return readDwgObject(doo.getOffset(), index);
+	}
+
+	void dumpEntity(int[] intData){
+		String outtxt= "int[] data = new int[]{";
+		for(int z = 0; z < intData.length -1; z++){
+			outtxt += intData[z] + ",";
+		}
+		outtxt += intData[intData.length -1] + "}";
+		logger.info(outtxt);
+	}
+
+	/**
+	 * Reads a dwg drawing entity (dwg object) given its offset in the file
+	 *
+	 * @param offset
+	 *            offset of the dwg object in the file
+	 * @param index
+	 *            order of the entity in the objects map (1, 2, etc.)
+	 */
+
+	protected DwgObject readDwgObject(int offset, int index) {
+		DwgObject obj = null;
+		try {
+			bb.position(offset);
+			int size = DwgUtil.getModularShort(bb);
+			bb.order(ByteOrder.nativeOrder());
+			byte[] data = new byte[size];
+			bb.get(data);
+			int[] intData = DwgUtil.toIntArray(data);
+			int bitPos = 0;
+			List val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int type = ((Integer) val.get(1)).intValue();
+
+			obj = DwgObjectFactory.getInstance().create(type, index);
+			if (obj == null) {
+				if (type >= 500) {
+					int newIndex = type - 500;
+					if (newIndex < (dwgFile.getDwgClasses().size() - 1)) {
+						DwgClass dwgClass = (DwgClass) dwgFile.getDwgClasses()
+								.get(newIndex);
+						String dxfEntityName = dwgClass.getDxfName();
+						obj = DwgObjectFactory.getInstance().create(
+								dxfEntityName, index);
+						if (obj == null) {
+							logger.info(dxfEntityName
+									+ " todavia no est� implementado");
+							return null;
+						}//if
+					}//if newIndex
+					else{
+						return null;
+					}
+				}else {
+					logger.info("Encontrado tipo " + type);
+					return null;
+				}
+			}//if obj == null
+			obj.setVersion(dwgFile.getDwgVersion());
+
+			DwgHandleReference hr = new DwgHandleReference();
+			bitPos = hr.read(intData, bitPos);
+			obj.setHandle(hr);
+
+			//TODO Si funciona, mover el metodo de esta clase a DwgUtil
+			val = readExtendedData(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			List extData = (List) val.get(1);
+			obj.setExtendedData(extData);
+
+			//Graphics data
+			boolean gflag = false;
+			gflag = obj.isGraphicsFlag();
+			if (gflag) {
+				val = DwgUtil.testBit(intData, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				boolean hasGraphicsData = ((Boolean) val.get(1))
+						.booleanValue();
+				//si hay imagen asociada, se lee por completo
+				if (hasGraphicsData) {
+					val = DwgUtil.getRawLong(intData, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					size = ((Integer) val.get(1)).intValue();
+					int bgSize = size * 8;
+					Integer giData = (Integer) DwgUtil.getBits(intData,
+							bgSize, bitPos);
+					obj.setGraphicData(giData.intValue());
+					bitPos = bitPos + bgSize;
+				}
+			}//if gflag
+
+			//size in bits
+			val = DwgUtil.getRawLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int sizeInBits = ((Integer) val.get(1)).intValue();
+			obj.setSizeInBits(sizeInBits);
+
+			readSpecificObject(obj, intData, bitPos);
+
+			return obj;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	/*
+	 * TODO Esto est� pesimamente dise�ado. Cada objeto DwgObject debe tener un
+	 * metodo readSpecificObject(data,bitPos)
+	 *
+	 */
+	protected void readSpecificObject(DwgObject obj, int[] data, int bitPos)
+			throws Exception {
+		DwgObjectReaderPool pool = DwgObjectReaderPool.getInstance();
+		IDwgObjectReader reader = pool.get(obj, "1314");
+		if (reader != null) {
+			reader.setFileReader(this);
+			reader.readSpecificObj(data, bitPos, obj);
+		} else {
+			logger.info("No se ha implementado la lectura de "
+					+ obj.getClass().getName() + ", code=" + obj.getType());
+		}
+	}
+
+	/*
+	 * TODO En DwgUtil se dice que este metodo tiene graves errores. Intento de
+	 * reimplementarlo a partir del codigo Python original
+	 */
+	List readExtendedData(int[] data, int bitPos) throws Exception {
+		List solution = new ArrayList();
+		//TODO Ver si el array est� bien, o hay que cambiarlo por un
+		// stringbuffer
+		List extendedData = new ArrayList();
+		int size;
+		List val;
+		while (true) {//TODO VER SI HAY PROBLEMAS DE NO SALIDA
+
+			val = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			size = ((Integer) val.get(1)).intValue();
+			if (size == 0)
+				break;
+
+			DwgHandleReference hr = new DwgHandleReference();
+			bitPos = hr.read(data, bitPos);
+//			logger.debug("Handle del EXTENDED ENTITY DATA:" + hr.getCode()
+//					+ " " + hr.getOffset());
+
+			int count = 0;
+			while (count < size) {
+				val = DwgUtil.getRawChar(data, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				int codeByte = ((Integer) val.get(1)).intValue();
+				count++;
+				if (codeByte == 0x0) {
+					val = DwgUtil.getRawChar(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int slen = ((Integer) val.get(1)).intValue();
+					val = DwgUtil.getRawShort(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int codePage = ((Integer) val.get(1)).intValue();
+//					logger.debug("Extended Data (0x0): code page = "
+//									+ codePage);
+					char[] chars = new char[slen];
+					for (int i = 0; i < slen; i++) {
+						val = DwgUtil.getRawChar(data, bitPos);
+						bitPos = ((Integer) val.get(0)).intValue();
+						chars[i] = (char) ((Integer) val.get(1)).intValue();
+					}//for
+					String str = new String(chars);
+//					logger.debug("Chars:" + str);
+					extendedData.add(str);
+					count += (3 + slen);
+				} else if (codeByte == 0x1) {
+					logger.debug("Invalid extended data code byte: 0x1");
+				} else if (codeByte == 0x2) {
+					val = DwgUtil.getRawChar(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int character = ((Integer) val.get(1)).intValue();
+					if (character == 0x0)
+						extendedData.add("{");
+					else if (character == 0x1)
+						extendedData.add("}");
+					else {
+						logger.warn("Invalid extended data char:" + character);
+					}
+					count++;
+				} else if (codeByte == 0x3) {
+					char[] chars = new char[8];
+					for (int i = 0; i < 8; i++) {
+						val = DwgUtil.getRawChar(data, bitPos);
+						bitPos = ((Integer) val.get(0)).intValue();
+						chars[i] = (char) ((Integer) val.get(1)).intValue();
+					}
+					String str = new String(chars);
+//					logger.debug("Chars:" + str);
+					extendedData.add(str);
+					count += 8;
+				} else if (codeByte == 0x4) {
+					//binary chunk in extended data
+					val = DwgUtil.getRawChar(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int length = ((Integer) val.get(1)).intValue();
+					char[] chars = new char[length];
+					for (int i = 0; i < length; i++) {
+						val = DwgUtil.getRawChar(data, bitPos);
+						bitPos = ((Integer) val.get(0)).intValue();
+						chars[i] = (char) ((Integer) val.get(1)).intValue();
+					}
+					String str = new String(chars);
+//					logger.debug("Chars:" + str);
+					extendedData.add(str);
+					count += (1 + length);
+				} else if (codeByte == 0x5) {
+					//entity handle reference
+					char[] chars = new char[8];
+					for (int i = 0; i < 8; i++) {
+						val = DwgUtil.getRawChar(data, bitPos);
+						bitPos = ((Integer) val.get(0)).intValue();
+						chars[i] = (char) ((Integer) val.get(1)).intValue();
+					}
+					String str = new String(chars);
+//					logger.debug("Chars:" + str);
+					extendedData.add(str);
+					count += 8;
+				} else if ((codeByte >= 0xa) && (codeByte <= 0xd)) {
+					//three doubles
+					double[] dValues = new double[3];
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					dValues[0] = ((Double) val.get(1)).doubleValue();
+
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					dValues[1] = ((Double) val.get(1)).doubleValue();
+
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					dValues[2] = ((Double) val.get(1)).doubleValue();
+
+//					logger.debug("Doubles:" + dValues);
+					extendedData.add(dValues);
+					count += 24;
+				} else if ((codeByte >= 0x28) && (codeByte <= 0x2a)) {
+					//one double
+					val = DwgUtil.getRawDouble(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					double value = ((Double) val.get(1)).doubleValue();
+//					logger.debug("Double value:" + value);
+					extendedData.add(val.get(1));
+					count += 8;
+				} else if (codeByte == 0x46) {
+					//a short value
+					val = DwgUtil.getRawShort(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int value = ((Integer) val.get(1)).intValue();
+//					logger.debug("Short value:" + value);
+					extendedData.add(val.get(1));
+					count += 2;
+				} else if (codeByte == 0x47) {
+					//int value
+					val = DwgUtil.getRawLong(data, bitPos);
+					bitPos = ((Integer) val.get(0)).intValue();
+					int value = ((Integer) val.get(1)).intValue();
+//					logger.debug("Int value:" + value);
+					extendedData.add(val.get(1));
+					count += 4;
+				} else {
+					logger.debug("Unexpected code byte in EXTENDED DATA "
+							+ codeByte);
+				}
+			}//while
+		}//while
+		solution.add(new Integer(bitPos));
+		solution.add(extendedData);
+		return solution;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgFileReader#readObjectHeader(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) {
+		int bitPos = offset;
+		Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		bitPos += 2;
+		dwgObject.setMode(mode.intValue());
+
+		List val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int rnum = ((Integer) val.get(1)).intValue();
+		dwgObject.setNumReactors(rnum);
+
+
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean isLyrByLineType = ((Boolean) val.get(1)).booleanValue();
+		//TODO En la 15 es un flag, no un boolean. REVISAR
+		dwgObject.setLyrByLineType(isLyrByLineType);
+
+		val = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		boolean noLinks = ((Boolean) val.get(1)).booleanValue();
+		dwgObject.setNoLinks(noLinks);
+
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int color = ((Integer) val.get(1)).intValue();
+		dwgObject.setColor(color);
+
+		val = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		float ltscale = ((Double) val.get(1)).floatValue();
+		//TODO tampoco se setea en la 15 (en su lugar, un flag de ints)
+		val = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int invis = ((Integer) val.get(1)).intValue();
+
+		return bitPos;
+	}
+
+	/*
+	 *
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgFileReader#readObjectTailer(int[],
+	 *      int, com.iver.cit.jdwglib.dwg.DwgObject)
+	 */
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject)
+			throws RuntimeException, CorruptedDwgEntityException {
+		int bitPos = offset;
+		List val = null;
+
+		/*
+		 * Subentity ref handle. Esto se aplica sobre VERTEX, ATTRIB, SEQEND
+		 */
+		if (dwgObject.getMode() == 0x0) {
+			DwgHandleReference subEntityHandle = new DwgHandleReference();
+			bitPos = subEntityHandle.read(data, bitPos);
+			dwgObject.setSubEntityHandle(subEntityHandle);
+		}
+
+		/*
+		 * Reactors handles DwgObject
+		 */
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < dwgObject.getNumReactors(); i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			dwgObject.addReactorHandle(reactorHandle);
+		}
+
+		/*
+		 * XDICOBJHANDLE
+		 */
+		DwgHandleReference xDicObjHandle = new DwgHandleReference();
+		bitPos = xDicObjHandle.read(data, bitPos);
+		dwgObject.setXDicObjHandle(xDicObjHandle);
+
+		//	  TODO Hasta aqui igual que en la 15
+
+		/*
+		 * Layer Handle code
+		 */
+
+		DwgHandleReference layerHandle = new DwgHandleReference();
+		bitPos = layerHandle.read(data, bitPos);
+		dwgObject.setLayerHandle(layerHandle);
+
+		if (!dwgObject.isLyrByLineType()) {
+			DwgHandleReference lineTypeHandle = new DwgHandleReference();
+			bitPos = lineTypeHandle.read(data, bitPos);
+			dwgObject.setLineTypeHandle(lineTypeHandle);
+		}
+		String cadena = "";
+		if (!dwgObject.isNoLinks()) {
+
+			/*
+			 * Previous Handle
+			 */
+			DwgHandleReference previousHandle = new DwgHandleReference();
+			bitPos = previousHandle.read(data, bitPos);
+			dwgObject.setPreviousHandle(previousHandle);
+
+			/*
+			 * Next Handle
+			 */
+			DwgHandleReference nextHandle = new DwgHandleReference();
+			bitPos = nextHandle.read(data, bitPos);
+			dwgObject.setNextHandle(nextHandle);
+		}
+		return bitPos;
+	}
+
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV15Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV15Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileV15Reader.java	(revision 435)
@@ -0,0 +1,2190 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.readers;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.ByteUtils;
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgClass;
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgObjectFactory;
+import org.gvsig.dwg.lib.DwgObjectOffset;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.util.HexUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * The DwgFileV15Reader reads the DWG version 15 format
+ *
+ * @author jmorell
+ */
+public class DwgFileV15Reader implements IDwgFileReader {
+	protected DwgFile dwgFile;
+
+	protected ByteBuffer bb;
+	
+	private static Logger logger = LoggerFactory.getLogger(DwgFileV15Reader.class
+			.getName());
+	
+
+
+	/**
+	 * Reads the DWG version 15 format
+	 *
+	 * @param dwgFile
+	 *            Represents the DWG file that we want to read
+	 * @throws IOException
+	 *             When DWG file path is wrong
+	 */
+	public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException {
+		this.dwgFile = dwgFile;
+		this.bb = bb;
+		try {
+			readDwgSectionOffsets();
+			readHeaders();
+			readDwgClasses();
+			readDwgObjectOffsets();
+			readDwgObjects();
+			//checkSuperentities();
+		} catch (Exception e) {
+			e.printStackTrace();
+			logger.error(e.getMessage());
+		}
+
+	}
+
+	/*
+	 *TODO: Eliminar esto cuando terminemos con el testeo
+	 */
+	protected void checkSuperentities(){
+		logger.info("***** CHEQUEANDO LAS SUPERENTIDADES *****");
+		List objects = dwgFile.getDwgObjects();
+		DwgObject obj;
+		DwgObject superEnt;
+		boolean buscado=false;
+		boolean perdidos=false;
+		int j=0;
+		for (int i=0; i<objects.size(); i++){
+			obj = (DwgObject)objects.get(i);
+			if (obj.hasSubEntityHandle()){
+				buscado = true;
+				superEnt = dwgFile.getDwgSuperEntity(obj);
+				if (superEnt == null){
+					j++;
+				}
+			}
+		}
+		if(j!=0) {
+			logger.warn("+++++ SE HAN PERDIDO LAS SUPERENTIDADES DE "+ j+" OBJETOS +++++");
+		}
+		logger.info("***** FIN DEL CHEQUEO DE LAS SUPERENTIDADES *****");
+
+	}
+
+
+	/**
+	 * It read the SECTIONS from the header of the DWG file
+	 */
+	protected void readDwgSectionOffsets() {
+		bb.position(19);
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short codePage = bb.getShort();
+		int count = bb.getInt();
+		for (int i = 0; i < count; i++) {
+			byte rec = bb.get();
+			int seek = bb.getInt();
+			int size = bb.getInt();
+			if (rec == 0) {
+				dwgFile.addDwgSectionOffset("HEADERS", seek, size);
+			} else if (rec == 1) {
+				dwgFile.addDwgSectionOffset("CLASSES", seek, size);
+			} else if (rec == 2) {
+				dwgFile.addDwgSectionOffset("OBJECTS", seek, size);
+			} else if (rec == 3) {
+				dwgFile.addDwgSectionOffset("UNKNOWN", seek, size);
+			} else if (rec == 4) {
+				dwgFile.addDwgSectionOffset("R14DATA", seek, size);
+			} else if (rec == 5) {
+				dwgFile.addDwgSectionOffset("R14REC5", seek, size);
+			} else {
+				//				System.out.println("ERROR: C�digo de n�mero de registro
+				// no soportado: " + rec);
+			}
+		}
+	}
+
+	/**
+	 * OpenDWG spec says: This section -object map- is a table which gives the
+	 * location of each object in the DWG file. This table is broken into
+	 * sections. It is basically a list of handle/file loc pairs. It could be
+	 * readed with this pseudocode:
+	 *
+	 * Set lastHandle to all 0 and last loc to 0L. Repeat until section size ==
+	 * 2 section size = read short (in bigendian order) Repeat until out of data
+	 * for this section offset of this handle form last handle as modular char
+	 * offset of location in file from last location as modular char End repeat
+	 * End repeat
+	 *
+	 */
+	protected void readDwgObjectOffsets() throws Exception {
+		int offset = dwgFile.getDwgSectionOffset("OBJECTS");
+		bb.position(offset);
+		while (true) {
+			bb.order(ByteOrder.BIG_ENDIAN);
+			/*
+			 * We read the size of the next section. If size == 2, break (it is
+			 * the last empty -except crc- section)
+			 */
+			short size = bb.getShort();
+			if (size == 2)
+				break;
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			byte[] dataBytes = new byte[size];
+			bb.get(dataBytes);
+			int[] data = DwgUtil.bytesToMachineBytes(dataBytes);
+			int lastHandle = 0;
+			int lastLoc = 0;
+			int bitPos = 0;
+			int bitMax = (size - 2) * 8;
+			while (bitPos < bitMax) {
+				ArrayList v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				lastHandle = lastHandle + ((Integer) v.get(1)).intValue();
+				v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				lastLoc = lastLoc + ((Integer) v.get(1)).intValue();
+				dwgFile.addDwgObjectOffset(lastHandle, lastLoc);
+			}//while
+		}//while
+	}
+
+
+	protected void readDwgClasses() throws Exception {
+		int offset = dwgFile.getDwgSectionOffset("CLASSES");
+		bb.position(offset);
+		//1� leemos el sentinnel inicial
+		bb.order(ByteOrder.nativeOrder());
+		byte[] sentinel = new byte[16];
+		bb.get(sentinel);
+		if (sentinel[0] != 0x8d)
+			logger.warn("sentinel[0] != 0x8d");
+		if (sentinel[1] != 0xa1)
+			logger.warn("sentinel[1] != 0xa1");
+		if (sentinel[2] != 0xc4)
+			logger.warn("sentinel[2] != 0xc4");
+		if (sentinel[3] != 0xb8)
+			logger.warn("sentinel[3] != 0xb8");
+		if (sentinel[4] != 0xc4)
+			logger.warn("sentinel[4] != 0xc4");
+		if (sentinel[5] != 0xa9)
+			logger.warn("sentinel[5] != 0xa9");
+		if (sentinel[6] != 0xf8)
+			logger.warn("sentinel[6] != 0xf8");
+		if (sentinel[7] != 0xc5)
+			logger.warn("sentinel[7] != 0xc5");
+		if (sentinel[8] != 0xc0)
+			logger.warn("sentinel[8] != 0xc0");
+		if (sentinel[9] != 0xdc)
+			logger.warn("sentinel[9] != 0xdc");
+		if (sentinel[10] != 0xf4)
+			logger.warn("sentinel[10] != 0xf4");
+		if (sentinel[11] != 0x5f)
+			logger.warn("sentinel[11] != 0x5f");
+		if (sentinel[12] != 0xe7)
+			logger.warn("sentinel[12] != 0xe7");
+		if (sentinel[13] != 0xcf)
+			logger.warn("sentinel[13] != 0xcf");
+		if (sentinel[14] != 0xb6)
+			logger.warn("sentinel[14] != 0xb6");
+		if (sentinel[15] != 0x8a)
+			logger.warn("sentinel[15] != 0x8a");
+
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int size = bb.getInt();
+		byte[] data = new byte[size];
+		bb.get(data);
+		int[] intData = DwgUtil.toIntArray(data);
+		short crc = bb.getShort();
+
+		int maxBit = size * 8;
+		int bitPos = 0;
+		List val = null;
+		while ((bitPos + 8) < maxBit) {
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int classNum = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int version = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String appName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String cPlusPlusName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String dxfName = (String) val.get(1);
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			boolean isZombie = ((Boolean) val.get(1)).booleanValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int id = ((Integer) val.get(1)).intValue();
+
+			DwgClass dwgClass = new DwgClass(classNum, version, appName,
+					cPlusPlusName, dxfName, isZombie, id);
+			dwgFile.addDwgClass(dwgClass);
+
+		}//while
+		//		Por ultimo, el sentinnel final
+		bb.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16];
+		bb.get(lastSentinnel);
+		if (lastSentinnel[0] != 0x72)
+			logger.warn("lastSentinnel[0] != 0x72");
+		if (lastSentinnel[1] != 0x5e)
+			logger.warn("lastSentinnel[1] != 0x5e");
+		if (lastSentinnel[2] != 0x3b)
+			logger.warn("lastSentinnel[2] != 0x3b");
+		if (lastSentinnel[3] != 0x47)
+			logger.warn("lastSentinnel[3] != 0x47");
+		if (lastSentinnel[4] != 0x3b)
+			logger.warn("lastSentinnel[4] != 0x3b");
+		if (lastSentinnel[5] != 0x56)
+			logger.warn("lastSentinnel[5] != 0x56");
+		if (lastSentinnel[6] != 0x07)
+			logger.warn("lastSentinnel[6] != 0x07");
+		if (lastSentinnel[7] != 0x3a)
+			logger.warn("lastSentinnel[7] != 0x3a");
+		if (lastSentinnel[8] != 0x3f)
+			logger.warn("lastSentinnel[8] != 0x3f");
+		if (lastSentinnel[9] != 0x23)
+			logger.warn("lastSentinnel[9] != 0x23");
+		if (lastSentinnel[10] != 0x0b)
+			logger.warn("lastSentinnel[10] != 0x0b");
+		if (lastSentinnel[11] != 0xa0)
+			logger.warn("lastSentinnel[11] != 0xa0");
+		if (lastSentinnel[12] != 0x18)
+			logger.warn("lastSentinnel[12] != 0x18");
+		if (lastSentinnel[13] != 0x30)
+			logger.warn("lastSentinnel[13] != 0x30");
+		if (lastSentinnel[14] != 0x49)
+			logger.warn("lastSentinnel[14] != 0x49");
+		if (lastSentinnel[15] != 0x75)
+			logger.warn("lastSentinnel[15] != 0x75");
+	}
+
+	protected void readDwgClasses2() throws Exception {
+		int offset = dwgFile.getDwgSectionOffset("CLASSES");
+		// Por ahora nos saltamos los 16 bytes de control
+		bb.position(offset + 16);
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int size = bb.getInt();
+		byte[] dataBytes = new byte[size];
+		for (int i = 0; i < dataBytes.length; i++) {
+			dataBytes[i] = bb.get();
+		}
+		int[] data = DwgUtil.bytesToMachineBytes(dataBytes);
+		for (int i = 0; i < data.length; i++) {
+			data[i] = (byte) ByteUtils.getUnsigned((byte) data[i]);
+		}
+		bb.position(bb.position() + 2 + 16);
+		int maxbit = size * 8;
+		int bitPos = 0;
+		while ((bitPos + 8) < maxbit) {
+			ArrayList v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.getTextString(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.testBit(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+		}
+	}
+
+	/**
+	 * Reads all the object referenced in the object map section of the DWG file
+	 * (using their object file obsets)
+	 */
+	protected void readDwgObjects() {
+		for (int i = 0; i < dwgFile.getDwgObjectOffsets().size(); i++) {
+				 try{
+					DwgObjectOffset doo = (DwgObjectOffset) dwgFile
+							.getDwgObjectOffsets().get(i);
+
+					DwgObject obj = readDwgObject(doo.getOffset(), i);
+					/*
+					 * azabala: las entidades DWG no implementadas no nos aportan nada
+					 * (aunque la sigo leyendo por si aparecen problemas de puntero de
+					 * fichero) No considero por tanto los DwgObject if (obj != null) {
+					 * dwgFile.addDwgObject(obj); }
+					 *
+					 * paco: propongo reconsiderar esto. Si no cargamos todos los objetos
+					 * podemos tener problemas con las subentities.
+					 */
+					if (obj != null && obj.getClass() != DwgObject.class) {
+						dwgFile.addDwgObject(obj);
+					}
+				}catch(Exception e){
+					logger.error(e.getMessage());
+					continue;
+				}
+			}//for
+
+	}
+
+
+
+	/**
+	 * Reads the header of an object in a DWG file Version 15
+	 *
+	 * @param data
+	 *            Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset
+	 *            The current bit offset where the value begins
+	 * @return int New offset
+	 */
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) {
+		int bitPos = offset;
+		Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		bitPos = bitPos + 2;
+		dwgObject.setMode(mode.intValue());
+
+		/*
+		ArrayList v = DwgUtil.getBitLong(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int rnum = ((Integer) v.get(1)).intValue();
+		dwgObject.setNumReactors(rnum);
+		*/
+		ArrayList v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int rnum = ((Integer) v.get(1)).intValue();
+		dwgObject.setNumReactors(rnum);
+
+		v = DwgUtil.testBit(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		boolean nolinks = ((Boolean) v.get(1)).booleanValue();
+		dwgObject.setNoLinks(nolinks);
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int color = ((Integer) v.get(1)).intValue();
+		dwgObject.setColor(color);
+
+		v = DwgUtil.getBitDouble(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		float ltscale = ((Double) v.get(1)).floatValue();
+
+		Integer ltflag = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		bitPos = bitPos + 2;
+
+		Integer psflag = (Integer) DwgUtil.getBits(data, 2, bitPos);
+		bitPos = bitPos + 2;
+
+		v = DwgUtil.getBitShort(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int invis = ((Integer) v.get(1)).intValue();
+
+		v = DwgUtil.getRawChar(data, bitPos);
+		bitPos = ((Integer) v.get(0)).intValue();
+		int weight = ((Integer) v.get(1)).intValue();
+
+		return bitPos;
+	}
+
+	/**
+	 * Reads the tail of an object in a DWG file Version 15
+	 *
+	 * @param data
+	 *            Array of bytes obtained from the DWG binary file
+	 * @param offset
+	 *            Offset for this array of bytes
+	 * @return int New offset
+	 * @throws CorruptedDwgEntityException
+	 * @throws RuntimeException
+	 */
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException {
+		int bitPos = offset;
+		/*
+		 * Subentity ref handle. Esto se aplica sobre VERTEX, ATTRIB, SEQEND
+		 */
+		if (dwgObject.getMode() == 0x0) {
+			DwgHandleReference subEntityHandle = new DwgHandleReference();
+			bitPos = subEntityHandle.read(data, bitPos);
+			dwgObject.setSubEntityHandle(subEntityHandle);
+		}
+
+		/*
+		 * Reactors handles TODO No se est�n usando para setear nada en
+		 * DwgObject
+		 */
+		DwgHandleReference reactorHandle;
+		for (int i = 0; i < dwgObject.getNumReactors(); i++) {
+			reactorHandle = new DwgHandleReference();
+			bitPos = reactorHandle.read(data, bitPos);
+			dwgObject.addReactorHandle(reactorHandle);
+		}
+
+		/*
+		 * XDICOBJHANDLE
+		 */
+		DwgHandleReference xDicObjHandle = new DwgHandleReference();
+		bitPos = xDicObjHandle.read(data, bitPos);
+		dwgObject.setXDicObjHandle(xDicObjHandle);
+
+		/*
+		 * Layer Handle code
+		 */
+
+		DwgHandleReference handle = new DwgHandleReference();
+		bitPos = handle.read(data, bitPos);
+		dwgObject.setLayerHandle(handle);
+
+		if (!dwgObject.isNoLinks()) {
+
+			DwgHandleReference previousHandle = new DwgHandleReference();
+			bitPos = previousHandle.read(data, bitPos);
+			dwgObject.setPreviousHandle(previousHandle);
+
+			DwgHandleReference nextHandle = new DwgHandleReference();
+			bitPos = nextHandle.read(data, bitPos);
+			dwgObject.setNextHandle(nextHandle);
+
+		}
+
+		if (dwgObject.getLinetypeFlags() == 0x3) {
+			DwgHandleReference lineTypeHandle = new DwgHandleReference();
+			bitPos = lineTypeHandle.read(data, bitPos);
+			dwgObject.setLineTypeHandle(lineTypeHandle);
+
+		}
+
+		if (dwgObject.getPlotstyleFlags() == 0x3) {
+			DwgHandleReference plotStyleHandle = new DwgHandleReference();
+			bitPos = plotStyleHandle.read(data, bitPos);
+			dwgObject.setPlotStyleHandle(plotStyleHandle);
+
+		}
+		return bitPos;
+	}
+
+	/**
+	 * Return a dwg object from its index in the dwg file
+	 *
+	 * @param index
+	 *            of the requested dwg object in the dwg file
+	 *
+	 */
+	public DwgObject getDwgObjectByIndex(int index) {
+		DwgObjectOffset doo = (DwgObjectOffset) dwgFile.getDwgObjectOffsets()
+				.get(index);
+		return readDwgObject(doo.getOffset(), index);
+	}
+
+
+	/**
+	 * Reads a dwg drawing entity (dwg object) given its offset in the file
+	 */
+
+	protected DwgObject readDwgObject(int offset, int index) {
+		DwgObject obj = null;
+		try {
+			bb.position(offset);
+			int size = DwgUtil.getModularShort(bb);
+
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			byte[] dataBytes = new byte[size];
+			String[] dataMachValString = new String[size];
+			int[] data = new int[size];
+			for (int i = 0; i < size; i++) {
+				dataBytes[i] = bb.get();
+				dataMachValString[i] = HexUtil
+						.bytesToHex(new byte[] { dataBytes[i] });
+				Integer dataMachValShort = Integer.decode("0x"
+						+ dataMachValString[i]);
+				data[i] = dataMachValShort.byteValue();
+				data[i] = ByteUtils.getUnsigned((byte) data[i]);
+			}
+
+			int bitPos = 0;
+			ArrayList v = DwgUtil.getBitShort(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int type = ((Integer) v.get(1)).intValue();
+			obj = DwgObjectFactory.getInstance().create(type, index);
+			if (obj == null) {
+				if (type >= 500) {
+					int newIndex = type - 500;
+					if (newIndex < (dwgFile.getDwgClasses().size() - 1)) {
+						DwgClass dwgClass = (DwgClass) dwgFile.getDwgClasses()
+								.get(newIndex);
+						String dxfEntityName = dwgClass.getDxfName();
+						obj = DwgObjectFactory.getInstance().create(
+								dxfEntityName, index);
+						if (obj == null) {
+							logger.info(dxfEntityName
+									+ " todavia no est� implementado");
+							return null;
+						}//if
+					}//if newIndex
+					else{
+						return null;
+					}
+				}else {
+					logger.info("Encontrado tipo " + type);
+					return null;
+				}
+			}//if obj == null
+
+
+			v = DwgUtil.getRawLong(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int objBSize = ((Integer) v.get(1)).intValue();
+			obj.setSizeInBits(objBSize);
+
+			DwgHandleReference entityHandle = new DwgHandleReference();
+			bitPos = entityHandle.read(data, bitPos);
+			obj.setHandle(entityHandle);
+
+			v = DwgUtil.readExtendedData(data, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			ArrayList extData = (ArrayList) v.get(1);
+			obj.setExtendedData(extData);
+
+			boolean gflag = false;
+			gflag = obj.isGraphicsFlag();
+			if (gflag) {
+				//lee un flag boolean
+				v = DwgUtil.testBit(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				boolean val = ((Boolean) v.get(1)).booleanValue();
+				//si hay imagen asociada, se lee por completo
+				if (val) {
+					v = DwgUtil.getRawLong(data, bitPos);
+					bitPos = ((Integer) v.get(0)).intValue();
+					size = ((Integer) v.get(1)).intValue();
+					int bgSize = size * 8;
+					Integer giData = (Integer) DwgUtil.getBits(data, bgSize,
+							bitPos);
+					obj.setGraphicData(giData.intValue());
+					bitPos = bitPos + bgSize;
+				}
+			}
+				if(obj.getClass() != DwgObject.class)
+					readSpecificObject(obj, data, bitPos);
+		} catch (RuntimeException e) {
+			e.printStackTrace();
+		} catch (CorruptedDwgEntityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return null;
+		}
+		return obj;
+	}
+
+	/*
+	 * TODO Esto está pesimamente diseñado. Cada objeto DwgObject debe tener un
+	 * metodo readSpecificObject(data,bitPos)
+	 *
+	 */
+	protected void readSpecificObject(DwgObject obj, int[] data, int bitPos)
+			throws RuntimeException, CorruptedDwgEntityException {
+			DwgObjectReaderPool pool = DwgObjectReaderPool.getInstance();
+			IDwgObjectReader reader = pool.get(obj, "15");
+			if(reader != null){
+				reader.setFileReader(this);
+				reader.readSpecificObj(data, bitPos, obj);
+			}else{
+				logger.warn("No se ha implementado la lectura de "+obj.getClass().getName()+", code="+obj.getType());
+			}
+	}
+
+
+	//TODO PROBAR, ESTA COPIADO A PELO DE DWG13-14. SI VALE, LLEVAR A UNA
+	//CLASE ABSTRACTA
+	protected void readHeaders() {
+
+		int offset = dwgFile.getDwgSectionOffset("HEADERS");
+		bb.position(offset);
+
+		//1� leemos el sentinnel inicial
+		bb.order(ByteOrder.nativeOrder());
+		byte[] sentinel = new byte[16];
+		bb.get(sentinel);
+
+		if (sentinel[0] != 0xcf)
+			logger.warn("sentinel[0] != 0xcf");
+		if (sentinel[1] != 0x7b)
+			logger.warn("sentinel[1] != 0x7b");
+		if (sentinel[2] != 0x1f)
+			logger.warn("sentinel[2] != 0x1f");
+		if (sentinel[3] != 0x23)
+			logger.warn("sentinel[3] != 0x23");
+		if (sentinel[4] != 0xfd)
+			logger.warn("sentinel[4] != 0xfd");
+		if (sentinel[5] != 0xde)
+			logger.warn("sentinel[5] != 0xde");
+		if (sentinel[6] != 0x38)
+			logger.warn("sentinel[6] != 0x38");
+		if (sentinel[7] != 0xa9)
+			logger.warn("sentinel[7] != 0xa9");
+		if (sentinel[8] != 0x5f)
+			logger.warn("sentinel[8] != 0x5f");
+		if (sentinel[9] != 0x7c)
+			logger.warn("sentinel[9] != 0x7c");
+		if (sentinel[10] != 0x68)
+			logger.warn("sentinel[10] != 0x68");
+		if (sentinel[11] != 0xb8)
+			logger.warn("sentinel[11] != 0xb8");
+		if (sentinel[12] != 0x4e)
+			logger.warn("sentinel[12] != 0x4e");
+		if (sentinel[13] != 0x6d)
+			logger.warn("sentinel[13] != 0x6d");
+		if (sentinel[14] != 0x33)
+			logger.warn("sentinel[14] != 0x33");
+		if (sentinel[15] != 0x5f)
+			logger.warn("sentinel[15] != 0x5f");
+
+		//2� seguidamente leemos los datos
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int size = bb.getInt();
+
+		bb.order(ByteOrder.nativeOrder());
+		byte[] data = new byte[size];
+		bb.get(data);
+
+		int[] intData = DwgUtil.toIntArray(data);
+
+		//3� a continuacion el CRC de la seccion HEADER
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short crc = bb.getShort();
+
+		//Por ultimo, el sentinnel final
+		bb.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16];
+		bb.get(lastSentinnel);
+		if (lastSentinnel[0] != 0x30)
+			logger.warn("lastSentinnel[0] != 0x30");
+		if (lastSentinnel[1] != 0x84)
+			logger.warn("lastSentinnel[1] != 0x84");
+		if (lastSentinnel[2] != 0xe0)
+			logger.warn("lastSentinnel[2] != 0xe0");
+		if (lastSentinnel[3] != 0xdc)
+			logger.warn("lastSentinnel[3] != 0xdc");
+		if (lastSentinnel[4] != 0x02)
+			logger.warn("lastSentinnel[4] != 0x02");
+		if (lastSentinnel[5] != 0x21)
+			logger.warn("lastSentinnel[5] != 0x21");
+		if (lastSentinnel[6] != 0xc7)
+			logger.warn("lastSentinnel[6] != 0xc7");
+		if (lastSentinnel[7] != 0x56)
+			logger.warn("lastSentinnel[7] != 0x56");
+		if (lastSentinnel[8] != 0xa0)
+			logger.warn("lastSentinnel[8] != 0xa0");
+		if (lastSentinnel[9] != 0x83)
+			logger.warn("lastSentinnel[9] != 0x83");
+		if (lastSentinnel[10] != 0x97)
+			logger.warn("lastSentinnel[10] != 0x97");
+		if (lastSentinnel[11] != 0x47)
+			logger.warn("lastSentinnel[11] != 0x47");
+		if (lastSentinnel[12] != 0xb1)
+			logger.warn("lastSentinnel[12] != 0xb1");
+		if (lastSentinnel[13] != 0x92)
+			logger.warn("lastSentinnel[13] != 0x92");
+		if (lastSentinnel[14] != 0xcc)
+			logger.warn("lastSentinnel[14] != 0xcc");
+		if (lastSentinnel[15] != 0xa0)
+			logger.warn("lastSentinnel[15] != 0xa0");
+
+		//Ahora interpretamos los datos en bruto
+		int bitPos = 0;
+		try {
+			List val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL4", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING1", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING2", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING3", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING4", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG1", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG2", val.get(1));
+
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("SHORT1", val.get(1));
+
+			//TODO REFACTORIZAR ESTO PARA USAR DWGHANDLEREFERENCE
+
+			//TODO Los handle se leen asi??
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HANDLE1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASO", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSHO", val.get(1));
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSAV", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEGEN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ORTHOMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("REGENMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("QTEXTMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSLTSCALE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LIMCHECK", val.get(1));
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("BLIPMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USER_TIMER", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKPOLY", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGDIR", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLFRAME", val.get(1));
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("ATTREQ", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("ATTDIA", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MIRRTEXT", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("WORLDVIEW", val.get(1));
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("WIREFRAME", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TILEMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLIMCHECK", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VISRETAIN", val.get(1));
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DELOBJ", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DISPSILH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PELLISE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+//			if (dwgFile.getDwgVersion() == "R14")
+			dwgFile.setHeader("PROXYGRAPH", val.get(1));
+//			else
+//				dwgFile.setHeader("SAVEIMAGES", val.get(1));
+
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DRAGMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TREEDEPTH", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUPREC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUPREC", val.get(1));
+
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("OSMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ATTMODE", val.get(1));
+
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("COORDS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDMODE", val.get(1));
+
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("PICKSTYLE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI3", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI4", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI5", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINESEGS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFV", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINETYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDGE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDIF", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNITMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MAXACTVP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ISOLINES", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLJUST", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTQLTY", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LTSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TRACEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKETCHINC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLETRAD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("THICKNESS", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGBASE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR4", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR5", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERA", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERB", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FACETRES", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CELTSCALE", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MENUNAME", val.get(1));
+
+			int[] tdcreate = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDCREATE", tdcreate);
+
+			int[] tdupdate = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDUPDATE", tdupdate);
+
+			int[] tdindwg = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDINDWG", tdindwg);
+
+			int[] tdusrtime = new int[2];
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[0] = ((Integer) val.get(1)).intValue();
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[1] = ((Integer) val.get(1)).intValue();
+			dwgFile.setHeader("TDUSRTIME", tdusrtime);
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CECOLOR", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("HANDSEED", new Integer(intHandle));
+
+			//creo que CLAYER marca la capa actualmente seleccionada en el menu
+			// de
+			// autocad
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("TEXSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CELLTYPE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CMLSTYLE", new Integer(intHandle));
+
+			//this property is exclusive of DWG 2000
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSVPSCALE", val.get(1));
+
+
+			double[] spaces1 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_INSBASE", spaces1);
+
+			double[] spaces2 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_EXTMIN", spaces2);
+
+			double[] spaces3 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_EXTMAX", spaces2);
+
+			double[] spaces4 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_LIMMIN", spaces4);
+
+			double[] spaces5 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_LIMMAX", spaces5);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSPACE_ELEVATION", val.get(1));
+
+			double[] spaces6 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSORG", spaces6);
+
+			double[] spaces7 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSXDIR", spaces7);
+
+			double[] spaces8 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_UCSYDIR", spaces8);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PSPACE_UCSNAME", new Integer(intHandle));
+
+			///DWG 2000 ONLY
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PUCSBASE", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PUCSORTHOVIEW", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PUCSORTHOREF", new Integer(intHandle));
+
+			double[] pucsorgtop = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGTOP", pucsorgtop);
+
+			double[] pucsorgbottom = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGBOTTOM", pucsorgbottom);
+
+			double[] pucsorgleft = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGLEFT", pucsorgleft);
+
+			double[] pucsorgright = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGRIGHT", pucsorgright);
+
+			double[] pucsorgfront = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGFRONT", pucsorgfront);
+
+			double[] pucsorgback = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGBACK", pucsorgback);
+
+
+			//COMMON
+			double[] spaces9 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_INSBASE", spaces9);
+
+			double[] spaces10 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_EXTMIN", spaces10);
+
+			double[] spaces11 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_EXTMAX", spaces11);
+
+			double[] spaces12 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_LIMMIN", spaces12);
+
+			double[] spaces13 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[1] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_LIMMAX", spaces13);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MSPACE_ELEVATION", (Double) val.get(1));
+
+			double[] spaces14 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSORG", spaces14);
+
+			double[] spaces15 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSXDIR", spaces15);
+
+			double[] spaces16 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("MSPACE_UCSYDIR", spaces16);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MSPACE_UCSNAME", new Integer(intHandle));
+
+			//DWG 2000
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCSBASE", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UCSORTHOVIEW", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCSORTHOREF", new Integer(intHandle));
+
+			double[] ucsorgtop = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGTOP", ucsorgtop);
+
+			double[] ucsorgbottom = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGBOTTOM", ucsorgbottom);
+
+			double[] ucsorgleft = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGLEFT", ucsorgleft);
+
+			double[] ucsorgright = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGRIGHT", ucsorgright);
+
+			double[] ucsorgfront = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGFRONT", ucsorgfront);
+
+			double[] ucsorgback = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGBACK", ucsorgback);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMPOST", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAPOST", val.get(1));
+
+
+			//Not readed in dwg 2000
+
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTOL", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMLIM", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTIH", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTOH", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSE1", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTSE2", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALT", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTOFL", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSAH", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTIX", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSOXD", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALTD", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMZIN", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSD1", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMSD2", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTOLJ", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMJUST", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMFINT", val.get(1));
+//
+//			val = DwgUtil.testBit(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMUPT", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMZIN", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALTZ", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALTTZ", val.get(1));
+//
+//			val = DwgUtil.getRawChar(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTAD", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMUNIT", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMAUNIT", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMDEC", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMTDEC", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALTU", val.get(1));
+//
+//			val = DwgUtil.getBitShort(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMALTTD", val.get(1));
+//
+//			val = DwgUtil.getHandle(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			intHandle = DwgUtil.handleToInt(val);
+//			dwgFile.setHeader("DIMTXSTY", new Integer(intHandle));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXO", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLI", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAND", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTM", val.get(1));
+
+			//DWG 2000 only
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLIM", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSE1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSE2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTAD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMZIN", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAZIN", val.get(1));
+
+			//common
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTXT", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCEN", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTF", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTVP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMGAP", val.get(1));
+
+			//not readed in DWG 2000
+
+//			val = DwgUtil.getTextString(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMPOST", val.get(1));
+//
+//			val = DwgUtil.getTextString(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMAPOST", val.get(1));
+//
+//			val = DwgUtil.getTextString(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMBLK", val.get(1));
+//
+//			val = DwgUtil.getTextString(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMBLK1", val.get(1));
+//
+//			val = DwgUtil.getTextString(intData, bitPos);
+//			bitPos = ((Integer) val.get(0)).intValue();
+//			dwgFile.setHeader("DIMBLK2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTRND", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTD", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOFL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSAH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIX", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSOXD", val.get(1));
+
+			//common
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRT", val.get(1));
+
+			//dwg 2000
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMADEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMFRAC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDSEP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTMOVE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMJUST", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD2", val.get(1));
+
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOLJ", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTZIN", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTZ", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTZ", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMUPT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMFIT", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMTXTSTY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMLDRBLK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK1", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK2", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLWD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLWE", val.get(1));
+
+			//common
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("BLOCK_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LAYER_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("STYLE_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LINETYPE_CONTROL_OBJECT",new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VIEW_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCS_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VPORT_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("APPID_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMSTYLE_CONTROL_OBJECT",
+							new Integer(intHandle));
+
+			//TODO Se lee para 2000? (en la doc. dice r13-r15)
+			//Se supone que sí r15 == 2000
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VIEWPORT_ENTITY_HEADER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_GROUP_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_MLINE_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("NAMED_OBJECT_DICTIONARY",
+							new Integer(intHandle));
+
+			//only dwg 2000
+
+			//unknown bitshort
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+
+//			unknown bitshort
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HYPERLINKBASE",
+					val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STYLESHEET",
+					val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LAYOUT_DICTIONARY",
+							new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PLOT_SETTINGS_DICTIONARY",
+							new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PLOT_STYLES_DICTIONARY",
+							new Integer(intHandle));
+
+			/*
+			 Flags:
+				CELWEIGHT	Flags & 0x001F
+				ENDCAPS		Flags & 0x0060
+				JOINSTYLE	Flags & 0x0180
+				LWDISPLAY	!(Flags & 0x0200)
+				XEDIT		!(Flags & 0x0400)
+				EXTNAMES	Flags & 0x0800
+				PSTYLEMODE	Flags & 0x2000
+				OLESTARTUP	Flags & 0x4000
+			 * */
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FLAGS",
+					val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("INSUNITS",
+					val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CEPSNTYPE",
+					val.get(1));
+
+			if(((Integer)val.get(1)).intValue() == 3){
+				val = DwgUtil.getHandle(intData, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				intHandle = DwgUtil.handleToInt(val);
+				dwgFile.setHeader("CPSNID",
+								new Integer(intHandle));
+			}
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FINGERPRINTGUID",
+					val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VERSIONGUID",
+					val.get(1));
+
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PAPER_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MODEL_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYBLOCK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_CONTINUOUS", new Integer(intHandle));
+
+			//		    # remaing bits are unknown, and they end with possible
+			//		    # padding bits so that 16-bit CRC value after the data
+			//		    # is on a byte boundary - ignore them for now ...
+
+		} catch (Exception e) {
+			logger.error(e.getMessage());
+		}
+	}
+
+
+
+
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileVR2004Reader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileVR2004Reader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgFileVR2004Reader.java	(revision 435)
@@ -0,0 +1,3255 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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.dwg.lib.readers;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.TreeSet;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgClass2004;
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgObjectFactory;
+import org.gvsig.dwg.lib.DwgObjectOffset;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class DwgFileVR2004Reader implements IDwgFileReader {
+
+	protected DwgFile dwgFile;
+
+	protected ByteBuffer bb;
+
+	static byte[] magicNumber = null;
+
+	private String version = "";
+
+	private byte[] unknowSixBytes;
+
+	private byte[] threeBytes0;
+
+	private byte[] unknowTwoBytes;
+
+	private byte[] eightyTwoBytes0;
+
+	private byte[] encryptedData;
+
+	private byte[] decryptedData;
+
+	private String fileID = "";
+
+	private int rootTreeNodeGap;
+
+	private int lowermostLeftTreeNodeGap;
+
+	private int lowermostRightTreeNodeGap;
+
+	private int lastSectionId; // Last Section identifier
+
+	private int lastSectionAddress; // Last Section Address
+
+	private int SecondHeaderAddress; // Second Header Address
+
+	private int gapAmount; // Number of Gaps
+
+	private int sectionAmount; // Number of Sections
+
+	private int sectionMapId; // Section Map identifier
+
+	private int sectionMapAddress; // Section Map address
+
+	private int sectionInfoId; // Section Info identifier
+
+	private int sectionInfoIndex = 0; // Section Info identifier into the
+
+	// Sections Array
+
+	private int sectionArraySize;
+
+	private int gapArraySize;
+
+	private byte[] generatedSequence;
+
+	private Section[] sections;
+
+	private Gap[] gaps;
+
+	static final int TYPE_SECTION_MAP = 1;
+
+	static final int TYPE_SECTION_INFO = 2;
+
+	private static Logger logger = LoggerFactory.getLogger(DwgFileVR2004Reader.class.getName());
+
+	/**
+	 * Reads the DWG version 2004 format
+	 *
+	 * @param dwgFile
+	 *            Represents the DWG file that we want to read
+	 * @throws IOException
+	 *             When DWG file path is wrong
+	 */
+	public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException {
+
+		this.dwgFile = dwgFile;
+		this.bb = bb;
+
+		readDwgR2004FileHeader(bb);
+		readDwgR2004SectionMap(bb);
+		readDwgR2004InfoSection(bb);
+		readDwgR2004Headers(bb);
+		readDwgR2004Classes(bb);
+		readDwgR2004ObjectOffsets(bb);
+
+		readDwgR2004Objects();
+
+	}
+
+	protected void readDwgR2004InfoSection(ByteBuffer bb) {
+		int numDescriptions;
+
+		int sizeOfSection;
+		int numSections;
+		int maxDecompressedSize;
+		int compressed;
+		int sectionType;
+		int encrypted;
+		String sectionName = "";
+
+		int sectionNumber;
+		int dataSize;
+		int startOffset;
+
+		char c;
+		int pos;
+
+		if (sectionInfoIndex == 0) {
+			logger.trace("No se ha encontrado la Section Info en el array de secciones.");
+		}
+
+		pos = sections[sectionInfoIndex].getAddress(); // we get the address for the Section Info
+
+		bb.position(pos);
+
+		ByteBuffer dData = readSystemSection(bb);
+		dData.order(ByteOrder.LITTLE_ENDIAN);
+		dData.position(0);
+
+		/*
+		 * We start reading the Section Info once decompressed We will find data
+		 * blocks depending on numDescriptions value
+		 */
+		numDescriptions = dData.getInt();
+		dData.getInt(); // 0x02
+		dData.getInt(); // 0x00007400
+		dData.getInt(); // 0x00
+		dData.getInt(); // unknown
+
+		for (int i = 0; i < numDescriptions; i++) {
+			sizeOfSection = dData.getInt();
+			dData.getInt(); // unknown
+			numSections = dData.getInt();
+			maxDecompressedSize = dData.getInt();
+			dData.getInt(); // unknown
+			compressed = dData.getInt();
+			sectionType = dData.getInt();
+			encrypted = dData.getInt();
+			sectionName = "";
+			for (int j = 0; j < 64; j++) {
+				c = (char) dData.get();
+				sectionName = sectionName + c;
+			}
+
+			for (int k = 0; k < numSections; k++) {
+				sectionNumber = dData.getInt(); // index into the Sections Array
+				dataSize = dData.getInt();
+				startOffset = dData.getInt();
+				dData.getInt(); // unknown
+
+
+				// We set the name for the Section, so we can localize it by the name
+				for (int j = 0; j < sectionAmount; j++) {
+					Section section = sections[j];
+					if (section.getNumber() == sectionNumber) {
+						section.setName(sectionName);
+						section.setSizeOfLogicalSection(sizeOfSection);
+						section.setDataSize(dataSize);
+						section.setMaxDecompressedSize(maxDecompressedSize);
+						section.setCompressed(compressed);
+						section.setType(sectionType);
+						section.setEncrypted(encrypted);
+						section.setStartOffset(startOffset);
+					}
+				}
+
+			}
+		}
+	}
+
+	/**
+	 * This function reads the header section of the file, with the encrypted
+	 * data
+	 *
+	 * @param bb
+	 *            ByteBuffer containing the opened DWG file
+	 */
+	protected void readDwgR2004FileHeader(ByteBuffer bb) {
+
+		logger.trace("STARTING TO READ DWG FILE.");
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		for (int i = 0; i < 6; i++) {
+			version = version + (char) bb.get();
+		}
+		if (!version.equalsIgnoreCase("AC1018")) {
+			logger.trace("Error en la version: " + version);
+		}
+
+		/*
+		 * OpenAlliance documentation says we will read 6 0x00 bytes but the
+		 * sixth one is always 0x4C
+		 */
+		unknowSixBytes = new byte[6];
+		int pos = 6;
+		for (int i = 0; i < 5; i++) {
+			unknowSixBytes[i] = bb.get();
+			if (unknowSixBytes[i] != 0) {
+				logger.trace("(unknowSixBytes) En la posicion 0x"
+						+ Integer.toHexString(pos + i)
+						+ " debería haber un 0, pero hay un 0x"
+						+ Integer.toHexString(unknowSixBytes[i]));
+			}
+		}
+		pos = 0xB;
+		unknowSixBytes[5] = bb.get();
+		if (unknowSixBytes[5] != 0x4C) {
+			logger.trace("(unknowSixBytes) En la posicion 0x"
+					+ Integer.toHexString(pos)
+					+ " debería haber un 0x4C, pero hay un 0x"
+					+ Integer.toHexString(unknowSixBytes[5]));
+		}
+
+		bb.get(); // Unknown Byte
+		bb.getInt(); // previewAddress
+		bb.get(); // dwgVer
+		bb.get(); // maintReleaseVer
+		bb.getShort(); // codepage
+
+		/*
+		 * OpenAlliance documentation says we will read 3 0x00 bytes but what we
+		 * always find is 0x00, 0x19 and then 0x4C
+		 */
+		threeBytes0 = new byte[3];
+		pos = 0x15;
+		bb.get(threeBytes0);
+		if (threeBytes0[0] != 0x0) {
+			logger.trace("Posible error leyendo la cabecera del archivo DWG: " +
+					"En la posicion 0x" + Integer.toHexString(pos)
+					+ " deber�a haber un 0x0, pero hay un 0x"
+					+ Integer.toHexString(threeBytes0[0]));
+		}
+		pos = 0x16;
+		if (threeBytes0[1] != 0x19) {
+			logger.trace("Posible error leyendo la cabecera del archivo DWG: " +
+					"En la posicion 0x" + Integer.toHexString(pos)
+					+ " deber�a haber un 0x19, pero hay un 0x"
+					+ Integer.toHexString(threeBytes0[1]));
+		}
+		pos = 0x17;
+		if (threeBytes0[2] != 0x4C) {
+			logger.trace("Posible error leyendo la cabecera del archivo DWG: " +
+					"En la posicion 0x" + Integer.toHexString(pos)
+					+ " deber�a haber un 0x4C, pero hay un 0x"
+					+ Integer.toHexString(threeBytes0[2]));
+		}
+
+		bb.getInt(); // security Type
+		bb.getInt(); // unknownLong
+		bb.getInt(); // dwgPropertyAddr
+		bb.getInt(); // vbaProjectAddr
+		bb.getInt(); // 0x00000080
+
+		pos = 0x2C;
+
+		unknowTwoBytes = new byte[2];
+		for (int i = 0; i < 2; i++) {
+			unknowTwoBytes[i] = bb.get();
+		}
+		pos = 0x2E;
+		eightyTwoBytes0 = new byte[82];
+		for (int i = 0; i < eightyTwoBytes0.length; i++) {
+			eightyTwoBytes0[i] = bb.get();
+			if (eightyTwoBytes0[i] != 0) {
+				logger.trace("Posible error leyendo la cabecera del archivo DWG: " +
+						"(eightyTwoBytes0) En la posicion 0x"
+						+ Integer.toHexString(pos + i)
+						+ " deber�a haber un 0, pero hay un 0x"
+						+ Integer.toHexString(eightyTwoBytes0[i]));
+			}
+		}
+
+		int len = 0x6C;
+		encryptedData = new byte[len];
+		decryptedData = new byte[len];
+		if (magicNumber == null) {
+			DwgFileVR2004Reader.setMagicNumber();
+		}
+
+		// decryptedData will contain the decrypted sequence after xor'ing the
+		// encrypted data
+		for (int i = 0; i < len; i++) {
+			encryptedData[i] = bb.get();
+			decryptedData[i] = (byte) (encryptedData[i] ^ magicNumber[i]);
+		}
+
+		ByteBuffer decryptedDataBB = ByteBuffer.allocate(len);
+		decryptedDataBB.put(decryptedData);
+		decryptedDataBB.position(0);
+		decryptedDataBB.order(ByteOrder.LITTLE_ENDIAN);
+
+		// we start intercepting the decrypted variables
+		for (int i = 0; i < 12; i++) {
+			fileID = fileID + (char) decryptedDataBB.get();
+		}
+		decryptedDataBB.getInt(); // 0x00
+
+		decryptedDataBB.getInt(); // 0x6C
+
+		decryptedDataBB.getInt(); // 0x04
+
+		rootTreeNodeGap = decryptedDataBB.getInt();
+		lowermostLeftTreeNodeGap = decryptedDataBB.getInt();
+		lowermostRightTreeNodeGap = decryptedDataBB.getInt();
+		decryptedDataBB.getInt(); // unknown
+		lastSectionId = decryptedDataBB.getInt();
+
+		lastSectionAddress = decryptedDataBB.getInt();
+		decryptedDataBB.getInt(); // 0x00
+
+		SecondHeaderAddress = decryptedDataBB.getInt();
+		decryptedDataBB.getInt(); // 0x00
+
+		gapAmount = decryptedDataBB.getInt();
+		sectionAmount = decryptedDataBB.getInt(); // Very important: this is
+		// the number of sections in the file
+		decryptedDataBB.getInt(); // 0x20
+		decryptedDataBB.getInt(); // 0x80
+		decryptedDataBB.getInt(); // 0x40
+
+		sectionMapId = decryptedDataBB.getInt();
+		sectionMapAddress = decryptedDataBB.getInt() + 0x100; // the Section Map Address
+		decryptedDataBB.getInt(); // 0x00
+		sectionInfoId = decryptedDataBB.getInt(); // Very important: the id of the Section Info
+		sectionArraySize = decryptedDataBB.getInt();
+		gapArraySize = decryptedDataBB.getInt();
+		decryptedDataBB.getInt(); // CRC
+		len = 0x14;
+		generatedSequence = new byte[len];
+		bb.get(generatedSequence);
+		// Done reading the encrypted variables
+
+	}
+
+	/*************************************************************************************
+	 * **********************************************************************/
+
+	/**
+	 * Read and store all the header variables into the
+	 * <code> HeaderVars </code> Map
+	 *
+	 * @param bb
+	 *            ByteBuffer containing the opened DWG file
+	 */
+	private void readDwgR2004Headers(ByteBuffer bb) {
+
+		/*
+		 * NOTA (Paco) He encontrado un sitio web con explicacion de ¿todas?
+		 * estas variables: http://www.hispacad.com/variables
+		 */
+
+		ByteBuffer decompressedBB = readSection(bb, "AcDb:Header");
+
+		byte[] sentinel = new byte[16];
+		decompressedBB.order(ByteOrder.nativeOrder());
+		decompressedBB.position(0);
+		decompressedBB.get(sentinel); // we get the sentinel that ALWAYS
+		// appears before the data
+
+		if ((sentinel[0] & 0xFF) != 0xcf)
+			logger.trace("sentinel[0] != 0xcf found " + (sentinel[0] & 0xFF));
+		if ((sentinel[1] & 0xFF) != 0x7b)
+			logger.trace("sentinel[1] != 0x7b found " + (sentinel[1] & 0xFF));
+		if ((sentinel[2] & 0xFF) != 0x1f)
+			logger.trace("sentinel[2] != 0x1f found " + (sentinel[2] & 0xFF));
+		if ((sentinel[3] & 0xFF) != 0x23)
+			logger.trace("sentinel[3] != 0x23 found " + (sentinel[3] & 0xFF));
+		if ((sentinel[4] & 0xFF) != 0xfd)
+			logger.trace("sentinel[4] != 0xfd found " + (sentinel[4] & 0xFF));
+		if ((sentinel[5] & 0xFF) != 0xde)
+			logger.trace("sentinel[5] != 0xde found " + (sentinel[5] & 0xFF));
+		if ((sentinel[6] & 0xFF) != 0x38)
+			logger.trace("sentinel[6] != 0x38 found " + (sentinel[6] & 0xFF));
+		if ((sentinel[7] & 0xFF) != 0xa9)
+			logger.trace("sentinel[7] != 0xa9 found " + (sentinel[7] & 0xFF));
+		if ((sentinel[8] & 0xFF) != 0x5f)
+			logger.trace("sentinel[8] != 0x5f found " + (sentinel[8] & 0xFF));
+		if ((sentinel[9] & 0xFF) != 0x7c)
+			logger.trace("sentinel[9] != 0x7c found " + (sentinel[9] & 0xFF));
+		if ((sentinel[10] & 0xFF) != 0x68)
+			logger.trace("sentinel[10] != 0x68 found " + (sentinel[10] & 0xFF));
+		if ((sentinel[11] & 0xFF) != 0xb8)
+			logger.trace("sentinel[11] != 0xb8 found " + (sentinel[11] & 0xFF));
+		if ((sentinel[12] & 0xFF) != 0x4e)
+			logger.trace("sentinel[12] != 0x4e found " + (sentinel[12] & 0xFF));
+		if ((sentinel[13] & 0xFF) != 0x6d)
+			logger.trace("sentinel[13] != 0x6d found " + (sentinel[13] & 0xFF));
+		if ((sentinel[14] & 0xFF) != 0x33)
+			logger.trace("sentinel[14] != 0x33 found " + (sentinel[14] & 0xFF));
+		if ((sentinel[15] & 0xFF) != 0x5f)
+			logger.trace("sentinel[15] != 0x5f found " + (sentinel[15] & 0xFF));
+
+		// we start working with data that comes after the beginning sentinel
+		decompressedBB.order(ByteOrder.LITTLE_ENDIAN);
+		int size = decompressedBB.getInt(); // this size is never correct
+
+		decompressedBB.order(ByteOrder.nativeOrder());
+		byte[] data = new byte[size];
+		decompressedBB.get(data);
+
+		int[] intData = DwgUtil.toIntArray(data);
+
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		decompressedBB.getShort(); // CRC
+
+		decompressedBB.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16]; // we know it comes there because we already found it
+		decompressedBB.get(lastSentinnel);
+
+		if ((lastSentinnel[0] & 0xFF) != 0x30)
+			logger.trace("lastSentinnel[0] != 0x30 , is: " + lastSentinnel[0]);
+		if ((lastSentinnel[1] & 0xFF) != 0x84)
+			logger.trace("lastSentinnel[1] != 0x84 , is: " + lastSentinnel[1]);
+		if ((lastSentinnel[2] & 0xFF) != 0xe0)
+			logger.trace("lastSentinnel[2] != 0xe0 , is: " + lastSentinnel[2]);
+		if ((lastSentinnel[3] & 0xFF) != 0xdc)
+			logger.trace("lastSentinnel[3] != 0xdc , is: " + lastSentinnel[3]);
+		if ((lastSentinnel[4] & 0xFF) != 0x02)
+			logger.trace("lastSentinnel[4] != 0x02 , is: " + lastSentinnel[4]);
+		if ((lastSentinnel[5] & 0xFF) != 0x21)
+			logger.trace("lastSentinnel[5] != 0x21 , is: " + lastSentinnel[5]);
+		if ((lastSentinnel[6] & 0xFF) != 0xc7)
+			logger.trace("lastSentinnel[6] != 0xc7 , is: " + lastSentinnel[6]);
+		if ((lastSentinnel[7] & 0xFF) != 0x56)
+			logger.trace("lastSentinnel[7] != 0x56 , is: " + lastSentinnel[7]);
+		if ((lastSentinnel[8] & 0xFF) != 0xa0)
+			logger.trace("lastSentinnel[8] != 0xa0 , is: " + lastSentinnel[8]);
+		if ((lastSentinnel[9] & 0xFF) != 0x83)
+			logger.trace("lastSentinnel[9] != 0x83 , is: " + lastSentinnel[9]);
+		if ((lastSentinnel[10] & 0xFF) != 0x97)
+			logger.trace("lastSentinnel[10] != 0x97 , is: " + lastSentinnel[10]);
+		if ((lastSentinnel[11] & 0xFF) != 0x47)
+			logger.trace("lastSentinnel[11] != 0x47 , is: " + lastSentinnel[11]);
+		if ((lastSentinnel[12] & 0xFF) != 0xb1)
+			logger.trace("lastSentinnel[12] != 0xb1 , is: " + lastSentinnel[12]);
+		if ((lastSentinnel[13] & 0xFF) != 0x92)
+			logger.trace("lastSentinnel[13] != 0x92 , is: " + lastSentinnel[13]);
+		if ((lastSentinnel[14] & 0xFF) != 0xcc)
+			logger.trace("lastSentinnel[14] != 0xcc , is: " + lastSentinnel[14]);
+		if ((lastSentinnel[15] & 0xFF) != 0xa0)
+			logger.trace("lastSentinnel[15] != 0xa0 , is: " + lastSentinnel[15]);
+
+		int bitPos = 0;
+		try {
+
+			List val = DwgUtil.getBitDouble(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VAL4", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING1", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING2", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING3", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STRING4", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG1", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos); // Unknown
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LONG2", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASO", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSHO", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEGEN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ORTHOMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("REGENMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("QTEXTMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSLTSCALE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LIMCHECK", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNDOCUMENTED1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USER_TIMER", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKPOLY", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGDIR", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLFRAME", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MIRRTEXT", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("WORLDVIEW", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TILEMODE", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLIMCHECK", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VISRETAIN", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DISPSILH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PELLISE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PROXYGRAPH", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TREEDEPTH", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LUPREC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("AUPREC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ATTMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDMODE", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN1", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN2", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN3", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI3", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI4", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERI5", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINESEGS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFV", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB1", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SURFTAB2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SPLINETYPE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDGE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SHADEDIF", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNITMODE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MAXACTVP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ISOLINES", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLJUST", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTQLTY", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("LTSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TEXTSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("TRACEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SKETCHINC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FILLETRAD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("THICKNESS", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("ANGBASE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PDSIZE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PLINEWID", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR1", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR2", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR3", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR4", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("USERR5", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERA", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERB", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CHAMFERD", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FACETRES", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CMLSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CELTSCALE", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MENUNAME", val.get(1));
+
+			int[] tdcreate = new int[2];
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdcreate[1] = ((Integer) val.get(1)).intValue();
+
+			dwgFile.setHeader("TDCREATE", tdcreate);
+
+			int[] tdupdate = new int[2];
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdupdate[1] = ((Integer) val.get(1)).intValue();
+
+			dwgFile.setHeader("TDUPDATE", tdupdate);
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN4", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN5", val.get(1));
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UNKNOWN6", val.get(1));
+
+			int[] tdindwg = new int[2];
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdindwg[1] = ((Integer) val.get(1)).intValue();
+
+			int[] tdusrtime = new int[2];
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[0] = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			tdusrtime[1] = ((Integer) val.get(1)).intValue();
+
+			dwgFile.setHeader("TDUSRTIME", tdusrtime);
+
+			//FIXME: En versiones anteriores solo hab�a una variable
+			// "CECOLOR" de tipo entero, habr�a que comprobar donde se
+			// utiliza para, si es necesario, utilizar apropiadamente
+			// las nuevas.
+			val = DwgUtil.getCmColor(intData, bitPos, dwgFile.getDwgVersion());
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CECOLOR", val.get(1));
+			dwgFile.setHeader("CECOLOR_RGBVALUE", val.get(2));
+			Object cecolorColorByte = val.get(3);
+			dwgFile.setHeader("CECOLOR_COLORBYTE", cecolorColorByte);
+			dwgFile.setHeader("CECOLOR_NAME", val.get(4));
+
+			dwgFile.getDwgVersion();
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("HANDSEED", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("TEXSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CELLTYPE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMSTYLE", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("CMLSTYLE", new Integer(intHandle));
+
+			// DWG 2000+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSVPSCALE", val.get(1));
+
+			double[] spaces1 = new double[3];
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces1[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_INSBASE", spaces1);
+
+			double[] spaces2 = new double[3];
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces2[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_EXTMIN", spaces2);
+
+			double[] spaces3 = new double[3];
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces3[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PSPACE_EXTMAX", spaces2);
+
+			double[] spaces4 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces4[1] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_LIMMIN", spaces4);
+
+			double[] spaces5 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces5[1] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_LIMMAX", spaces5);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PSPACE_ELEVATION", val.get(1));
+
+			double[] spaces6 = new double[6];
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces6[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_UCSORG", spaces6);
+
+			double[] spaces7 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces7[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_UCSXDIR", spaces7);
+
+			double[] spaces8 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces8[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("PSPACE_UCSYDIR", spaces8);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PSPACE_UCSNAME", new Integer(intHandle));
+
+			// R2000+ Only
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PUCSBASE", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PUCSORTHOVIEW", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PUCSORTHOREF", new Integer(intHandle));
+
+			double[] pucsorgtop = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgtop[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGTOP", pucsorgtop);
+
+			double[] pucsorgbottom = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgbottom[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGBOTTOM", pucsorgbottom);
+
+			double[] pucsorgleft = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgleft[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGLEFT", pucsorgleft);
+
+			double[] pucsorgright = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgright[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGRIGHT", pucsorgright);
+
+			double[] pucsorgfront = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgfront[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGFRONT", pucsorgfront);
+
+			double[] pucsorgback = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			pucsorgback[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("PUCSORGBACK", pucsorgback);
+
+			// Common
+
+			double[] spaces9 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces9[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_INSBASE", spaces9);
+
+			double[] spaces10 = new double[6];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces10[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_EXTMIN", spaces10);
+
+			double[] spaces11 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces11[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_EXTMAX", spaces11);
+
+			double[] spaces12 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces12[1] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_LIMMIN", spaces12);
+
+			double[] spaces13 = new double[2];
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getRawDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces13[1] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_LIMMAX", spaces13);
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("MSPACE_ELEVATION", (Double) val.get(1));
+
+			double[] spaces14 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces14[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_UCSORG", spaces14);
+
+			double[] spaces15 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces15[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_UCSXDIR", spaces15);
+
+			double[] spaces16 = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[0] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[1] = ((Double) val.get(1)).doubleValue();
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			spaces16[2] = ((Double) val.get(1)).doubleValue();
+
+			dwgFile.setHeader("MSPACE_UCSYDIR", spaces16);
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MSPACE_UCSNAME", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCSBASE", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("UCSORTHOVIEW", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCSORTHOREF", new Integer(intHandle));
+
+			double[] ucsorgtop = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgtop[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGTOP", ucsorgtop);
+
+			double[] ucsorgbottom = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgbottom[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGBOTTOM", ucsorgbottom);
+
+			double[] ucsorgleft = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgleft[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGLEFT", ucsorgleft);
+
+			double[] ucsorgright = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgright[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGRIGHT", ucsorgright);
+
+			double[] ucsorgfront = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgfront[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGFRONT", ucsorgfront);
+
+			double[] ucsorgback = new double[3];
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[0] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[1] = ((Double) val.get(1)).doubleValue();
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			ucsorgback[2] = ((Double) val.get(1)).doubleValue();
+			dwgFile.setHeader("UCSORGBACK", ucsorgback);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMPOST", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAPOST", val.get(1));
+
+			// Common
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSCALE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXO", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLI", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMEXE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAND", val.get(1)); //FIXME: ¿o es DIMRND?
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDLE", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTM", val.get(1));
+
+			// DWG 2000 +
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLIM", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSE1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSE2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTAD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMZIN", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAZIN", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTXT", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCEN", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSZ", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTF", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTVP", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTFAC", val.get(1));
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMGAP", val.get(1));
+
+			// DWG 2000+
+
+			val = DwgUtil.getBitDouble(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTRND", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTD", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOFL", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSAH", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTIX", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSOXD", val.get(1));
+
+			// common
+
+			//FIXME: En versiones anteriores solo hab�a una variable
+			// "DIMCLRD" de tipo entero, habr�a que comprobar donde se
+			// utiliza para, si es necesario, utilizar apropiadamente
+			// las nuevas. Lo mismo con "DIMCLRE" y "DIMCLRT".
+
+			val = DwgUtil.getCmColor(intData, bitPos, dwgFile.getDwgVersion());
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRD", val.get(1));
+			dwgFile.setHeader("DIMCLRD_RGBVALUE", val.get(2));
+			Object dimclrdColorByte = val.get(3);
+			dwgFile.setHeader("DIMCLRD_COLORBYTE", dimclrdColorByte);
+			dwgFile.setHeader("DIMCLRD_NAME", val.get(4));
+
+			val = DwgUtil.getCmColor(intData, bitPos, dwgFile.getDwgVersion());
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRE", val.get(1));
+			dwgFile.setHeader("DIMCLRE_RGBVALUE", val.get(2));
+			Object dimclreColorByte = val.get(3);
+			dwgFile.setHeader("DIMCLRE_COLORBYTE", dimclreColorByte);
+			dwgFile.setHeader("DIMCLRE_NAME", val.get(4));
+
+			val = DwgUtil.getCmColor(intData, bitPos, dwgFile.getDwgVersion());
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMCLRT", val.get(1));
+			dwgFile.setHeader("DIMCLRT_RGBVALUE", val.get(2));
+			Object dimclrtColorByte = val.get(3);
+			dwgFile.setHeader("DIMCLRT_COLORBYTE", dimclrtColorByte);
+
+			dwgFile.setHeader("DIMCLRT_NAME", val.get(4));
+
+			// dwg2000 +
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMADEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTDEC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTU", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMAUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMFRAC", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLUNIT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMDSEP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTMOVE", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMJUST", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD1", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMSD2", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTOLJ", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMTZIN", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTZ", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMALTTZ", val.get(1));
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMUPT", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMFIT", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMTXTSTY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMLDRBLK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK1", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMBLK2", new Integer(intHandle));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLWD", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMLWE", val.get(1));
+
+			// Common
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("BLOCK_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LAYER_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("STYLE_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LINETYPE_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VIEW_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("UCS_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("VPORT_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("APPID_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("DIMSTYLE_CONTROL_OBJECT", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_GROUP_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("ACAD_MLINE_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("NAMED_OBJECT_DICTIONARY", new Integer(intHandle));
+			// DWG 2000+
+
+			// unknown bitshort
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+
+			// unknown bitshort
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HYPERLINKBASE", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("STYLESHEET", val.get(1));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LAYOUT_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PLOT_SETTINGS_DICTIONARY",
+					new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PLOT_STYLES_DICTIONARY", new Integer(intHandle));
+
+			// DWG 2004+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MATERIALS_DICTIONARY", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("COLORS_DICTIONARY", new Integer(intHandle));
+
+			// DWG 2000 +
+
+			/*
+			 * Flags:
+			 * CELWEIGHT	Flags & 0x001F
+			 * ENDCAPS		Flags & 0x0060
+			 * JOINSTYLE	Flags & 0x0180
+			 * LWDISPLAY	!(Flags & 0x0200)
+			 * XEDIT		!(Flags & 0x0400)
+			 * EXTNAMES		Flags & 0x0800
+			 * PSTYLEMODE	Flags & 0x2000
+			 * OLESTARTUP	Flags & 0x4000
+			 */
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FLAGS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("INSUNITS", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("CEPSNTYPE", val.get(1));
+
+			if (((Integer) val.get(1)).intValue() == 3) {
+				val = DwgUtil.getHandle(intData, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				intHandle = DwgUtil.handleToInt(val);
+				dwgFile.setHeader("CPSNID", new Integer(intHandle));
+			}
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("FINGERPRINTGUID", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("VERSIONGUID", val.get(1));
+
+			// DWG 2004+
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("SORTENTS", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("INDEXCTL", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HIDETEXT", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("XCLIPFRAME", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("DIMASSOC", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("HALOGAP", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("OBSCUREDCOLOR", val.get(1));
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("INTERSECTION_COLOR", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("OBSCUREDLTYPE", val.get(1));
+
+			val = DwgUtil.getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("INTERSECTION_DISPLAY", val.get(1));
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			dwgFile.setHeader("PROJECTNAME", val.get(1));
+
+			// Common
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("PAPER_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("MODEL_BLOCK_RECORD", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYLAYER", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_BYBLOCK", new Integer(intHandle));
+
+			val = DwgUtil.getHandle(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			intHandle = DwgUtil.handleToInt(val);
+			dwgFile.setHeader("LTYPE_CONTINUOUS", new Integer(intHandle));
+
+		} catch (Exception e) {
+			logger.trace(e.getMessage());
+		}
+
+	}
+
+	/**
+	 * decrypts the encrypted data
+	 *
+	 * @param encrypted
+	 *            encrypted data
+	 * @param offset
+	 *            current position in file
+	 * @return vector with the decrypted data
+	 */
+	private int[] decryptSectionHeader(byte[] encrypted, int offset) {
+		int secMask = 0x4164536b ^ offset;
+		int[] decrypted = new int[8];
+		ByteBuffer Hdr = ByteBuffer.allocate(32);
+		Hdr.position(0);
+		Hdr.put(encrypted);
+		Hdr.order(ByteOrder.LITTLE_ENDIAN);
+		Hdr.position(0);
+
+		for (int i = 0; i < 8; i++) {
+			int aux = Hdr.getInt();
+			aux = aux ^ secMask;
+			decrypted[i] = aux;
+		}
+		return decrypted;
+	}
+
+	/**
+	 * Find all subsections of a section named "name" in the section's array sorted by startOffset
+	 *
+	 * @param name
+	 *            String name of the section to find
+	 *
+	 * @return vector with sections named 2name"
+	 */
+	private Section[] findSections(String name) {
+
+		Comparator cmp = new Comparator(){
+
+			public int compare(Object arg0, Object arg1) {
+				if (((Section)arg0).getStartOffset() > ((Section)arg1).getStartOffset()) {
+					return 1;
+                }
+				return -1;
+			}
+
+		};
+		TreeSet foundSections = new TreeSet(cmp);
+
+		for (int i = 0; i < sectionAmount; i++) {
+			if (sections[i].getName() != null
+					&& sections[i].getName().contains(name)) {
+				foundSections.add(sections[i]);
+			}
+			if (i == sectionAmount)
+				logger.trace("No se han encontrado secciones llamadas \"" + name + "\"");
+		}
+		return (Section[]) foundSections.toArray(new Section[0]);
+	}
+
+
+	/**
+	 * Contains the defined classes for drawing
+	 *
+	 * @param bb
+	 *            ByteBuffer containing the opened DWG file
+	 */
+	private void readDwgR2004Classes(ByteBuffer bb) {
+
+		ByteBuffer decompressedBB = readSection(bb, "AcDb:Classes");
+
+		byte[] sentinel = new byte[16];
+		decompressedBB.order(ByteOrder.nativeOrder());
+		decompressedBB.position(0);
+		decompressedBB.get(sentinel); // we get the sentinel that ALWAYS
+		// appears before the data
+
+		if ((sentinel[0] & 0XFF) != 0x8d)
+			logger.trace(" sentinel[0] != 0x8d");
+		if ((sentinel[1] & 0XFF) != 0xa1)
+			logger.trace("sentinel[1] != 0xa1");
+		if ((sentinel[2] & 0XFF) != 0xc4)
+			logger.trace("sentinel[2] != 0xc4");
+		if ((sentinel[3] & 0XFF) != 0xb8)
+			logger.trace("sentinel[3] != 0xb8");
+		if ((sentinel[4] & 0XFF) != 0xc4)
+			logger.trace("sentinel[4] != 0xc4");
+		if ((sentinel[5] & 0XFF) != 0xa9)
+			logger.trace("sentinel[5] != 0xa9");
+		if ((sentinel[6] & 0XFF) != 0xf8)
+			logger.trace("sentinel[6] != 0xf8");
+		if ((sentinel[7] & 0XFF) != 0xc5)
+			logger.trace("sentinel[7] != 0xc5");
+		if ((sentinel[8] & 0XFF) != 0xc0)
+			logger.trace("sentinel[8] != 0xc0");
+		if ((sentinel[9] & 0XFF) != 0xdc)
+			logger.trace("sentinel[9] != 0xdc");
+		if ((sentinel[10] & 0XFF) != 0xf4)
+			logger.trace("sentinel[10] != 0xf4");
+		if ((sentinel[11] & 0XFF) != 0x5f)
+			logger.trace("sentinel[11] != 0x5f");
+		if ((sentinel[12] & 0XFF) != 0xe7)
+			logger.trace("sentinel[12] != 0xe7");
+		if ((sentinel[13] & 0XFF) != 0xcf)
+			logger.trace("sentinel[13] != 0xcf");
+		if ((sentinel[14] & 0XFF) != 0xb6)
+			logger.trace("sentinel[14] != 0xb6");
+		if ((sentinel[15] & 0XFF) != 0x8a)
+			logger.trace("sentinel[15] != 0x8a");
+
+		// we start working with data that comes after the beginning sentinel
+		decompressedBB.order(ByteOrder.LITTLE_ENDIAN);
+		int size = decompressedBB.getInt();
+
+		decompressedBB.order(ByteOrder.nativeOrder());
+		byte[] data = new byte[size];
+		decompressedBB.get(data);
+
+		int[] intData = DwgUtil.toIntArray(data);
+
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		short crc = decompressedBB.getShort(); // CRC
+
+		List val = null;
+		int bitPos = 0;
+
+		val = DwgUtil.getBitShort(intData, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		int MaxclassNum = ((Integer) val.get(1)).intValue();
+
+		val = DwgUtil.getRawChar(intData, bitPos); // 0x00
+		if (((Integer) val.get(1)).intValue() != 0x00) {
+			logger.trace("Classes Section RC1 != 0x00");
+		}
+		bitPos = ((Integer) val.get(0)).intValue();
+
+		val = DwgUtil.getRawChar(intData, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue(); // 0x00
+		if (((Integer) val.get(1)).intValue() != 0x00) {
+			logger.trace("Classes Section RC2 != 0x00");
+		}
+
+		val = DwgUtil.testBit(intData, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		if (((Boolean) val.get(1)).booleanValue() != true) {
+			logger.trace("Classes Section B != true");
+		}
+
+		int maxBit = size * 8;
+
+		while ((bitPos + 8) < maxBit) {
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int classNum = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int version = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String appName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String cPlusPlusName = (String) val.get(1);
+
+			val = DwgUtil.getTextString(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			String dxfName = (String) val.get(1);
+
+			val = DwgUtil.testBit(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			boolean isZombie = ((Boolean) val.get(1)).booleanValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int id = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int numberObject = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int DwgVersion = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int maintenanceVersion = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int unknown1 = ((Integer) val.get(1)).intValue();
+
+			val = DwgUtil.getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			int unknown2 = ((Integer) val.get(1)).intValue();
+
+			DwgClass2004 dwgClass = new DwgClass2004(classNum, version,
+					appName, cPlusPlusName, dxfName, isZombie, id,
+					numberObject, DwgVersion, maintenanceVersion, unknown1,
+					unknown2);
+			dwgFile.addDwgClass(dwgClass);
+
+		}// while
+
+		decompressedBB.order(ByteOrder.nativeOrder());
+		byte[] lastSentinnel = new byte[16];
+		decompressedBB.get(lastSentinnel);
+		if (lastSentinnel[0] != 0x72)
+			logger.trace("lastSentinnel[0] != 0x72");
+		if (lastSentinnel[1] != 0x5e)
+			logger.trace("lastSentinnel[1] != 0x5e");
+		if (lastSentinnel[2] != 0x3b)
+			logger.trace("lastSentinnel[2] != 0x3b");
+		if (lastSentinnel[3] != 0x47)
+			logger.trace("lastSentinnel[3] != 0x47");
+		if (lastSentinnel[4] != 0x3b)
+			logger.trace("lastSentinnel[4] != 0x3b");
+		if (lastSentinnel[5] != 0x56)
+			logger.trace("lastSentinnel[5] != 0x56");
+		if (lastSentinnel[6] != 0x07)
+			logger.trace("lastSentinnel[6] != 0x07");
+		if (lastSentinnel[7] != 0x3a)
+			logger.trace("lastSentinnel[7] != 0x3a");
+		if (lastSentinnel[8] != 0x3f)
+			logger.trace("lastSentinnel[8] != 0x3f");
+		if (lastSentinnel[9] != 0x23)
+			logger.trace("lastSentinnel[9] != 0x23");
+		if (lastSentinnel[10] != 0x0b)
+			logger.trace("lastSentinnel[10] != 0x0b");
+		if ((lastSentinnel[11] & 0xFF) != 0xa0)
+			logger.trace("lastSentinnel[11] != 0xa0");
+		if (lastSentinnel[12] != 0x18)
+			logger.trace("lastSentinnel[12] != 0x18");
+		if (lastSentinnel[13] != 0x30)
+			logger.trace("lastSentinnel[13] != 0x30");
+		if (lastSentinnel[14] != 0x49)
+			logger.trace("lastSentinnel[14] != 0x49");
+		if (lastSentinnel[15] != 0x75)
+			logger.trace("lastSentinnel[15] != 0x75");
+	}
+
+	/**
+	 *
+	 * @param bb
+	 *            ByteBuffer containing the opened DWG File
+	 */
+	private void readDwgR2004ObjectOffsets(ByteBuffer bb) {
+
+		ByteBuffer decompressedBB = readSection(bb,"AcDb:Handles");
+		decompressedBB.position(0);
+
+		short size;
+
+		byte[] dataBytes;
+		int[] data;
+		int bitPos = 0;
+		int bitMax;
+
+
+		do {
+			bitPos = 0;
+			decompressedBB.order(ByteOrder.BIG_ENDIAN);
+			size = decompressedBB.getShort();
+			decompressedBB.order(ByteOrder.LITTLE_ENDIAN);
+			if (size == 2)
+				break;
+			dataBytes = new byte[size-2];
+			decompressedBB.get(dataBytes);
+			data = DwgUtil.bytesToMachineBytes(dataBytes);
+			bitMax = (size - 2) * 8;
+			int lastHandle = 0;
+			int lastLoc = 0;
+			while (bitPos < bitMax) {
+				ArrayList v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				int handle = ((Integer) v.get(1)).intValue();
+				if(handle<0){
+					logger.trace("offset negativo");
+					handle = - handle;
+				}
+				lastHandle = lastHandle + handle;
+
+				v = DwgUtil.getModularChar(data, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				int loc = ((Integer) v.get(1)).intValue();
+				lastLoc = lastLoc + loc;
+
+				dwgFile.addDwgObjectOffset(lastHandle, lastLoc);
+
+			}// while
+			decompressedBB.getShort(); //crc
+
+		} while (size != 2);
+
+		return;
+
+	}
+
+	/**
+	 * @return the decompressed data of a logical section,
+	 * joining up all the physical sections belonging to it .
+	 * @param ByteBuffer
+	 *            Containing the opened dwg file
+	 * @param compressedSize
+	 *            size of the compressed data
+	 * @param decompressedSize
+	 *            size of the decompressed data
+	 * @param CheckSum
+	 */
+	protected ByteBuffer readSection(ByteBuffer bb, String name) {
+
+		Section[] foundSections = findSections(name);
+		ByteBuffer fullSectionDecompressedBB = null;
+		ByteBuffer sectionDecompressedData = null;
+		int numberOfFoundSections = foundSections.length;
+		if ( numberOfFoundSections == 0) {
+			logger.trace("No se han encontrado secciones llamadas " + name);
+		} else {
+			Section section;
+			int decompressedSize = foundSections[0].getMaxDecompressedSize();
+
+			fullSectionDecompressedBB = ByteBuffer.allocate(decompressedSize * numberOfFoundSections);
+			fullSectionDecompressedBB.position(0);
+
+			for(int i=0; i<numberOfFoundSections; i++){
+				section = (Section)foundSections[i];
+
+				int offset = section.getAddress();
+				bb.position(offset);
+				bb.order(ByteOrder.nativeOrder());
+				byte[] encrypted = new byte[32];
+				bb.get(encrypted); // We get the Encrypted Section Header
+
+				int[] decrypted = decryptSectionHeader(encrypted, offset);
+				/*
+				 * decrypted[0] = SectionType
+				 * decrypted[1] = Data Size
+				 * decrypted[2] = Section Size
+				 * decrypted[3] = Start Offset
+				 * decrypted[4] = Unknown
+				 * decrypted[5] = CheckSum1
+				 * decrypted[6] = CheckSum2
+				 * decrypted[7] = ???
+				 *
+				 * Lo de arriba es lo de la documentacion pero yo creo [Paco]:
+				 *
+				 * decrypted[0] = ???
+				 * decrypted[1] = SectionType
+				 * decrypted[2] = Data Size
+				 * decrypted[3] = Section Size
+				 * decrypted[4] = Start Offset
+				 * decrypted[5] = Unknown
+				 * decrypted[6] = CheckSum1
+				 * decrypted[7] = CheckSum2
+				 *
+				 */
+
+				if ( decrypted[1] != section.getType()){
+					logger.trace("Discrepancia en el tipo de seccion: " + section.getType() +" , " + decrypted[1] );
+				}
+				if ( decrypted[2] != section.getDataSize()){
+					logger.trace("Discrepancia en el tamaño de los datos de la seccion: " + section.getDataSize() +" , " + decrypted[2] );
+				}
+				if ( decrypted[3] != section.getSize()){
+					logger.trace("Discrepancia en el tamaño de la seccion: " + section.getSize() +" , " + decrypted[3] );
+				}
+				if ( decrypted[4] != section.getStartOffset()){
+					logger.trace("Discrepancia en el start offset de la seccion: " + section.getStartOffset() +" , " + decrypted[4] );
+				}
+
+				decompressedSize = section.getMaxDecompressedSize();
+				sectionDecompressedData = readCompressedSection(bb, decrypted[2],	decompressedSize, 0);
+				sectionDecompressedData.position(0);
+				section.setDecompressedData(sectionDecompressedData);
+				if (fullSectionDecompressedBB.position() != section.getStartOffset()){
+					logger.trace("Desincronizaci�n entre el start offset de la seccion y la posici�n del ByteBuffer compuesto: " + section.getStartOffset() +" , " + fullSectionDecompressedBB.position() );
+				}
+				fullSectionDecompressedBB.put(section.getDecompressedData());
+			}
+		}
+		return fullSectionDecompressedBB;
+
+	}
+
+	/**
+	 * Reads all the object referenced in the object map section of the DWG file
+	 * (using their object file obsets)
+	 */
+	protected void readDwgR2004Objects() {
+
+		ByteBuffer decompressedBB = readSection(bb, "AcDb:AcDbObjects");
+		if (decompressedBB != null){
+			decompressedBB.position(0);
+
+			for (int i = 0; i < dwgFile.getDwgObjectOffsets().size(); i++) {
+				try {
+					DwgObjectOffset doo = (DwgObjectOffset) dwgFile.getDwgObjectOffsets().get(i);
+
+					DwgObject obj = readDwgR2004Object(decompressedBB, doo.getOffset(), i);
+					/*
+					 * azabala: las entidades DWG no implementadas no nos aportan
+					 * nada (aunque la sigo leyendo por si aparecen problemas de
+					 * puntero de fichero) No considero por tanto los DwgObject if
+					 * (obj != null) { dwgFile.addDwgObject(obj); }
+					 *
+					 * paco: propongo reconsiderar esto. Si no cargamos todos los
+					 * objetos podemos tener problemas con las subentities.
+					 */
+					if (obj != null && obj.getClass() != DwgObject.class) {
+						dwgFile.addDwgObject(obj);
+					}
+				} catch (Exception e) {
+					logger.trace(e.getMessage());
+					continue;
+				}
+			}// for
+		}
+
+	}
+
+	/**
+	 * Read commun parameters for an Object
+	 *
+	 * @param offset
+	 *            Object's address
+	 * @param index
+	 *            object identifier
+	 * @return the object
+	 */
+	protected DwgObject readDwgR2004Object(ByteBuffer bb, int offset, int index) {
+		DwgObject obj = null;
+		try {
+			if (offset >= bb.capacity()) {
+				logger.trace("Posible error leyendo un objeto: capacity = "
+						+ bb.capacity() + " offset = " + offset);
+				return null;
+			}
+			bb.position(offset);
+			int size = DwgUtil.getModularShort(bb);
+
+
+			//FIXME: Esto es para saltarse posibles objetos defectuosos que nos
+			//impedir�an ver el resto del archivo
+			if (size == 0 || size>29696) {
+				logger.trace("Posible error leyendo un objeto: size = "+size);
+				return null;
+			}
+			if (offset + (size*8) >= bb.capacity()) {
+				logger.trace("Posible error leyendo un objeto: capacity = "
+						+ bb.capacity() + " offset = " + offset + " size = "+size);
+				return null;
+			}
+
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			byte[] data = new byte[size];
+			int[] intData = new int[size];
+
+			bb.get(data);
+			try {
+				intData = DwgUtil.toIntArray(data);
+			} catch (Exception e) {
+				logger.trace("Error leyendo un objeto: size = " + size, e);
+				return null;
+			}
+
+			int bitPos = 0;
+			ArrayList v = DwgUtil.getBitShort(intData, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int type = ((Integer) v.get(1)).intValue(); // the type of object
+
+			obj = DwgObjectFactory.getInstance().create(type, index);
+
+			/*
+			 * This if is entered to check if the type of the object is a
+			 * non-fixed value
+			 */
+			if (obj == null) {
+				logger.trace("dwgFileVR2004Reader: Entrando en Objeto Nulo");
+				if (type >= 500) {
+					int newIndex = type - 500;
+					if (newIndex < (dwgFile.getDwgClasses().size() - 1)) {
+						DwgClass2004 dwgClass = (DwgClass2004) dwgFile.getDwgClasses().get(newIndex);
+						String dxfEntityName = dwgClass.getDxfName();
+						obj = DwgObjectFactory.getInstance().create(dxfEntityName, index);
+
+						if (obj == null) {
+							logger.trace(dxfEntityName
+									+ " todavia no est� implementado");
+							return null;
+						}// if
+					}// if newIndex
+					else {
+						return null;
+					}
+				} else {
+					logger.trace("dwgFileVR2004Reader: Encontrado tipo " + type);
+					return null;
+				}
+			}
+			obj.setAddress(offset); // we set the address for the object. This
+			// time there is no mistake
+			obj.setVersion(dwgFile.getDwgVersion());
+
+			v = DwgUtil.getRawLong(intData, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			int objBSize = ((Integer) v.get(1)).intValue();
+			obj.setSizeInBits(objBSize);
+
+			DwgHandleReference entityHandle = new DwgHandleReference();
+			bitPos = entityHandle.read(intData, bitPos);
+			obj.setHandle(entityHandle);
+
+			v = DwgUtil.readExtendedData(intData, bitPos);
+			bitPos = ((Integer) v.get(0)).intValue();
+			ArrayList extData = (ArrayList) v.get(1);
+			obj.setExtendedData(extData);
+
+			boolean gflag = obj.isGraphicsFlag();
+			if (gflag) {
+				//lee un flag boolean
+				v = DwgUtil.testBit(intData, bitPos);
+				bitPos = ((Integer) v.get(0)).intValue();
+				boolean val = ((Boolean) v.get(1)).booleanValue();
+				//si hay imagen asociada, se lee por completo
+				if (val) {
+					v = DwgUtil.getRawLong(intData, bitPos);
+					bitPos = ((Integer) v.get(0)).intValue();
+					size = ((Integer) v.get(1)).intValue();
+					int bgSize = size * 8;
+					Integer giData = (Integer) DwgUtil.getBits(intData, bgSize,
+							bitPos);
+					obj.setGraphicData(giData.intValue());
+					bitPos = bitPos + bgSize;
+				}
+			}
+			if(obj.getClass() != DwgObject.class)
+				readSpecificObject2004(obj, intData, bitPos);
+
+		} catch (RuntimeException e) {
+			e.printStackTrace();
+			return null;
+		} catch (CorruptedDwgEntityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return null;
+		}
+		return obj;
+	}
+
+	/**
+	 * Read a specific object depending on its type
+	 *
+	 * @param obj
+	 *            the object to read
+	 * @param data
+	 *            Data of the object
+	 * @param bitPos
+	 *            Position where start reading
+	 * @throws RuntimeException
+	 * @throws CorruptedDwgEntityException
+	 */
+	private void readSpecificObject2004(DwgObject obj, int[] data, int bitPos)
+			throws RuntimeException, CorruptedDwgEntityException {
+
+		DwgObjectReaderPool pool = DwgObjectReaderPool.getInstance();
+		IDwgObjectReader reader = pool.get(obj, "2004");
+		if (reader != null) {
+			// reader.setFileReader(this);
+			reader.readSpecificObj(data, bitPos, obj);
+		} else {
+			logger.trace("No se ha implementado la lectura de "
+					+ obj.getClass().getName() + ", code=" + obj.getType());
+		}
+	}
+
+
+	/**
+	 * Reads the Section Map and fills the Sections Array with the sections
+	 * found
+	 */
+	protected void readDwgR2004SectionMap(ByteBuffer bb) {
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		bb.position(sectionMapAddress);
+		ByteBuffer dData = readSystemSection(bb);
+		dData.order(ByteOrder.LITTLE_ENDIAN);
+		dData.position(0);
+
+		int sectionNumber;
+		int gapNumber = 0;
+		sections = new Section[sectionAmount + 1];
+		gaps = new Gap[gapAmount];
+
+		sections[0] = new Section();
+		sections[0].setNumber(0);
+		sections[0].setSize(0);
+		sections[0].setAddress(0x100);
+
+		int size=0;
+		int previousSize=0;
+
+		/*
+		 * We start reading the section map once decompressed. this usually
+		 * gives a pair of SectionNumber/SectionSize unless a Gap (negative
+		 * section number) is found
+		 */
+		for (int i = 1; i <= sectionAmount; i++) {
+			previousSize=size;
+			size=0;
+			sections[i] = new Section();
+			sectionNumber = dData.getInt();
+			while (sectionNumber < 0) {
+				if (gapNumber >= gapAmount) {
+					logger.trace("ERROR: Se han encontrado mas gaps de los definidos");
+				}
+				gaps[gapNumber] = new Gap();
+				int gapSize = dData.getInt();
+				size += gapSize;
+				gaps[gapNumber].setSize(gapSize);
+				gaps[gapNumber].setParent(dData.getInt());
+				gaps[gapNumber].setLeft(dData.getInt());
+				gaps[gapNumber].setRight(dData.getInt());
+				gaps[gapNumber].setZero(dData.getInt());
+				gapNumber++;
+				sectionNumber = dData.getInt();
+			}
+
+			if (sectionNumber == sectionInfoId) {
+				// We keep this index so we can localize the Section Info
+				sectionInfoIndex = i;
+			}
+			sections[i].setNumber(sectionNumber);
+			int sectionSize = dData.getInt();
+			sections[i].setSize(sectionSize);
+			size += sectionSize;
+			if (i == 1) {
+				sections[i].setAddress(0x100);
+			} else {
+				sections[i].setAddress(sections[i - 1].getAddress()
+						+ previousSize);
+			}
+		}
+	}
+
+	/**
+	 * @return Returns the decompressed data of SectionMap and Section Info.
+	 * @param ByteBuffer
+	 *            containing the dwg opened file
+	 */
+	protected ByteBuffer readSystemSection(ByteBuffer bb) {
+
+		int sectionType = bb.getInt();
+		int decompressedSize = bb.getInt();
+		int compressedSize = bb.getInt();
+		int compressionType = bb.getInt();
+		int checksum = bb.getInt();
+
+
+		return readCompressedSection(bb, compressedSize, decompressedSize, checksum);
+
+	}
+
+	/**
+	 * @return the decompressed data of a compressed section.
+	 * @param ByteBuffer
+	 *            Containing the opend dwg file
+	 * @param compressedSize
+	 *            size of the compressed data
+	 * @param decompressedSize
+	 *            size of the decompressed data
+	 * @param CheckSum
+	 */
+	protected ByteBuffer readCompressedSection(ByteBuffer bb, int compressedSize, int decompressedSize, int checksum) {
+		long calcSize = 0;
+		ByteBuffer decompressedData;
+		decompressedData = ByteBuffer.allocate(decompressedSize);
+		decompressedData.order(ByteOrder.LITTLE_ENDIAN);
+		decompressedData.position(0);
+
+		int opcodes = 0;
+		byte opcode1 = bb.get();
+		byte opcode2 = 0;
+		boolean opcode2valid = false;
+		int literalLength = 0;
+		int lls = 0;
+		int compressedBytes = 0; // Number of "compressed" bytes that are to be copied to this
+		                         // location from a previous location in the uncompressed data stream
+
+		int compOffset = 0; // Offset backwards from the current location in the decompressed data stream,
+		                    // where the "compressed" bytes should be copied from.
+
+		int litCount = 0; // Number of uncompressed or literal bytes to be copied from the input stream,
+		                  // following the addition of the compressed bytes.
+		int[] twoBytesOffset;
+		byte b;
+
+		try {
+			if (((opcode1 & 0xFF) >= 0x00) && ((opcode1 & 0xFF) <= 0x0F)) {
+				literalLength = readLiteralLength(bb, opcode1);
+				lls++;
+				if (literalLength != 0) { // Copy the first sequence of uncompressed(literal) data
+					for (int i = 0; i < literalLength; i++) {
+						b = bb.get();
+						decompressedData.put(b);
+					}
+					opcode1 = bb.get(); // get the first opcode
+				}
+				calcSize = calcSize + literalLength;
+
+			} else {
+				logger.trace("Error leyendo el literal Length");
+			}
+
+			// We start treating the opcodes
+
+			while (opcode1 != 0x11) {
+
+				if ((opcode1 & 0xFF) >= 0x00 && (opcode1 & 0xFF) <= 0x0F) {
+
+					logger.trace("Posible error leyendo el opcode " + opcode1);
+					decompressedData.put(opcode1); // ???
+					if (opcode2valid) {
+						opcode1 = opcode2;
+						opcode2valid = false;
+					} else {
+						opcode1 = bb.get();
+					}
+					continue;
+				} else {
+					compressedBytes = 0;
+					compOffset = 0;
+					litCount = 0;
+					opcodes++;
+					if ((opcode1 & 0xFF) == 0x10) {
+						compressedBytes = readLongCompressionOffset(bb) + 9;
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0] + 0x3FFF;
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) >= 0x12
+							&& (opcode1 & 0xFF) <= 0x17) {
+						compressedBytes = (opcode1 & 0x0F) + 2;
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0] + 0x3FFF;
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read
+							// as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) == 0x18) {
+						// Fuera de las especificaciones de OpenDWG pero
+						// segun chiuinan2, un usuario del foro (en japones):
+						// http://www.programmer-club.com/pc2020v5/Forum/ShowSameTitleN.asp?URL=N&board_pc2020=general&index=16&id=4664&mode=&type_pc2020=sametitleLevel-2
+						// hay que hacer este tratamiento al recibir estos opcodes
+
+						compressedBytes = readLongCompressionOffset(bb) + 9;
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0] + 0x7FFF;
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) >= 0x19
+							&& (opcode1 & 0xFF) <= 0x1f) {
+						// Fuera de las especificaciones de OpenDWG pero
+						// segun chiuinan2, un usuario del foro (en japones):
+						// http://www.programmer-club.com/pc2020v5/Forum/ShowSameTitleN.asp?URL=N&board_pc2020=general&index=16&id=4664&mode=&type_pc2020=sametitleLevel-2
+						// hay que hacer este tratamiento al recibir estos opcodes
+
+						compressedBytes = (opcode1 & 0x0F) + 2;
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0] + 0x7FFF;
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) == 0x20) {
+						// Fuera de las especificaciones de OpenDWG pero
+						// segun kermit un usuario del foro de openDesign hay
+						// que añadirle 0x21
+						compressedBytes = readLongCompressionOffset(bb) + 0x21;
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0];
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) >= 0x21
+							&& (opcode1 & 0xFF) <= 0x3f) {
+						compressedBytes = (opcode1 & 0xFF) - 0x1E;
+
+						twoBytesOffset = readTwoByteOffset(bb);
+						compOffset = twoBytesOffset[0];
+						litCount = twoBytesOffset[1]; // this can take values from 0 to 3.
+						opcode2 = bb.get(); // we get the next opcode
+						opcode2valid = true;
+						if (litCount == 0) { // if litCount is 0, it is read as the next literal length
+							litCount = readLiteralLength(bb, opcode2);
+							opcode2valid = false;
+							if (litCount != 0) {
+								opcode2 = bb.get();
+								opcode2valid = true;
+							}
+						}
+					} else if ((opcode1 & 0xFF) >= 0x40
+							&& (opcode1 & 0xFF) <= 0xFF) {
+						compressedBytes = ((opcode1 & 0xF0) >> 4) - 1;
+						opcode2 = bb.get(); // we read the next byte
+						opcode2valid = true;
+						compOffset = ((opcode2 & 0xFF) << 2)
+								| ((opcode1 & 0x0C) >> 2);
+						opcode2valid = false;
+						if ((opcode1 & 0x03) == 0x00) { // if litCount is 0, it is read as the next literal length
+							litCount = 0;
+							byte opcode3 = bb.get();
+							litCount = readLiteralLength(bb, opcode3);
+							if (litCount == 0) {
+								opcode2 = opcode3; // if litCount = 0, the actual byte is the next opcode
+							} else {
+								opcode2 = bb.get(); // we get the next opcode
+							}
+							opcode2valid = true;
+						} else {
+							litCount = opcode1 & 0x03;
+							opcode2 = bb.get();
+							opcode2valid = true;
+						}
+					} else {
+						logger.trace("Posible error de lectura de una seccion comprimida: " +
+								"Ha aparecido un opcode1 con valor "
+								+ Integer.toHexString(opcode1 & 0xFF));
+						opcode2 = bb.get();
+						opcode2valid = true;
+					}
+
+					if (compressedBytes < 0) {
+						logger.trace("Posible error de lectura de una seccion comprimida: compressedBytes < 0");
+					}
+					if (compOffset < 0) {
+						logger.trace("Posible error de lectura de una seccion comprimida: compOffset < 0");
+					}
+					if (litCount < 0) {
+						logger.trace("Posible error de lectura de una seccion comprimida: litCount < 0");
+					}
+
+					if (compressedBytes > compOffset) {
+						logger.trace("Posible error en la lectura de una seccion comprimida: "
+										+ "No parece logico que compressedBytes > compOffset");
+					}
+					if (compOffset >= decompressedData.position()) {
+						logger.trace("Posible error en la lectura de una seccion comprimida:"
+										+ " el compOffset se sale");
+						compressedBytes = 0; // ???? Para no leer bytes comprimidos ni que se
+						// incluyan en el tamaño calculado.
+					}
+					/*
+					 * We first copy the compressed bytes in our
+					 * decompressedData buffer, from a position compOffset bytes
+					 * backward from the current position
+					 */
+
+					for (int i = 0; i < compressedBytes; i++) {
+						b = decompressedData.get(decompressedData.position() - compOffset - 1);
+						decompressedData.put(b);
+					}
+
+					/*
+					 * Then we copy the literal bytes to our decompressedData
+					 * from the input stream
+					 */
+					for (int i = 0; i < litCount; i++) {
+						decompressedData.put(opcode2);
+						opcode2valid = false;
+						opcode2 = bb.get();
+						opcode2valid = true;
+					}
+
+					calcSize = calcSize + compressedBytes + litCount;
+				}
+				opcode1 = opcode2;
+				opcode2valid = false;
+			}
+
+		} catch (Exception e) {
+			e.printStackTrace();
+
+		}
+
+		return decompressedData;
+	}
+
+	/**
+	 * @return the value of the Literal Length.
+	 * @param ByteBuffer
+	 *            Containing the opened dwg File.
+	 * @param byte
+	 *            b The opcode to calculate the Literal Length
+	 */
+	private int readLiteralLength(ByteBuffer bb, byte b) {
+		int total = 0;
+		if (0x01 <= b && b <= 0x0F) {
+			total = (b & 0xFF) + 3;
+			return total;
+		} else if (b == 0x00) {
+			total = 0x0F;
+			b = bb.get();
+			while (b == 0x00) {
+				total += 0xFF;
+				b = bb.get();
+			}
+			total += (b & 0xFF) + 3;
+			return total;
+		} else if ((b & 0xF0) != 0) {
+			/*
+			 * Any bit set in the high nibble indicates that the literal lenght
+			 * is 0, and the byte is actually the next compression opcode. This
+			 * is case is not possible when the first literal length is read
+			 */
+			return 0;
+		}
+		logger.trace("Posible error de lectura: Se ha encontrado un Literal Lenght: "
+				+ Integer.toHexString(b & 0xFF));
+		return total;
+	}
+
+	/**
+	 * Common compression for different opcodes
+	 *
+	 * @param bb
+	 *            ByteBuffer reading the opened DWG file
+	 * @return the value for <code> offset </code> and <code> litCount </code>
+	 */
+	private int[] readTwoByteOffset(ByteBuffer bb) {
+		byte firstByte = bb.get();
+		int[] values = new int[2];
+		int offset = (((firstByte & 0xFF) >> 2) | ((bb.get() & 0xFF) << 6));
+		int litCount = firstByte & 0x03; // This will make litCount taking values from 0 to 3
+		values[0] = offset;
+		values[1] = litCount;
+		return values;
+	}
+
+	/**
+	 * Common compression for different opcodes
+	 *
+	 * @param bb
+	 *            ByteBuffer reading the opened DWG file
+	 * @return the value for <code> compressedBytes </code>
+	 */
+	private int readLongCompressionOffset(ByteBuffer bb) {
+		int value = 0;
+		byte b = bb.get();
+		while (b == 0x00) {
+			value = value + 0xFF;
+			b = bb.get();
+		}
+		value = value + (b & 0xFF);
+		return value;
+	}
+
+	/**
+	 * Generate a sequence into magicNumber to decrypt the encrypted data in the
+	 * header
+	 */
+	static void setMagicNumber() {
+		int size = 0x6C;
+		magicNumber = new byte[size];
+		int randseed = 1;
+		for (int i = 0; i < size; i++) {
+			randseed *= 0x343fd;
+			randseed += 0x269ec3;
+			magicNumber[i] = (byte) (randseed >> 0x10);
+		}
+	}
+
+
+	public int readObjectHeader(int[] data, int offset, DwgObject dwgObject)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+		throw new UnsupportedOperationException();
+		// return 0;
+	}
+
+	public int readObjectTailer(int[] data, int offset, DwgObject dwgObject)
+			throws RuntimeException, CorruptedDwgEntityException {
+		// TODO Auto-generated method stub
+		throw new UnsupportedOperationException();
+		// return 0;
+	}
+
+}
+
+/**
+ * A section structure contains the number (identifier),size, address and name
+ * of the section
+ *
+ */
+class Section {
+	private int number;
+
+	private int size;
+
+	private int address;
+
+	private String name;
+
+	private int sizeOfLogicalSection;
+
+	private int dataSize;
+
+	private int maxDecompressedSize;
+
+	private int compressed;
+
+	private int type;
+
+	private int encrypted;
+
+	private int startOffset;
+
+	private ByteBuffer decompressedData = null;
+
+	/**
+	 *
+	 * @return number of Section
+	 */
+	public int getNumber() {
+		return number;
+	}
+
+	/**
+	 * Sets number of section
+	 *
+	 * @param number
+	 */
+	public void setNumber(int number) {
+		this.number = number;
+	}
+
+	/**
+	 *
+	 * @return size of Section
+	 */
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size2 of Section
+	 *
+	 * @param size
+	 */
+	public void setSizeOfLogicalSection(int size) {
+		this.sizeOfLogicalSection = size;
+	}
+
+	/**
+	 *
+	 * @return size of Section
+	 */
+	public int getSizeOfLogicalSection() {
+		return sizeOfLogicalSection;
+	}
+
+	/**
+	 * Sets size of Section
+	 *
+	 * @param size
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+	/**
+	 *
+	 * @return address of Section
+	 */
+	public int getAddress() {
+		return address;
+	}
+
+	/**
+	 * Sets address of Section
+	 *
+	 * @param address
+	 */
+	public void setAddress(int address) {
+		this.address = address;
+	}
+
+	/**
+	 *
+	 * @return name of Section
+	 */
+	public String getName() {
+		return this.name;
+	}
+
+	/**
+	 * Sets the name of Section
+	 *
+	 * @param name
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 *
+	 * @return size of data of the Section
+	 */
+	public int getDataSize() {
+		return dataSize;
+	}
+
+	/**
+	 * Sets size of data of the Section
+	 *
+	 * @param size
+	 */
+	public void setDataSize(int dataSize) {
+		this.dataSize = dataSize;
+	}
+
+	/**
+	 *
+	 * @return the maximum decompressed size of section
+	 */
+	public int getMaxDecompressedSize() {
+		return maxDecompressedSize;
+	}
+
+	/**
+	 * Sets the maximum decompressed size of section
+	 *
+	 * @param number
+	 */
+	public void setMaxDecompressedSize(int maxDecompressedSize) {
+		this.maxDecompressedSize = maxDecompressedSize;
+	}
+
+	/**
+	 *
+	 * @return compressed of section
+	 */
+	public int getCompressed() {
+		return compressed;
+	}
+
+	/**
+	 * Sets compressed of section
+	 *
+	 * @param number
+	 */
+	public void setCompressed(int compressed) {
+		this.compressed = compressed;
+	}
+
+	/**
+	 *
+	 * @return type of Section
+	 */
+	public int getType() {
+		return type;
+	}
+
+	/**
+	 * Sets type of section
+	 *
+	 * @param number
+	 */
+	public void setType(int type) {
+		this.type = type;
+	}
+
+	/**
+	 *
+	 * @return encrypted of Section
+	 */
+	public int getEncrypted() {
+		return encrypted;
+	}
+
+	/**
+	 * Sets encrypted of section
+	 *
+	 * @param number
+	 */
+	public void setEncrypted(int encrypted) {
+		this.encrypted = encrypted;
+	}
+
+	/**
+	 * Sets startOffset of Section
+	 *
+	 * @param size
+	 */
+	public void setStartOffset(int startOffset) {
+		this.startOffset = startOffset;
+	}
+
+	/**
+	 *
+	 * @return startOffset of Section
+	 */
+	public int getStartOffset() {
+		return startOffset;
+	}
+
+	/**
+	 * Sets decompressedData of Section
+	 *
+	 * @param decompressedData
+	 */
+	public void setDecompressedData(ByteBuffer decompressedData) {
+		this.decompressedData = decompressedData;
+	}
+
+	/**
+	 *
+	 * @return decompressedData of Section
+	 */
+	public ByteBuffer getDecompressedData() {
+		return decompressedData;
+	}
+
+
+}
+
+/**
+ * A gap structure contains the size, parent, left, right and zero
+ * of the gap
+ *
+ */
+class Gap {
+	private int size;
+
+	private int parent;
+
+	private int left;
+
+	private int right;
+
+	private int zero;
+
+	public int getParent() {
+		return parent;
+	}
+
+	/**
+	 * Sets parent of section
+	 *
+	 * @param parent
+	 */
+	public void setParent(int parent) {
+		this.parent = parent;
+	}
+
+	/**
+	 *
+	 * @return left of Section
+	 */
+	public int getLeft() {
+		return left;
+	}
+
+	/**
+	 * Sets left of section
+	 *
+	 * @param left
+	 */
+	public void setLeft(int left) {
+		this.left = left;
+	}
+
+	/**
+	 *
+	 * @return right of Section
+	 */
+	public int getRight() {
+		return right;
+	}
+
+	/**
+	 * Sets right of section
+	 *
+	 * @param right
+	 */
+	public void setRight(int right) {
+		this.right = right;
+	}
+
+	/**
+	 *
+	 * @return zero of Section
+	 */
+	public int getZero() {
+		return zero;
+	}
+
+	/**
+	 * Sets zero of section
+	 *
+	 * @param zero
+	 */
+	public void setZero(int zero) {
+		this.zero = zero;
+	}
+
+	/**
+	 *
+	 * @return size of Section
+	 */
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size of section
+	 *
+	 * @param size
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgObjectReader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgObjectReader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/IDwgObjectReader.java	(revision 435)
@@ -0,0 +1,77 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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.dwg.lib.readers;
+
+import org.gvsig.dwg.lib.CorruptedDwgEntityException;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * Each dwg entity in the dwg section OBJECTS has a common part
+ * and an specific part.
+ * This interface has the responsability of reading the specif part.
+ * 
+ * In previous versions of libDwg DwgObject has this responsability, but
+ * with the inclusion of new versions of DWG (12, 13, 14, 2004) implementation
+ * is function of the dwg entity and the version.
+ * 
+ * 
+ * 
+ * @author azabala
+
+ */
+public interface IDwgObjectReader {
+	
+	
+	/**
+	 * Reads the specific part of the dwg object
+	 * @throws Exception 
+	 * */
+	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException;
+	/**
+	 * Sets the fileReader (wich has the responsability of read
+	 * head and tail of a dwg object)
+	 * */
+	public void setFileReader(IDwgFileReader headTailReader);
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgObjectReaderPool.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgObjectReaderPool.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/DwgObjectReaderPool.java	(revision 435)
@@ -0,0 +1,369 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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.dwg.lib.readers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.objects.DwgArc;
+import org.gvsig.dwg.lib.objects.DwgAttdef;
+import org.gvsig.dwg.lib.objects.DwgAttrib;
+import org.gvsig.dwg.lib.objects.DwgBlock;
+import org.gvsig.dwg.lib.objects.DwgBlockControl;
+import org.gvsig.dwg.lib.objects.DwgBlockHeader;
+import org.gvsig.dwg.lib.objects.DwgCircle;
+import org.gvsig.dwg.lib.objects.DwgDictionary;
+import org.gvsig.dwg.lib.objects.DwgDictionaryVar;
+import org.gvsig.dwg.lib.objects.DwgDimOrd;
+import org.gvsig.dwg.lib.objects.DwgEllipse;
+import org.gvsig.dwg.lib.objects.DwgEndblk;
+import org.gvsig.dwg.lib.objects.DwgFace3D;
+import org.gvsig.dwg.lib.objects.DwgHatch;
+import org.gvsig.dwg.lib.objects.DwgIdBuffer;
+import org.gvsig.dwg.lib.objects.DwgImage;
+import org.gvsig.dwg.lib.objects.DwgImageDef;
+import org.gvsig.dwg.lib.objects.DwgImageDefReactor;
+import org.gvsig.dwg.lib.objects.DwgInsert;
+import org.gvsig.dwg.lib.objects.DwgLayer;
+import org.gvsig.dwg.lib.objects.DwgLayerControl;
+import org.gvsig.dwg.lib.objects.DwgLayerIndex;
+import org.gvsig.dwg.lib.objects.DwgLine;
+import org.gvsig.dwg.lib.objects.DwgLinearDimension;
+import org.gvsig.dwg.lib.objects.DwgLwPolyline;
+import org.gvsig.dwg.lib.objects.DwgMText;
+import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
+import org.gvsig.dwg.lib.objects.DwgMinsert;
+import org.gvsig.dwg.lib.objects.DwgOle2Frame;
+import org.gvsig.dwg.lib.objects.DwgPFacePolyline;
+import org.gvsig.dwg.lib.objects.DwgPoint;
+import org.gvsig.dwg.lib.objects.DwgPolyline2D;
+import org.gvsig.dwg.lib.objects.DwgPolyline3D;
+import org.gvsig.dwg.lib.objects.DwgRasterVariables;
+import org.gvsig.dwg.lib.objects.DwgSeqend;
+import org.gvsig.dwg.lib.objects.DwgSolid;
+import org.gvsig.dwg.lib.objects.DwgSortEntStable;
+import org.gvsig.dwg.lib.objects.DwgSpline;
+import org.gvsig.dwg.lib.objects.DwgText;
+import org.gvsig.dwg.lib.objects.DwgVertex2D;
+import org.gvsig.dwg.lib.objects.DwgVertex3D;
+import org.gvsig.dwg.lib.objects.DwgVertexMesh;
+import org.gvsig.dwg.lib.objects.DwgVertexPFace;
+import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
+import org.gvsig.dwg.lib.objects.DwgXRecord;
+import org.gvsig.dwg.lib.readers.v1314.DwgArcReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgAttdefReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgAttribReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgBlockControlReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgBlockHeaderReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgBlockReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgCircleReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgDictionaryReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgDictionaryVarReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgDimOrdReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgEllipseReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgEndBlkReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgFace3DReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgHatchReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgIdBufferReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgImageDefReactor1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgImageDefReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgImageReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgInsertReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLayerControlReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLayerIndexReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLayerReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLineReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLinearDimensionReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgLwPolylineReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgMTextReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgMeshReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgMinsertReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgOle2FrameReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgPFaceReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgPointReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgPolyline2DReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgPolyline3DReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgRasterVariablesReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgSeqEndReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgSolidReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgSortEntsTableReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgSplineReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgTextReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgVertex2DReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgVertex3DReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgVertexMeshReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgVertexPFaceFaceReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgVertexPFaceReader1314;
+import org.gvsig.dwg.lib.readers.v1314.DwgXrecordReader1314;
+import org.gvsig.dwg.lib.readers.v15.DwgArcReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgAttdefReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgAttribReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgBlockControlReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgBlockHeaderReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgBlockReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgCircleReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgDictionaryReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgEllipseReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgEndBlkReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgInsertReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgLayerControlReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgLayerReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgLineReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgLinearDimensionReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgLwPolylineReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgMTextReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgMeshReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgPFaceReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgPointReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgPolyline2DReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgPolyline3DReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgSeqEndReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgSolidReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgSplineReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgTextReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgVertex2DReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgVertex3DReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgVertexMeshReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgVertexPFaceFaceReader15;
+import org.gvsig.dwg.lib.readers.v15.DwgVertexPFaceReader15;
+import org.gvsig.dwg.lib.readers.v2004.DwgArcReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgAttdefReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgAttribReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgBlockControlReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgBlockHeaderReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgBlockReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgCircleReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgDictionaryReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgEllipseReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgEndBlkReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgInsertReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgLayerControlReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgLayerReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgLineReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgLinearDimensionReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgLwPolylineReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgMTextReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgMeshReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgPFaceReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgPointReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgPolyline2DReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgPolyline3DReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgSeqEndReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgSolidReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgSplineReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgTextReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgVertex2DReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgVertex3DReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgVertexMeshReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgVertexPFaceFaceReader2004;
+import org.gvsig.dwg.lib.readers.v2004.DwgVertexPFaceReader2004;
+
+/**
+ * @author azabala
+ */
+public class DwgObjectReaderPool {
+	
+	private static final DwgObjectReaderPool _instance = 
+		new DwgObjectReaderPool();
+	
+	private Map obj_readers;
+	
+	static{
+		
+//		READERS FOR DWG V2004
+		_instance.put(DwgArc.class, "2004", new DwgArcReader2004());
+		_instance.put(DwgAttdef.class, "2004", new DwgAttdefReader2004());
+		_instance.put(DwgAttrib.class, "2004", new DwgAttribReader2004());
+		_instance.put(DwgBlock.class, "2004", new DwgBlockReader2004());
+		_instance.put(DwgBlockControl.class, "2004", new DwgBlockControlReader2004());
+		_instance.put(DwgBlockHeader.class, "2004", new DwgBlockHeaderReader2004());
+		_instance.put(DwgCircle.class, "2004", new DwgCircleReader2004());
+		_instance.put(DwgEllipse.class, "2004", new DwgEllipseReader2004());
+		_instance.put(DwgEndblk.class, "2004", new DwgEndBlkReader2004());
+		_instance.put(DwgInsert.class, "2004", new DwgInsertReader2004());
+		_instance.put(DwgLayer.class, "2004", new DwgLayerReader2004());
+		_instance.put(DwgLayerControl.class, "2004", new DwgLayerControlReader2004());
+		_instance.put(DwgLine.class, "2004", new DwgLineReader2004());
+		_instance.put(DwgLinearDimension.class, "2004", new DwgLinearDimensionReader2004());
+		_instance.put(DwgLwPolyline.class, "2004", new DwgLwPolylineReader2004());
+		_instance.put(DwgMText.class, "2004", new DwgMTextReader2004());
+		_instance.put(DwgPoint.class, "2004", new DwgPointReader2004());
+		_instance.put(DwgPolyline2D.class, "2004", new DwgPolyline2DReader2004());
+		_instance.put(DwgPolyline3D.class, "2004", new DwgPolyline3DReader2004());
+		_instance.put(DwgSeqend.class, "2004", new DwgSeqEndReader2004());
+		_instance.put(DwgSpline.class, "2004", new DwgSplineReader2004());
+		_instance.put(DwgText.class, "2004", new DwgTextReader2004());
+		_instance.put(DwgVertex2D.class, "2004", new DwgVertex2DReader2004());
+		_instance.put(DwgVertex3D.class, "2004", new DwgVertex3DReader2004());
+		_instance.put(DwgDictionary.class, "2004", new DwgDictionaryReader2004());
+		_instance.put(DwgVertexPFace.class, "2004", new DwgVertexPFaceReader2004());
+		_instance.put(DwgVertexPFaceFace.class, "2004", new DwgVertexPFaceFaceReader2004());
+		_instance.put(DwgPFacePolyline.class, "2004", new DwgPFaceReader2004());
+		_instance.put(DwgMeshPolyline.class, "2004", new DwgMeshReader2004());
+		_instance.put(DwgVertexMesh.class, "2004", new DwgVertexMeshReader2004());
+		_instance.put(DwgSolid.class, "2004", new DwgSolidReader2004());
+
+		//READERS FOR DWG V15
+		_instance.put(DwgArc.class, "15", new DwgArcReader15());
+		_instance.put(DwgAttdef.class, "15", new DwgAttdefReader15());
+		_instance.put(DwgAttrib.class, "15", new DwgAttribReader15());
+		_instance.put(DwgBlock.class, "15", new DwgBlockReader15());
+		_instance.put(DwgBlockControl.class, "15", new DwgBlockControlReader15());
+		_instance.put(DwgBlockHeader.class, "15", new DwgBlockHeaderReader15());
+		_instance.put(DwgCircle.class, "15", new DwgCircleReader15());
+		_instance.put(DwgEllipse.class, "15", new DwgEllipseReader15());
+		_instance.put(DwgEndblk.class, "15", new DwgEndBlkReader15());
+		_instance.put(DwgInsert.class, "15", new DwgInsertReader15());
+		_instance.put(DwgLayer.class, "15", new DwgLayerReader15());
+		_instance.put(DwgLayerControl.class, "15", new DwgLayerControlReader15());
+		_instance.put(DwgLine.class, "15", new DwgLineReader15());
+		_instance.put(DwgLinearDimension.class, "15", new DwgLinearDimensionReader15());
+		_instance.put(DwgLwPolyline.class, "15", new DwgLwPolylineReader15());
+		_instance.put(DwgMText.class, "15", new DwgMTextReader15());
+		_instance.put(DwgPoint.class, "15", new DwgPointReader15());
+		_instance.put(DwgPolyline2D.class, "15", new DwgPolyline2DReader15());
+		_instance.put(DwgPolyline3D.class, "15", new DwgPolyline3DReader15());
+		_instance.put(DwgSeqend.class, "15", new DwgSeqEndReader15());
+//		_instance.put(DwgSolid.class, "15", new DwgSolidReader15());
+		_instance.put(DwgSpline.class, "15", new DwgSplineReader15());
+		_instance.put(DwgText.class, "15", new DwgTextReader15());
+		_instance.put(DwgVertex2D.class, "15", new DwgVertex2DReader15());
+		_instance.put(DwgVertex3D.class, "15", new DwgVertex3DReader15());
+		_instance.put(DwgDictionary.class, "15", new DwgDictionaryReader15());
+		_instance.put(DwgVertexPFace.class, "15", new DwgVertexPFaceReader15());
+		_instance.put(DwgVertexPFaceFace.class, "15", new DwgVertexPFaceFaceReader15());
+		_instance.put(DwgPFacePolyline.class, "15", new DwgPFaceReader15());
+		_instance.put(DwgMeshPolyline.class, "15", new DwgMeshReader15());
+		_instance.put(DwgVertexMesh.class, "15", new DwgVertexMeshReader15());
+
+		//READERS FOR DWG V13 AND V14
+		_instance.put(DwgArc.class, "1314", new DwgArcReader1314());
+		_instance.put(DwgAttdef.class, "1314", new DwgAttdefReader1314());
+		_instance.put(DwgAttrib.class, "1314", new DwgAttribReader1314());
+		_instance.put(DwgBlock.class, "1314", new DwgBlockReader1314());
+		_instance.put(DwgBlockControl.class, "1314", new DwgBlockControlReader1314());
+		_instance.put(DwgBlockHeader.class, "1314", new DwgBlockHeaderReader1314());
+		_instance.put(DwgCircle.class, "1314", new DwgCircleReader1314());
+		_instance.put(DwgDictionary.class, "1314", new DwgDictionaryReader1314());
+		_instance.put(DwgDictionaryVar.class, "1314", new DwgDictionaryVarReader1314());
+		_instance.put(DwgDimOrd.class, "1314", new DwgDimOrdReader1314());
+		_instance.put(DwgEllipse.class, "1314", new DwgEllipseReader1314());
+		_instance.put(DwgEndblk.class, "1314", new DwgEndBlkReader1314());
+		_instance.put(DwgFace3D.class, "1314", new DwgFace3DReader1314());
+		_instance.put(DwgHatch.class, "1314", new DwgHatchReader1314());
+		_instance.put(DwgIdBuffer.class, "1314", new DwgIdBufferReader1314());
+		_instance.put(DwgImageDefReactor.class, "1314", new DwgImageDefReactor1314());
+		_instance.put(DwgImageDef.class, "1314", new DwgImageDefReader1314());
+		_instance.put(DwgImage.class, "1314", new DwgImageReader1314());
+		_instance.put(DwgInsert.class, "1314", new DwgInsertReader1314());
+		_instance.put(DwgLayer.class, "1314", new DwgLayerReader1314());
+		_instance.put(DwgLayerControl.class, "1314", new DwgLayerControlReader1314());
+		_instance.put(DwgLayerIndex.class, "1314", new DwgLayerIndexReader1314());
+		_instance.put(DwgLine.class, "1314", new DwgLineReader1314());
+		_instance.put(DwgLinearDimension.class, "1314", new DwgLinearDimensionReader1314());
+		_instance.put(DwgLwPolyline.class, "1314", new DwgLwPolylineReader1314());
+		_instance.put(DwgMeshPolyline.class, "1314", new DwgMeshReader1314());
+		_instance.put(DwgMinsert.class, "1314", new DwgMinsertReader1314());
+		_instance.put(DwgMText.class, "1314", new DwgMTextReader1314());
+		_instance.put(DwgOle2Frame.class, "1314", new DwgOle2FrameReader1314());
+		_instance.put(DwgPFacePolyline.class, "1314", new DwgPFaceReader1314());
+		_instance.put(DwgPoint.class, "1314", new DwgPointReader1314());
+		_instance.put(DwgPolyline2D.class, "1314", new DwgPolyline2DReader1314());
+		_instance.put(DwgPolyline3D.class, "1314", new DwgPolyline3DReader1314());
+		_instance.put(DwgRasterVariables.class, "1314", new DwgRasterVariablesReader1314());
+		_instance.put(DwgSeqend.class, "1314", new DwgSeqEndReader1314());
+		_instance.put(DwgSortEntStable.class, "1314", new DwgSortEntsTableReader1314());
+//		_instance.put(DwgSolid.class, "1314", new DwgSolidReader1314());
+		_instance.put(DwgSpline.class, "1314", new DwgSplineReader1314());
+		_instance.put(DwgText.class, "1314", new DwgTextReader1314());
+		_instance.put(DwgVertex2D.class, "1314", new DwgVertex2DReader1314());
+		_instance.put(DwgVertex3D.class, "1314", new DwgVertex3DReader1314());
+		_instance.put(DwgXRecord.class, "1314", new DwgXrecordReader1314());
+		_instance.put(DwgDictionary.class, "1314", new DwgDictionaryReader1314());
+		_instance.put(DwgVertexPFace.class, "1314", new DwgVertexPFaceReader1314());
+		_instance.put(DwgVertexPFaceFace.class, "1314", new DwgVertexPFaceFaceReader1314());
+		_instance.put(DwgVertexMesh.class, "1314", new DwgVertexMeshReader1314());
+	
+	}
+	
+	
+	
+	public final static DwgObjectReaderPool getInstance(){
+		return _instance;
+	}
+	private DwgObjectReaderPool(){
+		obj_readers = new HashMap();
+	}
+	
+	/**Get the specific reader for an object
+	 * 
+	 * @param obj Object we want to read
+	 * @param dwgVersion version of dwg file
+	 * @return The specific reader
+	 */
+	public IDwgObjectReader get(DwgObject obj, String dwgVersion){
+		
+		IDwgObjectReader reader = (IDwgObjectReader) obj_readers.
+				get(obj.getClass().getName() + dwgVersion);
+//		if(reader == null)
+//			throw new RuntimeException("No se encuentra la clase para leer "+obj.getClass().getName());
+		return reader;
+		
+	}
+	
+	/**
+	 * Stores in a map the different readers for objects
+	 * @param dwgObjClass Object's class
+	 * @param dwgVersion version of dwg file
+	 * @param reader Specific reader for the object
+	 */
+	public void put(Class dwgObjClass, String dwgVersion, IDwgObjectReader reader){
+		if(DwgObject.class.isAssignableFrom(dwgObjClass))
+			obj_readers.put(dwgObjClass.getName()+ dwgVersion, reader);
+		else
+			throw new RuntimeException("Este pool solo admite como entrada clases de entidad de dibujo gr�fica");
+	}
+	
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg3DTestable.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg3DTestable.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg3DTestable.java	(revision 435)
@@ -0,0 +1,72 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwg3DTestable.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/01/18 13:35:22  azabala
+* Refactoring general para evitar dar tantas pasadas en la carga, y para incrementar
+* la legibilidad del codigo (demasiados if-else-if en vez de usar polimorfismo)
+*
+* Revision 1.1  2007/01/12 19:29:58  azabala
+* first version in cvs
+*
+*
+*/
+package org.gvsig.dwg.lib;
+/**
+ * All dwg drawing entities that could have 3D data
+ * must implement this interface, to test if they have
+ * certainly a third dimension
+ * 
+ * */
+public interface IDwg3DTestable {
+
+	public boolean has3DData();
+	public double getZ();
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlock.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlock.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlock.java	(revision 435)
@@ -0,0 +1,72 @@
+/*
+ * Created on 12-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwgBlock.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.1.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.1  2007/03/02 20:31:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+/**
+ * A block is a composite entity in autocad
+ * (it is a drawing entity, and it contains drawing entities)
+ * 
+ * Currently we have found DwgBlock and DwgBlockHeaders as
+ * start of a block. This interface is a common ancestor to both
+ * 
+ * @author azabala
+ */
+
+public interface IDwgBlock {
+	public void add(DwgObject object);
+	public DwgObject get(int i); 
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgPolyline.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgPolyline.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgPolyline.java	(revision 435)
@@ -0,0 +1,80 @@
+/*
+ * Created on 09-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: IDwgPolyline.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.3.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+* Revision 1.3  2007/01/30 12:37:18  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2007/01/18 13:35:22  azabala
+* Refactoring general para evitar dar tantas pasadas en la carga, y para incrementar
+* la legibilidad del codigo (demasiados if-else-if en vez de usar polimorfismo)
+*
+* Revision 1.1  2007/01/12 19:29:58  azabala
+* first version in cvs
+*
+*
+*/
+package org.gvsig.dwg.lib;
+
+
+/**
+ * If a DwgObject (dwg drawing entity) is a kind of polyline
+ * must implements this interface
+ * 
+ * TODO Ahora mismo pasamos dwgObjs. Cuando file tenga
+ * un Hashtable handle->dwgObject, no se pasar�
+ * */
+public interface IDwgPolyline {
+	public void calculateGisModel(DwgFile dwgFile);
+	public void addVertex(IDwgVertex vertex);
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass.java	(revision 435)
@@ -0,0 +1,171 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+/**
+ * Entry in the CLASSES section of a dwg file.
+ * @author azabala
+ */
+public class DwgClass {
+	
+	int classNum;
+    int version;
+    String appName;
+    String cPlusPlusName;
+    String dxfName;
+    boolean isZombie;
+    int id;
+    
+    
+    public DwgClass(int classNum, int version, String appName,
+    		String cPlusPlusName, String dxfName, boolean isZombie, int id){
+    	
+    	this.classNum = classNum;
+        this.version = version;
+        this.appName = appName;
+        this.cPlusPlusName = cPlusPlusName;
+        this.dxfName = dxfName;
+        this.isZombie = isZombie;
+        this.id = id;
+    }
+    
+    public String toString(){
+    	String solution = "";
+    	solution += "classNum ="+classNum;
+    	solution += ", version = "+version;
+    	solution += ", appName = "+appName;
+    	solution += ", c++Name = "+cPlusPlusName;
+    	solution += ", dxfName = "+dxfName;
+    	solution += ", isZombie = " + isZombie;
+    	solution += ", id = " + id;
+    	return solution;
+    }
+    
+    
+    
+    
+	/**
+	 * @return Returns the appName.
+	 */
+	public String getAppName() {
+		return appName;
+	}
+	/**
+	 * @param appName The appName to set.
+	 */
+	public void setAppName(String appName) {
+		this.appName = appName;
+	}
+	/**
+	 * @return Returns the classNum.
+	 */
+	public int getClassNum() {
+		return classNum;
+	}
+	/**
+	 * @param classNum The classNum to set.
+	 */
+	public void setClassNum(int classNum) {
+		this.classNum = classNum;
+	}
+	/**
+	 * @return Returns the cPlusPlusName.
+	 */
+	public String getCPlusPlusName() {
+		return cPlusPlusName;
+	}
+	/**
+	 * @param plusPlusName The cPlusPlusName to set.
+	 */
+	public void setCPlusPlusName(String plusPlusName) {
+		cPlusPlusName = plusPlusName;
+	}
+	/**
+	 * @return Returns the dxfName.
+	 */
+	public String getDxfName() {
+		return dxfName;
+	}
+	/**
+	 * @param dxfName The dxfName to set.
+	 */
+	public void setDxfName(String dxfName) {
+		this.dxfName = dxfName;
+	}
+	/**
+	 * @return Returns the id.
+	 */
+	public int getId() {
+		return id;
+	}
+	/**
+	 * @param id The id to set.
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+	/**
+	 * @return Returns the isZombie.
+	 */
+	public boolean isZombie() {
+		return isZombie;
+	}
+	/**
+	 * @param isZombie The isZombie to set.
+	 */
+	public void setZombie(boolean isZombie) {
+		this.isZombie = isZombie;
+	}
+	/**
+	 * @return Returns the version.
+	 */
+	public int getVersion() {
+		return version;
+	}
+	/**
+	 * @param version The version to set.
+	 */
+	public void setVersion(int version) {
+		this.version = version;
+	}
+   
+    
+    
+	
+	
+	
+	
+	
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObject.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObject.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObject.java	(revision 435)
@@ -0,0 +1,558 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.fmap.geom.Geometry;
+
+/**
+ * The DwgObject class represents a DWG object
+ * 
+ * @author jmorell
+ */
+public class DwgObject implements Cloneable{
+	protected int type;
+
+	protected DwgHandleReference handle;
+
+	protected String version;
+
+	protected int mode;
+
+	/**
+	 * code of the layer handle
+	 */
+	//protected int layerHandleCode;
+
+	/**
+	 * layer handle as an integer
+	 */
+	protected DwgHandleReference layerHandle;
+
+	protected int color;
+
+	protected int numReactors;
+
+	protected boolean noLinks;
+
+	protected int linetypeFlags;
+
+	protected int plotstyleFlags;
+
+	protected int sizeInBits;
+
+	protected List extendedData;
+
+	protected int graphicData;
+	
+	protected int address;
+
+	protected DwgHandleReference plotStyleHandle = null;
+
+	protected DwgHandleReference subEntityHandle = null;
+
+	protected DwgHandleReference xDicObjHandle = null;
+
+	protected boolean graphicsFlag;
+	protected boolean xDicObjFlag;
+	protected boolean avanzarFlag=false;
+	
+	/**
+	 * Index of the dwg object in the object's map section
+	 *  
+	 */
+	protected int index = 0;
+
+	/*
+	 * Previous and Next Handle (this stuff has allowed us to solve the problem
+	 * of layer handles
+	 */
+	private DwgHandleReference nextHandle = null;
+
+	private DwgHandleReference previousHandle = null;
+
+	//private ArrayList reactorsHandlesCodes = new ArrayList();
+
+	private ArrayList reactorsHandles = new ArrayList();
+
+	private boolean insertar = false;
+	
+	
+	public DwgObject(int index) {
+		this.index = index;
+	}
+	
+	public void inserta(){
+		this.insertar=true;
+	}
+	
+	public boolean insertar(){
+		return this.insertar;
+	}
+	
+	public void setAddress(int address){
+		this.address=address;
+	}
+	
+	public int getAddress(){
+		return this.address;
+	}
+
+	public void setNextHandle(DwgHandleReference hr) {
+		this.nextHandle = hr;
+
+	}
+
+	public void setPreviousHandle(DwgHandleReference hr) {
+		this.previousHandle = hr;
+	}
+
+	/* 
+	public void setReactorsHandles(ArrayList reactorsHandles) {
+		this.reactorsHandlesCodes=reactorsHandles;
+	}
+	*/
+	
+	
+	public void setAvanzar(boolean avanza){
+		this.avanzarFlag=avanza;
+	}
+	public boolean getAvanzar(){
+		return this.avanzarFlag;
+	}
+	
+	
+	
+	
+
+	public void addReactorHandle(DwgHandleReference hr) {
+		if (this.reactorsHandles == null){
+			this.reactorsHandles = new ArrayList();
+		}
+		this.reactorsHandles.add(hr);
+	}
+
+
+	public DwgHandleReference getNextHandle() {
+		return this.nextHandle;
+
+	}
+
+	public DwgHandleReference getPreviousHandle() {
+		return this.previousHandle;
+	}
+
+	public ArrayList getReactorsHandles() {
+		return this.reactorsHandles;
+	}
+
+	//TODO Todo esto no vale si handle puede tomar valor -1
+	public boolean hasLayerHandle() {
+		return this.layerHandle != null;
+	}
+	public boolean hasNextHandle() {
+		return this.nextHandle != null;
+	}
+
+	public boolean hasPreviousHandle() {
+		return this.previousHandle != null;
+	}
+
+	public boolean hasSubEntityHandle(){
+		return this.subEntityHandle != null;
+	}
+
+	public boolean hasXDicObjHandle(){
+		return this.xDicObjHandle != null;
+	}
+
+	public boolean hasReactorsHandles(){
+		return this.reactorsHandles.size() != 0;
+	}
+
+	public int reactorsHandlesQuantity(){
+		return this.reactorsHandles.size();
+	}
+
+	public int getIndex() {
+		return index;
+	}
+
+	/**
+	 * @return Returns the sizeInBits.
+	 */
+	public int getSizeInBits() {
+		return sizeInBits;
+	}
+
+	/**
+	 * @param sizeInBits
+	 *            The sizeInBits to set.
+	 */
+	public void setSizeInBits(int sizeInBits) {
+		this.sizeInBits = sizeInBits;
+	}
+
+	/**
+	 * @return Returns the extendedData.
+	 */
+	public List getExtendedData() {
+		return extendedData;
+	}
+
+	/**
+	 * @param extData
+	 *            The extendedData to set.
+	 */
+	public void setExtendedData(List extData) {
+		this.extendedData = extData;
+	}
+
+	/**
+	 * @return Returns the graphicData.
+	 */
+	public int getGraphicData() {
+		return graphicData;
+	}
+
+	/**
+	 * @param graphicData
+	 *            The graphicData to set.
+	 */
+	public void setGraphicData(int graphicData) {
+		this.graphicData = graphicData;
+	}
+
+	/**
+	 * @return Returns the version.
+	 */
+	public String getVersion() {
+		return version;
+	}
+
+	/**
+	 * @param linetypeFlags
+	 *            The linetypeFlags to set.
+	 */
+	public void setLinetypeFlags(int linetypeFlags) {
+		this.linetypeFlags = linetypeFlags;
+	}
+
+	/**
+	 * @param plotstyleFlags
+	 *            The plotstyleFlags to set.
+	 */
+	public void setPlotstyleFlags(int plotstyleFlags) {
+		this.plotstyleFlags = plotstyleFlags;
+	}
+
+	/**
+	 * @return Returns the subEntityHandle.
+	 */
+	public DwgHandleReference getSubEntityHandle() {
+		return subEntityHandle;
+	}
+
+	/**
+	 * @param subEntityHandle
+	 *            The subEntityHandle to set.
+	 */
+	public void setSubEntityHandle(DwgHandleReference subEntityHandle) {
+		this.subEntityHandle = subEntityHandle;
+	}
+
+	/**
+	 * @return Returns the xDicObjHandle.
+	 */
+	public DwgHandleReference getXDicObjHandle() {
+		return xDicObjHandle;
+	}
+
+	/**
+	 * @param dicObjHandle
+	 *            The xDicObjHandle to set.
+	 */
+	public void setXDicObjHandle(DwgHandleReference dicObjHandle) {
+		xDicObjHandle = dicObjHandle;
+	}
+
+	/**
+	 * @return Returns the color.
+	 */
+	public int getColor() {
+		return color;
+	}
+
+	/**
+	 * @param color
+	 *            The color to set.
+	 */
+	public void setColor(int color) {
+		this.color = color;
+	}
+
+	/**
+	 * @return Returns the handle.
+	 */
+	public DwgHandleReference getHandle() {
+		return handle;
+	}
+
+	/**
+	 * @param handle
+	 *            The handle to set.
+	 */
+	public void setHandle(DwgHandleReference handle) {
+		this.handle = handle;
+	}
+
+	/**
+	 * @return Returns the layerHandle.
+	 */
+	public DwgHandleReference getLayerHandle() {
+		return layerHandle;
+	}
+
+	/**
+	 * @param layerHandle
+	 *            The layerHandle to set.
+	 */
+	public void setLayerHandle(DwgHandleReference layerHandle) {
+		this.layerHandle = layerHandle;
+	}
+
+	/**
+	 * @return Returns the mode.
+	 */
+	public int getMode() {
+		return mode;
+	}
+
+	/**
+	 * @param mode
+	 *            The mode to set.
+	 */
+	public void setMode(int mode) {
+		this.mode = mode;
+	}
+
+	/**
+	 * @return Returns the noLinks.
+	 */
+	public boolean isNoLinks() {
+		return noLinks;
+	}
+
+	/**
+	 * @param noLinks
+	 *            The noLinks to set.
+	 */
+	public void setNoLinks(boolean noLinks) {
+		this.noLinks = noLinks;
+	}
+
+	/**
+	 * @return Returns the numReactors.
+	 */
+	public int getNumReactors() {
+		return numReactors;
+	}
+
+	/**
+	 * @param numReactors
+	 *            The numReactors to set.
+	 */
+	public void setNumReactors(int numReactors) {
+		this.numReactors = numReactors;
+	}
+
+	/**
+	 * @return Returns the type.
+	 */
+	public int getType() {
+		return type;
+	}
+
+	/**
+	 * @param type
+	 *            The type to set.
+	 */
+	public void setType(int type) {
+		this.type = type;
+	}
+
+	/**
+	 * @return Returns the linetypeFlags.
+	 */
+	public int getLinetypeFlags() {
+		return linetypeFlags;
+	}
+
+	/**
+	 * @return Returns the plotstyleFlags.
+	 */
+	public int getPlotstyleFlags() {
+		return plotstyleFlags;
+	}
+
+	/**
+	 * @param version
+	 *            The version to set.
+	 */
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	/**
+	 * @return Returns the graphicsFlag.
+	 */
+	public boolean isGraphicsFlag() {
+		return graphicsFlag;
+	}
+
+	/**
+	 * @param graphicsFlag
+	 *            The graphicsFlag to set.
+	 */
+	public void setGraphicsFlag(boolean graphicsFlag) {
+		this.graphicsFlag = graphicsFlag;
+	}
+	
+	
+	/**
+	 * @return Returns the xDicObjFlag.
+	 */
+	public boolean isXDicObjFlag() {
+		return xDicObjFlag;
+	}
+
+	/**
+	 * @param xDicObjFlag
+	 *            The xDicObjFlag to set.
+	 */
+	public void setXDicObjFlag(boolean xDicObjFlag) {
+		this.xDicObjFlag = xDicObjFlag;
+	}
+
+	/*
+	 * This property exists in 13-14 versions, but not in 2000 version
+	 */
+	private boolean lyrByLineType = false;
+
+	public void setLyrByLineType(boolean lyrByLineType) {
+		this.lyrByLineType = lyrByLineType;
+	}
+
+	public boolean isLyrByLineType() {
+		return lyrByLineType;
+	}
+
+	public void setPlotStyleHandle(DwgHandleReference hr) {
+		this.plotStyleHandle = hr;
+
+	}
+	
+	public boolean hasPlotStyleHandle() {
+		return this.plotStyleHandle != null;
+	}
+
+	/*
+	 * Esto solo se usa para la version 13-14
+	 */
+	private DwgHandleReference lineTypeHandle = null;
+
+	/**
+	 * Sets the handle of the line type of this drawing entity.
+	 * 
+	 * TODO Ver si conviene guardar tambien el handleCode de este handle
+	 * 
+	 * @param handle2
+	 */
+	public void setLineTypeHandle(DwgHandleReference hr) {
+		this.lineTypeHandle = hr;
+
+	}
+
+	public DwgHandleReference getLineTypeHandle() {
+		return this.lineTypeHandle;
+	}
+	
+	public boolean hasLineTypeHandle() {
+		return this.lineTypeHandle != null;
+	}
+
+	
+	public Object clone(){
+		DwgObject obj = new DwgObject(this.index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+
+		obj.setColor(color);
+		obj.setExtendedData(extendedData);
+		obj.setGraphicData(graphicData);
+		obj.setGraphicsFlag(graphicsFlag);
+		obj.setHandle(handle);
+		obj.setLayerHandle(layerHandle);
+		obj.setLinetypeFlags(linetypeFlags);
+		obj.setLineTypeHandle(lineTypeHandle);
+		obj.setLyrByLineType(lyrByLineType);
+		obj.setMode(mode);
+		obj.setNextHandle(nextHandle);
+		obj.setNoLinks(noLinks);
+		obj.setNumReactors(numReactors);
+		obj.setPlotstyleFlags(plotstyleFlags);
+		obj.setPlotStyleHandle(plotStyleHandle);
+		obj.setPreviousHandle(previousHandle);
+		obj.setSizeInBits(sizeInBits);
+		obj.setSubEntityHandle(subEntityHandle);
+		obj.setType(type);
+		obj.setVersion(version);
+		obj.setXDicObjHandle(xDicObjHandle);
+	}
+	
+   public int getGeometrySubType(boolean is3DFile) {
+        if (is3DFile) {
+            return Geometry.SUBTYPES.GEOM3D;
+        } else {
+            return Geometry.SUBTYPES.GEOM2D;
+        }
+    }
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMinsert.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMinsert.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMinsert.java	(revision 435)
@@ -0,0 +1,163 @@
+/*
+ * Created on 02-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMinsert.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgMinsert extends DwgObject {
+
+	private double[] insertionPoint;
+	private double[] scale;
+	private double rotation;
+	private double[] extrusion;
+	private DwgHandleReference blockHeaderHandle;
+	private DwgHandleReference firstAttribHandle;
+	private DwgHandleReference lastAttribHandle;
+	private DwgHandleReference seqEndHandle;
+
+	public DwgMinsert(int index) {
+		super(index);
+	}
+
+	public void setInsertionPoint(double[] ds) {
+		this.insertionPoint = ds;
+	}
+
+	public void setScale(double[] ds) {
+		this.scale = ds;
+	}
+
+	public void setRotation(double rotation) {
+		this.rotation = rotation;
+	}
+
+	public void setExtrusion(double[] ds) {
+		this.extrusion = ds;
+	}
+
+	public void setBlockHeaderHandle(DwgHandleReference handle) {
+		this.blockHeaderHandle = handle;
+	}
+
+	public void setFirstAttribHandle(DwgHandleReference handle) {
+		this.firstAttribHandle = handle;
+	}
+
+	public void setLastAttribHandle(DwgHandleReference handle) {
+		this.lastAttribHandle = handle;
+	}
+
+	public DwgHandleReference getSeqEndHandle() {
+		return seqEndHandle;
+	}
+
+	public void setSeqEndHandle(DwgHandleReference seqEndHandle) {
+		this.seqEndHandle = seqEndHandle;
+	}
+
+	public DwgHandleReference getBlockHeaderHandle() {
+		return blockHeaderHandle;
+	}
+
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+
+	public DwgHandleReference getFirstAttribHandle() {
+		return firstAttribHandle;
+	}
+
+	public double[] getInsertionPoint() {
+		return insertionPoint;
+	}
+
+	public DwgHandleReference getLastAttribHandle() {
+		return lastAttribHandle;
+	}
+
+	public double getRotation() {
+		return rotation;
+	}
+
+	public double[] getScale() {
+		return scale;
+	}
+	public Object clone(){
+		DwgMinsert obj = new DwgMinsert(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgMinsert myObj = (DwgMinsert)obj;
+
+		myObj.setBlockHeaderHandle(blockHeaderHandle);
+		myObj.setExtrusion(extrusion);
+		myObj.setFirstAttribHandle(firstAttribHandle);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setLastAttribHandle(lastAttribHandle);
+		myObj.setRotation(rotation);
+		myObj.setScale(scale);
+		myObj.setSeqEndHandle(seqEndHandle);
+	}
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDefReactor.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDefReactor.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDefReactor.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImageDefReactor extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgImageDefReactor(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgImageDefReactor obj = new DwgImageDefReactor(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgImageDefReactor myObj = (DwgImageDefReactor)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttrib.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttrib.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttrib.java	(revision 435)
@@ -0,0 +1,373 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+
+
+/**
+ * The DwgAttrib class represents a DWG Attrib
+ * 
+ * @author jmorell
+ */
+public class DwgAttrib extends DwgObject 
+implements IDwgExtrusionable, IDwg3DTestable{
+	public DwgAttrib(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private int dataFlag;
+	private double elevation;
+	private Point2D insertionPoint;
+	private Point2D alignmentPoint;
+	private double[] extrusion;
+	private double thickness;
+	private double obliqueAngle;
+	private double rotationAngle;
+	private double height;
+	private double widthFactor;
+	private String text;
+	private int generation;
+	private int halign;
+	private int valign;
+	private String tag;
+	private int fieldLength;
+	private int flags;
+	private String prompt;
+	private DwgHandleReference styleHandle = null;
+	
+	
+    /**
+     * @return Returns the elevation.
+     */
+    public double getElevation() {
+        return elevation;
+    }
+    /**
+     * @param elevation The elevation to set.
+     */
+    public void setElevation(double elevation) {
+        this.elevation = elevation;
+    }
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+    /**
+     * @return Returns the insertionPoint.
+     */
+    public Point2D getInsertionPoint() {
+        return insertionPoint;
+    }
+    /**
+     * @param insertionPoint The insertionPoint to set.
+     */
+    public void setInsertionPoint(Point2D insertionPoint) {
+        this.insertionPoint = insertionPoint;
+    }
+
+	/**
+	 * @return Returns the alignmentPoint.
+	 */
+	public Point2D getAlignmentPoint() {
+		return alignmentPoint;
+	}
+	/**
+	 * @param alignmentPoint The alignmentPoint to set.
+	 */
+	public void setAlignmentPoint(Point2D alignmentPoint) {
+		this.alignmentPoint = alignmentPoint;
+	}
+	/**
+	 * @return Returns the dataFlag.
+	 */
+	public int getDataFlag() {
+		return dataFlag;
+	}
+	/**
+	 * @param dataFlag The dataFlag to set.
+	 */
+	public void setDataFlag(int dataFlag) {
+		this.dataFlag = dataFlag;
+	}
+	/**
+	 * @return Returns the fieldLength.
+	 */
+	public int getFieldLength() {
+		return fieldLength;
+	}
+	/**
+	 * @param fieldLength The fieldLength to set.
+	 */
+	public void setFieldLength(int fieldLength) {
+		this.fieldLength = fieldLength;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the generation.
+	 */
+	public int getGeneration() {
+		return generation;
+	}
+	/**
+	 * @param generation The generation to set.
+	 */
+	public void setGeneration(int generation) {
+		this.generation = generation;
+	}
+	/**
+	 * @return Returns the halign.
+	 */
+	public int getHalign() {
+		return halign;
+	}
+	/**
+	 * @param halign The halign to set.
+	 */
+	public void setHalign(int halign) {
+		this.halign = halign;
+	}
+	/**
+	 * @return Returns the height.
+	 */
+	public double getHeight() {
+		return height;
+	}
+	/**
+	 * @param height The height to set.
+	 */
+	public void setHeight(double height) {
+		this.height = height;
+	}
+	/**
+	 * @return Returns the obliqueAngle.
+	 */
+	public double getObliqueAngle() {
+		return obliqueAngle;
+	}
+	/**
+	 * @param obliqueAngle The obliqueAngle to set.
+	 */
+	public void setObliqueAngle(double obliqueAngle) {
+		this.obliqueAngle = obliqueAngle;
+	}
+	/**
+	 * @return Returns the prompt.
+	 */
+	public String getPrompt() {
+		return prompt;
+	}
+	/**
+	 * @param prompt The prompt to set.
+	 */
+	public void setPrompt(String prompt) {
+		this.prompt = prompt;
+	}
+	/**
+	 * @return Returns the rotationAngle.
+	 */
+	public double getRotationAngle() {
+		return rotationAngle;
+	}
+	/**
+	 * @param rotationAngle The rotationAngle to set.
+	 */
+	public void setRotationAngle(double rotationAngle) {
+		this.rotationAngle = rotationAngle;
+	}
+	/**
+	 * @return Returns the styleHandle.
+	 */
+	public DwgHandleReference getStyleHandle() {
+		return styleHandle;
+	}
+	/**
+	 * @param styleHandle The styleHandle to set.
+	 */
+	public void setStyleHandle(DwgHandleReference styleHandle) {
+		this.styleHandle = styleHandle;
+	}
+	/**
+	 * @return Returns the tag.
+	 */
+	public String getTag() {
+		return tag;
+	}
+	/**
+	 * @param tag The tag to set.
+	 */
+	public void setTag(String tag) {
+		this.tag = tag;
+	}
+	/**
+	 * @return Returns the text.
+	 */
+	public String getText() {
+		return text;
+	}
+	/**
+	 * @param text The text to set.
+	 */
+	public void setText(String text) {
+		this.text = text;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @return Returns the valign.
+	 */
+	public int getValign() {
+		return valign;
+	}
+	/**
+	 * @param valign The valign to set.
+	 */
+	public void setValign(int valign) {
+		this.valign = valign;
+	}
+	/**
+	 * @return Returns the widthFactor.
+	 */
+	public double getWidthFactor() {
+		return widthFactor;
+	}
+	/**
+	 * @param widthFactor The widthFactor to set.
+	 */
+	public void setWidthFactor(double widthFactor) {
+		this.widthFactor = widthFactor;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		  Point2D attribInsertionPoint = getInsertionPoint();
+		  if(attribInsertionPoint == null){
+			  System.out.println("ATTRIB sin insertion point");
+			  return;
+		  }
+          double attribElevation = getElevation();
+          double[] attribInsertionPoint3D = new double[]{
+          		attribInsertionPoint.getX(), 
+				attribInsertionPoint.getY(), 
+				attribElevation};
+          double[] attribExt = getExtrusion();
+          attribInsertionPoint3D = AcadExtrusionCalculator.
+		  	extrude2(attribInsertionPoint3D, attribExt);
+          setInsertionPoint(new Point2D.Double(attribInsertionPoint3D[0], 
+          									attribInsertionPoint3D[1]));
+         setElevation(attribInsertionPoint3D[2]);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getElevation() != 0.0);
+	}
+	public double getZ() {
+		return getElevation();
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+public Object clone(){
+		DwgAttrib obj = new DwgAttrib(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgAttrib myObj = (DwgAttrib)obj;
+
+		myObj.setAlignmentPoint(alignmentPoint);
+		myObj.setDataFlag(dataFlag);
+		myObj.setElevation(elevation);
+		myObj.setExtrusion(extrusion);
+		myObj.setFieldLength(fieldLength);
+		myObj.setFlags(flags);
+		myObj.setGeneration(generation);
+		myObj.setHalign(halign);
+		myObj.setHeight(height);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setObliqueAngle(obliqueAngle);
+		myObj.setPrompt(prompt);
+		myObj.setRotationAngle(rotationAngle);
+		myObj.setStyleHandle(styleHandle);
+		myObj.setTag(tag);
+		myObj.setText(text);
+		myObj.setThickness(thickness);
+		myObj.setValign(valign);
+		myObj.setWidthFactor(widthFactor);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgFace3D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgFace3D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgFace3D.java	(revision 435)
@@ -0,0 +1,135 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgFace3D.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgFace3D extends DwgObject {
+
+	private double[] corner1;
+	private double[] corner2;
+	private double[] corner3;
+	private double[] corner4;
+	private int flags;
+
+	public DwgFace3D(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setCorner1(double[] ds) {
+		this.corner1 = ds;
+	}
+
+	public void setCorner2(double[] ds) {
+		this.corner2 = ds;
+	}
+
+	public void setCorner3(double[] ds) {
+		this.corner3 = ds;
+	}
+
+	public void setCorner4(double[] ds) {
+		this.corner4 = ds;
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	public double[] getCorner1() {
+		return corner1;
+	}
+
+	public double[] getCorner2() {
+		return corner2;
+	}
+
+	public double[] getCorner3() {
+		return corner3;
+	}
+
+	public double[] getCorner4() {
+		return corner4;
+	}
+
+	public int getFlags() {
+		return flags;
+	}
+
+	public Object clone(){
+		DwgFace3D obj = new DwgFace3D(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgFace3D obj){
+		super.fill(obj);
+		DwgFace3D myObj = (DwgFace3D)obj;
+
+		myObj.setCorner1(corner1);
+		myObj.setCorner2(corner2);
+		myObj.setCorner3(corner3);
+		myObj.setCorner4(corner4);
+		myObj.setFlags(flags);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgIdBuffer.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgIdBuffer.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgIdBuffer.java	(revision 435)
@@ -0,0 +1,65 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgIdBuffer extends DwgObject {
+
+	private DwgHandleReference parentHandle;
+	private List handles;
+
+	/**
+	 * @param index
+	 */
+	public DwgIdBuffer(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setParentHandle(DwgHandleReference handle) {
+		this.parentHandle = handle;
+	}
+
+	public void setObjidHandles(List handles) {
+		this.handles = handles;
+	}
+
+	public List getHandles() {
+		return handles;
+	}
+
+	public void setHandles(List handles) {
+		this.handles = handles;
+	}
+
+	public DwgHandleReference getParentHandle() {
+		return parentHandle;
+	}
+	public Object clone(){
+		DwgIdBuffer obj = new DwgIdBuffer(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgIdBuffer myObj = (DwgIdBuffer)obj;
+
+		myObj.setHandles(handles);
+		myObj.setParentHandle(parentHandle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgHatch.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgHatch.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgHatch.java	(revision 435)
@@ -0,0 +1,209 @@
+/*
+ * Created on 30-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgHatch.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.4.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.3  2007/02/02 12:39:52  azabala
+* Added new dwg entities
+*
+* Revision 1.2  2007/02/01 20:00:27  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2007/01/30 19:40:23  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+public class DwgHatch extends DwgObject {
+
+	private double z;
+	private double[] extrusion;
+	private String name;
+	private boolean solidFill;
+	private boolean associative;
+	private Map paths;
+	private int style;
+	private int patternType;
+	private double fillAngle;
+	private double fillScaleOrSpace;
+	private boolean fileDoubleHath;
+	private ArrayList[] lines;
+	private double pixelSize;
+	private double[][] seedPoints;
+	private DwgHandleReference[] handles;
+
+	public DwgHatch(int index) {
+		super(index);
+	}
+
+	public void setZ(double coord) {
+		this.z = coord;
+	}
+
+	public void setExtrusion(double[] ds) {
+		this.extrusion = ds;
+	}
+
+	public void setName(String txt) {
+		this.name = txt;
+	}
+
+	public void setSolidFill(boolean solidFill) {
+		this.solidFill = solidFill;
+	}
+
+	public void setAssociative(boolean associative) {
+		this.associative = associative;
+	}
+
+	public void setPaths(Map paths) {
+		this.paths = paths;
+	}
+
+	public void setStyle(int style) {
+		this.style = style;
+	}
+
+	/**
+	 * @param patternType
+	 */
+	public void setPatterType(int patternType) {
+		this.patternType = patternType;
+	}
+
+	/**
+	 * @param fillAngle
+	 */
+	public void setFillAngle(double fillAngle) {
+		this.fillAngle = fillAngle;
+	}
+
+	/**
+	 * @param fillScaleOrSpacion
+	 */
+	public void setFillScale(double fillScaleOrSpacion) {
+		this.fillScaleOrSpace = fillScaleOrSpacion;
+	}
+
+	/**
+	 * @param fileDoubleHath
+	 */
+	public void setFileDoubleHath(boolean fileDoubleHath) {
+		this.fileDoubleHath = fileDoubleHath;
+	}
+
+	/**
+	 * @param lines
+	 */
+	public void setFillLines(ArrayList[] lines) {
+		this.lines = lines;
+	}
+
+	/**
+	 * @param pixelSize
+	 */
+	public void setPixelSize(double pixelSize) {
+		this.pixelSize = pixelSize;
+	}
+
+	/**
+	 * @param seedPoints
+	 */
+	public void setSeedPoints(double[][] seedPoints) {
+		this.seedPoints = seedPoints;
+	}
+
+	/**
+	 * @param handles
+	 */
+	public void setBoundaryHandles(DwgHandleReference[] handles) {
+		this.handles = handles;
+	}
+
+	public Object clone(){
+		DwgHatch obj = new DwgHatch(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgHatch myObj = (DwgHatch)obj;
+
+		myObj.setAssociative(associative);
+		myObj.setBoundaryHandles(handles);
+		myObj.setExtrusion(extrusion);
+		myObj.setFileDoubleHath(fileDoubleHath);
+		myObj.setFillAngle(fillAngle);
+		myObj.setFillLines(lines);
+		myObj.setFillScale(fillScaleOrSpace);
+		myObj.setName(name);
+		myObj.setPaths(paths);
+		myObj.setPatterType(patternType);
+		myObj.setPixelSize(pixelSize);
+		myObj.setSeedPoints(seedPoints);
+		myObj.setSolidFill(solidFill);
+		myObj.setStyle(style);
+		myObj.setZ(z);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPoint.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPoint.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPoint.java	(revision 435)
@@ -0,0 +1,178 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+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.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgPoint class represents a DWG Point
+ *
+ * @author jmorell
+ */
+public class DwgPoint extends DwgObject
+		implements/* IDwgExtrusionable,*/ IDwg3DTestable, IDwg2FMap{
+	public DwgPoint(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private double[] point;
+	private double thickness;
+	private double[] extrusion;
+	private double xAxisAngle;
+
+	/**
+	 * @return Returns the point.
+	 */
+	public double[] getPoint() {
+		return point;
+	}
+	/**
+	 * @param point The point to set.
+	 */
+	public void setPoint(double[] point) {
+		this.point = point;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @return Returns the xAxisAngle.
+	 */
+	public double getXAxisAngle() {
+		return xAxisAngle;
+	}
+	/**
+	 * @param axisAngle The xAxisAngle to set.
+	 */
+	public void setXAxisAngle(double axisAngle) {
+		xAxisAngle = axisAngle;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] point = getPoint();
+         double[] pointExt = getExtrusion();
+         point = AcadExtrusionCalculator.extrude2(point, pointExt);
+         setPoint(point);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return getPoint()[2] != 0.0;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		return getPoint()[2];
+	}
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		double[] p = getPoint();
+		Point point = (Point) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		point.setCoordinates(p);
+		return point;
+	}
+
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPoint3D";
+		} else {
+			return "FPoint2D";
+		}
+	}
+
+	public String toString(){
+		return "Point";
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgPoint obj = new DwgPoint(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgPoint myObj = (DwgPoint)obj;
+
+		myObj.setExtrusion(extrusion);
+		myObj.setPoint(point);
+		myObj.setThickness(thickness);
+		myObj.setXAxisAngle(xAxisAngle);
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.POINT;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpline.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpline.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpline.java	(revision 435)
@@ -0,0 +1,333 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+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.fmap.geom.primitive.Point;
+import org.gvsig.fmap.geom.primitive.Spline;
+
+
+/**
+ * The DwgSpline class represents a DWG Spline
+ *
+ * @author jmorell
+ */
+public class DwgSpline extends DwgObject
+	implements IDwg3DTestable,  IDwg2FMap {
+
+	public DwgSpline(int index) {
+		super(index);
+	}
+	private int scenario;
+	private int degree;
+	private double fitTolerance;
+	private double[] beginTanVector;
+	private double[] endTanVector;
+	private boolean rational;
+	private boolean closed;
+	private boolean periodic;
+	private double knotTolerance;
+	private double controlTolerance;
+	private double[] knotPoints;
+	private double[][] controlPoints;
+	private double[] weights;
+	private double[][] fitPoints;
+
+	/**
+	 * @return Returns the closed.
+	 */
+	public boolean isClosed() {
+		return closed;
+	}
+	/**
+	 * @param closed The closed to set.
+	 */
+	public void setClosed(boolean closed) {
+		this.closed = closed;
+	}
+	/**
+	 * @return Returns the controlPoints.
+	 */
+	public double[][] getControlPoints() {
+		return controlPoints;
+	}
+	/**
+	 * @param controlPoints The controlPoints to set.
+	 */
+	public void setControlPoints(double[][] controlPoints) {
+		this.controlPoints = controlPoints;
+	}
+	/**
+	 * @return Returns the fitPoints.
+	 */
+	public double[][] getFitPoints() {
+		return fitPoints;
+	}
+	/**
+	 * @param fitPoints The fitPoints to set.
+	 */
+	public void setFitPoints(double[][] fitPoints) {
+		this.fitPoints = fitPoints;
+	}
+	/**
+	 * @return Returns the knotPoints.
+	 */
+	public double[] getKnotPoints() {
+		return knotPoints;
+	}
+	/**
+	 * @param knotPoints The knotPoints to set.
+	 */
+	public void setKnotPoints(double[] knotPoints) {
+		this.knotPoints = knotPoints;
+	}
+	/**
+	 * @return Returns the scenario.
+	 */
+	public int getScenario() {
+		return scenario;
+	}
+	/**
+	 * @param scenario The scenario to set.
+	 */
+	public void setScenario(int scenario) {
+		this.scenario = scenario;
+	}
+
+	/**
+	 * @return Returns the beginTanVector.
+	 */
+	public double[] getBeginTanVector() {
+		return beginTanVector;
+	}
+	/**
+	 * @param beginTanVector The beginTanVector to set.
+	 */
+	public void setBeginTanVector(double[] beginTanVector) {
+		this.beginTanVector = beginTanVector;
+	}
+	/**
+	 * @return Returns the controlTolerance.
+	 */
+	public double getControlTolerance() {
+		return controlTolerance;
+	}
+	/**
+	 * @param controlTolerance The controlTolerance to set.
+	 */
+	public void setControlTolerance(double controlTolerance) {
+		this.controlTolerance = controlTolerance;
+	}
+	/**
+	 * @return Returns the degree.
+	 */
+	public int getDegree() {
+		return degree;
+	}
+	/**
+	 * @param degree The degree to set.
+	 */
+	public void setDegree(int degree) {
+		this.degree = degree;
+	}
+	/**
+	 * @return Returns the endTanVector.
+	 */
+	public double[] getEndTanVector() {
+		return endTanVector;
+	}
+	/**
+	 * @param endTanVector The endTanVector to set.
+	 */
+	public void setEndTanVector(double[] endTanVector) {
+		this.endTanVector = endTanVector;
+	}
+	/**
+	 * @return Returns the fitTolerance.
+	 */
+	public double getFitTolerance() {
+		return fitTolerance;
+	}
+	/**
+	 * @param fitTolerance The fitTolerance to set.
+	 */
+	public void setFitTolerance(double fitTolerance) {
+		this.fitTolerance = fitTolerance;
+	}
+	/**
+	 * @return Returns the knotTolerance.
+	 */
+	public double getKnotTolerance() {
+		return knotTolerance;
+	}
+	/**
+	 * @param knotTolerance The knotTolerance to set.
+	 */
+	public void setKnotTolerance(double knotTolerance) {
+		this.knotTolerance = knotTolerance;
+	}
+	/**
+	 * @return Returns the periodic.
+	 */
+	public boolean isPeriodic() {
+		return periodic;
+	}
+	/**
+	 * @param periodic The periodic to set.
+	 */
+	public void setPeriodic(boolean periodic) {
+		this.periodic = periodic;
+	}
+	/**
+	 * @return Returns the rational.
+	 */
+	public boolean isRational() {
+		return rational;
+	}
+	/**
+	 * @param rational The rational to set.
+	 */
+	public void setRational(boolean rational) {
+		this.rational = rational;
+	}
+	/**
+	 * @return Returns the weights.
+	 */
+	public double[] getWeights() {
+		return weights;
+	}
+	/**
+	 * @param weights The weights to set.
+	 */
+	public void setWeights(double[] weights) {
+		this.weights = weights;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		double[][] pts = getControlPoints();
+		if(pts == null) {
+			return false;
+		}
+		double z = 0d;
+		for (int j=0;j<pts.length;j++) {
+				z = pts[j][2];
+				if (z != 0.0) {
+					return true;
+				}
+		}//for
+		return false;
+	}
+	public double getZ() {
+		return 0d;
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgSpline obj = new DwgSpline(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgSpline myObj = (DwgSpline)obj;
+
+		myObj.setBeginTanVector(beginTanVector);
+		myObj.setClosed(closed);
+		myObj.setControlPoints(controlPoints);
+		myObj.setControlTolerance(controlTolerance);
+		myObj.setDegree(degree);
+		myObj.setEndTanVector(endTanVector);
+		myObj.setFitPoints(fitPoints);
+		myObj.setFitTolerance(fitTolerance);
+		myObj.setKnotPoints(knotPoints);
+		myObj.setKnotTolerance(knotTolerance);
+		myObj.setPeriodic(periodic);
+		myObj.setRational(rational);
+		myObj.setScenario(scenario);
+		myObj.setWeights(weights);
+
+	}
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		//FIXME: Implementación provisional para ver si podemos leer SPLINES
+		//De momento creamos una polilinea cuando deberíamos crear un spline o un bspline
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		Spline pline = null;
+		int subType = getGeometrySubType(is3DFile);
+		double elev = getZ();
+		double[][] points = getFitPoints();
+		if (points == null) {
+			points = getControlPoints();
+		}
+
+
+		if (points == null) {
+			gMan.createNullGeometry(subType);
+		}
+		pline = (Spline) gMan.create(getGeometryType(), subType);
+		Point point;
+		for (int i = 0; i < points.length; i++) {
+			point = (Point) gMan.create(Geometry.TYPES.POINT, subType);
+			pline.addVertex(point);
+		}
+		return pline;
+	}
+
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+	public String toString(){
+		return "Spline";
+	}
+
+	public int getGeometryType() {
+		// return Geometry.TYPES.SOLID; FIXME not implemented
+		return Geometry.TYPES.SPLINE;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlock.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlock.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlock.java	(revision 435)
@@ -0,0 +1,77 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * The DwgBlock class represents a DWG Block
+ * 
+ * @author jmorell
+ */
+public class DwgBlock extends DwgObject {
+	public DwgBlock(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private String name;
+	
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+	/**
+	 * @param name The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Object clone(){
+		DwgBlock obj = new DwgBlock(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgBlock myObj = (DwgBlock)obj;
+
+		myObj.setName(name);
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMesh.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMesh.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMesh.java	(revision 435)
@@ -0,0 +1,175 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMesh.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.1  2007-02-28 07:35:10  jmvivo
+* Actualizado desde el HEAD.
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgMesh extends DwgObject {
+
+	private int flags;
+	private int curveType;
+	private int mVerticies;
+	private int nVerticies;
+	private int mDensity;
+	private int nDensity;
+	private DwgHandleReference firstVertexHandle;
+	private DwgHandleReference lastVertexHandle;
+	private DwgHandleReference seqendHandle;
+
+	public DwgMesh(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	public void setCurveType(int curveType) {
+		this.curveType = curveType;
+	}
+
+	public void setMVerticies(int verticies) {
+		this.mVerticies = verticies;
+	}
+
+	public void setNVerticies(int verticies) {
+		this.nVerticies = verticies;
+	}
+
+	public void setMDensity(int density) {
+		this.mDensity = density;
+	}
+
+	public void setNDensity(int density) {
+		this.nDensity = density;
+	}
+
+	public void setFirstVertexHandle(DwgHandleReference handle) {
+		this.firstVertexHandle = handle;
+	}
+
+	public void setLastVertexHandle(DwgHandleReference handle) {
+		this.lastVertexHandle = handle;
+	}
+
+	public void setSeqendHandle(DwgHandleReference handle) {
+		this.seqendHandle = handle;
+	}
+
+	public int getCurveType() {
+		return curveType;
+	}
+
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+
+	public int getFlags() {
+		return flags;
+	}
+
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+
+	public int getMDensity() {
+		return mDensity;
+	}
+
+	public int getMVerticies() {
+		return mVerticies;
+	}
+
+	public int getNDensity() {
+		return nDensity;
+	}
+
+	public int getNVerticies() {
+		return nVerticies;
+	}
+
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+	public Object clone(){
+		DwgMesh obj = new DwgMesh(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgMesh myObj = (DwgMesh)obj;
+
+		myObj.setCurveType(curveType);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setFlags(flags);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setMDensity(mDensity);
+		myObj.setMVerticies(mVerticies);
+		myObj.setNDensity(nDensity);
+		myObj.setNVerticies(nVerticies);
+		myObj.setSeqendHandle(seqendHandle);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLwPolyline.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLwPolyline.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLwPolyline.java	(revision 435)
@@ -0,0 +1,411 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.dwg.lib.util.GisModelCurveCalculator;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+/**
+ * The DwgLwPolyline class represents a DWG LwPolyline
+ *
+ * @author jmorell
+ */
+public class DwgLwPolyline extends DwgObject
+        implements IDwgPolyline, IDwgExtrusionable,
+        IDwg3DTestable, IDwg2FMap, IDwgBlockMember {
+
+    private int flag;
+    private double constWidth;
+    private double elevation;
+    private double thickness;
+    private double[] normal;
+    private List vertices;
+    /*
+     *The bulge is the tangent of 1/4 of the included angle for the arc
+     *between the selected vertex and the next vertex in the polyline's vertex list.
+     *A negative bulge value indicates that the arc goes clockwise from
+     *the selected vertex to the next vertex.
+     *A bulge of 0 indicates a straight segment,
+     *and a bulge of 1 is a semicircle.
+     *
+     *http://www.faqs.org/faqs/CAD/autolisp-faq/part2/section-6.html
+     */
+    private double[] bulges;
+    private double[][] widths;
+
+    public DwgLwPolyline(int index) {
+        super(index);
+        vertices = new ArrayList();
+    }
+
+    /**
+     * @return Returns the bulges.
+     */
+    public double[] getBulges() {
+        return bulges;
+    }
+
+    /**
+     * @param bulges The bulges to set.
+     */
+    public void setBulges(double[] bulges) {
+        this.bulges = bulges;
+    }
+
+    /**
+     * @return Returns the flag.
+     */
+    public int getFlag() {
+        return flag;
+    }
+
+    /**
+     * @param flag The flag to set.
+     */
+    public void setFlag(int flag) {
+        this.flag = flag;
+    }
+
+    /**
+     * @return Returns the vertices.
+     */
+    public List getVertices() {
+        return vertices;
+    }
+
+    /**
+     * @param vertices The vertices to set.
+     */
+    public void setVertices(List vertices) {
+        this.vertices = vertices;
+    }
+
+    /**
+     * @return Returns the elevation.
+     */
+    public double getElevation() {
+        return elevation;
+    }
+
+    /**
+     * @param elevation The elevation to set.
+     */
+    public void setElevation(double elevation) {
+        this.elevation = elevation;
+    }
+
+    /**
+     * @return Returns the normal.
+     */
+    public double[] getNormal() {
+        return normal;
+    }
+    /* (non-Javadoc)
+     * @see java.lang.Object#clone()
+     */
+//	public Object clone() {
+//		DwgLwPolyline dwgLwPolyline = new DwgLwPolyline(index);
+//		dwgLwPolyline.setType(type);
+//		dwgLwPolyline.setHandle(handle);
+//		dwgLwPolyline.setVersion(version);
+//		dwgLwPolyline.setMode(mode);
+//		dwgLwPolyline.setLayerHandle(layerHandle);
+//		dwgLwPolyline.setColor(color);
+//		dwgLwPolyline.setNumReactors(numReactors);
+//		dwgLwPolyline.setNoLinks(noLinks);
+//		dwgLwPolyline.setLinetypeFlags(linetypeFlags);
+//		dwgLwPolyline.setPlotstyleFlags(plotstyleFlags);
+//		dwgLwPolyline.setSizeInBits(sizeInBits);
+//		dwgLwPolyline.setExtendedData(extendedData);
+//		dwgLwPolyline.setGraphicData(graphicData);
+//		//dwgLwPolyline.setInsideBlock(insideBlock);
+//		dwgLwPolyline.setFlag(flag);
+//		dwgLwPolyline.setElevation(elevation);
+//		dwgLwPolyline.setConstWidth(constWidth);
+//		dwgLwPolyline.setThickness(thickness);
+//		dwgLwPolyline.setNormal(normal);
+//		dwgLwPolyline.setVertices(vertices);
+//		dwgLwPolyline.setBulges(bulges);
+//		dwgLwPolyline.setWidths(widths);
+//		return dwgLwPolyline;
+//	}
+
+    /**
+     * @return Returns the constWidth.
+     */
+    public double getConstWidth() {
+        return constWidth;
+    }
+
+    /**
+     * @param constWidth The constWidth to set.
+     */
+    public void setConstWidth(double constWidth) {
+        this.constWidth = constWidth;
+    }
+
+    /**
+     * @return Returns the thickness.
+     */
+    public double getThickness() {
+        return thickness;
+    }
+
+    /**
+     * @param thickness The thickness to set.
+     */
+    public void setThickness(double thickness) {
+        this.thickness = thickness;
+    }
+
+    /**
+     * @return Returns the widths.
+     */
+    public double[][] getWidths() {
+        return widths;
+    }
+
+    /**
+     * @param widths The widths to set.
+     */
+    public void setWidths(double[][] widths) {
+        this.widths = widths;
+    }
+
+    /**
+     * @param normal The normal to set.
+     */
+    public void setNormal(double[] normal) {
+        this.normal = normal;
+    }
+    /* (non-Javadoc)
+     * @see com.iver.cit.jdwglib.dwg.IDwgPolyline#calculateGisModel(java.util.List)
+     */
+
+    public void calculateGisModel(DwgFile dwgFile) {
+        if (getVertices() == null) {
+            return;
+        }
+        int flags = getFlag();
+        List pts = getVertices();
+        double[] bulges = getBulges();
+        List newPts = new ArrayList();
+        double[] newBulges = null;
+        if (bulges != null) {
+            newBulges = new double[bulges.length];
+            System.arraycopy(bulges, 0, newBulges, 0, bulges.length);
+        } else {
+            bulges = new double[pts.size()];
+            newBulges = new double[bulges.length];
+			//dwg spec says numVertex (numSegments + 1)
+            //TODO Check this
+            for (int i = 0; i < newBulges.length; i++) {
+                bulges[i] = 0d;
+            }
+            newBulges = new double[bulges.length];
+            System.arraycopy(bulges, 0, newBulges, 0, bulges.length);
+        }
+        // TODO: Aqu� pueden existir casos no contemplados ...
+//        System.out.println("flags = " + flags);
+        if (flags == 512 || flags == 776 || flags == 768) {//closed
+            newBulges = new double[bulges.length + 1];
+            for (int j = 0; j < pts.size(); j++) {
+                newPts.add(pts.get(j));
+            }
+            newPts.add(pts.get(0));
+            newBulges[pts.size()] = 0;
+        } else {
+            for (int j = 0; j < pts.size(); j++) {
+                newPts.add(pts.get(j));
+            }
+        }
+        if (newPts.size() > 0) {
+            setBulges(newBulges);
+            List points = GisModelCurveCalculator.calculateGisModelBulge(newPts, newBulges);
+            setVertices(points);
+        }
+//		if (pts.size() > 0) {
+//			setBulges(newBulges);
+//			List points = GisModelCurveCalculator.calculateGisModelBulge(newPts, newBulges);
+//			setVertices(points);
+//		}
+//		else {
+////			System.out.println("Encontrada polil�nea sin puntos ...");
+//			// TODO: No se debe mandar nunca una polil�nea sin puntos, si esto
+//			// ocurre es porque existe un error que hay que corregir ...
+//		}
+    }
+    /* (non-Javadoc)
+     * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+     */
+
+    public void applyExtrussion() {
+        if (getVertices() == null) {
+            return;
+        }
+        List vertices = getVertices();
+        double[] lwPolylineExt = getNormal();
+        // Normals and Extrusions aren`t the same
+        if (lwPolylineExt[0] == 0 && lwPolylineExt[1] == 0 && lwPolylineExt[2] == 0) {
+            lwPolylineExt[2] = 1.0;
+        }
+
+        double elev = getElevation();
+        List lwPolylinePoints3D = new ArrayList();
+        for (int j = 0; j < vertices.size(); j++) {
+            double[] point = new double[3];
+            point[0] = ((double[]) vertices.get(j))[0];
+            point[1] = ((double[]) vertices.get(j))[1];
+            point[2] = elev;
+            lwPolylinePoints3D.add(AcadExtrusionCalculator.
+                    extrude2(point, lwPolylineExt));
+        }
+        setElevation(elev);
+        List newVertices = new ArrayList();
+        for (int j = 0; j < vertices.size(); j++) {
+            double[] point = (double[]) lwPolylinePoints3D.get(j);
+            newVertices.add(new double[]{point[0], point[1]});
+        }
+        setVertices(newVertices);
+    }
+    /* (non-Javadoc)
+     * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+     */
+
+    public boolean has3DData() {
+        return getElevation() != 0.0;
+    }
+
+    public double getZ() {
+        return getElevation();
+    }
+
+    public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+        return FMapUtil.ptsToLine(getVertices(),
+                getGeometrySubType(is3DFile));
+    }
+
+    public String toFMapString(boolean is3DFile) {
+        if (is3DFile) {
+            return "FPolyline3D";
+        } else {
+            return "FPolyline2D";
+        }
+    }
+
+    public String toString() {
+        return "LwPolyline";
+    }
+
+    public void transform2Block(double[] bPoint, Point2D insPoint,
+            double[] scale, double rot,
+            List dwgObjectsWithoutBlocks,
+            Map handleObjWithoutBlocks, DwgFile callBack) {
+        DwgLwPolyline transformedEntity = null;
+        List vertices = this.getVertices();
+        Object vertice;
+        double[] point;
+        if (vertices != null) {
+            List transformedVertices = new ArrayList();
+            for (int i = 0; i < vertices.size(); i++) {
+                vertice = vertices.get(i);
+                if (vertice instanceof Point2D.Double) {
+                    point = new double[]{((Point2D.Double) vertices.get(i)).x, ((Point2D.Double) vertices.get(i)).y};
+                } else {
+                    point = (double[]) vertices.get(i);
+                }
+                double[] pointAux = new double[]{point[0] - bPoint[0],
+                    point[1] - bPoint[1]};
+                double laX = insPoint.getX() + ((pointAux[0] * scale[0]) * Math.cos(rot) + (pointAux[1] * scale[1]) * (-1) * Math.sin(rot));
+                double laY = insPoint.getY() + ((pointAux[0] * scale[0]) * Math.sin(rot) + (pointAux[1] * scale[1]) * Math.cos(rot));
+                transformedVertices.add(new double[]{laX, laY});
+            }
+            transformedEntity = (DwgLwPolyline) this.clone();
+            transformedEntity.setVertices(transformedVertices);
+            transformedEntity.setElevation((this.getElevation() * scale[2]));
+            transformedEntity.setHandle(this.getHandle());
+            dwgObjectsWithoutBlocks.add(transformedEntity);
+            handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+//			dwgObjectsWithoutBlocks.add(this);
+        }//if
+    }
+
+    public Object clone() {
+        DwgLwPolyline dwgLwPolyline = new DwgLwPolyline(index);
+        this.fill(dwgLwPolyline);
+        return dwgLwPolyline;
+    }
+
+    protected void fill(DwgObject obj) {
+        super.fill(obj);
+        DwgLwPolyline myObj = (DwgLwPolyline) obj;
+
+        myObj.setBulges(bulges);
+        myObj.setConstWidth(constWidth);
+        myObj.setElevation(elevation);
+        myObj.setFlag(flag);
+        myObj.setNormal(normal);
+        myObj.setThickness(thickness);
+        myObj.setVertices(vertices);
+        myObj.setWidths(widths);
+
+    }
+
+    public void addVertex(IDwgVertex vertex) {
+        vertices.add(vertex.getPoint());
+
+    }
+
+    public int getGeometryType() {
+        return Geometry.TYPES.MULTICURVE;
+    }
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEndblk.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEndblk.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEndblk.java	(revision 435)
@@ -0,0 +1,62 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * The DwgEndblk class represents a DWG Endblk
+ * 
+ * @author jmorell
+ */
+public class DwgEndblk extends DwgObject {
+	
+	public DwgEndblk(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgEndblk obj = new DwgEndblk(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgEndblk myObj = (DwgEndblk)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgCircle.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgCircle.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgCircle.java	(revision 435)
@@ -0,0 +1,248 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+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.fmap.geom.primitive.Circle;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgCircle class represents a DWG Circle
+ *
+ * @author jmorell
+ */
+public class DwgCircle extends DwgObject
+	implements IDwgExtrusionable, IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+
+	private double[] center;
+	private double radius;
+	private double thickness;
+	private double[] extrusion;
+
+
+	public DwgCircle(int index) {
+		super(index);
+	}
+	/**
+	 * @return Returns the center.
+	 */
+	public double[] getCenter() {
+		return center;
+	}
+	/**
+	 * @param center The center to set.
+	 */
+	public void setCenter(double[] center) {
+		this.center = center;
+	}
+	/**
+	 * @return Returns the radius.
+	 */
+	public double getRadius() {
+		return radius;
+	}
+	/**
+	 * @param radius The radius to set.
+	 */
+	public void setRadius(double radius) {
+		this.radius = radius;
+	}
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+//	public Object clone() {
+//		DwgCircle dwgCircle = new DwgCircle(index);
+//		dwgCircle.setType(type);
+//		dwgCircle.setHandle(handle);
+//		dwgCircle.setVersion(version);
+//		dwgCircle.setMode(mode);
+//		dwgCircle.setLayerHandle(layerHandle);
+//		dwgCircle.setColor(color);
+//		dwgCircle.setNumReactors(numReactors);
+//		dwgCircle.setNoLinks(noLinks);
+//		dwgCircle.setLinetypeFlags(linetypeFlags);
+//		dwgCircle.setPlotstyleFlags(plotstyleFlags);
+//		dwgCircle.setSizeInBits(sizeInBits);
+//		dwgCircle.setExtendedData(extendedData);
+//		dwgCircle.setGraphicData(graphicData);
+//		//dwgCircle.setInsideBlock(insideBlock);
+//		dwgCircle.setCenter(center);
+//		dwgCircle.setRadius(radius);
+//		dwgCircle.setThickness(thickness);
+//		dwgCircle.setExtrusion(extrusion);
+//		return dwgCircle;
+//	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] circleCenter = getCenter();
+         double[] circleExt = getExtrusion();
+         circleCenter = AcadExtrusionCalculator.extrude2(circleCenter, circleExt);
+         setCenter(circleCenter);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getCenter()[2]!= 0.0) ;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		return getCenter()[2];
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean)
+	 */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		double[] c = getCenter();
+		//FIXME: ¿qué hacer cuando llega un radio negativo?
+		//	De momento, tomamos el valor absoluto del radio, pero
+		//	¿habría que modificar de alguna manera los angulos?
+		double radius = Math.abs(getRadius());
+		Circle circle = (Circle) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		Point center = (Point) gMan.create(Geometry.TYPES.POINT,
+				getGeometrySubType(is3DFile));
+		center.setCoordinates(c);
+		circle.setPoints(center, radius);
+		return circle;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "Circle";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot,
+			List dwgObjectsWithoutBlocks, Map handleObjWithoutBlocks, DwgFile callBack) {
+		DwgCircle transformedEntity = null;
+		double[] center = this.getCenter();
+		Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double laZ = center[2] * scale[2];
+		double[] transformedCenter = new double[]{laX, laY, laZ};
+		double radius = this.getRadius();
+		double transformedRadius = radius * scale[0];
+		transformedEntity = (DwgCircle)this.clone();
+		transformedEntity.setCenter(transformedCenter);
+		transformedEntity.setRadius(transformedRadius);
+		dwgObjectsWithoutBlocks.add(transformedEntity);
+		handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+//		setCenter(transformedCenter);
+//		setRadius(transformedRadius);
+//		dwgObjectsWithoutBlocks.add(this);
+	}
+	public Object clone(){
+		DwgCircle obj = new DwgCircle(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgCircle myObj = (DwgCircle)obj;
+
+		myObj.setCenter(center);
+		myObj.setExtrusion(extrusion);
+		myObj.setRadius(radius);
+		myObj.setThickness(thickness);
+
+	}
+	public int getGeometrySubType(boolean is3DFile) {
+		if (is3DFile) {
+			return Geometry.SUBTYPES.GEOM3D;
+		} else {
+			return Geometry.SUBTYPES.GEOM2D;
+		}
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.CIRCLE;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDef.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDef.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImageDef.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImageDef extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgImageDef(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgImageDef obj = new DwgImageDef(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgImageDef myObj = (DwgImageDef)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMText.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMText.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMText.java	(revision 435)
@@ -0,0 +1,308 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+import org.gvsig.dwg.lib.util.FMapUtil;
+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.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgMText class represents a DWG MText
+ *
+ * @author jmorell, azabala
+ */
+public class DwgMText extends DwgObject
+	implements IDwgExtrusionable, IDwg3DTestable, IDwg2FMap {
+	public DwgMText(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private double[] insertionPoint;
+	private double[] extrusion;
+	private double[] xAxisDirection;
+	private double width;
+	private double height;
+	private int attachment;
+	private int drawingDir;
+	private double extHeight;
+	private double extWidth;
+	private String text;
+	private int lineSpacingStyle;
+	private double lineSpacingFactor;
+	private DwgHandleReference styleHandle = null;
+
+
+	/**
+	 * @return Returns the height.
+	 */
+	public double getHeight() {
+		return height;
+	}
+	/**
+	 * @param height The height to set.
+	 */
+	public void setHeight(double height) {
+		this.height = height;
+	}
+	/**
+	 * @return Returns the insertionPoint.
+	 */
+	public double[] getInsertionPoint() {
+		return insertionPoint;
+	}
+	/**
+	 * @param insertionPoint The insertionPoint to set.
+	 */
+	public void setInsertionPoint(double[] insertionPoint) {
+		this.insertionPoint = insertionPoint;
+	}
+	/**
+	 * @return Returns the text.
+	 */
+	public String getText() {
+		return text;
+	}
+	/**
+	 * @param text The text to set.
+	 */
+	public void setText(String text) {
+		this.text = text;
+	}
+	/**
+	 * @return Returns the width.
+	 */
+	public double getWidth() {
+		return width;
+	}
+	/**
+	 * @param width The width to set.
+	 */
+	public void setWidth(double width) {
+		this.width = width;
+	}
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+
+    /**
+	 * @return Returns the attachment.
+	 */
+	public int getAttachment() {
+		return attachment;
+	}
+	/**
+	 * @param attachment The attachment to set.
+	 */
+	public void setAttachment(int attachment) {
+		this.attachment = attachment;
+	}
+	/**
+	 * @return Returns the drawingDir.
+	 */
+	public int getDrawingDir() {
+		return drawingDir;
+	}
+	/**
+	 * @param drawingDir The drawingDir to set.
+	 */
+	public void setDrawingDir(int drawingDir) {
+		this.drawingDir = drawingDir;
+	}
+	/**
+	 * @return Returns the extHeight.
+	 */
+	public double getExtHeight() {
+		return extHeight;
+	}
+	/**
+	 * @param extHeight The extHeight to set.
+	 */
+	public void setExtHeight(double extHeight) {
+		this.extHeight = extHeight;
+	}
+	/**
+	 * @return Returns the extWidth.
+	 */
+	public double getExtWidth() {
+		return extWidth;
+	}
+	/**
+	 * @param extWidth The extWidth to set.
+	 */
+	public void setExtWidth(double extWidth) {
+		this.extWidth = extWidth;
+	}
+	/**
+	 * @return Returns the lineSpacingFactor.
+	 */
+	public double getLineSpacingFactor() {
+		return lineSpacingFactor;
+	}
+	/**
+	 * @param lineSpacingFactor The lineSpacingFactor to set.
+	 */
+	public void setLineSpacingFactor(double lineSpacingFactor) {
+		this.lineSpacingFactor = lineSpacingFactor;
+	}
+	/**
+	 * @return Returns the lineSpacingStyle.
+	 */
+	public int getLineSpacingStyle() {
+		return lineSpacingStyle;
+	}
+	/**
+	 * @param lineSpacingStyle The lineSpacingStyle to set.
+	 */
+	public void setLineSpacingStyle(int lineSpacingStyle) {
+		this.lineSpacingStyle = lineSpacingStyle;
+	}
+	/**
+	 * @return Returns the styleHandle.
+	 */
+	public DwgHandleReference getStyleHandle() {
+		return styleHandle;
+	}
+	/**
+	 * @param styleHandle The styleHandle to set.
+	 */
+	public void setStyleHandle(DwgHandleReference styleHandle) {
+		this.styleHandle = styleHandle;
+	}
+	/**
+	 * @return Returns the xAxisDirection.
+	 */
+	public double[] getXAxisDirection() {
+		return xAxisDirection;
+	}
+	/**
+	 * @param axisDirection The xAxisDirection to set.
+	 */
+	public void setXAxisDirection(double[] axisDirection) {
+		xAxisDirection = axisDirection;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] mtextPoint = getInsertionPoint();
+         double[] mtextExt = getExtrusion();
+         mtextPoint = AcadExtrusionCalculator.extrude2(mtextPoint, mtextExt);
+         setInsertionPoint(mtextPoint);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getInsertionPoint()[2] != 0.0);
+	}
+	public double getZ() {
+		return getInsertionPoint()[2];
+	}
+
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		double[] p = getInsertionPoint();
+		Point point = (Point) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		point.setCoordinates(p);
+		return point;
+	}
+
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPoint3D";
+		} else {
+			return "FPoint2D";
+		}
+	}
+
+
+
+	public String toString(){
+		return "MText";
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgMText obj = new DwgMText(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgMText myObj = (DwgMText)obj;
+
+		myObj.setAttachment(attachment);
+		myObj.setDrawingDir(drawingDir);
+		myObj.setExtHeight(extHeight);
+		myObj.setExtrusion(extrusion);
+		myObj.setExtWidth(extWidth);
+		myObj.setHeight(extHeight);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setLineSpacingFactor(lineSpacingFactor);
+		myObj.setLineSpacingStyle(lineSpacingStyle);
+		myObj.setStyleHandle(styleHandle);
+		myObj.setText(text);
+		myObj.setWidth(width);
+		myObj.setXAxisDirection(xAxisDirection);
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.POINT;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialFilter.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialFilter.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialFilter.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSpatialFilter extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgSpatialFilter(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgSpatialFilter obj = new DwgSpatialFilter(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgSpatialFilter myObj = (DwgSpatialFilter)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgXRecord.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgXRecord.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgXRecord.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgXRecord extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgXRecord(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgXRecord obj = new DwgXRecord(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgXRecord myObj = (DwgXRecord)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMeshPolyline.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMeshPolyline.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgMeshPolyline.java	(revision 435)
@@ -0,0 +1,355 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgMeshPolyline.java 34887 2011-04-04 12:19:30Z jpiera $
+* $Log$
+* Revision 1.4.2.1  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+* Revision 1.3  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+* Revision 1.2  2007/03/02 20:31:22  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2007/03/01 19:58:53  azabala
+* refactor of pface and mesh names
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+/**
+ * This class is a Mesh (polyline mesh), what is different of
+ * a Polyface mesh (polyline pface).
+ *
+ *
+ * */
+public class DwgMeshPolyline extends DwgObject
+		implements IDwgPolyline, IDwg2FMap, IDwgBlockMember{
+
+	private int flags;
+	/**
+	 * Curves and smooth surface type (optional; default = 0);
+	 * integer codes, not bit-coded:
+	 		0 = No smooth surface fitted
+	 		5 = Quadratic B-spline surface
+	 		6 = Cubic B-spline surface
+	 		8 = Bezier surface
+	 * */
+	private int curveType;
+
+	/**
+	 * Polygon mesh M vertex count
+	 * (if curvetype is Spline, it has smooth M density)
+	 */
+	private int mVerticies;
+	/**
+	 * Polygon mesh N vertex count
+	 * (if curvetype is Spline, it has smooth n density)
+	 * */
+	private int nVerticies;
+	/**
+	 * If the mesh is closed in the M direction
+	 * */
+	private boolean isClosedM;
+	/**
+	 * If the mesh is closed in the N direction
+	 * */
+	private boolean isClosedN;
+
+	/**
+	 * handle of the first vertex of the mesh
+	 * */
+	private DwgHandleReference firstVertexHandle;
+	/**
+	 * handle of the last vertex of the mesh
+	 * */
+	private DwgHandleReference lastVertexHandle;
+	/**
+	 * handle of the seqend of the mesh
+	 * */
+	private DwgHandleReference seqendHandle;
+
+	/**
+	 * Vertices of the mesh
+	 * */
+	private List vertices;
+
+	/**
+	 * Owned Objects Handles of the mesh
+	 * */
+	private ArrayList ownedObjectsHandles; //For R2004+
+
+
+	/**
+	 * Constructor
+	 * */
+	public DwgMeshPolyline(int index) {
+		super(index);
+		ownedObjectsHandles = new ArrayList();
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	public void setCurveType(int curveType) {
+		this.curveType = curveType;
+	}
+
+	public void setMVerticies(int verticies) {
+		this.mVerticies = verticies;
+	}
+
+	public void setNVerticies(int verticies) {
+		this.nVerticies = verticies;
+	}
+
+
+	public void setFirstVertexHandle(DwgHandleReference handle) {
+		this.firstVertexHandle = handle;
+	}
+
+	public void setLastVertexHandle(DwgHandleReference handle) {
+		this.lastVertexHandle = handle;
+	}
+
+	public void setSeqendHandle(DwgHandleReference handle) {
+		this.seqendHandle = handle;
+	}
+
+	public int getCurveType() {
+		return curveType;
+	}
+
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+
+	public int getFlags() {
+		return flags;
+	}
+
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+
+
+	public int getMVerticies() {
+		return mVerticies;
+	}
+
+
+	public int getNVerticies() {
+		return nVerticies;
+	}
+
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+	public Object clone(){
+		DwgMeshPolyline obj = new DwgMeshPolyline(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgMeshPolyline myObj = (DwgMeshPolyline)obj;
+
+		myObj.setCurveType(curveType);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setFlags(flags);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setMVerticies(mVerticies);
+		myObj.setNVerticies(nVerticies);
+		myObj.setSeqendHandle(seqendHandle);
+	}
+
+	public void calculateGisModel(DwgFile dwgFile) {
+	}
+
+	 /*
+     * By the moment, we consideer that PFacePolyline
+     * is a Polyline3D TODO Implement real conversion
+     * from a polyface mesh to a FMap geometry
+     * */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		//TODO Implementar la conversion de DWG Mesh a
+		//FMap (coleccion de poligonos??)
+		return null;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "MeshPolyline";
+	}
+
+	public List getVertices() {
+		return vertices;
+	}
+
+	public void setVertices(List vertices) {
+		this.vertices = vertices;
+	}
+
+	public boolean isClosedM() {
+		return isClosedM;
+	}
+
+	public void setClosedM(boolean isClosedM) {
+		this.isClosedM = isClosedM;
+	}
+
+	public boolean isClosedN() {
+		return isClosedN;
+	}
+
+	public void setClosedN(boolean isClosedN) {
+		this.isClosedN = isClosedN;
+	}
+
+	public void setMDensity(int density) {
+		this.mVerticies = density;
+	}
+
+	public void setNDensity(int density) {
+		this.nVerticies = density;
+	}
+
+	public void addVertex(IDwgVertex vertex) {
+		vertices.add(vertex.getPoint());
+
+	}
+
+	/**
+	 * @return Returns the owned objects handles.
+	 */
+	public ArrayList getOwnedObjectsHandles() {
+		return ownedObjectsHandles;
+	}
+	/**
+	 * @param objects The owned objects handles to set.
+	 */
+	public void setOwnedObjectsHandles(ArrayList handles) {
+		this.ownedObjectsHandles = handles;
+	}
+	/**
+	 * Add a handle to the ownedBbjectsHandle vector
+	 *
+	 * @param handle handle
+	 */
+	public void addOwnedObjectHandle(DwgHandleReference handle) {
+		this.ownedObjectsHandles.add(handle);
+	}
+
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks, DwgFile callBack) {
+
+		DwgPolyline3D transformedEntity = null;
+		List vertices = this.getVertices();
+
+		if (vertices != null) {
+		    List transformedVertices = new ArrayList();
+			for (int i=0;i < vertices.size();i++) {
+				double[] pointAux = null;
+			    pointAux = new double[]{((double[]) vertices.get(i))[0] - bPoint[0],
+			    		((double[]) vertices.get(i))[1] - bPoint[1]};
+
+				double laX = insPoint.getX() + ((pointAux[0] * scale[0])*Math.cos(rot) + (pointAux[1]*scale[1])*(-1)*Math.sin(rot));
+				double laY = insPoint.getY() + ((pointAux[0]*scale[0])*Math.sin(rot) + (pointAux[1]*scale[1])*Math.cos(rot));
+				double laZ = ((double[]) vertices.get(i))[2] - bPoint[2];
+				transformedVertices.add(new double[]{laX, laY, laZ});
+			}//for
+			transformedEntity = (DwgPolyline3D)this.clone();
+			transformedEntity.setPts(transformedVertices);
+			dwgObjectsWithoutBlocks.add(transformedEntity);
+			handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+		}
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.MULTICURVE;
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgOle2Frame.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgOle2Frame.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgOle2Frame.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgOle2Frame extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgOle2Frame(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgOle2Frame obj = new DwgOle2Frame(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgOle2Frame myObj = (DwgOle2Frame)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerControl.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerControl.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerControl.java	(revision 435)
@@ -0,0 +1,91 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.util.List;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * The DwgLayerControl class represents a DWG Layer control
+ * 
+ * @author jmorell
+ */
+public class DwgLayerControl extends DwgObject {
+	
+	private DwgHandleReference nullHandle;
+	private List handles;
+
+	public DwgLayerControl(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setNullHandle(DwgHandleReference handle) {
+		this.nullHandle = handle;
+	}
+
+	public void setCode2Handles(List handles) {
+		this.handles = handles;
+	}
+
+	public List getHandles() {
+		return handles;
+	}
+
+	public void setHandles(List handles) {
+		this.handles = handles;
+	}
+
+	public DwgHandleReference getNullHandle() {
+		return nullHandle;
+	}
+	public Object clone(){
+		DwgLayerControl obj = new DwgLayerControl(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgLayerControl myObj = (DwgLayerControl)obj;
+
+		myObj.setHandles(handles);
+		myObj.setNullHandle(nullHandle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFace.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFace.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFace.java	(revision 435)
@@ -0,0 +1,136 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgPFace.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.1  2007-02-28 07:35:10  jmvivo
+* Actualizado desde el HEAD.
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgPFace extends DwgObject{
+
+	private int vertexCount;
+	private int faceCount;
+	private DwgHandleReference firstVertexHandle;
+	private DwgHandleReference lastVertexHandle;
+	private DwgHandleReference seqendHandle;
+
+	public DwgPFace(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setVertexCount(int vertexCount) {
+		this.vertexCount = vertexCount;
+	}
+
+	public void setFaceCount(int faceCount) {
+		this.faceCount = faceCount;
+	}
+
+	public void setFirstVertexHandle(DwgHandleReference handle) {
+		this.firstVertexHandle = handle;
+	}
+
+	public void setLastVertexHandle(DwgHandleReference handle) {
+		this.lastVertexHandle = handle;
+	}
+
+	public void setSeqendHandle(DwgHandleReference handle) {
+		this.seqendHandle = handle;
+	}
+
+	public int getFaceCount() {
+		return faceCount;
+	}
+
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+
+	public int getVertexCount() {
+		return vertexCount;
+	}
+	public Object clone(){
+		DwgPFace obj = new DwgPFace(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgPFace myObj = (DwgPFace)obj;
+		
+		myObj.setFaceCount(faceCount);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setSeqendHandle(seqendHandle);
+		myObj.setVertexCount(vertexCount);
+
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionaryVar.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionaryVar.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionaryVar.java	(revision 435)
@@ -0,0 +1,118 @@
+/*
+ * Created on 30-ene-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgDictionaryVar.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.3.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.3  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.2  2007/01/31 17:56:40  fdiaz
+* Refactorizacion para usar la clase DwgHandleReference
+*
+* Revision 1.1  2007/01/30 19:40:23  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgDictionaryVar extends DwgObject {
+	private int intval;
+	private String text;
+	private DwgHandleReference parentHandle;
+
+	public DwgDictionaryVar(int index) {
+		super(index);
+	}
+
+	
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public void setParentHandle(DwgHandleReference hr) {
+		this.parentHandle = hr;
+		
+	}
+
+	public int getIntval() {
+		return intval;
+	}
+
+	public void setIntval(int intval) {
+		this.intval = intval;
+	}
+
+	public DwgHandleReference getParentHandle() {
+		return parentHandle;
+	}
+
+	public String getText() {
+		return text;
+	}
+	public Object clone(){
+		DwgDictionaryVar obj = new DwgDictionaryVar(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgDictionaryVar myObj = (DwgDictionaryVar)obj;
+
+		myObj.setIntval(intval);
+		myObj.setParentHandle(parentHandle);
+		myObj.setText(text);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDimOrd.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDimOrd.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDimOrd.java	(revision 435)
@@ -0,0 +1,265 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgDimOrd.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+public class DwgDimOrd extends DwgObject {
+
+	private double[] extrusion;
+	private double[] textMidPoint;
+	private double elevation;
+	private int flags;
+	private String text;
+	private double rotation;
+	private double horizDir;
+	private double[] insScale;
+	private double insRotation;
+	private double[] pt12;
+	private double[] pt10;
+	private double[] pt13;
+	private double[] pt14;
+	private int flags2;
+	private DwgHandleReference dimStyleHandle;
+	private DwgHandleReference anonBlockHandle;
+
+	public DwgDimOrd(int index) {
+		super(index);
+	}
+
+	public void setExtrusion(double[] ds) {
+		this.extrusion = ds;
+	}
+
+
+	public void setTextMidPoint(double[] ds) {
+		this.textMidPoint = ds;
+	}
+
+	public void setElevation(double elevation) {
+		this.elevation = elevation;
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	public void setText(String txt) {
+		this.text = txt;
+	}
+
+	public void setTextRotation(double textRotation) {
+		this.rotation = textRotation;
+	}
+
+	public void setHorizDir(double horizDir) {
+		this.horizDir = horizDir;
+	}
+
+	public void setInsScale(double[] ds) {
+		this.insScale = ds;
+	}
+
+	public void setInsRotation(double insRotation) {
+		this.insRotation = insRotation;
+	}
+
+	public void set12Pt(double[] ds) {
+		this.pt12 = ds;
+	}
+
+	public void set10Pt(double[] ds) {
+		this.pt10 = ds;
+	}
+
+	public void set13Pt(double[] ds) {
+		this.pt13 = ds;
+	}
+
+	public void set14Pt(double[] ds) {
+		this.pt14 = ds;
+	}
+
+	public void setFlags2(int flags2) {
+		this.flags2 = flags2;
+	}
+
+	public void setDimStyleHandle(DwgHandleReference handle) {
+		this.dimStyleHandle = handle;
+	}
+
+	public void setAnonBlockHandle(DwgHandleReference handle) {
+		this.anonBlockHandle = handle;
+	}
+
+	public double[] getPt10() {
+		return pt10;
+	}
+
+	public void setPt10(double[] pt10) {
+		this.pt10 = pt10;
+	}
+
+	public double[] getPt12() {
+		return pt12;
+	}
+
+	public void setPt12(double[] pt12) {
+		this.pt12 = pt12;
+	}
+
+	public double[] getPt13() {
+		return pt13;
+	}
+
+	public void setPt13(double[] pt13) {
+		this.pt13 = pt13;
+	}
+
+	public double[] getPt14() {
+		return pt14;
+	}
+
+	public void setPt14(double[] pt14) {
+		this.pt14 = pt14;
+	}
+
+	public double getRotation() {
+		return rotation;
+	}
+
+	public void setRotation(double rotation) {
+		this.rotation = rotation;
+	}
+
+	public DwgHandleReference getAnonBlockHandle() {
+		return anonBlockHandle;
+	}
+
+	public DwgHandleReference getDimStyleHandle() {
+		return dimStyleHandle;
+	}
+
+	public double getElevation() {
+		return elevation;
+	}
+
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+
+	public int getFlags() {
+		return flags;
+	}
+
+	public int getFlags2() {
+		return flags2;
+	}
+
+	public double getHorizDir() {
+		return horizDir;
+	}
+
+	public double getInsRotation() {
+		return insRotation;
+	}
+
+	public double[] getInsScale() {
+		return insScale;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public double[] getTextMidPoint() {
+		return textMidPoint;
+	}
+	public Object clone(){
+		DwgDimOrd obj = new DwgDimOrd(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgDimOrd myObj = (DwgDimOrd)obj;
+
+		myObj.setAnonBlockHandle(anonBlockHandle);
+		myObj.setDimStyleHandle(dimStyleHandle);
+		myObj.setElevation(elevation);
+		myObj.setExtrusion(extrusion);
+		myObj.setFlags(flags);
+		myObj.setFlags2(flags2);
+		myObj.setHorizDir(horizDir);
+		myObj.setInsRotation(insRotation);
+		myObj.setInsScale(insScale);
+		myObj.setPt10(pt10);
+		myObj.setPt12(pt12);
+		myObj.setPt13(pt13);
+		myObj.setPt14(pt14);
+		myObj.setRotation(rotation);
+		myObj.setText(text);
+		myObj.setTextMidPoint(textMidPoint);
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline2D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline2D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline2D.java	(revision 435)
@@ -0,0 +1,576 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.dwg.lib.util.GisModelCurveCalculator;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The DwgPolyline2D class represents a DWG Polyline2D
+ *
+ * @author jmorell
+ */
+public class DwgPolyline2D extends DwgObject
+	implements IDwgPolyline, IDwgExtrusionable, IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+
+	private static Logger logger = LoggerFactory.getLogger(DwgPolyline2D.class.getName());
+
+	private int flags;
+	private int curveType;
+	private double initWidth;
+	private double endWidth;
+	private double thickness;
+	private double elevation;
+	private double[] extrusion;
+	private DwgHandleReference firstVertexHandle = null;
+	private DwgHandleReference lastVertexHandle = null;
+	private DwgHandleReference seqendHandle = null;
+	private List vertices;
+	private double[] bulges;
+	private ArrayList vertexHandles;
+
+	public DwgPolyline2D(int index) {
+		super(index);
+		vertices = new ArrayList();
+		vertexHandles = new ArrayList();
+	}
+	/**
+	 * @return Returns the firstVertexHandle.
+	 */
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+	/**
+	 * @param firstVertexHandle The firstVertexHandle to set.
+	 */
+	public void setFirstVertexHandle(DwgHandleReference firstVertexHandle) {
+		this.firstVertexHandle = firstVertexHandle;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the lastVertexHandle.
+	 */
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+	/**
+	 * @param lastVertexHandle The lastVertexHandle to set.
+	 */
+	public void setLastVertexHandle(DwgHandleReference lastVertexHandle) {
+		this.lastVertexHandle = lastVertexHandle;
+	}
+	/**
+	 * @return Returns the pts.
+	 */
+	public List getPts() {
+		return vertices;
+	}
+	/**
+	 * @param pts The pts to set.
+	 */
+	public void setPts(List pts) {
+		this.vertices = pts;
+	}
+	/**
+	 * @return Returns the bulges.
+	 */
+	public double[] getBulges() {
+		return bulges;
+	}
+	/**
+	 * @param bulges The bulges to set.
+	 */
+	public void setBulges(double[] bulges) {
+		this.bulges = bulges;
+	}
+	/**
+	 * @return Returns the initWidth.
+	 */
+	public double getInitWidth() {
+		return initWidth;
+	}
+	/**
+	 * @param initWidth The initWidth to set.
+	 */
+	public void setInitWidth(double initWidth) {
+		this.initWidth = initWidth;
+	}
+	/**
+	 * @return Returns the seqendHandle.
+	 */
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+	/**
+	 * @param seqendHandle The seqendHandle to set.
+	 */
+	public void setSeqendHandle(DwgHandleReference seqendHandle) {
+		this.seqendHandle = seqendHandle;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @return Returns the curveType.
+	 */
+	public int getCurveType() {
+		return curveType;
+	}
+	/**
+	 * @param curveType The curveType to set.
+	 */
+	public void setCurveType(int curveType) {
+		this.curveType = curveType;
+	}
+	/**
+	 * @return Returns the elevation.
+	 */
+	public double getElevation() {
+		return elevation;
+	}
+	/**
+	 * @param elevation The elevation to set.
+	 */
+	public void setElevation(double elevation) {
+		this.elevation = elevation;
+	}
+	/**
+	 * @return Returns the endWidth.
+	 */
+	public double getEndWidth() {
+		return endWidth;
+	}
+	/**
+	 * @param endWidth The endWidth to set.
+	 */
+	public void setEndWidth(double endWidth) {
+		this.endWidth = endWidth;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+
+	/**
+	 * @param Handles The vertexHandles to set.
+	 */
+	public void setVertexHandles(ArrayList handles){
+		this.vertexHandles = handles;
+	}
+
+	/**
+	 * @return Returns the vertexHandles.
+	 */
+	public ArrayList getVertexHandles(){
+		return this.vertexHandles;
+	}
+	/**
+	 * @param Handle The vertexHandles to add.
+	 */
+	public void addVertexHandle(DwgHandleReference handle){
+		this.vertexHandles.add(handle);
+	}
+
+
+	public void calculateGisModel(DwgFile dwgFile){
+		int flags = getFlags();
+//		En este metodo se mantiene el mecanismo anterior
+//		al refactoring de los handles references.
+//		TODO: Pensar si deberiamos coger el handle completo.
+//		Tal vez deberiamos tomar el handle completo y evaluar
+//		a donde apuntan (pueden haber 2 handles con codigo y offset
+//		distintos y que, sin embargo apunten al mismo objeto).
+
+		ArrayList pts = new ArrayList();
+		ArrayList bulges = new ArrayList();
+		double[] pt = new double[3];
+		double bulge = 0d;
+
+		if(dwgFile.getDwgVersion().equalsIgnoreCase("Autocad R2004, R2005, R2006")){
+			ArrayList vertexHandles = getVertexHandles();
+			DwgObject seqend = null;
+			for (int i=0; i<vertexHandles.size(); i++){
+				DwgHandleReference vertice = (DwgHandleReference)vertexHandles.get(i);
+				DwgObject objVertex = dwgFile.getDwgObjectFromHandle(vertice.getOffset());
+				if (objVertex != null){
+					if (objVertex instanceof DwgVertex2D) {
+						pts.add(((DwgVertex2D)objVertex).getPoint());
+						bulge = ((DwgVertex2D)objVertex).getBulge();
+						bulges.add(new Double(bulge));
+					} else {
+						logger.warn("Encontrado un "+objVertex.getClass().getName()+" " +
+								"con indice "+i+" en la lista de vertices de Polyline2D");
+					}
+				} else {
+					logger.warn("No se ha encontrado el vertice "+i+" de "+vertexHandles.size()
+							+" de la Polyline2D "+this.getIndex());
+					if (i==0){
+						seqend = dwgFile.getDwgObjectFromHandle(seqendHandle.getOffset());
+					}
+				}
+			}
+			if(seqend != null){
+				if (seqend instanceof DwgVertex2D) {
+					pts.add(((DwgVertex2D)seqend).getPoint());
+					bulge = ((DwgVertex2D)seqend).getBulge();
+					bulges.add(new Double(bulge));
+				} else {
+					logger.warn("Encontrado un "+seqend.getClass().getName()+" en seqend de Polyline2D "+
+							this.getIndex()+" cuando debería ser un DwgVertex2D");
+				}
+			}
+
+		} else {
+			DwgHandleReference firstHandle = getFirstVertexHandle();
+			DwgHandleReference lastHandle = getLastVertexHandle();
+
+
+			DwgObject first = dwgFile.getDwgObjectFromHandle(firstHandle.getOffset());
+			DwgObject last = dwgFile.getDwgObjectFromHandle(lastHandle.getOffset());
+			if(first == null || last == null){
+				logger.warn("Polyline2D con vertices inicial o final a null");
+				return;
+			}
+
+			if(!(first instanceof DwgVertex2D)){
+				logger.warn("El primer vertice de Polyline2D es "+
+						first.getClass().getName());
+				return;
+			}
+
+			if(!(last instanceof DwgVertex2D)){
+				logger.warn("El primer vertice de Polyline2D es "+
+						first.getClass().getName());
+				return;
+			}
+
+			int firstObjIdx = dwgFile.getIndexOf(first);
+			int lastObjIdx =  dwgFile.getIndexOf(last);
+			if(firstObjIdx == -1 || lastObjIdx == -1){
+				logger.warn("Calculate GIS Model: Problemas en la LinkedList: 1�="+firstObjIdx+",Ultimo="+lastObjIdx);
+				return;
+			}
+
+//			pt = ((DwgVertex2D)first).getPoint();
+//			pts.add(new Point2D.Double(pt[0], pt[1]));
+//			bulge = ((DwgVertex2D)first).getBulge();
+//			bulges.add(new Double(bulge));
+
+			for(int i = firstObjIdx; i <= lastObjIdx; i++){
+				DwgObject obj = dwgFile.getDwgObject(i);
+				if(obj instanceof DwgVertex2D){
+					DwgVertex2D vertex = (DwgVertex2D) obj;
+					pt = vertex.getPoint();
+					pts.add(new Point2D.Double(pt[0], pt[1]));
+					bulge = vertex.getBulge();
+					bulges.add(new Double(bulge));
+				}else{
+					logger.warn("Encontrado "+obj.getClass().getName()+" en la lista de vertices de Polyline2D");
+				}
+			}//for
+		}
+
+		if (pts.size()>0) {
+			List newPts = new ArrayList();
+			if ((flags & 0x1)==0x1) {
+				for (int j=0;j<pts.size();j++) {
+					newPts.add(pts.get(j));
+				}
+				newPts.add(pts.get(0));
+				bulges.add(new Double(0));
+			} else {
+				for (int j=0;j<pts.size();j++) {
+					newPts.add(pts.get(j));
+				}
+			}
+			double[] bs = new double[bulges.size()];
+			for (int j=0;j<bulges.size();j++) {
+				bs[j] = ((Double)bulges.get(j)).doubleValue();
+			}
+			setBulges(bs);
+			List points = GisModelCurveCalculator.
+			calculateGisModelBulge(newPts, bs);
+			setPts(points);
+		} else {
+			logger.warn("Encontrada polilínea sin puntos ...");
+			// TODO: No se debe mandar nunca una polil�nea sin puntos, si esto
+			// ocurre es porque existe un error que hay que corregir ...
+		}
+	}
+	//TODO Este metodo es antiguo y MUY INEFICIENTE
+	//No obstante lo dejo porque hace referencia a SeqEnd y a un posible bug
+	public void calculateGisModel(List dwgObjects) {
+		int flags = getFlags();
+//		En estas dos lineas de abajo y en el resto del metodo
+//		se mantiene el mecanismo anterior al refactoring.
+//		TODO: Pensar si deberiamos coger el handle completo.
+//		Tal vez deberiamos tomar el handle completo y evaluar
+//		a donde apuntan (pueden haber 2 handles con codigo y offset
+//		distintos y que, sin embargo apunten al mismo objeto).
+		int firstHandle = getFirstVertexHandle().getOffset();
+		int lastHandle = getLastVertexHandle().getOffset();
+		ArrayList pts = new ArrayList();
+		ArrayList bulges = new ArrayList();
+		double[] pt = new double[3];
+
+		//TODO Esto cambiarlo. Es lento y poco elegante
+
+		for (int j=0;j<dwgObjects.size();j++) {
+			DwgObject firstVertex = (DwgObject)dwgObjects.get(j);
+
+			if (firstVertex instanceof DwgVertex2D) {
+				int vertexHandle = firstVertex.getHandle().getOffset();
+				if (vertexHandle==firstHandle) {
+					int k=0;
+					while (true) {
+						DwgObject vertex = (DwgObject)dwgObjects.get(j+k);
+						int vHandle = vertex.getHandle().getOffset();
+						if (vertex instanceof DwgVertex2D) {
+							pt = ((DwgVertex2D)vertex).getPoint();
+							pts.add(new Point2D.Double(pt[0], pt[1]));
+							double bulge = ((DwgVertex2D)vertex).getBulge();
+							bulges.add(new Double(bulge));
+							k++;
+							if (vHandle==lastHandle && vertex instanceof DwgVertex2D) {
+								break;
+							}
+						} else if (vertex instanceof DwgSeqend) {
+                            // 051116, jmorell: Polil�neas_ACAD2000.dwg tiene un DwgSeqend en mitad de
+                            //una secuencia de v�rtices. Precauci�n con esto puesto que es posible que esta
+                            // condici�n fuera requerida en la carga de otros DWGs.
+                            //break;
+                            k++;
+						}
+					}//while
+				}//if first handle
+			}//if
+		}//for
+
+		if (pts.size()>0) {
+			List newPts = new ArrayList();
+			if ((flags & 0x1)==0x1) {
+				for (int j=0;j<pts.size();j++) {
+					newPts.add(pts.get(j));
+				}
+				newPts.add(pts.get(0));
+				bulges.add(new Double(0));
+			} else {
+				for (int j=0;j<pts.size();j++) {
+					newPts.add(pts.get(j));
+				}
+			}
+			double[] bs = new double[bulges.size()];
+			for (int j=0;j<bulges.size();j++) {
+				bs[j] = ((Double)bulges.get(j)).doubleValue();
+			}
+			setBulges(bs);
+			List points = GisModelCurveCalculator.
+					calculateGisModelBulge(newPts, bs);
+			setPts(points);
+		} else {
+//			System.out.println("Encontrada polil�nea sin puntos ...");
+			// TODO: No se debe mandar nunca una polil�nea sin puntos, si esto
+			// ocurre es porque existe un error que hay que corregir ...
+		}
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		  if(getPts() == null) {
+			return;
+		}
+		  List vertices = getPts();
+	      double[] polyline2DExt = getExtrusion();
+	      double elev = getElevation();
+	      double[][] polylinePoints3D = new double[vertices.size()][3];
+	      for (int j = 0;j < vertices.size(); j++) {
+	          polylinePoints3D[j][0] = ((double[])vertices.get(j))[0];
+	          polylinePoints3D[j][1] = ((double[])vertices.get(j))[1];
+	          polylinePoints3D[j][2] = elev;
+	          polylinePoints3D[j] = AcadExtrusionCalculator.extrude2(polylinePoints3D[j], polyline2DExt);
+	      }
+	      setElevation(elev);
+	      for (int j=0;j<vertices.size();j++) {
+	          vertices.add(new double[]{(polylinePoints3D[j])[0], (polylinePoints3D[j])[1]});
+	      }
+	      setPts(vertices);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getElevation() != 0.0);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		return getElevation();
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean)
+	 */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		return FMapUtil.ptsToLine(getPts(), getGeometrySubType(is3DFile));
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "Polyline2D";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks, DwgFile callBack) {
+
+		DwgPolyline2D transformedEntity = null;
+		List vertices = this.getPts();
+
+		if (vertices != null) {
+		    List transformedVertices = new ArrayList();
+			for (int i=0;i < vertices.size();i++) {
+				double[] pointAux = null;
+			    pointAux = new double[]{((double[]) vertices.get(i))[0] - bPoint[0],
+			    		((double[]) vertices.get(i))[1] - bPoint[1]};
+
+				double laX = insPoint.getX() + ((pointAux[0] * scale[0])*Math.cos(rot) + (pointAux[1]*scale[1])*(-1)*Math.sin(rot));
+				double laY = insPoint.getY() + ((pointAux[0]*scale[0])*Math.sin(rot) + (pointAux[1]*scale[1])*Math.cos(rot));
+				transformedVertices.add(new double[]{laX, laY});
+			}//for
+			transformedEntity = (DwgPolyline2D)this.clone();
+			transformedEntity.setPts(transformedVertices);
+			transformedEntity.setElevation((this.getElevation() * scale[2]));
+			dwgObjectsWithoutBlocks.add(transformedEntity);
+			handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+		}
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgPolyline2D obj = new DwgPolyline2D(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgPolyline2D myObj = (DwgPolyline2D)obj;
+
+		myObj.setBulges(bulges);
+		myObj.setCurveType(curveType);
+		myObj.setElevation(elevation);
+		myObj.setEndWidth(endWidth);
+		myObj.setExtrusion(extrusion);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setFlags(flags);
+		myObj.setInitWidth(initWidth);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setPts(vertices);
+		myObj.setSeqendHandle(seqendHandle);
+		myObj.setThickness(thickness);
+
+	}
+	public void addVertex(IDwgVertex vertex) {
+		vertices.add(vertex.getPoint());
+	}
+
+	public int getGeometrySubType(boolean is3DFile) {
+		return Geometry.SUBTYPES.GEOM2D;
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.MULTICURVE;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImage.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImage.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgImage.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgImage extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgImage(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgImage obj = new DwgImage(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgImage myObj = (DwgImage)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline3D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline3D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline3D.java	(revision 435)
@@ -0,0 +1,510 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+
+/**
+ * The DwgPolyline3D class represents a DWG Polyline3D
+ *
+ * @author jmorell
+ */
+public class DwgPolyline3D extends DwgObject
+	implements IDwgPolyline, IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+
+	private int splineFlags;
+	private int closedFlags;
+	private DwgHandleReference firstVertexHandle = null;
+	private DwgHandleReference lastVertexHandle = null;
+	private DwgHandleReference seqendHandle = null;
+	private ArrayList vertexHandles;
+	private List vertices;
+	private double[] bulges;
+
+	private static Logger logger = LoggerFactory.getLogger(DwgPolyline3D.class.getName());
+
+	public DwgPolyline3D(int index) {
+		super(index);
+		vertices = new ArrayList();
+		vertexHandles = new ArrayList();
+	}
+
+
+	/**
+	 * @return Returns the closedFlags.
+	 */
+	public int getClosedFlags() {
+		return closedFlags;
+	}
+	/**
+	 * @param closedFlags The closedFlags to set.
+	 */
+	public void setClosedFlags(int closedFlags) {
+		this.closedFlags = closedFlags;
+	}
+	/**
+	 * @return Returns the firstVertexHandle.
+	 */
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+	/**
+	 * @param firstVertexHandle The firstVertexHandle to set.
+	 */
+	public void setFirstVertexHandle(DwgHandleReference firstVertexHandle) {
+		this.firstVertexHandle = firstVertexHandle;
+	}
+	/**
+	 * @return Returns the lastVertexHandle.
+	 */
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+	/**
+	 * @param lastVertexHandle The lastVertexHandle to set.
+	 */
+	public void setLastVertexHandle(DwgHandleReference lastVertexHandle) {
+		this.lastVertexHandle = lastVertexHandle;
+	}
+	/**
+	 * @return Returns the pts.
+	 */
+	public List getPts() {
+		return vertices;
+	}
+	/**
+	 * @param pts The pts to set.
+	 */
+	public void setPts(List pts) {
+		this.vertices = pts;
+	}
+	/**
+	 * @return Returns the bulges.
+	 */
+	public double[] getBulges() {
+		return bulges;
+	}
+	/**
+	 * @param bulges The bulges to set.
+	 */
+	public void setBulges(double[] bulges) {
+		this.bulges = bulges;
+	}
+
+	/**
+	 * @return Returns the seqendHandle.
+	 */
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+	/**
+	 * @param seqendHandle The seqendHandle to set.
+	 */
+	public void setSeqendHandle(DwgHandleReference seqendHandle) {
+		this.seqendHandle = seqendHandle;
+	}
+	/**
+	 * @return Returns the splineFlags.
+	 */
+	public int getSplineFlags() {
+		return splineFlags;
+	}
+	/**
+	 * @param splineFlags The splineFlags to set.
+	 */
+	public void setSplineFlags(int splineFlags) {
+		this.splineFlags = splineFlags;
+	}
+
+	public void calculateGisModel(DwgFile dwgFile){
+		ArrayList pts = new ArrayList();
+		double[] pt = new double[3];
+
+		int closedFlags = getClosedFlags();
+		if(dwgFile.getDwgVersion().equalsIgnoreCase("Autocad R2004, R2005, R2006")){
+			ArrayList vertexHandles = getVertexHandles();
+			DwgObject seqend = null;
+			for (int i=0; i<vertexHandles.size(); i++){
+				DwgHandleReference vertice = (DwgHandleReference)vertexHandles.get(i);
+				DwgObject objVertex = dwgFile.getDwgObjectFromHandle(vertice.getOffset());
+				if (objVertex != null){
+					if (objVertex instanceof DwgVertex3D) {
+						pts.add(((DwgVertex3D)objVertex).getPoint());
+					} else {
+						logger.warn("Encontrado un "+objVertex.getClass().getName()+" " +
+								"con indice "+i+" en la lista de vertices de Polyline3D");
+					}
+				} else {
+					logger.warn("No se ha encontrado el vertice "+i+" de "+vertexHandles.size()
+							+" de la Polyline3D "+this.getIndex());
+					if (i==0){
+						seqend = dwgFile.getDwgObjectFromHandle(seqendHandle.getOffset());
+					}
+				}
+			}
+			if(seqend != null){
+				if (seqend instanceof DwgVertex3D) {
+					pts.add(((DwgVertex3D)seqend).getPoint());
+				} else {
+					logger.warn("Encontrado un "+seqend.getClass().getName()+" en seqend de Polyline3D "+
+							this.getIndex()+" cuando debería ser un DwgVertex3D");
+				}
+			}
+
+		} else {
+			DwgHandleReference firstHandle = getFirstVertexHandle();
+			DwgHandleReference lastHandle = getLastVertexHandle();
+			double bulge = 0d;
+
+			DwgObject first = dwgFile.getDwgObjectFromHandle(firstHandle.getOffset());
+			DwgObject last = dwgFile.getDwgObjectFromHandle(lastHandle.getOffset());
+			DwgObject seqend = dwgFile.getDwgObjectFromHandle(seqendHandle.getOffset());
+			if(last == null){
+				logger.warn("Polyline3D con vertice final a null");
+				return;
+			}
+			if(first == null){
+				logger.warn("Polyline3D con offset = "+this.getHandle().getOffset() +" con vertice inicial a null");
+				if(seqend != null){
+					first = last;
+					last = seqend;
+				} else {
+					logger.warn("Polyline3D con vertice seqend a null");
+				}
+			}
+
+			if(!(first instanceof DwgVertex3D)){
+				logger.warn("El primer vertice de Polyline3D es "+
+						first.getClass().getName());
+				return;
+			}
+
+			if(!(last instanceof DwgVertex3D)){
+				logger.warn("El ultimo vertice de Polyline3D es "+
+						last.getClass().getName());
+				return;
+			}
+
+			int firstObjIdx = dwgFile.getIndexOf(first);
+			int lastObjIdx =  dwgFile.getIndexOf(last);
+			if(firstObjIdx == -1 || lastObjIdx == -1){
+				logger.warn("Calculate GIS Model: Problemas en la LinkedList: 1º="+firstObjIdx+",Ultimo="+lastObjIdx);
+				return;
+			}
+
+			for(int i = firstObjIdx; i <= lastObjIdx; i++){
+				DwgObject obj = dwgFile.getDwgObject(i);
+				if(obj instanceof DwgVertex3D){
+					DwgVertex3D vertex = (DwgVertex3D) obj;
+					pt = (vertex).getPoint();
+					pts.add(new double[]{pt[0], pt[1], pt[2]});
+				}else if(obj instanceof DwgSeqend){
+					//TODO En Polyline2D J.Morell no interrumpia el barrido,
+					//pero aquí Sí. REVISAR
+					break;
+				}else{
+					logger.warn("Encontrado "+obj.getClass().getName()+" en la lista de vertices de Polyline3D");
+				}
+			}//for
+		}
+		if (pts.size()>0) {
+			List newPts = new ArrayList();
+			for (int j=0;j<pts.size();j++) {
+				newPts.add(pts.get(j));
+			}
+			if ((closedFlags & 0x1)== 0x1) {
+
+				newPts.add(pts.get(0));
+			}
+			setPts(newPts);
+		} else {
+			logger.warn("Encontrada polilínea sin puntos ...");
+			// TODO: No se debe mandar nunca una polilínea sin puntos, si esto
+			// ocurre es porque existe un error que hay que corregir ...
+		}
+
+	}
+
+	//TODO Metodo antiguo y muy ineficiente. Se deja hasta que se
+	//revise que funciona el nuevo perfectamente
+	public void calculateGisModel(List dwgObjects) {
+		int closedFlags = getClosedFlags();
+
+//		En estas dos lineas de abajo y en el resto del metodo
+//		se mantiene el mecanismo anterior al refactoring.
+//		TODO: Pensar si deberiamos coger el handle completo.
+//		Tal vez deberiamos tomar el handle completo y evaluar
+//		a donde apuntan (pueden haber 2 handles con codigo y offset
+//		distintos y que, sin embargo apunten al mismo objeto).
+
+		int firstHandle = getFirstVertexHandle().getOffset();
+		int lastHandle = getLastVertexHandle().getOffset();
+		ArrayList pts = new ArrayList();
+		double[] pt = new double[3];
+
+		//TODO Sustituir esto por un hashtable handle->DwgObject
+		for (int j=0;j< dwgObjects.size();j++) {
+			DwgObject firstVertex = (DwgObject)dwgObjects.get(j);
+			if (firstVertex instanceof DwgVertex3D) {
+				int vertexHandle = firstVertex.getHandle().getOffset();
+				if (vertexHandle==firstHandle) {
+					int k=0;
+					while (true) {
+						DwgObject vertex = (DwgObject)dwgObjects.get(j+k);
+						int vHandle = vertex.getHandle().getOffset();
+						if (vertex instanceof DwgVertex3D) {
+							pt = ((DwgVertex3D)vertex).getPoint();
+							pts.add(new double[]{pt[0], pt[1], pt[2]});
+							k++;
+							if (vHandle==lastHandle && vertex instanceof DwgVertex3D) {
+								break;
+							}
+						} else if (vertex instanceof DwgSeqend) {
+							break;
+						}//if
+					}//while
+				}//if
+			}//if
+		}//for
+
+		if (pts.size()>0) {
+			List newPts = new ArrayList();
+			for (int j=0;j<pts.size();j++) {
+				newPts.add(pts.get(j));
+			}
+			if ((closedFlags & 0x1)==0x1) {
+				newPts.add(pts.get(0));
+			}
+			setPts(newPts);
+		} else {
+//			System.out.println("Encontrada polilinea sin puntos ...");
+			// TODO: No se debe mandar nunca una polilinea sin puntos, si esto
+			// ocurre es porque existe un error que hay que corregir ...
+		}
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+
+		List pts = getPts();
+		if(pts == null) {
+			return false;
+		}
+		double z = 0d;
+	    for (int j = 0; j<pts.size(); j++) {
+	        z = ((double[])pts.get(j))[2];
+			if (z != 0.0) {
+				return true;
+			}
+	    }
+	    return false;
+
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		List points3D = getPts();
+		if (points3D != null) {
+			boolean constantElevation = true;
+			double[] firstPt = (double[]) points3D.get(0);
+			for (int j = 0; j < points3D.size(); j++) {
+				double[] pt = (double[]) points3D.get(j);
+				if (pt[2] != firstPt[2]) {
+					constantElevation = false;
+					break;
+				}
+			}
+			if (constantElevation) {
+				return firstPt[2];
+			}
+		}
+		return 0d;
+	}
+
+	public double[] getPZ() {
+		List points3D = getPts();
+		if (points3D != null) {
+			double [] pZ = new double[points3D.size()];
+			for (int i = 0; i < points3D.size(); i++) {
+				double[] pt = (double[]) points3D.get(i);
+				pZ[i] = pt[2];
+			}
+			return pZ;
+		}
+		return new double[] {0};
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean)
+	 */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		return FMapUtil.ptsToLine(getPts(), getGeometrySubType(is3DFile));
+	}
+//	public Geometry toFMapGeometry_old(boolean is3DFile) {
+//		FPolyline2D pline = null;
+//		List points3D = getPts();
+//		if (points3D != null && points3D.size() > 0) {
+//			if (is3DFile) {
+//				pline = FMapUtil.points3DToFPolyline3D(points3D);
+//			} else {
+//				List points2D = new ArrayList();
+//				for (int j = 0; j < points3D.size(); j++) {
+//					double[] pt3d = (double[]) points3D.get(j);
+//					double[] pt  = new double[]{pt3d[0],
+//							pt3d[1]};
+//					points2D.add(pt);
+//				}
+//				pline = FMapUtil.points2DToFPolyline2D(points2D);
+//			}//if
+//			return  ShapeFactory.createGeometry(pline);
+//		}//if
+//		return null;
+//
+//	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "Polyline3D";
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgPolyline3D obj = new DwgPolyline3D(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgPolyline3D myObj = (DwgPolyline3D)obj;
+
+		myObj.setBulges(bulges);
+		myObj.setClosedFlags(closedFlags);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setPts(vertices);
+		myObj.setSeqendHandle(seqendHandle);
+		myObj.setSplineFlags(splineFlags);
+	}
+	public void addVertex(IDwgVertex vertex) {
+		vertices.add(vertex.getPoint());
+	}
+
+	//TODO Por qué Polyline3D no tenía implementado el transform2Block???
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks, DwgFile callBack) {
+
+		DwgPolyline3D transformedEntity = null;
+		List vertices = this.getPts();
+
+		if (vertices != null) {
+		    List transformedVertices = new ArrayList();
+			for (int i=0;i < vertices.size();i++) {
+				double[] pointAux = null;
+			    pointAux = new double[]{((double[]) vertices.get(i))[0] - bPoint[0],
+			    		((double[]) vertices.get(i))[1] - bPoint[1]};
+
+				double laX = insPoint.getX() + ((pointAux[0] * scale[0])*Math.cos(rot) + (pointAux[1]*scale[1])*(-1)*Math.sin(rot));
+				double laY = insPoint.getY() + ((pointAux[0]*scale[0])*Math.sin(rot) + (pointAux[1]*scale[1])*Math.cos(rot));
+				double laZ = ((double[]) vertices.get(i))[2] - bPoint[2];
+				transformedVertices.add(new double[]{laX, laY, laZ});
+			}//for
+			transformedEntity = (DwgPolyline3D)this.clone();
+			transformedEntity.setPts(transformedVertices);
+			dwgObjectsWithoutBlocks.add(transformedEntity);
+			handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+		}
+	}
+
+	/**
+	 * @param Handles The vertexHandles to set.
+	 */
+	public void setVertexHandles(ArrayList Handles){
+		this.vertexHandles = Handles;
+	}
+
+	/**
+	 * @return Returns the vertexHandles.
+	 */
+	public ArrayList getVertexHandles(){
+		return this.vertexHandles;
+	}
+	/**
+	 * @param Handle The vertexHandles to add.
+	 */
+	public void addVertexHandle(DwgHandleReference handle){
+		this.vertexHandles.add(handle);
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.MULTICURVE;
+	}
+
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgText.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgText.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgText.java	(revision 435)
@@ -0,0 +1,379 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+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.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgText class represents a DWG Text
+ *
+ * @author jmorell
+ */
+public class DwgText extends DwgObject
+					implements IDwgExtrusionable,
+					IDwg3DTestable,
+					IDwg2FMap,
+					IDwgBlockMember{
+	public DwgText(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private int dataFlag;
+	private double elevation;
+	private Point2D insertionPoint;
+	private Point2D alignmentPoint;
+	private double[] extrusion;
+	private double thickness;
+	private double obliqueAngle;
+	private double rotationAngle;
+	private double height;
+	private double widthFactor;
+	private String text;
+	private int generation;
+	private int halign;
+	private int valign;
+	private DwgHandleReference styleHdl;
+
+	/**
+	 * @return Returns the dataFlag.
+	 */
+	public int getDataFlag() {
+		return dataFlag;
+	}
+	/**
+	 * @param dataFlag The dataFlag to set.
+	 */
+	public void setDataFlag(int dataFlag) {
+		this.dataFlag = dataFlag;
+	}
+	/**
+	 * @return Returns the height.
+	 */
+	public double getHeight() {
+		return height;
+	}
+	/**
+	 * @param height The height to set.
+	 */
+	public void setHeight(double height) {
+		this.height = height;
+	}
+	/**
+	 * @return Returns the insertionPoint.
+	 */
+	public Point2D getInsertionPoint() {
+		return insertionPoint;
+	}
+	/**
+	 * @param insertionPoint The insertionPoint to set.
+	 */
+	public void setInsertionPoint(Point2D insertionPoint) {
+		this.insertionPoint = insertionPoint;
+	}
+	/**
+	 * @return Returns the rotationAngle.
+	 */
+	public double getRotationAngle() {
+		return rotationAngle;
+	}
+
+	public double getRotationAngleInDegrees(){
+		int dflag = getDataFlag();
+		if ((dflag & 0x8) == 0) {
+			double textRot = getRotationAngle();
+			return Math.toDegrees(textRot);
+		} else {
+			return 0d;
+		}
+	}
+	/**
+	 * @param rotationAngle The rotationAngle to set.
+	 */
+	public void setRotationAngle(double rotationAngle) {
+		this.rotationAngle = rotationAngle;
+	}
+	/**
+	 * @return Returns the text.
+	 */
+	public String getText() {
+		return text;
+	}
+	/**
+	 * @param text The text to set.
+	 */
+	public void setText(String text) {
+		this.text = text;
+	}
+	/**
+	 * @return Returns the elevation.
+	 */
+	public double getElevation() {
+		return elevation;
+	}
+	/**
+	 * @param elevation The elevation to set.
+	 */
+	public void setElevation(double elevation) {
+		this.elevation = elevation;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+
+	/**
+	 * @return Returns the alignmentPoint.
+	 */
+	public Point2D getAlignmentPoint() {
+		return alignmentPoint;
+	}
+	/**
+	 * @param alignmentPoint The alignmentPoint to set.
+	 */
+	public void setAlignmentPoint(Point2D alignmentPoint) {
+		this.alignmentPoint = alignmentPoint;
+	}
+	/**
+	 * @return Returns the generation.
+	 */
+	public int getGeneration() {
+		return generation;
+	}
+	/**
+	 * @param generation The generation to set.
+	 */
+	public void setGeneration(int generation) {
+		this.generation = generation;
+	}
+	/**
+	 * @return Returns the halign.
+	 */
+	public int getHalign() {
+		return halign;
+	}
+	/**
+	 * @param halign The halign to set.
+	 */
+	public void setHalign(int halign) {
+		this.halign = halign;
+	}
+	/**
+	 * @return Returns the obliqueAngle.
+	 */
+	public double getObliqueAngle() {
+		return obliqueAngle;
+	}
+	/**
+	 * @param obliqueAngle The obliqueAngle to set.
+	 */
+	public void setObliqueAngle(double obliqueAngle) {
+		this.obliqueAngle = obliqueAngle;
+	}
+	/**
+	 * @return Returns the valign.
+	 */
+	public int getValign() {
+		return valign;
+	}
+	/**
+	 * @param valign The valign to set.
+	 */
+	public void setValign(int valign) {
+		this.valign = valign;
+	}
+	/**
+	 * @return Returns the widthFactor.
+	 */
+	public double getWidthFactor() {
+		return widthFactor;
+	}
+	/**
+	 * @param widthFactor The widthFactor to set.
+	 */
+	public void setWidthFactor(double widthFactor) {
+		this.widthFactor = widthFactor;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 Point2D tpoint = getInsertionPoint();
+         double elev = getElevation();
+         double[] textPoint = new double[]{tpoint.getX(), tpoint.getY(), elev};
+         double[] textExt = getExtrusion();
+         textPoint = AcadExtrusionCalculator.extrude2(textPoint, textExt);
+         setInsertionPoint(new Point2D.Double(textPoint[0], textPoint[1]));
+         setElevation(elev);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getElevation() !=0.0);
+	}
+	public double getZ() {
+		return getElevation();
+	}
+	public Geometry toFMapGeometry(boolean is3DFile)
+			throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		Point2D p = getInsertionPoint();
+		double elev = 0.0;
+		if ((getDataFlag() & 0x1) == 0) {
+			elev = getElevation();
+		}
+		Point point = (Point) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		point.setX(p.getX());
+		point.setY(p.getY());
+		if (is3DFile) {
+			point.setCoordinateAt(2, elev);
+
+		}
+		return point;
+	}
+
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPoint3D";
+		} else {
+			return "FPoint2D";
+		}
+	}
+	public String toString(){
+		return "Text";
+	}
+	/**
+	 * @param styleHdl
+	 */
+	public void setStyleHandle(DwgHandleReference styleHdl) {
+		this.styleHdl = styleHdl;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgText obj = new DwgText(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgText myObj = (DwgText)obj;
+
+		myObj.setAlignmentPoint(alignmentPoint);
+		myObj.setDataFlag(dataFlag);
+		myObj.setElevation(elevation);
+		myObj.setExtrusion(extrusion);
+		myObj.setGeneration(generation);
+		myObj.setHalign(halign);
+		myObj.setHeight(height);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setObliqueAngle(obliqueAngle);
+		myObj.setRotationAngle(rotationAngle);
+		myObj.setStyleHandle(styleHdl);
+		myObj.setText(text);
+		myObj.setThickness(thickness);
+		myObj.setValign(valign);
+		myObj.setWidthFactor(widthFactor);
+	}
+
+	//TODO Implement
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot, List dwgObjectsWithoutBlocks, Map handle_objectsWithoutBlocks, DwgFile callBack) {
+		 Point2D pointAux = new Point2D.Double(insertionPoint.getX() - bPoint[0],
+				 insertionPoint.getY() - bPoint[1]);
+		 double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		 double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+
+		 Point2D.Double newInsertionPoint = new Point2D.Double(laX, laY);
+		 DwgText transformedEntity = (DwgText) this.clone();
+		 transformedEntity.setInsertionPoint(newInsertionPoint);
+
+		 if(alignmentPoint != null){
+			 pointAux = new Point2D.Double(alignmentPoint.getX() - bPoint[0],
+					 alignmentPoint.getY() - bPoint[1]);
+			 laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+			 laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+			 Point2D.Double newAlignPoint = new Point2D.Double(laX, laY);
+			 transformedEntity.setAlignmentPoint(newAlignPoint);
+		 }
+		 //TODO Transformar el resto de parametros en base a los datos del bloque
+		 //altura, etc.
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.POINT;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialIndex.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialIndex.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSpatialIndex.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSpatialIndex extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgSpatialIndex(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgSpatialIndex obj = new DwgSpatialIndex(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgSpatialIndex myObj = (DwgSpatialIndex)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLine.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLine.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLine.java	(revision 435)
@@ -0,0 +1,302 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+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.fmap.geom.primitive.Curve;
+import org.gvsig.fmap.geom.primitive.Line;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgLine class represents a DWG Line
+ *
+ * @author jmorell, azabala
+ */
+public class DwgLine extends DwgObject
+	implements /*IDwgExtrusionable,*/ IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+	public DwgLine(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private double[] p1;
+	private double[] p2;
+	private double thickness;
+	private double[] extrusion;
+	private boolean zflag = false;
+
+	/**
+	 * @return Returns the p1.
+	 */
+	public double[] getP1() {
+		return p1;
+	}
+	/**
+	 * @param p1 The p1 to set.
+	 */
+	public void setP1(double[] p1) {
+		this.p1 = p1;
+	}
+	/**
+	 * @return Returns the p2.
+	 */
+	public double[] getP2() {
+		return p2;
+	}
+	/**
+	 * @param p2 The p2 to set.
+	 */
+	public void setP2(double[] p2) {
+		this.p2 = p2;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+//	public Object clone() {
+//		DwgLine dwgLine = new DwgLine(index);
+//		dwgLine.setType(type);
+//		dwgLine.setHandle(handle);
+//		dwgLine.setVersion(version);
+//		dwgLine.setMode(mode);
+//		dwgLine.setLayerHandle(layerHandle);
+//		dwgLine.setColor(color);
+//		dwgLine.setNumReactors(numReactors);
+//		dwgLine.setNoLinks(noLinks);
+//		dwgLine.setLinetypeFlags(linetypeFlags);
+//		dwgLine.setPlotstyleFlags(plotstyleFlags);
+//		dwgLine.setSizeInBits(sizeInBits);
+//		dwgLine.setExtendedData(extendedData);
+//		dwgLine.setGraphicData(graphicData);
+//		//dwgLine.setInsideBlock(insideBlock);
+//		dwgLine.setP1(p1);
+//		dwgLine.setP2(p2);
+//		dwgLine.setThickness(thickness);
+//		dwgLine.setExtrusion(extrusion);
+//		dwgLine.setSubEntityHandle(subEntityHandle);
+//		return dwgLine;
+//	}
+    /**
+     * @return Returns the zflag.
+     */
+    public boolean isZflag() {
+        return zflag;
+    }
+    /**
+     * @param zflag The zflag to set.
+     */
+    public void setZflag(boolean zflag) {
+        this.zflag = zflag;
+    }
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] lineP1 = getP1();
+         double[] lineP2 = getP2();
+         boolean zflag = isZflag();
+         if (zflag) {
+             // elev = 0.0;
+             lineP1 = new double[]{lineP1[0], lineP1[1], 0.0};
+             lineP2 = new double[]{lineP2[0], lineP2[1], 0.0};
+         }
+         double[] lineExt = getExtrusion();
+         lineP1 = AcadExtrusionCalculator.extrude2(lineP1, lineExt);
+         lineP2 = AcadExtrusionCalculator.extrude2(lineP2, lineExt);
+         setP1(lineP1);
+         setP2(lineP2);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+	  if (!isZflag()) {
+		double z1 = getP1()[2];
+		double z2 = getP2()[2];
+		if (z1!=0.0 || z2!=0.0) {
+			return  true;
+		}
+	  }//TODO y si zflag vale true? REVISAR
+	  return false;
+	}
+	public double getZ() {
+		double[] p1 = getP1();
+		double[] p2 = getP2();
+		if(isZflag()){
+			if (p1[2] == p2[2]) {
+				return p1[2];
+			} else {
+				return 0d;
+			}
+		} else {
+				return 0d;
+		}
+	}
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+                Line line;
+                if( is3DFile ) {
+                    line = gMan.createLine(Geometry.SUBTYPES.GEOM3D);
+                    line.addVertex(p1[0],p1[1],p1[2]);
+                    line.addVertex(p2[0],p2[1],p2[2]);
+                } else {
+                    line = gMan.createLine(Geometry.SUBTYPES.GEOM2D);
+                    line.addVertex(p1[0],p1[1]);
+                    line.addVertex(p2[0],p2[1]);
+                }
+                return line;
+
+	}
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile){
+			return "FPolyline3D";
+		}else{
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "Line";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks,
+			DwgFile callBack) {
+		DwgLine transformedEntity = null;
+		double[] p1 = this.getP1();
+		if(p1.length < 3)
+		{
+			double[] newp1 = new double[3];
+			System.arraycopy(p1, 0, newp1, 0, p1.length);
+			p1 = newp1;
+			setP1(newp1);
+		}
+		double[] p2 = this.getP2();
+		if(p2.length < 3)
+		{
+			double[] newp2 = new double[3];
+			System.arraycopy(p2, 0, newp2, 0, p2.length);
+			p2 = newp2;
+			setP2(newp2);
+		}
+		Point2D pointAux = new Point2D.Double(p1[0] - bPoint[0], p1[1] - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double[] transformedP1 = null;
+        if (this.isZflag() ) {
+			double laZ = p1[2] * scale[2];
+			transformedP1 = new double[]{laX, laY, laZ};
+		} else {
+			transformedP1 = new double[]{laX, laY, 0d};
+		}
+		//double[] transformedP1 = new double[]{laX, laY};
+		pointAux = new Point2D.Double(p2[0] - bPoint[0], p2[1] - bPoint[1]);
+		laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+        double[] transformedP2 = null;
+		if (this.isZflag() ) {
+			double laZ = p2[2] * scale[2];
+			transformedP2 = new double[]{laX, laY, laZ};
+		} else {
+			transformedP2 = new double[]{laX, laY, 0d};
+		}
+		//double[] transformedP2 = new double[]{laX, laY};
+		transformedEntity = (DwgLine)this.clone();
+		transformedEntity.setP1(transformedP1);
+		transformedEntity.setP2(transformedP2);
+		dwgObjectsWithoutBlocks.add(transformedEntity);
+		handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+//		dwgObjectsWithoutBlocks.add(this);
+	}
+	public Object clone(){
+		DwgLine dwgLine = new DwgLine(index);
+		this.fill(dwgLine);
+		return dwgLine;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgLine myObj = (DwgLine)obj;
+
+		myObj.setExtrusion(extrusion);
+		myObj.setP1(p1);
+		myObj.setP2(p2);
+		myObj.setThickness(thickness);
+
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.CURVE;
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSortEntStable.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSortEntStable.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSortEntStable.java	(revision 435)
@@ -0,0 +1,65 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgSortEntStable extends DwgObject {
+
+	private DwgHandleReference[] handles;
+	private DwgHandleReference[] objHandles;
+	private DwgHandleReference parentHdl;
+
+	/**
+	 * @param index
+	 */
+	public DwgSortEntStable(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @param handles
+	 */
+	public void setSortedHandles(DwgHandleReference[] handles) {
+		this.handles = handles;
+	}
+
+	/**
+	 * @param handles2
+	 */
+	public void setObjHandles(DwgHandleReference[] handles2) {
+		this.objHandles = handles2;
+	}
+
+	/**
+	 * @param handle
+	 */
+	public void setParentHandle(DwgHandleReference handle) {
+		this.parentHdl = handle;
+	}
+	public Object clone(){
+		DwgSortEntStable obj = new DwgSortEntStable(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgSortEntStable myObj = (DwgSortEntStable)obj;
+
+		myObj.setObjHandles(objHandles);
+		myObj.setParentHandle(parentHdl);
+		myObj.setSortedHandles(handles);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgRasterVariables.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgRasterVariables.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgRasterVariables.java	(revision 435)
@@ -0,0 +1,36 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * @author alzabord
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DwgRasterVariables extends DwgObject {
+
+	/**
+	 * @param index
+	 */
+	public DwgRasterVariables(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgRasterVariables obj = new DwgRasterVariables(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgRasterVariables myObj = (DwgRasterVariables)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFacePolyline.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFacePolyline.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPFacePolyline.java	(revision 435)
@@ -0,0 +1,452 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+ *
+ * $Id: DwgPFacePolyline.java 34887 2011-04-04 12:19:30Z jpiera $
+ * $Log$
+ * Revision 1.3.2.1  2007-03-21 19:49:16  azabala
+ * implementation of dwg 12, 13, 14.
+ *
+ * Revision 1.3  2007/03/20 19:57:08  azabala
+ * source code cleaning
+ *
+ * Revision 1.2  2007/03/06 19:39:38  azabala
+ * Changes to adapt dwg 12 to general architecture
+ *
+ * Revision 1.1  2007/03/01 19:58:53  azabala
+ * refactor of pface and mesh names
+ *
+ * Revision 1.2  2007/02/07 12:44:27  fdiaz
+ * A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+ * A�adido el metodo fill.
+ *
+ * Revision 1.1  2007/02/05 07:03:22  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgPolyline;
+import org.gvsig.dwg.lib.IDwgVertex;
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.aggregate.MultiSurface;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+
+/**
+ * This DWG entity is a "Polyface Mesh".
+ *
+ */
+
+/*
+ * azabala DXF 12 spec says: "If the Vertex defines a face of the mesh, its
+ * Vertex flags (70) group has the 128 bit set but not the 64 bit. The 10, 20,
+ * and 30 (location) groups of the face entity are irrelevant and are always
+ * written as zero in a DXF file.
+ *
+ * The vertex indexes that define the mesh are given by 71, 72, 73, and 74
+ * groups, the values of which are integers specifying one of the previously
+ * defined vertices by index.
+ *
+ * If the index is negative, the edge that begins with that vertex is invisible.
+ *
+ * The first zero vertex marks the end of the vertices of the face.
+ *
+ * Since the 71 through 74 groups are optional fields with default values of
+ * zero, they are present in DXF only if nonzero."
+ *
+ * But DWG 12 spec doesnt say anything about 71,72,73 and 74 fields for VERTEX.
+ */
+public class DwgPFacePolyline extends DwgObject
+	implements IDwgPolyline, IDwg2FMap, IDwgBlockMember{
+
+	private static Logger logger = LoggerFactory.getLogger(DwgPFacePolyline.class.getName());
+
+	public static final int NUM_VERTEX_OF_FACE = 4;
+
+
+	/**
+	 * number of vertices in the mesh (as it is readed from the dwg file... very
+	 * often is wrong)
+	 */
+	private int vertexCount;
+	/**
+	 * number of faces of the mesh (as it is readed from the dwg file... very
+	 * often is wrong)
+	 */
+	private int faceCount;
+
+
+	private DwgHandleReference firstVertexHandle;
+	private DwgHandleReference lastVertexHandle;
+	private DwgHandleReference seqendHandle;
+
+	/**
+	 * Collection of all the vertices of the polyface mesh
+	 */
+	private List vertices;
+	/**
+	 * Collection of all the faces of the polyface mesh, whose vertices are in
+	 * vertices List.
+	 */
+	private List faces;
+
+	private ArrayList ownedObjectsHandles; //For R2004+
+
+
+	/**
+	 * Constructor
+	 */
+	public DwgPFacePolyline(int index) {
+		super(index);
+		vertices = new ArrayList();
+		faces = new ArrayList();
+		ownedObjectsHandles = new ArrayList();
+	}
+
+	public void setVertexCount(int vertexCount) {
+		this.vertexCount = vertexCount;
+	}
+
+	public void setFaceCount(int faceCount) {
+		this.faceCount = faceCount;
+	}
+
+	public void setFirstVertexHandle(DwgHandleReference handle) {
+		this.firstVertexHandle = handle;
+	}
+
+	public void setLastVertexHandle(DwgHandleReference handle) {
+		this.lastVertexHandle = handle;
+	}
+
+	public void setSeqendHandle(DwgHandleReference handle) {
+		this.seqendHandle = handle;
+	}
+
+	public int getFaceCount() {
+		return faceCount;
+	}
+
+	public DwgHandleReference getFirstVertexHandle() {
+		return firstVertexHandle;
+	}
+
+	public DwgHandleReference getLastVertexHandle() {
+		return lastVertexHandle;
+	}
+
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+
+	public int getVertexCount() {
+		return vertexCount;
+	}
+
+	public Object clone(){
+		DwgPFacePolyline obj = new DwgPFacePolyline(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgPFacePolyline myObj = (DwgPFacePolyline)obj;
+		myObj.setFaceCount(faceCount);
+		myObj.setFirstVertexHandle(firstVertexHandle);
+		myObj.setLastVertexHandle(lastVertexHandle);
+		myObj.setSeqendHandle(seqendHandle);
+		myObj.setVertexCount(vertexCount);
+		myObj.setVertices(this.vertices);
+		myObj.setFaces(this.faces);
+
+	}
+
+	public void setFaces(List faces) {
+		this.faces = faces;
+	}
+
+	public List getFaces(){
+		return this.faces;
+	}
+
+	public List getVertices() {
+		return vertices;
+	}
+
+	public void setVertices(List vertices) {
+		this.vertices = vertices;
+	}
+
+	/**
+	 * @return Returns the owned objects handles.
+	 */
+	public ArrayList getOwnedObjectsHandles() {
+		return ownedObjectsHandles;
+	}
+	/**
+	 * @param objects The owned objects handles to set.
+	 */
+	public void setOwnedObjectsHandles(ArrayList handles) {
+		this.ownedObjectsHandles = handles;
+	}
+	/**
+	 * Add a handle to the ownedBbjectsHandle vector
+	 *
+	 * @param handle handle
+	 */
+	public void addOwnedObjectHandle(DwgHandleReference handle) {
+		this.ownedObjectsHandles.add(handle);
+	}
+
+	public void calculateGisModel(DwgFile dwgFile) {
+	// In DWG 13, 14 and 2000 version, a Polyface mesh has
+    // handles references to its vertices.
+	// In DWG 12 vertices are after the entity
+	 if(firstVertexHandle != null && lastVertexHandle != null){
+		 	DwgObject first = dwgFile.getDwgObjectFromHandle(firstVertexHandle.getOffset());
+			DwgObject last = dwgFile.getDwgObjectFromHandle(lastVertexHandle.getOffset());
+			if(first == null || last == null){
+				logger.warn("DwgPFacePolyline con vertices inicial o final a null");
+				return;
+			}
+
+			if(!(first instanceof IDwgVertex)){
+				logger.warn("El primer vertice de PFacePolyline es "+
+								first.getClass().getName());
+				return;
+			}
+
+			if(!(last instanceof IDwgVertex)){
+				logger.warn("El ultimo vertice de PFacePolyline es "+
+						last.getClass().getName());
+				return;
+			}
+
+			 int firstObjIdx = dwgFile.getIndexOf(first);
+			 int lastObjIdx =  dwgFile.getIndexOf(last);
+			 if(firstObjIdx == -1 || lastObjIdx == -1){
+				 logger.warn("Calculate GIS Model: Problemas en "+
+						 "la localizacion de vertices: primero ="
+						 	+firstObjIdx+
+						 	",Ultimo ="+lastObjIdx);
+				 return;
+			 }
+			 for(int i = firstObjIdx; i <= lastObjIdx; i++){
+				 DwgObject obj = dwgFile.getDwgObject(i);
+				 if(obj instanceof IDwgVertex){
+				 	this.addVertex((IDwgVertex)obj);
+				 }else if(obj instanceof DwgSeqend){
+				 	// TODO SEE IF BREAK THE ITERATION
+				 	break;
+				 }else{
+					 logger.warn("Encontrado "+obj.getClass().getName()+" en la lista de vertices de Polyline3D");
+				 }
+			 }// for
+
+		} else {
+			logger.warn("Encontrada polilínea sin puntos ...");
+			// TODO: No se debe mandar nunca una polil�nea sin puntos, si
+			// esto
+			// ocurre es porque existe un error que hay que corregir ...
+		}
+
+	}
+
+
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+
+		int subType = getGeometrySubType(is3DFile);
+		MultiSurface solution = (MultiSurface) gMan.create(getGeometryType(),
+				subType);
+		if(vertices != null && faces != null){
+			if(vertices.size() == 0 || faces.size() == 0){
+				return gMan.createNullGeometry(subType);
+			}
+			int numFaces = faces.size();
+			for(int i = 0; i < numFaces; i++){
+				DwgVertexPFaceFace face = (DwgVertexPFaceFace) faces.get(i);
+				int[] verticesId = face.getVerticesidx();
+				ArrayList pts = new ArrayList();
+				boolean lastWasInvisible = true;
+				for(int j = 0; j < NUM_VERTEX_OF_FACE; j++){
+					if(verticesId[j] > 0){
+	                    if(lastWasInvisible){
+	                        pts.clear();
+	                        lastWasInvisible = false;
+	                    }
+	                    // the index is 1-based
+	                    try{
+	                    pts.add(vertices.get(verticesId[j] -1));
+	                    }catch(Throwable t){
+	                    	t.printStackTrace();
+	                    }
+
+	                } else if(verticesId[j] < 0 && !lastWasInvisible){
+	                    lastWasInvisible = true;
+	                    pts.add(vertices.get( (verticesId[j] * -1) -1));
+	                }
+				}// for j
+
+				solution.addSurface(FMapUtil.ptsToPolygon(pts, subType));
+
+
+// if(!lastWasInvisible){
+// if(vertex[nrV] < 0){
+// line.addPoint(knot[-vertex[nrV] - 1]);
+// } else{
+// line.addPoint(knot[vertex[nrV] - 1]);
+// }
+// set.addDrawable(line);
+// }
+
+			}// for i
+		}
+		return solution;
+
+	}
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "PFacePolyline";
+	}
+
+	public void addVertex(IDwgVertex vertex) {
+		// here we save the vertex (not the coordinate) because
+		// this Polyline could have two kind of vertex (pface and pfaceface)
+		if(vertex instanceof DwgVertexPFaceFace) {
+			faces.add(vertex);
+		} else {
+			vertices.add(vertex);
+		}
+	}
+
+	public void dump(){
+		System.out.println("<PFacePolyline vertexCount="+vertexCount+" faceCount"+faceCount+">");
+		int numRealVertex = 1;
+		for(int i = 0; i < vertices.size(); i++){
+			IDwgVertex vertex = (IDwgVertex) vertices.get(i);
+			double[] point = vertex.getPoint();
+			System.out.println("<Vertex idx="+numRealVertex+" class="+vertex.getClass().getName()+" x="+point[0]+" y="+point[1]+" z="+point[2]+" >");
+			numRealVertex++;
+		}
+
+		for(int i = 0; i < faces.size(); i++){
+			IDwgVertex vertex = (IDwgVertex) faces.get(i);
+			if(vertex instanceof DwgVertexPFaceFace){
+				int[] point = ((DwgVertexPFaceFace)vertex).getVerticesidx();
+				System.out.println("<Vertex class="+vertex.getClass().getName()+" 1="+point[0]+" 2="+point[1]+" 3="+point[2]+" 4="+ point[3]+">");
+			}
+		}
+		System.out.println("</PFacePolyline>");
+	}
+
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot, List dwgObjectsWithoutBlocks, Map handle_objectsWithoutBlocks, DwgFile callBack) {
+		DwgPFacePolyline transformedEntity = null;
+		List vertices = this.getVertices();
+		if (vertices != null) {
+			if(vertices.size() == 0) {
+				return;
+			}
+		    List transformedVertices = new ArrayList();
+			for (int i=0;i < vertices.size();i++) {
+				double[] pointAux = null;
+				IDwgVertex vertex = (IDwgVertex) vertices.get(i);
+			    if(!(vertex instanceof DwgVertexPFaceFace)){
+			    	// DwgVertexPFaceFace hasnt coordinates, instead
+			    	// it has indices in the vertex array
+					double[] point = vertex.getPoint();
+				    pointAux = new double[]{point[0] - bPoint[0],
+				    		point[1] - bPoint[1], point[2] - bPoint[2]};
+
+					double laX = insPoint.getX() + ((pointAux[0] * scale[0])*Math.cos(rot) + (pointAux[1]*scale[1])*(-1)*Math.sin(rot));
+					double laY = insPoint.getY() + ((pointAux[0]*scale[0])*Math.sin(rot) + (pointAux[1]*scale[1])*Math.cos(rot));
+					double laZ = pointAux[2];
+					vertex.setPoint(new double[]{laX, laY, laZ});
+					transformedVertices.add(vertex);
+				}
+			}// for
+			transformedEntity = (DwgPFacePolyline)this.clone();
+			fill(transformedEntity);
+			dwgObjectsWithoutBlocks.add(transformedEntity);
+			handle_objectsWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+		}// if
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.MULTISURFACE;
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexMesh.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexMesh.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexMesh.java	(revision 435)
@@ -0,0 +1,120 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexMesh.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.4  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+* Revision 1.3  2007/03/01 19:59:00  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwgVertex;
+
+/**
+ * Dwg vertex whose super entity is a DwgMeshPolyline.
+ * 
+ * */
+public class DwgVertexMesh extends DwgObject implements IDwgVertex{
+
+	private int flag;
+	private double[] point;
+
+	public DwgVertexMesh(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+
+	public void setFlags(int flag) {
+		this.flag = flag;
+	}
+
+	public void setPoint(double[] ds) {
+		this.point = ds;
+	}
+
+	public int getFlag() {
+		return flag;
+	}
+
+	public void setFlag(int flag) {
+		this.flag = flag;
+	}
+
+	public double[] getPoint() {
+		return point;
+	}
+	public Object clone(){
+		DwgVertexMesh obj = new DwgVertexMesh(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgVertexMesh myObj = (DwgVertexMesh)obj;
+
+		myObj.setFlag(flag);
+		myObj.setPoint(point);
+	}
+
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFaceFace.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFaceFace.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFaceFace.java	(revision 435)
@@ -0,0 +1,138 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFaceFace.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.5  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+* Revision 1.4  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+* Revision 1.3  2007/03/02 20:31:22  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwgVertex;
+
+/**
+ * A vertex whose superentity is a DwgPFacePolyline.
+ * 
+ * This vertex hasent coordinates (instead, it has a colection of
+ * indexes of the vertices which forms its faces)
+ * 
+ * @author azabala
+ * */
+public class DwgVertexPFaceFace extends DwgObject implements IDwgVertex{
+
+	private int flags;
+	private double[] vertices;
+	private int[] verticesidx;
+
+	public DwgVertexPFaceFace(int index) {
+		super(index);
+		vertices = new double[]{0,0,0,0};
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	
+	public int getFlags() {
+		return flags;
+	}
+
+	public void setPoint(double[] ds) {
+		this.vertices = ds;
+	}
+
+	public double[] getPoint() {
+		return vertices;
+	}
+	public Object clone(){
+		DwgVertexPFaceFace obj = new DwgVertexPFaceFace(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgVertexPFaceFace myObj = (DwgVertexPFaceFace)obj;
+
+		myObj.setFlags(flags);
+		myObj.setPoint(vertices);
+	}
+
+	public int[] getVerticesidx() {
+		return verticesidx;
+	}
+
+	public void setVerticesidx(int[] verticesidx) {
+		this.verticesidx = verticesidx;
+	}
+	
+	public String toString(){
+		return "[1="+verticesidx[0]+", 2="+verticesidx[1]+", 3="+verticesidx[2]+", 4="+verticesidx[3]+"]";
+	}
+
+	
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockControl.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockControl.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockControl.java	(revision 435)
@@ -0,0 +1,99 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.util.Vector;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * The DwgBlockControl class represents a DWG Block control
+ * 
+ * @author jmorell
+ */
+public class DwgBlockControl extends DwgObject {
+
+	private DwgHandleReference nullHandle = null;
+	private Vector code2Handles;
+	private DwgHandleReference modelSpaceHandle = null;
+	private DwgHandleReference paperSpaceHandle = null;
+	
+	public DwgBlockControl(int index) {
+		super(index);
+	}
+	
+	public Vector getCode2Handles() {
+		return code2Handles;
+	}
+	public void setCode2Handles(Vector code2Handles) {
+		this.code2Handles = code2Handles;
+	}
+	public DwgHandleReference getModelSpaceHandle() {
+		return modelSpaceHandle;
+	}
+	public void setModelSpaceHandle(DwgHandleReference modelSpaceHandle) {
+		this.modelSpaceHandle = modelSpaceHandle;
+	}
+	public DwgHandleReference getNullHandle() {
+		return nullHandle;
+	}
+	public void setNullHandle(DwgHandleReference nullHandle) {
+		this.nullHandle = nullHandle;
+	}
+	public DwgHandleReference getPaperSpaceHandle() {
+		return paperSpaceHandle;
+	}
+	public void setPaperSpaceHandle(DwgHandleReference paperSpaceHandle) {
+		this.paperSpaceHandle = paperSpaceHandle;
+	}
+	public Object clone(){
+		DwgBlockControl obj = new DwgBlockControl(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgBlockControl myObj = (DwgBlockControl)obj;
+
+		myObj.setCode2Handles(code2Handles);
+		myObj.setModelSpaceHandle(modelSpaceHandle);
+		myObj.setNullHandle(nullHandle);
+		myObj.setPaperSpaceHandle(paperSpaceHandle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEllipse.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEllipse.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEllipse.java	(revision 435)
@@ -0,0 +1,288 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.util.FMapUtil;
+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.fmap.geom.primitive.EllipticArc;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgEllipse class represents a DWG Ellipse
+ *
+ * @author jmorell
+ */
+public class DwgEllipse extends DwgObject
+	implements IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+	public DwgEllipse(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private double[] center;
+	private double[] semiMajorAxisVector;
+	private double[] extrusion;
+	private double axisRatio;
+	private double initAngle;
+	private double endAngle;
+
+    /**
+     * @return Returns the axisRatio.
+     */
+    public double getAxisRatio() {
+        return axisRatio;
+    }
+    /**
+     * @param axisRatio The axisRatio to set.
+     */
+    public void setAxisRatio(double axisRatio) {
+        this.axisRatio = axisRatio;
+    }
+    /**
+     * @return Returns the center.
+     */
+    public double[] getCenter() {
+        return center;
+    }
+    /**
+     * @param center The center to set.
+     */
+    public void setCenter(double[] center) {
+        this.center = center;
+    }
+    /**
+     * @return Returns the endAngle.
+     */
+    public double getEndAngle() {
+        return endAngle;
+    }
+    /**
+     * @param endAngle The endAngle to set.
+     */
+    public void setEndAngle(double endAngle) {
+        this.endAngle = endAngle;
+    }
+    /**
+     * @return Returns the initAngle.
+     */
+    public double getInitAngle() {
+        return initAngle;
+    }
+    /**
+     * @param initAngle The initAngle to set.
+     */
+    public void setInitAngle(double initAngle) {
+        this.initAngle = initAngle;
+    }
+    /**
+     * @return Returns the majorAxisVector.
+     */
+    public double[] getSemiMajorAxisVector() {
+        return semiMajorAxisVector;
+    }
+    /**
+     * @param semiMajorAxisVector The majorAxisVector to set.
+     */
+    public void setSemiMajorAxisVector(double[] semiMajorAxisVector) {
+        this.semiMajorAxisVector = semiMajorAxisVector;
+    }
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getCenter()[2] !=0.0);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		return getCenter()[2];
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean)
+	 */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		double[] c = getCenter();
+		double[] semiMajorAxisVector = getSemiMajorAxisVector();
+		double axisRatio = getAxisRatio();
+		double angSt = getInitAngle();
+		double angEnd = getEndAngle();
+		double angExt = FMapUtil.angleDistance(angSt, angEnd);
+
+
+		//Point2D axis1Start = new Point2D.Double(center.getX()+smav.getX(), center.getY()+smav.getY());
+		Point axis1Start = (Point)gMan.create(Geometry.TYPES.POINT,
+				getGeometrySubType(is3DFile));
+		double[] tmp;
+		tmp = new double[c.length];
+		for (int i=0;i< c.length;i++){
+			tmp[i]=c[i]+semiMajorAxisVector[i];
+		}
+		axis1Start.setCoordinates(tmp);
+
+		//Point2D axis1End = new Point2D.Double(center.getX()-smav.getX(), center.getY()-smav.getY());
+		Point axis1End = (Point)gMan.create(Geometry.TYPES.POINT,
+				getGeometrySubType(is3DFile));
+
+		tmp = new double[c.length];
+		for (int i=0;i< c.length;i++){
+			tmp[i]=c[i]-semiMajorAxisVector[i];
+		}
+		axis1End.setCoordinates(tmp);
+
+
+		Point2D smav = new Point2D.Double(semiMajorAxisVector[0],semiMajorAxisVector[1]);
+		Point2D origen = new Point2D.Double(0.0,0.0);
+		double semiMajorAxisLenght = origen.distance(smav);
+		double semiMinorAxisLenght = semiMajorAxisLenght * axisRatio;
+
+
+
+		EllipticArc ellipse = (EllipticArc) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		ellipse.setPoints(axis1Start, axis1End, semiMinorAxisLenght, -angSt,
+				-angExt);
+
+		return ellipse;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean)
+	 */
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "EllipticArc2DZ";
+		} else {
+			return "EllipticArc2D";
+		}
+	}
+
+	public String toString(){
+		return "Ellipse";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks,
+			DwgFile callBack) {
+		DwgEllipse transformedEntity = null;
+		double[] center = this.getCenter();
+		Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double laZ = center[2] * scale[2];
+		double[] transformedCenter = new double[]{laX, laY, laZ};
+		double[] majorAxisVector = this.getSemiMajorAxisVector();
+		double[] transformedMajorAxisVector = new double[]{majorAxisVector[0] * scale[0], majorAxisVector[1] * scale[1], majorAxisVector[2] * scale[2]};
+		//TODO: Rotar un �ngulo rot el vector majorAxisVector fijado en
+		// center.
+		double axisRatio = this.getAxisRatio();
+		double transformedAxisRatio = axisRatio;
+		double initAngle = this.getInitAngle();
+		double endAngle = this.getEndAngle();
+        double transformedInitAngle = initAngle + rot;
+        if (transformedInitAngle<0) {
+            transformedInitAngle = transformedInitAngle + (2*Math.PI);
+        } else if (transformedInitAngle>(2*Math.PI)) {
+            transformedInitAngle = transformedInitAngle - (2*Math.PI);
+        }
+        double transformedEndAngle = endAngle + rot;
+        if (transformedEndAngle<0) {
+            transformedEndAngle = transformedEndAngle + (2*Math.PI);
+        } else if (transformedEndAngle>(2*Math.PI)) {
+            transformedEndAngle = transformedEndAngle - (2*Math.PI);
+        }
+		transformedEntity = (DwgEllipse)this.clone();
+		transformedEntity.setCenter(transformedCenter);
+		transformedEntity.setSemiMajorAxisVector(transformedMajorAxisVector);
+		transformedEntity.setAxisRatio(transformedAxisRatio);
+		transformedEntity.setInitAngle(transformedInitAngle);
+		transformedEntity.setEndAngle(transformedEndAngle);
+		dwgObjectsWithoutBlocks.add(transformedEntity);
+		handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+//		dwgObjectsWithoutBlocks.add(this);
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgEllipse obj = new DwgEllipse(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgEllipse myObj = (DwgEllipse)obj;
+
+		myObj.setAxisRatio(axisRatio);
+		myObj.setCenter(center);
+		myObj.setEndAngle(endAngle);
+		myObj.setExtrusion(extrusion);
+		myObj.setInitAngle(initAngle);
+		myObj.setSemiMajorAxisVector(semiMajorAxisVector);
+
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.ELLIPTICARC;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockHeader.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockHeader.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockHeader.java	(revision 435)
@@ -0,0 +1,428 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.util.ArrayList;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+
+
+/**
+ * The DwgBlockHeader class represents a DWG Block header
+ *
+ * @author jmorell, azabala
+ */
+public class DwgBlockHeader extends DwgObject implements IDwg3DTestable {
+	private String name;
+	private boolean flag64;
+	private int xRefPlus;
+	private boolean xdep;
+	private boolean anonymous;
+	private boolean hasAttrs;
+
+	//TODO REVISAR COMO TRATAR UN BLOQUE CUANDO ES UNA REFERENCIA
+	//EXTERNA (DwgFile.blockManagement() )
+	private boolean blkIsXRef;
+	private boolean xRefOverLaid;
+	private boolean loaded;
+	private double[] basePoint;
+	private String xRefPName;
+	private String blockDescription;
+	private int previewData;
+
+	private DwgHandleReference blockControlHandle;
+	private DwgHandleReference nullHandle;
+	private DwgHandleReference blockEntityHandle;
+	private DwgHandleReference firstEntityHandle;
+	private DwgHandleReference lastEntityHandle;
+	private DwgHandleReference endBlkEntityHandle;
+
+
+	private DwgHandleReference[] insertHandles;
+
+	private DwgHandleReference layoutHandle;
+	private ArrayList objects;
+	private ArrayList ownedObjectsHandles; //For R2004+
+
+	/**
+	 * Create new DwgBlockHeader object
+	 */
+	public DwgBlockHeader(int index) {
+		super(index);
+		objects = new ArrayList();
+		ownedObjectsHandles = new ArrayList();
+	}
+
+	/**
+	 * @return Returns the basePoint.
+	 */
+	public double[] getBasePoint() {
+		return basePoint;
+	}
+	/**
+	 * @param basePoint The basePoint to set.
+	 */
+	public void setBasePoint(double[] basePoint) {
+		this.basePoint = basePoint;
+	}
+	/**
+	 * @return Returns the firstEntityHandle.
+	 */
+	public DwgHandleReference getFirstEntityHandle() {
+		return firstEntityHandle;
+	}
+	/**
+	 * @param firstEntityHandle The firstEntityHandle to set.
+	 */
+	public void setFirstEntityHandle(DwgHandleReference firstEntityHandle) {
+		this.firstEntityHandle = firstEntityHandle;
+	}
+	/**
+	 * @return Returns the lastEntityHandle.
+	 */
+	public DwgHandleReference getLastEntityHandle() {
+		return lastEntityHandle;
+	}
+	/**
+	 * @param lastEntityHandle The lastEntityHandle to set.
+	 */
+	public void setLastEntityHandle(DwgHandleReference lastEntityHandle) {
+		this.lastEntityHandle = lastEntityHandle;
+	}
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+	/**
+	 * @param name The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	/**
+	 * @return Returns the blockEntityHandle.
+	 */
+	public DwgHandleReference getBlockEntityHandle() {
+		return blockEntityHandle;
+	}
+	/**
+	 * @param blockEntityHandle The blockEntityHandle to set.
+	 */
+	public void setBlockEntityHandle(DwgHandleReference blockEntityHandle) {
+		this.blockEntityHandle = blockEntityHandle;
+	}
+	/**
+	 * @return Returns the anonymous.
+	 */
+	public boolean isAnonymous() {
+		return anonymous;
+	}
+	/**
+	 * @param anonymous The anonymous to set.
+	 */
+	public void setAnonymous(boolean anonymous) {
+		this.anonymous = anonymous;
+	}
+	/**
+	 * @return Returns the blkIsXRef.
+	 */
+	public boolean isBlkIsXRef() {
+		return blkIsXRef;
+	}
+	/**
+	 * @param blkIsXRef The blkIsXRef to set.
+	 */
+	public void setBlkIsXRef(boolean blkIsXRef) {
+		this.blkIsXRef = blkIsXRef;
+	}
+	/**
+	 * @return Returns the blockControlHandle.
+	 */
+	public DwgHandleReference getBlockControlHandle() {
+		return blockControlHandle;
+	}
+	/**
+	 * @param blockControlHandle The blockControlHandle to set.
+	 */
+	public void setBlockControlHandle(DwgHandleReference blockControlHandle) {
+		this.blockControlHandle = blockControlHandle;
+	}
+	/**
+	 * @return Returns the blockDescription.
+	 */
+	public String getBlockDescription() {
+		return blockDescription;
+	}
+	/**
+	 * @param blockDescription The blockDescription to set.
+	 */
+	public void setBlockDescription(String blockDescription) {
+		this.blockDescription = blockDescription;
+	}
+	/**
+	 * @return Returns the endBlkEntityHandle.
+	 */
+	public DwgHandleReference getEndBlkEntityHandle() {
+		return endBlkEntityHandle;
+	}
+	/**
+	 * @param endBlkEntityHandle The endBlkEntityHandle to set.
+	 */
+	public void setEndBlkEntityHandle(DwgHandleReference endBlkEntityHandle) {
+		this.endBlkEntityHandle = endBlkEntityHandle;
+	}
+	/**
+	 * @return Returns the flag64.
+	 */
+	public boolean isFlag64() {
+		return flag64;
+	}
+	/**
+	 * @param flag64 The flag64 to set.
+	 */
+	public void setFlag64(boolean flag64) {
+		this.flag64 = flag64;
+	}
+	/**
+	 * @return Returns the hasAttrs.
+	 */
+	public boolean isHasAttrs() {
+		return hasAttrs;
+	}
+	/**
+	 * @param hasAttrs The hasAttrs to set.
+	 */
+	public void setHasAttrs(boolean hasAttrs) {
+		this.hasAttrs = hasAttrs;
+	}
+	/**
+	 * @return Returns the insertHandles.
+	 */
+	public DwgHandleReference[] getInsertHandles() {
+		return insertHandles;
+	}
+	/**
+	 * @param insertHandles The insertHandles to set.
+	 */
+	public void setInsertHandles(DwgHandleReference[] insertHandles) {
+		this.insertHandles = insertHandles;
+	}
+	/**
+	 * @return Returns the layoutHandle.
+	 */
+	public DwgHandleReference getLayoutHandle() {
+		return layoutHandle;
+	}
+	/**
+	 * @param handle The layoutHandle to set.
+	 */
+	public void setLayoutHandle(DwgHandleReference handle) {
+		this.layoutHandle = handle;
+	}
+	/**
+	 * @return Returns the loaded.
+	 */
+	public boolean isLoaded() {
+		return loaded;
+	}
+	/**
+	 * @param loaded The loaded to set.
+	 */
+	public void setLoaded(boolean loaded) {
+		this.loaded = loaded;
+	}
+	/**
+	 * @return Returns the nullHandle.
+	 */
+	public DwgHandleReference getNullHandle() {
+		return nullHandle;
+	}
+	/**
+	 * @param nullHandle The nullHandle to set.
+	 */
+	public void setNullHandle(DwgHandleReference nullHandle) {
+		this.nullHandle = nullHandle;
+	}
+	/**
+	 * @return Returns the previewData.
+	 */
+	public int getPreviewData() {
+		return previewData;
+	}
+	/**
+	 * @param previewData The previewData to set.
+	 */
+	public void setPreviewData(int previewData) {
+		this.previewData = previewData;
+	}
+	/**
+	 * @return Returns the xdep.
+	 */
+	public boolean isXdep() {
+		return xdep;
+	}
+	/**
+	 * @param xdep The xdep to set.
+	 */
+	public void setXdep(boolean xdep) {
+		this.xdep = xdep;
+	}
+	/**
+	 * @return Returns the xRefOverLaid.
+	 */
+	public boolean isXRefOverLaid() {
+		return xRefOverLaid;
+	}
+	/**
+	 * @param refOverLaid The xRefOverLaid to set.
+	 */
+	public void setXRefOverLaid(boolean refOverLaid) {
+		xRefOverLaid = refOverLaid;
+	}
+	/**
+	 * @return Returns the xRefPlus.
+	 */
+	public int getXRefPlus() {
+		return xRefPlus;
+	}
+	/**
+	 * @param refPlus The xRefPlus to set.
+	 */
+	public void setXRefPlus(int refPlus) {
+		xRefPlus = refPlus;
+	}
+	/**
+	 * @return Returns the xRefPName.
+	 */
+	public String getXRefPName() {
+		return xRefPName;
+	}
+	/**
+	 * @param refPName The xRefPName to set.
+	 */
+	public void setXRefPName(String refPName) {
+		xRefPName = refPName;
+	}
+	/**
+	 * @return Returns the objects.
+	 */
+	public ArrayList getObjects() {
+		return objects;
+	}
+	/**
+	 * @param objects The objects to set.
+	 */
+	public void setObjects(ArrayList objects) {
+		this.objects = objects;
+	}
+	/**
+	 * Add a DWG object to the blockObjects vector
+	 *
+	 * @param object DWG object
+	 */
+	public void addObject(DwgObject object) {
+		this.objects.add(object);
+	}
+
+	/**
+	 * @return Returns the owned objects handles.
+	 */
+	public ArrayList getOwnedObjectsHandles() {
+		return ownedObjectsHandles;
+	}
+	/**
+	 * @param objects The owned objects handles to set.
+	 */
+	public void setOwnedObjectsHandles(ArrayList handles) {
+		this.ownedObjectsHandles = handles;
+	}
+	/**
+	 * Add a handle to the ownedBbjectsHandle vector
+	 *
+	 * @param handle handle
+	 */
+	public void addOwnedObjectHandle(DwgHandleReference handle) {
+		this.ownedObjectsHandles.add(handle);
+	}
+
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getBasePoint()[2] != 0.0);
+	}
+	public double getZ() {
+		return getBasePoint()[2];
+	}
+	public Object clone(){
+		DwgBlockHeader obj = new DwgBlockHeader(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgBlockHeader myObj = (DwgBlockHeader)obj;
+
+		myObj.setAnonymous(anonymous);
+		myObj.setBasePoint(basePoint);
+		myObj.setBlkIsXRef(blkIsXRef);
+		myObj.setBlockControlHandle(blockControlHandle);
+		myObj.setBlockDescription(blockDescription);
+		myObj.setBlockEntityHandle(blockEntityHandle);
+		myObj.setEndBlkEntityHandle(endBlkEntityHandle);
+		myObj.setFirstEntityHandle(firstEntityHandle);
+		myObj.setFlag64(flag64);
+		myObj.setHasAttrs(hasAttrs);
+		myObj.setInsertHandles(insertHandles);
+		myObj.setLastEntityHandle(lastEntityHandle);
+		myObj.setLayoutHandle(layoutHandle);
+		myObj.setLoaded(loaded);
+		myObj.setName(name);
+		myObj.setNullHandle(nullHandle);
+		myObj.setObjects(objects);
+		myObj.setPreviewData(previewData);
+		myObj.setXdep(xdep);
+		myObj.setXRefOverLaid(xRefOverLaid);
+		myObj.setXRefPlus(xRefPlus);
+		myObj.setXRefPName(xRefPName);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex2D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex2D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex2D.java	(revision 435)
@@ -0,0 +1,130 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwgVertex;
+
+/**
+ * The DwgVertex2D class represents a DWG Vertex2D
+ * 
+ * @author jmorell
+ */
+public class DwgVertex2D extends DwgObject implements IDwgVertex {
+	public DwgVertex2D(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private int flags;
+	private double[] point;
+	private double initWidth;
+	private double endWidth;
+	private double bulge;
+	private double tangentDir;
+	
+	
+	/**
+	 * @return Returns the bulge.
+	 */
+	public double getBulge() {
+		return bulge;
+	}
+	/**
+	 * @param bulge The bulge to set.
+	 */
+	public void setBulge(double bulge) {
+		this.bulge = bulge;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the point.
+	 */
+	public double[] getPoint() {
+		return point;
+	}
+	/**
+	 * @param point The point to set.
+	 */
+	public void setPoint(double[] point) {
+		this.point = point;
+	}
+	public double getEndWidth() {
+		return endWidth;
+	}
+	public void setEndWidth(double endWidth) {
+		this.endWidth = endWidth;
+	}
+	public double getInitWidth() {
+		return initWidth;
+	}
+	public void setInitWidth(double initWidth) {
+		this.initWidth = initWidth;
+	}
+	public double getTangentDir() {
+		return tangentDir;
+	}
+	public void setTangentDir(double tangentDir) {
+		this.tangentDir = tangentDir;
+	}
+	public Object clone(){
+		DwgVertex2D obj = new DwgVertex2D(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgVertex2D myObj = (DwgVertex2D)obj;
+
+		myObj.setBulge(bulge);
+		myObj.setEndWidth(endWidth);
+		myObj.setFlags(flags);
+		myObj.setInitWidth(initWidth);
+		myObj.setPoint(point);
+		myObj.setTangentDir(tangentDir);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerIndex.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerIndex.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayerIndex.java	(revision 435)
@@ -0,0 +1,113 @@
+/*
+ * Created on 02-feb-2007 by azabala
+ *
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * @author alzabord
+ *
+ * TODO Posiblemente esta clase no haga falta leerla, porque ya la construimos
+ * nosotros luego recorriendo todos los DwgLayer cargados
+ */
+public class DwgLayerIndex extends DwgObject {
+
+	private int timestamp1;
+	private int timestamp2;
+	
+	private List indexEntries;
+	private List indexHandles;
+	
+	private DwgHandleReference parentHandle;
+
+	/**
+	 * @param index
+	 */
+	public DwgLayerIndex(int index) {
+		super(index);
+		indexEntries = new ArrayList();
+		indexHandles = new ArrayList();
+	}
+
+	public void setTimestamp1(int timestamp1) {
+		this.timestamp1 = timestamp1;
+	}
+
+	public void setTimestamp2(int timestamp12) {
+		this.timestamp2 = timestamp12;
+	}
+
+	public void addIndex(int indexLong, String indexStr) {
+		IndexEntry entry = new IndexEntry();
+		entry.indexLong = indexLong;
+		entry.indexStr = indexStr;
+		indexEntries.add(entry);
+		
+	}
+	
+	public void addHandleEntry(DwgHandleReference handle){
+		this.indexHandles.add(handle);
+	}
+	
+	class IndexEntry{
+		int indexLong;
+		String indexStr;
+	}
+
+	public List getIndexEntries() {
+		return indexEntries;
+	}
+
+	public void setIndexEntries(List indexEntries) {
+		this.indexEntries = indexEntries;
+	}
+
+	public int getTimestamp1() {
+		return timestamp1;
+	}
+
+	public int getTimestamp2() {
+		return timestamp2;
+	}
+
+	public void setParentHandle(DwgHandleReference handle) {
+		this.parentHandle = handle;
+	}
+
+	public List getIndexHandles() {
+		return indexHandles;
+	}
+
+	public void setIndexHandles(List indexHandles) {
+		this.indexHandles = indexHandles;
+	}
+
+	public DwgHandleReference getParentHandle() {
+		return parentHandle;
+	}
+	public Object clone(){
+		DwgLayerIndex obj = new DwgLayerIndex(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgLayerIndex myObj = (DwgLayerIndex)obj;
+
+		myObj.setIndexEntries(indexEntries);
+		myObj.setIndexHandles(indexHandles);
+		myObj.setParentHandle(parentHandle);
+		myObj.setTimestamp1(timestamp1);
+		myObj.setTimestamp2(timestamp2);
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgInsert.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgInsert.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgInsert.java	(revision 435)
@@ -0,0 +1,322 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+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.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgInsert class represents a DWG Insert
+ *
+ * @author jmorell
+ */
+public class DwgInsert extends DwgObject
+	implements IDwgExtrusionable, IDwg3DTestable,/* IDwg2FMap, */IDwgBlockMember {
+	public DwgInsert(int index) {
+		super(index);
+	}
+	private double[] insertionPoint;
+	private double[] scale;
+	private double rotation;
+	private double[] extrusion;
+	private DwgHandleReference blockHeaderHandle = null;
+	private DwgHandleReference firstAttribHandle = null;
+	private DwgHandleReference lastAttribHandle = null;
+	private DwgHandleReference seqendHandle = null;
+	private ArrayList ownedObjectsHandles = new ArrayList(); //For R2004+
+
+	/**
+	 * An insert could be nexted in other insert.
+	 * We wont process and insert two times.
+	 * */
+	private boolean processed = false;
+
+
+	public void dump(){
+		System.out.println("<Insert>");
+		System.out.println("<inspoint x="+insertionPoint[0]+
+				" y="+insertionPoint[1]+
+				" z="+insertionPoint[2]+">");
+		System.out.println("<scale x="+scale[0]+
+				" y="+scale[1]+
+				" z="+scale[2]+">");
+		System.out.println("<rotation rot="+rotation+" >");
+
+		System.out.println("</Insert>");
+
+	}
+
+	/**
+	 * @return Returns the blockHeaderHandle.
+	 */
+	public DwgHandleReference getBlockHeaderHandle() {
+		return blockHeaderHandle;
+	}
+	/**
+	 * @param blockHeaderHandle The blockHeaderHandle to set.
+	 */
+	public void setBlockHeaderHandle(DwgHandleReference blockHeaderHandle) {
+		this.blockHeaderHandle = blockHeaderHandle;
+	}
+	/**
+	 * @return Returns the firstAttribHandle.
+	 */
+	public DwgHandleReference getFirstAttribHandle() {
+		return firstAttribHandle;
+	}
+	/**
+	 * @param firstAttribHandle The firstAttribHandle to set.
+	 */
+	public void setFirstAttribHandle(DwgHandleReference firstAttribHandle) {
+		this.firstAttribHandle = firstAttribHandle;
+	}
+	/**
+	 * @return Returns the insertionPoint.
+	 */
+	public double[] getInsertionPoint() {
+		return insertionPoint;
+	}
+	/**
+	 * @param insertionPoint The insertionPoint to set.
+	 */
+	public void setInsertionPoint(double[] insertionPoint) {
+		this.insertionPoint = insertionPoint;
+	}
+	/**
+	 * @return Returns the lastAttribHandle.
+	 */
+	public DwgHandleReference getLastAttribHandle() {
+		return lastAttribHandle;
+	}
+	/**
+	 * @param lastAttribHandle The lastAttribHandle to set.
+	 */
+	public void setLastAttribHandle(DwgHandleReference lastAttribHandle) {
+		this.lastAttribHandle = lastAttribHandle;
+	}
+	/**
+	 * @return Returns the rotation.
+	 */
+	public double getRotation() {
+		return rotation;
+	}
+	/**
+	 * @param rotation The rotation to set.
+	 */
+	public void setRotation(double rotation) {
+		this.rotation = rotation;
+	}
+	/**
+	 * @return Returns the scale.
+	 */
+	public double[] getScale() {
+		return scale;
+	}
+	/**
+	 * @param scale The scale to set.
+	 */
+	public void setScale(double[] scale) {
+		this.scale = scale;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/**
+	 * @return Returns the seqendHandle.
+	 */
+	public DwgHandleReference getSeqendHandle() {
+		return seqendHandle;
+	}
+	/**
+	 * @param seqendHandle The seqendHandle to set.
+	 */
+	public void setSeqendHandle(DwgHandleReference seqendHandle) {
+		this.seqendHandle = seqendHandle;
+	}
+
+	/**
+	 * @return Returns the owned objects handles.
+	 */
+	public ArrayList getOwnedObjectsHandles() {
+		return ownedObjectsHandles;
+	}
+	/**
+	 * @param objects The owned objects handles to set.
+	 */
+	public void setOwnedObjectsHandles(ArrayList handles) {
+		this.ownedObjectsHandles = handles;
+	}
+	/**
+	 * Add a handle to the ownedBbjectsHandle vector
+	 *
+	 * @param handle handle
+	 */
+	public void addOwnedObjectHandle(DwgHandleReference handle) {
+		this.ownedObjectsHandles.add(handle);
+	}
+
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] insertPoint = getInsertionPoint();
+         double[] insertExt = getExtrusion();
+         insertPoint = AcadExtrusionCalculator.extrude2(insertPoint, insertExt);
+         setInsertionPoint(insertPoint);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getInsertionPoint()[2] != 0.0);
+	}
+	public double getZ() {
+		return getInsertionPoint()[2];
+	}
+	public Geometry toFMapGeometry(boolean is3DFile)
+			throws CreateGeometryException {
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+		double[] p = getInsertionPoint();
+		Point point = (Point) gMan.create(getGeometryType(),
+				getGeometrySubType(is3DFile));
+		point.setCoordinates(p);
+		return point;
+
+	}
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile) {
+			return "FPoint3D";
+		} else {
+			return "FPoint2D";
+		}
+	}
+
+	public String toString(){
+		return "Insert";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint,
+			double[] scale, double rot,
+			List dwgObjectsWithoutBlocks, Map handle_objWithoutBlocks, DwgFile callBack) {
+
+		processed = true;
+
+		double[] p = this.getInsertionPoint();
+		Point2D point = new Point2D.Double(p[0], p[1]);
+
+		double[] newScale = this.getScale();
+		double newRot = this.getRotation();
+		DwgHandleReference newBlockHandle = this.getBlockHeaderHandle();
+
+		Point2D pointAux = new Point2D.Double(point.getX() - bPoint[0], point.getY() - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double laZ = p[2] * scale[2];
+
+		Point2D newInsPoint = new Point2D.Double(laX, laY);
+		newScale = new double[]{scale[0]*newScale[0], scale[1]*newScale[1], scale[2]*newScale[2]};
+        newRot = newRot + rot;
+        if (newRot<0) {
+            newRot = newRot + (2*Math.PI);
+        } else if (newRot>(2*Math.PI)) {
+            newRot = newRot - (2*Math.PI);
+        }
+
+        callBack.manageInsert2(newInsPoint,
+								newScale,
+								newRot,
+								newBlockHandle.getOffset(),
+								dwgObjectsWithoutBlocks,
+								handle_objWithoutBlocks);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgInsert obj = new DwgInsert(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgInsert myObj = (DwgInsert)obj;
+
+		myObj.setBlockHeaderHandle(blockHeaderHandle);
+		myObj.setExtrusion(extrusion);
+		myObj.setFirstAttribHandle(firstAttribHandle);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setLastAttribHandle(lastAttribHandle);
+		myObj.setRotation(rotation);
+		myObj.setScale(scale);
+		myObj.setSeqendHandle(seqendHandle);
+	}
+	public boolean isProcessed() {
+		return processed;
+	}
+	public void setProcessed(boolean processed) {
+		this.processed = processed;
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.POINT;
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex3D.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex3D.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertex3D.java	(revision 435)
@@ -0,0 +1,91 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwgVertex;
+
+/**
+ * The DwgVertex3D class represents a DWG Vertex3D
+ * 
+ * @author jmorell
+ */
+public class DwgVertex3D extends DwgObject implements IDwgVertex{
+	public DwgVertex3D(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private int flags;
+	private double[] point;
+	
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the point.
+	 */
+	public double[] getPoint() {
+		return point;
+	}
+	/**
+	 * @param point The point to set.
+	 */
+	public void setPoint(double[] point) {
+		this.point = point;
+	}
+	public Object clone(){
+		DwgVertex3D obj = new DwgVertex3D(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgVertex3D myObj = (DwgVertex3D)obj;
+
+		myObj.setFlags(flags);
+		myObj.setPoint(point);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgArc.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgArc.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgArc.java	(revision 435)
@@ -0,0 +1,292 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+import org.gvsig.dwg.lib.util.FMapUtil;
+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.fmap.geom.primitive.Arc;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ * The DwgArc class represents a DWG Arc
+ *
+ * @author jmorell
+ */
+public class DwgArc extends DwgObject
+	implements IDwgExtrusionable, IDwg3DTestable, IDwg2FMap, IDwgBlockMember {
+
+    private static Logger logger = LoggerFactory.getLogger(DwgArc.class);
+	private double[] center;
+	private double radius;
+	private double thickness;
+	private double[] extrusion;
+	private double initAngle;
+	private double endAngle;
+
+	public DwgArc(int index) {
+		super(index);
+	}
+
+
+	/**
+	 * @return Returns the center.
+	 */
+	public double[] getCenter() {
+		return center;
+	}
+	/**
+	 * @param center The center to set.
+	 */
+	public void setCenter(double[] center) {
+		this.center = center;
+	}
+	/**
+	 * @return Returns the endAngle.
+	 */
+	public double getEndAngle() {
+		return endAngle;
+	}
+	/**
+	 * @param endAngle The endAngle to set.
+	 */
+	public void setEndAngle(double endAngle) {
+		this.endAngle = endAngle;
+	}
+	/**
+	 * @return Returns the initAngle.
+	 */
+	public double getInitAngle() {
+		return initAngle;
+	}
+	/**
+	 * @param initAngle The initAngle to set.
+	 */
+	public void setInitAngle(double initAngle) {
+		this.initAngle = initAngle;
+	}
+	/**
+	 * @return Returns the radius.
+	 */
+	public double getRadius() {
+		return radius;
+	}
+	/**
+	 * @param radius The radius to set.
+	 */
+	public void setRadius(double radius) {
+		this.radius = radius;
+	}
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] arcCenter = getCenter();
+         double[] arcExt = getExtrusion();
+         arcCenter = AcadExtrusionCalculator.
+		 	extrude2(arcCenter, arcExt);
+         setCenter(arcCenter);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getCenter()[2] != 0.0);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry()
+	 */
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+
+		GeometryManager gMan = GeometryLocator.getGeometryManager();
+
+		double[] center = getCenter();
+		//FIXME: ¿qué hacer cuando llega un radio negativo?
+		//	De momento, tomamos el valor absoluto del radio, pero
+		//	¿habría que modificar de alguna manera los angulos?
+		double radius = Math.abs(getRadius());
+		double angSt = getInitAngle();
+		double angEnd = getEndAngle();
+		double angExt = FMapUtil.angleDistance(angSt, angEnd);
+		Arc arc = (Arc) gMan.create(getGeometryType(),getGeometrySubType(is3DFile));
+		Point point = (Point) gMan.create(Geometry.TYPES.POINT,getGeometrySubType(is3DFile));
+		point.setCoordinates(center);
+		
+		try {
+		    arc.setPoints(point, radius, angSt, -angExt);
+		} catch (IllegalArgumentException ex) {
+		    logger.info("Unable to create arc from points.");
+		    arc = null;
+		}
+		
+		return arc;
+	}
+
+	public String toString(){
+		return "Arc";
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString()
+	 */
+	public String toFMapString(boolean is3dFile) {
+		if(is3dFile) {
+			return "FPolyline3D";
+		} else {
+			return "FPolyline2D";
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ()
+	 */
+	public double getZ() {
+		return getCenter()[2];
+	}
+
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot,
+			List dwgObjectsWithoutBlocks, Map handleObjWithoutBlocks, DwgFile callBack) {
+		//DwgArc transformedEntity = new DwgArc(getIndex());
+		double[] center = this.getCenter();
+		Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double laZ = center[2] * scale[2];
+		double[] transformedCenter = new double[]{laX, laY, laZ};
+		double radius = this.getRadius();
+		double transformedRadius = radius * scale[0];
+		double initAngle = this.getInitAngle();
+		double endAngle = this.getEndAngle();
+		double transformedInitAngle = initAngle + rot;
+		if (transformedInitAngle<0) {
+		    transformedInitAngle = transformedInitAngle + (2*Math.PI);
+		} else if (transformedInitAngle>(2*Math.PI)) {
+		    transformedInitAngle = transformedInitAngle - (2*Math.PI);
+		}
+		double transformedEndAngle = endAngle + rot;
+		if (transformedEndAngle<0) {
+		    transformedEndAngle = transformedEndAngle + (2*Math.PI);
+		} else if (transformedEndAngle>(2*Math.PI)) {
+		    transformedEndAngle = transformedEndAngle - (2*Math.PI);
+		}
+		DwgArc transformedEntity = (DwgArc) this.clone();
+		transformedEntity.setCenter(transformedCenter);
+		transformedEntity.setRadius(transformedRadius);
+		transformedEntity.setInitAngle(transformedInitAngle);
+		transformedEntity.setEndAngle(transformedEndAngle);
+		transformedEntity.setHandle(this.getHandle());
+
+		dwgObjectsWithoutBlocks.add(transformedEntity);
+		handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+
+//		setCenter(transformedCenter);
+//		setRadius(transformedRadius);
+//		setInitAngle(transformedInitAngle);
+//		setEndAngle(transformedEndAngle);
+//		dwgObjectsWithoutBlocks.add(this);
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+public Object clone(){
+		DwgArc obj = new DwgArc(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgArc myObj = (DwgArc)obj;
+
+		myObj.setCenter(center);
+		myObj.setEndAngle(endAngle);
+		myObj.setExtrusion(extrusion);
+		myObj.setInitAngle(initAngle);
+		myObj.setRadius(radius);
+		myObj.setThickness(thickness);
+
+	}
+
+	public int getGeometryType() {
+		return Geometry.TYPES.ARC;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionary.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionary.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgDictionary.java	(revision 435)
@@ -0,0 +1,117 @@
+package org.gvsig.dwg.lib.objects;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgUtil;
+
+
+public class DwgDictionary extends DwgObject implements Cloneable, Map, Serializable{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5594420471375074362L;
+	private HashMap map;
+	private int hardOwnerFlag;
+	private int cloningFlag;
+	private DwgHandleReference parentHandle;
+	
+	public DwgDictionary(int index) {
+		super(index);
+		map = new HashMap();
+	}
+
+	public int size() {
+		return map.size();
+	}
+
+	public void clear() {
+		map.clear();
+	}
+
+	public boolean isEmpty() {
+		return map.isEmpty();
+	}
+
+	public boolean containsKey(Object key) {
+		return map.containsKey(key);
+	}
+
+	public boolean containsValue(Object value) {
+		return map.containsKey(value);
+	}
+
+	public Collection values() {
+		return map.values();
+	}
+
+	public void putAll(Map t) {
+		map.putAll(t);
+		
+	}
+
+	public Set entrySet() {
+		return map.entrySet();
+	}
+
+	public Set keySet() {
+		return map.keySet();
+	}
+
+	public Object get(Object key) {
+		return map.get(key);
+	}
+
+	public Object remove(Object key) {
+		return map.remove(key);
+	}
+
+	public Object put(Object key, Object value) {
+		return map.put(key, value);
+	}
+
+	
+	public void setCloningFlag(int cloningFlag) {
+		this.cloningFlag = cloningFlag;
+		
+	}
+
+	private int getCloningFlag() {
+		return this.cloningFlag;
+		
+	}
+
+	public void setHardOwnerFlag(int flag){
+		this.hardOwnerFlag = flag;
+	}
+	
+	public int getHardOwnerFlag(){
+		return this.hardOwnerFlag;
+	}
+
+	public void setParentHandle(DwgHandleReference handle) {
+		this.parentHandle = handle;
+	}
+	public Object clone(){
+		DwgDictionary obj = new DwgDictionary(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgDictionary myObj = (DwgDictionary)obj;
+
+		myObj.setCloningFlag(cloningFlag);
+		myObj.setHardOwnerFlag(hardOwnerFlag);
+		myObj.setParentHandle(parentHandle);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttdef.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttdef.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgAttdef.java	(revision 435)
@@ -0,0 +1,337 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * The DwgAttdef class represents a DWG Attdef
+ * 
+ * @author jmorell
+ */
+public class DwgAttdef extends DwgObject {
+	public DwgAttdef(int index) {
+		super(index);
+	}
+	private int dataFlag;
+	private double elevation;
+	private Point2D insertionPoint;
+	private Point2D alignmentPoint;
+	private double[] extrusion;
+	private double thickness;
+	private double obliqueAngle;
+	private double rotationAngle;
+	private double height;
+	private double widthFactor;
+	private String text;
+	private int generation;
+	private int halign;
+	private int valign;
+	private String tag;
+	private int fieldLength;
+	private int flags;
+	private String prompt;
+	private DwgHandleReference styleHandle = null;
+	
+	
+	/**
+	 * @return Returns the alignmentPoint.
+	 */
+	public Point2D getAlignmentPoint() {
+		return alignmentPoint;
+	}
+	/**
+	 * @param alignmentPoint The alignmentPoint to set.
+	 */
+	public void setAlignmentPoint(Point2D alignmentPoint) {
+		this.alignmentPoint = alignmentPoint;
+	}
+	/**
+	 * @return Returns the dataFlag.
+	 */
+	public int getDataFlag() {
+		return dataFlag;
+	}
+	/**
+	 * @param dataFlag The dataFlag to set.
+	 */
+	public void setDataFlag(int dataFlag) {
+		this.dataFlag = dataFlag;
+	}
+	/**
+	 * @return Returns the elevation.
+	 */
+	public double getElevation() {
+		return elevation;
+	}
+	/**
+	 * @param elevation The elevation to set.
+	 */
+	public void setElevation(double elevation) {
+		this.elevation = elevation;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/**
+	 * @return Returns the fieldLength.
+	 */
+	public int getFieldLength() {
+		return fieldLength;
+	}
+	/**
+	 * @param fieldLength The fieldLength to set.
+	 */
+	public void setFieldLength(int fieldLength) {
+		this.fieldLength = fieldLength;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the generation.
+	 */
+	public int getGeneration() {
+		return generation;
+	}
+	/**
+	 * @param generation The generation to set.
+	 */
+	public void setGeneration(int generation) {
+		this.generation = generation;
+	}
+	/**
+	 * @return Returns the halign.
+	 */
+	public int getHalign() {
+		return halign;
+	}
+	/**
+	 * @param halign The halign to set.
+	 */
+	public void setHalign(int halign) {
+		this.halign = halign;
+	}
+	/**
+	 * @return Returns the height.
+	 */
+	public double getHeight() {
+		return height;
+	}
+	/**
+	 * @param height The height to set.
+	 */
+	public void setHeight(double height) {
+		this.height = height;
+	}
+	/**
+	 * @return Returns the insertionPoint.
+	 */
+	public Point2D getInsertionPoint() {
+		return insertionPoint;
+	}
+	/**
+	 * @param insertionPoint The insertionPoint to set.
+	 */
+	public void setInsertionPoint(Point2D insertionPoint) {
+		this.insertionPoint = insertionPoint;
+	}
+	/**
+	 * @return Returns the obliqueAngle.
+	 */
+	public double getObliqueAngle() {
+		return obliqueAngle;
+	}
+	/**
+	 * @param obliqueAngle The obliqueAngle to set.
+	 */
+	public void setObliqueAngle(double obliqueAngle) {
+		this.obliqueAngle = obliqueAngle;
+	}
+	/**
+	 * @return Returns the prompt.
+	 */
+	public String getPrompt() {
+		return prompt;
+	}
+	/**
+	 * @param prompt The prompt to set.
+	 */
+	public void setPrompt(String prompt) {
+		this.prompt = prompt;
+	}
+	/**
+	 * @return Returns the rotationAngle.
+	 */
+	public double getRotationAngle() {
+		return rotationAngle;
+	}
+	/**
+	 * @param rotationAngle The rotationAngle to set.
+	 */
+	public void setRotationAngle(double rotationAngle) {
+		this.rotationAngle = rotationAngle;
+	}
+	/**
+	 * @return Returns the styleHandle.
+	 */
+	public DwgHandleReference getStyleHandle() {
+		return styleHandle;
+	}
+	/**
+	 * @param styleHandle The styleHandle to set.
+	 */
+	public void setStyleHandle(DwgHandleReference styleHandle) {
+		this.styleHandle = styleHandle;
+	}
+	/**
+	 * @return Returns the tag.
+	 */
+	public String getTag() {
+		return tag;
+	}
+	/**
+	 * @param tag The tag to set.
+	 */
+	public void setTag(String tag) {
+		this.tag = tag;
+	}
+	/**
+	 * @return Returns the text.
+	 */
+	public String getText() {
+		return text;
+	}
+	/**
+	 * @param text The text to set.
+	 */
+	public void setText(String text) {
+		this.text = text;
+	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @return Returns the valign.
+	 */
+	public int getValign() {
+		return valign;
+	}
+	/**
+	 * @param valign The valign to set.
+	 */
+	public void setValign(int valign) {
+		this.valign = valign;
+	}
+	/**
+	 * @return Returns the widthFactor.
+	 */
+	public double getWidthFactor() {
+		return widthFactor;
+	}
+	/**
+	 * @param widthFactor The widthFactor to set.
+	 */
+	public void setWidthFactor(double widthFactor) {
+		this.widthFactor = widthFactor;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgAttdef obj = new DwgAttdef(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgAttdef myObj = (DwgAttdef)obj;
+
+		myObj.setAlignmentPoint(alignmentPoint);
+		myObj.setDataFlag(dataFlag);
+		myObj.setElevation(elevation);
+		myObj.setExtrusion(extrusion);
+		myObj.setFieldLength(fieldLength);
+		myObj.setFlags(flags);
+		myObj.setGeneration(generation);
+		myObj.setHalign(halign);
+		myObj.setHeight(height);
+		myObj.setInsertionPoint(insertionPoint);
+		myObj.setObliqueAngle(obliqueAngle);
+		myObj.setPrompt(prompt);
+		myObj.setRotationAngle(rotationAngle);
+		myObj.setStyleHandle(styleHandle);
+		myObj.setTag(tag);
+		myObj.setText(text);
+		myObj.setThickness(thickness);
+		myObj.setValign(valign);
+		myObj.setWidthFactor(widthFactor);
+		
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSolid.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSolid.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSolid.java	(revision 435)
@@ -0,0 +1,326 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.IDwgBlockMember;
+import org.gvsig.dwg.lib.IDwgExtrusionable;
+import org.gvsig.dwg.lib.util.AcadExtrusionCalculator;
+import org.gvsig.dwg.lib.util.FMapUtil;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+
+/**
+ * The DwgSolid class represents a DWG Solid
+ *
+ * @author jmorell, azabala
+ */
+public class DwgSolid extends DwgObject
+	implements IDwgExtrusionable,
+	IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
+
+
+	public DwgSolid(int index) {
+		super(index);
+	}
+	private double thickness;
+	private double elevation;
+	private double[] corner1;
+	private double[] corner2;
+	private double[] corner3;
+	private double[] corner4;
+	private double[] extrusion;
+
+	/**
+	 * Read a Solid in the DWG format Version 15
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws Exception If an unexpected bit value is found in the DWG file. Occurs
+	 * 		   when we are looking for LwPolylines.
+	 */
+	public void readDwgSolidV15(int[] data, int offset) throws Exception {
+
+	}
+	/**
+	 * @return Returns the corner1.
+	 */
+	public double[] getCorner1() {
+		return corner1;
+	}
+	/**
+	 * @param corner1 The corner1 to set.
+	 */
+	public void setCorner1(double[] corner1) {
+		this.corner1 = corner1;
+	}
+	/**
+	 * @return Returns the corner2.
+	 */
+	public double[] getCorner2() {
+		return corner2;
+	}
+	/**
+	 * @param corner2 The corner2 to set.
+	 */
+	public void setCorner2(double[] corner2) {
+		this.corner2 = corner2;
+	}
+	/**
+	 * @return Returns the corner3.
+	 */
+	public double[] getCorner3() {
+		return corner3;
+	}
+	/**
+	 * @param corner3 The corner3 to set.
+	 */
+	public void setCorner3(double[] corner3) {
+		this.corner3 = corner3;
+	}
+	/**
+	 * @return Returns the corner4.
+	 */
+	public double[] getCorner4() {
+		return corner4;
+	}
+	/**
+	 * @param corner4 The corner4 to set.
+	 */
+	public void setCorner4(double[] corner4) {
+		this.corner4 = corner4;
+	}
+    /**
+     * @return Returns the elevation.
+     */
+    public double getElevation() {
+        return elevation;
+    }
+    /**
+     * @param elevation The elevation to set.
+     */
+    public void setElevation(double elevation) {
+        this.elevation = elevation;
+    }
+    /**
+     * @return Returns the extrusion.
+     */
+    public double[] getExtrusion() {
+        return extrusion;
+    }
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+//	public Object clone() {
+//		DwgSolid dwgSolid = new DwgSolid(index);
+//		dwgSolid.setType(type);
+//		dwgSolid.setHandle(handle);
+//		dwgSolid.setVersion(version);
+//		dwgSolid.setMode(mode);
+//		dwgSolid.setLayerHandle(layerHandle);
+//		dwgSolid.setColor(color);
+//		dwgSolid.setNumReactors(numReactors);
+//		dwgSolid.setNoLinks(noLinks);
+//		dwgSolid.setLinetypeFlags(linetypeFlags);
+//		dwgSolid.setPlotstyleFlags(plotstyleFlags);
+//		dwgSolid.setSizeInBits(sizeInBits);
+//		dwgSolid.setExtendedData(extendedData);
+//		dwgSolid.setGraphicData(graphicData);
+//		//dwgSolid.setInsideBlock(insideBlock);
+//		dwgSolid.setThickness(thickness);
+//		dwgSolid.setElevation(elevation);
+//		dwgSolid.setCorner1(corner1);
+//		dwgSolid.setCorner2(corner2);
+//		dwgSolid.setCorner3(corner3);
+//		dwgSolid.setCorner4(corner4);
+//		dwgSolid.setExtrusion(extrusion);
+//		return dwgSolid;
+//	}
+	/**
+	 * @return Returns the thickness.
+	 */
+	public double getThickness() {
+		return thickness;
+	}
+	/**
+	 * @param thickness The thickness to set.
+	 */
+	public void setThickness(double thickness) {
+		this.thickness = thickness;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion()
+	 */
+	public void applyExtrussion() {
+		 double[] corner1 = getCorner1();
+         double[] corner2 = getCorner2();
+         double[] corner3 = getCorner3();
+         double[] corner4 = getCorner4();
+         double[] solidExt = getExtrusion();
+         corner1 = AcadExtrusionCalculator.extrude2(corner1, solidExt);
+         corner2 = AcadExtrusionCalculator.extrude2(corner2, solidExt);
+         corner3 = AcadExtrusionCalculator.extrude2(corner3, solidExt);
+         corner4 = AcadExtrusionCalculator.extrude2(corner4, solidExt);
+
+
+         setCorner1(corner1);
+         setCorner2(corner2);
+         setCorner3(corner3);
+         setCorner4(corner4);
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData()
+	 */
+	public boolean has3DData() {
+		return (getElevation() != 0.0);
+	}
+	public double getZ() {
+		return getElevation();
+	}
+	public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
+		int subType = getGeometrySubType(is3DFile);
+
+		double[] p1 = getCorner1();
+		double[] p2 = getCorner2();
+		double[] p3 = getCorner3();
+		double[] p4 = getCorner4();
+		double elev = getElevation();
+		List pts = new ArrayList();
+
+		if (is3DFile) {
+			double[] p13d = new double[]{p1[0], p1[1], elev};
+			double[] p23d = new double[]{p2[0], p2[1], elev};
+			double[] p33d = new double[]{p3[0], p3[1], elev};
+			double[] p43d = new double[]{p4[0], p4[1], elev};
+			pts.add(p13d);
+			pts.add(p23d);
+			pts.add(p33d);
+			pts.add(p43d);
+		} else {
+			pts.add(p1);
+			pts.add(p2);
+			pts.add(p3);
+			pts.add(p4);
+		}
+		return FMapUtil.ptsToPolygon(pts, subType);
+//		return ShapeFactory.createGeometry(solid);
+
+	}
+	public String toFMapString(boolean is3DFile) {
+		if(is3DFile){
+			return "FPolyline3D";
+		}else{
+			return "FPolyline2D";
+		}
+	}
+
+	public String toString(){
+		return "Solid";
+	}
+	public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot,
+			List dwgObjectsWithoutBlocks,
+			Map handleObjWithoutBlocks,
+			DwgFile callBack) {
+		DwgSolid transformedEntity = null;
+		double[] corner1 = this.getCorner1();
+		double[] corner2 = this.getCorner2();
+		double[] corner3 = this.getCorner3();
+		double[] corner4 = this.getCorner4();
+		Point2D pointAux = new Point2D.Double(corner1[0] - bPoint[0], corner1[1] - bPoint[1]);
+		double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double[] transformedP1 = new double[]{laX, laY};
+		pointAux = new Point2D.Double(corner2[0] - bPoint[0], corner2[1] - bPoint[1]);
+		laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double[] transformedP2 = new double[]{laX, laY};
+		pointAux = new Point2D.Double(corner3[0] - bPoint[0], corner3[1] - bPoint[1]);
+		laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double[] transformedP3 = new double[]{laX, laY};
+		pointAux = new Point2D.Double(corner4[0] - bPoint[0], corner4[1] - bPoint[1]);
+		laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot));
+		laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot));
+		double[] transformedP4 = new double[]{laX, laY};
+		transformedEntity = (DwgSolid)this.clone();
+		transformedEntity.setCorner1(transformedP1);
+		transformedEntity.setCorner2(transformedP2);
+		transformedEntity.setCorner3(transformedP3);
+		transformedEntity.setCorner4(transformedP4);
+		transformedEntity.setElevation(this.getElevation() * scale[2]);
+		dwgObjectsWithoutBlocks.add(transformedEntity);
+		handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity);
+	}
+
+	public Object clone(){
+		DwgSolid obj = new DwgSolid(index);
+		this.fill(obj);
+		return obj;
+	}
+
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgSolid myObj = (DwgSolid)obj;
+
+		myObj.setCorner1(corner1);
+		myObj.setCorner2(corner2);
+		myObj.setCorner3(corner3);
+		myObj.setCorner4(corner4);
+		myObj.setElevation(elevation);
+		myObj.setExtrusion(extrusion);
+		myObj.setThickness(thickness);
+
+	}
+
+	public int getGeometryType() {
+		// return Geometry.TYPES.SOLID; FIXME not implemented
+		return Geometry.TYPES.SURFACE;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayer.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayer.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLayer.java	(revision 435)
@@ -0,0 +1,237 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * The DwgLayer class represents a DWG Layer
+ * 
+ * @author jmorell
+ */
+public class DwgLayer extends DwgObject {
+	public DwgLayer(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private String name;
+	private boolean flag64;
+	private int xRefPlus;
+	private boolean xdep;
+	private int flags;
+	private int color;
+	private DwgHandleReference layerControlHandle = null;
+	private DwgHandleReference nullHandle = null;
+	private DwgHandleReference plotstyleHandle = null;
+	private DwgHandleReference linetypeHandle = null;
+	private boolean frozen;
+	private boolean on;
+	private boolean frozenInNew;
+	private boolean locked;
+	
+	/**
+	 * @return Returns the color.
+	 */
+	public int getColor() {
+		return color;
+	}
+	/**
+	 * @param color The color to set.
+	 */
+	public void setColor(int color) {
+		this.color = color;
+	}
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+	/**
+	 * @param name The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	/**
+	 * @return Returns the flag64.
+	 */
+	public boolean isFlag64() {
+		return flag64;
+	}
+	/**
+	 * @param flag64 The flag64 to set.
+	 */
+	public void setFlag64(boolean flag64) {
+		this.flag64 = flag64;
+	}
+	/**
+	 * @return Returns the xRefPlus.
+	 */
+	public int getXRefPlus() {
+		return xRefPlus;
+	}
+	/**
+	 * @param refPlus The xRefPlus to set.
+	 */
+	public void setXRefPlus(int refPlus) {
+		xRefPlus = refPlus;
+	}
+	/**
+	 * @return Returns the xdep.
+	 */
+	public boolean isXdep() {
+		return xdep;
+	}
+	/**
+	 * @param xdep The xdep to set.
+	 */
+	public void setXdep(boolean xdep) {
+		this.xdep = xdep;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the layerControlHandle.
+	 */
+	public DwgHandleReference getLayerControlHandle() {
+		return layerControlHandle;
+	}
+	/**
+	 * @param layerControlHandle The layerControlHandle to set.
+	 */
+	public void setLayerControlHandle(DwgHandleReference layerControlHandle) {
+		this.layerControlHandle = layerControlHandle;
+	}
+	/**
+	 * @return Returns the nullHandle.
+	 */
+	public DwgHandleReference getNullHandle() {
+		return nullHandle;
+	}
+	/**
+	 * @param nullHandle The nullHandle to set.
+	 */
+	public void setNullHandle(DwgHandleReference nullHandle) {
+		this.nullHandle = nullHandle;
+	}
+	/**
+	 * @return Returns the linetypeHandle.
+	 */
+	public DwgHandleReference getLinetypeHandle() {
+		return linetypeHandle;
+	}
+	/**
+	 * @param linetypeHandle The linetypeHandle to set.
+	 */
+	public void setLinetypeHandle(DwgHandleReference linetypeHandle) {
+		this.linetypeHandle = linetypeHandle;
+	}
+	/**
+	 * @return Returns the plotstyleHandle.
+	 */
+	public DwgHandleReference getPlotstyleHandle() {
+		return plotstyleHandle;
+	}
+	/**
+	 * @param plotstyleHandle The plotstyleHandle to set.
+	 */
+	public void setPlotstyleHandle(DwgHandleReference plotstyleHandle) {
+		this.plotstyleHandle = plotstyleHandle;
+	}
+	public void setFrozen(boolean frozen) {
+		this.frozen = frozen;
+	}
+	public void setOn(boolean on) {
+		this.on = on;
+	}
+	public void setFrozenInNew(boolean frozenInNew) {
+		this.frozenInNew = frozenInNew;
+	}
+	public void setLocked(boolean locked) {
+		this.locked = locked;
+	}
+	public boolean isFrozen() {
+		return frozen;
+	}
+	public boolean isFrozenInNew() {
+		return frozenInNew;
+	}
+	public boolean isLocked() {
+		return locked;
+	}
+	public boolean isOn() {
+		return on;
+	}
+	
+	public Object clone(){
+		DwgLayer obj = new DwgLayer(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgLayer myObj = (DwgLayer)obj;
+
+		myObj.setColor(color);
+		myObj.setFlag64(flag64);
+		myObj.setFlags(flags);
+		myObj.setFrozen(frozen);
+		myObj.setFrozenInNew(frozenInNew);
+		myObj.setLayerControlHandle(layerControlHandle);
+		myObj.setLinetypeHandle(linetypeHandle);
+		myObj.setLocked(locked);
+		myObj.setName(name);
+		myObj.setNullHandle(nullHandle);
+		myObj.setOn(on);
+		myObj.setPlotstyleHandle(plotstyleHandle);
+		myObj.setXdep(xdep);
+		myObj.setXRefPlus(xRefPlus);
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFace.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFace.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgVertexPFace.java	(revision 435)
@@ -0,0 +1,127 @@
+/*
+ * Created on 03-feb-2007
+ *
+ * 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
+ */
+/* CVS MESSAGES:
+*
+* $Id: DwgVertexPFace.java 28969 2009-05-25 13:23:12Z jmvivo $
+* $Log$
+* Revision 1.2.2.2  2007-03-21 19:49:16  azabala
+* implementation of dwg 12, 13, 14.
+*
+* Revision 1.6  2007/03/20 19:57:08  azabala
+* source code cleaning
+*
+* Revision 1.5  2007/03/06 19:39:38  azabala
+* Changes to adapt dwg 12 to general architecture
+*
+* Revision 1.4  2007/03/02 20:31:22  azabala
+* *** empty log message ***
+*
+* Revision 1.3  2007/03/01 19:59:00  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2007/02/07 12:44:27  fdiaz
+* A�adido o modificado el metodo clone para que el DwgObject se encargue de las propiedades comunes a todos los objetos.
+* A�adido el metodo fill.
+*
+* Revision 1.1  2007/02/05 07:03:22  azabala
+* *** empty log message ***
+*
+*
+*/
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.IDwgVertex;
+
+/**
+ * 
+ * A vertex whose superentity is a DwgPFacePolyline
+ * (a polyface mesh vertex)
+ * 
+ * This vertex is similar to Vertex3D.
+ * */
+public class DwgVertexPFace extends DwgObject implements IDwgVertex {
+
+	private int flags;
+	private double[] point;
+
+	public DwgVertexPFace(int index) {
+		super(index);
+	}
+
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+
+	public void setPoint(double[] ds) {
+		this.point = ds;
+	}
+
+	public int getFlags() {
+		return flags;
+	}
+
+	public double[] getPoint() {
+		return point;
+	}
+	public Object clone(){
+		DwgVertexPFace obj = new DwgVertexPFace(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgVertexPFace myObj = (DwgVertexPFace)obj;
+
+		myObj.setFlags(flags);
+		myObj.setPoint(point);
+	}
+	
+	public String toString(){
+		return "[x="+point[0]+", y="+point[1]+", z="+point[2]+"]";
+	}
+
+}
+
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSeqend.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSeqend.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgSeqend.java	(revision 435)
@@ -0,0 +1,62 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import org.gvsig.dwg.lib.DwgObject;
+
+/**
+ * The DwgSeqend class represents a DWG Seqend
+ * 
+ * @author jmorell
+ */
+public class DwgSeqend extends DwgObject {
+	
+	public DwgSeqend(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	public Object clone(){
+		DwgSeqend obj = new DwgSeqend(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		//DwgSeqend myObj = (DwgSeqend)obj;
+
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLinearDimension.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLinearDimension.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLinearDimension.java	(revision 435)
@@ -0,0 +1,363 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib.objects;
+
+import java.awt.geom.Point2D;
+
+import org.gvsig.dwg.lib.DwgHandleReference;
+import org.gvsig.dwg.lib.DwgObject;
+
+
+/**
+ * The DwgLinearDimension class represents a DWG Linear dimension
+ * 
+ * @author jmorell
+ */
+public class DwgLinearDimension extends DwgObject {
+	public DwgLinearDimension(int index) {
+		super(index);
+		// TODO Auto-generated constructor stub
+	}
+	private double[] extrusion;
+	private Point2D textMidpoint;
+	private double elevation;
+	private int flags;
+	private String text;
+	private double rotation;
+	private double horizDir;
+	private double[] insScale;
+	private double insRotation;
+	private int attachmentPoint;
+	private int linespaceStyle;
+	private double linespaceFactor;
+	private double actualMeasurement;
+	private Point2D pt12;
+	private double[] pt10;
+	private double[] pt13;
+	private double[] pt14;
+	private double extRotation;
+	private double dimensionRotation;
+	private DwgHandleReference dimstyleHandle = null;
+	private DwgHandleReference anonBlockHandle = null;
+    /**
+     * @return Returns the elevation.
+     */
+    public double getElevation() {
+        return elevation;
+    }
+    /**
+     * @param elevation The elevation to set.
+     */
+    public void setElevation(double elevation) {
+        this.elevation = elevation;
+    }
+
+    /**
+	 * @return Returns the actualMeasurement.
+	 */
+	public double getActualMeasurement() {
+		return actualMeasurement;
+	}
+	/**
+	 * @param actualMeasurement The actualMeasurement to set.
+	 */
+	public void setActualMeasurement(double actualMeasurement) {
+		this.actualMeasurement = actualMeasurement;
+	}
+	/**
+	 * @return Returns the anonBlockHandle.
+	 */
+	public DwgHandleReference getAnonBlockHandle() {
+		return anonBlockHandle;
+	}
+	/**
+	 * @param anonBlockHandle The anonBlockHandle to set.
+	 */
+	public void setAnonBlockHandle(DwgHandleReference anonBlockHandle) {
+		this.anonBlockHandle = anonBlockHandle;
+	}
+	/**
+	 * @return Returns the attachmentPoint.
+	 */
+	public int getAttachmentPoint() {
+		return attachmentPoint;
+	}
+	/**
+	 * @param attachmentPoint The attachmentPoint to set.
+	 */
+	public void setAttachmentPoint(int attachmentPoint) {
+		this.attachmentPoint = attachmentPoint;
+	}
+	/**
+	 * @return Returns the dimensionRotation.
+	 */
+	public double getDimensionRotation() {
+		return dimensionRotation;
+	}
+	/**
+	 * @param dimensionRotation The dimensionRotation to set.
+	 */
+	public void setDimensionRotation(double dimensionRotation) {
+		this.dimensionRotation = dimensionRotation;
+	}
+	/**
+	 * @return Returns the dimstyleHandle.
+	 */
+	public DwgHandleReference getDimstyleHandle() {
+		return dimstyleHandle;
+	}
+	/**
+	 * @param dimstyleHandle The dimstyleHandle to set.
+	 */
+	public void setDimstyleHandle(DwgHandleReference dimstyleHandle) {
+		this.dimstyleHandle = dimstyleHandle;
+	}
+	/**
+	 * @return Returns the extRotation.
+	 */
+	public double getExtRotation() {
+		return extRotation;
+	}
+	/**
+	 * @param extRotation The extRotation to set.
+	 */
+	public void setExtRotation(double extRotation) {
+		this.extRotation = extRotation;
+	}
+	/**
+	 * @return Returns the extrusion.
+	 */
+	public double[] getExtrusion() {
+		return extrusion;
+	}
+	/**
+	 * @param extrusion The extrusion to set.
+	 */
+	public void setExtrusion(double[] extrusion) {
+		this.extrusion = extrusion;
+	}
+	/**
+	 * @return Returns the flags.
+	 */
+	public int getFlags() {
+		return flags;
+	}
+	/**
+	 * @param flags The flags to set.
+	 */
+	public void setFlags(int flags) {
+		this.flags = flags;
+	}
+	/**
+	 * @return Returns the horizDir.
+	 */
+	public double getHorizDir() {
+		return horizDir;
+	}
+	/**
+	 * @param horizDir The horizDir to set.
+	 */
+	public void setHorizDir(double horizDir) {
+		this.horizDir = horizDir;
+	}
+	/**
+	 * @return Returns the insRotation.
+	 */
+	public double getInsRotation() {
+		return insRotation;
+	}
+	/**
+	 * @param insRotation The insRotation to set.
+	 */
+	public void setInsRotation(double insRotation) {
+		this.insRotation = insRotation;
+	}
+	/**
+	 * @return Returns the insScale.
+	 */
+	public double[] getInsScale() {
+		return insScale;
+	}
+	/**
+	 * @param insScale The insScale to set.
+	 */
+	public void setInsScale(double[] insScale) {
+		this.insScale = insScale;
+	}
+	/**
+	 * @return Returns the linespaceFactor.
+	 */
+	public double getLinespaceFactor() {
+		return linespaceFactor;
+	}
+	/**
+	 * @param linespaceFactor The linespaceFactor to set.
+	 */
+	public void setLinespaceFactor(double linespaceFactor) {
+		this.linespaceFactor = linespaceFactor;
+	}
+	/**
+	 * @return Returns the linespaceStyle.
+	 */
+	public int getLinespaceStyle() {
+		return linespaceStyle;
+	}
+	/**
+	 * @param linespaceStyle The linespaceStyle to set.
+	 */
+	public void setLinespaceStyle(int linespaceStyle) {
+		this.linespaceStyle = linespaceStyle;
+	}
+	/**
+	 * @return Returns the pt10.
+	 */
+	public double[] getPt10() {
+		return pt10;
+	}
+	/**
+	 * @param pt10 The pt10 to set.
+	 */
+	public void setPt10(double[] pt10) {
+		this.pt10 = pt10;
+	}
+	/**
+	 * @return Returns the pt12.
+	 */
+	public Point2D getPt12() {
+		return pt12;
+	}
+	/**
+	 * @param pt12 The pt12 to set.
+	 */
+	public void setPt12(Point2D pt12) {
+		this.pt12 = pt12;
+	}
+	/**
+	 * @return Returns the pt13.
+	 */
+	public double[] getPt13() {
+		return pt13;
+	}
+	/**
+	 * @param pt13 The pt13 to set.
+	 */
+	public void setPt13(double[] pt13) {
+		this.pt13 = pt13;
+	}
+	/**
+	 * @return Returns the pt14.
+	 */
+	public double[] getPt14() {
+		return pt14;
+	}
+	/**
+	 * @param pt14 The pt14 to set.
+	 */
+	public void setPt14(double[] pt14) {
+		this.pt14 = pt14;
+	}
+	/**
+	 * @return Returns the rotation.
+	 */
+	public double getRotation() {
+		return rotation;
+	}
+	/**
+	 * @param rotation The rotation to set.
+	 */
+	public void setRotation(double rotation) {
+		this.rotation = rotation;
+	}
+	/**
+	 * @return Returns the text.
+	 */
+	public String getText() {
+		return text;
+	}
+	/**
+	 * @param text The text to set.
+	 */
+	public void setText(String text) {
+		this.text = text;
+	}
+	/**
+	 * @return Returns the textMidpoint.
+	 */
+	public Point2D getTextMidpoint() {
+		return textMidpoint;
+	}
+	/**
+	 * @param textMidpoint The textMidpoint to set.
+	 */
+	public void setTextMidpoint(Point2D textMidpoint) {
+		this.textMidpoint = textMidpoint;
+	}
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	public Object clone(){
+		DwgLinearDimension obj = new DwgLinearDimension(index);
+		this.fill(obj);
+		return obj;
+	}
+	
+	protected void fill(DwgObject obj){
+		super.fill(obj);
+		DwgLinearDimension myObj = (DwgLinearDimension)obj;
+
+		myObj.setActualMeasurement(actualMeasurement);
+		myObj.setAnonBlockHandle(anonBlockHandle);
+		myObj.setAttachmentPoint(attachmentPoint);
+		myObj.setDimensionRotation(dimensionRotation);
+		myObj.setDimstyleHandle(dimstyleHandle);
+		myObj.setElevation(elevation);
+		myObj.setExtRotation(extRotation);
+		myObj.setExtrusion(extrusion);
+		myObj.setFlags(flags);
+		myObj.setHorizDir(horizDir);
+		myObj.setInsRotation(insRotation);
+		myObj.setInsScale(insScale);
+		myObj.setLinespaceFactor(linespaceFactor);
+		myObj.setLinespaceStyle(linespaceStyle);
+		myObj.setPt10(pt10);
+		myObj.setPt12(pt12);
+		myObj.setPt13(pt13);
+		myObj.setPt14(pt14);
+		myObj.setRotation(rotation);
+		myObj.setText(text);
+		myObj.setTextMidpoint(textMidpoint);
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHandleReference.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHandleReference.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgHandleReference.java	(revision 435)
@@ -0,0 +1,119 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Equipo de desarrollo de gvSIG.
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2007 IVER TI S.A. 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:
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */package org.gvsig.dwg.lib;
+
+import java.util.ArrayList;
+
+
+public class DwgHandleReference {
+
+	private Integer code=null;
+	private Integer offset=null;
+	private Integer counter=null;
+
+	public DwgHandleReference(int code, int offset){
+		this.code=new Integer(code);
+		this.offset=new Integer(offset);
+	}
+
+	public DwgHandleReference(){
+	}
+
+	public void setCode(int code){
+		this.code = new Integer(code);
+	}
+
+	public void setOffset(int offset){
+		this.offset=new Integer(offset);
+	}
+
+	public int getCode(){
+		return this.code.intValue();
+	}
+
+	public int getOffset(){
+		return this.offset.intValue();
+	}
+
+	public int getCounter(){
+		return this.counter.intValue();
+	}
+
+	public void setCounter(int counter){
+		this.counter=new Integer(counter);
+	}
+
+	/**
+	 * Read a pair of int values (the HandleCode and HandleOffset of a handle of a DWG object)
+	 * from a group of unsigned bytes and initializes the properties.
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws Exception If an unexpected bit value is found in the DWG file. Occurs
+	 * 		   when we are looking for LwPolylines.
+	 * @return int Represents the new offset.
+	 *
+	 * 	 */
+	public int read(int[] data, int offset) throws RuntimeException, CorruptedDwgEntityException{
+		ArrayList v = new ArrayList();
+		int code = ((Integer)DwgUtil.getBits(data, 4, offset)).intValue();
+		int counter = ((Integer)DwgUtil.getBits(data, 4, (offset + 4))).intValue();
+		int read = 8;
+		ArrayList hlist = new ArrayList();
+		if (counter>0) {
+			int hlen = counter * 8;
+			Object handle = DwgUtil.getBits(data, hlen, (offset + 8));
+			read = read + hlen;
+			if (hlen > 8) {
+				byte[] handleBytes = (byte[])handle;
+				int[] handleInts = new int[handleBytes.length];
+				// Hacerlos unsigned ...
+				for (int i=0; i<handleBytes.length; i++) {
+					handleInts[i] = ByteUtils.getUnsigned(handleBytes[i]);
+				}
+				for (int i=0; i<handleInts.length; i++) {
+					hlist.add(new Integer(handleInts[i]));
+				}
+			} else {
+				hlist.add(handle);
+			}
+		}
+		v.add(new Integer(code));
+		v.add(new Integer(counter));
+		for (int i=0;i<hlist.size();i++) {
+			v.add(hlist.get(i));
+		}
+		setCode(code);
+		setCounter(counter);
+		setOffset(DwgUtil.handleBinToHandleInt(v));
+		return offset+read;
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgSectionOffset.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgSectionOffset.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgSectionOffset.java	(revision 435)
@@ -0,0 +1,84 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+/**
+ * The DwgSectionOffset class is useful to store the key of a DWG section with its seek
+ * (or offset) and with its size
+ * 
+ * @author jmorell
+ */
+public class DwgSectionOffset {
+	private String key;
+	private int seek;
+	private int size;
+	
+	/**
+	 * Creates a new DwgSectionOffset object
+	 * 
+	 * @param key Section key
+	 * @param seek Seeker or offset in the DWG file for this section
+	 * @param size Size of this section
+	 */
+	public DwgSectionOffset(String key, int seek, int size) {
+		this.key = key;
+		this.seek = seek;
+		this.size = size;
+	}
+    /**
+     * @return Returns the key.
+     */
+    public String getKey() {
+        return key;
+    }
+    /**
+     * @param key The key to set.
+     */
+    public void setKey(String key) {
+        this.key = key;
+    }
+    /**
+     * @return Returns the seek.
+     */
+    public int getSeek() {
+        return seek;
+    }
+    /**
+     * @param seek The seek to set.
+     */
+    public void setSeek(int seek) {
+        this.seek = seek;
+    }
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass2004.java	(revision 435)
@@ -0,0 +1,82 @@
+package org.gvsig.dwg.lib;
+
+public class DwgClass2004 extends DwgClass {
+
+	int numberObject;
+	int maintenanceVersion;
+	int DwgVersion;
+	int unknown1;
+	int unknown2;
+
+	public DwgClass2004(int classNum, int version, String appName, String cPlusPlusName,
+			String dxfName, boolean isZombie, int id, int numberObject,
+			int maintenanceVersion,int DwgVersion,int unknown1, int unknown2) {
+		super( classNum, version,  appName,
+    		 cPlusPlusName, dxfName, isZombie, id);
+
+        this.numberObject = numberObject;
+        this.maintenanceVersion = maintenanceVersion;
+        this.DwgVersion = DwgVersion;
+        this.unknown1 = unknown1;
+        this.unknown2 = unknown2;
+
+	}
+
+	public String toString(){
+    	String solution = "";
+    	solution += "classNum ="+classNum;
+    	solution += ", version = "+version;
+    	solution += ", appName = "+appName;
+    	solution += ", c++Name = "+cPlusPlusName;
+    	solution += ", dxfName = "+dxfName;
+    	solution += ", isZombie = " + isZombie;
+    	solution += ", numberObject = " + numberObject;
+    	solution += ", maintenanceVersion = " + maintenanceVersion;
+    	solution += ", DwgVersion = " + DwgVersion;
+    	solution += ", unknown1 = " + unknown1;
+    	solution += ", unknown2 = " + unknown2;
+    	return solution;
+    }
+
+	/**
+	 * @return Returns the numberObject.
+	 */
+	public int getNumberObject() {
+		return numberObject;
+	}
+	/**
+	 * @param numberObject The numberObject to set.
+	 */
+	public void setNumberObject(int numberObject) {
+		this.numberObject = numberObject;
+	}
+
+	/**
+	 * @return Returns the maintenanceVersion.
+	 */
+	public int getMaintenanceVersion() {
+		return maintenanceVersion;
+	}
+	/**
+	 * @param maintenanceVersion The maintenanceVersion to set.
+	 */
+	public void setMaintenanceVersion(int maintenanceVersion) {
+		this.maintenanceVersion = maintenanceVersion;
+	}
+
+
+	/**
+	 * @return Returns the DwgVersion.
+	 */
+	public int getDwgVersion() {
+		return DwgVersion;
+	}
+	/**
+	 * @param DwgVersion The DwgVersion to set.
+	 */
+	public void setDwgVersion(int DwgVersion) {
+		this.DwgVersion = DwgVersion;
+	}
+
+
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgUtil.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgUtil.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgUtil.java	(revision 435)
@@ -0,0 +1,827 @@
+/* jdwglib. Java Library for reading Dwg files.
+ *
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ *
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.dwg.lib.util.HexUtil;
+
+
+
+/**
+ * The DwgUtil class contains the essential set of functions for reading bitstreams
+ * in DWG files
+ *
+ * @author jmorell
+ */
+public final class DwgUtil {
+
+	/**
+	 * Read the extended data for a DWG object
+	 * Don't use in this version. Serious bugs detected
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the extended data of a DWG object
+	 */
+	public static ArrayList readExtendedData(int[] data, int offset) throws RuntimeException {
+		int bitPos = offset;
+		ArrayList extData = new ArrayList();
+		while (true) {
+			int newBitPos = ((Integer)getBitShort(data, bitPos).get(0)).intValue();
+			int size = ((Integer) getBitShort(data, bitPos).get(1)).intValue();
+			bitPos = newBitPos;
+			if (size == 0) {
+				break;
+			}
+			newBitPos = ((Integer)((ArrayList)getHandle(data, bitPos)).get(0)).intValue();
+			// TODO: Esto no es correcto. Repasar ...
+			int handle = ((Integer)((ArrayList)getHandle(data, bitPos)).get(1)).intValue();
+			bitPos = newBitPos;
+			ArrayList eedata = new ArrayList();
+			while (size > 0) {
+				newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+				int cb = ((Integer) getRawChar(data, bitPos).get(1)).intValue();
+				bitPos = newBitPos;
+				size = size - 1;
+				if (cb == 0x0) {
+					newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+					int len = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					newBitPos = ((Integer)getRawShort(data, bitPos).get(0)).intValue();
+					int cp = ((Integer)getRawShort(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					ArrayList chars = new ArrayList();
+					for (int i = 0; i < len; i++) {
+						newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+						int charr = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+						bitPos = newBitPos;
+						// �int o char?
+						chars.add(new Integer(charr));
+					}
+					// Incorrecto. Repasar ...
+					eedata.add(chars);
+					size = size - len - 3;
+				} else if (cb == 0x1) {
+					System.out.println("Invalid EXX code byte: 0x1");
+				} else if (cb == 0x2) {
+					newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+					int charr = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					if (charr == 0x0) {
+						eedata.add("{");
+					} else if (charr == 0x1) {
+						eedata.add("}");
+					} else {
+						System.out.println("Unexpected EXX char: " + charr);
+					}
+					size = size - 1;
+				} else if (cb == 0x3 || cb == 0x5) {
+					ArrayList chars = new ArrayList();
+					for (int i = 0; i < 8; i++) {
+						newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+						int charr = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+						bitPos = newBitPos;
+						chars.add(new Integer(charr));
+					}
+					eedata.add(chars);
+					size = size - 8;
+				} else if (cb == 0x4) {
+					newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+					int len = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					ArrayList chars = new ArrayList();
+					for (int i = 0; i < len; i++) {
+						newBitPos = ((Integer)getRawChar(data, bitPos).get(0)).intValue();
+						int charr = ((Integer)getRawChar(data, bitPos).get(1)).intValue();
+						bitPos = newBitPos;
+						chars.add(new Integer(charr));
+					}
+					eedata.add(chars);
+					size = size - len - 1;
+				} else if (0xa <= cb && cb <= 0xd) {
+					newBitPos = ((Integer)((ArrayList)getRawDouble(data, bitPos)).get(0)).intValue();
+					double d1 = ((Double)((ArrayList)getRawDouble(data, bitPos)).get(1)).doubleValue();
+					bitPos = newBitPos;
+					newBitPos = ((Integer)((ArrayList)getRawDouble(data, bitPos)).get(0)).intValue();
+					double d2 = ((Double)((ArrayList)getRawDouble(data, bitPos)).get(1)).doubleValue();
+					bitPos = newBitPos;
+					newBitPos = ((Integer)((ArrayList)getRawDouble(data, bitPos)).get(0)).intValue();
+					double d3 = ((Double)((ArrayList)getRawDouble(data, bitPos)).get(1)).doubleValue();
+					bitPos = newBitPos;
+					eedata.add(new double[] { d1, d2, d3 });
+					size = size - 24;
+				} else if (0x28 <= cb && cb <= 0x2a) {
+					newBitPos = ((Integer)((ArrayList)getRawDouble(data, bitPos)).get(0)).intValue();
+					double d = ((Double)((ArrayList)getRawDouble(data, bitPos)).get(1)).doubleValue();
+					bitPos = newBitPos;
+					eedata.add(new Double(d));
+					size = size - 8;
+				} else if (cb == 0x46) {
+					newBitPos = ((Integer)getRawShort(data, bitPos).get(0)).intValue();
+					int shortt = ((Integer)getRawShort(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					eedata.add(new Integer(shortt));
+					size = size - 2;
+				} else if (cb == 0x47) {
+					newBitPos = ((Integer)getRawLong(data, bitPos).get(0)).intValue();
+					int longg = ((Integer)getRawLong(data, bitPos).get(1)).intValue();
+					bitPos = newBitPos;
+					eedata.add(new Integer(longg));
+					size = size - 4;
+				} else {
+					System.out.println("Unexpected code byte: " + cb);
+				}
+			}
+			ArrayList v = new ArrayList();
+			// v.add(handle, eedata);
+			extData.add(v);
+		}
+		ArrayList v = new ArrayList();
+		v.add(new Integer(bitPos));
+		v.add(extData);
+		return v;
+	}
+
+	/**
+	 * Read a double value from a group of unsigned bytes and a default double
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @param defVal Default double value
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the double value
+	 */
+	public static ArrayList getDefaultDouble(int[] data, int offset, double defVal) throws RuntimeException {
+		int flags = ((Integer) getBits(data, 2, offset)).intValue();
+		int read = 2;
+		double val;
+		if (flags == 0x0) {
+			val = defVal;
+		} else {
+			int _offset = offset + 2;
+			if (flags == 0x3) {
+				byte[] bytes = (byte[]) getBits(data, 64, _offset);
+				ByteBuffer bb = ByteBuffer.wrap(bytes);
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				val = bb.getDouble();
+				read = 66;
+			} else {
+				byte[] dstrArrayAux = new byte[8];
+				int[] doubleOffset = new int[] { 0 };
+				ByteUtils.doubleToBytes(defVal, dstrArrayAux, doubleOffset);
+				byte[] dstrArrayAuxx = new byte[8];
+				dstrArrayAuxx[0] = dstrArrayAux[7];
+				dstrArrayAuxx[1] = dstrArrayAux[6];
+				dstrArrayAuxx[2] = dstrArrayAux[5];
+				dstrArrayAuxx[3] = dstrArrayAux[4];
+				dstrArrayAuxx[4] = dstrArrayAux[3];
+				dstrArrayAuxx[5] = dstrArrayAux[2];
+				dstrArrayAuxx[6] = dstrArrayAux[1];
+				dstrArrayAuxx[7] = dstrArrayAux[0];
+				int[] dstrArrayAuxxx = new int[8];
+				for (int i = 0; i < dstrArrayAuxxx.length; i++) {
+					dstrArrayAuxxx[i] = ByteUtils.getUnsigned(dstrArrayAuxx[i]);
+				}
+				byte[] dstrArray = new byte[8];
+				for (int i = 0; i < dstrArray.length; i++) {
+					dstrArray[i] = (byte) dstrArrayAuxxx[i];
+				}
+				if (flags == 0x1) {
+					byte[] ddArray = (byte[]) getBits(data, 32, _offset);
+					dstrArray[0] = ddArray[0];
+					dstrArray[1] = ddArray[1];
+					dstrArray[2] = ddArray[2];
+					dstrArray[3] = ddArray[3];
+					read = 34;
+				} else {
+					byte[] ddArray = (byte[]) getBits(data, 48, _offset);
+					dstrArray[4] = ddArray[0];
+					dstrArray[5] = ddArray[1];
+					dstrArray[0] = ddArray[2];
+					dstrArray[1] = ddArray[3];
+					dstrArray[2] = ddArray[4];
+					dstrArray[3] = ddArray[5];
+					read = 50;
+				}
+				ByteBuffer bb = ByteBuffer.wrap(dstrArray);
+				bb.order(ByteOrder.LITTLE_ENDIAN);
+				val = bb.getDouble();
+			}
+		}
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + read));
+		v.add(new Double(val));
+		return v;
+	}
+
+
+	/**
+	 * Read a double value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the double value
+	 */
+	public static ArrayList getBitDouble(int[] data, int offset) throws RuntimeException {
+		ArrayList v = new ArrayList();
+		int type = ((Integer) getBits(data, 2, offset)).intValue();
+		int read = 2;
+		double val = 0.0;
+		if (type == 0x00) {
+			byte[] bytes = (byte[]) getBits(data, 64, (offset + 2));
+			ByteBuffer bb = ByteBuffer.wrap(bytes);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			val = bb.getDouble();
+			read = 66;
+		} else if (type == 0x01) {
+			val = 1.0;
+		} else if (type == 0x02) {
+			val = 0.0;
+		} else {
+			System.out.println("Bad type " + type + " at bit offset: " + offset);
+		}
+		v.add(new Integer(offset + read));
+		v.add(new Double(val));
+		return v;
+	}
+
+
+	/**
+	 * Read a double value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the double value
+	 */
+	public static ArrayList getRawDouble(int[] data, int offset) throws RuntimeException {
+		byte[] bytes = (byte[]) getBits(data, 64, offset);
+		ByteBuffer bb = ByteBuffer.wrap(bytes);
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		double val = bb.getDouble();
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + 64));
+		v.add(new Double(val));
+		return v;
+	}
+
+	/**
+	 * Read a short value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the short value
+	 */
+	public static ArrayList getBitShort(int[] data, int offset) throws RuntimeException {
+		ArrayList v = new ArrayList();
+		int type = ((Integer) getBits(data, 2, offset)).intValue();
+		int read = 2;
+		int val = 0;
+		if (type == 0x00) {
+			byte[] bytes = (byte[]) getBits(data, 16, (offset + 2));
+			ByteBuffer bb = ByteBuffer.wrap(bytes);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			val = bb.getShort();
+			read = 18;
+		} else if (type == 0x01) {
+			val = ((Integer) getBits(data, 8, (offset + 2))).intValue();
+			read = 10;
+		} else if (type == 0x02) {
+			val = 0;
+		} else if (type == 0x03) {
+			val = 256;
+		}
+		v.add(new Integer(offset + read));
+		v.add(new Integer(val));
+		return v;
+	}
+
+	/**
+	 * Read a short value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the short value
+	 */
+	public static ArrayList getRawShort(int[] data, int offset) throws RuntimeException {
+		byte[] bytes = (byte[]) getBits(data, 16, offset);
+		ByteBuffer bb = ByteBuffer.wrap(bytes);
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int val = bb.getShort();
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + 16));
+		v.add(new Integer(val));
+		return v;
+	}
+
+	/**
+	 * Read a long value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the long value
+	 */
+	public static ArrayList getBitLong(int[] data, int offset) throws RuntimeException {
+		int type = ((Integer) getBits(data, 2, offset)).intValue();
+		int read = 2;
+		int val = 0;
+		if (type == 0x0) {
+			byte[] bytes = (byte[]) getBits(data, 32, (offset + 2));
+			ByteBuffer bb = ByteBuffer.wrap(bytes);
+			bb.order(ByteOrder.LITTLE_ENDIAN);
+			val = bb.getInt();
+			read = 34;
+		} else if (type == 0x01) {
+			val = ((Integer) getBits(data, 8, (offset + 2))).intValue();
+			read = 10;
+		} else if (type == 0x02) {
+			val = 0;
+		} else {
+			System.out.println("Bad type at bit offset: " + offset);
+		}
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + read));
+		v.add(new Integer(val));
+		return v;
+	}
+
+	/**
+	 * Read a long value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the long value
+	 * @throws RuntimeException
+	 */
+	public static ArrayList getRawLong(int[] data, int offset) throws RuntimeException {
+		ArrayList v = new ArrayList();
+		// _val = struct.unpack('<l', _long)[0]
+		byte[] bytes = (byte[]) getBits(data, 32, offset);
+		ByteBuffer bb = ByteBuffer.wrap(bytes);
+		bb.order(ByteOrder.LITTLE_ENDIAN);
+		int val = bb.getInt();
+		v.add(new Integer(offset + 32));
+		v.add(new Integer(val));
+		return v;
+	}
+
+	/**
+	 * Read a char value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the char value
+	 */
+	public static ArrayList getRawChar(int[] data, int offset) throws RuntimeException {
+		int charr = ((Integer) getBits(data, 8, offset)).intValue();
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + 8));
+		v.add(new Integer(charr));
+		return v;
+	}
+
+	/**
+	 * Read a char value from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the char value
+	 */
+	public static ArrayList getModularChar(int[] data, int offset) throws RuntimeException {
+		int val = 0;
+		ArrayList bytes = new ArrayList();
+		boolean read = true;
+		int offsett = offset;
+		int fac = 1;
+		while (read) {
+			int bytee = ((Integer) getBits(data, 8, offsett)).intValue();
+			offsett = offsett + 8;
+			if ((bytee & 0x80) == 0) {
+				read = false;
+				if ((bytee & 0x40) > 0) {
+					fac = -1;
+					bytee = bytee & 0xbf;
+				}
+			}
+			bytes.add(new Integer(bytee & 0x7f));
+		}
+		if (bytes.size()==1) val = ((Integer)bytes.get(0)).intValue();
+		else if (bytes.size()==2) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7);
+		else if (bytes.size()==3) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14);
+		else if (bytes.size()==4) val = ((Integer)bytes.get(0)).intValue() | (((Integer)bytes.get(1)).intValue() << 7) | (((Integer)bytes.get(2)).intValue() << 14) | (((Integer)bytes.get(3)).intValue() << 21);
+		else System.out.println("Unexpected byte array length: " + bytes.size());
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offsett));
+		v.add(new Integer(fac * val));
+		return v;
+	}
+
+	/**
+	 * Read a String from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is the String
+	 */
+	public static ArrayList getTextString(int[] data, int offset) throws RuntimeException {
+		int bitPos = offset;
+		ArrayList bitShort = DwgUtil.getBitShort(data, bitPos);
+		int newBitPos = ((Integer) bitShort.get(0)).intValue();
+		int len = ((Integer) bitShort.get(1)).intValue();
+		bitPos = newBitPos;
+		int bitLen = len * 8;
+		Object cosa = DwgUtil.getBits(data, bitLen, bitPos);
+		String string;
+		if (cosa instanceof byte[]) {
+			string = new String((byte[]) cosa);
+		} else {
+			// string = ((Integer)cosa).toString();
+			byte[] bytes = new byte[] { ((Integer) cosa).byteValue() };
+			string = new String((byte[]) bytes);
+		}
+		bitPos = bitPos + bitLen;
+		ArrayList v = new ArrayList();
+		v.add(new Integer(bitPos));
+		v.add(string);
+		return v;
+	}
+
+	/**
+	 * Read a CmColor from a group of unsigned bytes
+	 *
+	 * @param data
+	 *            Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset
+	 *            The current bit offset where the value begins
+	 * @throws RuntimeException
+	 *             If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value
+	 *         that represents the new offset, and second is the int value
+	 *         (handle of a DWG object)
+	 */
+	public static ArrayList getCmColor(int[] intData, int offset, String version) throws RuntimeException {
+
+		ArrayList v = new ArrayList();
+		int bitPos = offset;
+		List val = getBitShort(intData, bitPos);
+		bitPos = ((Integer) val.get(0)).intValue();
+		v.add((Integer) val.get(1));		//color index
+
+		//FIXME: para versiones superiores habrá que ampliar la condición
+		if (version.equalsIgnoreCase("Autocad R2004, R2005, R2006")){
+
+			val = getBitLong(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			v.add((Integer) val.get(1));	//RGB value
+
+			val = getRawChar(intData, bitPos);
+			bitPos = ((Integer) val.get(0)).intValue();
+			Integer colorByte = ((Integer) val.get(1)); //.intValue();
+			v.add(colorByte);				//Color Byte
+
+			// Según la documentacion:
+			// Color Byte & 1 ==> color name follows
+			// Color Byte & 2 ==> book name follows
+			if (((colorByte.intValue() & 0x01) != 0) || ((colorByte.intValue() & 0x02) != 0)) {
+				val = getTextString(intData, bitPos);
+				bitPos = ((Integer) val.get(0)).intValue();
+				v.add(val.get(1));//color name or book name
+			} else {
+				v.add("");//color name or book name
+			}
+		}
+
+		v.add(0, new Integer(bitPos));
+		return v;
+	}
+
+	/**
+	 * Read a int value (the handle of a DWG object) from a group of unsigned
+	 * bytes
+	 *
+	 * @param data
+	 *            Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset
+	 *            The current bit offset where the value begins
+	 * @throws RuntimeException
+	 *             If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return ArrayList This ArrayList has two parts. First is an int value
+	 *         that represents the new offset, and second is the int value
+	 *         (handle of a DWG object)
+	 */
+	public static ArrayList getHandle(int[] data, int offset)
+			throws RuntimeException {
+		ArrayList v = new ArrayList();
+		int code = ((Integer) DwgUtil.getBits(data, 4, offset)).intValue();
+	    int counter = ((Integer)DwgUtil.getBits(data, 4, (offset + 4))).intValue();
+		int read = 8;
+		ArrayList hlist = new ArrayList();
+		if (counter > 0) {
+			int hlen = counter * 8;
+			Object handle = DwgUtil.getBits(data, hlen, (offset + 8));
+			read = read + hlen;
+			if (hlen > 8) {
+				byte[] handleBytes = (byte[]) handle;
+				int[] handleInts = new int[handleBytes.length];
+				// Hacerlos unsigned ...
+				for (int i = 0; i < handleBytes.length; i++) {
+					handleInts[i] = ByteUtils.getUnsigned(handleBytes[i]);
+				}
+				for (int i = 0; i < handleInts.length; i++) {
+					hlist.add(new Integer(handleInts[i]));
+				}
+			} else {
+				hlist.add(handle);
+			}
+		}
+		v.add(new Integer(offset + read));
+		v.add(new Integer(code));
+		v.add(new Integer(counter));
+		for (int i = 0; i < hlist.size(); i++) {
+			v.add(hlist.get(i));
+		}
+		return v;
+	}
+
+	/**
+	 * Read a int value (the size of a modular short) from a ByteBuffer
+	 *
+	 * @param bb Data given as a ByteBuffer
+	 * @return int Size of the modular short
+	 */
+	public static int getModularShort(ByteBuffer bb) {
+		ArrayList shorts = new ArrayList();
+		bb.order(ByteOrder.BIG_ENDIAN);
+		short shortt = bb.getShort();
+		int size = 0;
+		while ((shortt & 0x80) > 0) {
+			shorts.add(new Short(shortt));
+			shortt = bb.getShort();
+		}
+		shorts.add(new Short(shortt));
+		for (int i = 0; i < shorts.size(); i++) {
+			shortt = ((Short) shorts.get(i)).shortValue();
+			shorts.set(i, new Integer(((shortt & 0xff00) >> 8) | ((shortt & 0xff) << 8)));
+		}
+		int slen = shorts.size();
+		if (slen == 1) {
+			size = (((Integer)shorts.get(0)).intValue()) & 0x7fff;//(new Integer(((Integer)shorts.get(0)).shortValue() & 0x7fff)).byteValue();
+		} else if (slen == 2) {
+			int tmp = ((Integer) shorts.get(0)).intValue();
+			shorts.set(0, shorts.get(1));
+			shorts.set(1, new Integer(tmp));
+			size = (((((Integer)shorts.get(0)).intValue()) & 0x7fff) << 15) | (((((Integer)shorts.get(1)).intValue()) & 0x7fff));//(new Integer(((Integer)shorts.get(0)).shortValue() & 0x7fff)).byteValue();
+		} else {
+			System.out.println("Unexpected array length: " + slen);
+		}
+		return size;
+	}
+
+	/**
+	 * Returns a set of bits from a group of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param count Bit counter
+	 * @param offset The current bit offset where the value begins
+	 * @throws RuntimeException If an unexpected bit value is found in the DWG file. Occurs
+	 *             when we are looking for LwPolylines.
+	 * @return This method returns an array of bytes or an int value
+	 */
+	public static Object getBits(int[] data, int count, int offset) throws RuntimeException {
+		int idx = offset / 8;
+		int bitidx = offset % 8;
+		/**
+		 * mask1: bit mask to apply to the current byte
+		 * lshift: left shift amount of mask results
+		 * mask2: bit mask to apply to the next byte
+		 * rshift: right shift amount of the mask results
+		 */
+		int[][] maskTable = new int[][]{
+		    {0xff, 0, 0x00, 0}, // bit offset == 0
+				{ 0x7f, 1, 0x80, 7 }, // bit offset == 1
+				{ 0x3f, 2, 0xc0, 6 }, // bit offset == 2
+				{ 0x1f, 3, 0xe0, 5 }, // bit offset == 3
+				{ 0x0f, 4, 0xf0, 4 }, // bit offset == 4
+				{ 0x07, 5, 0xf8, 3 }, // bit offset == 5
+				{ 0x03, 6, 0xfc, 2 }, // bit offset == 6
+				{ 0x01, 7, 0xfe, 1 }, // bit offset == 7
+		};
+		int mask1 = maskTable[bitidx][0];
+		int lsh = maskTable[bitidx][1];
+		int mask2 = maskTable[bitidx][2];
+		int rsh = maskTable[bitidx][3];
+		int binc = 8 - bitidx;
+		int read = 0;
+		int rem = count;
+		int bytee = 0x0;
+		ArrayList bytes = new ArrayList();
+		while (read < count) {
+			int b1 = 0;
+			if (rem > binc) {
+				b1 = (data[idx] & mask1);
+				read = read + binc;
+				rem = rem - binc;
+			} else {
+				b1 = ((data[idx] & mask1) >> (8 - bitidx - rem));
+				bytee = b1;
+				read = read + rem;
+				rem = 0;
+			}
+			if (read < count) {
+				idx = idx + 1;
+				if (rem > bitidx) {
+					int b2 = (data[idx] & mask2);
+					bytee = (b1 << lsh) | (b2 >> rsh);
+					read = read + bitidx;
+					rem = rem - bitidx;
+				} else {
+					int mask = maskTable[rem][2];
+					int b2 = data[idx] & mask;
+					bytee = (b1 << rem) | (b2 >> (8 - rem));
+					read = read + rem;
+					rem = 0;
+				}
+			}
+			if (count > 8) {
+				bytes.add(new Integer(bytee));
+			}
+		}
+		if (bytes.size() > 0) {
+			byte[] newBytes = new byte[bytes.size()];
+			for (int i = 0; i < newBytes.length; i++) {
+				newBytes[i] = ((Integer) bytes.get(i)).byteValue();
+			}
+			return newBytes;
+		}
+		return new Integer(bytee);
+	}
+
+	/**
+	 * Test a bit obtained from a set of unsigned bytes
+	 *
+	 * @param data Array of unsigned bytes obtained from the DWG binary file
+	 * @param offset The current bit offset where the value begins
+	 * @return ArrayList This ArrayList has two parts. First is an int value that represents
+	 * 		   the new offset, and second is a bit flag
+	 */
+	public static ArrayList testBit(int[] data, int offset) {
+		int idx = offset / 8;
+		int bitidx = offset % 8;
+		int mask = 0x1 << (7 - bitidx);
+		boolean val = false;
+		if ((data[idx] & mask) > 0) val = true;
+		ArrayList v = new ArrayList();
+		v.add(new Integer(offset + 1));
+		v.add(new Boolean(val));
+		return v;
+	}
+
+	/**
+	 * Convert bytes to machine value bytes
+	 *
+	 * @param data Input of array of bytes
+	 * @return int[] Output of array of machine bytes
+	 */
+	public static int[] bytesToMachineBytes(byte[] data) {
+		String[] dataString = new String[data.length];
+		int[] dataOut = new int[data.length];
+		for (int i = 0; i < data.length; i++) {
+			dataString[i] = HexUtil.bytesToHex(new byte[] { data[i] });
+			Integer dataInt = Integer.decode("0x" + dataString[i]);
+			dataOut[i] = dataInt.intValue();
+		}
+		return dataOut;
+	}
+
+	/**
+	 * It receives the list procedent from getHandle method, and return the
+	 * handle as int
+	 *
+     * */
+	public static int handleToInt(List fromGetHandle) {
+
+		int[] handle = new int[fromGetHandle.size() - 1];
+		for (int j = 1; j < fromGetHandle.size(); j++) {
+			handle[j - 1] = ((Integer) fromGetHandle.get(j)).intValue();
+		}
+		ArrayList handleVect = new ArrayList();
+		for (int i = 0; i < handle.length; i++) {
+			handleVect.add(new Integer(handle[i]));
+		}
+		return DwgUtil.handleBinToHandleInt(handleVect);
+
+
+    }
+	/**
+	 * Obtain the int value of a handle given in binary format
+	 *
+	 * @param layerHandle Handle in binary format
+	 * @return int Int value of the handle
+	 */
+	public static int handleBinToHandleInt(ArrayList layerHandle) {
+		byte[] layerBytes = new byte[] { 0, 0, 0, 0 };
+		if (layerHandle.size()>2) layerBytes[3] = (byte)((Integer)layerHandle.get(2)).intValue();
+		if (layerHandle.size() > 3) {
+			layerBytes[3] = (byte) ((Integer) layerHandle.get(3)).intValue();
+			layerBytes[2] = (byte) ((Integer) layerHandle.get(2)).intValue();
+		}
+		if (layerHandle.size() > 4) {
+			layerBytes[3] = (byte) ((Integer) layerHandle.get(4)).intValue();
+			layerBytes[2] = (byte) ((Integer) layerHandle.get(3)).intValue();
+			layerBytes[1] = (byte) ((Integer) layerHandle.get(2)).intValue();
+		}
+		if (layerHandle.size() > 5) {
+			layerBytes[3] = (byte) ((Integer) layerHandle.get(5)).intValue();
+			layerBytes[2] = (byte) ((Integer) layerHandle.get(4)).intValue();
+			layerBytes[1] = (byte) ((Integer) layerHandle.get(3)).intValue();
+			layerBytes[0] = (byte) ((Integer) layerHandle.get(2)).intValue();
+		}
+		int layer = ByteUtils.bytesToInt(layerBytes, new int[] { 0 });
+		return layer;
+	}
+
+	/*
+	 * TODO Ver si esto es necesario
+	 * */
+	public static int[] toIntArray(byte[] bytes) {
+		String[] dataMachValString = new String[bytes.length];
+		int[] data = new int[bytes.length];
+		for (int i = 0; i < bytes.length; i++) {
+			dataMachValString[i] = HexUtil.bytesToHex(new byte[] { bytes[i] });
+			Integer dataMachValShort = Integer.decode("0x" + dataMachValString[i]);
+			data[i] = dataMachValShort.byteValue();
+			data[i] = ByteUtils.getUnsigned((byte) data[i]);
+		}// for
+		return data;
+
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectOffset.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectOffset.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectOffset.java	(revision 435)
@@ -0,0 +1,81 @@
+/* jdwglib. Java Library for reading Dwg files.
+ * 
+ * Author: Jose Morell Rama (jose.morell@gmail.com).
+ * Port from the Pythoncad Dwg library by Art Haas.
+ *
+ * Copyright (C) 2005 Jose Morell, IVER TI S.A. 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:
+ *
+ * Jose Morell (jose.morell@gmail.com)
+ * 
+ * or
+ *
+ * IVER TI S.A.
+ *  C/Salamanca, 50
+ *  46005 Valencia
+ *  Spain
+ *  +34 963163400
+ *  dac@iver.es
+ */
+package org.gvsig.dwg.lib;
+
+/**
+ * The DwgObjectOffset class is useful to store the handle of an object with its
+ * offset in the DWG file
+ * 
+ * @author jmorell
+ */
+public class DwgObjectOffset {
+	private int handle;
+	private int offset;
+	private int size;
+	
+	/**
+	 * Create a new DwgObjectOffset object
+	 * 
+	 * @param handle Handle of the object
+	 * @param offset Offset in the DWG file of the object
+	 */
+	public DwgObjectOffset(int handle, int offset) {
+		this.handle = handle;
+		this.offset = offset;
+	}
+	
+    /**
+     * @return Returns the handle.
+     */
+    public int getHandle() {
+        return handle;
+    }
+    /**
+     * @return Returns the offset.
+     */
+    public int getOffset() {
+        return offset;
+    }
+    
+    public void setSize(int size){
+    	this.size=size;
+    }
+    
+    public int getSize(){
+    	return this.size;
+    }
+    
+    
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib/pom.xml	(revision 435)
@@ -0,0 +1,45 @@
+<?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.dwg.lib</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+  <description>
+Library for read-only access DWG files
+
+Supported versions:
+- v12
+- v14
+- v15
+- v2004
+
+  </description>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg</artifactId>
+      <version>2.0.98</version>
+  </parent>
+
+  <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.api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.geometry.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    
+  </dependencies>
+
+</project>

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.lib
___________________________________________________________________
Added: svn:ignore
   + target


Index: tags/org.gvsig.dwg-2.0.98/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/pom.xml	(revision 435)
@@ -0,0 +1,102 @@
+<?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.dwg</artifactId>
+  <version>2.0.98</version>
+  <packaging>pom</packaging>
+  <name>${project.artifactId}</name>
+  <description>DWG read-only support fort DAL and gvSIG</description>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.desktop</artifactId>
+      <version>2.0.242</version>
+  </parent>
+
+  <url>https://devel.gvsig.org/redmine/projects/gvsig-dwg</url>
+
+  <scm>
+      <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-dwg/tags/org.gvsig.dwg-2.0.98</connection>
+      <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-dwg/tags/org.gvsig.dwg-2.0.98</developerConnection>
+      <url>https://devel.gvsig.org/redmine/projects/gvsig-dwg/repository/show/tags/org.gvsig.dwg-2.0.98</url>
+  </scm>
+
+  <repositories>
+    <repository>
+      <id>gvsig-public-http-repository</id>
+      <name>gvSIG maven public HTTP repository</name>
+      <url>http://devel.gvsig.org/m2repo/j2se</url>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>daily</updatePolicy>
+        <checksumPolicy>warn</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+        <updatePolicy>daily</updatePolicy>
+        <checksumPolicy>warn</checksumPolicy>
+      </snapshots>
+    </repository>
+  </repositories>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-release-plugin</artifactId>
+				<configuration>
+					<tagBase>https://devel.gvsig.org/svn/gvsig-dwg/tags/</tagBase>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+  <dependencyManagement>
+      <dependencies>
+          <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.dwg.provider</artifactId>
+            <version>2.0.98</version>
+          </dependency>
+          <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.dwg.provider.legend</artifactId>
+            <version>2.0.98</version>
+          </dependency>
+          <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.dwg.lib</artifactId>
+            <version>2.0.98</version>
+          </dependency>
+          <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.dwg.app.mainplugin</artifactId>
+            <version>2.0.98</version>
+          </dependency>
+          <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.fmap.geometry.impl</artifactId>
+            <version>2.0.47</version>
+            <scope>test</scope>
+          </dependency>
+      </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+  </dependencies>
+
+  <modules>
+    <module>org.gvsig.dwg.app</module>
+    <module>org.gvsig.dwg.lib</module>
+    <module>org.gvsig.dwg.provider</module>
+    <module>org.gvsig.dwg.provider.legend</module>
+  </modules>
+
+
+</project>
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendLibrary.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendLibrary.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendLibrary.java	(revision 435)
@@ -0,0 +1,69 @@
+/* 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.dwg.fmap.dal.store.dwg.legend;
+
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary;
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
+import org.gvsig.fmap.dal.DALLibrary;
+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 DWGLegendLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsImplementationOf(DWGLegendLibrary.class);
+        require(MetadataLibrary.class);
+        require(DWGLibrary.class);
+        require(DALLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		DynClass dynClass = (DynClass) MetadataLocator.getMetadataManager()
+				.getDefinition(DWGStoreProvider.METADATA_DEFINITION_NAME);
+
+		DWGGetLegendBuilder.register(dynClass);
+		DWGGetLegend.register(dynClass);
+		DWGGetLabeling.register(dynClass);
+	}
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegendBuilder.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegendBuilder.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegendBuilder.java	(revision 435)
@@ -0,0 +1,65 @@
+/* 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.dwg.fmap.dal.store.dwg.legend;
+
+import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.AbstractDynMethod;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+/**
+ * @author gvSIG team
+ *
+ */
+public class DWGGetLegendBuilder extends AbstractDynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dwgLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		DWGGetLegendBuilder legendBuilder = new DWGGetLegendBuilder();
+        code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(
+						dwgLegendDynClass, legendBuilder));
+        legendBuilder.setCode(code);
+
+	}
+        public DWGGetLegendBuilder() {
+            super(LegendBuilder.DYNMETHOD_BUILDER_NAME,"DWG LegendBuilder creator");
+        }
+
+        @Override
+	public Object invoke(DynObject self, Object[] args)
+			throws DynMethodException {
+		return new DWGLegendBuilder();
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendBuilder.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendBuilder.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGLegendBuilder.java	(revision 435)
@@ -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.dwg.fmap.dal.store.dwg.legend;
+
+import java.awt.Color;
+
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
+import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder;
+import org.gvsig.dwg.lib.util.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.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+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 DWGLegendBuilder implements LegendBuilder {
+
+
+	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) MapContextLocator
+				.getMapContextManager().createLegend(
+						IVectorialUniqueValueLegend.LEGEND_NAME);
+		defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY);
+		defaultLegend
+				.setClassifyingFieldNames(new String[] { DWGStoreProvider.NAME_FIELD_COLOR });
+		defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT });
+
+		ISymbol myDefaultSymbol =
+				MapContextLocator.getSymbolManager()
+				.createSymbol(Geometry.TYPES.GEOMETRY, Color.BLACK);
+
+		defaultLegend.setDefaultSymbol(myDefaultSymbol);
+
+        labelingStragegy =
+            SymbologyLocator.getSymbologyManager()
+                .createAttrInTableLabelingStrategy();
+		labelingStragegy.setTextField(DWGStoreProvider.NAME_FIELD_TEXT);
+		labelingStragegy
+				.setRotationField(DWGStoreProvider.NAME_FIELD_ROTATIONTEXT);
+		labelingStragegy.setHeightField(DWGStoreProvider.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;
+		}
+
+        defaultLegend.useDefaultSymbol(false);
+		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 =
+					MapContextLocator.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);
+			}
+		}
+        defaultLegend.useDefaultSymbol(true);
+
+	}
+
+	public Object getLabeling() {
+		return labelingStragegy;
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLabeling.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLabeling.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLabeling.java	(revision 435)
@@ -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.dwg.fmap.dal.store.dwg.legend;
+
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
+import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.AbstractDynMethod;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+public class DWGGetLabeling extends AbstractDynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dwgLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		DWGGetLabeling labeling = new DWGGetLabeling();
+        code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(dwgLegendDynClass, labeling));
+        labeling.setCode(code);
+
+	}
+        public DWGGetLabeling() {
+            super(LegendBuilder.DYNMETHOD_GETLABELING_NAME,"DWG Labeling");
+        }
+
+        @Override
+        public Object invoke(DynObject self, Object[] args)
+			throws DynMethodException {
+		try {
+			return ((DWGStoreProvider) self).getLabeling();
+		} catch (OpenException e) {
+			//FIXME
+			throw new RuntimeException(e);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegend.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegend.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/legend/DWGGetLegend.java	(revision 435)
@@ -0,0 +1,72 @@
+/* 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.dwg.fmap.dal.store.dwg.legend;
+
+import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
+import org.gvsig.dwg.fmap.dal.store.dwg.LegendBuilder;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.AbstractDynMethod;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+/**
+ * @author gvSIG Team
+ *
+ */
+public class DWGGetLegend extends AbstractDynMethod {
+	private static Integer code = null;
+
+	static void register(DynClass dwgLegendDynClass) {
+		if (code != null) {
+			return;
+		}
+		DWGGetLegend legend = new DWGGetLegend();
+        code = new Integer(ToolsLocator.getDynObjectManager()
+				.registerDynMethod(dwgLegendDynClass, legend));
+        legend.setCode(code);
+
+	}
+
+        public DWGGetLegend() {
+            super(LegendBuilder.DYNMETHOD_GETLEGEND_NAME,"DWG Legend");
+        }
+
+        @Override
+	public Object invoke(DynObject self, Object[] args)
+			throws DynMethodException {
+		try {
+			return ((DWGStoreProvider) self).getLegend();
+		} catch (OpenException e) {
+			//FIXME
+			throw new RuntimeException(e);
+		}
+	}
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend/pom.xml	(revision 435)
@@ -0,0 +1,52 @@
+<?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.dwg.provider.legend</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg</artifactId>
+      <version>2.0.98</version>
+  </parent>
+
+  <dependencies>
+  
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg.provider</artifactId>
+      <scope>compile</scope>
+    </dependency>
+  
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.symbology.lib.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+
+    <!-- Test -->
+    <!--
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
+        <scope>test</scope>
+    </dependency>
+    -->
+    
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.symbology.lib.impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+</project>

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider.legend
___________________________________________________________________
Added: svn:ignore
   + target


Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java	(revision 435)
@@ -0,0 +1,88 @@
+/* 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.dwg.fmap.dal.store.dwg;
+
+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 TestDWG extends BaseTestFeatureStore {
+
+
+	protected boolean testDXFInitialized = false;
+
+	public static File file_prueba = new File(TestDWG.class.getResource(
+			"data/V2000.dwg").getFile());
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
+	 * ()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException {
+		DWGOpenStoreParameters dwgParameters = null;
+
+		dwgParameters = (DWGOpenStoreParameters) dataManager
+				.createStoreParameters(DWGStoreProvider.NAME);
+
+		dwgParameters.setFile(file_prueba);
+		dwgParameters.setCRS("EPSG:23030");
+		return dwgParameters;
+	}
+
+	/*
+	 * (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 {
+		DataStoreParameters params = getDefaultDataStoreParameters();
+		FeatureStore store = (FeatureStore) dataManager.openStore(params
+				.getDataStoreName(), params);
+
+		assertNotNull(store.invokeDynMethod("getLegend", null));
+		assertNotNull(store.invokeDynMethod("getLabeling", null));
+		store.dispose();
+	}
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java	(revision 435)
@@ -0,0 +1,35 @@
+/* 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.dwg.fmap.dal.store.dwg;
+
+import java.io.File;
+
+public class TestDWG2004 extends TestDWG {
+	public static File file_prueba = new File(TestDWG.class.getResource(
+			"data/V2004.dwg").getFile());
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2004.dwg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2004.dwg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2000.dwg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/data/V2000.dwg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGMetadata.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGMetadata.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGMetadata.xml	(revision 435)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+Definitions of metadata fields of a DWG file.  
+ -->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    
+    <class name="DWG" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="SpatialProvider"/>
+      </extends>
+      <description>Metadata of a DWG store</description>
+      <fields>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGParameters.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGParameters.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/org/gvsig/dwg/fmap/dal/store/dwg/DWGParameters.xml	(revision 435)
@@ -0,0 +1,20 @@
+<?xml version= "1.0 "?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DWGStoreParameters">
+      <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Store the parameters need to open a dwg file</description>
+      <fields>
+        <field name="file" type="file" mandatory="true" group="Basic">
+          <description>dwg file</description>
+        </field>
+        <field name="CRS" type="crs" mandatory="true" group="Basic">
+          <description>The coordinate reference system used in this dwg file</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 435)
@@ -0,0 +1,2 @@
+org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary
+org.gvsig.dwg.fmap.dal.store.dwg.legend.DWGLegendLibrary
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/UnsupportedDWGVersionException.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/UnsupportedDWGVersionException.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/UnsupportedDWGVersionException.java	(revision 435)
@@ -0,0 +1,23 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+import org.gvsig.dwg.lib.DwgVersionNotSupportedException;
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class UnsupportedDWGVersionException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7335241420683266251L;
+	private final static String MESSAGE_FORMAT = "Unssuported version of DWG of file '%(file)'. Try to convert using Autodesk convertor from '%(autodeskurl)'";
+	private final static String MESSAGE_KEY = "_UnsupportedDWGVersionException";
+
+	public final static String AUTODESK_URL = "http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=7024151";
+
+	public UnsupportedDWGVersionException(String file,
+			DwgVersionNotSupportedException cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("file", file);
+		setValue("autodeskurl", AUTODESK_URL);
+	}
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProviderFactory.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProviderFactory.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProviderFactory.java	(revision 435)
@@ -0,0 +1,56 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+
+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 DWGStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{
+
+	protected DWGStoreProviderFactory(String name, String description) {
+		super(name, description);
+	}
+
+	public DataStoreProvider createProvider(DataParameters parameters,
+			DataStoreProviderServices providerServices)
+			throws InitializeException {
+		return new DWGStoreProvider((DWGOpenStoreParameters) parameters, providerServices);
+	}
+
+	public DynObject createParameters() {
+		return new DWGOpenStoreParameters();
+	}
+	
+	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/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGOpenStoreParameters.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGOpenStoreParameters.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGOpenStoreParameters.java	(revision 435)
@@ -0,0 +1,102 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+import java.io.File;
+
+import org.cresques.cts.IProjection;
+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.OpenFeatureStoreParameters;
+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 DWGOpenStoreParameters extends AbstractDataParameters implements
+		FilesystemStoreParameters,
+		OpenFeatureStoreParameters {
+
+	public static final String PARAMETERS_DEFINITION_NAME = "DWGStoreParameters";
+
+	private static final String FIELD_FILE = "file";
+	private static final String FIELD_CRS = "CRS";
+
+	private DelegatedDynObject parameters;
+
+	public DWGOpenStoreParameters() {
+		this(PARAMETERS_DEFINITION_NAME);
+	}
+
+	protected DWGOpenStoreParameters(String parametersDefinitionName) {
+		this(parametersDefinitionName, DWGStoreProvider.NAME);
+	}
+
+	public DWGOpenStoreParameters(String parametersDefinitionName, String name) {
+		super();
+		this.parameters = (DelegatedDynObject) FileHelper
+				.newParameters(parametersDefinitionName);
+		this
+				.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME,
+						name);
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return parameters;
+	}
+
+	public String getDataStoreName() {
+		return (String) this
+				.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
+	}
+
+	public String getDescription() {
+		return this.getDynClass().getDescription();
+	}
+
+	public void setCRS(IProjection crs) {
+		setDynValue(FIELD_CRS, crs);
+	}
+
+	public void setCRS(String crs) {
+		setDynValue(FIELD_CRS, crs);
+	}
+
+	public IProjection getCRS() {
+		return (IProjection) getDynValue(FIELD_CRS);
+	}
+
+	public String getFileName() {
+		return this.getFile().getPath();
+	}
+
+	public void setFileName(String file) {
+		setDynValue(FIELD_FILE, file);
+	}
+
+	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 EditableFeatureType getDefaultFeatureType() {
+		return null; //TODO ????
+	}
+
+	public void setDefaultFeatureType(FeatureType defaultFeatureType) {
+		throw new UnsupportedOperationException();
+	}
+
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/LegendBuilder.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/LegendBuilder.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/LegendBuilder.java	(revision 435)
@@ -0,0 +1,24 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+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();
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGLibrary.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGLibrary.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGLibrary.java	(revision 435)
@@ -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.dwg.fmap.dal.store.dwg;
+
+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.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DWGLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsImplementationOf(DWGLibrary.class);
+        require(DALLibrary.class);
+        require(DALFileLibrary.class);
+        require(MetadataLibrary.class);
+    }
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		FileHelper.registerParametersDefinition(
+				DWGOpenStoreParameters.PARAMETERS_DEFINITION_NAME, 
+				DWGOpenStoreParameters.class,
+				"DWGParameters.xml"
+		);
+		try {
+			FileHelper.registerMetadataDefinition(
+					DWGStoreProvider.METADATA_DEFINITION_NAME, 
+					DWGStoreProvider.class,
+					"DWGMetadata.xml"
+			);
+		} catch (MetadataException e) {
+			throw new LibraryException(getClass(), e);
+		}
+
+        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+				.getDataManager();
+
+		if (!dataman.getStoreProviders().contains(DWGStoreProvider.NAME)) {
+                        dataman.registerStoreProviderFactory(new DWGStoreProviderFactory(
+                                DWGStoreProvider.NAME,
+                                DWGStoreProvider.DESCRIPTION
+                        ));
+		}
+
+		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
+				DWGStoreProvider.NAME, DWGStoreProvider.DESCRIPTION,
+				DWGFilesystemServerProvider.class);
+
+		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
+		DynClass dynClass = dynMan.get(
+				DWGStoreProvider.METADATA_DEFINITION_NAME);
+		DynField field;
+		if (dynClass == null) {
+			dynClass = dynMan.add(
+					DWGStoreProvider.METADATA_DEFINITION_NAME);
+
+		}
+	}
+}
\ No newline at end of file
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGFilesystemServerProvider.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGFilesystemServerProvider.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGFilesystemServerProvider.java	(revision 435)
@@ -0,0 +1,120 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+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.feature.NewFeatureStoreParameters;
+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 DWGFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider 
+	implements FilesystemServerExplorerProvider, ResourceConsumer {
+
+	//private FilesystemServerExplorerProviderServices serverExplorer;
+
+	public String getDataStoreProviderName() {
+		return DWGStoreProvider.NAME;
+	}
+
+	public int getMode() {
+		return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
+	}
+
+	public boolean accept(File pathname) {
+		return (pathname.getName().toLowerCase().endsWith(".dwg"));
+	}
+
+	public String getDescription() {
+		return DWGStoreProvider.DESCRIPTION;
+	}
+
+	public DataStoreParameters getParameters(File file) throws DataException {
+		DataManager manager = DALLocator.getDataManager();
+		DWGOpenStoreParameters params = (DWGOpenStoreParameters) manager
+				.createStoreParameters(this
+				.getDataStoreProviderName());
+		params.setFileName(file.getPath());
+		return params;
+	}
+
+	public boolean canCreate() {
+		return true;
+	}
+
+	public boolean canCreate(NewDataStoreParameters parameters) {
+		if (!(parameters instanceof DWGOpenStoreParameters)) {
+			throw new IllegalArgumentException(); // FIXME ???
+		}
+		DWGOpenStoreParameters dwgParams = (DWGOpenStoreParameters) parameters;
+		// TODO comporbar si el ftype es correcto (para este formato es fijo)
+		File file = new File(dwgParams.getFileName());
+
+		if (dwgParams.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 {
+		// FIXME Exception
+		throw new UnsupportedOperationException();
+	}
+
+	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(((DWGOpenStoreParameters) 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
+
+	}
+
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java	(revision 435)
@@ -0,0 +1,665 @@
+package org.gvsig.dwg.fmap.dal.store.dwg;
+
+import java.io.File;
+import java.io.IOException;
+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.dwg.lib.DwgFile;
+import org.gvsig.dwg.lib.DwgObject;
+import org.gvsig.dwg.lib.DwgVersionNotSupportedException;
+import org.gvsig.dwg.lib.IDwg2FMap;
+import org.gvsig.dwg.lib.IDwg3DTestable;
+import org.gvsig.dwg.lib.objects.DwgMText;
+import org.gvsig.dwg.lib.objects.DwgText;
+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.CreateGeometryException;
+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.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.gvsig.fmap.geom.primitive.Point;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DWGStoreProvider extends AbstractMemoryStoreProvider implements
+        ResourceConsumer {
+
+    private static final Logger logger = LoggerFactory.getLogger(DWGStoreProvider.class);
+
+    public static final String NAME = "DWG";
+    public static final String DESCRIPTION = "DWG 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 int ID_FIELD_ID = 0;
+    private int ID_FIELD_GEOMETRY = 1;
+    private int ID_FIELD_ENTITY = 2;
+    private int ID_FIELD_LAYER = 3;
+    private int ID_FIELD_COLOR = 4;
+    private int ID_FIELD_ELEVATION = 5;
+    private int ID_FIELD_THICKNESS = 6;
+    private int ID_FIELD_TEXT = 7;
+    private int ID_FIELD_HEIGHTTEXT = 8;
+    private int ID_FIELD_ROTATIONTEXT = 9;
+
+    private IProjection projection;
+    private ResourceProvider resource;
+    private LegendBuilder legendBuilder;
+
+    private long counterNewsOIDs = 0;
+    protected GeometryManager geomManager = GeometryLocator.getGeometryManager();
+
+    public DWGStoreProvider(DWGOpenStoreParameters parameters,
+            DataStoreProviderServices storeServices) throws InitializeException {
+        super(parameters, storeServices, FileHelper
+                .newMetadataContainer(METADATA_DEFINITION_NAME));
+
+        counterNewsOIDs = 0;
+        //		projection = CRSFactory.getCRS(getParameters().getSRSID());
+
+        File file = getDWGParameters().getFile();
+        resource = this.createResource(
+                FileResource.NAME,
+                new Object[]{file.getAbsolutePath()}
+        );
+
+        resource.addConsumer(this);
+
+        this.projection = this.getDWGParameters().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 DWGOpenStoreParameters getDWGParameters() {
+        return (DWGOpenStoreParameters) this.getParameters();
+    }
+
+    public String getProviderName() {
+        return NAME;
+    }
+
+    public boolean allowWrite() {
+        return false;
+    }
+
+    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 DWGData {
+
+        public ArrayList data = null;
+        public FeatureType defaultFType = null;
+        public List fTypes = null;
+        public Envelope envelope = null;
+        public IProjection projection;
+        public LegendBuilder legendBuilder = null;
+
+        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;
+        }
+    }
+
+    private AbstractMemoryStoreProvider getStoreProvider() {
+        return this;
+    }
+
+    public void open() throws OpenException {
+        if (this.data != null) {
+            return;
+        }
+		// try {
+        // this.resource.begin();
+        // } catch (ResourceExecuteException e2) {
+        // try {
+        // throw new OpenException(resource.getName(), e2);
+        // } catch (AccessResourceException e1) {
+        // throw new OpenException(this.getName(), e2);
+        // }
+        //
+        // }
+        try {
+            getResource().execute(new ResourceAction() {
+                public Object run() throws Exception {
+                    ResourceProvider resource = getResource();
+                    DWGData dwgData = null;
+                    FeatureStoreProviderServices store = getStoreServices();
+                    if (resource.getData() != null) {
+                        dwgData
+                                = (DWGData) ((Map) resource.getData()).get(projection.getAbrev());
+						// OJO no es del todo correcto (puede llevar
+                        // reproyeccion)
+                    } else {
+                        resource.setData(new HashMap());
+                    }
+                    if (dwgData == null) {
+                        dwgData = new DWGData();
+                        dwgData.data = new ArrayList();
+                        data = dwgData.data;
+                        counterNewsOIDs = 0;
+                        Reader reader
+                                = new Reader().initialice(getStoreProvider(),
+                                        (File) resource.get(),
+                                        projection, legendBuilder);
+                        reader.begin(store);
+                        dwgData.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(
+                                    dwgData.defaultFType.getId())) {
+                                types.add(dwgData.defaultFType);
+                            } else {
+                                types.add(fType.getNotEditableCopy());
+                            }
+                        }
+                        dwgData.fTypes = types;
+                        dwgData.legendBuilder = legendBuilder;
+
+                        resource.notifyOpen();
+                        store.setFeatureTypes(dwgData.fTypes,
+                                dwgData.defaultFType);
+                        reader.load();
+                        // this.envelope = reader.getEnvelope();
+
+                        dwgData.envelope = reader.getEnvelope();
+
+                        dwgData.projection = projection;
+
+                        reader.end();
+                        resource.notifyClose();
+                        ((Map) resource.getData()).put(projection.getAbrev(),
+                                dwgData); // OJO la reproyeccion
+                    }
+
+                    data = dwgData.data;
+                    store.setFeatureTypes(dwgData.fTypes, dwgData.defaultFType);
+                    legendBuilder = dwgData.legendBuilder;
+                    setDynValue("Envelope", dwgData.getEnvelopeCopy());
+                    setDynValue("CRS", projection);
+                    counterNewsOIDs = data.size();
+                    return null;
+                }
+            });
+        } catch (Exception e) {
+            this.data = null;
+            try {
+                throw new OpenException(resource.getName(), e);
+            } catch (AccessResourceException e1) {
+                throw new OpenException(this.getProviderName(), e);
+            }
+			// } finally {
+            // this.resource.end();
+        }
+    }
+
+    public DataServerExplorer getExplorer() throws ReadException {
+        DataManager manager = DALLocator.getDataManager();
+        FilesystemServerExplorerParameters params;
+        try {
+            params = (FilesystemServerExplorerParameters) manager
+                    .createServerExplorerParameters(FilesystemServerExplorer.NAME);
+            params.setRoot(this.getDWGParameters().getFile().getParent());
+            return manager.createServerExplorer(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;
+        private DwgFile dwgFeatureFile;
+
+        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 UnsupportedDWGVersionException, ReadException {
+            dwgFeatureFile = new DwgFile(file.getAbsolutePath());
+
+            try {
+                dwgFeatureFile.read();
+            } catch (DwgVersionNotSupportedException e1) {
+                throw new UnsupportedDWGVersionException(file.getName(), e1);
+            } catch (IOException e) {
+                throw new ReadException(NAME, e);
+            }
+
+            EditableFeatureType featureType = store.createFeatureType(getName());
+
+            featureType.setHasOID(true);
+
+            ID_FIELD_ID = featureType.add(NAME_FIELD_ID, DataTypes.INT)
+                    .setDefaultValue(Integer.valueOf(0))
+                    .getIndex();
+
+            EditableFeatureAttributeDescriptor attr = featureType.add(
+                    NAME_FIELD_GEOMETRY, DataTypes.GEOMETRY);
+            attr.setSRS(this.projection);
+            attr.setGeometryType(Geometry.TYPES.GEOMETRY);
+            boolean is3dFile = dwgFeatureFile.isDwg3DFile();
+            if (is3dFile) {
+                attr.setGeometrySubType(Geometry.SUBTYPES.GEOM3D);
+            } else {
+                attr.setGeometrySubType(Geometry.SUBTYPES.GEOM2D);
+            }
+            ID_FIELD_GEOMETRY = attr.getIndex();
+
+            featureType.setDefaultGeometryAttributeName(NAME_FIELD_GEOMETRY);
+
+            // 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();
+
+			// FIXME: Parece que el DXF 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;
+
+            long count_not_fmap_interface = 0;
+            long count_null_geometry = 0;
+            long count_bad_envelope = 0;
+            long count_envelope_out_of_aoi = 0;
+
+            dwgFeatureFile.calculateGisModelDwgPolylines();
+            dwgFeatureFile.blockManagement2();
+            List entities = dwgFeatureFile.getDwgObjects();
+
+            int id = -1;
+            try {
+                int envelopeSubType = Geometry.SUBTYPES.GEOM2D;
+                boolean is3dFile = dwgFeatureFile.isDwg3DFile();
+
+                this.envelope = geomManager.createEnvelope(envelopeSubType);
+
+                boolean updateEnvelope = true;
+
+                double[] extMin = (double[]) dwgFeatureFile
+                        .getHeader("MSPACE_EXTMIN");
+                double[] extMax = (double[]) dwgFeatureFile
+                        .getHeader("MSPACE_EXTMAX");
+                if (extMin != null && extMax != null) {
+                    updateEnvelope = false;
+                    Point point = geomManager.createPoint(extMin[0], extMin[1],envelopeSubType);
+                    this.envelope.setLowerCorner(point);
+                    point = geomManager.createPoint(extMax[0], extMax[1],envelopeSubType);
+                    this.envelope.setUpperCorner(point);
+                }
+
+                Iterator iter = entities.iterator();
+
+                FeatureProvider featureProvider;
+                Envelope gEnvelope;
+
+                while (iter.hasNext()) {
+                    id++;
+                    DwgObject entity = (DwgObject) iter.next();
+
+                    if (!(entity instanceof IDwg2FMap)) {
+                        count_not_fmap_interface++;
+                        /*
+                         logger.warn("load: entity type {}(id:{}) not loadded",
+                         new Object[] { entity.getType() }, id);
+                         */
+                        continue;
+                    }
+
+                    IDwg2FMap dwgEnt = (IDwg2FMap) entity;
+                    Geometry geometry = dwgEnt.toFMapGeometry(is3dFile);
+                    if (geometry == null) {
+                        count_null_geometry++;
+                        /*
+                         logger.warn("load: entity {}(id:{}) with null geometry",
+                         new Object[] { entity.getType(), id });
+                         */
+                        continue;
+                    }
+
+                    // we check for Region of Interest of the CAD file
+                    if (!this.envelope.intersects(geometry.getEnvelope())) {
+                        count_envelope_out_of_aoi++;
+                        /*
+                         logger.warn("load: entity {}(id:{}) out of envelope",
+                         new Object[] { entity.getType(), id });
+                         */
+                        continue;
+                    }
+                    featureProvider = store.createFeatureProvider(store
+                            .getStoreServices().getDefaultFeatureType());
+
+                    featureProvider.set(ID_FIELD_ID, id);
+
+                    featureProvider.set(ID_FIELD_ENTITY, dwgEnt.toString());
+
+                    featureProvider.set(ID_FIELD_LAYER, dwgFeatureFile
+                            .getLayerName(entity));
+
+                    int colorByLayer = dwgFeatureFile.getColorByLayer(entity);
+                    int color = entity.getColor();
+                    if (color < 0) {
+                        color = Math.abs(color);
+                    }
+                    if (color > 255) {
+                        color = colorByLayer;
+                    }
+
+                    featureProvider.set(ID_FIELD_COLOR, color);
+
+                    if (entity instanceof IDwg3DTestable) {
+                        featureProvider.set(ID_FIELD_ELEVATION,
+                                ((IDwg3DTestable) entity).getZ());
+                    }
+
+                    featureProvider.set(ID_FIELD_THICKNESS, 0.0);
+                    featureProvider.set(ID_FIELD_HEIGHTTEXT, 0.0);
+                    featureProvider.set(ID_FIELD_ROTATIONTEXT, 0.0);
+                    featureProvider.set(ID_FIELD_TEXT, "");
+
+                    if (entity instanceof DwgMText) {
+                        DwgMText mtext = (DwgMText) entity;
+                        featureProvider.set(ID_FIELD_HEIGHTTEXT, mtext.getHeight());
+                        featureProvider.set(ID_FIELD_TEXT, mtext.getText());
+                    } else if (entity instanceof DwgText) {
+                        DwgText text = (DwgText) entity;
+                        featureProvider
+                                .set(ID_FIELD_THICKNESS, text.getThickness());
+                        featureProvider.set(ID_FIELD_HEIGHTTEXT, text.getHeight());
+                        featureProvider.set(ID_FIELD_ROTATIONTEXT, text
+                                .getRotationAngle());
+                        featureProvider.set(ID_FIELD_TEXT, text.getText());
+                    }// if-else
+
+                    featureProvider.setDefaultGeometry(geometry);
+
+                    store.addFeatureProvider(featureProvider);
+                    if (this.leyendBuilder != null) {
+                        this.leyendBuilder.process(featureProvider);
+                    }
+
+                }
+
+                logger.info("Issues while loading DWG entities:+\n"
+                        + "    Entities not implementing IDwg2FMap interface: " + count_not_fmap_interface + "\n"
+                        + "    Entities with non-convertible geometry: " + count_null_geometry + "\n"
+                        + "    Entities without valid envelope: " + count_bad_envelope + "\n"
+                        + "    Entities with envelope out of global envelope: " + count_envelope_out_of_aoi);
+
+            } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+                throw new CreateGeometryException(e);
+            } catch (org.gvsig.fmap.geom.exception.CreateEnvelopeException e) {
+                throw new 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) {
+        // FIXME Exception
+        throw new UnsupportedOperationException();
+    }
+
+    public void beginAppend() {
+        // FIXME Exception
+        throw new UnsupportedOperationException();
+
+    }
+
+    public void endAppend() {
+        // FIXME Exception
+        throw new UnsupportedOperationException();
+    }
+
+    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 (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.getDWGParameters().getFile();
+    }
+
+    public String getName() {
+        String name = this.getDWGParameters().getFile().getName();
+        int n = name.lastIndexOf(".");
+        if (n < 1) {
+            return name;
+        }
+        return name.substring(0, n);
+    }
+
+    public String getFullName() {
+        return this.getDWGParameters().getFile().getAbsolutePath();
+    }
+
+    public ResourceProvider getResource() {
+        return resource;
+    }
+
+}
Index: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/pom.xml
===================================================================
--- tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/pom.xml	(revision 0)
+++ tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider/pom.xml	(revision 435)
@@ -0,0 +1,130 @@
+<?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.dwg.provider</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+  <description>DAL provider for DWG files</description>
+  <parent>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.dwg</artifactId>
+      <version>2.0.98</version>
+  </parent>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.lib</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.projection.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.dal.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.dal.spi</artifactId>
+        <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.dwg.lib</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.fmap.geometry.api</artifactId>
+        <scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.timesupport.lib.api</artifactId>
+        <scope>compile</scope>
+    </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.file.lib</artifactId>
+      <scope>compile</scope>
+    </dependency>
+
+
+    <!-- TESTS -->
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.tools.lib</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.compat.se</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    
+    <!--
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.fmap.dal.index.spatial.jts</artifactId>
+      <scope>test</scope>
+    </dependency>
+    -->
+    
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.fmap.geometry.impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.projection.cresques.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.fmap.dal</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    -->
+
+
+  </dependencies>
+
+</project>

Property changes on: tags/org.gvsig.dwg-2.0.98/org.gvsig.dwg.provider
___________________________________________________________________
Added: svn:ignore
   + target


