Revision 135
tags/org.gvsig.dwg-2.0.38/org.gvsig.dwg.app/org.gvsig.dwg.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Tue Jan 19 22:37:40 CET 2016 |
|
2 |
buildNumber=2106 |
tags/org.gvsig.dwg-2.0.38/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.38/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.38/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.38/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.38/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.38/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.38</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 |
|
|
0 | 117 |
tags/org.gvsig.dwg-2.0.38/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.38</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.38/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgClass.java | ||
---|---|---|
1 |
/* jdwglib. Java Library for reading Dwg files. |
|
2 |
* |
|
3 |
* Author: Jose Morell Rama (jose.morell@gmail.com). |
|
4 |
* Port from the Pythoncad Dwg library by Art Haas. |
|
5 |
* |
|
6 |
* Copyright (C) 2005 Jose Morell, IVER TI S.A. 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 |
* Jose Morell (jose.morell@gmail.com) |
|
25 |
* |
|
26 |
* or |
|
27 |
* |
|
28 |
* IVER TI S.A. |
|
29 |
* C/Salamanca, 50 |
|
30 |
* 46005 Valencia |
|
31 |
* Spain |
|
32 |
* +34 963163400 |
|
33 |
* dac@iver.es |
|
34 |
*/ |
|
35 |
package org.gvsig.dwg.lib; |
|
36 |
|
|
37 |
/** |
|
38 |
* Entry in the CLASSES section of a dwg file. |
|
39 |
* @author azabala |
|
40 |
*/ |
|
41 |
public class DwgClass { |
|
42 |
|
|
43 |
int classNum; |
|
44 |
int version; |
|
45 |
String appName; |
|
46 |
String cPlusPlusName; |
|
47 |
String dxfName; |
|
48 |
boolean isZombie; |
|
49 |
int id; |
|
50 |
|
|
51 |
|
|
52 |
public DwgClass(int classNum, int version, String appName, |
|
53 |
String cPlusPlusName, String dxfName, boolean isZombie, int id){ |
|
54 |
|
|
55 |
this.classNum = classNum; |
|
56 |
this.version = version; |
|
57 |
this.appName = appName; |
|
58 |
this.cPlusPlusName = cPlusPlusName; |
|
59 |
this.dxfName = dxfName; |
|
60 |
this.isZombie = isZombie; |
|
61 |
this.id = id; |
|
62 |
} |
|
63 |
|
|
64 |
public String toString(){ |
|
65 |
String solution = ""; |
|
66 |
solution += "classNum ="+classNum; |
|
67 |
solution += ", version = "+version; |
|
68 |
solution += ", appName = "+appName; |
|
69 |
solution += ", c++Name = "+cPlusPlusName; |
|
70 |
solution += ", dxfName = "+dxfName; |
|
71 |
solution += ", isZombie = " + isZombie; |
|
72 |
solution += ", id = " + id; |
|
73 |
return solution; |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
/** |
|
80 |
* @return Returns the appName. |
|
81 |
*/ |
|
82 |
public String getAppName() { |
|
83 |
return appName; |
|
84 |
} |
|
85 |
/** |
|
86 |
* @param appName The appName to set. |
|
87 |
*/ |
|
88 |
public void setAppName(String appName) { |
|
89 |
this.appName = appName; |
|
90 |
} |
|
91 |
/** |
|
92 |
* @return Returns the classNum. |
|
93 |
*/ |
|
94 |
public int getClassNum() { |
|
95 |
return classNum; |
|
96 |
} |
|
97 |
/** |
|
98 |
* @param classNum The classNum to set. |
|
99 |
*/ |
|
100 |
public void setClassNum(int classNum) { |
|
101 |
this.classNum = classNum; |
|
102 |
} |
|
103 |
/** |
|
104 |
* @return Returns the cPlusPlusName. |
|
105 |
*/ |
|
106 |
public String getCPlusPlusName() { |
|
107 |
return cPlusPlusName; |
|
108 |
} |
|
109 |
/** |
|
110 |
* @param plusPlusName The cPlusPlusName to set. |
|
111 |
*/ |
|
112 |
public void setCPlusPlusName(String plusPlusName) { |
|
113 |
cPlusPlusName = plusPlusName; |
|
114 |
} |
|
115 |
/** |
|
116 |
* @return Returns the dxfName. |
|
117 |
*/ |
|
118 |
public String getDxfName() { |
|
119 |
return dxfName; |
|
120 |
} |
|
121 |
/** |
|
122 |
* @param dxfName The dxfName to set. |
|
123 |
*/ |
|
124 |
public void setDxfName(String dxfName) { |
|
125 |
this.dxfName = dxfName; |
|
126 |
} |
|
127 |
/** |
|
128 |
* @return Returns the id. |
|
129 |
*/ |
|
130 |
public int getId() { |
|
131 |
return id; |
|
132 |
} |
|
133 |
/** |
|
134 |
* @param id The id to set. |
|
135 |
*/ |
|
136 |
public void setId(int id) { |
|
137 |
this.id = id; |
|
138 |
} |
|
139 |
/** |
|
140 |
* @return Returns the isZombie. |
|
141 |
*/ |
|
142 |
public boolean isZombie() { |
|
143 |
return isZombie; |
|
144 |
} |
|
145 |
/** |
|
146 |
* @param isZombie The isZombie to set. |
|
147 |
*/ |
|
148 |
public void setZombie(boolean isZombie) { |
|
149 |
this.isZombie = isZombie; |
|
150 |
} |
|
151 |
/** |
|
152 |
* @return Returns the version. |
|
153 |
*/ |
|
154 |
public int getVersion() { |
|
155 |
return version; |
|
156 |
} |
|
157 |
/** |
|
158 |
* @param version The version to set. |
|
159 |
*/ |
|
160 |
public void setVersion(int version) { |
|
161 |
this.version = version; |
|
162 |
} |
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
} |
tags/org.gvsig.dwg-2.0.38/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/DwgObject.java | ||
---|---|---|
1 |
/* jdwglib. Java Library for reading Dwg files. |
|
2 |
* |
|
3 |
* Author: Jose Morell Rama (jose.morell@gmail.com). |
|
4 |
* Port from the Pythoncad Dwg library by Art Haas. |
|
5 |
* |
|
6 |
* Copyright (C) 2005 Jose Morell, IVER TI S.A. 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 |
* Jose Morell (jose.morell@gmail.com) |
|
25 |
* |
|
26 |
* or |
|
27 |
* |
|
28 |
* IVER TI S.A. |
|
29 |
* C/Salamanca, 50 |
|
30 |
* 46005 Valencia |
|
31 |
* Spain |
|
32 |
* +34 963163400 |
|
33 |
* dac@iver.es |
|
34 |
*/ |
|
35 |
package org.gvsig.dwg.lib; |
|
36 |
|
|
37 |
import java.util.ArrayList; |
|
38 |
import java.util.List; |
|
39 |
|
|
40 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
41 |
import org.gvsig.fmap.geom.Geometry; |
|
42 |
|
|
43 |
/** |
|
44 |
* The DwgObject class represents a DWG object |
|
45 |
* |
|
46 |
* @author jmorell |
|
47 |
*/ |
|
48 |
public class DwgObject implements Cloneable{ |
|
49 |
protected int type; |
|
50 |
|
|
51 |
protected DwgHandleReference handle; |
|
52 |
|
|
53 |
protected String version; |
|
54 |
|
|
55 |
protected int mode; |
|
56 |
|
|
57 |
/** |
|
58 |
* code of the layer handle |
|
59 |
*/ |
|
60 |
//protected int layerHandleCode; |
|
61 |
|
|
62 |
/** |
|
63 |
* layer handle as an integer |
|
64 |
*/ |
|
65 |
protected DwgHandleReference layerHandle; |
|
66 |
|
|
67 |
protected int color; |
|
68 |
|
|
69 |
protected int numReactors; |
|
70 |
|
|
71 |
protected boolean noLinks; |
|
72 |
|
|
73 |
protected int linetypeFlags; |
|
74 |
|
|
75 |
protected int plotstyleFlags; |
|
76 |
|
|
77 |
protected int sizeInBits; |
|
78 |
|
|
79 |
protected List extendedData; |
|
80 |
|
|
81 |
protected int graphicData; |
|
82 |
|
|
83 |
protected int address; |
|
84 |
|
|
85 |
protected DwgHandleReference plotStyleHandle = null; |
|
86 |
|
|
87 |
protected DwgHandleReference subEntityHandle = null; |
|
88 |
|
|
89 |
protected DwgHandleReference xDicObjHandle = null; |
|
90 |
|
|
91 |
protected boolean graphicsFlag; |
|
92 |
protected boolean xDicObjFlag; |
|
93 |
protected boolean avanzarFlag=false; |
|
94 |
|
|
95 |
/** |
|
96 |
* Index of the dwg object in the object's map section |
|
97 |
* |
|
98 |
*/ |
|
99 |
protected int index = 0; |
|
100 |
|
|
101 |
/* |
|
102 |
* Previous and Next Handle (this stuff has allowed us to solve the problem |
|
103 |
* of layer handles |
|
104 |
*/ |
|
105 |
private DwgHandleReference nextHandle = null; |
|
106 |
|
|
107 |
private DwgHandleReference previousHandle = null; |
|
108 |
|
|
109 |
//private ArrayList reactorsHandlesCodes = new ArrayList(); |
|
110 |
|
|
111 |
private ArrayList reactorsHandles = new ArrayList(); |
|
112 |
|
|
113 |
private boolean insertar = false; |
|
114 |
|
|
115 |
|
|
116 |
public DwgObject(int index) { |
|
117 |
this.index = index; |
|
118 |
} |
|
119 |
|
|
120 |
public void inserta(){ |
|
121 |
this.insertar=true; |
|
122 |
} |
|
123 |
|
|
124 |
public boolean insertar(){ |
|
125 |
return this.insertar; |
|
126 |
} |
|
127 |
|
|
128 |
public void setAddress(int address){ |
|
129 |
this.address=address; |
|
130 |
} |
|
131 |
|
|
132 |
public int getAddress(){ |
|
133 |
return this.address; |
|
134 |
} |
|
135 |
|
|
136 |
public void setNextHandle(DwgHandleReference hr) { |
|
137 |
this.nextHandle = hr; |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
public void setPreviousHandle(DwgHandleReference hr) { |
|
142 |
this.previousHandle = hr; |
|
143 |
} |
|
144 |
|
|
145 |
/* |
|
146 |
public void setReactorsHandles(ArrayList reactorsHandles) { |
|
147 |
this.reactorsHandlesCodes=reactorsHandles; |
|
148 |
} |
|
149 |
*/ |
|
150 |
|
|
151 |
|
|
152 |
public void setAvanzar(boolean avanza){ |
|
153 |
this.avanzarFlag=avanza; |
|
154 |
} |
|
155 |
public boolean getAvanzar(){ |
|
156 |
return this.avanzarFlag; |
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
public void addReactorHandle(DwgHandleReference hr) { |
|
164 |
if (this.reactorsHandles == null){ |
|
165 |
this.reactorsHandles = new ArrayList(); |
|
166 |
} |
|
167 |
this.reactorsHandles.add(hr); |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
public DwgHandleReference getNextHandle() { |
|
172 |
return this.nextHandle; |
|
173 |
|
|
174 |
} |
|
175 |
|
|
176 |
public DwgHandleReference getPreviousHandle() { |
|
177 |
return this.previousHandle; |
|
178 |
} |
|
179 |
|
|
180 |
public ArrayList getReactorsHandles() { |
|
181 |
return this.reactorsHandles; |
|
182 |
} |
|
183 |
|
|
184 |
//TODO Todo esto no vale si handle puede tomar valor -1 |
|
185 |
public boolean hasLayerHandle() { |
|
186 |
return this.layerHandle != null; |
|
187 |
} |
|
188 |
public boolean hasNextHandle() { |
|
189 |
return this.nextHandle != null; |
|
190 |
} |
|
191 |
|
|
192 |
public boolean hasPreviousHandle() { |
|
193 |
return this.previousHandle != null; |
|
194 |
} |
|
195 |
|
|
196 |
public boolean hasSubEntityHandle(){ |
|
197 |
return this.subEntityHandle != null; |
|
198 |
} |
|
199 |
|
|
200 |
public boolean hasXDicObjHandle(){ |
|
201 |
return this.xDicObjHandle != null; |
|
202 |
} |
|
203 |
|
|
204 |
public boolean hasReactorsHandles(){ |
|
205 |
return this.reactorsHandles.size() != 0; |
|
206 |
} |
|
207 |
|
|
208 |
public int reactorsHandlesQuantity(){ |
|
209 |
return this.reactorsHandles.size(); |
|
210 |
} |
|
211 |
|
|
212 |
public int getIndex() { |
|
213 |
return index; |
|
214 |
} |
|
215 |
|
|
216 |
/** |
|
217 |
* @return Returns the sizeInBits. |
|
218 |
*/ |
|
219 |
public int getSizeInBits() { |
|
220 |
return sizeInBits; |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* @param sizeInBits |
|
225 |
* The sizeInBits to set. |
|
226 |
*/ |
|
227 |
public void setSizeInBits(int sizeInBits) { |
|
228 |
this.sizeInBits = sizeInBits; |
|
229 |
} |
|
230 |
|
|
231 |
/** |
|
232 |
* @return Returns the extendedData. |
|
233 |
*/ |
|
234 |
public List getExtendedData() { |
|
235 |
return extendedData; |
|
236 |
} |
|
237 |
|
|
238 |
/** |
|
239 |
* @param extData |
|
240 |
* The extendedData to set. |
|
241 |
*/ |
|
242 |
public void setExtendedData(List extData) { |
|
243 |
this.extendedData = extData; |
|
244 |
} |
|
245 |
|
|
246 |
/** |
|
247 |
* @return Returns the graphicData. |
|
248 |
*/ |
|
249 |
public int getGraphicData() { |
|
250 |
return graphicData; |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* @param graphicData |
|
255 |
* The graphicData to set. |
|
256 |
*/ |
|
257 |
public void setGraphicData(int graphicData) { |
|
258 |
this.graphicData = graphicData; |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* @return Returns the version. |
|
263 |
*/ |
|
264 |
public String getVersion() { |
|
265 |
return version; |
|
266 |
} |
|
267 |
|
|
268 |
/** |
|
269 |
* @param linetypeFlags |
|
270 |
* The linetypeFlags to set. |
|
271 |
*/ |
|
272 |
public void setLinetypeFlags(int linetypeFlags) { |
|
273 |
this.linetypeFlags = linetypeFlags; |
|
274 |
} |
|
275 |
|
|
276 |
/** |
|
277 |
* @param plotstyleFlags |
|
278 |
* The plotstyleFlags to set. |
|
279 |
*/ |
|
280 |
public void setPlotstyleFlags(int plotstyleFlags) { |
|
281 |
this.plotstyleFlags = plotstyleFlags; |
|
282 |
} |
|
283 |
|
|
284 |
/** |
|
285 |
* @return Returns the subEntityHandle. |
|
286 |
*/ |
|
287 |
public DwgHandleReference getSubEntityHandle() { |
|
288 |
return subEntityHandle; |
|
289 |
} |
|
290 |
|
|
291 |
/** |
|
292 |
* @param subEntityHandle |
|
293 |
* The subEntityHandle to set. |
|
294 |
*/ |
|
295 |
public void setSubEntityHandle(DwgHandleReference subEntityHandle) { |
|
296 |
this.subEntityHandle = subEntityHandle; |
|
297 |
} |
|
298 |
|
|
299 |
/** |
|
300 |
* @return Returns the xDicObjHandle. |
|
301 |
*/ |
|
302 |
public DwgHandleReference getXDicObjHandle() { |
|
303 |
return xDicObjHandle; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* @param dicObjHandle |
|
308 |
* The xDicObjHandle to set. |
|
309 |
*/ |
|
310 |
public void setXDicObjHandle(DwgHandleReference dicObjHandle) { |
|
311 |
xDicObjHandle = dicObjHandle; |
|
312 |
} |
|
313 |
|
|
314 |
/** |
|
315 |
* @return Returns the color. |
|
316 |
*/ |
|
317 |
public int getColor() { |
|
318 |
return color; |
|
319 |
} |
|
320 |
|
|
321 |
/** |
|
322 |
* @param color |
|
323 |
* The color to set. |
|
324 |
*/ |
|
325 |
public void setColor(int color) { |
|
326 |
this.color = color; |
|
327 |
} |
|
328 |
|
|
329 |
/** |
|
330 |
* @return Returns the handle. |
|
331 |
*/ |
|
332 |
public DwgHandleReference getHandle() { |
|
333 |
return handle; |
|
334 |
} |
|
335 |
|
|
336 |
/** |
|
337 |
* @param handle |
|
338 |
* The handle to set. |
|
339 |
*/ |
|
340 |
public void setHandle(DwgHandleReference handle) { |
|
341 |
this.handle = handle; |
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* @return Returns the layerHandle. |
|
346 |
*/ |
|
347 |
public DwgHandleReference getLayerHandle() { |
|
348 |
return layerHandle; |
|
349 |
} |
|
350 |
|
|
351 |
/** |
|
352 |
* @param layerHandle |
|
353 |
* The layerHandle to set. |
|
354 |
*/ |
|
355 |
public void setLayerHandle(DwgHandleReference layerHandle) { |
|
356 |
this.layerHandle = layerHandle; |
|
357 |
} |
|
358 |
|
|
359 |
/** |
|
360 |
* @return Returns the mode. |
|
361 |
*/ |
|
362 |
public int getMode() { |
|
363 |
return mode; |
|
364 |
} |
|
365 |
|
|
366 |
/** |
|
367 |
* @param mode |
|
368 |
* The mode to set. |
|
369 |
*/ |
|
370 |
public void setMode(int mode) { |
|
371 |
this.mode = mode; |
|
372 |
} |
|
373 |
|
|
374 |
/** |
|
375 |
* @return Returns the noLinks. |
|
376 |
*/ |
|
377 |
public boolean isNoLinks() { |
|
378 |
return noLinks; |
|
379 |
} |
|
380 |
|
|
381 |
/** |
|
382 |
* @param noLinks |
|
383 |
* The noLinks to set. |
|
384 |
*/ |
|
385 |
public void setNoLinks(boolean noLinks) { |
|
386 |
this.noLinks = noLinks; |
|
387 |
} |
|
388 |
|
|
389 |
/** |
|
390 |
* @return Returns the numReactors. |
|
391 |
*/ |
|
392 |
public int getNumReactors() { |
|
393 |
return numReactors; |
|
394 |
} |
|
395 |
|
|
396 |
/** |
|
397 |
* @param numReactors |
|
398 |
* The numReactors to set. |
|
399 |
*/ |
|
400 |
public void setNumReactors(int numReactors) { |
|
401 |
this.numReactors = numReactors; |
|
402 |
} |
|
403 |
|
|
404 |
/** |
|
405 |
* @return Returns the type. |
|
406 |
*/ |
|
407 |
public int getType() { |
|
408 |
return type; |
|
409 |
} |
|
410 |
|
|
411 |
/** |
|
412 |
* @param type |
|
413 |
* The type to set. |
|
414 |
*/ |
|
415 |
public void setType(int type) { |
|
416 |
this.type = type; |
|
417 |
} |
|
418 |
|
|
419 |
/** |
|
420 |
* @return Returns the linetypeFlags. |
|
421 |
*/ |
|
422 |
public int getLinetypeFlags() { |
|
423 |
return linetypeFlags; |
|
424 |
} |
|
425 |
|
|
426 |
/** |
|
427 |
* @return Returns the plotstyleFlags. |
|
428 |
*/ |
|
429 |
public int getPlotstyleFlags() { |
|
430 |
return plotstyleFlags; |
|
431 |
} |
|
432 |
|
|
433 |
/** |
|
434 |
* @param version |
|
435 |
* The version to set. |
|
436 |
*/ |
|
437 |
public void setVersion(String version) { |
|
438 |
this.version = version; |
|
439 |
} |
|
440 |
|
|
441 |
/** |
|
442 |
* @return Returns the graphicsFlag. |
|
443 |
*/ |
|
444 |
public boolean isGraphicsFlag() { |
|
445 |
return graphicsFlag; |
|
446 |
} |
|
447 |
|
|
448 |
/** |
|
449 |
* @param graphicsFlag |
|
450 |
* The graphicsFlag to set. |
|
451 |
*/ |
|
452 |
public void setGraphicsFlag(boolean graphicsFlag) { |
|
453 |
this.graphicsFlag = graphicsFlag; |
|
454 |
} |
|
455 |
|
|
456 |
|
|
457 |
/** |
|
458 |
* @return Returns the xDicObjFlag. |
|
459 |
*/ |
|
460 |
public boolean isXDicObjFlag() { |
|
461 |
return xDicObjFlag; |
|
462 |
} |
|
463 |
|
|
464 |
/** |
|
465 |
* @param xDicObjFlag |
|
466 |
* The xDicObjFlag to set. |
|
467 |
*/ |
|
468 |
public void setXDicObjFlag(boolean xDicObjFlag) { |
|
469 |
this.xDicObjFlag = xDicObjFlag; |
|
470 |
} |
|
471 |
|
|
472 |
/* |
|
473 |
* This property exists in 13-14 versions, but not in 2000 version |
|
474 |
*/ |
|
475 |
private boolean lyrByLineType = false; |
|
476 |
|
|
477 |
public void setLyrByLineType(boolean lyrByLineType) { |
|
478 |
this.lyrByLineType = lyrByLineType; |
|
479 |
} |
|
480 |
|
|
481 |
public boolean isLyrByLineType() { |
|
482 |
return lyrByLineType; |
|
483 |
} |
|
484 |
|
|
485 |
public void setPlotStyleHandle(DwgHandleReference hr) { |
|
486 |
this.plotStyleHandle = hr; |
|
487 |
|
|
488 |
} |
|
489 |
|
|
490 |
public boolean hasPlotStyleHandle() { |
|
491 |
return this.plotStyleHandle != null; |
|
492 |
} |
|
493 |
|
|
494 |
/* |
|
495 |
* Esto solo se usa para la version 13-14 |
|
496 |
*/ |
|
497 |
private DwgHandleReference lineTypeHandle = null; |
|
498 |
|
|
499 |
/** |
|
500 |
* Sets the handle of the line type of this drawing entity. |
|
501 |
* |
|
502 |
* TODO Ver si conviene guardar tambien el handleCode de este handle |
|
503 |
* |
|
504 |
* @param handle2 |
|
505 |
*/ |
|
506 |
public void setLineTypeHandle(DwgHandleReference hr) { |
|
507 |
this.lineTypeHandle = hr; |
|
508 |
|
|
509 |
} |
|
510 |
|
|
511 |
public DwgHandleReference getLineTypeHandle() { |
|
512 |
return this.lineTypeHandle; |
|
513 |
} |
|
514 |
|
|
515 |
public boolean hasLineTypeHandle() { |
|
516 |
return this.lineTypeHandle != null; |
|
517 |
} |
|
518 |
|
|
519 |
|
|
520 |
public Object clone(){ |
|
521 |
DwgObject obj = new DwgObject(this.index); |
|
522 |
this.fill(obj); |
|
523 |
return obj; |
|
524 |
} |
|
525 |
|
|
526 |
protected void fill(DwgObject obj){ |
|
527 |
|
|
528 |
obj.setColor(color); |
|
529 |
obj.setExtendedData(extendedData); |
|
530 |
obj.setGraphicData(graphicData); |
|
531 |
obj.setGraphicsFlag(graphicsFlag); |
|
532 |
obj.setHandle(handle); |
|
533 |
obj.setLayerHandle(layerHandle); |
|
534 |
obj.setLinetypeFlags(linetypeFlags); |
|
535 |
obj.setLineTypeHandle(lineTypeHandle); |
|
536 |
obj.setLyrByLineType(lyrByLineType); |
|
537 |
obj.setMode(mode); |
|
538 |
obj.setNextHandle(nextHandle); |
|
539 |
obj.setNoLinks(noLinks); |
|
540 |
obj.setNumReactors(numReactors); |
|
541 |
obj.setPlotstyleFlags(plotstyleFlags); |
|
542 |
obj.setPlotStyleHandle(plotStyleHandle); |
|
543 |
obj.setPreviousHandle(previousHandle); |
|
544 |
obj.setSizeInBits(sizeInBits); |
|
545 |
obj.setSubEntityHandle(subEntityHandle); |
|
546 |
obj.setType(type); |
|
547 |
obj.setVersion(version); |
|
548 |
obj.setXDicObjHandle(xDicObjHandle); |
|
549 |
} |
|
550 |
|
|
551 |
public int getGeometrySubType(boolean is3DFile) { |
|
552 |
if (is3DFile) { |
|
553 |
return Geometry.SUBTYPES.GEOM3D; |
|
554 |
} else { |
|
555 |
return Geometry.SUBTYPES.GEOM2D; |
|
556 |
} |
|
557 |
} |
|
558 |
} |
tags/org.gvsig.dwg-2.0.38/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgEllipse.java | ||
---|---|---|
1 |
/* jdwglib. Java Library for reading Dwg files. |
|
2 |
* |
|
3 |
* Author: Jose Morell Rama (jose.morell@gmail.com). |
|
4 |
* Port from the Pythoncad Dwg library by Art Haas. |
|
5 |
* |
|
6 |
* Copyright (C) 2005 Jose Morell, IVER TI S.A. 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 |
* Jose Morell (jose.morell@gmail.com) |
|
25 |
* |
|
26 |
* or |
|
27 |
* |
|
28 |
* IVER TI S.A. |
|
29 |
* C/Salamanca, 50 |
|
30 |
* 46005 Valencia |
|
31 |
* Spain |
|
32 |
* +34 963163400 |
|
33 |
* dac@iver.es |
|
34 |
*/ |
|
35 |
package org.gvsig.dwg.lib.objects; |
|
36 |
|
|
37 |
import java.awt.geom.Point2D; |
|
38 |
import java.util.List; |
|
39 |
import java.util.Map; |
|
40 |
|
|
41 |
import org.gvsig.dwg.lib.DwgFile; |
|
42 |
import org.gvsig.dwg.lib.DwgObject; |
|
43 |
import org.gvsig.dwg.lib.IDwg2FMap; |
|
44 |
import org.gvsig.dwg.lib.IDwg3DTestable; |
|
45 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
|
46 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
47 |
import org.gvsig.fmap.geom.Geometry; |
|
48 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
49 |
import org.gvsig.fmap.geom.GeometryManager; |
|
50 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
51 |
import org.gvsig.fmap.geom.primitive.EllipticArc; |
|
52 |
import org.gvsig.fmap.geom.primitive.Point; |
|
53 |
|
|
54 |
|
|
55 |
/** |
|
56 |
* The DwgEllipse class represents a DWG Ellipse |
|
57 |
* |
|
58 |
* @author jmorell |
|
59 |
*/ |
|
60 |
public class DwgEllipse extends DwgObject |
|
61 |
implements IDwg3DTestable, IDwg2FMap, IDwgBlockMember{ |
|
62 |
public DwgEllipse(int index) { |
|
63 |
super(index); |
|
64 |
// TODO Auto-generated constructor stub |
|
65 |
} |
|
66 |
private double[] center; |
|
67 |
private double[] semiMajorAxisVector; |
|
68 |
private double[] extrusion; |
|
69 |
private double axisRatio; |
|
70 |
private double initAngle; |
|
71 |
private double endAngle; |
|
72 |
|
|
73 |
/** |
|
74 |
* @return Returns the axisRatio. |
|
75 |
*/ |
|
76 |
public double getAxisRatio() { |
|
77 |
return axisRatio; |
|
78 |
} |
|
79 |
/** |
|
80 |
* @param axisRatio The axisRatio to set. |
|
81 |
*/ |
|
82 |
public void setAxisRatio(double axisRatio) { |
|
83 |
this.axisRatio = axisRatio; |
|
84 |
} |
|
85 |
/** |
|
86 |
* @return Returns the center. |
|
87 |
*/ |
|
88 |
public double[] getCenter() { |
|
89 |
return center; |
|
90 |
} |
|
91 |
/** |
|
92 |
* @param center The center to set. |
|
93 |
*/ |
|
94 |
public void setCenter(double[] center) { |
|
95 |
this.center = center; |
|
96 |
} |
|
97 |
/** |
|
98 |
* @return Returns the endAngle. |
|
99 |
*/ |
|
100 |
public double getEndAngle() { |
|
101 |
return endAngle; |
|
102 |
} |
|
103 |
/** |
|
104 |
* @param endAngle The endAngle to set. |
|
105 |
*/ |
|
106 |
public void setEndAngle(double endAngle) { |
|
107 |
this.endAngle = endAngle; |
|
108 |
} |
|
109 |
/** |
|
110 |
* @return Returns the initAngle. |
|
111 |
*/ |
|
112 |
public double getInitAngle() { |
|
113 |
return initAngle; |
|
114 |
} |
|
115 |
/** |
|
116 |
* @param initAngle The initAngle to set. |
|
117 |
*/ |
|
118 |
public void setInitAngle(double initAngle) { |
|
119 |
this.initAngle = initAngle; |
|
120 |
} |
|
121 |
/** |
|
122 |
* @return Returns the majorAxisVector. |
|
123 |
*/ |
|
124 |
public double[] getSemiMajorAxisVector() { |
|
125 |
return semiMajorAxisVector; |
|
126 |
} |
|
127 |
/** |
|
128 |
* @param semiMajorAxisVector The majorAxisVector to set. |
|
129 |
*/ |
|
130 |
public void setSemiMajorAxisVector(double[] semiMajorAxisVector) { |
|
131 |
this.semiMajorAxisVector = semiMajorAxisVector; |
|
132 |
} |
|
133 |
/** |
|
134 |
* @return Returns the extrusion. |
|
135 |
*/ |
|
136 |
public double[] getExtrusion() { |
|
137 |
return extrusion; |
|
138 |
} |
|
139 |
/** |
|
140 |
* @param extrusion The extrusion to set. |
|
141 |
*/ |
|
142 |
public void setExtrusion(double[] extrusion) { |
|
143 |
this.extrusion = extrusion; |
|
144 |
} |
|
145 |
/* (non-Javadoc) |
|
146 |
* @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#has3DData() |
|
147 |
*/ |
|
148 |
public boolean has3DData() { |
|
149 |
return (getCenter()[2] !=0.0); |
|
150 |
} |
|
151 |
/* (non-Javadoc) |
|
152 |
* @see com.iver.cit.jdwglib.dwg.IDwg3DTestable#getZ() |
|
153 |
*/ |
|
154 |
public double getZ() { |
|
155 |
return getCenter()[2]; |
|
156 |
} |
|
157 |
/* (non-Javadoc) |
|
158 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
|
159 |
*/ |
|
160 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
161 |
|
|
162 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
163 |
double[] c = getCenter(); |
|
164 |
double[] semiMajorAxisVector = getSemiMajorAxisVector(); |
|
165 |
double axisRatio = getAxisRatio(); |
|
166 |
double angSt = getInitAngle(); |
|
167 |
double angEnd = getEndAngle(); |
|
168 |
double angExt = FMapUtil.angleDistance(angSt, angEnd); |
|
169 |
|
|
170 |
|
|
171 |
//Point2D axis1Start = new Point2D.Double(center.getX()+smav.getX(), center.getY()+smav.getY()); |
|
172 |
Point axis1Start = (Point)gMan.create(Geometry.TYPES.POINT, |
|
173 |
getGeometrySubType(is3DFile)); |
|
174 |
double[] tmp; |
|
175 |
tmp = new double[c.length]; |
|
176 |
for (int i=0;i< c.length;i++){ |
|
177 |
tmp[i]=c[i]+semiMajorAxisVector[i]; |
|
178 |
} |
|
179 |
axis1Start.setCoordinates(tmp); |
|
180 |
|
|
181 |
//Point2D axis1End = new Point2D.Double(center.getX()-smav.getX(), center.getY()-smav.getY()); |
|
182 |
Point axis1End = (Point)gMan.create(Geometry.TYPES.POINT, |
|
183 |
getGeometrySubType(is3DFile)); |
|
184 |
|
|
185 |
tmp = new double[c.length]; |
|
186 |
for (int i=0;i< c.length;i++){ |
|
187 |
tmp[i]=c[i]-semiMajorAxisVector[i]; |
|
188 |
} |
|
189 |
axis1End.setCoordinates(tmp); |
|
190 |
|
|
191 |
|
|
192 |
Point2D smav = new Point2D.Double(semiMajorAxisVector[0],semiMajorAxisVector[1]); |
|
193 |
Point2D origen = new Point2D.Double(0.0,0.0); |
|
194 |
double semiMajorAxisLenght = origen.distance(smav); |
|
195 |
double semiMinorAxisLenght = semiMajorAxisLenght * axisRatio; |
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
EllipticArc ellipse = (EllipticArc) gMan.create(getGeometryType(), |
|
200 |
getGeometrySubType(is3DFile)); |
|
201 |
ellipse.setPoints(axis1Start, axis1End, semiMinorAxisLenght, -angSt, |
|
202 |
-angExt); |
|
203 |
|
|
204 |
return ellipse; |
|
205 |
} |
|
206 |
|
|
207 |
/* (non-Javadoc) |
|
208 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
|
209 |
*/ |
|
210 |
public String toFMapString(boolean is3DFile) { |
|
211 |
if(is3DFile) { |
|
212 |
return "EllipticArc2DZ"; |
|
213 |
} else { |
|
214 |
return "EllipticArc2D"; |
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
public String toString(){ |
|
219 |
return "Ellipse"; |
|
220 |
} |
|
221 |
public void transform2Block(double[] bPoint, Point2D insPoint, |
|
222 |
double[] scale, double rot, |
|
223 |
List dwgObjectsWithoutBlocks, |
|
224 |
Map handleObjWithoutBlocks, |
|
225 |
DwgFile callBack) { |
|
226 |
DwgEllipse transformedEntity = null; |
|
227 |
double[] center = this.getCenter(); |
|
228 |
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]); |
|
229 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
|
230 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
|
231 |
double laZ = center[2] * scale[2]; |
|
232 |
double[] transformedCenter = new double[]{laX, laY, laZ}; |
|
233 |
double[] majorAxisVector = this.getSemiMajorAxisVector(); |
|
234 |
double[] transformedMajorAxisVector = new double[]{majorAxisVector[0] * scale[0], majorAxisVector[1] * scale[1], majorAxisVector[2] * scale[2]}; |
|
235 |
//TODO: Rotar un �ngulo rot el vector majorAxisVector fijado en |
|
236 |
// center. |
|
237 |
double axisRatio = this.getAxisRatio(); |
|
238 |
double transformedAxisRatio = axisRatio; |
|
239 |
double initAngle = this.getInitAngle(); |
|
240 |
double endAngle = this.getEndAngle(); |
|
241 |
double transformedInitAngle = initAngle + rot; |
|
242 |
if (transformedInitAngle<0) { |
|
243 |
transformedInitAngle = transformedInitAngle + (2*Math.PI); |
|
244 |
} else if (transformedInitAngle>(2*Math.PI)) { |
|
245 |
transformedInitAngle = transformedInitAngle - (2*Math.PI); |
|
246 |
} |
|
247 |
double transformedEndAngle = endAngle + rot; |
|
248 |
if (transformedEndAngle<0) { |
|
249 |
transformedEndAngle = transformedEndAngle + (2*Math.PI); |
|
250 |
} else if (transformedEndAngle>(2*Math.PI)) { |
|
251 |
transformedEndAngle = transformedEndAngle - (2*Math.PI); |
|
252 |
} |
|
253 |
transformedEntity = (DwgEllipse)this.clone(); |
|
254 |
transformedEntity.setCenter(transformedCenter); |
|
255 |
transformedEntity.setSemiMajorAxisVector(transformedMajorAxisVector); |
|
256 |
transformedEntity.setAxisRatio(transformedAxisRatio); |
|
257 |
transformedEntity.setInitAngle(transformedInitAngle); |
|
258 |
transformedEntity.setEndAngle(transformedEndAngle); |
|
259 |
dwgObjectsWithoutBlocks.add(transformedEntity); |
|
260 |
handleObjWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity); |
|
261 |
// dwgObjectsWithoutBlocks.add(this); |
|
262 |
} |
|
263 |
/* (non-Javadoc) |
|
264 |
* @see java.lang.Object#clone() |
|
265 |
*/ |
|
266 |
public Object clone(){ |
|
267 |
DwgEllipse obj = new DwgEllipse(index); |
|
268 |
this.fill(obj); |
|
269 |
return obj; |
|
270 |
} |
|
271 |
|
|
272 |
protected void fill(DwgObject obj){ |
|
273 |
super.fill(obj); |
|
274 |
DwgEllipse myObj = (DwgEllipse)obj; |
|
275 |
|
|
276 |
myObj.setAxisRatio(axisRatio); |
|
277 |
myObj.setCenter(center); |
|
278 |
myObj.setEndAngle(endAngle); |
|
279 |
myObj.setExtrusion(extrusion); |
|
280 |
myObj.setInitAngle(initAngle); |
|
281 |
myObj.setSemiMajorAxisVector(semiMajorAxisVector); |
|
282 |
|
|
283 |
} |
|
284 |
|
|
285 |
public int getGeometryType() { |
|
286 |
return Geometry.TYPES.ELLIPTICARC; |
|
287 |
} |
|
288 |
} |
tags/org.gvsig.dwg-2.0.38/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgBlockHeader.java | ||
---|---|---|
1 |
/* jdwglib. Java Library for reading Dwg files. |
|
2 |
* |
|
3 |
* Author: Jose Morell Rama (jose.morell@gmail.com). |
|
4 |
* Port from the Pythoncad Dwg library by Art Haas. |
|
5 |
* |
|
6 |
* Copyright (C) 2005 Jose Morell, IVER TI S.A. 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. |
Also available in: Unified diff