Revision 29001
branches/v2_0_0_prep/libraries/libDwg/build.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<!-- ====================================================================== |
|
3 |
09/01/2008 13:02:25 |
|
4 |
|
|
5 |
libDwg |
|
6 |
Build library libDwg |
|
7 |
|
|
8 |
jmvivo |
|
9 |
====================================================================== --> |
|
10 |
<project name="libDwg" default="batch-build"> |
|
11 |
<description> |
|
12 |
Build del libDataStore |
|
13 |
</description> |
|
14 |
<dirname file="${ant.file.libDwg}" property="proyectDir"/> |
|
15 |
<import file="${proyectDir}/../binaries/ant/utilities.xml"/> |
|
16 |
|
|
17 |
<property name="src" location="${proyectDir}/src"/> |
|
18 |
<property name="src-test" location="${proyectDir}/src-test"/> |
|
19 |
<property name="build" location="${proyectDir}/bin"/> |
|
20 |
<property name="build-test" location="${proyectDir}/bin-test"/> |
|
21 |
<property name="dist" location="${proyectDir}/dist"/> |
|
22 |
<property name="lib" location="${proyectDir}/lib"/> |
|
23 |
<property name="jarName" value="jdwglib.jar"/> |
|
24 |
|
|
25 |
|
|
26 |
<!-- ================================= |
|
27 |
target: generate-source |
|
28 |
================================= --> |
|
29 |
<target name="generate-source" description="--> genera el tar de fuentes"> |
|
30 |
<!-- TODO --> |
|
31 |
<echo level="warning">TODO!!!!</echo> |
|
32 |
</target> |
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
<!-- ================================= |
|
37 |
target: compile |
|
38 |
================================= --> |
|
39 |
<target name="compile" depends="update-referenced-libraries" description="--> Compile sources"> |
|
40 |
<mkdir dir="${build}"/> |
|
41 |
<mkdir dir="${build-test}"/> |
|
42 |
<!-- Compile the Java code from ${src} to ${build} --> |
|
43 |
<loadEclipseClasspath project="${basedir}"/> |
|
44 |
<gvSIG-javac |
|
45 |
classpath="${eclipseClasspath}"/> |
|
46 |
<gvSIG-javac |
|
47 |
classpath="${eclipseClasspath}" |
|
48 |
srcdir="${src-test}" |
|
49 |
destdir="${build-test}"/> |
|
50 |
|
|
51 |
</target> |
|
52 |
|
|
53 |
<!-- ================================= |
|
54 |
target: batch-build |
|
55 |
================================= --> |
|
56 |
<target name="batch-build" depends="compile" description="--> Prepare library"> |
|
57 |
<mkdir dir="${dist}"/> |
|
58 |
<jar destfile="${dist}/${jarName}" basedir="${build}"/> |
|
59 |
</target> |
|
60 |
|
|
61 |
<!-- ================================= |
|
62 |
target: clean |
|
63 |
================================= --> |
|
64 |
<target name="clean" depends="" description="--> Clean proyect"> |
|
65 |
<delete> |
|
66 |
<fileset dir="${build}"> |
|
67 |
<include name="***"/> |
|
68 |
<exclude name=".svn"/> |
|
69 |
</fileset> |
|
70 |
<fileset dir="${build-test}"> |
|
71 |
<include name="***"/> |
|
72 |
<exclude name=".svn"/> |
|
73 |
</fileset> |
|
74 |
|
|
75 |
</delete> |
|
76 |
<delete file="${dist}/${jarName}"/> |
|
77 |
|
|
78 |
</target> |
|
79 |
|
|
80 |
|
|
81 |
<target name="update-referenced-libraries"> |
|
82 |
<!--<copy todir="${lib}" failonerror="false"> |
|
83 |
<fileset dir="${workspaceDir}/libTools/dist" includes="*.jar,*.zip"/> |
|
84 |
</copy> --> |
|
85 |
</target> |
|
86 |
|
|
87 |
</project> |
branches/v2_0_0_prep/libraries/libDwg/pom.xml | ||
---|---|---|
3 | 3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
4 | 4 |
<modelVersion>4.0.0</modelVersion> |
5 | 5 |
<groupId>org.gvsig</groupId> |
6 |
<artifactId>libDwg</artifactId>
|
|
6 |
<artifactId>org.gvsig.dwg.lib</artifactId>
|
|
7 | 7 |
<packaging>jar</packaging> |
8 | 8 |
<version>2.0-SNAPSHOT</version> |
9 | 9 |
<name>libDwg</name> |
... | ... | |
17 | 17 |
<build-dir>${basedir}/../build</build-dir> |
18 | 18 |
</properties> |
19 | 19 |
<dependencies> |
20 |
<dependency>
|
|
20 |
<dependency> |
|
21 | 21 |
<groupId>org.gvsig</groupId> |
22 |
<artifactId>org.cresques.cts</artifactId>
|
|
22 |
<artifactId>org.gvsig.tools</artifactId>
|
|
23 | 23 |
<version>2.0-SNAPSHOT</version> |
24 | 24 |
</dependency> |
25 | 25 |
<dependency> |
26 |
<groupId>org.gvsig</groupId>
|
|
27 |
<artifactId>org.gvsig.fmap.geometry</artifactId>
|
|
28 |
<version>2.0-SNAPSHOT</version>
|
|
26 |
<groupId>org.gvsig</groupId>
|
|
27 |
<artifactId>org.gvsig.projection</artifactId>
|
|
28 |
<version>2.0-SNAPSHOT</version>
|
|
29 | 29 |
</dependency> |
30 | 30 |
<dependency> |
31 | 31 |
<groupId>org.gvsig</groupId> |
32 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
33 |
<classifier>impl</classifier> |
|
34 |
<version>2.0-SNAPSHOT</version> |
|
35 |
</dependency> |
|
32 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
33 |
<version>2.0-SNAPSHOT</version> |
|
34 |
</dependency> |
|
36 | 35 |
</dependencies> |
37 | 36 |
<build> |
38 | 37 |
<sourceDirectory>src</sourceDirectory> |
branches/v2_0_0_prep/libraries/libDwg/.settings/org.eclipse.jdt.core.prefs | ||
---|---|---|
1 |
#Mon May 25 15:31:59 CEST 2009 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 |
|
3 |
eclipse.preferences.version=1 |
|
4 |
org.eclipse.jdt.core.compiler.source=1.5 |
|
5 |
org.eclipse.jdt.core.compiler.compliance=1.5 |
|
0 | 6 |
branches/v2_0_0_prep/libraries/libDwg/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 | 1 |
<classpath> |
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="src" output="bin-test" path="src-test"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
6 |
<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/> |
|
7 |
<classpathentry kind="lib" path="/libFMap_geometries/lib/org.cresques.cts.jar"/> |
|
8 |
<classpathentry kind="lib" path="lib/slf4j-api-1.5.0.jar"/> |
|
9 |
<classpathentry kind="lib" path="lib/slf4j-log4j12-1.5.0.jar"/> |
|
10 |
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/> |
|
11 |
<classpathentry combineaccessrules="false" kind="src" path="/libFMap_geometries"/> |
|
12 |
<classpathentry combineaccessrules="false" kind="src" path="/libFMap_dal"/> |
|
13 |
<classpathentry kind="output" path="bin"/> |
|
14 |
</classpath> |
|
2 |
<classpathentry kind="src" path="src"/> |
|
3 |
<classpathentry kind="src" path="src-test" output="target/test-classes"/> |
|
4 |
<classpathentry kind="output" path="target/classes"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
6 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/geoapi/gvsig/geoapi-gvsig.jar"/> |
|
7 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/geojava/gvsig/geojava-gvsig.jar"/> |
|
8 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/gt2-legacy/gvsig/gt2-legacy-gvsig.jar"/> |
|
9 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/gt2-main/gvsig/gt2-main-gvsig.jar"/> |
|
10 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/gt2-postgis/gvsig/gt2-postgis-gvsig.jar"/> |
|
11 |
<classpathentry kind="var" path="M2_REPO/javax/media/jai_codec/1.1.3/jai_codec-1.1.3.jar"/> |
|
12 |
<classpathentry kind="var" path="M2_REPO/javax/media/jai_core/1.1.3/jai_core-1.1.3.jar"/> |
|
13 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/jts/gvsig/jts-gvsig.jar"/> |
|
14 |
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/> |
|
15 |
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/> |
|
16 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/org.gvsig.fmap.geometry/2.0-SNAPSHOT/org.gvsig.fmap.geometry-2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/gvsig/org.gvsig.fmap.geometry/2.0-SNAPSHOT/org.gvsig.fmap.geometry-2.0-SNAPSHOT-sources.jar"/> |
|
17 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/org.gvsig.i18n/2.0-SNAPSHOT/org.gvsig.i18n-2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/gvsig/org.gvsig.i18n/2.0-SNAPSHOT/org.gvsig.i18n-2.0-SNAPSHOT-sources.jar"> |
|
18 |
<attributes> |
|
19 |
<attribute value="jar:file:/home/jmvivo/.m2/repository/org/gvsig/org.gvsig.i18n/2.0-SNAPSHOT/org.gvsig.i18n-2.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/> |
|
20 |
</attributes> |
|
21 |
</classpathentry> |
|
22 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/org.gvsig.projection/2.0-SNAPSHOT/org.gvsig.projection-2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/gvsig/org.gvsig.projection/2.0-SNAPSHOT/org.gvsig.projection-2.0-SNAPSHOT-sources.jar"/> |
|
23 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/org.gvsig.tools/2.0-SNAPSHOT/org.gvsig.tools-2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/gvsig/org.gvsig.tools/2.0-SNAPSHOT/org.gvsig.tools-2.0-SNAPSHOT-sources.jar"/> |
|
24 |
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.5/slf4j-api-1.5.5.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.5.5/slf4j-api-1.5.5-sources.jar"/> |
|
25 |
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.5/slf4j-log4j12-1.5.5.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.5.5/slf4j-log4j12-1.5.5-sources.jar"/> |
|
26 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/units/gvsig/units-gvsig.jar"/> |
|
27 |
<classpathentry kind="var" path="M2_REPO/org/gvsig/legacy/vecmath/gvsig/vecmath-gvsig.jar"/> |
|
28 |
</classpath> |
branches/v2_0_0_prep/libraries/libDwg/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 | 1 |
<projectDescription> |
3 |
<name>libDwg</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
<project>libFMap</project> |
|
7 |
</projects> |
|
8 |
<buildSpec> |
|
9 |
<buildCommand> |
|
10 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
11 |
<arguments> |
|
12 |
</arguments> |
|
13 |
</buildCommand> |
|
14 |
</buildSpec> |
|
15 |
<natures> |
|
16 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
17 |
</natures> |
|
18 |
</projectDescription> |
|
2 |
<name>org.gvsig.dwg.lib</name> |
|
3 |
<comment>Base POM for all GvSIG libraries projects. This pom knows how to |
|
4 |
build and made an libraries for GvSIG. The property |
|
5 |
"gvsig-path" must be set up correctly.</comment> |
|
6 |
<projects/> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
</buildCommand> |
|
11 |
</buildSpec> |
|
12 |
<natures> |
|
13 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
14 |
</natures> |
|
15 |
</projectDescription> |
branches/v2_0_0_prep/libraries/libDwg/src-test/org/gvsig/dwg/lib/DwgFileTest.java | ||
---|---|---|
1 | 1 |
package org.gvsig.dwg.lib; |
2 | 2 |
|
3 |
import java.awt.geom.Point2D; |
|
4 | 3 |
import java.io.File; |
5 |
import java.io.FileInputStream; |
|
6 |
import java.io.FileNotFoundException; |
|
7 | 4 |
import java.io.IOException; |
8 | 5 |
import java.net.URL; |
9 |
import java.nio.ByteBuffer; |
|
10 |
import java.nio.ByteOrder; |
|
11 |
import java.nio.channels.FileChannel; |
|
12 |
import java.util.LinkedList; |
|
13 |
import java.util.List; |
|
14 | 6 |
|
15 |
import org.gvsig.dwg.lib.CorruptedDwgEntityException; |
|
16 |
import org.gvsig.dwg.lib.DwgVersionNotSupportedException; |
|
17 |
import org.gvsig.dwg.lib.readers.DwgFileV15Reader; |
|
18 |
import org.gvsig.dwg.lib.readers.IDwgFileReader; |
|
19 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
|
20 |
|
|
21 |
|
|
22 | 7 |
import junit.framework.TestCase; |
23 | 8 |
|
24 | 9 |
public class DwgFileTest extends TestCase { |
... | ... | |
26 | 11 |
|
27 | 12 |
protected void setUp() throws Exception { |
28 | 13 |
super.setUp(); |
29 |
URL url = this.getClass().getResource("DwgFileTest_data"); |
|
30 |
if (url == null) |
|
31 |
throw new Exception("Can't find 'DwgFileTest_data' dir"); |
|
32 |
|
|
14 |
URL url = this.getClass().getResource("data"); |
|
15 |
if (url == null) { |
|
16 |
throw new Exception("Can't find 'data' dir"); |
|
17 |
} |
|
18 |
|
|
33 | 19 |
baseDataPath = new File(url.getFile()); |
34 |
if (!baseDataPath.exists()) |
|
35 |
throw new Exception("Can't find 'DwgFileTest_data' dir"); |
|
36 |
|
|
20 |
if (!baseDataPath.exists()) { |
|
21 |
throw new Exception("Can't find 'data' dir"); |
|
22 |
} |
|
23 |
|
|
37 | 24 |
} |
38 | 25 |
|
39 | 26 |
protected void tearDown() throws Exception { |
... | ... | |
48 | 35 |
// dwg.blockManagement(); |
49 | 36 |
// LinkedList dwgObjects = dwg.getDwgObjects(); |
50 | 37 |
} |
51 |
|
|
38 |
|
|
52 | 39 |
public void test2() throws RuntimeException, CorruptedDwgEntityException{ |
53 | 40 |
//Dwg Object that is supposed to be |
54 | 41 |
//an LWPOLYLINE in V14 version |
... | ... | |
96 | 83 |
// bitPos = ((Integer) val.get(0)).intValue(); |
97 | 84 |
// int type = ((Integer) val.get(1)).intValue(); |
98 | 85 |
// System.out.println("type = " + type); |
99 |
//
|
|
86 |
// |
|
100 | 87 |
// DwgHandleReference hr = new DwgHandleReference(); |
101 | 88 |
// bitPos = hr.read(data, bitPos); |
102 | 89 |
// System.out.println("handle, code="+ |
103 | 90 |
// hr.getCode()+ |
104 | 91 |
// " ,offset="+ |
105 | 92 |
// hr.getOffset()); |
106 |
//
|
|
93 |
// |
|
107 | 94 |
// //Ahora pasamos a la extended data |
108 | 95 |
// val = DwgUtil.getBitShort(data, bitPos); |
109 | 96 |
// bitPos = ((Integer) val.get(0)).intValue(); |
110 | 97 |
// int extendedDataSize = ((Integer) val.get(1)).intValue(); |
111 | 98 |
// System.out.println("EED size="+extendedDataSize); |
112 | 99 |
// //como el size es 0, me lo salto |
113 |
//
|
|
100 |
// |
|
114 | 101 |
// //ver si tiene datos graficos |
115 | 102 |
// val = DwgUtil.testBit(data, bitPos); |
116 | 103 |
// bitPos = ((Integer) val.get(0)).intValue(); |
117 | 104 |
// boolean hasGraphicsData = ((Boolean) val.get(1)) |
118 | 105 |
// .booleanValue(); |
119 | 106 |
// System.out.println("graphics = "+hasGraphicsData); |
120 |
//
|
|
107 |
// |
|
121 | 108 |
// //como se que no hay graphics me lo salto |
122 | 109 |
// //tama?o en bits |
123 | 110 |
// val = DwgUtil.getRawLong(data, bitPos); |
124 | 111 |
// bitPos = ((Integer) val.get(0)).intValue(); |
125 | 112 |
// int sizeInBits = ((Integer) val.get(1)).intValue(); |
126 | 113 |
// System.out.println("sizeInBits = "+sizeInBits); |
127 |
//
|
|
114 |
// |
|
128 | 115 |
// /* |
129 | 116 |
// * Ahora, lo que viene es lo que en la spec se dice |
130 | 117 |
// * "Common entity data". Revisar bien pues PythonCAD no lo lee |
131 | 118 |
// * como en la spec. |
132 |
// *
|
|
119 |
// * |
|
133 | 120 |
// * pag 42. |
134 | 121 |
// R13-R14 Only: |
135 | 122 |
// RL : Size of object data in bits |
136 | 123 |
// 6B : Flags (FEDCBA) |
137 | 124 |
// 6B : Common parameters (CCSSII) |
138 | 125 |
// Segun esto, deberia leer 6 bits y 6 bits |
139 |
//
|
|
126 |
// |
|
140 | 127 |
// FLAGS |
141 | 128 |
// Mas adelante (pag 43), dice: |
142 |
// DC : This is the number of reactors attached to an
|
|
143 |
// entity as a bitshort.
|
|
144 |
// This feature may have been dormant in R13,
|
|
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, |
|
145 | 132 |
// but it appears in R14, and in files saved as R13 by R14. |
146 |
//
|
|
133 |
// |
|
147 | 134 |
// Ahora bien, pythoncad las est? leyendo como bitLong |
148 | 135 |
// ?En que quedamos, son 2 bits, 1 bitLong o 1 bitShort? |
149 | 136 |
// TODO REVISAR |
150 |
//
|
|
137 |
// |
|
151 | 138 |
// COMMON PARAMETERS |
152 | 139 |
// Al principio, dice que son 6 bits (CC, SS, II) |
153 | 140 |
// pero luego dice (pag 43): |
... | ... | |
157 | 144 |
// |
158 | 145 |
// Pythoncad, en vez de como 2 bits, los est? leyendo |
159 | 146 |
// como BitShort, BitDouble y BitShort |
160 |
//
|
|
147 |
// |
|
161 | 148 |
// * */ |
162 |
//
|
|
149 |
// |
|
163 | 150 |
// Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos); |
164 | 151 |
// bitPos += 2; |
165 | 152 |
// System.out.println("mode = "+mode); |
166 |
//
|
|
153 |
// |
|
167 | 154 |
// /* |
168 | 155 |
// val = DwgUtil.getBitLong(data, bitPos); |
169 | 156 |
// bitPos = ((Integer) val.get(0)).intValue(); |
... | ... | |
174 | 161 |
// bitPos = ((Integer) val.get(0)).intValue(); |
175 | 162 |
// int rnum = ((Integer) val.get(1)).intValue(); |
176 | 163 |
// System.out.println("numReactors = "+rnum); |
177 |
//
|
|
178 |
//
|
|
164 |
// |
|
165 |
// |
|
179 | 166 |
// val = DwgUtil.testBit(data, bitPos); |
180 | 167 |
// bitPos = ((Integer) val.get(0)).intValue(); |
181 | 168 |
// boolean isLyrByLineType = ((Boolean) val.get(1)).booleanValue(); |
182 | 169 |
// System.out.println("isLyrByLineType="+isLyrByLineType); |
183 |
//
|
|
170 |
// |
|
184 | 171 |
// val = DwgUtil.testBit(data, bitPos); |
185 | 172 |
// bitPos = ((Integer) val.get(0)).intValue(); |
186 | 173 |
// boolean noLinks = ((Boolean) val.get(1)).booleanValue(); |
187 | 174 |
// System.out.println("noLinks="+noLinks); |
188 | 175 |
// |
189 |
//
|
|
176 |
// |
|
190 | 177 |
// val = DwgUtil.getBitShort(data, bitPos); |
191 | 178 |
// bitPos = ((Integer) val.get(0)).intValue(); |
192 | 179 |
// int color = ((Integer) val.get(1)).intValue(); |
193 | 180 |
// System.out.println("color="+color); |
194 |
//
|
|
195 |
//
|
|
181 |
// |
|
182 |
// |
|
196 | 183 |
// val = DwgUtil.getBitDouble(data, bitPos); |
197 | 184 |
// bitPos = ((Integer) val.get(0)).intValue(); |
198 | 185 |
// float ltscale = ((Double) val.get(1)).floatValue(); |
199 | 186 |
// System.out.println("ltscale="+ltscale); |
200 |
//
|
|
187 |
// |
|
201 | 188 |
// val = DwgUtil.getBitShort(data, bitPos); |
202 | 189 |
// bitPos = ((Integer) val.get(0)).intValue(); |
203 | 190 |
// int invis = ((Integer) val.get(1)).intValue(); |
204 | 191 |
// System.out.println("invis="+invis); |
205 |
//
|
|
192 |
// |
|
206 | 193 |
// val = DwgUtil.getBitShort(data, bitPos); |
207 | 194 |
// bitPos = ((Integer) val.get(0)).intValue(); |
208 | 195 |
// int flag = ((Integer) val.get(1)).intValue(); |
209 | 196 |
// System.out.println("flag="+flag); |
210 |
//
|
|
197 |
// |
|
211 | 198 |
// double dVal = 0d; |
212 | 199 |
// if((flag & 0x4) > 0){ |
213 | 200 |
// val = DwgUtil.getBitDouble(data, bitPos); |
... | ... | |
215 | 202 |
// dVal = ((Double) val.get(1)).doubleValue(); |
216 | 203 |
// } |
217 | 204 |
// System.out.println("constWidth="+dVal); |
218 |
//
|
|
205 |
// |
|
219 | 206 |
// dVal = 0d; |
220 | 207 |
// if((flag & 0x8) > 0){ |
221 | 208 |
// val = DwgUtil.getBitDouble(data, bitPos); |
... | ... | |
223 | 210 |
// dVal = ((Double) val.get(1)).doubleValue(); |
224 | 211 |
// } |
225 | 212 |
// System.out.println("elevation="+dVal); |
226 |
//
|
|
213 |
// |
|
227 | 214 |
// dVal = 0d; |
228 | 215 |
// if ((flag & 0x2) > 0){ |
229 | 216 |
// val = DwgUtil.getBitDouble(data, bitPos); |
... | ... | |
231 | 218 |
// dVal = ((Double) val.get(1)).doubleValue(); |
232 | 219 |
// } |
233 | 220 |
// System.out.println("thickness="+dVal); |
234 |
//
|
|
221 |
// |
|
235 | 222 |
// double x, y, z ; |
236 | 223 |
// x = 0d; |
237 |
// y = 0d;
|
|
224 |
// y = 0d; |
|
238 | 225 |
// z = 0d; |
239 |
//
|
|
226 |
// |
|
240 | 227 |
// if ((flag & 0x1) > 0){ |
241 | 228 |
// val = DwgUtil.getBitDouble(data, bitPos); |
242 | 229 |
// bitPos = ((Integer) val.get(0)).intValue(); |
243 | 230 |
// x = ((Double) val.get(1)).doubleValue(); |
244 |
//
|
|
231 |
// |
|
245 | 232 |
// val = DwgUtil.getBitDouble(data, bitPos); |
246 | 233 |
// bitPos = ((Integer) val.get(0)).intValue(); |
247 | 234 |
// y = ((Double) val.get(1)).doubleValue(); |
248 |
//
|
|
235 |
// |
|
249 | 236 |
// val = DwgUtil.getBitDouble(data, bitPos); |
250 | 237 |
// bitPos = ((Integer) val.get(0)).intValue(); |
251 | 238 |
// z = ((Double) val.get(1)).doubleValue(); |
252 | 239 |
// } |
253 | 240 |
// System.out.println("normal="+x+","+y+","+z); |
254 |
//
|
|
241 |
// |
|
255 | 242 |
// val = DwgUtil.getBitLong(data, bitPos); |
256 | 243 |
// bitPos = ((Integer) val.get(0)).intValue(); |
257 | 244 |
// int np = ((Integer) val.get(1)).intValue(); |
258 | 245 |
// System.out.println("numPoints="+np); |
259 |
//
|
|
246 |
// |
|
260 | 247 |
// int nb = 0; |
261 | 248 |
// if((flag & 0x10) > 0){ |
262 | 249 |
// val = DwgUtil.getBitLong(data, bitPos); |
... | ... | |
277 | 264 |
// val = DwgUtil.getRawDouble(data, bitPos); |
278 | 265 |
// bitPos = ((Integer) val.get(0)).intValue(); |
279 | 266 |
// x = ((Double) val.get(1)).doubleValue(); |
280 |
//
|
|
267 |
// |
|
281 | 268 |
// val = DwgUtil.getRawDouble(data, bitPos); |
282 | 269 |
// bitPos = ((Integer) val.get(0)).intValue(); |
283 | 270 |
// y = ((Double) val.get(1)).doubleValue(); |
284 |
//
|
|
271 |
// |
|
285 | 272 |
// points[i] = new Point2D.Double(x, y); |
286 | 273 |
// System.out.println("Punto"+i+"="+x+","+y); |
287 | 274 |
// }//for |
288 | 275 |
// }//if np |
289 |
//
|
|
276 |
// |
|
290 | 277 |
// if(nb > 0){ |
291 | 278 |
// double[] bulges = new double[nb]; |
292 | 279 |
// for(int i = 0; i < nb; i++){ |
... | ... | |
295 | 282 |
// bulges[i] = ((Double) val.get(1)).doubleValue(); |
296 | 283 |
// System.out.println("Bulge"+i+"="+bulges[i]); |
297 | 284 |
// }//for |
298 |
//
|
|
285 |
// |
|
299 | 286 |
// }//if nb |
300 |
//
|
|
287 |
// |
|
301 | 288 |
// if(nw > 0){ |
302 | 289 |
// double[][] widths = new double[nw][2]; |
303 | 290 |
// for(int i = 0; i < nw; i++){ |
304 | 291 |
// val = DwgUtil.getBitDouble(data, bitPos); |
305 | 292 |
// bitPos = ((Integer) val.get(0)).intValue(); |
306 | 293 |
// double sw = ((Double) val.get(1)).doubleValue(); |
307 |
//
|
|
294 |
// |
|
308 | 295 |
// val = DwgUtil.getBitDouble(data, bitPos); |
309 | 296 |
// bitPos = ((Integer) val.get(0)).intValue(); |
310 | 297 |
// double ew = ((Double) val.get(1)).doubleValue(); |
311 |
//
|
|
298 |
// |
|
312 | 299 |
// widths[i][0] = sw; |
313 | 300 |
// widths[i][1] = ew; |
314 | 301 |
// System.out.println("Width"+i+"="+sw+","+ew); |
315 | 302 |
// }//for |
316 | 303 |
// } |
317 | 304 |
} |
318 |
|
|
305 |
|
|
319 | 306 |
public void test3(){ |
320 | 307 |
//test of extrusion |
321 | 308 |
double[] coord = null; |
322 | 309 |
double[] extrusion = null; |
323 | 310 |
double[] extrusion2 = new double[]{0, 0, 1}; |
324 |
|
|
311 |
|
|
325 | 312 |
coord = new double[]{790089.65, 4477974.75, 9.560000000114087}; |
326 | 313 |
extrusion = new double[]{-0.5037965987025721, 0.07005064807841195, 0.8609772899673451}; |
327 | 314 |
//1. algoritmo original, vector normal distinto |
328 |
// double[] newCoord = AcadExtrusionCalculator.extrude(coord, extrusion);
|
|
329 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion);
|
|
330 |
//
|
|
315 |
// double[] newCoord = AcadExtrusionCalculator.extrude(coord, extrusion); |
|
316 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion); |
|
317 |
// |
|
331 | 318 |
//2? ahora con vector normal coincidente con eje Z |
332 |
// newCoord = AcadExtrusionCalculator.extrude(coord, extrusion2);
|
|
333 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion2);
|
|
319 |
// newCoord = AcadExtrusionCalculator.extrude(coord, extrusion2); |
|
320 |
// newCoord = AcadExtrusionCalculator.extrude3(coord, extrusion2); |
|
334 | 321 |
} |
335 | 322 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/util/FMapUtil.java | ||
---|---|---|
5 | 5 |
package org.gvsig.dwg.lib.util; |
6 | 6 |
|
7 | 7 |
import java.awt.geom.Point2D; |
8 |
import java.util.Iterator; |
|
8 | 9 |
import java.util.List; |
9 | 10 |
|
10 |
import org.gvsig.dwg.lib.objects.DwgVertexPFace;
|
|
11 |
import org.gvsig.dwg.lib.IDwgVertex;
|
|
11 | 12 |
import org.gvsig.fmap.geom.Geometry; |
12 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
13 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
13 | 14 |
import org.gvsig.fmap.geom.GeometryManager; |
14 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
15 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
16 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
17 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
18 |
import org.gvsig.fmap.geom.primitive.Point; |
|
15 | 19 |
import org.gvsig.fmap.geom.primitive.Surface; |
16 |
import org.gvsig.fmap.geom.primitive.impl.Surface2DZ; |
|
17 | 20 |
|
18 | 21 |
|
19 | 22 |
/** |
... | ... | |
41 | 44 |
// return new FPolyline3D(genPathX, elevations); |
42 | 45 |
// } |
43 | 46 |
|
44 |
private static GeneralPathX getGeneralPathX(List pts){ |
|
45 |
if(pts == null || pts.size()==0){ |
|
46 |
return null; |
|
47 |
} |
|
47 |
private static GeometryManager gManager = GeometryLocator |
|
48 |
.getGeometryManager(); |
|
48 | 49 |
|
49 |
Object firstVertex = pts.get(0); |
|
50 | 50 |
|
51 |
if(firstVertex == null){ |
|
52 |
return null; |
|
53 |
} |
|
54 |
GeneralPathX genPathX = new GeneralPathX(); |
|
55 | 51 |
|
56 |
double[] coordinate = null; |
|
57 |
if(firstVertex instanceof double[]) |
|
58 |
coordinate = (double[])firstVertex; |
|
59 |
else if(firstVertex instanceof DwgVertexPFace){ |
|
60 |
DwgVertexPFace v = (DwgVertexPFace)firstVertex; |
|
61 |
coordinate = v.getPoint(); |
|
62 |
}else if(firstVertex instanceof Point2D){ |
|
63 |
Point2D point = (Point2D)firstVertex; |
|
64 |
coordinate = new double[]{point.getX(), point.getY()}; |
|
65 |
} |
|
66 |
genPathX.moveTo(coordinate[0], |
|
67 |
coordinate[1]); |
|
68 |
|
|
69 |
//TODO ESTE LIO SE DEBE A QUE EN ALGUNOS CASOS SE GUARDAN |
|
70 |
//double[] y en otros el IDwgVertex UNIFICAR |
|
71 |
for (int i = 1; i < pts.size(); i++) { |
|
72 |
Object vertex = pts.get(i); |
|
73 |
double[] vertexCoordinate = null; |
|
74 |
if(vertex instanceof double[]) |
|
75 |
vertexCoordinate = (double[])vertex; |
|
76 |
else if(vertex instanceof DwgVertexPFace){ |
|
77 |
DwgVertexPFace v = (DwgVertexPFace)vertex; |
|
78 |
vertexCoordinate = v.getPoint(); |
|
79 |
}else if(vertex instanceof Point2D){ |
|
80 |
Point2D point = (Point2D)vertex; |
|
81 |
vertexCoordinate = new double[]{point.getX(), point.getY()}; |
|
82 |
} |
|
83 |
genPathX.lineTo(vertexCoordinate[0], |
|
84 |
vertexCoordinate[1]); |
|
85 |
} |
|
86 |
return genPathX; |
|
87 |
} |
|
88 |
|
|
89 |
|
|
90 |
public static Geometry ptsTo3DPolygon(List pts){ |
|
91 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
92 |
GeneralPathX genPathX = getGeneralPathX(pts); |
|
93 |
double[] elevations = new double[pts.size()]; |
|
94 |
for (int i = 0; i < pts.size(); i++) { |
|
95 |
// TODO ESTE LIO SE DEBE A QUE EN ALGUNOS CASOS SE GUARDAN |
|
96 |
//double[] y en otros el IDwgVertex UNIFICAR |
|
97 |
Object vertex = pts.get(i); |
|
98 |
double[] vertexCoordinate = null; |
|
99 |
if(vertex instanceof double[]) |
|
100 |
vertexCoordinate = (double[])vertex; |
|
101 |
else{ |
|
102 |
DwgVertexPFace v = (DwgVertexPFace)vertex; |
|
103 |
vertexCoordinate = v.getPoint(); |
|
104 |
} |
|
105 |
elevations[i] = vertexCoordinate[2]; |
|
106 |
} |
|
107 |
return gFactory.createPolygon2DZ(genPathX, elevations); |
|
108 |
} |
|
109 | 52 |
// /** |
110 | 53 |
// * Method that changes a Point2D array to a FPolyline2D. Is useful to |
111 | 54 |
// * convert a polyline given by it points to a FPolyline2D, a polyline in the |
... | ... | |
122 | 65 |
// return new FPolyline2D(genPathX); |
123 | 66 |
// } |
124 | 67 |
|
125 |
public static Geometry ptsTo2DPolygon(List pts){
|
|
126 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory();
|
|
68 |
public static MultiCurve ptsToMultiCurve(List pts, int subType)
|
|
69 |
throws CreateGeometryException {
|
|
127 | 70 |
|
128 |
GeneralPathX genPathX = getGeneralPathX(pts); |
|
129 |
return gFactory.createPolygon2D(genPathX); |
|
130 |
// return new FPolygon2D(genPathX); |
|
71 |
if (pts.size() < 2) { |
|
72 |
throw new IllegalArgumentException(); |
|
73 |
} |
|
74 |
|
|
75 |
Point point, prevPoint; |
|
76 |
Curve curve; |
|
77 |
|
|
78 |
MultiCurve multi = (MultiCurve) gManager.create( |
|
79 |
Geometry.TYPES.MULTICURVE, |
|
80 |
subType); |
|
81 |
prevPoint = FMapUtil.createPoint(subType, pts.get(0)); |
|
82 |
for (int i = 1; i < pts.size(); i++) { |
|
83 |
point = FMapUtil.createPoint(subType, pts.get(i)); |
|
84 |
curve = (Curve) gManager.create(Geometry.TYPES.CURVE, subType); |
|
85 |
curve.setPoints(prevPoint, point); |
|
86 |
multi.addCurve(curve); |
|
87 |
prevPoint = point; |
|
88 |
} |
|
89 |
return multi; |
|
90 |
|
|
131 | 91 |
} |
92 |
|
|
93 |
public static Surface ptsToPolygon(List pts, int subType) |
|
94 |
throws CreateGeometryException { |
|
95 |
|
|
96 |
|
|
97 |
if (pts.size() < 3) { |
|
98 |
throw new IllegalArgumentException(); |
|
99 |
} |
|
100 |
|
|
101 |
Point cur; |
|
102 |
Surface surface = (Surface) gManager.create(Geometry.TYPES.SURFACE, |
|
103 |
subType); |
|
104 |
|
|
105 |
Iterator iter = pts.iterator(); |
|
106 |
while (iter.hasNext()) { |
|
107 |
cur = createPoint(subType, iter.next()); |
|
108 |
surface.addVertex(cur); |
|
109 |
} |
|
110 |
return surface; |
|
111 |
} |
|
112 |
|
|
113 |
public static Point createPoint(int subType, |
|
114 |
Object point) |
|
115 |
throws CreateGeometryException { |
|
116 |
Point result = (Point) gManager.create(Geometry.TYPES.POINT, subType); |
|
117 |
if (point instanceof double[]) { |
|
118 |
result.setCoordinates((double[]) point); |
|
119 |
} else if (point instanceof Point2D) { |
|
120 |
Point2D p = (Point2D) point; |
|
121 |
result.setX(p.getX()); |
|
122 |
result.setY(p.getY()); |
|
123 |
|
|
124 |
} else if (point instanceof IDwgVertex) { |
|
125 |
result.setCoordinates(((IDwgVertex) point).getPoint()); |
|
126 |
} else { |
|
127 |
throw new IllegalArgumentException(); |
|
128 |
} |
|
129 |
return result; |
|
130 |
} |
|
131 |
|
|
132 | 132 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgPolyline2D.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package org.gvsig.dwg.lib.objects; |
36 | 36 |
|
37 |
import java.awt.Shape; |
|
38 |
import java.awt.geom.GeneralPath; |
|
39 | 37 |
import java.awt.geom.Point2D; |
40 | 38 |
import java.util.ArrayList; |
41 | 39 |
import java.util.List; |
... | ... | |
54 | 52 |
import org.gvsig.dwg.lib.util.FMapUtil; |
55 | 53 |
import org.gvsig.dwg.lib.util.GisModelCurveCalculator; |
56 | 54 |
import org.gvsig.fmap.geom.Geometry; |
57 |
import org.gvsig.fmap.geom.GeometryFactory; |
|
58 |
import org.gvsig.fmap.geom.GeometryManager; |
|
59 |
import org.gvsig.fmap.geom.primitive.impl.Curve2D; |
|
60 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
55 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
61 | 56 |
import org.slf4j.Logger; |
62 | 57 |
import org.slf4j.LoggerFactory; |
63 | 58 |
|
... | ... | |
71 | 66 |
implements IDwgPolyline, IDwgExtrusionable, IDwg3DTestable, IDwg2FMap, IDwgBlockMember{ |
72 | 67 |
|
73 | 68 |
private static Logger logger = LoggerFactory.getLogger(DwgPolyline2D.class.getName()); |
74 |
|
|
69 |
|
|
75 | 70 |
private int flags; |
76 | 71 |
private int curveType; |
77 | 72 |
private double initWidth; |
... | ... | |
462 | 457 |
* @see com.iver.cit.jdwglib.dwg.IDwgExtrusionable#applyExtrussion() |
463 | 458 |
*/ |
464 | 459 |
public void applyExtrussion() { |
465 |
if(getPts() == null) |
|
460 |
if(getPts() == null) {
|
|
466 | 461 |
return; |
462 |
} |
|
467 | 463 |
List vertices = getPts(); |
468 | 464 |
double[] polyline2DExt = getExtrusion(); |
469 | 465 |
double elev = getElevation(); |
... | ... | |
476 | 472 |
} |
477 | 473 |
setElevation(elev); |
478 | 474 |
for (int j=0;j<vertices.size();j++) { |
479 |
vertices.add(new double[]{((double[])polylinePoints3D[j])[0], ((double[])polylinePoints3D[j])[1]});
|
|
475 |
vertices.add(new double[]{(polylinePoints3D[j])[0], (polylinePoints3D[j])[1]});
|
|
480 | 476 |
} |
481 | 477 |
setPts(vertices); |
482 | 478 |
} |
... | ... | |
495 | 491 |
/* (non-Javadoc) |
496 | 492 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
497 | 493 |
*/ |
498 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
499 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
500 |
List vertices = getPts(); |
|
501 |
double elev = getElevation(); |
|
502 |
|
|
503 |
if (vertices != null){ |
|
504 |
GeneralPathX gp = new GeneralPathX(); |
|
505 |
for (int i = 0; i < vertices.size(); i++) { |
|
506 |
Object vertice = vertices.get(i); |
|
507 |
if(i==0){ |
|
508 |
if(vertice instanceof double[]){ |
|
509 |
gp.moveTo(new Double(((double[])vertice)[0]).floatValue(),new Double(((double[])vertice)[1]).floatValue()); |
|
510 |
} else if (vertice instanceof Point2D){ |
|
511 |
gp.moveTo(new Double(((Point2D)vertice).getX()).floatValue(), |
|
512 |
new Double(((Point2D)vertice).getY()).floatValue()); |
|
513 |
} |
|
514 |
} else { |
|
515 |
|
|
516 |
if(vertice instanceof double[]){ |
|
517 |
gp.lineTo(new Double(((double[])vertice)[0]).floatValue(),new Double(((double[])vertice)[1]).floatValue()); |
|
518 |
} else if (vertice instanceof Point2D){ |
|
519 |
gp.lineTo(new Double(((Point2D)vertice).getX()).floatValue(), |
|
520 |
new Double(((Point2D)vertice).getY()).floatValue()); |
|
521 |
} |
|
522 |
} |
|
523 |
} |
|
524 |
if (is3DFile) { |
|
525 |
return gFactory.createPolyline3D(gp,new double[] {elev}); |
|
526 |
} else { |
|
527 |
return gFactory.createPolyline2D(gp); |
|
528 |
} |
|
529 |
} else { |
|
530 |
return null; |
|
531 |
} |
|
494 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
495 |
return FMapUtil.ptsToMultiCurve(getPts(), getGeometrySubType(is3DFile)); |
|
532 | 496 |
} |
533 | 497 |
/* (non-Javadoc) |
534 | 498 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
535 | 499 |
*/ |
536 | 500 |
public String toFMapString(boolean is3DFile) { |
537 |
if(is3DFile) |
|
501 |
if(is3DFile) {
|
|
538 | 502 |
return "FPolyline3D"; |
539 |
else
|
|
503 |
} else {
|
|
540 | 504 |
return "FPolyline2D"; |
505 |
} |
|
541 | 506 |
} |
542 | 507 |
|
543 | 508 |
public String toString(){ |
... | ... | |
599 | 564 |
public void addVertex(IDwgVertex vertex) { |
600 | 565 |
vertices.add(vertex.getPoint()); |
601 | 566 |
} |
567 |
|
|
568 |
public int getGeometrySubType(boolean is3DFile) { |
|
569 |
return Geometry.SUBTYPES.GEOM2D; |
|
570 |
} |
|
571 |
|
|
572 |
public int getGeometryType() { |
|
573 |
return Geometry.TYPES.MULTICURVE; |
|
574 |
} |
|
575 |
|
|
602 | 576 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgPolyline3D.java | ||
---|---|---|
39 | 39 |
import java.util.List; |
40 | 40 |
import java.util.Map; |
41 | 41 |
|
42 |
|
|
43 | 42 |
import org.gvsig.dwg.lib.DwgFile; |
44 | 43 |
import org.gvsig.dwg.lib.DwgHandleReference; |
45 | 44 |
import org.gvsig.dwg.lib.DwgObject; |
... | ... | |
48 | 47 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
49 | 48 |
import org.gvsig.dwg.lib.IDwgPolyline; |
50 | 49 |
import org.gvsig.dwg.lib.IDwgVertex; |
50 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
51 | 51 |
import org.gvsig.fmap.geom.Geometry; |
52 |
import org.gvsig.fmap.geom.GeometryFactory; |
|
53 |
import org.gvsig.fmap.geom.GeometryManager; |
|
54 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
52 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
55 | 53 |
import org.slf4j.Logger; |
56 | 54 |
import org.slf4j.LoggerFactory; |
57 | 55 |
|
... | ... | |
248 | 246 |
DwgObject obj = dwgFile.getDwgObject(i); |
249 | 247 |
if(obj instanceof DwgVertex3D){ |
250 | 248 |
DwgVertex3D vertex = (DwgVertex3D) obj; |
251 |
pt = ((DwgVertex3D)vertex).getPoint();
|
|
249 |
pt = (vertex).getPoint(); |
|
252 | 250 |
pts.add(new double[]{pt[0], pt[1], pt[2]}); |
253 | 251 |
}else if(obj instanceof DwgSeqend){ |
254 | 252 |
//TODO En Polyline2D J.Morell no interrumpia el barrido, |
... | ... | |
340 | 338 |
public boolean has3DData() { |
341 | 339 |
|
342 | 340 |
List pts = getPts(); |
343 |
if(pts == null) |
|
341 |
if(pts == null) {
|
|
344 | 342 |
return false; |
343 |
} |
|
345 | 344 |
double z = 0d; |
346 | 345 |
for (int j = 0; j<pts.size(); j++) { |
347 | 346 |
z = ((double[])pts.get(j))[2]; |
348 |
if (z != 0.0) |
|
347 |
if (z != 0.0) {
|
|
349 | 348 |
return true; |
349 |
} |
|
350 | 350 |
} |
351 | 351 |
return false; |
352 | 352 |
|
... | ... | |
366 | 366 |
break; |
367 | 367 |
} |
368 | 368 |
} |
369 |
if (constantElevation) |
|
369 |
if (constantElevation) {
|
|
370 | 370 |
return firstPt[2]; |
371 |
} |
|
371 | 372 |
} |
372 | 373 |
return 0d; |
373 | 374 |
} |
... | ... | |
388 | 389 |
/* (non-Javadoc) |
389 | 390 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
390 | 391 |
*/ |
391 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
392 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
393 |
List vertices = getPts(); |
|
394 |
|
|
395 |
if (vertices != null){ |
|
396 |
GeneralPathX gp = new GeneralPathX(); |
|
397 |
for (int i = 0; i < vertices.size(); i++) { |
|
398 |
Object vertice = vertices.get(i); |
|
399 |
if(i==0){ |
|
400 |
if(vertice instanceof double[]){ |
|
401 |
gp.moveTo(new Double(((double[])vertice)[0]).floatValue(),new Double(((double[])vertice)[1]).floatValue()); |
|
402 |
} else if (vertice instanceof Point2D){ |
|
403 |
gp.moveTo(new Double(((Point2D)vertice).getX()).floatValue(), |
|
404 |
new Double(((Point2D)vertice).getY()).floatValue()); |
|
405 |
} |
|
406 |
} else { |
|
407 |
if(vertice instanceof double[]){ |
|
408 |
gp.lineTo(new Double(((double[])vertice)[0]).floatValue(),new Double(((double[])vertice)[1]).floatValue()); |
|
409 |
} else if (vertice instanceof Point2D){ |
|
410 |
gp.lineTo(new Double(((Point2D)vertice).getX()).floatValue(), |
|
411 |
new Double(((Point2D)vertice).getY()).floatValue()); |
|
412 |
} |
|
413 |
} |
|
414 |
} |
|
415 |
if (is3DFile) { |
|
416 |
return gFactory.createPolyline3D(gp,getPZ()); |
|
417 |
} else { |
|
418 |
return gFactory.createPolyline2D(gp); |
|
419 |
} |
|
420 |
} else { |
|
421 |
return null; |
|
422 |
} |
|
392 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
393 |
return FMapUtil.ptsToMultiCurve(getPts(), getGeometrySubType(is3DFile)); |
|
423 | 394 |
} |
424 | 395 |
// public Geometry toFMapGeometry_old(boolean is3DFile) { |
425 | 396 |
// FPolyline2D pline = null; |
... | ... | |
446 | 417 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
447 | 418 |
*/ |
448 | 419 |
public String toFMapString(boolean is3DFile) { |
449 |
if(is3DFile) |
|
420 |
if(is3DFile) {
|
|
450 | 421 |
return "FPolyline3D"; |
451 |
else
|
|
422 |
} else {
|
|
452 | 423 |
return "FPolyline2D"; |
424 |
} |
|
453 | 425 |
} |
454 | 426 |
|
455 | 427 |
public String toString(){ |
... | ... | |
528 | 500 |
this.vertexHandles.add(handle); |
529 | 501 |
} |
530 | 502 |
|
503 |
public int getGeometrySubType(boolean is3DFile) { |
|
504 |
return Geometry.SUBTYPES.GEOM3D; |
|
505 |
} |
|
531 | 506 |
|
507 |
public int getGeometryType() { |
|
508 |
return Geometry.TYPES.MULTICURVE; |
|
509 |
} |
|
532 | 510 |
|
511 |
|
|
512 |
|
|
533 | 513 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgText.java | ||
---|---|---|
47 | 47 |
import org.gvsig.dwg.lib.IDwgExtrusionable; |
48 | 48 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
49 | 49 |
import org.gvsig.fmap.geom.Geometry; |
50 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
50 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
51 | 51 |
import org.gvsig.fmap.geom.GeometryManager; |
52 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
53 |
import org.gvsig.fmap.geom.primitive.Point; |
|
52 | 54 |
|
53 | 55 |
|
54 | 56 |
/** |
... | ... | |
281 | 283 |
public double getZ() { |
282 | 284 |
return getElevation(); |
283 | 285 |
} |
284 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
285 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
286 |
public Geometry toFMapGeometry(boolean is3DFile) |
|
287 |
throws CreateGeometryException { |
|
288 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
286 | 289 |
Point2D p = getInsertionPoint(); |
287 | 290 |
double elev = 0.0; |
288 |
if ((getDataFlag() & 0x1) == 0) |
|
291 |
if ((getDataFlag() & 0x1) == 0) {
|
|
289 | 292 |
elev = getElevation(); |
293 |
} |
|
294 |
Point point = (Point) gMan.create(getGeometryType(), |
|
295 |
getGeometrySubType(is3DFile)); |
|
296 |
point.setX(p.getX()); |
|
297 |
point.setX(p.getY()); |
|
290 | 298 |
if (is3DFile) { |
291 |
return gFactory.createPoint3D(p.getX(), p.getY(), elev);
|
|
299 |
point.setCoordinateAt(2, elev);
|
|
292 | 300 |
|
293 |
} else { |
|
294 |
return gFactory.createPoint2D(p.getX(), p.getY()); |
|
295 | 301 |
} |
302 |
return point; |
|
296 | 303 |
} |
297 | 304 |
|
298 | 305 |
public String toFMapString(boolean is3DFile) { |
299 |
if(is3DFile) |
|
306 |
if(is3DFile) {
|
|
300 | 307 |
return "FPoint3D"; |
301 |
else
|
|
308 |
} else {
|
|
302 | 309 |
return "FPoint2D"; |
310 |
} |
|
303 | 311 |
} |
304 | 312 |
public String toString(){ |
305 | 313 |
return "Text"; |
... | ... | |
364 | 372 |
//altura, etc. |
365 | 373 |
} |
366 | 374 |
|
375 |
public int getGeometrySubType(boolean is3DFile) { |
|
376 |
if (is3DFile) { |
|
377 |
return Geometry.SUBTYPES.GEOM3D; |
|
378 |
} else { |
|
379 |
return Geometry.SUBTYPES.GEOM2D; |
|
380 |
} |
|
381 |
} |
|
382 |
|
|
383 |
public int getGeometryType() { |
|
384 |
return Geometry.TYPES.POINT; |
|
385 |
} |
|
386 |
|
|
367 | 387 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgLine.java | ||
---|---|---|
35 | 35 |
package org.gvsig.dwg.lib.objects; |
36 | 36 |
|
37 | 37 |
import java.awt.geom.Point2D; |
38 |
import java.util.ArrayList; |
|
39 | 38 |
import java.util.List; |
40 | 39 |
import java.util.Map; |
41 | 40 |
|
... | ... | |
45 | 44 |
import org.gvsig.dwg.lib.IDwg3DTestable; |
46 | 45 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
47 | 46 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
48 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
49 | 47 |
import org.gvsig.fmap.geom.Geometry; |
50 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
48 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
51 | 49 |
import org.gvsig.fmap.geom.GeometryManager; |
50 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
51 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
52 |
import org.gvsig.fmap.geom.primitive.Point; |
|
52 | 53 |
|
53 | 54 |
|
54 | 55 |
/** |
... | ... | |
179 | 180 |
if (!isZflag()) { |
180 | 181 |
double z1 = getP1()[2]; |
181 | 182 |
double z2 = getP2()[2]; |
182 |
if (z1!=0.0 || z2!=0.0) |
|
183 |
if (z1!=0.0 || z2!=0.0) {
|
|
183 | 184 |
return true; |
185 |
} |
|
184 | 186 |
}//TODO y si zflag vale true? REVISAR |
185 | 187 |
return false; |
186 | 188 |
} |
... | ... | |
188 | 190 |
double[] p1 = getP1(); |
189 | 191 |
double[] p2 = getP2(); |
190 | 192 |
if(isZflag()){ |
191 |
if (p1[2] == p2[2]) |
|
193 |
if (p1[2] == p2[2]) {
|
|
192 | 194 |
return p1[2]; |
193 |
else
|
|
195 |
} else {
|
|
194 | 196 |
return 0d; |
197 |
} |
|
195 | 198 |
} else { |
196 | 199 |
return 0d; |
197 | 200 |
} |
198 | 201 |
} |
199 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
200 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
202 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
203 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
204 |
|
|
201 | 205 |
double[] p1 = getP1(); |
202 | 206 |
double[] p2 = getP2(); |
203 | 207 |
|
208 |
Point point1 = (Point) gMan.create(Geometry.TYPES.POINT, |
|
209 |
getGeometrySubType(is3DFile)); |
|
210 |
point1.setCoordinates(p1); |
|
204 | 211 |
|
205 |
if (is3DFile && isZflag()) { |
|
206 |
return gFactory.createLine2DZ( |
|
207 |
new Point2D.Double(p1[0], p1[1]), |
|
208 |
new Point2D.Double(p2[0], p2[1]), |
|
209 |
p1[2]); |
|
210 |
} else if (is3DFile && ! isZflag()) { |
|
211 |
return gFactory.createLine2DZ( |
|
212 |
new Point2D.Double(p1[0], p1[1]), |
|
213 |
new Point2D.Double(p2[0], p2[1]), |
|
214 |
0); |
|
215 |
} else { |
|
216 |
return gFactory.createLine2D( |
|
217 |
new Point2D.Double(p1[0], p1[1]), |
|
218 |
new Point2D.Double(p2[0], p2[1])); |
|
219 |
} |
|
212 |
Point point2 = (Point) gMan.create(Geometry.TYPES.POINT, |
|
213 |
getGeometrySubType(is3DFile)); |
|
214 |
point1.setCoordinates(p2); |
|
220 | 215 |
|
216 |
Curve line = (Curve) gMan.create(getGeometryType(), |
|
217 |
getGeometrySubType(is3DFile)); |
|
218 |
line.setPoints(point1, point2); |
|
219 |
return line; |
|
220 |
|
|
221 | 221 |
} |
222 | 222 |
public String toFMapString(boolean is3DFile) { |
223 | 223 |
if(is3DFile){ |
... | ... | |
298 | 298 |
|
299 | 299 |
} |
300 | 300 |
|
301 |
public int getGeometrySubType(boolean is3DFile) { |
|
302 |
if (is3DFile) { |
|
303 |
if (isZflag()) { |
|
304 |
return Geometry.SUBTYPES.GEOM3DM; |
|
305 |
} else { |
|
306 |
return Geometry.SUBTYPES.GEOM3D; |
|
307 |
} |
|
308 |
} else { |
|
309 |
if (isZflag()) { |
|
310 |
return Geometry.SUBTYPES.GEOM2DM; |
|
311 |
} else { |
|
312 |
return Geometry.SUBTYPES.GEOM2D; |
|
313 |
} |
|
314 |
} |
|
315 |
} |
|
316 |
|
|
317 |
public int getGeometryType() { |
|
318 |
return Geometry.TYPES.CURVE; |
|
319 |
} |
|
320 |
|
|
321 |
|
|
301 | 322 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgPFacePolyline.java | ||
---|---|---|
82 | 82 |
import org.gvsig.dwg.lib.IDwgVertex; |
83 | 83 |
import org.gvsig.dwg.lib.util.FMapUtil; |
84 | 84 |
import org.gvsig.fmap.geom.Geometry; |
85 |
import org.gvsig.fmap.geom.aggregate.impl.MultiSurface2D; |
|
86 |
import org.gvsig.fmap.geom.primitive.impl.Surface2D; |
|
85 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
86 |
import org.gvsig.fmap.geom.GeometryManager; |
|
87 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
|
88 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
87 | 89 |
import org.slf4j.Logger; |
88 | 90 |
import org.slf4j.LoggerFactory; |
89 | 91 |
|
... | ... | |
310 | 312 |
} |
311 | 313 |
|
312 | 314 |
|
313 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
314 |
// FGeometryCollection solution = null; |
|
315 |
// GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
315 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
|
316 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
316 | 317 |
|
317 |
MultiSurface2D solution = null; |
|
318 |
Surface2D[] geometries = null; |
|
318 |
int subType = getGeometrySubType(is3DFile); |
|
319 |
MultiSurface solution = (MultiSurface) gMan.create(getGeometryType(), |
|
320 |
subType); |
|
319 | 321 |
if(vertices != null && faces != null){ |
320 | 322 |
if(vertices.size() == 0 || faces.size() == 0){ |
321 |
return solution;
|
|
323 |
return gMan.createNullGeometry(subType);
|
|
322 | 324 |
} |
323 |
ArrayList geomList = new ArrayList(); |
|
324 | 325 |
int numFaces = faces.size(); |
325 | 326 |
for(int i = 0; i < numFaces; i++){ |
326 | 327 |
DwgVertexPFaceFace face = (DwgVertexPFaceFace) faces.get(i); |
... | ... | |
346 | 347 |
} |
347 | 348 |
}// for j |
348 | 349 |
|
349 |
Geometry geom = FMapUtil.ptsTo3DPolygon(pts); |
|
350 |
// Geometry geom = ShapeFactory.createGeometry(polygon); |
|
351 |
geomList.add(geom); |
|
350 |
solution.addSurface(FMapUtil.ptsToPolygon(pts, subType)); |
|
352 | 351 |
|
353 | 352 |
|
354 | 353 |
// if(!lastWasInvisible){ |
... | ... | |
361 | 360 |
// } |
362 | 361 |
|
363 | 362 |
}// for i |
364 |
geometries = new Surface2D[geomList.size()]; |
|
365 |
geometries = (Surface2D[]) geomList.toArray(geometries); |
|
366 |
solution = new MultiSurface2D(null, null, geometries); |
|
367 | 363 |
} |
368 | 364 |
return solution; |
369 | 365 |
|
... | ... | |
374 | 370 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
375 | 371 |
*/ |
376 | 372 |
public String toFMapString(boolean is3DFile) { |
377 |
if(is3DFile) |
|
373 |
if(is3DFile) {
|
|
378 | 374 |
return "FPolyline3D"; |
379 |
else
|
|
375 |
} else {
|
|
380 | 376 |
return "FPolyline2D"; |
377 |
} |
|
381 | 378 |
} |
382 | 379 |
|
383 | 380 |
public String toString(){ |
... | ... | |
387 | 384 |
public void addVertex(IDwgVertex vertex) { |
388 | 385 |
// here we save the vertex (not the coordinate) because |
389 | 386 |
// this Polyline could have two kind of vertex (pface and pfaceface) |
390 |
if(vertex instanceof DwgVertexPFaceFace) |
|
387 |
if(vertex instanceof DwgVertexPFaceFace) {
|
|
391 | 388 |
faces.add(vertex); |
392 |
else
|
|
389 |
} else {
|
|
393 | 390 |
vertices.add(vertex); |
391 |
} |
|
394 | 392 |
} |
395 | 393 |
|
396 | 394 |
public void dump(){ |
... | ... | |
417 | 415 |
DwgPFacePolyline transformedEntity = null; |
418 | 416 |
List vertices = this.getVertices(); |
419 | 417 |
if (vertices != null) { |
420 |
if(vertices.size() == 0) |
|
418 |
if(vertices.size() == 0) {
|
|
421 | 419 |
return; |
420 |
} |
|
422 | 421 |
List transformedVertices = new ArrayList(); |
423 | 422 |
for (int i=0;i < vertices.size();i++) { |
424 | 423 |
double[] pointAux = null; |
... | ... | |
443 | 442 |
handle_objectsWithoutBlocks.put(new Integer(transformedEntity.getHandle().getOffset()), transformedEntity); |
444 | 443 |
}// if |
445 | 444 |
} |
445 |
|
|
446 |
public int getGeometrySubType(boolean is3DFile) { |
|
447 |
if (is3DFile) { |
|
448 |
return Geometry.SUBTYPES.GEOM3D; |
|
449 |
} else { |
|
450 |
return Geometry.SUBTYPES.GEOM2D; |
|
451 |
} |
|
452 |
} |
|
453 |
|
|
454 |
public int getGeometryType() { |
|
455 |
return Geometry.TYPES.MULTISURFACE; |
|
456 |
} |
|
457 |
|
|
446 | 458 |
} |
447 | 459 |
|
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgEllipse.java | ||
---|---|---|
35 | 35 |
package org.gvsig.dwg.lib.objects; |
36 | 36 |
|
37 | 37 |
import java.awt.geom.Point2D; |
38 |
import java.util.ArrayList; |
|
39 | 38 |
import java.util.List; |
40 | 39 |
import java.util.Map; |
41 | 40 |
|
... | ... | |
44 | 43 |
import org.gvsig.dwg.lib.IDwg2FMap; |
45 | 44 |
import org.gvsig.dwg.lib.IDwg3DTestable; |
46 | 45 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
47 |
import org.gvsig.dwg.lib.util.FMapUtil; |
|
48 |
import org.gvsig.dwg.lib.util.GisModelCurveCalculator; |
|
49 | 46 |
import org.gvsig.fmap.geom.Geometry; |
50 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
47 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
51 | 48 |
import org.gvsig.fmap.geom.GeometryManager; |
49 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
50 |
import org.gvsig.fmap.geom.primitive.EllipticArc; |
|
51 |
import org.gvsig.fmap.geom.primitive.Point; |
|
52 | 52 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
53 | 53 |
|
54 | 54 |
|
... | ... | |
157 | 157 |
/* (non-Javadoc) |
158 | 158 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
159 | 159 |
*/ |
160 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
160 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException {
|
|
161 | 161 |
|
162 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory();
|
|
162 |
GeometryManager gMan = GeometryLocator.getGeometryManager();
|
|
163 | 163 |
double[] c = getCenter(); |
164 |
Point2D center = new Point2D.Double(c[0], c[1]); |
|
165 | 164 |
double[] semiMajorAxisVector = getSemiMajorAxisVector(); |
166 |
Point2D smav = new Point2D.Double(semiMajorAxisVector[0],semiMajorAxisVector[1]); |
|
167 | 165 |
double axisRatio = getAxisRatio(); |
168 | 166 |
double angSt = getInitAngle(); |
169 | 167 |
double angEnd = getEndAngle(); |
170 | 168 |
double angExt = UtilFunctions.angleDistance(angSt, angEnd); |
171 |
Point2D axis1Start = new Point2D.Double(center.getX()+smav.getX(), center.getY()+smav.getY()); |
|
172 |
Point2D axis1End = new Point2D.Double(center.getX()-smav.getX(), center.getY()-smav.getY()); |
|
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]); |
|
173 | 193 |
Point2D origen = new Point2D.Double(0.0,0.0); |
174 | 194 |
double semiMajorAxisLenght = origen.distance(smav); |
175 | 195 |
double semiMinorAxisLenght = semiMajorAxisLenght * axisRatio; |
176 | 196 |
|
177 |
if (is3DFile) { |
|
178 |
return gFactory.createEllipticArc2DZ(axis1Start, axis1End, semiMinorAxisLenght, -angSt, -angExt, c[2]); |
|
179 | 197 |
|
180 |
} else { |
|
181 |
return gFactory.createEllipticArc2D(axis1Start, axis1End, semiMinorAxisLenght, -angSt, -angExt); |
|
182 |
} |
|
198 |
|
|
199 |
EllipticArc ellipse = (EllipticArc) gMan.create(getGeometryType(), |
|
200 |
getGeometrySubType(is3DFile)); |
|
201 |
ellipse.setPoints(axis1Start, axis1End, semiMinorAxisLenght, -angSt, |
|
202 |
-angExt); |
|
203 |
|
|
204 |
return ellipse; |
|
183 | 205 |
} |
184 | 206 |
|
185 | 207 |
/* (non-Javadoc) |
186 | 208 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
187 | 209 |
*/ |
188 | 210 |
public String toFMapString(boolean is3DFile) { |
189 |
if(is3DFile) |
|
211 |
if(is3DFile) {
|
|
190 | 212 |
return "EllipticArc2DZ"; |
191 |
else
|
|
213 |
} else {
|
|
192 | 214 |
return "EllipticArc2D"; |
215 |
} |
|
193 | 216 |
} |
194 | 217 |
|
195 | 218 |
public String toString(){ |
... | ... | |
259 | 282 |
|
260 | 283 |
} |
261 | 284 |
|
285 |
public int getGeometrySubType(boolean is3DFile) { |
|
286 |
if (is3DFile) { |
|
287 |
return Geometry.SUBTYPES.GEOM3D; |
|
288 |
} else { |
|
289 |
return Geometry.SUBTYPES.GEOM2D; |
|
290 |
} |
|
291 |
} |
|
292 |
public int getGeometryType() { |
|
293 |
return Geometry.TYPES.ELLIPTICARC; |
|
294 |
} |
|
262 | 295 |
} |
branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgInsert.java | ||
---|---|---|
42 | 42 |
import org.gvsig.dwg.lib.DwgFile; |
43 | 43 |
import org.gvsig.dwg.lib.DwgHandleReference; |
44 | 44 |
import org.gvsig.dwg.lib.DwgObject; |
45 |
import org.gvsig.dwg.lib.IDwg2FMap; |
|
46 | 45 |
import org.gvsig.dwg.lib.IDwg3DTestable; |
47 | 46 |
import org.gvsig.dwg.lib.IDwgBlockMember; |
48 | 47 |
import org.gvsig.dwg.lib.IDwgExtrusionable; |
49 | 48 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
50 | 49 |
import org.gvsig.fmap.geom.Geometry; |
51 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
50 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
52 | 51 |
import org.gvsig.fmap.geom.GeometryManager; |
52 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
53 |
import org.gvsig.fmap.geom.primitive.Point; |
|
53 | 54 |
|
54 | 55 |
|
55 | 56 |
/** |
... | ... | |
230 | 231 |
public double getZ() { |
231 | 232 |
return getInsertionPoint()[2]; |
232 | 233 |
} |
233 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
234 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
234 |
public Geometry toFMapGeometry(boolean is3DFile) |
|
235 |
throws CreateGeometryException { |
|
236 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
235 | 237 |
double[] p = getInsertionPoint(); |
236 |
if (is3DFile) { |
|
237 |
return gFactory.createPoint3D(p[0], p[1], p[2]); |
|
238 |
} else { |
|
239 |
return gFactory.createPoint2D(p[0], p[1]); |
|
240 |
} |
|
238 |
Point point = (Point) gMan.create(getGeometryType(), |
|
239 |
getGeometrySubType(is3DFile)); |
|
240 |
point.setCoordinates(p); |
|
241 |
return point; |
|
241 | 242 |
|
242 | 243 |
} |
243 | 244 |
public String toFMapString(boolean is3DFile) { |
244 |
if(is3DFile) |
|
245 |
if(is3DFile) {
|
|
245 | 246 |
return "FPoint3D"; |
246 |
else
|
|
247 |
} else {
|
|
247 | 248 |
return "FPoint2D"; |
249 |
} |
|
248 | 250 |
} |
249 | 251 |
|
250 | 252 |
public String toString(){ |
... | ... | |
314 | 316 |
this.processed = processed; |
315 | 317 |
} |
316 | 318 |
|
319 |
public int getGeometrySubType(boolean is3DFile) { |
|
320 |
if (is3DFile) { |
|
321 |
return Geometry.SUBTYPES.GEOM3D; |
|
322 |
} else { |
|
323 |
return Geometry.SUBTYPES.GEOM2D; |
|
324 |
} |
|
325 |
} |
|
326 |
|
|
327 |
public int getGeometryType() { |
|
328 |
return Geometry.TYPES.POINT; |
|
329 |
} |
|
317 | 330 |
} |
Also available in: Unified diff