root / branches / pilotoDWG / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / dwg / DwgCadDriver.java @ 2326
History | View | Annotate | Download (71.2 KB)
1 |
/*
|
---|---|
2 |
* Created on 14-abr-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
* DwgMemoryDriver 0.2. Driver del formato DWG para gvSIG
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.fmap.drivers.dwg; |
46 |
|
47 |
import java.awt.Color; |
48 |
import java.awt.Font; |
49 |
import java.awt.geom.AffineTransform; |
50 |
import java.awt.geom.Arc2D; |
51 |
import java.awt.geom.Point2D; |
52 |
import java.io.File; |
53 |
import java.io.IOException; |
54 |
import java.util.ArrayList; |
55 |
import java.util.Vector; |
56 |
|
57 |
import net.jmorell.javacad.util.AcadColor; |
58 |
import net.jmorell.javacad.util.ArcFromBulgeCalculator; |
59 |
import net.jmorell.javacad.util.GisModelCurveCalculator; |
60 |
import net.jmorell.jdwglib.dwg.DwgFile; |
61 |
import net.jmorell.jdwglib.dwg.DwgObject; |
62 |
import net.jmorell.jdwglib.dwg.objects.DwgArc; |
63 |
import net.jmorell.jdwglib.dwg.objects.DwgAttdef; |
64 |
import net.jmorell.jdwglib.dwg.objects.DwgAttrib; |
65 |
import net.jmorell.jdwglib.dwg.objects.DwgBlock; |
66 |
import net.jmorell.jdwglib.dwg.objects.DwgBlockControl; |
67 |
import net.jmorell.jdwglib.dwg.objects.DwgBlockHeader; |
68 |
import net.jmorell.jdwglib.dwg.objects.DwgCircle; |
69 |
import net.jmorell.jdwglib.dwg.objects.DwgEndblk; |
70 |
import net.jmorell.jdwglib.dwg.objects.DwgInsert; |
71 |
import net.jmorell.jdwglib.dwg.objects.DwgLine; |
72 |
import net.jmorell.jdwglib.dwg.objects.DwgLwPolyline; |
73 |
import net.jmorell.jdwglib.dwg.objects.DwgMText; |
74 |
import net.jmorell.jdwglib.dwg.objects.DwgPoint; |
75 |
import net.jmorell.jdwglib.dwg.objects.DwgPolyline2D; |
76 |
import net.jmorell.jdwglib.dwg.objects.DwgPolyline3D; |
77 |
import net.jmorell.jdwglib.dwg.objects.DwgSolid; |
78 |
import net.jmorell.jdwglib.dwg.objects.DwgText; |
79 |
import net.jmorell.jdwglib.dwg.objects.DwgEllipse; |
80 |
|
81 |
import com.hardcode.gdbms.engine.data.DriverException; |
82 |
import com.hardcode.gdbms.engine.data.ReadDriver; |
83 |
import com.hardcode.gdbms.engine.values.IntValue; |
84 |
import com.hardcode.gdbms.engine.values.Value; |
85 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
86 |
import com.iver.cit.gvsig.fmap.core.FArc2D; |
87 |
import com.iver.cit.gvsig.fmap.core.FCircle2D; |
88 |
import com.iver.cit.gvsig.fmap.core.FEllipse2D; |
89 |
import com.iver.cit.gvsig.fmap.core.FGeometryCollection; |
90 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
91 |
import com.iver.cit.gvsig.fmap.core.FPoint3D; |
92 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
93 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
94 |
import com.iver.cit.gvsig.fmap.core.FPolyline3D; |
95 |
import com.iver.cit.gvsig.fmap.core.FShape; |
96 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
97 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
98 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
99 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
100 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
101 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
102 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
103 |
import com.iver.cit.gvsig.fmap.drivers.MemoryDriver; |
104 |
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend; |
105 |
import com.iver.cit.gvsig.fmap.edition.cad.TrigonometricalFunctions; |
106 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
107 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
108 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
109 |
|
110 |
/**
|
111 |
* Driver that allows gvSig Cad Pilot to read files in DWG format
|
112 |
* Using this driver, the Cad Pilot user can manipulate part of the information contained in
|
113 |
* a DWG file
|
114 |
* This driver load the Dwg file in memory
|
115 |
* This driver uses jdwglib
|
116 |
*
|
117 |
* @author jmorell
|
118 |
*/
|
119 |
public class DwgCadDriver extends MemoryDriver implements WithDefaultLegend { |
120 |
private final int ID_FIELD_ID=0; |
121 |
private final int ID_FIELD_FSHAPE=1; |
122 |
private final int ID_FIELD_ENTITY=2; |
123 |
private final int ID_FIELD_LAYER=3; |
124 |
private final int ID_FIELD_COLOR=4; |
125 |
private final int ID_FIELD_ELEVATION=5; |
126 |
private final int ID_FIELD_THICKNESS=6; |
127 |
private final int ID_FIELD_TEXT=7; |
128 |
private final int ID_FIELD_HEIGHTTEXT=8; |
129 |
private final int ID_FIELD_ROTATIONTEXT=9; |
130 |
|
131 |
VectorialUniqueValueLegend defaultLegend; |
132 |
private String path; |
133 |
private File m_Fich; |
134 |
|
135 |
private DwgFile dwg;
|
136 |
private Vector dwgObjects; |
137 |
private DriverAttributes attr = new DriverAttributes(); |
138 |
|
139 |
/* (non-Javadoc)
|
140 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#open(java.io.File)
|
141 |
*/
|
142 |
public void open(File f) throws IOException { |
143 |
m_Fich = f; |
144 |
} |
145 |
|
146 |
/**
|
147 |
* This method load the DWG file in memory.
|
148 |
* First, it will be necessary to create a DwgFile object with the DWG file path
|
149 |
* as the argument
|
150 |
* Second, the method read of DwgFile allows to read the objects inside the DWG
|
151 |
* file
|
152 |
* Third, it will be necessary to process some DWG objects like Layers or Polylines
|
153 |
* Fourth, we can read the objects Vector, and convert this objects to the FMap
|
154 |
* object model
|
155 |
* And finally, the testDwg3D method test if this DWG has elevation informacion
|
156 |
*/
|
157 |
public void initialize() throws DriverIOException { |
158 |
try {
|
159 |
clearGeometryArray(); |
160 |
float heightText = 10; |
161 |
attr.setLoadedInMemory(true);
|
162 |
|
163 |
dwg = new DwgFile(m_Fich.getAbsolutePath());
|
164 |
long t1 = System.currentTimeMillis(); |
165 |
dwg.read(); |
166 |
long t2 = System.currentTimeMillis(); |
167 |
System.out.println("Tiempo empleado por la librer?a en leer el fichero dwg = " + (t2-t1)); |
168 |
t1 = System.currentTimeMillis();
|
169 |
dwg.initializeLayerTable(); |
170 |
//dwg.calculateGisModelDwgPolylines();
|
171 |
dwg.calculateCadModelDwgPolylines(); |
172 |
t2 = System.currentTimeMillis();
|
173 |
System.out.println("Tiempo empleado por la librer?a en tratar el fichero dwg = " + (t2-t1)); |
174 |
dwgObjects = dwg.getDwgObjects(); |
175 |
//dwg.testDwg3D();
|
176 |
dwg.setDwg3DFile(false);
|
177 |
|
178 |
// TODO: Atributos extra de los objectos
|
179 |
//int nAtt = featureMaker.getAttributes().size();
|
180 |
|
181 |
// Campos de las MemoryLayer:
|
182 |
//Value[] auxRow = new Value[9+nAtt];
|
183 |
Value[] auxRow = new Value[10]; |
184 |
ArrayList arrayFields = new ArrayList(); |
185 |
arrayFields.add("ID");
|
186 |
arrayFields.add("FShape");
|
187 |
arrayFields.add("Entity");
|
188 |
arrayFields.add("Layer");
|
189 |
arrayFields.add("Color");
|
190 |
arrayFields.add("Elevation");
|
191 |
arrayFields.add("Thickness");
|
192 |
arrayFields.add("Text");
|
193 |
arrayFields.add("HeightText");
|
194 |
arrayFields.add("RotationText");
|
195 |
/*for (int i=0;i<nAtt;i++) {
|
196 |
String att[] = new String[2];
|
197 |
att = (String[])featureMaker.getAttributes().get(i);
|
198 |
arrayFields.add(att[0]);
|
199 |
}*/
|
200 |
|
201 |
getTableModel().setColumnIdentifiers(arrayFields.toArray()); |
202 |
|
203 |
t1 = System.currentTimeMillis();
|
204 |
|
205 |
boolean addingToBlock = false; |
206 |
|
207 |
for (int i=0;i<dwgObjects.size();i++) { |
208 |
|
209 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0);
|
210 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0);
|
211 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createNullValue(); |
212 |
|
213 |
DwgObject entity = (DwgObject)dwgObjects.get(i); |
214 |
if (entity instanceof DwgArc && !addingToBlock) { |
215 |
//System.out.println("Encuentra un Arc ...");
|
216 |
double[] c = ((DwgArc)entity).getCenter(); |
217 |
Point2D center = new Point2D.Double(c[0], c[1]); |
218 |
double r = ((DwgArc)entity).getRadius();
|
219 |
double empieza = Math.toDegrees(((DwgArc)entity).getInitAngle()); |
220 |
double acaba = Math.toDegrees(((DwgArc)entity).getEndAngle()); |
221 |
int iempieza = (int)empieza; |
222 |
int iacaba = (int)acaba; |
223 |
Point2D[] pts = null; |
224 |
double angulo = 0; |
225 |
if (empieza <= acaba) {
|
226 |
pts = new Point2D[(iacaba-iempieza)+2]; |
227 |
angulo = empieza; |
228 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
229 |
for (int j=1; j<=(iacaba-iempieza)+1; j++) { |
230 |
angulo = (double)(iempieza+j);
|
231 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
232 |
} |
233 |
angulo = acaba; |
234 |
pts[(iacaba-iempieza)+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
235 |
} else {
|
236 |
pts = new Point2D[(360-iempieza)+iacaba+2]; |
237 |
angulo = empieza; |
238 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
239 |
for (int j=1; j<=(360-iempieza); j++) { |
240 |
angulo = (double)(iempieza+j);
|
241 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
242 |
} |
243 |
for (int j=(360-iempieza)+1; j<=(360-iempieza)+iacaba; j++) { |
244 |
angulo = (double)(j-(360-iempieza)); |
245 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
246 |
} |
247 |
angulo = acaba; |
248 |
pts[(360-iempieza)+iacaba+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
249 |
} |
250 |
Point2D pc = pts[(pts.length)/2]; |
251 |
Point2D in = pts[0]; |
252 |
Point2D e = pts[pts.length-1]; |
253 |
if (pc.getX()==e.getX() && pc.getY()==e.getY()) {
|
254 |
double middleAngle = (empieza+acaba)/2; |
255 |
if (empieza>acaba) {
|
256 |
acaba = acaba + 360;
|
257 |
double a = acaba - empieza;
|
258 |
double mangle = a/2; |
259 |
middleAngle = empieza + mangle; |
260 |
} |
261 |
pc = new Point2D.Double(center.getX()+r*Math.sin(middleAngle), center.getY()+r*Math.cos(middleAngle)); |
262 |
} |
263 |
Arc2D arco = TrigonometricalFunctions.createArc(in, pc, e);
|
264 |
FArc2D fArc = new FArc2D(new GeneralPathX(arco),in,pc,e); |
265 |
/*if (dwg.isDwg3DFile()) {
|
266 |
double[][] arc3D = new double[arc.length][3];
|
267 |
for (int j=0;j<arc.length;j++) {
|
268 |
arc3D[j][0] = arc[j].getX();
|
269 |
arc3D[j][1] = arc[j].getY();
|
270 |
arc3D[j][2] = c[2];
|
271 |
}
|
272 |
arcc = points3DToFPolyline3D(arc3D);
|
273 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
274 |
} else {
|
275 |
arcc = points2DToFPolyline2D(arc);
|
276 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
277 |
}*/
|
278 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
279 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FArc2D")); |
280 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Arc")); |
281 |
String layerName = dwg.getLayerName(entity);
|
282 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
283 |
int color = entity.getColor();
|
284 |
int colorByLayer = dwg.getColorByLayer(entity);
|
285 |
// TODO: if (color==0) color ByBlock
|
286 |
if (color==256) color = colorByLayer; |
287 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
288 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(c[2]);
|
289 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
290 |
// Attributes
|
291 |
/*for (int j=0;j<nAtt;j++) {
|
292 |
String[] attributes = new String[2];
|
293 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
294 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
295 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
296 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
297 |
}
|
298 |
}*/
|
299 |
addShape(fArc, auxRow); |
300 |
} else if (entity instanceof DwgEllipse && !addingToBlock) { |
301 |
//System.out.println("Encuentra una Ellipse ...");
|
302 |
double[] c = ((DwgEllipse)entity).getCenter(); |
303 |
Point2D center = new Point2D.Double(c[0], c[1]); |
304 |
double[] majorAxisVector = ((DwgEllipse)entity).getMajorAxisVector(); |
305 |
Point2D mav = new Point2D.Double(majorAxisVector[0], majorAxisVector[1]); |
306 |
double axisRatio = ((DwgEllipse)entity).getAxisRatio();
|
307 |
double initAngle = Math.toDegrees(((DwgEllipse)entity).getInitAngle()); |
308 |
double endAngle = Math.toDegrees(((DwgEllipse)entity).getEndAngle()); |
309 |
|
310 |
double incX = mav.getX()/2D; |
311 |
double incY = mav.getY()/2D; |
312 |
Point2D pt2 = new Point2D.Double(center.getX()+incX, center.getY()+incY); |
313 |
Point2D pt1 = new Point2D.Double(center.getX()-incX, center.getY()-incY); |
314 |
double majorAxisLength = pt1.distance(pt2);
|
315 |
double minorAxisLength = majorAxisLength*axisRatio;
|
316 |
Arc2D.Double arc = new Arc2D.Double(pt1.getX(), |
317 |
pt1.getY() - minorAxisLength/2D, majorAxisLength, minorAxisLength, 0, 360, Arc2D.OPEN); |
318 |
Point2D rotationPoint = new Point2D.Double(pt1.getX() + majorAxisLength /2, pt1.getY()); |
319 |
double angle = TrigonometricalFunctions.getAngle(pt1, pt2);
|
320 |
AffineTransform mT = AffineTransform.getRotateInstance(angle, pt1.getX(), pt1.getY()); |
321 |
GeneralPathX gp = new GeneralPathX(arc);
|
322 |
gp.transform(mT); |
323 |
FEllipse2D fEllipse = new FEllipse2D(new GeneralPathX(gp),pt1,pt2,minorAxisLength/2D); |
324 |
/*if (dwg.isDwg3DFile()) {
|
325 |
double[][] arc3D = new double[arc.length][3];
|
326 |
for (int j=0;j<arc.length;j++) {
|
327 |
arc3D[j][0] = arc[j].getX();
|
328 |
arc3D[j][1] = arc[j].getY();
|
329 |
arc3D[j][2] = c[2];
|
330 |
}
|
331 |
arcc = points3DToFPolyline3D(arc3D);
|
332 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
333 |
} else {
|
334 |
arcc = points2DToFPolyline2D(arc);
|
335 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
336 |
}*/
|
337 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
338 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FEllipse2D")); |
339 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Ellipse")); |
340 |
String layerName = dwg.getLayerName(entity);
|
341 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
342 |
int color = entity.getColor();
|
343 |
int colorByLayer = dwg.getColorByLayer(entity);
|
344 |
// TODO: if (color==0) color ByBlock
|
345 |
if (color==256) color = colorByLayer; |
346 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
347 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(c[2]);
|
348 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
349 |
// Attributes
|
350 |
/*for (int j=0;j<nAtt;j++) {
|
351 |
String[] attributes = new String[2];
|
352 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
353 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
354 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
355 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
356 |
}
|
357 |
}*/
|
358 |
addShape(fEllipse, auxRow); |
359 |
} else if (entity instanceof DwgCircle && !addingToBlock) { |
360 |
//System.out.println("Encuentra un Circle ...");
|
361 |
double[] c = ((DwgCircle)entity).getCenter(); |
362 |
Point2D center = new Point2D.Double(c[0], c[1]); |
363 |
double r = ((DwgCircle)entity).getRadius();
|
364 |
//Point2D[] arc = GisModelCurveCalculator.calculateGisModelCircle(center, radius);
|
365 |
Arc2D.Double arc = new Arc2D.Double(center.getX()-r , center.getY()-r , 2*r , 2*r , 0 , 360 , Arc2D.OPEN); |
366 |
FCircle2D fCircle = new FCircle2D(new GeneralPathX(arc),center,r); |
367 |
/*FPolyline2D arcc;
|
368 |
if (dwg.isDwg3DFile()) {
|
369 |
double[][] arc3D = new double[arc.length][3];
|
370 |
for (int j=0;j<arc.length;j++) {
|
371 |
arc3D[j][0] = arc[j].getX();
|
372 |
arc3D[j][1] = arc[j].getY();
|
373 |
arc3D[j][2] = c[2];
|
374 |
}
|
375 |
arcc = points3DToFPolyline3D(arc3D);
|
376 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
377 |
} else {
|
378 |
arcc = points2DToFPolyline2D(arc);
|
379 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
380 |
}*/
|
381 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
382 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FCircle2D")); |
383 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Circle")); |
384 |
String layerName = dwg.getLayerName(entity);
|
385 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
386 |
int color = entity.getColor();
|
387 |
int colorByLayer = dwg.getColorByLayer(entity);
|
388 |
//if (color==0) color ByBlock
|
389 |
if (color==256) color = colorByLayer; |
390 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
391 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(c[2]);
|
392 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
393 |
// Attributes
|
394 |
/*for (int j=0;j<nAtt;j++) {
|
395 |
String[] attributes = new String[2];
|
396 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
397 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
398 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
399 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
400 |
}
|
401 |
}*/
|
402 |
addShape(fCircle, auxRow); |
403 |
} else if (entity instanceof DwgPolyline2D && !addingToBlock) { |
404 |
//System.out.println("Encuentra una Polyline2D ...");
|
405 |
Point2D[] points = ((DwgPolyline2D)entity).getPts(); |
406 |
double elev = ((DwgPolyline2D)entity).getElevation();
|
407 |
if (points!=null) { |
408 |
int vertexNumber = points.length;
|
409 |
int geomNumber = 0; |
410 |
int flag = ((DwgPolyline2D)entity).getFlags();
|
411 |
if (flag==0 || flag==2 || flag==4 || flag==8 || flag==16 || flag==32 || flag==64 || flag==128) { |
412 |
geomNumber = vertexNumber-1;
|
413 |
} else if (flag==1 || flag==3 || flag==5 || flag==9 || flag==17 || flag==33 || flag==65 || flag==129) { |
414 |
geomNumber = vertexNumber; |
415 |
} |
416 |
IGeometry[] geoms = new IGeometry[geomNumber]; |
417 |
for (int j=0;j<geomNumber;j++) { |
418 |
Point2D init = (Point2D)((DwgPolyline2D)entity).getPts()[j]; |
419 |
Point2D end = new Point2D.Double(); |
420 |
if (j==geomNumber-1 && (flag==1 || flag==129)) { |
421 |
end = (Point2D)((DwgPolyline2D)entity).getPts()[0]; |
422 |
} else {
|
423 |
end = (Point2D)((DwgPolyline2D)entity).getPts()[j+1]; |
424 |
} |
425 |
//System.out.println("DxfCadDriver.initialize(): dxfPolyline.getBulges().size() = " + dxfPolyline.getBulges().size());
|
426 |
if (((DwgPolyline2D)entity).getBulges()[j]==0 || (init.getX()==end.getX() && init.getY()==end.getY())) { |
427 |
GeneralPathX gp = new GeneralPathX();
|
428 |
gp.moveTo(init.getX(), init.getY()); |
429 |
gp.lineTo(end.getX(), end.getY()); |
430 |
//System.out.println("flag = " + flag);
|
431 |
//if (j==geomNumber-1 && flag==1) {
|
432 |
/*Point2D first = (Point2D)dxfPolyline.getPts().get(0);
|
433 |
gp.lineTo(first.getX(), first.getY());*/
|
434 |
/*System.out.println("Polyline: Cierra el gp.");
|
435 |
gp.closePath();
|
436 |
}*/
|
437 |
geoms[j] = (IGeometry)ShapeFactory.createPolyline2D(gp); |
438 |
} else if (((DwgPolyline2D)entity).getBulges()[j]>0 && !(init.getX()==end.getX() && init.getY()==end.getY())) { |
439 |
//IGeometry arc = (IGeometry)ShapeFactory.createArc();
|
440 |
ArcFromBulgeCalculator arcFromBulgeCalculator = new ArcFromBulgeCalculator(init, end, ((DwgPolyline2D)entity).getBulges()[j]);
|
441 |
Vector arc = (Vector)arcFromBulgeCalculator.getCentralPoint(); |
442 |
Point2D cent = (Point2D)arc.get(0); |
443 |
//System.out.println("init = " + init);
|
444 |
//System.out.println("cent = " + cent);
|
445 |
//System.out.println("end = " + end);
|
446 |
geoms[j] = (IGeometry)ShapeFactory.createArc(init, cent, end); |
447 |
} else if (((DwgPolyline2D)entity).getBulges()[j]<0 && !(init.getX()==end.getX() && init.getY()==end.getY())) { |
448 |
//IGeometry arc = (IGeometry)ShapeFactory.createArc();
|
449 |
ArcFromBulgeCalculator arcFromBulgeCalculator = new ArcFromBulgeCalculator(init, end, ((DwgPolyline2D)entity).getBulges()[j]);
|
450 |
Vector arc = (Vector)arcFromBulgeCalculator.getCentralPoint(); |
451 |
Point2D cent = (Point2D)arc.get(0); |
452 |
//System.out.println("init = " + init);
|
453 |
//System.out.println("cent = " + cent);
|
454 |
//System.out.println("end = " + end);
|
455 |
geoms[j] = (IGeometry)ShapeFactory.createArc(init, cent, end); |
456 |
//((FArc2D)geoms[j].getShapes()[0]).setNegativeBulgeFlag(true);
|
457 |
} |
458 |
} |
459 |
FGeometryCollection gc = new FGeometryCollection(geoms);
|
460 |
|
461 |
/*if (dwg.isDwg3DFile()) {
|
462 |
double[][] pline3D = new double[points.length][3];
|
463 |
for (int j=0;j<points.length;j++) {
|
464 |
pline3D[j][0] = points[j].getX();
|
465 |
pline3D[j][1] = points[j].getY();
|
466 |
pline3D[j][2] = elev;
|
467 |
}
|
468 |
pline = points3DToFPolyline3D(pline3D);
|
469 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
470 |
} else {
|
471 |
pline = points2DToFPolyline2D(points);
|
472 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
473 |
}*/
|
474 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
475 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FGeometryCollection")); |
476 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Polyline2D")); |
477 |
String layerName = dwg.getLayerName(entity);
|
478 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
479 |
int color = entity.getColor();
|
480 |
int colorByLayer = dwg.getColorByLayer(entity);
|
481 |
//if (color==0) color ByBlock
|
482 |
if (color==256) color = colorByLayer; |
483 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
484 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev); |
485 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
486 |
// Attributes
|
487 |
/*for (int j=0;j<nAtt;j++) {
|
488 |
String[] attributes = new String[2];
|
489 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
490 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
491 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
492 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
493 |
}
|
494 |
}*/
|
495 |
addGeometry(gc, auxRow); |
496 |
} |
497 |
/*} else if (entity instanceof DwgPolyline3D && !addingToBlock) {
|
498 |
//System.out.println("Encuentra una Polyline3D ...");
|
499 |
double[][] points3D = ((DwgPolyline3D)entity).getPts();
|
500 |
FPolyline2D pline;
|
501 |
if (points3D!=null) {
|
502 |
if (dwg.isDwg3DFile()) {
|
503 |
double[][] pline3D = new double[points3D.length][3];
|
504 |
pline = points3DToFPolyline3D(points3D);
|
505 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
506 |
} else {
|
507 |
Point2D[] points2D = new Point2D[points3D.length];
|
508 |
for (int j=0;j<points3D.length;j++) {
|
509 |
points2D[j] = new Point2D.Double(points3D[j][0], points3D[j][1]);
|
510 |
}
|
511 |
pline = points2DToFPolyline2D(points2D);
|
512 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
513 |
}
|
514 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
|
515 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Polyline3D"));
|
516 |
String layerName = dwg.getLayerName(entity);
|
517 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName);
|
518 |
int color = entity.getColor();
|
519 |
int colorByLayer = dwg.getColorByLayer(entity);
|
520 |
//if (color==0) color ByBlock
|
521 |
if (color==256) color = colorByLayer;
|
522 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color);
|
523 |
boolean constantElevation = true;
|
524 |
for (int j=0;j<points3D.length;j++) {
|
525 |
if (points3D[j][2]!=points3D[0][2]) {
|
526 |
constantElevation = false;
|
527 |
break;
|
528 |
}
|
529 |
}
|
530 |
if (constantElevation) auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(points3D[0][2]);
|
531 |
else auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
532 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);*/
|
533 |
// Attributes
|
534 |
/*for (int j=0;j<nAtt;j++) {
|
535 |
String[] attributes = new String[2];
|
536 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
537 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
538 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
539 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
540 |
}
|
541 |
}*/
|
542 |
/*addShape(pline, auxRow);
|
543 |
}*/
|
544 |
/*} else if (entity instanceof DwgLwPolyline && !addingToBlock) {
|
545 |
//System.out.println("Encuentra una Lwpolyline ...");
|
546 |
Point2D[] pts = ((DwgLwPolyline)entity).getVertices();
|
547 |
double elev = ((DwgLwPolyline)entity).getElevation();
|
548 |
if (pts!=null) {
|
549 |
FPolyline2D lwpline;
|
550 |
if (dwg.isDwg3DFile()) {
|
551 |
double[][] pline3D = new double[pts.length][3];
|
552 |
for (int j=0;j<pts.length;j++) {
|
553 |
pline3D[j][0] = pts[j].getX();
|
554 |
pline3D[j][1] = pts[j].getY();
|
555 |
pline3D[j][2] = elev;
|
556 |
}
|
557 |
lwpline = points3DToFPolyline3D(pline3D);
|
558 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
559 |
} else {
|
560 |
lwpline = points2DToFPolyline2D(pts);
|
561 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
562 |
}
|
563 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
|
564 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("LwPolyline"));
|
565 |
String layerName = dwg.getLayerName(entity);
|
566 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName);
|
567 |
int color = entity.getColor();
|
568 |
int colorByLayer = dwg.getColorByLayer(entity);
|
569 |
//if (color==0) color ByBlock
|
570 |
if (color==256) color = colorByLayer;
|
571 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color);
|
572 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev);
|
573 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);*/
|
574 |
// Attributes
|
575 |
/*for (int j=0;j<nAtt;j++) {
|
576 |
String[] attributes = new String[2];
|
577 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
578 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
579 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
580 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
581 |
}
|
582 |
}*/
|
583 |
/*addShape(lwpline, auxRow);
|
584 |
}*/
|
585 |
} else if (entity instanceof DwgSolid && !addingToBlock) { |
586 |
//System.out.println("Encuentra un Solid ...");
|
587 |
double[] p1 = ((DwgSolid)entity).getCorner1(); |
588 |
double[] p2 = ((DwgSolid)entity).getCorner2(); |
589 |
double[] p3 = ((DwgSolid)entity).getCorner3(); |
590 |
double[] p4 = ((DwgSolid)entity).getCorner4(); |
591 |
double elev = ((DwgSolid)entity).getElevation();
|
592 |
Point2D[] pts = new Point2D[]{new Point2D.Double(p1[0], p1[1]), new Point2D.Double(p2[0], p2[1]), new Point2D.Double(p4[0], p4[1]), new Point2D.Double(p3[0], p3[1])}; |
593 |
FPolyline2D solid; |
594 |
if (dwg.isDwg3DFile()) {
|
595 |
double[][] pline3D = new double[pts.length][3]; |
596 |
for (int j=0;j<pts.length;j++) { |
597 |
pline3D[j][0] = pts[j].getX();
|
598 |
pline3D[j][1] = pts[j].getY();
|
599 |
pline3D[j][2] = elev;
|
600 |
} |
601 |
solid = points3DToFPolyline3D(pline3D); |
602 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
603 |
} else {
|
604 |
solid = points2DToFPolyline2D(pts); |
605 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D")); |
606 |
} |
607 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
608 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Solid")); |
609 |
String layerName = dwg.getLayerName(entity);
|
610 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
611 |
int color = entity.getColor();
|
612 |
int colorByLayer = dwg.getColorByLayer(entity);
|
613 |
//if (color==0) color ByBlock
|
614 |
if (color==256) color = colorByLayer; |
615 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
616 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev); |
617 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
618 |
// Attributes
|
619 |
/*for (int j=0;j<nAtt;j++) {
|
620 |
String[] attributes = new String[2];
|
621 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
622 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
623 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
624 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
625 |
}
|
626 |
}*/
|
627 |
addShape(solid, auxRow); |
628 |
} else if (entity instanceof DwgLine && !addingToBlock) { |
629 |
//System.out.println("Encuentra una Line ...");
|
630 |
double[] p1 = ((DwgLine)entity).getP1(); |
631 |
Point2D point1 = new Point2D.Double(p1[0], p1[1]); |
632 |
double[] p2 = ((DwgLine)entity).getP2(); |
633 |
Point2D point2 = new Point2D.Double(p2[0], p2[1]); |
634 |
Point2D[] lin = new Point2D[]{point1, point2}; |
635 |
FPolyline2D line; |
636 |
if (dwg.isDwg3DFile() && !((DwgLine)entity).isZflag()) {
|
637 |
double[][] lin3D = new double[2][3]; |
638 |
lin3D[0][0] = lin[0].getX(); |
639 |
lin3D[0][1] = lin[0].getY(); |
640 |
lin3D[0][2] = p1[2]; |
641 |
lin3D[1][0] = lin[1].getX(); |
642 |
lin3D[1][1] = lin[1].getY(); |
643 |
lin3D[1][2] = p2[2]; |
644 |
line = points3DToFPolyline3D(lin3D); |
645 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
646 |
} else if (dwg.isDwg3DFile() && ((DwgLine)entity).isZflag()) { |
647 |
double[][] lin3D = new double[2][3]; |
648 |
lin3D[0][0] = lin[0].getX(); |
649 |
lin3D[0][1] = lin[0].getY(); |
650 |
lin3D[0][2] = 0.0; |
651 |
lin3D[1][0] = lin[1].getX(); |
652 |
lin3D[1][1] = lin[1].getY(); |
653 |
lin3D[1][2] = 0.0; |
654 |
line = points3DToFPolyline3D(lin3D); |
655 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
656 |
} else {
|
657 |
line = points2DToFPolyline2D(lin); |
658 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D")); |
659 |
} |
660 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
661 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Line")); |
662 |
String layerName = dwg.getLayerName(entity);
|
663 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
664 |
int color = entity.getColor();
|
665 |
int colorByLayer = dwg.getColorByLayer(entity);
|
666 |
//if (color==0) color ByBlock
|
667 |
if (color==256) color = colorByLayer; |
668 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
669 |
if (!((DwgLine)entity).isZflag()) {
|
670 |
if (p1[2]==p2[2]) auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(p1[2]); |
671 |
else auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
672 |
} else {
|
673 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
674 |
} |
675 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
676 |
// Attributes
|
677 |
/*for (int j=0;j<nAtt;j++) {
|
678 |
String[] attributes = new String[2];
|
679 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
680 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
681 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
682 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
683 |
}
|
684 |
}*/
|
685 |
addShape(line, auxRow); |
686 |
} else if (entity instanceof DwgPoint && !addingToBlock) { |
687 |
//System.out.println("Encuentra un Point ...");
|
688 |
double[] p = ((DwgPoint)entity).getPoint(); |
689 |
FPoint2D point; |
690 |
if (dwg.isDwg3DFile()) {
|
691 |
point = new FPoint3D(p[0], p[1], p[2]); |
692 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
693 |
} else {
|
694 |
point = new FPoint2D(p[0], p[1]); |
695 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
696 |
} |
697 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
698 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Point")); |
699 |
String layerName = dwg.getLayerName(entity);
|
700 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
701 |
int color = entity.getColor();
|
702 |
int colorByLayer = dwg.getColorByLayer(entity);
|
703 |
//if (color==0) color ByBlock
|
704 |
if (color==256) color = colorByLayer; |
705 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
706 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(p[2]);
|
707 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
708 |
// Attributes
|
709 |
/*for (int j=0;j<nAtt;j++) {
|
710 |
String[] attributes = new String[2];
|
711 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
712 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
713 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
714 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
715 |
}
|
716 |
}*/
|
717 |
addShape(point, auxRow); |
718 |
} else if (entity instanceof DwgInsert && !addingToBlock) { |
719 |
//System.out.println("Encuentra un Insert ...");
|
720 |
double[] p = ((DwgInsert)entity).getInsertionPoint(); |
721 |
Point2D point = new Point2D.Double(p[0], p[1]); |
722 |
FPoint2D fPoint; |
723 |
double[] scale = ((DwgInsert)entity).getScale(); |
724 |
double rot = ((DwgInsert)entity).getRotation();
|
725 |
int blockHandle = ((DwgInsert)entity).getBlockHeaderHandle();
|
726 |
manageInsert(dwgObjects, point, scale, rot, blockHandle, i, auxRow); |
727 |
if (dwg.isDwg3DFile()) {
|
728 |
fPoint = new FPoint3D(p[0], p[1], p[2]); |
729 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
730 |
} else {
|
731 |
fPoint = new FPoint2D(p[0], p[1]); |
732 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
733 |
} |
734 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
735 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Insert")); |
736 |
String layerName = dwg.getLayerName(entity);
|
737 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
738 |
int color = entity.getColor();
|
739 |
int colorByLayer = dwg.getColorByLayer(entity);
|
740 |
//if (color==0) color ByBlock
|
741 |
if (color==256) color = colorByLayer; |
742 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
743 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(p[2]);
|
744 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
745 |
// Attributes
|
746 |
/*for (int j=0;j<nAtt;j++) {
|
747 |
String[] attributes = new String[2];
|
748 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
749 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
750 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
751 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
752 |
}
|
753 |
}*/
|
754 |
addShape(fPoint, auxRow); |
755 |
} else if (entity instanceof DwgMText && !addingToBlock) { |
756 |
//System.out.println("Encuentra un MText ...");
|
757 |
double[] p = ((DwgMText)entity).getInsertionPoint(); |
758 |
FPoint2D fPoint; |
759 |
if (dwg.isDwg3DFile()) {
|
760 |
fPoint = new FPoint3D(p[0], p[1], p[2]); |
761 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
762 |
} else {
|
763 |
fPoint = new FPoint2D(p[0], p[1]); |
764 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
765 |
} |
766 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
767 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("MText")); |
768 |
String layerName = dwg.getLayerName(entity);
|
769 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
770 |
int color = entity.getColor();
|
771 |
int colorByLayer = dwg.getColorByLayer(entity);
|
772 |
//if (color==0) color ByBlock
|
773 |
if (color==256) color = colorByLayer; |
774 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
775 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(p[2]);
|
776 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
777 |
// Attributes
|
778 |
/*for (int j=0;j<nAtt;j++) {
|
779 |
String[] attributes = new String[2];
|
780 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
781 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
782 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
783 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
784 |
}
|
785 |
}*/
|
786 |
addShape(fPoint, auxRow); |
787 |
} else if (entity instanceof DwgAttrib && !addingToBlock) { |
788 |
//System.out.println("Encuentra un Attrib ...");
|
789 |
} else if (entity instanceof DwgText && !addingToBlock) { |
790 |
//System.out.println("Encuentra un Text ...");
|
791 |
Point2D p = ((DwgText)entity).getInsertionPoint();
|
792 |
int dflag = ((DwgText)entity).getDataFlag();
|
793 |
double elev = 0.0; |
794 |
if ((dflag & 0x1)==0) elev = ((DwgText)entity).getElevation(); |
795 |
FPoint2D point; |
796 |
if (dwg.isDwg3DFile()) {
|
797 |
point = new FPoint3D(p.getX(), p.getY(), elev);
|
798 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
799 |
} else {
|
800 |
point = new FPoint2D(p.getX(), p.getY());
|
801 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
802 |
} |
803 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
804 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Text")); |
805 |
String layerName = dwg.getLayerName(entity);
|
806 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
807 |
int color = entity.getColor();
|
808 |
int colorByLayer = dwg.getColorByLayer(entity);
|
809 |
//if (color==0) color ByBlock
|
810 |
if (color==256) color = colorByLayer; |
811 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
812 |
String text = ((DwgText)entity).getText();
|
813 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createValue(new String(text)); |
814 |
heightText = (float)((DwgText)entity).getHeight();
|
815 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(heightText); |
816 |
if ((dflag & 0x8) == 0) { |
817 |
double textRot = ((DwgText)entity).getRotationAngle();
|
818 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(Math.toDegrees(textRot));
|
819 |
} else {
|
820 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0);
|
821 |
} |
822 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev); |
823 |
double thickness = ((DwgText)entity).getThickness();
|
824 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(thickness); |
825 |
// Attributes
|
826 |
/*for (int j=0;j<nAtt;j++) {
|
827 |
String[] attributes = new String[2];
|
828 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
829 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
830 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
831 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
832 |
}
|
833 |
}*/
|
834 |
addShape(point, auxRow); |
835 |
} else if (entity instanceof DwgBlock) { |
836 |
//System.out.println("Encuentra un Block ...");
|
837 |
addingToBlock = true;
|
838 |
String blockName = ((DwgBlock)entity).getName();
|
839 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
840 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block")); |
841 |
String layerName = dwg.getLayerName(entity);
|
842 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
843 |
int color = entity.getColor();
|
844 |
int colorByLayer = dwg.getColorByLayer(entity);
|
845 |
//if (color==0) color ByBlock
|
846 |
if (color==256) color = colorByLayer; |
847 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
848 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
849 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
850 |
// Attributes
|
851 |
/*for (int j=0;j<nAtt;j++) {
|
852 |
String[] attributes = new String[2];
|
853 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
854 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
855 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
856 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
857 |
}
|
858 |
}*/
|
859 |
//addShape(point, auxRow);
|
860 |
} else if (entity instanceof DwgEndblk) { |
861 |
//System.out.println("Encuentra un Endblk ...");
|
862 |
addingToBlock = false;
|
863 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
864 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("EndBlk")); |
865 |
String layerName = dwg.getLayerName(entity);
|
866 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
867 |
int color = entity.getColor();
|
868 |
int colorByLayer = dwg.getColorByLayer(entity);
|
869 |
//if (color==0) color ByBlock
|
870 |
if (color==256) color = colorByLayer; |
871 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
872 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
873 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
874 |
// Attributes
|
875 |
/*for (int j=0;j<nAtt;j++) {
|
876 |
String[] attributes = new String[2];
|
877 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
878 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
879 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
880 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
881 |
}
|
882 |
}*/
|
883 |
//addShape(point, auxRow);
|
884 |
} else if (entity instanceof DwgBlockControl) { |
885 |
//System.out.println("Encuentra un Block Control Object ...");
|
886 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
887 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block Control Object")); |
888 |
String layerName = dwg.getLayerName(entity);
|
889 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
890 |
int color = entity.getColor();
|
891 |
int colorByLayer = dwg.getColorByLayer(entity);
|
892 |
//if (color==0) color ByBlock
|
893 |
if (color==256) color = colorByLayer; |
894 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
895 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
896 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
897 |
// Attributes
|
898 |
/*for (int j=0;j<nAtt;j++) {
|
899 |
String[] attributes = new String[2];
|
900 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
901 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
902 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
903 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
904 |
}
|
905 |
}*/
|
906 |
//addShape(point, auxRow);
|
907 |
} else if (entity instanceof DwgBlockHeader) { |
908 |
//System.out.println("Encuentra un Block Header ...");
|
909 |
addingToBlock = true;
|
910 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
911 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Block Header")); |
912 |
String layerName = dwg.getLayerName(entity);
|
913 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
914 |
int color = entity.getColor();
|
915 |
int colorByLayer = dwg.getColorByLayer(entity);
|
916 |
//if (color==0) color ByBlock
|
917 |
if (color==256) color = colorByLayer; |
918 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
919 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
920 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
921 |
// Attributes
|
922 |
/*for (int j=0;j<nAtt;j++) {
|
923 |
String[] attributes = new String[2];
|
924 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
925 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
926 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
927 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
928 |
}
|
929 |
}*/
|
930 |
//addShape(point, auxRow);
|
931 |
} else if (entity instanceof DwgAttdef && !addingToBlock) { |
932 |
//System.out.println("Encuentra un Attdef ...");
|
933 |
} else {
|
934 |
//System.out.println("Detectado dwgObject pendiente de implementar");
|
935 |
} |
936 |
} |
937 |
t2 = System.currentTimeMillis();
|
938 |
System.out.println("Tiempo empleado por el driver en importar el contenido del dwg = " + (t2-t1)); |
939 |
|
940 |
defaultLegend = LegendFactory.createVectorialUniqueValueLegend(getShapeType()); |
941 |
defaultLegend.setFieldName("Color");
|
942 |
defaultLegend.setLabelField("Text");
|
943 |
defaultLegend.setDefaultSymbol(new FSymbol(getShapeType()));
|
944 |
defaultLegend.getDefaultSymbol().setShapeVisible(false);
|
945 |
defaultLegend.getDefaultSymbol().setFontSizeInPixels(false);
|
946 |
defaultLegend.getDefaultSymbol().setFont(new Font("SansSerif", Font.PLAIN, 9)); |
947 |
defaultLegend.getDefaultSymbol().setFontColor(Color.BLACK);
|
948 |
defaultLegend.getDefaultSymbol().setFontSize(heightText); |
949 |
defaultLegend.getDefaultSymbol().setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL); |
950 |
defaultLegend.getDefaultSymbol().setSize(3);
|
951 |
defaultLegend.getDefaultSymbol().setSizeInPixels(true);
|
952 |
|
953 |
defaultLegend.setLabelHeightField("HeightText");
|
954 |
defaultLegend.setLabelRotationField("RotationText");
|
955 |
|
956 |
ReadDriver rs = this;
|
957 |
IntValue clave; |
958 |
FSymbol theSymbol = null;
|
959 |
|
960 |
try {
|
961 |
// Provisional hasta que cambiemos los s?mbolos.
|
962 |
/* BufferedImage bi= new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB);
|
963 |
Graphics2D big = bi.createGraphics();
|
964 |
Color color=new Color(0,0,0,0);
|
965 |
big.setBackground(color);
|
966 |
big.clearRect(0, 0, 5, 5);
|
967 |
Paint fillProv = null;
|
968 |
Rectangle2D rProv = new Rectangle();
|
969 |
rProv.setFrame(0, 0,5,5);
|
970 |
fillProv = new TexturePaint(bi,rProv); */
|
971 |
|
972 |
for (long j = 0; j < rs.getRowCount(); j++) |
973 |
{ |
974 |
clave = (IntValue)rs.getFieldValue(j,ID_FIELD_COLOR); |
975 |
if (defaultLegend.getSymbolByValue(clave) == null) |
976 |
{ |
977 |
theSymbol = new FSymbol(getShapeType());
|
978 |
theSymbol.setDescription(clave.toString()); |
979 |
theSymbol.setColor(AcadColor.getColor(clave.getValue())); |
980 |
// theSymbol.setFill(fillProv);
|
981 |
// 050202, jmorell: Asigna los colores de Autocad a los bordes
|
982 |
// de los pol?gonos.
|
983 |
theSymbol.setOutlineColor(AcadColor.getColor(clave.getValue())); |
984 |
|
985 |
theSymbol.setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL); |
986 |
theSymbol.setSize(3);
|
987 |
theSymbol.setSizeInPixels(true);
|
988 |
|
989 |
defaultLegend.addSymbol(clave, theSymbol); |
990 |
} |
991 |
} // for
|
992 |
} catch (DriverException e) {
|
993 |
e.printStackTrace(); |
994 |
throw new IOException("Error al poner la leyenda por defecto en el Dwg"); |
995 |
} |
996 |
}catch (Exception e){ ///TODO Esta excepci?n es solo para el piloto. |
997 |
e.printStackTrace(); |
998 |
//throw new DXFFormatException(e);
|
999 |
} |
1000 |
} |
1001 |
|
1002 |
/**
|
1003 |
* Method that changes a Point2D array to a FPolyline2D. Is useful to convert a
|
1004 |
* polyline given by it points to a FPolyline2D, a polyline in the FMap model
|
1005 |
* object
|
1006 |
*
|
1007 |
* @param pts Array of Point2D that defines the polyline that will be converted in
|
1008 |
* a FPolyline2D
|
1009 |
* @return FPolyline2D This FPolyline2D is build using the array of Point2D that
|
1010 |
* is the argument of the method
|
1011 |
*/
|
1012 |
private FPolyline2D points2DToFPolyline2D(Point2D[] pts) { |
1013 |
GeneralPathX genPathX = new GeneralPathX();
|
1014 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
1015 |
for (int i=1; i<pts.length; i++) { |
1016 |
genPathX.lineTo(pts[i].getX(), pts[i].getY()); |
1017 |
} |
1018 |
return new FPolyline2D(genPathX); |
1019 |
} |
1020 |
|
1021 |
/**
|
1022 |
* Method that changes a Point3D array to a FPolyline3D. Is useful to convert a
|
1023 |
* polyline given by it points to a FPolyline3D, a polyline 3D in the FMap model
|
1024 |
* object
|
1025 |
*
|
1026 |
* @param pts Array of Point3D that defines the polyline 3D that will be converted in
|
1027 |
* a FPolyline3D
|
1028 |
* @return FPolyline3D This FPolyline3D is build using the array of Point3D that
|
1029 |
* is the argument of the method
|
1030 |
*/
|
1031 |
private FPolyline3D points3DToFPolyline3D(double[][] pts) { |
1032 |
GeneralPathX genPathX = new GeneralPathX();
|
1033 |
genPathX.moveTo(pts[0][0], pts[0][1]); |
1034 |
for (int i=1; i<pts.length; i++) { |
1035 |
genPathX.lineTo(pts[i][0], pts[i][1]); |
1036 |
} |
1037 |
double[] elevations = new double[pts.length]; |
1038 |
for (int i=0;i<pts.length;i++) { |
1039 |
elevations[i] = pts[i][2];
|
1040 |
} |
1041 |
return new FPolyline3D(genPathX, elevations); |
1042 |
} |
1043 |
|
1044 |
/**
|
1045 |
* Method that changes a Point2D array to a FPolygon2D. Is useful to convert a
|
1046 |
* polygon given by it points to a FPolygon2D, a polygon in the FMap model
|
1047 |
* object
|
1048 |
*
|
1049 |
* @param pts Array of Point2D that defines the polygon that will be converted in
|
1050 |
* a FPolygon2D
|
1051 |
* @return FPolygon2D This FPolygon2D is build using the array of Point2D that
|
1052 |
* is the argument of the method
|
1053 |
*/
|
1054 |
private FPolygon2D points2DToFPolygon2D(Point2D[] pts) { |
1055 |
GeneralPathX genPathX = new GeneralPathX();
|
1056 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
1057 |
for (int i=1; i<pts.length; i++) { |
1058 |
genPathX.lineTo(pts[i].getX(), pts[i].getY()); |
1059 |
} |
1060 |
genPathX.closePath(); |
1061 |
return new FPolygon2D(genPathX); |
1062 |
} |
1063 |
|
1064 |
private void manageInsert(Vector dwgObjects, Point2D insPoint, double[] scale, double rot, int bHandle, int id, Value[] auxRow) { |
1065 |
for (int i=0;i<dwgObjects.size();i++) { |
1066 |
DwgObject obj = (DwgObject)dwgObjects.get(i); |
1067 |
if (obj instanceof DwgBlockHeader) { |
1068 |
int objHandle = ((DwgBlockHeader)obj).getHandle();
|
1069 |
if (objHandle==bHandle) {
|
1070 |
double[] bPoint = ((DwgBlockHeader)obj).getBasePoint(); |
1071 |
String bname = ((DwgBlockHeader)obj).getName();
|
1072 |
if (!bname.startsWith("*")) { |
1073 |
int firstObjectHandle = ((DwgBlockHeader)obj).getFirstEntityHandle();
|
1074 |
int lastObjectHandle = ((DwgBlockHeader)obj).getLastEntityHandle();
|
1075 |
DwgBlock block = null;
|
1076 |
for (int j=0;j<dwgObjects.size();j++) { |
1077 |
DwgObject ent = (DwgObject)dwgObjects.get(j); |
1078 |
if (ent instanceof DwgBlock) { |
1079 |
String name = ((DwgBlock)ent).getName();
|
1080 |
if (bname.equals(name)) {
|
1081 |
block = (DwgBlock)ent; |
1082 |
break;
|
1083 |
} |
1084 |
} |
1085 |
} |
1086 |
for (int j=0;j<dwgObjects.size();j++) { |
1087 |
DwgObject fObj = (DwgObject)dwgObjects.get(j); |
1088 |
if (fObj!=null) { |
1089 |
int fObjHandle = fObj.getHandle();
|
1090 |
if (fObjHandle==firstObjectHandle) {
|
1091 |
int k=0; |
1092 |
while (true) { |
1093 |
DwgObject iObj = (DwgObject)dwgObjects.get(j+k); |
1094 |
int iObjHandle = iObj.getHandle();
|
1095 |
manageBlockEntity(iObj, bPoint, insPoint, scale, rot, block, id, auxRow); |
1096 |
k++; |
1097 |
if (iObjHandle==lastObjectHandle) break; |
1098 |
} |
1099 |
} |
1100 |
} |
1101 |
} |
1102 |
} |
1103 |
} |
1104 |
} |
1105 |
} |
1106 |
} |
1107 |
private void manageBlockEntity(DwgObject entity, double[] bPoint, Point2D insPoint, double[] scale, double rot, DwgObject block, int id, Value[] auxRow) { |
1108 |
if (entity instanceof DwgArc) { |
1109 |
//System.out.println("Encuentra un arco dentro de un bloque ...");
|
1110 |
double[] c = ((DwgArc)entity).getCenter(); |
1111 |
Point2D center = new Point2D.Double(c[0], c[1]); |
1112 |
double r = ((DwgArc)entity).getRadius();
|
1113 |
double empieza = Math.toDegrees(((DwgArc)entity).getInitAngle()); |
1114 |
double acaba = Math.toDegrees(((DwgArc)entity).getEndAngle()); |
1115 |
int iempieza = (int)empieza; |
1116 |
int iacaba = (int)acaba; |
1117 |
Point2D[] pts = null; |
1118 |
double angulo = 0; |
1119 |
if (empieza <= acaba) {
|
1120 |
pts = new Point2D[(iacaba-iempieza)+2]; |
1121 |
angulo = empieza; |
1122 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1123 |
for (int j=1; j<=(iacaba-iempieza)+1; j++) { |
1124 |
angulo = (double)(iempieza+j);
|
1125 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1126 |
} |
1127 |
angulo = acaba; |
1128 |
pts[(iacaba-iempieza)+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1129 |
} else {
|
1130 |
pts = new Point2D[(360-iempieza)+iacaba+2]; |
1131 |
angulo = empieza; |
1132 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1133 |
for (int j=1; j<=(360-iempieza); j++) { |
1134 |
angulo = (double)(iempieza+j);
|
1135 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1136 |
} |
1137 |
for (int j=(360-iempieza)+1; j<=(360-iempieza)+iacaba; j++) { |
1138 |
angulo = (double)(j-(360-iempieza)); |
1139 |
pts[j] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1140 |
} |
1141 |
angulo = acaba; |
1142 |
pts[(360-iempieza)+iacaba+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1143 |
} |
1144 |
for (int i=0;i<pts.length;i++) { |
1145 |
Point2D pointAux = new Point2D.Double(pts[i].getX() - bPoint[0], pts[i].getY() - bPoint[1]); |
1146 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
1147 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
1148 |
pts[i] = new Point2D.Double(laX, laY); |
1149 |
} |
1150 |
Point2D pc = pts[(pts.length)/2]; |
1151 |
Point2D in = pts[0]; |
1152 |
Point2D e = pts[pts.length-1]; |
1153 |
if (pc.getX()==e.getX() && pc.getY()==e.getY()) {
|
1154 |
double middleAngle = (empieza+acaba)/2; |
1155 |
if (empieza>acaba) {
|
1156 |
acaba = acaba + 360;
|
1157 |
double a = acaba - empieza;
|
1158 |
double mangle = a/2; |
1159 |
middleAngle = empieza + mangle; |
1160 |
} |
1161 |
pc = new Point2D.Double(center.getX()+r*Math.sin(middleAngle), center.getY()+r*Math.cos(middleAngle)); |
1162 |
} |
1163 |
Arc2D arco = TrigonometricalFunctions.createArc(in, pc, e);
|
1164 |
FArc2D fArc = new FArc2D(new GeneralPathX(arco),in,pc,e); |
1165 |
/*if (dwg.isDwg3DFile()) {
|
1166 |
double[][] arc3D = new double[pts.length][3];
|
1167 |
for (int j=0;j<pts.length;j++) {
|
1168 |
arc3D[j][0] = pts[j].getX();
|
1169 |
arc3D[j][1] = pts[j].getY();
|
1170 |
arc3D[j][2] = c[2];
|
1171 |
}
|
1172 |
arcc = points3DToFPolyline3D(arc3D);
|
1173 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
1174 |
} else {
|
1175 |
arcc = points2DToFPolyline2D(arc);
|
1176 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
1177 |
}*/
|
1178 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(id); |
1179 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FArc2D")); |
1180 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Arc")); |
1181 |
String layerName = dwg.getLayerName(entity);
|
1182 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
1183 |
int color = entity.getColor();
|
1184 |
int colorByLayer = dwg.getColorByLayer(entity);
|
1185 |
// TODO: if (color==0) color ByBlock
|
1186 |
if (color==256) color = colorByLayer; |
1187 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
1188 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(c[2]);
|
1189 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
1190 |
// Attributes
|
1191 |
//for (int j=0;j<nAtt;j++) {
|
1192 |
// String[] attributes = new String[2];
|
1193 |
// attributes = (String[])featureMaker.getAttributes().get(j);
|
1194 |
// auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
1195 |
// if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
1196 |
// auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
1197 |
// }
|
1198 |
//}
|
1199 |
addShape(fArc, auxRow); |
1200 |
} else if (entity instanceof DwgCircle) { |
1201 |
//System.out.println("Encuentra un c?rculo dentro de un bloque ...");
|
1202 |
double[] c = ((DwgCircle)entity).getCenter(); |
1203 |
Point2D center = new Point2D.Double(c[0], c[1]); |
1204 |
double r = ((DwgCircle)entity).getRadius();
|
1205 |
Point2D pointAux = new Point2D.Double(c[0] - bPoint[0], c[1] - bPoint[1]); |
1206 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(Math.toRadians(rot)) + (pointAux.getY()*scale[1])*(-1)*Math.sin(Math.toRadians(rot))); |
1207 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(Math.toRadians(rot)) + (pointAux.getY()*scale[1])*Math.cos(Math.toRadians(rot))); |
1208 |
Point2D cen = new Point2D.Double(laX, laY); |
1209 |
r = r * scale[0];
|
1210 |
Arc2D.Double arc = new Arc2D.Double(cen.getX()-r , cen.getY()-r , 2*r , 2*r , 0 , 360 , Arc2D.OPEN); |
1211 |
FCircle2D fCircle = new FCircle2D(new GeneralPathX(arc),cen,r); |
1212 |
/*if (dwg.isDwg3DFile()) {
|
1213 |
double[][] arc3D = new double[arc.length][3];
|
1214 |
for (int j=0;j<arc.length;j++) {
|
1215 |
arc3D[j][0] = arc[j].getX();
|
1216 |
arc3D[j][1] = arc[j].getY();
|
1217 |
arc3D[j][2] = c[2];
|
1218 |
}
|
1219 |
arcc = points3DToFPolyline3D(arc3D);
|
1220 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
1221 |
} else {
|
1222 |
arcc = points2DToFPolyline2D(arc);
|
1223 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
1224 |
}*/
|
1225 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(id); |
1226 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FCircle2D")); |
1227 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Circle")); |
1228 |
String layerName = dwg.getLayerName(entity);
|
1229 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
1230 |
int color = entity.getColor();
|
1231 |
int colorByLayer = dwg.getColorByLayer(entity);
|
1232 |
//if (color==0) color ByBlock
|
1233 |
if (color==256) color = colorByLayer; |
1234 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
1235 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(c[2]);
|
1236 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
1237 |
// Attributes
|
1238 |
/*for (int j=0;j<nAtt;j++) {
|
1239 |
String[] attributes = new String[2];
|
1240 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
1241 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
1242 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
1243 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
1244 |
}
|
1245 |
}*/
|
1246 |
addShape(fCircle, auxRow); |
1247 |
} else if (entity instanceof DwgLine) { |
1248 |
//System.out.println("Encuentra una l?nea dentro de un bloque ...");
|
1249 |
double[] p1 = ((DwgLine)entity).getP1(); |
1250 |
double[] p2 = ((DwgLine)entity).getP2(); |
1251 |
Point2D pointAux = new Point2D.Double(p1[0] - bPoint[0], p1[1] - bPoint[1]); |
1252 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
1253 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
1254 |
Point2D pp1 = new Point2D.Double(laX, laY); |
1255 |
pointAux = new Point2D.Double(p2[0] - bPoint[0], p2[1] - bPoint[1]); |
1256 |
laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
1257 |
laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
1258 |
Point2D pp2 = new Point2D.Double(laX, laY); |
1259 |
Point2D[] lin = new Point2D[]{pp1, pp2}; |
1260 |
FPolyline2D line; |
1261 |
if (dwg.isDwg3DFile() && !((DwgLine)entity).isZflag()) {
|
1262 |
double[][] lin3D = new double[2][3]; |
1263 |
lin3D[0][0] = lin[0].getX(); |
1264 |
lin3D[0][1] = lin[0].getY(); |
1265 |
lin3D[0][2] = p1[2]; |
1266 |
lin3D[1][0] = lin[1].getX(); |
1267 |
lin3D[1][1] = lin[1].getY(); |
1268 |
lin3D[1][2] = p2[2]; |
1269 |
line = points3DToFPolyline3D(lin3D); |
1270 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
1271 |
} else if (dwg.isDwg3DFile() && ((DwgLine)entity).isZflag()) { |
1272 |
double[][] lin3D = new double[2][3]; |
1273 |
lin3D[0][0] = lin[0].getX(); |
1274 |
lin3D[0][1] = lin[0].getY(); |
1275 |
lin3D[0][2] = 0.0; |
1276 |
lin3D[1][0] = lin[1].getX(); |
1277 |
lin3D[1][1] = lin[1].getY(); |
1278 |
lin3D[1][2] = 0.0; |
1279 |
line = points3DToFPolyline3D(lin3D); |
1280 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
1281 |
} else {
|
1282 |
line = points2DToFPolyline2D(lin); |
1283 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D")); |
1284 |
} |
1285 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(id); |
1286 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Line")); |
1287 |
String layerName = dwg.getLayerName(entity);
|
1288 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
1289 |
int color = entity.getColor();
|
1290 |
int colorByLayer = dwg.getColorByLayer(entity);
|
1291 |
//if (color==0) color ByBlock
|
1292 |
if (color==256) color = colorByLayer; |
1293 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
1294 |
if (!((DwgLine)entity).isZflag()) {
|
1295 |
if (p1[2]==p2[2]) auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(p1[2]); |
1296 |
else auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0); |
1297 |
} else {
|
1298 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
1299 |
} |
1300 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
1301 |
// Attributes
|
1302 |
/*for (int j=0;j<nAtt;j++) {
|
1303 |
String[] attributes = new String[2];
|
1304 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
1305 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
1306 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
1307 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
1308 |
}
|
1309 |
}*/
|
1310 |
addShape(line, auxRow); |
1311 |
} else if (entity instanceof DwgPolyline2D) { |
1312 |
//System.out.println("Encuentra una polil?nea dentro de un bloque ...");
|
1313 |
Point2D[] points = ((DwgPolyline2D)entity).getPts(); |
1314 |
double elev = ((DwgPolyline2D)entity).getElevation();
|
1315 |
FPolyline2D pline; |
1316 |
if (points!=null) { |
1317 |
Point2D[] newPoints = new Point2D[points.length]; |
1318 |
for (int i=0;i<points.length;i++) { |
1319 |
Point2D pointAux = new Point2D.Double(points[i].getX() - bPoint[0], points[i].getY() - bPoint[1]); |
1320 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
1321 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
1322 |
newPoints[i] = new Point2D.Double(laX, laY); |
1323 |
} |
1324 |
|
1325 |
((DwgPolyline2D)entity).setPts(newPoints); |
1326 |
int vertexNumber = points.length;
|
1327 |
int geomNumber = 0; |
1328 |
int flag = ((DwgPolyline2D)entity).getFlags();
|
1329 |
if (flag==0 || flag==2 || flag==4 || flag==8 || flag==16 || flag==32 || flag==64 || flag==128) { |
1330 |
geomNumber = vertexNumber-1;
|
1331 |
} else if (flag==1 || flag==3 || flag==5 || flag==9 || flag==17 || flag==33 || flag==65 || flag==129) { |
1332 |
geomNumber = vertexNumber; |
1333 |
} |
1334 |
IGeometry[] geoms = new IGeometry[geomNumber]; |
1335 |
for (int j=0;j<geomNumber;j++) { |
1336 |
Point2D init = (Point2D)((DwgPolyline2D)entity).getPts()[j]; |
1337 |
Point2D end = new Point2D.Double(); |
1338 |
if (j==geomNumber-1 && (flag==1 || flag==129)) { |
1339 |
end = (Point2D)((DwgPolyline2D)entity).getPts()[0]; |
1340 |
} else {
|
1341 |
end = (Point2D)((DwgPolyline2D)entity).getPts()[j+1]; |
1342 |
} |
1343 |
//System.out.println("DxfCadDriver.initialize(): dxfPolyline.getBulges().size() = " + dxfPolyline.getBulges().size());
|
1344 |
if (((DwgPolyline2D)entity).getBulges()[j]==0) { |
1345 |
GeneralPathX gp = new GeneralPathX();
|
1346 |
gp.moveTo(init.getX(), init.getY()); |
1347 |
gp.lineTo(end.getX(), end.getY()); |
1348 |
//System.out.println("flag = " + flag);
|
1349 |
//if (j==geomNumber-1 && flag==1) {
|
1350 |
/*Point2D first = (Point2D)dxfPolyline.getPts().get(0);
|
1351 |
gp.lineTo(first.getX(), first.getY());*/
|
1352 |
/*System.out.println("Polyline: Cierra el gp.");
|
1353 |
gp.closePath();
|
1354 |
}*/
|
1355 |
geoms[j] = (IGeometry)ShapeFactory.createPolyline2D(gp); |
1356 |
} else if (((DwgPolyline2D)entity).getBulges()[j]>0) { |
1357 |
//IGeometry arc = (IGeometry)ShapeFactory.createArc();
|
1358 |
ArcFromBulgeCalculator arcFromBulgeCalculator = new ArcFromBulgeCalculator(init, end, ((DwgPolyline2D)entity).getBulges()[j]);
|
1359 |
Vector arc = (Vector)arcFromBulgeCalculator.getCentralPoint(); |
1360 |
Point2D cent = (Point2D)arc.get(0); |
1361 |
//System.out.println("init = " + init);
|
1362 |
//System.out.println("cent = " + cent);
|
1363 |
//System.out.println("end = " + end);
|
1364 |
geoms[j] = (IGeometry)ShapeFactory.createArc(init, cent, end); |
1365 |
} else if (((DwgPolyline2D)entity).getBulges()[j]<0) { |
1366 |
//IGeometry arc = (IGeometry)ShapeFactory.createArc();
|
1367 |
ArcFromBulgeCalculator arcFromBulgeCalculator = new ArcFromBulgeCalculator(init, end, ((DwgPolyline2D)entity).getBulges()[j]);
|
1368 |
Vector arc = (Vector)arcFromBulgeCalculator.getCentralPoint(); |
1369 |
Point2D cent = (Point2D)arc.get(0); |
1370 |
//System.out.println("init = " + init);
|
1371 |
//System.out.println("cent = " + cent);
|
1372 |
//System.out.println("end = " + end);
|
1373 |
geoms[j] = (IGeometry)ShapeFactory.createArc(init, cent, end); |
1374 |
//((FArc2D)geoms[j].getShapes()[0]).setNegativeBulgeFlag(true);
|
1375 |
} |
1376 |
} |
1377 |
FGeometryCollection gc = new FGeometryCollection(geoms);
|
1378 |
((DwgPolyline2D)entity).setPts(points); |
1379 |
|
1380 |
/*if (dwg.isDwg3DFile()) {
|
1381 |
double[][] pline3D = new double[newPoints.length][3];
|
1382 |
for (int j=0;j<newPoints.length;j++) {
|
1383 |
pline3D[j][0] = newPoints[j].getX();
|
1384 |
pline3D[j][1] = newPoints[j].getY();
|
1385 |
pline3D[j][2] = elev;
|
1386 |
}
|
1387 |
pline = points3DToFPolyline3D(pline3D);
|
1388 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D"));
|
1389 |
} else {
|
1390 |
pline = points2DToFPolyline2D(newPoints);
|
1391 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D"));
|
1392 |
}*/
|
1393 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(id); |
1394 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("Polyline2D")); |
1395 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FGeometryCollection")); |
1396 |
String layerName = dwg.getLayerName(entity);
|
1397 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(layerName); |
1398 |
int color = entity.getColor();
|
1399 |
int colorByLayer = dwg.getColorByLayer(entity);
|
1400 |
//if (color==0) color ByBlock
|
1401 |
if (color==256) color = colorByLayer; |
1402 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color); |
1403 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(elev); |
1404 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);
|
1405 |
// Attributes
|
1406 |
/*for (int j=0;j<nAtt;j++) {
|
1407 |
String[] attributes = new String[2];
|
1408 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
1409 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
1410 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
1411 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
1412 |
}
|
1413 |
}*/
|
1414 |
addGeometry(gc, auxRow); |
1415 |
} |
1416 |
} else if (entity instanceof DwgInsert) { |
1417 |
//System.out.println("Encuentra un insert dentro de un bloque ...");
|
1418 |
double[] p = ((DwgInsert)entity).getInsertionPoint(); |
1419 |
Point2D point = new Point2D.Double(p[0], p[1]); |
1420 |
double[] newScale = ((DwgInsert)entity).getScale(); |
1421 |
double newRot = ((DwgInsert)entity).getRotation();
|
1422 |
int newBlockHandle = ((DwgInsert)entity).getBlockHeaderHandle();
|
1423 |
Point2D pointAux = new Point2D.Double(point.getX() - bPoint[0], point.getY() - bPoint[1]); |
1424 |
double laX = insPoint.getX() + ((pointAux.getX()*scale[0])*Math.cos(rot) + (pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
1425 |
double laY = insPoint.getY() + ((pointAux.getX()*scale[0])*Math.sin(rot) + (pointAux.getY()*scale[1])*Math.cos(rot)); |
1426 |
Point2D newInsPoint = new Point2D.Double(laX, laY); |
1427 |
newScale = new double[]{scale[0]*newScale[0], scale[1]*newScale[1], scale[2]*newScale[2]}; |
1428 |
manageInsert(dwgObjects, newInsPoint, newScale, newRot, newBlockHandle, id, auxRow); |
1429 |
/*auxRow[ID_FIELD_ID] = ValueFactory.createValue(0);
|
1430 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String("dxfEntity"));
|
1431 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String("layer"));
|
1432 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(0);
|
1433 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(0.0);
|
1434 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(0.0);*/
|
1435 |
// Attributes
|
1436 |
/*for (int j=0;j<nAtt;j++) {
|
1437 |
String[] attributes = new String[2];
|
1438 |
attributes = (String[])featureMaker.getAttributes().get(j);
|
1439 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
1440 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) {
|
1441 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
1442 |
}
|
1443 |
}*/
|
1444 |
/*FPoint2D fPoint = createPoint(newInsPoint);
|
1445 |
addShape(fPoint, auxRow);*/
|
1446 |
} |
1447 |
} |
1448 |
|
1449 |
/* (non-Javadoc)
|
1450 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#accept(java.io.File)
|
1451 |
*/
|
1452 |
public boolean accept(File f) { |
1453 |
return f.getName().toUpperCase().endsWith("DWG"); |
1454 |
} |
1455 |
|
1456 |
/* (non-Javadoc)
|
1457 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getShapeType()
|
1458 |
*/
|
1459 |
public int getShapeType() { |
1460 |
return FShape.MULTI;
|
1461 |
} |
1462 |
|
1463 |
/* (non-Javadoc)
|
1464 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getName()
|
1465 |
*/
|
1466 |
public String getName() { |
1467 |
return "gvSIG DWG Memory Driver"; |
1468 |
} |
1469 |
|
1470 |
/* (non-Javadoc)
|
1471 |
* @see com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend#getDefaultLegend()
|
1472 |
*/
|
1473 |
public Legend getDefaultLegend() {
|
1474 |
return defaultLegend;
|
1475 |
} |
1476 |
|
1477 |
/* (non-Javadoc)
|
1478 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes()
|
1479 |
*/
|
1480 |
public DriverAttributes getDriverAttributes() {
|
1481 |
return attr;
|
1482 |
} |
1483 |
} |