Revision 53

View differences:

tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties
1
#Thu Jul 02 01:08:21 CEST 2015
2
buildNumber=2090
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG2004.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 IVER T.I   {{Task}}
26
*/
27

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

  
30
import java.io.File;
31

  
32
public class TestDWG2004 extends TestDWG {
33
	public static File file_prueba = new File(TestDWG.class.getResource(
34
			"data/V2004.dwg").getFile());
35
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/test/java/org/gvsig/dwg/fmap/dal/store/dwg/TestDWG.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

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

  
30
import java.io.File;
31

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

  
37
public class TestDWG extends BaseTestFeatureStore {
38

  
39

  
40
	protected boolean testDXFInitialized = false;
41

  
42
	public static File file_prueba = new File(TestDWG.class.getResource(
43
			"data/V2000.dwg").getFile());
44

  
45
	/*
46
	 * (non-Javadoc)
47
	 *
48
	 * @see
49
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
50
	 * ()
51
	 */
52
	public DataStoreParameters getDefaultDataStoreParameters()
53
			throws DataException {
54
		DWGStoreParameters dwgParameters = null;
55

  
56
		dwgParameters = (DWGStoreParameters) dataManager
57
				.createStoreParameters(DWGStoreProvider.NAME);
58

  
59
		dwgParameters.setFile(file_prueba);
60
		dwgParameters.setCRS("EPSG:23030");
61
		return dwgParameters;
62
	}
63

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

  
74
	public boolean usesResources() {
75
		return true;
76
	}
77

  
78

  
79
	public void testLegendAndLabeling() throws Exception {
80
		DataStoreParameters params = getDefaultDataStoreParameters();
81
		FeatureStore store = (FeatureStore) dataManager.openStore(params
82
				.getDataStoreName(), params);
83

  
84
		assertNotNull(store.invokeDynMethod("getLegend", null));
85
		assertNotNull(store.invokeDynMethod("getLabeling", null));
86
		store.dispose();
87
	}
88
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="lib">
4
	</libraries>
5
	<depends plugin-name="org.gvsig.app"/>
6
		<resourceBundle name="text"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.dwg.DWGRegisterExtension"
9
			description="DWG Driver"
10
			active="true">
11
		</extension>
12

  
13
	</extensions>
14
</plugin-config>
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
        <include>org.gvsig:org.gvsig.dwg.provider.legend</include>
32
        <include>org.gvsig:org.gvsig.dwg.provider</include>
33
        <include>org.gvsig:org.gvsig.dwg.lib</include>
34
      </includes>
35
    </dependencySet>
36
  </dependencySets>
37

  
38
</assembly>
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/src/main/java/org/gvsig/dwg/DWGRegisterExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.dwg;
23

  
24
import org.gvsig.andami.IconThemeHelper;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.dwg.fmap.dal.store.dwg.DWGLibrary;
27
import org.gvsig.dwg.fmap.dal.store.dwg.DWGStoreProvider;
28
import org.gvsig.fmap.mapcontext.MapContextLocator;
29

  
30
/**
31
 * Dummy DWG extension, as all the registration happens in the
32
 * {@link DWGLibrary}.
33
 * 
34
 * @author gvSIG Team
35
 */
36
public class DWGRegisterExtension extends Extension {
37

  
38
	public void execute(String actionCommand) {
39
		// Nothing to do
40
	}
41

  
42
	public void initialize() {
43
		IconThemeHelper.registerIcon("layer", "layer-icon-dwg", this);
44
	}
45

  
46
	public void postInitialize() {
47
		MapContextLocator.getMapContextManager().registerIconLayer(DWGStoreProvider.NAME, "layer-icon-dwg");
48
	}
49

  
50
	public boolean isEnabled() {
51
		// Nothing to do
52
		return false;
53
	}
54

  
55
	public boolean isVisible() {
56
		// Nothing to do
57
		return false;
58
	}
59

  
60
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4

  
5
  <modelVersion>4.0.0</modelVersion>
6
  <artifactId>org.gvsig.dwg.app.mainplugin</artifactId>
7
  <packaging>jar</packaging>
8
  <name>Formats: dwg file format support (read-only)</name>
9
  <description>
10
DWG file format support (read-only)
11

  
12
Supported versions:
13
- v12
14
- v14
15
- v15
16
- v2004
17

  
18
  </description>
19
  <parent>
20
      <groupId>org.gvsig</groupId>
21
      <artifactId>org.gvsig.dwg.app</artifactId>
22
      <version>2.0.22</version>
23
  </parent>
24

  
25
  <dependencies>
26
    <dependency>
27
        <groupId>org.gvsig</groupId>
28
        <artifactId>org.gvsig.tools.lib</artifactId>
29
        <scope>compile</scope>
30
    </dependency>
31
    <dependency>
32
        <groupId>org.gvsig</groupId>
33
        <artifactId>org.gvsig.andami</artifactId>
34
        <scope>compile</scope>
35
    </dependency>
36
    <dependency>
37
        <groupId>org.gvsig</groupId>
38
        <artifactId>org.gvsig.dwg.provider</artifactId>
39
        <scope>compile</scope>
40
    </dependency>
41
    <dependency>
42
        <groupId>org.gvsig</groupId>
43
        <artifactId>org.gvsig.dwg.provider.legend</artifactId>
44
        <scope>compile</scope>
45
    </dependency>
46

  
47
    <dependency>
48
        <groupId>org.gvsig</groupId>
49
        <artifactId>org.gvsig.dwg.lib</artifactId>
50
        <scope>runtime</scope>
51
    </dependency>
52

  
53
    <!-- Tests -->
54

  
55
    <dependency>
56
      <groupId>org.gvsig</groupId>
57
      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
58
      <type>test-jar</type>
59
      <scope>test</scope>
60
    </dependency>
61

  
62
    <dependency>
63
      <groupId>org.gvsig</groupId>
64
      <artifactId>org.gvsig.fmap.dal.impl</artifactId>
65
      <type>jar</type>
66
      <scope>test</scope>
67
    </dependency>
68

  
69
  </dependencies>
70

  
71
    <properties>
72
        <!-- Package info property values -->
73
        <!-- Default values in org.gvsig.desktop -->
74
        <gvsig.package.info.state>testing</gvsig.package.info.state>
75
        <gvsig.package.info.official>true</gvsig.package.info.official>
76
        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies>
77
        <gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories>
78
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-dwg/pool</gvsig.package.info.poolURL>
79
    </properties>
80

  
81
  <build>
82
    <plugins>
83

  
84
      <plugin>
85
        <!-- Skip compilation tests -->
86
        <groupId>org.apache.maven.plugins</groupId>
87
        <artifactId>maven-compiler-plugin</artifactId>
88
        <executions>
89
          <execution>
90
            <id>default-testCompile</id>
91
            <phase>process-test-sources</phase>
92
            <goals>
93
              <goal>testCompile</goal>
94
            </goals>
95
            <configuration>
96
              <skip>true</skip>
97
            </configuration>
98
          </execution>
99
        </executions>
100
      </plugin>
101

  
102
      <plugin>
103
        <!-- Skip test execution -->
104
        <groupId>org.apache.maven.plugins</groupId>
105
        <artifactId>maven-surefire-plugin</artifactId>
106
        <configuration>
107
          <skipTests>true</skipTests>
108
        </configuration>
109
      </plugin>
110

  
111
    </plugins>
112
  </build>
113

  
114
</project>
115

  
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.app/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4

  
5
  <modelVersion>4.0.0</modelVersion>
6
  <artifactId>org.gvsig.dwg.app</artifactId>
7
  <packaging>pom</packaging>
8
  <name>${project.artifactId}</name>
9
  <parent>
10
      <groupId>org.gvsig</groupId>
11
      <artifactId>org.gvsig.dwg</artifactId>
12
      <version>2.0.22</version>
13
  </parent>
14

  
15
  <modules>
16
    <module>org.gvsig.dwg.app.mainplugin</module>
17
  </modules>
18

  
19

  
20
</project>
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgIdBufferReader1314.java
1
/*
2
 * Created on 02-feb-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.ArrayList;
8
import java.util.List;
9

  
10
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
11
import org.gvsig.dwg.lib.DwgHandleReference;
12
import org.gvsig.dwg.lib.DwgObject;
13
import org.gvsig.dwg.lib.DwgUtil;
14
import org.gvsig.dwg.lib.objects.DwgIdBuffer;
15

  
16

  
17
/**
18
 * @author alzabord
19
 *
20
 * TODO To change the template for this generated type comment go to
21
 * Window - Preferences - Java - Code Style - Code Templates
22
 */
23
public class DwgIdBufferReader1314 extends AbstractDwg1314Reader {
24

  
25
	/* (non-Javadoc)
26
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
27
	 */
28
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
29
			throws RuntimeException, CorruptedDwgEntityException {
30
		 if(! (dwgObj instanceof DwgIdBuffer))
31
		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgIdBuffer");
32
		DwgIdBuffer idB = (DwgIdBuffer) dwgObj;
33
		int bitPos = offset;
34
		
35
		List val = DwgUtil.getBitLong(data, bitPos);
36
		bitPos = ((Integer) val.get(0)).intValue();
37
		int numReactors = ((Integer) val.get(1)).intValue();
38
		idB.setNumReactors(numReactors);
39
		
40
		val = DwgUtil.getRawChar(data, bitPos);
41
		bitPos = ((Integer) val.get(0)).intValue();
42
		int rcharVal = ((Integer) val.get(1)).intValue();
43
		
44
		val = DwgUtil.getBitLong(data, bitPos);
45
		bitPos = ((Integer) val.get(0)).intValue();
46
		int nids = ((Integer) val.get(1)).intValue();
47
		
48
		DwgHandleReference handle = new DwgHandleReference();
49
		bitPos = handle.read(data, bitPos);
50
		idB.setParentHandle(handle);
51
		
52
		for(int i = 0; i < numReactors; i++){
53
			handle = new DwgHandleReference();
54
			bitPos = handle.read(data, bitPos);
55
			idB.addReactorHandle(handle);
56
		}
57
	
58
		handle = new DwgHandleReference();
59
		bitPos = handle.read(data, bitPos);
60
		idB.setXDicObjHandle(handle);
61
	    
62
		if(nids > 0){
63
			List handles = new ArrayList();
64
			for(int i = 0; i < nids; i++){
65
				handle = new DwgHandleReference();
66
				bitPos = handle.read(data, bitPos);
67
				handles.add(handle);
68
			}
69
			idB.setObjidHandles(handles);
70
		}
71
	}
72

  
73
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgRasterVariablesReader1314.java
1
/*
2
 * Created on 02-feb-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
8
import org.gvsig.dwg.lib.DwgObject;
9

  
10
/**
11
 * @author alzabord
12
 *
13
 * TODO To change the template for this generated type comment go to
14
 * Window - Preferences - Java - Code Style - Code Templates
15
 */
16
public class DwgRasterVariablesReader1314 extends AbstractDwg1314Reader {
17

  
18
	/* (non-Javadoc)
19
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
20
	 */
21
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
22
			throws RuntimeException, CorruptedDwgEntityException {
23
		// TODO Auto-generated method stub
24

  
25
	}
26

  
27
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSortEntsTableReader1314.java
1
/*
2
 * Created on 02-feb-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.List;
8

  
9
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
10
import org.gvsig.dwg.lib.DwgHandleReference;
11
import org.gvsig.dwg.lib.DwgObject;
12
import org.gvsig.dwg.lib.DwgUtil;
13
import org.gvsig.dwg.lib.objects.DwgSortEntStable;
14

  
15

  
16
/**
17
 * @author alzabord
18
 */
19
public class DwgSortEntsTableReader1314 extends AbstractDwg1314Reader {
20

  
21
	/* (non-Javadoc)
22
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
23
	 */
24
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
25
			throws RuntimeException, CorruptedDwgEntityException {
26
		
27
		if(! (dwgObj instanceof DwgSortEntStable))
28
	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSortEntStable");
29
		DwgSortEntStable stable = (DwgSortEntStable) dwgObj;
30
		int bitPos = offset;
31
		
32
		List val = DwgUtil.getBitLong(data, bitPos);
33
		bitPos = ((Integer) val.get(0)).intValue();
34
		int numReactors = ((Integer)val.get(1)).intValue();
35
		
36
		val = DwgUtil.getBitLong(data, bitPos);
37
		bitPos = ((Integer) val.get(0)).intValue();
38
		int ne = ((Integer)val.get(1)).intValue();
39
		if(ne > 0){
40
			DwgHandleReference[] handles = new DwgHandleReference[ne];
41
			for(int i = 0; i < ne; i++){
42
				handles[i] = new DwgHandleReference();
43
				bitPos = handles[i].read(data, bitPos);
44
			}//for
45
			stable.setSortedHandles(handles);
46
		}
47
		
48
		DwgHandleReference handle = new DwgHandleReference();
49
		bitPos = handle.read(data, bitPos);
50
		stable.setParentHandle(handle);
51
		
52
		for(int i = 0; i < numReactors; i++){
53
			handle = new DwgHandleReference();
54
			bitPos = handle.read(data, bitPos);
55
			stable.addReactorHandle(handle);
56
		}
57
		
58
		handle = new DwgHandleReference();
59
		bitPos = handle.read(data, bitPos);
60
		stable.setXDicObjHandle(handle);
61
		
62
		if(ne > 0){
63
			DwgHandleReference[] handles = new DwgHandleReference[ne];
64
			for(int i = 0; i < ne; i++){
65
				handles[i] = new DwgHandleReference();
66
				bitPos = handles[i].read(data, bitPos);
67
			}//for
68
			stable.setObjHandles(handles);
69
		}
70
	}
71

  
72
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgSplineReader1314.java
1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.List;
8

  
9
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
10
import org.gvsig.dwg.lib.DwgObject;
11
import org.gvsig.dwg.lib.DwgUtil;
12
import org.gvsig.dwg.lib.objects.DwgSpline;
13

  
14

  
15
/**
16
 * @author azabala
17
 */
18
public class DwgSplineReader1314 extends AbstractDwg1314Reader{
19

  
20
	/* (non-Javadoc)
21
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
22
	 */
23
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
24
		if(! (dwgObj instanceof DwgSpline))
25
	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgSpline");
26
		DwgSpline spline = (DwgSpline) dwgObj;
27
		
28
		int bitPos = offset;
29
		bitPos = headTailReader.readObjectHeader(data, bitPos, spline );
30
		
31
		List val = DwgUtil.getBitShort(data, bitPos);
32
		bitPos = ((Integer) val.get(0)).intValue();
33
		int scenario = ((Integer) val.get(1)).intValue();
34
		
35
		val = DwgUtil.getBitShort(data, bitPos);
36
		bitPos = ((Integer) val.get(0)).intValue();
37
		int degree = ((Integer) val.get(1)).intValue();
38
		spline.setDegree(degree);
39
		
40
		int knots = 0;
41
		int numCtPts = 0;
42
		int numFitPts = 0;
43
		
44
		boolean weight = false;
45
		
46
		switch(scenario){
47
			case 2:
48
				val = DwgUtil.getBitDouble(data, bitPos);
49
				bitPos = ((Integer) val.get(0)).intValue();
50
				double fitTolerance = ((Integer) val.get(1)).intValue();
51
				spline.setFitTolerance(fitTolerance);
52
				
53
				val = DwgUtil.getBitDouble(data, bitPos);
54
				bitPos = ((Integer) val.get(0)).intValue();
55
				double x = ((Integer) val.get(1)).intValue();
56
				
57
				val = DwgUtil.getBitDouble(data, bitPos);
58
				bitPos = ((Integer) val.get(0)).intValue();
59
				double y = ((Integer) val.get(1)).intValue();
60
				
61
				val = DwgUtil.getBitDouble(data, bitPos);
62
				bitPos = ((Integer) val.get(0)).intValue();
63
				double z = ((Integer) val.get(1)).intValue();
64
				spline.setBeginTanVector(new double[]{x, y, z});
65
				
66
				val = DwgUtil.getBitDouble(data, bitPos);
67
				bitPos = ((Integer) val.get(0)).intValue();
68
				x = ((Integer) val.get(1)).intValue();
69
				
70
				val = DwgUtil.getBitDouble(data, bitPos);
71
				bitPos = ((Integer) val.get(0)).intValue();
72
				y = ((Integer) val.get(1)).intValue();
73
				
74
				val = DwgUtil.getBitDouble(data, bitPos);
75
				bitPos = ((Integer) val.get(0)).intValue();
76
				z = ((Integer) val.get(1)).intValue();
77
				spline.setEndTanVector(new double[]{x, y, z});
78
				
79
				val = DwgUtil.getBitShort(data, bitPos);
80
				bitPos = ((Integer) val.get(0)).intValue();
81
				numFitPts = ((Integer) val.get(1)).intValue();
82
			break;
83
			
84
			case 1:
85
				val = DwgUtil.testBit(data, bitPos);
86
				bitPos = ((Integer) val.get(0)).intValue();
87
				boolean rational  = ((Boolean) val.get(1)).booleanValue();
88
				
89
				val = DwgUtil.testBit(data, bitPos);
90
				bitPos = ((Integer) val.get(0)).intValue();
91
				boolean closed  = ((Boolean) val.get(1)).booleanValue();
92
				
93
				val = DwgUtil.testBit(data, bitPos);
94
				bitPos = ((Integer) val.get(0)).intValue();
95
				boolean periodic  = ((Boolean) val.get(1)).booleanValue();
96
				
97
				val = DwgUtil.getBitDouble(data, bitPos);
98
				bitPos = ((Integer) val.get(0)).intValue();
99
				double knotTolerance = ((Double) val.get(1)).doubleValue();
100
				spline.setKnotTolerance(knotTolerance);
101
				
102
				val = DwgUtil.getBitDouble(data, bitPos);
103
				bitPos = ((Integer) val.get(0)).intValue();
104
				double controlTolerance = ((Double) val.get(1)).doubleValue();
105
				spline.setControlTolerance(controlTolerance);
106
				
107
				val = DwgUtil.getBitLong(data, bitPos);
108
				bitPos = ((Integer) val.get(0)).intValue();
109
				knots = ((Integer) val.get(1)).intValue();
110
				
111
				val = DwgUtil.getBitLong(data, bitPos);
112
				bitPos = ((Integer) val.get(0)).intValue();
113
				numCtPts = ((Integer) val.get(1)).intValue();
114
				
115
				val = DwgUtil.testBit(data, bitPos);
116
				bitPos = ((Integer) val.get(0)).intValue();
117
				weight  = ((Boolean) val.get(1)).booleanValue();
118
				
119
			break;
120
		
121
		
122
			default:
123
				System.out.println("Unexpected spline scenario "+scenario);
124
			break;
125
		}
126
		
127
		if(knots > 0){
128
			double[] knotsArray = new double[knots];
129
			for(int i = 0; i < knots; i++){
130
				val = DwgUtil.getBitDouble(data, bitPos);
131
				bitPos = ((Integer) val.get(0)).intValue();
132
				knotsArray[i] = ((Double) val.get(1)).doubleValue();
133
			}
134
			spline.setKnotPoints(knotsArray);
135
		}
136
		
137
		if(numCtPts > 0){
138
			double[][] ctrlPoint = new double[3][numCtPts];
139
			double[] weights = new double[numCtPts];
140
			for(int i = 0; i < numCtPts; i++){
141
				val = DwgUtil.getBitDouble(data, bitPos);
142
				bitPos = ((Integer) val.get(0)).intValue();
143
				double x = ((Integer) val.get(1)).intValue();
144
				
145
				val = DwgUtil.getBitDouble(data, bitPos);
146
				bitPos = ((Integer) val.get(0)).intValue();
147
				double y = ((Integer) val.get(1)).intValue();
148
				
149
				val = DwgUtil.getBitDouble(data, bitPos);
150
				bitPos = ((Integer) val.get(0)).intValue();
151
				double z = ((Integer) val.get(1)).intValue();
152
				
153
				ctrlPoint[0][i] = x;
154
				ctrlPoint[1][i] = y;
155
				ctrlPoint[2][i] = z;
156
				
157
				if(weight){
158
					val = DwgUtil.getBitDouble(data, bitPos);
159
					bitPos = ((Integer) val.get(0)).intValue();
160
					weights[i] = ((Integer) val.get(1)).intValue();
161
				}
162
			}//for
163
			spline.setControlPoints(ctrlPoint);
164
			spline.setWeights(weights);
165
		}//if
166
		
167
		
168
		if(numFitPts > 0){
169
			double[][] fitPoint = new double[3][numCtPts];
170
			for(int i = 0; i < numFitPts; i++){
171
				val = DwgUtil.getBitDouble(data, bitPos);
172
				bitPos = ((Integer) val.get(0)).intValue();
173
				double x = ((Integer) val.get(1)).intValue();
174
				
175
				val = DwgUtil.getBitDouble(data, bitPos);
176
				bitPos = ((Integer) val.get(0)).intValue();
177
				double y = ((Integer) val.get(1)).intValue();
178
				
179
				val = DwgUtil.getBitDouble(data, bitPos);
180
				bitPos = ((Integer) val.get(0)).intValue();
181
				double z = ((Integer) val.get(1)).intValue();
182
				
183
				fitPoint[0][i] = x;
184
				fitPoint[1][i] = y;
185
				fitPoint[2][i] = z;
186
			}
187
			spline.setFitPoints(fitPoint);
188
		}
189
		bitPos = headTailReader.readObjectTailer(data, bitPos, spline);
190
	}
191
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgVertexPFaceFaceReader1314.java
1
/*
2
 * Created on 03-feb-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: DwgVertexPFaceFaceReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
47
* $Log$
48
* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
49
* implementation of dwg 12, 13, 14.
50
*
51
* Revision 1.2  2007/03/20 19:57:09  azabala
52
* source code cleaning
53
*
54
* Revision 1.1  2007/02/05 07:03:22  azabala
55
* *** empty log message ***
56
*
57
*
58
*/
59
package org.gvsig.dwg.lib.readers.v1314;
60

  
61
import java.util.List;
62

  
63
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
64
import org.gvsig.dwg.lib.DwgObject;
65
import org.gvsig.dwg.lib.DwgUtil;
66
import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace;
67

  
68

  
69
public class DwgVertexPFaceFaceReader1314 extends AbstractDwg1314Reader {
70

  
71
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
72
			throws RuntimeException, CorruptedDwgEntityException {
73
		
74
		 if(! (dwgObj instanceof DwgVertexPFaceFace))
75
		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgVertexPFaceFace");
76
		 DwgVertexPFaceFace v = (DwgVertexPFaceFace) dwgObj;
77
		 
78
		 int bitPos = offset;
79
		 
80
		 bitPos = headTailReader.readObjectHeader(data, offset, v);
81
		 
82
		 List val = DwgUtil.getBitShort(data, bitPos);
83
		 bitPos = ((Integer) val.get(0)).intValue();
84
		 int v1 = ((Integer) val.get(1)).intValue();
85
		 
86
		 val = DwgUtil.getBitShort(data, bitPos);
87
		 bitPos = ((Integer) val.get(0)).intValue();
88
		 int v2 = ((Integer) val.get(1)).intValue();
89
		 
90
		 val = DwgUtil.getBitShort(data, bitPos);
91
		 bitPos = ((Integer) val.get(0)).intValue();
92
		 int v3 = ((Integer) val.get(1)).intValue();
93
		 
94
		 val = DwgUtil.getBitShort(data, bitPos);
95
		 bitPos = ((Integer) val.get(0)).intValue();
96
		 int v4 = ((Integer) val.get(1)).intValue();
97
		 
98
		 v.setVerticesidx(new int[]{v1, v2, v3, v4});
99
		 
100
		 bitPos = headTailReader.readObjectTailer(data, bitPos, v);
101
	}
102

  
103
}
104

  
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgMeshReader1314.java
1
/*
2
 * Created on 03-feb-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: DwgMeshReader1314.java 28969 2009-05-25 13:23:12Z jmvivo $
47
* $Log$
48
* Revision 1.1.2.2  2007-03-21 19:49:16  azabala
49
* implementation of dwg 12, 13, 14.
50
*
51
* Revision 1.2  2007/03/01 19:56:52  azabala
52
* refactor of names
53
*
54
* Revision 1.1  2007/02/05 07:03:22  azabala
55
* *** empty log message ***
56
*
57
*
58
*/
59
package org.gvsig.dwg.lib.readers.v1314;
60

  
61
import java.util.List;
62

  
63
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
64
import org.gvsig.dwg.lib.DwgHandleReference;
65
import org.gvsig.dwg.lib.DwgObject;
66
import org.gvsig.dwg.lib.DwgUtil;
67
import org.gvsig.dwg.lib.objects.DwgMeshPolyline;
68

  
69

  
70
public class DwgMeshReader1314 extends AbstractDwg1314Reader {
71

  
72
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj)
73
			throws RuntimeException, CorruptedDwgEntityException {
74
		if(! (dwgObj instanceof DwgMeshPolyline))
75
	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgMeshPolyline");
76
		DwgMeshPolyline m = (DwgMeshPolyline) dwgObj;
77
		int bitPos = offset;
78
		bitPos = headTailReader.readObjectHeader(data, bitPos, m);
79
		
80
		List val = DwgUtil.getBitShort(data, bitPos);
81
		bitPos = ((Integer) val.get(0)).intValue();
82
		int flags = ((Integer) val.get(1)).intValue();
83
		m.setFlags(flags);
84
		
85
		val = DwgUtil.getBitShort(data, bitPos);
86
		bitPos = ((Integer) val.get(0)).intValue();
87
		int curveType = ((Integer) val.get(1)).intValue();
88
		m.setCurveType(curveType);
89
		
90
		val = DwgUtil.getBitShort(data, bitPos);
91
		bitPos = ((Integer) val.get(0)).intValue();
92
		int mVerticies = ((Integer) val.get(1)).intValue();
93
		m.setMVerticies(mVerticies);
94
		
95
		val = DwgUtil.getBitShort(data, bitPos);
96
		bitPos = ((Integer) val.get(0)).intValue();
97
		int nVerticies = ((Integer) val.get(1)).intValue();
98
		m.setNVerticies(nVerticies);
99
		
100
		val = DwgUtil.getBitShort(data, bitPos);
101
		bitPos = ((Integer) val.get(0)).intValue();
102
		int mDensity = ((Integer) val.get(1)).intValue();
103
		m.setMDensity(mDensity);
104
		
105
		val = DwgUtil.getBitShort(data, bitPos);
106
		bitPos = ((Integer) val.get(0)).intValue();
107
		int nDensity = ((Integer) val.get(1)).intValue();
108
		m.setNDensity(nDensity);
109
		
110
		bitPos = headTailReader.readObjectTailer(data, bitPos, m);
111
		
112
		DwgHandleReference handle = new DwgHandleReference();
113
		bitPos = handle.read(data, bitPos);
114
		m.setFirstVertexHandle(handle);
115
		
116
		handle = new DwgHandleReference();
117
		bitPos = handle.read(data, bitPos);
118
		m.setLastVertexHandle(handle);
119
		
120
		handle = new DwgHandleReference();
121
		bitPos = handle.read(data, bitPos);
122
		m.setSeqendHandle(handle);
123
	}
124

  
125
}
126

  
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgEllipseReader1314.java
1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.List;
8

  
9
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
10
import org.gvsig.dwg.lib.DwgObject;
11
import org.gvsig.dwg.lib.DwgUtil;
12
import org.gvsig.dwg.lib.objects.DwgArc;
13
import org.gvsig.dwg.lib.objects.DwgEllipse;
14

  
15

  
16
/**
17
 * @author alzabord
18
 *
19
 * TODO To change the template for this generated type comment go to
20
 * Window - Preferences - Java - Code Style - Code Templates
21
 */
22
public class DwgEllipseReader1314 extends AbstractDwg1314Reader{
23

  
24
	/* (non-Javadoc)
25
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
26
	 */
27
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
28
		if(! (dwgObj instanceof DwgEllipse))
29
	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgEllipse");
30
		DwgEllipse ell = (DwgEllipse) dwgObj;
31
		int bitPos = offset;
32
		bitPos = headTailReader.readObjectHeader(data, bitPos, ell);
33
		
34
		List val = DwgUtil.getBitDouble(data, bitPos);
35
		bitPos = ((Integer) val.get(0)).intValue();
36
		double x = ((Double) val.get(1)).doubleValue();
37
		
38
		val = DwgUtil.getBitDouble(data, bitPos);
39
		bitPos = ((Integer) val.get(0)).intValue();
40
		double y = ((Double) val.get(1)).doubleValue();
41
		
42
		val = DwgUtil.getBitDouble(data, bitPos);
43
		bitPos = ((Integer) val.get(0)).intValue();
44
		double z = ((Double) val.get(1)).doubleValue();
45
		ell.setCenter(new double[]{x, y, z});
46
		
47
		val = DwgUtil.getBitDouble(data, bitPos);
48
		bitPos = ((Integer) val.get(0)).intValue();
49
		x = ((Double) val.get(1)).doubleValue();
50
		
51
		val = DwgUtil.getBitDouble(data, bitPos);
52
		bitPos = ((Integer) val.get(0)).intValue();
53
		y = ((Double) val.get(1)).doubleValue();
54
		
55
		val = DwgUtil.getBitDouble(data, bitPos);
56
		bitPos = ((Integer) val.get(0)).intValue();
57
		z = ((Double) val.get(1)).doubleValue();
58
		ell.setSemiMajorAxisVector(new double[]{x, y, z});
59
		
60
		val = DwgUtil.getBitDouble(data, bitPos);
61
		bitPos = ((Integer) val.get(0)).intValue();
62
		x = ((Double) val.get(1)).doubleValue();
63
		
64
		val = DwgUtil.getBitDouble(data, bitPos);
65
		bitPos = ((Integer) val.get(0)).intValue();
66
		y = ((Double) val.get(1)).doubleValue();
67
		
68
		val = DwgUtil.getBitDouble(data, bitPos);
69
		bitPos = ((Integer) val.get(0)).intValue();
70
		z = ((Double) val.get(1)).doubleValue();
71
		ell.setExtrusion(new double[]{x, y, z});
72
		
73
		val = DwgUtil.getBitDouble(data, bitPos);
74
		bitPos = ((Integer) val.get(0)).intValue();
75
		double axisRatio = ((Double) val.get(1)).doubleValue();
76
		ell.setAxisRatio(axisRatio);
77
		
78
		val = DwgUtil.getBitDouble(data, bitPos);
79
		bitPos = ((Integer) val.get(0)).intValue();
80
		double startAngle = ((Double) val.get(1)).doubleValue();
81
		ell.setInitAngle(startAngle);
82
		
83
		val = DwgUtil.getBitDouble(data, bitPos);
84
		bitPos = ((Integer) val.get(0)).intValue();
85
		double endAngle = ((Double) val.get(1)).doubleValue();
86
		ell.setEndAngle(endAngle);
87
		
88
		bitPos = headTailReader.readObjectTailer(data, bitPos, ell);
89
	}
90
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgLwPolylineReader1314.java
1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.awt.geom.Point2D;
8
import java.util.ArrayList;
9
import java.util.List;
10

  
11
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
12
import org.gvsig.dwg.lib.DwgObject;
13
import org.gvsig.dwg.lib.DwgUtil;
14
import org.gvsig.dwg.lib.objects.DwgLwPolyline;
15

  
16

  
17
/**
18
 * @author alzabord
19
 *
20
 * TODO To change the template for this generated type comment go to
21
 * Window - Preferences - Java - Code Style - Code Templates
22
 */
23
public class DwgLwPolylineReader1314 extends AbstractDwg1314Reader{
24

  
25
	/* (non-Javadoc)
26
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
27
	 */
28
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
29
		if(! (dwgObj instanceof DwgLwPolyline))
30
	    	throw new RuntimeException("ArcReader 14 solo puede leer DwgLwPolyline");
31
		DwgLwPolyline l = (DwgLwPolyline) dwgObj;
32
		int bitPos = offset;
33
		
34
		bitPos = headTailReader.readObjectHeader(data, bitPos, l);
35
		
36
	
37
		List val = DwgUtil.getBitShort(data, bitPos);
38
		bitPos = ((Integer) val.get(0)).intValue();
39
		int flag = ((Integer) val.get(1)).intValue();
40
		l.setFlag(flag);
41
		
42
		double dVal = 0d;
43
		if((flag & 0x4) > 0){
44
			val = DwgUtil.getBitDouble(data, bitPos);
45
			bitPos = ((Integer) val.get(0)).intValue();
46
			dVal = ((Double) val.get(1)).doubleValue();
47
		}
48
		l.setConstWidth(dVal);
49
		
50
		dVal = 0d;
51
		if((flag & 0x8) > 0){
52
			val = DwgUtil.getBitDouble(data, bitPos);
53
			bitPos = ((Integer) val.get(0)).intValue();
54
			dVal = ((Double) val.get(1)).doubleValue();
55
		}
56
		l.setElevation(dVal);
57
		
58
		dVal = 0d;
59
		if ((flag & 0x2) > 0){
60
			val = DwgUtil.getBitDouble(data, bitPos);
61
			bitPos = ((Integer) val.get(0)).intValue();
62
			dVal = ((Double) val.get(1)).doubleValue();
63
		}
64
		l.setThickness(dVal);
65
		
66
		double x, y, z ;
67
		x = 0d;
68
		y = 0d; 
69
		z = 0d;
70
		
71
		if ((flag & 0x1) > 0){
72
			val = DwgUtil.getBitDouble(data, bitPos);
73
			bitPos = ((Integer) val.get(0)).intValue();
74
			x = ((Double) val.get(1)).doubleValue();
75
			
76
			val = DwgUtil.getBitDouble(data, bitPos);
77
			bitPos = ((Integer) val.get(0)).intValue();
78
			y = ((Double) val.get(1)).doubleValue();
79
			
80
			val = DwgUtil.getBitDouble(data, bitPos);
81
			bitPos = ((Integer) val.get(0)).intValue();
82
			z = ((Double) val.get(1)).doubleValue();
83
		}
84
		l.setNormal(new double[]{x, y, z});
85
		
86
		val = DwgUtil.getBitLong(data, bitPos);
87
		bitPos = ((Integer) val.get(0)).intValue();
88
		int np = ((Integer) val.get(1)).intValue();
89
		
90
		int nb = 0;
91
		if((flag & 0x10) > 0){
92
			val = DwgUtil.getBitLong(data, bitPos);
93
			bitPos = ((Integer) val.get(0)).intValue();
94
			nb = ((Integer) val.get(1)).intValue();
95
		}
96
		if(nb > 10000)
97
    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
98
		
99
		int nw = 0;
100
		if((flag & 0x20) > 0){
101
			val = DwgUtil.getBitLong(data, bitPos);
102
			bitPos = ((Integer) val.get(0)).intValue();
103
			nw = ((Integer) val.get(1)).intValue();
104
		}
105
		
106
		if(nw > 10000)
107
    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
108
		
109
		if(np > 0){
110
			if(np > 10000)
111
	    		throw new CorruptedDwgEntityException("LwPolyline corrupta");
112
			List points = new ArrayList();
113
			for(int i = 0; i < np; i++){
114
				val = DwgUtil.getRawDouble(data, bitPos);
115
				bitPos = ((Integer) val.get(0)).intValue();
116
				x = ((Double) val.get(1)).doubleValue();
117
				
118
				val = DwgUtil.getRawDouble(data, bitPos);
119
				bitPos = ((Integer) val.get(0)).intValue();
120
				y = ((Double) val.get(1)).doubleValue();
121
				
122
				points.add(new double[]{x,y});
123
			}//for
124
			l.setVertices(points);
125
		}//if np
126
		
127
		if(nb > 0){
128
			double[] bulges = new double[nb];
129
			for(int i = 0; i < nb; i++){
130
				val = DwgUtil.getRawDouble(data, bitPos);
131
				bitPos = ((Integer) val.get(0)).intValue();
132
				bulges[i] = ((Double) val.get(1)).doubleValue();
133
			}//for
134
			l.setBulges(bulges);
135
		}//if nb
136
		
137
		if(nw > 0){
138
			double[][] widths = new double[nw][2];
139
			for(int i = 0; i < nw; i++){
140
				val = DwgUtil.getBitDouble(data, bitPos);
141
				bitPos = ((Integer) val.get(0)).intValue();
142
				double sw = ((Double) val.get(1)).doubleValue();
143
				
144
				val = DwgUtil.getBitDouble(data, bitPos);
145
				bitPos = ((Integer) val.get(0)).intValue();
146
				double ew = ((Double) val.get(1)).doubleValue();
147
				
148
				widths[i][0] = sw;
149
				widths[i][1] = ew;
150
			}//for
151
			l.setWidths(widths);
152
		}
153
		bitPos = headTailReader.readObjectTailer(data, bitPos, l);
154
	}
155
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgCircleReader1314.java
1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.List;
8

  
9
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
10
import org.gvsig.dwg.lib.DwgObject;
11
import org.gvsig.dwg.lib.DwgUtil;
12
import org.gvsig.dwg.lib.objects.DwgCircle;
13

  
14

  
15
/**
16
 * @author alzabord
17
 *
18
 * TODO To change the template for this generated type comment go to
19
 * Window - Preferences - Java - Code Style - Code Templates
20
 */
21
public class DwgCircleReader1314 extends AbstractDwg1314Reader{
22

  
23
	/* (non-Javadoc)
24
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
25
	 */
26
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
27
		 if(! (dwgObj instanceof DwgCircle))
28
		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgCircle");
29
		 DwgCircle circle = (DwgCircle) dwgObj;
30
		 int bitPos = offset;
31
		 bitPos = headTailReader.readObjectHeader(data, offset, circle );
32
		
33
		 List val = DwgUtil.getBitDouble(data, bitPos);
34
		 bitPos = ((Integer) val.get(0)).intValue();
35
		 double x = ((Double) val.get(1)).doubleValue();
36
		 
37
		 val = DwgUtil.getBitDouble(data, bitPos);
38
		 bitPos = ((Integer) val.get(0)).intValue();
39
		 double y = ((Double) val.get(1)).doubleValue();
40
		 
41
		 val = DwgUtil.getBitDouble(data, bitPos);
42
		 bitPos = ((Integer) val.get(0)).intValue();
43
		 double z = ((Double) val.get(1)).doubleValue();
44
		 circle.setCenter(new double[]{x, y, z});
45
		 
46
		 val = DwgUtil.getBitDouble(data, bitPos);
47
		 bitPos = ((Integer) val.get(0)).intValue();
48
		 double radius = ((Double) val.get(1)).doubleValue();
49
		 circle.setRadius(radius);
50
		 
51
		 val = DwgUtil.getBitDouble(data, bitPos);
52
		 bitPos = ((Integer) val.get(0)).intValue();
53
		 double thickness = ((Double) val.get(1)).doubleValue();
54
		 circle.setThickness(thickness);
55
		 
56
		 val = DwgUtil.getBitDouble(data, bitPos);
57
		 bitPos = ((Integer) val.get(0)).intValue();
58
		 x = ((Double) val.get(1)).doubleValue();
59
		 
60
		 val = DwgUtil.getBitDouble(data, bitPos);
61
		 bitPos = ((Integer) val.get(0)).intValue();
62
		 y = ((Double) val.get(1)).doubleValue();
63
		 
64
		 val = DwgUtil.getBitDouble(data, bitPos);
65
		 bitPos = ((Integer) val.get(0)).intValue();
66
		 z = ((Double) val.get(1)).doubleValue();
67
		 circle.setExtrusion(new double[]{x, y, z});
68
		 
69
		 bitPos = headTailReader.readObjectTailer(data, bitPos, circle);
70
	}
71
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgImageDefReader1314.java
1
/*
2
 * Created on 02-feb-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
8
import org.gvsig.dwg.lib.DwgObject;
9

  
10
/**
11
 * @author alzabord
12
 *
13
 * TODO To change the template for this generated type comment go to
14
 * Window - Preferences - Java - Code Style - Code Templates
15
 */
16
public class DwgImageDefReader1314 extends AbstractDwg1314Reader {
17

  
18
	/* (non-Javadoc)
19
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
20
	 */
21
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
22
		// TODO Auto-generated method stub
23
		
24
	}
25

  
26
}
tags/org.gvsig.dwg-2.0.22/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/readers/v1314/DwgBlockHeaderReader1314.java
1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package org.gvsig.dwg.lib.readers.v1314;
6

  
7
import java.util.List;
8

  
9
import org.gvsig.dwg.lib.CorruptedDwgEntityException;
10
import org.gvsig.dwg.lib.DwgHandleReference;
11
import org.gvsig.dwg.lib.DwgObject;
12
import org.gvsig.dwg.lib.DwgUtil;
13
import org.gvsig.dwg.lib.objects.DwgBlockHeader;
14

  
15

  
16
/**
17
 * @author alzabord
18
 *
19
 */
20
public class DwgBlockHeaderReader1314 extends AbstractDwg1314Reader{
21

  
22
	/* (non-Javadoc)
23
	 * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
24
	 */
25
	
26
	//TODO REVISAR COMO TRATAR LAS REFERENCIAS EXTERNAS
27
	public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
28
		 if(! (dwgObj instanceof DwgBlockHeader))
29
		    	throw new RuntimeException("ArcReader 14 solo puede leer DwgBlockHeader");
30
		 DwgBlockHeader blk = (DwgBlockHeader) dwgObj;
31
		 int bitPos = offset;
32
		 
33
		 List val = DwgUtil.getBitLong(data, bitPos);
34
		 bitPos = ((Integer) val.get(0)).intValue();
35
		 int numReactors = ((Integer) val.get(1)).intValue();
36
		 blk.setNumReactors(numReactors);
37
		
38
		 val = DwgUtil.getTextString(data, bitPos);
39
		 bitPos = ((Integer) val.get(0)).intValue();
40
		 String name = (String) val.get(1);
41
		 blk.setName(name);
42
		 
43
		 val = DwgUtil.testBit(data, bitPos);
44
		 bitPos = ((Integer) val.get(0)).intValue();
45
		 boolean flag64 = ((Boolean) val.get(1)).booleanValue();
46
		 blk.setFlag64(flag64);
47
		 
48
		 val = DwgUtil.getBitShort(data, bitPos);
49
		 bitPos = ((Integer) val.get(0)).intValue();
50
		 int xRefPlus = ((Integer) val.get(1)).intValue();
51
		 blk.setXRefPlus(xRefPlus);
52
		 
53
		 val = DwgUtil.testBit(data, bitPos);
54
		 bitPos = ((Integer) val.get(0)).intValue();
55
		 boolean xdep = ((Boolean) val.get(1)).booleanValue();
56
		 blk.setXdep(xdep);
57
		 
58
		 val = DwgUtil.testBit(data, bitPos);
59
		 bitPos = ((Integer) val.get(0)).intValue();
60
		 boolean anonymous = ((Boolean) val.get(1)).booleanValue();
61
		 blk.setAnonymous(anonymous);
62
		 
63
		 val = DwgUtil.testBit(data, bitPos);
64
		 bitPos = ((Integer) val.get(0)).intValue();
65
		 boolean hasAttr = ((Boolean) val.get(1)).booleanValue();
66
		 blk.setHasAttrs(hasAttr);
67
		 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff