Revision 430
tags/org.gvsig.dwg-2.0.97/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.97/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.97/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.97/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.DWGStoreProvider; |
|
27 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
28 |
|
|
29 |
/** |
|
30 |
* Dummy DWG extension, as all the registration happens in the |
|
31 |
* {@link DWGLibrary}. |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
*/ |
|
35 |
public class DWGRegisterExtension extends Extension { |
|
36 |
|
|
37 |
public void execute(String actionCommand) { |
|
38 |
// Nothing to do |
|
39 |
} |
|
40 |
|
|
41 |
public void initialize() { |
|
42 |
IconThemeHelper.registerIcon("layer", "layer-icon-dwg", this); |
|
43 |
} |
|
44 |
|
|
45 |
public void postInitialize() { |
|
46 |
MapContextLocator.getMapContextManager().registerIconLayer(DWGStoreProvider.NAME, "layer-icon-dwg"); |
|
47 |
} |
|
48 |
|
|
49 |
public boolean isEnabled() { |
|
50 |
// Nothing to do |
|
51 |
return false; |
|
52 |
} |
|
53 |
|
|
54 |
public boolean isVisible() { |
|
55 |
// Nothing to do |
|
56 |
return false; |
|
57 |
} |
|
58 |
|
|
59 |
} |
tags/org.gvsig.dwg-2.0.97/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.mainplugin"/> |
|
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.97/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>${project.artifactId}</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.97</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.name>Formats: dwg file format support (read-only)</gvsig.package.info.name> |
|
75 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
76 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
77 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies> |
|
78 |
<gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories> |
|
79 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-dwg/pool</gvsig.package.info.poolURL> |
|
80 |
</properties> |
|
81 |
|
|
82 |
<build> |
|
83 |
<plugins> |
|
84 |
|
|
85 |
<plugin> |
|
86 |
<!-- Skip compilation tests --> |
|
87 |
<groupId>org.apache.maven.plugins</groupId> |
|
88 |
<artifactId>maven-compiler-plugin</artifactId> |
|
89 |
<executions> |
|
90 |
<execution> |
|
91 |
<id>default-testCompile</id> |
|
92 |
<phase>process-test-sources</phase> |
|
93 |
<goals> |
|
94 |
<goal>testCompile</goal> |
|
95 |
</goals> |
|
96 |
<configuration> |
|
97 |
<skip>true</skip> |
|
98 |
</configuration> |
|
99 |
</execution> |
|
100 |
</executions> |
|
101 |
</plugin> |
|
102 |
|
|
103 |
<plugin> |
|
104 |
<!-- Skip test execution --> |
|
105 |
<groupId>org.apache.maven.plugins</groupId> |
|
106 |
<artifactId>maven-surefire-plugin</artifactId> |
|
107 |
<configuration> |
|
108 |
<skipTests>true</skipTests> |
|
109 |
</configuration> |
|
110 |
</plugin> |
|
111 |
|
|
112 |
</plugins> |
|
113 |
</build> |
|
114 |
|
|
115 |
</project> |
|
116 |
|
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Mar 03 12:31:37 CET 2019 |
|
2 |
buildNumber=2165 |
|
0 | 3 |
tags/org.gvsig.dwg-2.0.97/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.97</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.97/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgFileTest.java | ||
---|---|---|
1 |
package org.gvsig.dwg.lib; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.net.URL; |
|
6 |
|
|
7 |
import junit.framework.TestCase; |
|
8 |
|
|
9 |
public class DwgFileTest extends TestCase { |
|
10 |
private File baseDataPath; |
|
11 |
|
|
12 |
protected void setUp() throws Exception { |
|
13 |
super.setUp(); |
|
14 |
URL url = this.getClass().getResource("data"); |
|
15 |
if (url == null) { |
|
16 |
throw new Exception("Can't find 'data' dir"); |
|
17 |
} |
|
18 |
|
|
19 |
baseDataPath = new File(url.getFile()); |
|
20 |
if (!baseDataPath.exists()) { |
|
21 |
throw new Exception("Can't find 'data' dir"); |
|
22 |
} |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
protected void tearDown() throws Exception { |
|
27 |
super.tearDown(); |
|
28 |
} |
|
29 |
public void test1() throws IOException, DwgVersionNotSupportedException { |
|
30 |
// String fileName = baseDataPath.getAbsolutePath()+"/Un punto.dwg"; |
|
31 |
// DwgFile dwg = new DwgFile(fileName); |
|
32 |
// |
|
33 |
// dwg.read(); |
|
34 |
// dwg.calculateGisModelDwgPolylines(); |
|
35 |
// dwg.blockManagement(); |
|
36 |
// LinkedList dwgObjects = dwg.getDwgObjects(); |
|
37 |
} |
|
38 |
|
|
39 |
public void test2() throws RuntimeException, CorruptedDwgEntityException{ |
|
40 |
//Dwg Object that is supposed to be |
|
41 |
//an LWPOLYLINE in V14 version |
|
42 |
/* |
|
43 |
int[] data = new int[]{61,64,64,183,19,227,104,16 |
|
44 |
,0,5,8,59,72,32,252,47,90,142, |
|
45 |
234,145,50,10,71,11,213,36,229, |
|
46 |
162,130,10,228,126,23,174,130, |
|
47 |
145,50,15,98,141,196,244,229, |
|
48 |
162,130,12,126,23,169,66,58, |
|
49 |
145,50,12,47,90,138,68,229, |
|
50 |
162,130,8,0,0,4,7,74,137,50, |
|
51 |
15,177,66,231,252,221,162,130, |
|
52 |
9,130,151,21,242,151,21,190, |
|
53 |
8,21,8,56}; |
|
54 |
*/ |
|
55 |
// int[] data = new int[]{62,128,64,71,99, |
|
56 |
// 40,48,0,5,8,27,72, |
|
57 |
// 100,126,23,169,68, |
|
58 |
// 178,105,50,13,114, |
|
59 |
// 63,11,82,165,162,130, |
|
60 |
// 13,114,63,11,210,138, |
|
61 |
// 105,50,8,173,114,59, |
|
62 |
// 138,205,162,130,15,98, |
|
63 |
// 141,192,241,58,105,50, |
|
64 |
// 11,51,51,52,178,229,162, |
|
65 |
// 130,14,110,102,98,97,234, |
|
66 |
// 105,50,11,51,51,52,179,21, |
|
67 |
// 162,130,10,149,192,240,42, |
|
68 |
// 162,105,50,14,189,27,131, |
|
69 |
// 107,69,162,130,14,31,169, |
|
70 |
// 66,227,74,105,50,9,240,86, |
|
71 |
// 185,27,117,162,130,11,59, |
|
72 |
// 51,51,52,234,105,50,13,114, |
|
73 |
// 63,11,83,85,162,130,9,74,228, |
|
74 |
// 126,22,186,105,50,11,51,51,50, |
|
75 |
// 51,53,162,130,11,137,232,82,190, |
|
76 |
// 58,105,50,9,74,228,122,147,13,162, |
|
77 |
// 130,11,137,232,82,189,106,105,50,9, |
|
78 |
// 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}; |
|
79 |
// //1er intento: suponemos que la LWPOLYLINE cumple la especificaci?n |
|
80 |
// //a rajatabla |
|
81 |
// int bitPos = 0; |
|
82 |
// List val = DwgUtil.getBitShort(data, bitPos); |
|
83 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
84 |
// int type = ((Integer) val.get(1)).intValue(); |
|
85 |
// System.out.println("type = " + type); |
|
86 |
// |
|
87 |
// DwgHandleReference hr = new DwgHandleReference(); |
|
88 |
// bitPos = hr.read(data, bitPos); |
|
89 |
// System.out.println("handle, code="+ |
|
90 |
// hr.getCode()+ |
|
91 |
// " ,offset="+ |
|
92 |
// hr.getOffset()); |
|
93 |
// |
|
94 |
// //Ahora pasamos a la extended data |
|
95 |
// val = DwgUtil.getBitShort(data, bitPos); |
|
96 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
97 |
// int extendedDataSize = ((Integer) val.get(1)).intValue(); |
|
98 |
// System.out.println("EED size="+extendedDataSize); |
|
99 |
// //como el size es 0, me lo salto |
|
100 |
// |
|
101 |
// //ver si tiene datos graficos |
|
102 |
// val = DwgUtil.testBit(data, bitPos); |
|
103 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
104 |
// boolean hasGraphicsData = ((Boolean) val.get(1)) |
|
105 |
// .booleanValue(); |
|
106 |
// System.out.println("graphics = "+hasGraphicsData); |
|
107 |
// |
|
108 |
// //como se que no hay graphics me lo salto |
|
109 |
// //tama?o en bits |
|
110 |
// val = DwgUtil.getRawLong(data, bitPos); |
|
111 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
112 |
// int sizeInBits = ((Integer) val.get(1)).intValue(); |
|
113 |
// System.out.println("sizeInBits = "+sizeInBits); |
|
114 |
// |
|
115 |
// /* |
|
116 |
// * Ahora, lo que viene es lo que en la spec se dice |
|
117 |
// * "Common entity data". Revisar bien pues PythonCAD no lo lee |
|
118 |
// * como en la spec. |
|
119 |
// * |
|
120 |
// * pag 42. |
|
121 |
// R13-R14 Only: |
|
122 |
// RL : Size of object data in bits |
|
123 |
// 6B : Flags (FEDCBA) |
|
124 |
// 6B : Common parameters (CCSSII) |
|
125 |
// Segun esto, deberia leer 6 bits y 6 bits |
|
126 |
// |
|
127 |
// FLAGS |
|
128 |
// Mas adelante (pag 43), dice: |
|
129 |
// DC : This is the number of reactors attached to an |
|
130 |
// entity as a bitshort. |
|
131 |
// This feature may have been dormant in R13, |
|
132 |
// but it appears in R14, and in files saved as R13 by R14. |
|
133 |
// |
|
134 |
// Ahora bien, pythoncad las est? leyendo como bitLong |
|
135 |
// ?En que quedamos, son 2 bits, 1 bitLong o 1 bitShort? |
|
136 |
// TODO REVISAR |
|
137 |
// |
|
138 |
// COMMON PARAMETERS |
|
139 |
// Al principio, dice que son 6 bits (CC, SS, II) |
|
140 |
// pero luego dice (pag 43): |
|
141 |
// CC : Color bitshort |
|
142 |
// SS : Linetype scale bitdouble |
|
143 |
// II : "Invisible" flag bitshort |
|
144 |
// |
|
145 |
// Pythoncad, en vez de como 2 bits, los est? leyendo |
|
146 |
// como BitShort, BitDouble y BitShort |
|
147 |
// |
|
148 |
// * */ |
|
149 |
// |
|
150 |
// Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos); |
|
151 |
// bitPos += 2; |
|
152 |
// System.out.println("mode = "+mode); |
|
153 |
// |
|
154 |
// /* |
|
155 |
// val = DwgUtil.getBitLong(data, bitPos); |
|
156 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
157 |
// int rnum = ((Integer) val.get(1)).intValue(); |
|
158 |
// System.out.println("numReactors = "+rnum); |
|
159 |
//*/ |
|
160 |
// val = DwgUtil.getBitShort(data, bitPos); |
|
161 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
162 |
// int rnum = ((Integer) val.get(1)).intValue(); |
|
163 |
// System.out.println("numReactors = "+rnum); |
|
164 |
// |
|
165 |
// |
|
166 |
// val = DwgUtil.testBit(data, bitPos); |
|
167 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
168 |
// boolean isLyrByLineType = ((Boolean) val.get(1)).booleanValue(); |
|
169 |
// System.out.println("isLyrByLineType="+isLyrByLineType); |
|
170 |
// |
|
171 |
// val = DwgUtil.testBit(data, bitPos); |
|
172 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
173 |
// boolean noLinks = ((Boolean) val.get(1)).booleanValue(); |
|
174 |
// System.out.println("noLinks="+noLinks); |
|
175 |
// |
|
176 |
// |
|
177 |
// val = DwgUtil.getBitShort(data, bitPos); |
|
178 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
179 |
// int color = ((Integer) val.get(1)).intValue(); |
|
180 |
// System.out.println("color="+color); |
|
181 |
// |
|
182 |
// |
|
183 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
184 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
185 |
// float ltscale = ((Double) val.get(1)).floatValue(); |
|
186 |
// System.out.println("ltscale="+ltscale); |
|
187 |
// |
|
188 |
// val = DwgUtil.getBitShort(data, bitPos); |
|
189 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
190 |
// int invis = ((Integer) val.get(1)).intValue(); |
|
191 |
// System.out.println("invis="+invis); |
|
192 |
// |
|
193 |
// val = DwgUtil.getBitShort(data, bitPos); |
|
194 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
195 |
// int flag = ((Integer) val.get(1)).intValue(); |
|
196 |
// System.out.println("flag="+flag); |
|
197 |
// |
|
198 |
// double dVal = 0d; |
|
199 |
// if((flag & 0x4) > 0){ |
|
200 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
201 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
202 |
// dVal = ((Double) val.get(1)).doubleValue(); |
|
203 |
// } |
|
204 |
// System.out.println("constWidth="+dVal); |
|
205 |
// |
|
206 |
// dVal = 0d; |
|
207 |
// if((flag & 0x8) > 0){ |
|
208 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
209 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
210 |
// dVal = ((Double) val.get(1)).doubleValue(); |
|
211 |
// } |
|
212 |
// System.out.println("elevation="+dVal); |
|
213 |
// |
|
214 |
// dVal = 0d; |
|
215 |
// if ((flag & 0x2) > 0){ |
|
216 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
217 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
218 |
// dVal = ((Double) val.get(1)).doubleValue(); |
|
219 |
// } |
|
220 |
// System.out.println("thickness="+dVal); |
|
221 |
// |
|
222 |
// double x, y, z ; |
|
223 |
// x = 0d; |
|
224 |
// y = 0d; |
|
225 |
// z = 0d; |
|
226 |
// |
|
227 |
// if ((flag & 0x1) > 0){ |
|
228 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
229 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
230 |
// x = ((Double) val.get(1)).doubleValue(); |
|
231 |
// |
|
232 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
233 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
234 |
// y = ((Double) val.get(1)).doubleValue(); |
|
235 |
// |
|
236 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
237 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
238 |
// z = ((Double) val.get(1)).doubleValue(); |
|
239 |
// } |
|
240 |
// System.out.println("normal="+x+","+y+","+z); |
|
241 |
// |
|
242 |
// val = DwgUtil.getBitLong(data, bitPos); |
|
243 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
244 |
// int np = ((Integer) val.get(1)).intValue(); |
|
245 |
// System.out.println("numPoints="+np); |
|
246 |
// |
|
247 |
// int nb = 0; |
|
248 |
// if((flag & 0x10) > 0){ |
|
249 |
// val = DwgUtil.getBitLong(data, bitPos); |
|
250 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
251 |
// nb = ((Integer) val.get(1)).intValue(); |
|
252 |
// } |
|
253 |
// System.out.println("numBulges="+nb); |
|
254 |
// int nw = 0; |
|
255 |
// if((flag & 0x20) > 0){ |
|
256 |
// val = DwgUtil.getBitLong(data, bitPos); |
|
257 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
258 |
// nw = ((Integer) val.get(1)).intValue(); |
|
259 |
// } |
|
260 |
// System.out.println("numWidths="+nw); |
|
261 |
// if(np > 0){ |
|
262 |
// Point2D[] points = new Point2D[np]; |
|
263 |
// for(int i = 0; i < np; i++){ |
|
264 |
// val = DwgUtil.getRawDouble(data, bitPos); |
|
265 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
266 |
// x = ((Double) val.get(1)).doubleValue(); |
|
267 |
// |
|
268 |
// val = DwgUtil.getRawDouble(data, bitPos); |
|
269 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
270 |
// y = ((Double) val.get(1)).doubleValue(); |
|
271 |
// |
|
272 |
// points[i] = new Point2D.Double(x, y); |
|
273 |
// System.out.println("Punto"+i+"="+x+","+y); |
|
274 |
// }//for |
|
275 |
// }//if np |
|
276 |
// |
|
277 |
// if(nb > 0){ |
|
278 |
// double[] bulges = new double[nb]; |
|
279 |
// for(int i = 0; i < nb; i++){ |
|
280 |
// val = DwgUtil.getRawDouble(data, bitPos); |
|
281 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
282 |
// bulges[i] = ((Double) val.get(1)).doubleValue(); |
|
283 |
// System.out.println("Bulge"+i+"="+bulges[i]); |
|
284 |
// }//for |
|
285 |
// |
|
286 |
// }//if nb |
|
287 |
// |
|
288 |
// if(nw > 0){ |
|
289 |
// double[][] widths = new double[nw][2]; |
|
290 |
// for(int i = 0; i < nw; i++){ |
|
291 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
292 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
293 |
// double sw = ((Double) val.get(1)).doubleValue(); |
|
294 |
// |
|
295 |
// val = DwgUtil.getBitDouble(data, bitPos); |
|
296 |
// bitPos = ((Integer) val.get(0)).intValue(); |
|
297 |
// double ew = ((Double) val.get(1)).doubleValue(); |
|
298 |
// |
|
299 |
// widths[i][0] = sw; |
|
300 |
// widths[i][1] = ew; |
|
301 |
// System.out.println("Width"+i+"="+sw+","+ew); |
|
302 |
// }//for |
|
303 |
// } |
|
304 |
} |
|
305 |
|
|
306 |
public void test3(){ |
|
307 |
//test of extrusion |
|
308 |
double[] coord = null; |
|
309 |
double[] extrusion = null; |
|
310 |
double[] extrusion2 = new double[]{0, 0, 1}; |
|
311 |
|
|
312 |
coord = new double[]{790089.65, 4477974.75, 9.560000000114087}; |
|
313 |
extrusion = new double[]{-0.5037965987025721, 0.07005064807841195, 0.8609772899673451}; |
|
314 |
//1. algoritmo original, vector normal distinto |
|
315 |
// double[] newCoord = AcadExtrusionCalculator.extrude(coord, extrusion); |
|
316 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion); |
|
317 |
// |
|
318 |
//2? ahora con vector normal coincidente con eje Z |
|
319 |
// newCoord = AcadExtrusionCalculator.extrude(coord, extrusion2); |
|
320 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion2); |
|
321 |
} |
|
322 |
} |
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.lib/src/test/java/org/gvsig/dwg/lib/DwgTestSuite.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 08-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: DwgTestSuite.java 28970 2009-05-25 13:27:14Z jmvivo $ |
|
47 |
* $Log$ |
|
48 |
* Revision 1.1.2.1 2007-02-28 07:35:10 jmvivo |
|
49 |
* Actualizado desde el HEAD. |
|
50 |
* |
|
51 |
* Revision 1.1 2007/02/08 20:27:57 azabala |
|
52 |
* *** empty log message *** |
|
53 |
* |
|
54 |
* |
|
55 |
*/ |
|
56 |
package org.gvsig.dwg.lib; |
|
57 |
|
|
58 |
import junit.framework.Test; |
|
59 |
import junit.framework.TestSuite; |
|
60 |
|
|
61 |
public class DwgTestSuite { |
|
62 |
|
|
63 |
public static Test suite() { |
|
64 |
TestSuite suite = new TestSuite("Test for com.iver.cit.jdwglib.dwg"); |
|
65 |
//$JUnit-BEGIN$ |
|
66 |
suite.addTestSuite(DwgFileTest.class); |
|
67 |
//$JUnit-END$ |
|
68 |
return suite; |
|
69 |
} |
|
70 |
|
|
71 |
} |
|
72 |
|
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgExtrusionable.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 09-ene-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: IDwgExtrusionable.java 28969 2009-05-25 13:23:12Z jmvivo $ |
|
47 |
* $Log$ |
|
48 |
* Revision 1.3.2.2 2007-03-21 19:49:16 azabala |
|
49 |
* implementation of dwg 12, 13, 14. |
|
50 |
* |
|
51 |
* Revision 1.3 2007/02/15 20:35:13 azabala |
|
52 |
* comments |
|
53 |
* |
|
54 |
* Revision 1.2 2007/02/15 15:32:51 azabala |
|
55 |
* added comments |
|
56 |
* |
|
57 |
* Revision 1.1 2007/01/12 19:29:58 azabala |
|
58 |
* first version in cvs |
|
59 |
* |
|
60 |
* |
|
61 |
*/ |
|
62 |
package org.gvsig.dwg.lib; |
|
63 |
/** |
|
64 |
* All dwg drawing entities that need to compute |
|
65 |
* an extrussion before draw them must implement |
|
66 |
* this interface. |
|
67 |
* |
|
68 |
* This "extrusion" transforms coordinates from the |
|
69 |
* "Object Coordinate System" (OCS) to the |
|
70 |
* "World Coordinate System" (WCS). |
|
71 |
* |
|
72 |
* For some entities, the OCS is equivalent to the |
|
73 |
* WCS and all points are expressed in World coordinates. |
|
74 |
|
|
75 |
Entities Notes |
|
76 |
|
|
77 |
3D entities such as These entities do not lie in a |
|
78 |
line, point, 3dface, particular plane. All points are |
|
79 |
3D polyline, expressed in world coordinates. |
|
80 |
3D vertex, 3D mesh, Of these entities, only lines and points can be extruded. |
|
81 |
3D mesh vertex |
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
2D entities such as circle, arc, These entities are planar in nature. |
|
87 |
solid, trace, text, attrib, attdef, All points are expressed in object coordinates. |
|
88 |
shape, insert, 2D polyline, 2D vertex, All of these entities can be extruded. |
|
89 |
lwpolyline, hatch, image |
|
90 |
|
|
91 |
|
|
92 |
* |
|
93 |
* |
|
94 |
* */ |
|
95 |
public interface IDwgExtrusionable { |
|
96 |
public void applyExtrussion(); |
|
97 |
} |
|
98 |
|
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObjectFactory.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 27-dic-2006 |
|
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: DwgObjectFactory.java 28969 2009-05-25 13:23:12Z jmvivo $ |
|
47 |
* $Log$ |
|
48 |
* Revision 1.14.2.2 2007-03-21 19:49:16 azabala |
|
49 |
* implementation of dwg 12, 13, 14. |
|
50 |
* |
|
51 |
* Revision 1.18 2007/03/20 19:55:27 azabala |
|
52 |
* source code cleaning |
|
53 |
* |
|
54 |
* Revision 1.17 2007/03/06 19:39:38 azabala |
|
55 |
* Changes to adapt dwg 12 to general architecture |
|
56 |
* |
|
57 |
* Revision 1.16 2007/03/02 20:31:22 azabala |
|
58 |
* *** empty log message *** |
|
59 |
* |
|
60 |
* Revision 1.15 2007/03/01 19:59:46 azabala |
|
61 |
* source code cleaning |
|
62 |
* |
|
63 |
* Revision 1.14 2007/02/22 20:45:51 azabala |
|
64 |
* changes to add dwg 12 entities creation |
|
65 |
* |
|
66 |
* Revision 1.13 2007/02/14 09:20:32 fdiaz |
|
67 |
* Eliminado un comentario y habilitado de nuevo el else del final del metodo create. |
|
68 |
* |
|
69 |
* Revision 1.12 2007/02/08 20:27:06 azabala |
|
70 |
* solved bug with lwpolylines |
|
71 |
* |
|
72 |
* Revision 1.11 2007/02/08 10:27:35 azabala |
|
73 |
* if the type is unknown it returns NULL |
|
74 |
* |
|
75 |
* Revision 1.10 2007/02/06 20:17:29 azabala |
|
76 |
* *** empty log message *** |
|
77 |
* |
|
78 |
* Revision 1.9 2007/02/02 12:39:52 azabala |
|
79 |
* Added new dwg entities |
|
80 |
* |
|
81 |
* Revision 1.8 2007/02/01 20:00:27 azabala |
|
82 |
* *** empty log message *** |
|
83 |
* |
|
84 |
* Revision 1.7 2007/01/31 18:20:58 fdiaz |
|
85 |
* A๏ฟฝadido un return null al final de metodo create por si no entra en ninguna de las condiciones. |
|
86 |
* |
|
87 |
* Revision 1.6 2007/01/31 10:01:11 fdiaz |
|
88 |
* A๏ฟฝadido el DwgDictionary. |
|
89 |
* |
|
90 |
* Revision 1.5 2007/01/30 19:40:23 azabala |
|
91 |
* *** empty log message *** |
|
92 |
* |
|
93 |
* Revision 1.4 2007/01/30 12:37:18 azabala |
|
94 |
* *** empty log message *** |
|
95 |
* |
|
96 |
* Revision 1.3 2007/01/24 20:14:31 azabala |
|
97 |
* implementation of reader of V14 |
|
98 |
* |
|
99 |
* Revision 1.2 2007/01/12 19:35:00 azabala |
|
100 |
* *** empty log message *** |
|
101 |
* |
|
102 |
* Revision 1.1 2007/01/09 15:39:15 azabala |
|
103 |
* *** empty log message *** |
|
104 |
* |
|
105 |
* |
|
106 |
*/ |
|
107 |
package org.gvsig.dwg.lib; |
|
108 |
|
|
109 |
import org.gvsig.dwg.lib.objects.DwgArc; |
|
110 |
import org.gvsig.dwg.lib.objects.DwgAttdef; |
|
111 |
import org.gvsig.dwg.lib.objects.DwgAttrib; |
|
112 |
import org.gvsig.dwg.lib.objects.DwgBlock; |
|
113 |
import org.gvsig.dwg.lib.objects.DwgBlockControl; |
|
114 |
import org.gvsig.dwg.lib.objects.DwgBlockHeader; |
|
115 |
import org.gvsig.dwg.lib.objects.DwgCircle; |
|
116 |
import org.gvsig.dwg.lib.objects.DwgDictionary; |
|
117 |
import org.gvsig.dwg.lib.objects.DwgDictionaryVar; |
|
118 |
import org.gvsig.dwg.lib.objects.DwgDimOrd; |
|
119 |
import org.gvsig.dwg.lib.objects.DwgEllipse; |
|
120 |
import org.gvsig.dwg.lib.objects.DwgEndblk; |
|
121 |
import org.gvsig.dwg.lib.objects.DwgFace3D; |
|
122 |
import org.gvsig.dwg.lib.objects.DwgHatch; |
|
123 |
import org.gvsig.dwg.lib.objects.DwgIdBuffer; |
|
124 |
import org.gvsig.dwg.lib.objects.DwgImage; |
|
125 |
import org.gvsig.dwg.lib.objects.DwgImageDef; |
|
126 |
import org.gvsig.dwg.lib.objects.DwgImageDefReactor; |
|
127 |
import org.gvsig.dwg.lib.objects.DwgInsert; |
|
128 |
import org.gvsig.dwg.lib.objects.DwgLayer; |
|
129 |
import org.gvsig.dwg.lib.objects.DwgLayerControl; |
|
130 |
import org.gvsig.dwg.lib.objects.DwgLayerIndex; |
|
131 |
import org.gvsig.dwg.lib.objects.DwgLine; |
|
132 |
import org.gvsig.dwg.lib.objects.DwgLwPolyline; |
|
133 |
import org.gvsig.dwg.lib.objects.DwgMText; |
|
134 |
import org.gvsig.dwg.lib.objects.DwgMeshPolyline; |
|
135 |
import org.gvsig.dwg.lib.objects.DwgOle2Frame; |
|
136 |
import org.gvsig.dwg.lib.objects.DwgPFacePolyline; |
|
137 |
import org.gvsig.dwg.lib.objects.DwgPoint; |
|
138 |
import org.gvsig.dwg.lib.objects.DwgPolyline2D; |
|
139 |
import org.gvsig.dwg.lib.objects.DwgPolyline3D; |
|
140 |
import org.gvsig.dwg.lib.objects.DwgRasterVariables; |
|
141 |
import org.gvsig.dwg.lib.objects.DwgSeqend; |
|
142 |
import org.gvsig.dwg.lib.objects.DwgSolid; |
|
143 |
import org.gvsig.dwg.lib.objects.DwgSortEntStable; |
|
144 |
import org.gvsig.dwg.lib.objects.DwgSpatialFilter; |
|
145 |
import org.gvsig.dwg.lib.objects.DwgSpatialIndex; |
|
146 |
import org.gvsig.dwg.lib.objects.DwgSpline; |
|
147 |
import org.gvsig.dwg.lib.objects.DwgText; |
|
148 |
import org.gvsig.dwg.lib.objects.DwgVertex2D; |
|
149 |
import org.gvsig.dwg.lib.objects.DwgVertex3D; |
|
150 |
import org.gvsig.dwg.lib.objects.DwgVertexMesh; |
|
151 |
import org.gvsig.dwg.lib.objects.DwgVertexPFace; |
|
152 |
import org.gvsig.dwg.lib.objects.DwgVertexPFaceFace; |
|
153 |
import org.gvsig.dwg.lib.objects.DwgXRecord; |
|
154 |
|
|
155 |
|
|
156 |
/** |
|
157 |
* Factory that creates dwg entities from its code (int value). |
|
158 |
* |
|
159 |
* Some DWG entities dont have a fixed "type code". Instead, their type |
|
160 |
* is specified in the CLASSES section of the dwg file. |
|
161 |
* |
|
162 |
* |
|
163 |
* |
|
164 |
* It's a singleton |
|
165 |
* |
|
166 |
*/ |
|
167 |
public class DwgObjectFactory { |
|
168 |
|
|
169 |
private static DwgObjectFactory _instance = new DwgObjectFactory(); |
|
170 |
|
|
171 |
private DwgObjectFactory() { |
|
172 |
} |
|
173 |
|
|
174 |
/* |
|
175 |
* Constants to represent polyline2d, polyline3d, |
|
176 |
* vertex2d and vertex3d. |
|
177 |
* */ |
|
178 |
// public static final byte POLYLINE2D = 40; |
|
179 |
// public static final byte POLYLINE3D = 41; |
|
180 |
// public static final byte VERTEX2D = 50; |
|
181 |
// public static final byte VERTEX3D = 51; |
|
182 |
|
|
183 |
public static final DwgObjectFactory getInstance() { |
|
184 |
return _instance; |
|
185 |
} |
|
186 |
|
|
187 |
|
|
188 |
/** |
|
189 |
* Creates a Dwg object instance from its type. |
|
190 |
* |
|
191 |
* This method is used for DWG 13, 14, 2000 and 2004 files. |
|
192 |
* |
|
193 |
* */ |
|
194 |
public DwgObject create(int type, int index) { |
|
195 |
DwgObject obj = null; |
|
196 |
|
|
197 |
if (type == 0x1) { |
|
198 |
obj = new DwgText(index); |
|
199 |
obj.setGraphicsFlag(true); |
|
200 |
} else if (type == 0x2) { |
|
201 |
obj = new DwgAttrib(index); |
|
202 |
obj.setGraphicsFlag(true); |
|
203 |
} else if (type == 0x3) { |
|
204 |
obj = new DwgAttdef(index); |
|
205 |
obj.setGraphicsFlag(true); |
|
206 |
} else if (type == 0x4) { |
|
207 |
obj = new DwgBlock(index); |
|
208 |
obj.setGraphicsFlag(true); |
|
209 |
} else if (type == 0x5) { |
|
210 |
obj = new DwgEndblk(index); |
|
211 |
obj.setGraphicsFlag(true); |
|
212 |
} else if (type == 0x6) { |
|
213 |
obj = new DwgSeqend(index); |
|
214 |
obj.setGraphicsFlag(true); |
|
215 |
} else if (type == 0x7) { |
|
216 |
obj = new DwgInsert(index); |
|
217 |
obj.setGraphicsFlag(true); |
|
218 |
} else if (type == 0x0A) { |
|
219 |
obj = new DwgVertex2D(index); |
|
220 |
obj.setGraphicsFlag(true); |
|
221 |
} else if (type == 0x0B) { |
|
222 |
obj = new DwgVertex3D(index); |
|
223 |
obj.setGraphicsFlag(true); |
|
224 |
} else if (type == 0x0C) { |
|
225 |
obj = new DwgVertexMesh(index); |
|
226 |
obj.setGraphicsFlag(true); |
|
227 |
} else if (type == 0x0D) { |
|
228 |
obj = new DwgVertexPFace(index); |
|
229 |
obj.setGraphicsFlag(true); |
|
230 |
} else if (type == 0x0E) { |
|
231 |
obj = new DwgVertexPFaceFace(index); |
|
232 |
obj.setGraphicsFlag(true); |
|
233 |
} else if (type == 0x0F) { |
|
234 |
obj = new DwgPolyline2D(index); |
|
235 |
obj.setGraphicsFlag(true); |
|
236 |
} else if (type == 0x10) { |
|
237 |
obj = new DwgPolyline3D(index); |
|
238 |
obj.setGraphicsFlag(true); |
|
239 |
} else if (type == 0x11) { |
|
240 |
obj = new DwgArc(index); |
|
241 |
obj.setGraphicsFlag(true); |
|
242 |
} else if (type == 0x12) { |
|
243 |
obj = new DwgCircle(index); |
|
244 |
obj.setGraphicsFlag(true); |
|
245 |
} else if (type == 0x13) { |
|
246 |
obj = new DwgLine(index); |
|
247 |
obj.setGraphicsFlag(true); |
|
248 |
} else if (type == 0x1B) { |
|
249 |
obj = new DwgPoint(index); |
|
250 |
obj.setGraphicsFlag(true); |
|
251 |
} else if (type == 0x1D) { |
|
252 |
obj = new DwgPFacePolyline(index); |
|
253 |
obj.setGraphicsFlag(true); |
|
254 |
} else if (type == 0x1E) { |
|
255 |
obj = new DwgMeshPolyline(index); |
|
256 |
obj.setGraphicsFlag(true); |
|
257 |
} else if (type == 0x23) { |
|
258 |
obj = new DwgEllipse(index); |
|
259 |
obj.setGraphicsFlag(true); |
|
260 |
} else if (type == 0x24) { |
|
261 |
obj = new DwgSpline(index); |
|
262 |
obj.setGraphicsFlag(true); |
|
263 |
} else if (type == 0x2A) { |
|
264 |
obj = new DwgDictionary(index); |
|
265 |
obj.setGraphicsFlag(false); |
|
266 |
} else if (type == 0x2C) { |
|
267 |
obj = new DwgMText(index); |
|
268 |
obj.setGraphicsFlag(true); |
|
269 |
} else if (type == 0x30) { |
|
270 |
obj = new DwgBlockControl(index); |
|
271 |
obj.setGraphicsFlag(false); |
|
272 |
} else if (type == 0x31) { |
|
273 |
obj = new DwgBlockHeader(index); |
|
274 |
obj.setGraphicsFlag(false); |
|
275 |
} else if (type == 0x32) { |
|
276 |
obj = new DwgLayerControl(index); |
|
277 |
obj.setGraphicsFlag(false); |
|
278 |
} else if (type == 0x33) { |
|
279 |
obj = new DwgLayer(index); |
|
280 |
obj.setGraphicsFlag(false); |
|
281 |
} else if (type == 0x4D) { |
|
282 |
obj = new DwgLwPolyline(index); |
|
283 |
obj.setGraphicsFlag(true); |
|
284 |
} else if (type == 0x1F) { |
|
285 |
obj = new DwgSolid(index); |
|
286 |
obj.setGraphicsFlag(true); |
|
287 |
} |
|
288 |
|
|
289 |
// else if (type == 0x15) { |
|
290 |
// obj = new DwgLinearDimension(index); |
|
291 |
// obj.setGraphicsFlag(true); |
|
292 |
// } |
|
293 |
/* |
|
294 |
* Segun los foros de OpenDWG: |
|
295 |
* OLE2FRAME - 74 -> 0X4A |
|
296 |
LWPOLYLINE - 77 -> 0X4D |
|
297 |
HATCH - 78 -> 0X4E |
|
298 |
* |
|
299 |
* |
|
300 |
* */ |
|
301 |
|
|
302 |
|
|
303 |
/* |
|
304 |
else if (type == 0x4A){ |
|
305 |
obj = new DwgOle2Frame(index); |
|
306 |
obj.setGraphicsFlag(false); |
|
307 |
} |
|
308 |
|
|
309 |
|
|
310 |
else if (type == 0x4E){ |
|
311 |
obj = new DwgHatch(index); |
|
312 |
obj.setGraphicsFlag(true); |
|
313 |
} |
|
314 |
|
|
315 |
else if (type == 0x4E) { |
|
316 |
obj = new DwgLwPolyline(index); |
|
317 |
obj.setGraphicsFlag(true); |
|
318 |
} else if (type == 0x4F) { |
|
319 |
obj = new DwgLwPolyline(index); |
|
320 |
obj.setGraphicsFlag(true); |
|
321 |
} else if (type == 0x50) { |
|
322 |
obj = new DwgLwPolyline(index); |
|
323 |
obj.setGraphicsFlag(true); |
|
324 |
} else if (type == 0x51) { |
|
325 |
obj = new DwgLwPolyline(index); |
|
326 |
obj.setGraphicsFlag(true); |
|
327 |
} else if (type == 0x52) { |
|
328 |
obj = new DwgLwPolyline(index); |
|
329 |
obj.setGraphicsFlag(true); |
|
330 |
} else if (type == 0x53) { |
|
331 |
obj = new DwgLwPolyline(index); |
|
332 |
obj.setGraphicsFlag(true); |
|
333 |
} |
|
334 |
*/ |
|
335 |
|
|
336 |
else { |
|
337 |
// obj = new DwgObject(index); |
|
338 |
return null; |
|
339 |
} |
|
340 |
obj.setType(type); |
|
341 |
return obj; |
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* Creates a DwgObject from its DXF name. |
|
346 |
* |
|
347 |
* This method is used to create entities without a fixed dwg code type |
|
348 |
* (entities whose type is > 500) |
|
349 |
* |
|
350 |
* This method is used for DWG 13, 14 and 2000 files. |
|
351 |
* |
|
352 |
*/ |
|
353 |
public DwgObject create(String dxfName, int index) { |
|
354 |
//TODO De todas estas ver cuales son graficas, |
|
355 |
//para poner su graphicsFlag a true |
|
356 |
//ESTO MEJOR VA A SER CADA CLASE QUIEN LO HAGA, EN VEZ |
|
357 |
//DE LA FACTORIA |
|
358 |
|
|
359 |
// if (dxfName.equalsIgnoreCase("DICTIONARYVAR")) |
|
360 |
// return new DwgDictionaryVar(index); |
|
361 |
// else if (dxfName.equalsIgnoreCase("HATCH")) |
|
362 |
// return new DwgHatch(index); |
|
363 |
// else if (dxfName.equalsIgnoreCase("IDBUFFER")) |
|
364 |
// return new DwgIdBuffer(index); |
|
365 |
// else if (dxfName.equalsIgnoreCase("IMAGE")) |
|
366 |
// return new DwgImage(index); |
|
367 |
// else if (dxfName.equalsIgnoreCase("IMAGEDEF")) |
|
368 |
// return new DwgImageDef(index); |
|
369 |
// else if (dxfName.equalsIgnoreCase("IMAGEDEFREACTOR")) |
|
370 |
// return new DwgImageDefReactor(index); |
|
371 |
// else if (dxfName.equalsIgnoreCase("LAYER_INDEX")) |
|
372 |
// return new DwgLayerIndex(index); |
|
373 |
// else |
|
374 |
if (dxfName.equalsIgnoreCase("LWPOLYLINE")){ |
|
375 |
DwgLwPolyline solution = new DwgLwPolyline(index); |
|
376 |
solution.setGraphicsFlag(true); |
|
377 |
return solution; |
|
378 |
} |
|
379 |
// else if (dxfName.equalsIgnoreCase("OLE2FRAME")) |
|
380 |
// return new DwgOle2Frame(index); |
|
381 |
// else if (dxfName.equalsIgnoreCase("RASTERVARIABLES")) |
|
382 |
// return new DwgRasterVariables(index); |
|
383 |
// else if (dxfName.equalsIgnoreCase("SORTENTSTABLE")) |
|
384 |
// return new DwgSortEntStable(index); |
|
385 |
// else if (dxfName.equalsIgnoreCase("SPATIALFILTER")) |
|
386 |
// return new DwgSpatialFilter(index); |
|
387 |
// else if (dxfName.equalsIgnoreCase("SPATIALINDEX")) |
|
388 |
// return new DwgSpatialIndex(index); |
|
389 |
// else if (dxfName.equalsIgnoreCase("XRECORD")) |
|
390 |
// return new DwgXRecord(index); |
|
391 |
return null; |
|
392 |
} |
|
393 |
|
|
394 |
/** |
|
395 |
* Creates a DWG object for DWG 12 files. |
|
396 |
* |
|
397 |
* */ |
|
398 |
public DwgObject create(byte kind, int index){ |
|
399 |
switch(kind){ |
|
400 |
case 1: |
|
401 |
return new DwgLine(index); |
|
402 |
case 2: |
|
403 |
return new DwgPoint(index); |
|
404 |
case 3: |
|
405 |
return new DwgCircle(index); |
|
406 |
// case 4://un dxf shape es un fichero externo que define una forma |
|
407 |
//(un tipo rudimentario de svg) |
|
408 |
// return new DwgShape() |
|
409 |
case 7: |
|
410 |
return new DwgText(index); |
|
411 |
case 8: |
|
412 |
return new DwgArc(index); |
|
413 |
// case 9: //It is a 3D quad |
|
414 |
// return new DwgTrace(index); |
|
415 |
|
|
416 |
case 11: |
|
417 |
return new DwgSolid(index); |
|
418 |
case 12: |
|
419 |
return new DwgBlockHeader(index); |
|
420 |
case 13: |
|
421 |
return new DwgEndblk(index); |
|
422 |
case 14: |
|
423 |
return new DwgInsert(index); |
|
424 |
case 15: |
|
425 |
return new DwgAttdef(index); |
|
426 |
case 16: |
|
427 |
return new DwgAttrib(index); |
|
428 |
case 17://no estoy seguro de q esto sea SbEnd |
|
429 |
return new DwgSeqend(index); |
|
430 |
case 19://polyline is a particular case. Creation responsability is of Reader |
|
431 |
return null; |
|
432 |
case 20://vertex like polyline |
|
433 |
return null; |
|
434 |
case 22: |
|
435 |
return new DwgFace3D(index); |
|
436 |
case 23: //esto es Dim ?? |
|
437 |
return new DwgDimOrd(index); |
|
438 |
// case 25://no implementado |
|
439 |
// return new DwgVPort(index); |
|
440 |
default: |
|
441 |
return null; |
|
442 |
} |
|
443 |
} |
|
444 |
} |
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwgBlock.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 12-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: IDwgBlock.java 28969 2009-05-25 13:23:12Z jmvivo $ |
|
47 |
* $Log$ |
|
48 |
* Revision 1.1.2.1 2007-03-21 19:49:16 azabala |
|
49 |
* implementation of dwg 12, 13, 14. |
|
50 |
* |
|
51 |
* Revision 1.1 2007/03/02 20:31:22 azabala |
|
52 |
* *** empty log message *** |
|
53 |
* |
|
54 |
* |
|
55 |
*/ |
|
56 |
package org.gvsig.dwg.lib; |
|
57 |
|
|
58 |
/** |
|
59 |
* A block is a composite entity in autocad |
|
60 |
* (it is a drawing entity, and it contains drawing entities) |
|
61 |
* |
|
62 |
* Currently we have found DwgBlock and DwgBlockHeaders as |
|
63 |
* start of a block. This interface is a common ancestor to both |
|
64 |
* |
|
65 |
* @author azabala |
|
66 |
*/ |
|
67 |
|
|
68 |
public interface IDwgBlock { |
|
69 |
public void add(DwgObject object); |
|
70 |
public DwgObject get(int i); |
|
71 |
} |
|
72 |
|
tags/org.gvsig.dwg-2.0.97/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/IDwg3DTestable.java | ||
---|---|---|
1 |
/* |
Also available in: Unified diff