root / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfFeatureMaker.java @ 469
History | View | Annotate | Download (80.4 KB)
1 |
package org.cresques.px.dxf; |
---|---|
2 |
|
3 |
import org.cresques.cts.ICoordTrans; |
4 |
import org.cresques.cts.IProjection; |
5 |
import org.cresques.geo.Point3D; |
6 |
import org.cresques.geo.Projected; |
7 |
import org.cresques.geo.ViewPortData; |
8 |
import org.cresques.io.DxfFile; |
9 |
import org.cresques.io.DxfGroup; |
10 |
import org.cresques.io.DxfGroupVector; |
11 |
import org.cresques.px.Extent; |
12 |
import org.cresques.px.IObjList; |
13 |
import org.cresques.px.gml.Feature; |
14 |
import org.cresques.px.gml.FeatureCollection; |
15 |
import org.cresques.px.gml.InsPoint; |
16 |
import org.cresques.px.gml.LineString; |
17 |
import org.cresques.px.gml.Point; |
18 |
import org.cresques.px.gml.Polygon; |
19 |
|
20 |
import java.util.HashSet; |
21 |
import java.util.Iterator; |
22 |
import java.util.Set; |
23 |
import java.util.Vector; |
24 |
import java.awt.Graphics2D; |
25 |
import java.awt.geom.GeneralPath; |
26 |
import java.awt.geom.Point2D; |
27 |
|
28 |
public class DxfFeatureMaker implements DxfFile.EntityFactory, Projected { |
29 |
IProjection proj = null;
|
30 |
//Feature lastFeature = null;
|
31 |
Feature lastFeaBordes = null;
|
32 |
Feature lastFeaFondos = null;
|
33 |
boolean isDoubleFeatured = false; |
34 |
FeatureCollection features = null;
|
35 |
double bulge = 0.0; |
36 |
double xtruX=0.0, xtruY=0.0, xtruZ=1.0; |
37 |
int polylineFlag = 0; |
38 |
Point2D firstPt = new Point2D.Double(); |
39 |
Point2D ptAnterior = null; |
40 |
|
41 |
boolean addingToBlock = false; |
42 |
int iterator = 0; |
43 |
FeatureCollection blk = null;
|
44 |
Vector blkList = null; |
45 |
DxfTable layers = null;
|
46 |
|
47 |
private Vector faces = null; |
48 |
private boolean hasFaces = false; |
49 |
private int facesIterador = 1; |
50 |
private Point2D facesFirstPoint = null; |
51 |
|
52 |
private Vector attributes = null; |
53 |
|
54 |
public DxfFeatureMaker(IProjection proj) {
|
55 |
this.proj = proj;
|
56 |
layers = new DxfTable();
|
57 |
features = new FeatureCollection(proj);
|
58 |
blkList = new Vector(); |
59 |
attributes = new Vector(); |
60 |
} |
61 |
|
62 |
public void setAddingToBlock(boolean a) { addingToBlock = a; } |
63 |
|
64 |
public void createLayer(DxfGroupVector v) throws Exception { |
65 |
int color = v.getDataAsInt(62); |
66 |
DxfLayer layer = new DxfLayer(v.getDataAsString(2), Math.abs(v.getDataAsInt(62))); |
67 |
if (color < 0) { |
68 |
layer.isOff = true;
|
69 |
} |
70 |
layer.lType = v.getDataAsString(6);
|
71 |
layer.setFlags(v.getDataAsInt(70));
|
72 |
// compruebo flags
|
73 |
if ((layer.flags & 0x01) == 0x01) { |
74 |
layer.frozen = true;
|
75 |
} |
76 |
if ((layer.flags & 0x02) == 0x02) { |
77 |
layer.frozen = true;
|
78 |
} |
79 |
System.out.println("LAYER color="+layer.getColor()); |
80 |
|
81 |
layers.add(layer); |
82 |
} |
83 |
|
84 |
public void createPolyline(DxfGroupVector grp) throws Exception { |
85 |
LineString lineString = new LineString();
|
86 |
Polygon polygon = new Polygon(); |
87 |
//Feature feature= new Feature();
|
88 |
Feature feaBordes= new Feature();
|
89 |
Feature feaFondos= new Feature();
|
90 |
double x = 0.0, y = 0.0, z = 0.0; |
91 |
int flags = 0; |
92 |
|
93 |
// 041122: Cada polyline tiene asociado un objeto faces distinto.
|
94 |
faces = new Vector(); |
95 |
|
96 |
//feature.setProp("dxfEntity", "Polyline");
|
97 |
feaBordes.setProp("dxfEntity", "Polyline"); |
98 |
feaFondos.setProp("dxfEntity", "Polyline"); |
99 |
if (grp.hasCode(8)) { |
100 |
//feature.setProp("layer", grp.getDataAsString(8));
|
101 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
102 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
103 |
} |
104 |
if (grp.hasCode(39)) { |
105 |
Double doub = new Double(grp.getDataAsDouble(39)); |
106 |
String string = doub.toString();
|
107 |
//feature.setProp("thickness", string);
|
108 |
feaBordes.setProp("thickness", string);
|
109 |
feaFondos.setProp("thickness", string);
|
110 |
} else {
|
111 |
Double doub = new Double(0.0); |
112 |
//feature.setProp("thickness", doub.toString());
|
113 |
feaBordes.setProp("thickness", doub.toString());
|
114 |
feaFondos.setProp("thickness", doub.toString());
|
115 |
} |
116 |
if (grp.hasCode(62)) { |
117 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
118 |
String string = integer.toString();
|
119 |
//feature.setProp("color", string);
|
120 |
feaBordes.setProp("color", string);
|
121 |
feaFondos.setProp("color", string);
|
122 |
feaBordes.setProp("colorByLayer", "false"); |
123 |
feaFondos.setProp("colorByLayer", "false"); |
124 |
} else {
|
125 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
126 |
int clr = layer.colorNumber;
|
127 |
Integer integer = new Integer(clr); |
128 |
String string = integer.toString();
|
129 |
//feature.setProp("color", string);
|
130 |
feaBordes.setProp("color", string);
|
131 |
feaFondos.setProp("color", string);
|
132 |
feaBordes.setProp("colorByLayer", "true"); |
133 |
feaFondos.setProp("colorByLayer", "true"); |
134 |
} |
135 |
if (grp.hasCode(10)) |
136 |
x = grp.getDataAsDouble(10);
|
137 |
if (grp.hasCode(20)) |
138 |
y = grp.getDataAsDouble(20);
|
139 |
if (grp.hasCode(30)) { |
140 |
z = grp.getDataAsDouble(30);
|
141 |
Double doub = new Double(z); |
142 |
String string = doub.toString();
|
143 |
//feature.setProp("elevation", string);
|
144 |
feaBordes.setProp("elevation", string);
|
145 |
feaFondos.setProp("elevation", string);
|
146 |
} else {
|
147 |
Double doub = new Double(0.0); |
148 |
//feature.setProp("elevation", doub.toString());
|
149 |
feaBordes.setProp("elevation", doub.toString());
|
150 |
feaFondos.setProp("elevation", doub.toString());
|
151 |
} |
152 |
if (grp.hasCode(70)) |
153 |
flags = grp.getDataAsInt(70);
|
154 |
if (grp.hasCode(210)) |
155 |
xtruX = grp.getDataAsDouble(210);
|
156 |
if (grp.hasCode(220)) |
157 |
xtruY = grp.getDataAsDouble(220);
|
158 |
if (grp.hasCode(230)) |
159 |
xtruZ = grp.getDataAsDouble(230);
|
160 |
if ((flags & 0x01) == 0x01 || (flags & 0x40) == 0x40) { |
161 |
feaBordes.setGeometry(lineString); |
162 |
feaFondos.setGeometry(polygon); |
163 |
lastFeaBordes = feaBordes; |
164 |
lastFeaFondos = feaFondos; |
165 |
isDoubleFeatured = true;
|
166 |
} else if ((flags & 0x01) == 0x00) { |
167 |
feaBordes.setGeometry(lineString); |
168 |
lastFeaBordes = feaBordes; |
169 |
isDoubleFeatured = false;
|
170 |
} else {
|
171 |
System.out.println("Detectada una Polyline Flag que no corresponde"); |
172 |
System.out.println("a una Polyline corriente, ni a una Closed Polyline"); |
173 |
} |
174 |
} |
175 |
|
176 |
public void endSeq() throws Exception { |
177 |
if (isDoubleFeatured) {
|
178 |
if (lastFeaBordes.getGeometry() instanceof LineString) { |
179 |
Feature feaBordes = lastFeaBordes; |
180 |
Feature feaFondos = lastFeaFondos; |
181 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
182 |
Polygon polygon = (Polygon)feaFondos.getGeometry(); |
183 |
lineString.add(firstPt); |
184 |
// 041103: linea anulada porque hay pol?gonos en los que al final
|
185 |
// a?ade el (0,0). Parece que a?adimos el punto inicial
|
186 |
// del pol?gono una vez pero parece que el pol?gono, por
|
187 |
// el hecho de ser pol?gono, ya se a?ade el punto inicial
|
188 |
// al final, con lo que estamos duplicando el punto inicial
|
189 |
// del pol?gono al final del mismo.
|
190 |
//polygon.add(firstPt);
|
191 |
if (bulge!=0) { |
192 |
|
193 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
194 |
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge); |
195 |
lineString.remove(lineString.pointNr()-1);
|
196 |
lineString.remove(lineString.pointNr()-1);
|
197 |
polygon.remove(lineString.pointNr()-1);
|
198 |
polygon.remove(lineString.pointNr()-1);
|
199 |
if (bulge>0) { |
200 |
for (int i=0; i<arc.size(); i++) { |
201 |
Point2D ptAux = new Point2D.Double(); |
202 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
203 |
lineString.add(ptAux); |
204 |
polygon.add(ptAux); |
205 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
206 |
} |
207 |
} else {
|
208 |
for (int i=arc.size()-1; i>=0; i--) { |
209 |
Point2D ptAux = new Point2D.Double(); |
210 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
211 |
lineString.add(ptAux); |
212 |
polygon.add(ptAux); |
213 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
214 |
} |
215 |
} |
216 |
// 041122
|
217 |
|
218 |
bulge = 0.0;
|
219 |
} |
220 |
|
221 |
if (hasFaces) {
|
222 |
//System.out.println("Sabe que es un poligono.");
|
223 |
//System.out.println("POLYLINE: caras=" +faces.size()+", puntos="+ lineString.pointNr());
|
224 |
LineString ls1 = new LineString();
|
225 |
Polygon pl1 = new Polygon(); |
226 |
LineString ls2 = new LineString();
|
227 |
Polygon pl2 = new Polygon(); |
228 |
LineString ls = new LineString();
|
229 |
Polygon pl = new Polygon(); |
230 |
int [] face; |
231 |
int i0, i1;
|
232 |
Iterator iter = faces.iterator();
|
233 |
while (iter.hasNext()) {
|
234 |
face = (int []) iter.next(); |
235 |
i0 = face[3];
|
236 |
for (int i=0; i<4; i++) { |
237 |
i1 = face[i]; |
238 |
if (i0 > 0) { |
239 |
if ((facesIterador%2)!=0) { |
240 |
//System.out.println("endSeq(): hasFaces = " + hasFaces);
|
241 |
//System.out.println("endSeq(): i0 = " + i0);
|
242 |
//System.out.println("endSeq(): lineString.pointNr() = " + lineString.pointNr());
|
243 |
ls1.add((Point2D)lineString.get(i0-1)); |
244 |
pl1.add((Point2D)polygon.get(i0-1)); |
245 |
//ls1.add((Point2D)lineString.get(Math.abs(i1)-1));
|
246 |
//pl1.add((Point2D)polygon.get(Math.abs(i1)-1));
|
247 |
} else {
|
248 |
ls2.add((Point2D)lineString.get(i0-1)); |
249 |
pl2.add((Point2D)polygon.get(i0-1)); |
250 |
//ls2.add((Point2D)lineString.get(Math.abs(i1)-1));
|
251 |
//pl2.add((Point2D)polygon.get(Math.abs(i1)-1));
|
252 |
} |
253 |
facesIterador = facesIterador + 1;
|
254 |
} |
255 |
i0 = i1; |
256 |
} |
257 |
} |
258 |
facesFirstPoint = new Point2D.Double(ls1.get(0).getX(), ls1.get(0).getY()); |
259 |
for (int i=0;i<ls1.pointNr();i++) { |
260 |
ls.add(ls1.get(i)); |
261 |
pl.add(pl1.get(i)); |
262 |
} |
263 |
for (int i=ls2.pointNr()-1;i>0;i--) { |
264 |
ls.add(ls2.get(i)); |
265 |
pl.add(pl2.get(i)); |
266 |
} |
267 |
ls.add(facesFirstPoint); |
268 |
pl.add(facesFirstPoint); |
269 |
lastFeaBordes.setGeometry(ls); |
270 |
lastFeaFondos.setGeometry(pl); |
271 |
} else {
|
272 |
lastFeaBordes.setGeometry(lineString); |
273 |
lastFeaFondos.setGeometry(polygon); |
274 |
} |
275 |
|
276 |
// 041130: Rellena las props con los atributos.
|
277 |
completeAttributes(lastFeaBordes); |
278 |
completeAttributes(lastFeaFondos); |
279 |
|
280 |
if (addingToBlock == false) { |
281 |
features.add(lastFeaBordes); |
282 |
features.add(lastFeaFondos); |
283 |
} else {
|
284 |
blk.add(lastFeaBordes); |
285 |
blk.add(lastFeaFondos); |
286 |
} |
287 |
lastFeaBordes = null;
|
288 |
lastFeaFondos = null;
|
289 |
} else if (lastFeaBordes.getGeometry() instanceof InsPoint) { |
290 |
// Se trata de un SEQEND despues de un ATTRIB
|
291 |
|
292 |
// 041130: Rellena las props con los atributos.
|
293 |
//completeAttributes(lastFeaBordes);
|
294 |
//completeAttributes(lastFeaFondos);
|
295 |
|
296 |
//System.out.println("endSeq(): lastFeaBordes.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
|
297 |
//System.out.println("endSeq(): lastFeaFondos.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
|
298 |
|
299 |
copyAttributes(lastFeaBordes); |
300 |
|
301 |
gestionaInsert(lastFeaBordes); |
302 |
|
303 |
if (addingToBlock == false) { |
304 |
features.add(lastFeaFondos); |
305 |
} else {
|
306 |
blk.add(lastFeaBordes); |
307 |
} |
308 |
lastFeaBordes = null;
|
309 |
lastFeaFondos = null;
|
310 |
} else {
|
311 |
// Caso no contemplado.
|
312 |
} |
313 |
} else {
|
314 |
if (lastFeaBordes.getGeometry() instanceof LineString) { |
315 |
Feature feaBordes = lastFeaBordes; |
316 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
317 |
if (bulge!=0) { |
318 |
|
319 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
320 |
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge); |
321 |
lineString.remove(lineString.pointNr()-1);
|
322 |
lineString.remove(lineString.pointNr()-1);
|
323 |
if (bulge>0) { |
324 |
for (int i=0; i<arc.size(); i++) { |
325 |
Point2D ptAux = new Point2D.Double(); |
326 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
327 |
lineString.add(ptAux); |
328 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
329 |
} |
330 |
} else {
|
331 |
for (int i=arc.size()-1; i>=0; i--) { |
332 |
Point2D ptAux = new Point2D.Double(); |
333 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
334 |
lineString.add(ptAux); |
335 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
336 |
} |
337 |
} |
338 |
// 041122
|
339 |
|
340 |
bulge = 0.0;
|
341 |
} |
342 |
|
343 |
if (hasFaces) {
|
344 |
//System.out.println("POLYLINE: caras=" +faces.size()+", puntos="+ lineString.pointNr());
|
345 |
LineString ls1 = new LineString();
|
346 |
LineString ls2 = new LineString();
|
347 |
LineString ls = new LineString();
|
348 |
int [] face; |
349 |
int i0, i1;
|
350 |
Iterator iter = faces.iterator();
|
351 |
while (iter.hasNext()) {
|
352 |
face = (int []) iter.next(); |
353 |
i0 = face[3];
|
354 |
for (int i=0; i<4; i++) { |
355 |
i1 = face[i]; |
356 |
if (i0 > 0) { |
357 |
if ((facesIterador%2)!=0) { |
358 |
ls1.add((Point2D)lineString.get(i0-1)); |
359 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
360 |
} else {
|
361 |
ls2.add((Point2D)lineString.get(i0-1)); |
362 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
363 |
} |
364 |
facesIterador = facesIterador + 1;
|
365 |
} |
366 |
i0 = i1; |
367 |
} |
368 |
} |
369 |
facesFirstPoint = new Point2D.Double(ls1.get(0).getX(), ls1.get(0).getY()); |
370 |
for (int i=0;i<ls1.pointNr();i++) { |
371 |
ls.add(ls1.get(i)); |
372 |
} |
373 |
for (int i=ls2.pointNr()-1;i>0;i--) { |
374 |
ls.add(ls2.get(i)); |
375 |
} |
376 |
ls.add(facesFirstPoint); |
377 |
lastFeaBordes.setGeometry(ls); |
378 |
} else {
|
379 |
lastFeaBordes.setGeometry(lineString); |
380 |
} |
381 |
|
382 |
// 041130: Rellena las props con los atributos.
|
383 |
completeAttributes(lastFeaBordes); |
384 |
|
385 |
if (addingToBlock == false) { |
386 |
features.add(lastFeaBordes); |
387 |
} else {
|
388 |
blk.add(lastFeaBordes); |
389 |
} |
390 |
lastFeaBordes = null;
|
391 |
} else {
|
392 |
// Se trata de un SEQEND despues de un ATTRIB
|
393 |
} |
394 |
} |
395 |
xtruX = 0.0;
|
396 |
xtruY = 0.0;
|
397 |
xtruZ = 1.0;
|
398 |
bulge = 0.0;
|
399 |
isDoubleFeatured = false;
|
400 |
hasFaces = false;
|
401 |
facesIterador = 1;
|
402 |
} |
403 |
|
404 |
public void addVertex(DxfGroupVector grp) throws Exception { |
405 |
double x = 0.0, y = 0.0, z = 0.0; |
406 |
int vFlags = 0; |
407 |
if (isDoubleFeatured) {
|
408 |
Feature feaBordes = lastFeaBordes; |
409 |
Feature feaFondos = lastFeaFondos; |
410 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
411 |
Polygon polygon = (Polygon)feaFondos.getGeometry(); |
412 |
if (grp.hasCode(8)) { |
413 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
414 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
415 |
} |
416 |
if (grp.hasCode(70)) { |
417 |
vFlags = grp.getDataAsInt(70);
|
418 |
} |
419 |
x = grp.getDataAsDouble(10);
|
420 |
y = grp.getDataAsDouble(20);
|
421 |
if (grp.hasCode(30)) { |
422 |
z = grp.getDataAsDouble(30);
|
423 |
} |
424 |
Point3D point_in = new Point3D(x, y, z);
|
425 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
426 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
427 |
x = point_out.getX(); |
428 |
y = point_out.getY(); |
429 |
//System.out.println("addVertex(): vFlags = " + vFlags);
|
430 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) { |
431 |
int [] face = {0,0,0,0}; |
432 |
face[0] = grp.getDataAsInt(71); |
433 |
face[1] = grp.getDataAsInt(72); |
434 |
face[2] = grp.getDataAsInt(73); |
435 |
face[3] = grp.getDataAsInt(74); |
436 |
addFace(face); |
437 |
} else if ((vFlags & 0x10) == 0x10) { |
438 |
// Son vertices que se trataran cuando se implementen
|
439 |
// los splines. En principio no se hace nada con ellos.
|
440 |
} else {
|
441 |
Point2D pt = proj.createPoint( x, y);
|
442 |
lineString.add(pt); |
443 |
polygon.add(pt); |
444 |
if (lineString.pointNr() == 1) { |
445 |
firstPt = pt; |
446 |
} |
447 |
if (bulge == 0.0) { |
448 |
if (grp.hasCode(42)) { |
449 |
bulge = grp.getDataAsDouble(42);
|
450 |
} else { bulge = 0.0; } |
451 |
} else {
|
452 |
double bulge_aux = 0.0; |
453 |
if (grp.hasCode(42)) { |
454 |
bulge_aux = grp.getDataAsDouble(42);
|
455 |
} else { bulge_aux = 0.0; } |
456 |
//int cnt = lineString.pointNr();
|
457 |
//System.out.println("addVertex(): lineString.pointNr() = " + lineString.pointNr());
|
458 |
lineString.remove(lineString.pointNr()-1);
|
459 |
lineString.remove(lineString.pointNr()-1);
|
460 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
461 |
polygon.remove(polygon.pointNr()-1);
|
462 |
polygon.remove(polygon.pointNr()-1);
|
463 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
464 |
if (bulge>0) { |
465 |
for (int i=0; i<arc.size(); i++) { |
466 |
Point2D ptAux = new Point2D.Double(); |
467 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
468 |
lineString.add(ptAux); |
469 |
polygon.add(ptAux); |
470 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
471 |
} |
472 |
} else {
|
473 |
for (int i=arc.size()-1; i>=0; i--) { |
474 |
Point2D ptAux = new Point2D.Double(); |
475 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
476 |
lineString.add(ptAux); |
477 |
polygon.add(ptAux); |
478 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
479 |
} |
480 |
} |
481 |
bulge = bulge_aux; |
482 |
} |
483 |
ptAnterior = pt; |
484 |
} |
485 |
} else {
|
486 |
Feature feaBordes = lastFeaBordes; |
487 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
488 |
if (grp.hasCode(8)) |
489 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
490 |
if (grp.hasCode(70)) { |
491 |
vFlags = grp.getDataAsInt(70);
|
492 |
} |
493 |
x = grp.getDataAsDouble(10);
|
494 |
y = grp.getDataAsDouble(20);
|
495 |
if (grp.hasCode(30)) { |
496 |
z = grp.getDataAsDouble(30);
|
497 |
} |
498 |
Point3D point_in = new Point3D(x, y, z);
|
499 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
500 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
501 |
x = point_out.getX(); |
502 |
y = point_out.getY(); |
503 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) { |
504 |
int [] face = {0,0,0,0}; |
505 |
face[0] = grp.getDataAsInt(71); |
506 |
face[1] = grp.getDataAsInt(72); |
507 |
face[2] = grp.getDataAsInt(73); |
508 |
face[3] = grp.getDataAsInt(74); |
509 |
addFace(face); |
510 |
} else if ((vFlags & 16) == 16) { |
511 |
// no se hace nada.
|
512 |
} else {
|
513 |
Point2D pt = proj.createPoint( x, y);
|
514 |
lineString.add(pt); |
515 |
//System.out.println("addVertex: pt = " + pt);
|
516 |
if (lineString.pointNr() == 1) { |
517 |
firstPt = pt; |
518 |
//System.out.println("addVertex(Primer pto de la lineString, firstPt=pt): firstPt = " + firstPt);
|
519 |
} |
520 |
if (bulge == 0.0) { |
521 |
if (grp.hasCode(42)) { |
522 |
bulge = grp.getDataAsDouble(42);
|
523 |
} else { bulge = 0.0; } |
524 |
//System.out.println("addVertex: El vertice anterior tenia bulge=0.0");
|
525 |
} else {
|
526 |
//System.out.println("addVertex: El vertice anterior tiene bulge = " + bulge);
|
527 |
double bulge_aux = 0.0; |
528 |
if (grp.hasCode(42)) { |
529 |
bulge_aux = grp.getDataAsDouble(42);
|
530 |
} else { bulge_aux = 0.0; } |
531 |
//int cnt = lineString.pointNr();
|
532 |
//System.out.println("addVertex: El vertice anterior tenia bulge. Se va a crear el");
|
533 |
//System.out.println("addVertex: arco del ptAnterior al ptActual.");
|
534 |
//System.out.println("addVertex: ptAnterior = " + ptAnterior + ", ptActual = " + pt);
|
535 |
// Borro los puntos inicio y final del arco.
|
536 |
lineString.remove(lineString.pointNr()-1);
|
537 |
lineString.remove(lineString.pointNr()-1);
|
538 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
539 |
if (bulge>0) { |
540 |
for (int i=0; i<arc.size(); i++) { |
541 |
Point2D ptAux = new Point2D.Double(); |
542 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
543 |
lineString.add(ptAux); |
544 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
545 |
} |
546 |
} else {
|
547 |
for (int i=arc.size()-1; i>=0; i--) { |
548 |
Point2D ptAux = new Point2D.Double(); |
549 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
550 |
lineString.add(ptAux); |
551 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
552 |
} |
553 |
} |
554 |
bulge = bulge_aux; |
555 |
} |
556 |
ptAnterior = pt; |
557 |
} |
558 |
} |
559 |
} |
560 |
|
561 |
public void createLwPolyline(DxfGroupVector grp) throws Exception { |
562 |
double x = 0.0, y = 0.0; |
563 |
double elev = 0.0; |
564 |
DxfGroup g = null;
|
565 |
LineString lineString = new LineString();
|
566 |
Polygon polygon = new Polygon(); |
567 |
//Geometry geometria;
|
568 |
//Feature feature= new Feature();
|
569 |
Feature feaBordes= new Feature();
|
570 |
Feature feaFondos= new Feature();
|
571 |
int flags = 0; |
572 |
int NumberOfVertices = 0; |
573 |
|
574 |
//feature.setProp("dxfEntity", "LwPolyline");
|
575 |
feaBordes.setProp("dxfEntity", "LwPolyline"); |
576 |
feaFondos.setProp("dxfEntity", "LwPolyline"); |
577 |
if (grp.hasCode(8)) |
578 |
//feature.setProp("layer", grp.getDataAsString(8));
|
579 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
580 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
581 |
if (grp.hasCode(38)) { |
582 |
elev = grp.getDataAsDouble(38);
|
583 |
Double doub = new Double(elev); |
584 |
String string = doub.toString();
|
585 |
//feature.setProp("elevation", string);
|
586 |
feaBordes.setProp("elevation", string);
|
587 |
feaFondos.setProp("elevation", string);
|
588 |
} else {
|
589 |
Double doub = new Double(0.0); |
590 |
//feature.setProp("elevation", doub.toString());
|
591 |
feaBordes.setProp("elevation", doub.toString());
|
592 |
feaFondos.setProp("elevation", doub.toString());
|
593 |
} |
594 |
if (grp.hasCode(39)) { |
595 |
Double doub = new Double(grp.getDataAsDouble(39)); |
596 |
String string = doub.toString();
|
597 |
//feature.setProp("thickness", string);
|
598 |
feaBordes.setProp("thickness", string);
|
599 |
feaFondos.setProp("thickness", string);
|
600 |
} else {
|
601 |
Double doub = new Double(0.0); |
602 |
//feature.setProp("thickness", doub.toString());
|
603 |
feaBordes.setProp("thickness", doub.toString());
|
604 |
feaFondos.setProp("thickness", doub.toString());
|
605 |
} |
606 |
if (grp.hasCode(62)) { |
607 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
608 |
String string = integer.toString();
|
609 |
//feature.setProp("color", string);
|
610 |
feaBordes.setProp("color", string);
|
611 |
feaFondos.setProp("color", string);
|
612 |
feaBordes.setProp("colorByLayer", "false"); |
613 |
feaFondos.setProp("colorByLayer", "false"); |
614 |
} else {
|
615 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
616 |
int clr = layer.colorNumber;
|
617 |
Integer integer = new Integer(clr); |
618 |
String string = integer.toString();
|
619 |
//feature.setProp("color", string);
|
620 |
feaBordes.setProp("color", string);
|
621 |
feaFondos.setProp("color", string);
|
622 |
feaBordes.setProp("colorByLayer", "true"); |
623 |
feaFondos.setProp("colorByLayer", "true"); |
624 |
} |
625 |
if (grp.hasCode(70)) |
626 |
flags = grp.getDataAsInt(70);
|
627 |
if ((flags & 0x01) == 0x01) { |
628 |
//geometria = new Polygon();
|
629 |
feaBordes.setGeometry(lineString); |
630 |
feaFondos.setGeometry(polygon); |
631 |
isDoubleFeatured = true;
|
632 |
} else {
|
633 |
//geometria = new LineString();
|
634 |
feaBordes.setGeometry(lineString); |
635 |
isDoubleFeatured = false;
|
636 |
} |
637 |
if (grp.hasCode(90)) |
638 |
NumberOfVertices = grp.getDataAsInt(90);
|
639 |
|
640 |
int j = 0; |
641 |
double firstX = 0.0; |
642 |
double firstY = 0.0; |
643 |
boolean hasBulge = false; |
644 |
double bulgeLwp = 0.0; |
645 |
for (int i=0; i<grp.size(); i++) { |
646 |
g = (DxfGroup) grp.get(i); |
647 |
if (g.getCode() == 10) { |
648 |
j++; |
649 |
x = ((Double) g.getData()).doubleValue();
|
650 |
} else if (g.getCode() == 20) { |
651 |
y = ((Double) g.getData()).doubleValue();
|
652 |
//if (y <= 1.0) throw new Exception("Y == "+y);
|
653 |
//lineString.add( proj.createPoint( x, y ) );
|
654 |
//polygon.add( proj.createPoint( x, y ) );
|
655 |
//geometria.add( proj.createPoint( x, y ) );
|
656 |
//lineString.add( proj.createPoint( x, y ) );
|
657 |
//if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
658 |
|
659 |
if (hasBulge) {
|
660 |
Point2D finalPoint = new Point2D.Double(x, y); |
661 |
//lineString.remove(lineString.pointNr()-1);
|
662 |
//lineString.remove(lineString.pointNr()-1);
|
663 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
664 |
//polygon.remove(polygon.pointNr()-1);
|
665 |
//polygon.remove(polygon.pointNr()-1);
|
666 |
Vector arc = createArc(lineString.get(lineString.pointNr()-1), finalPoint, bulgeLwp); |
667 |
lineString.remove(lineString.pointNr()-1);
|
668 |
if (isDoubleFeatured) polygon.remove(polygon.pointNr()-1); |
669 |
if (bulgeLwp>0) { |
670 |
for (int k=0; k<arc.size(); k++) { |
671 |
Point2D ptAux = new Point2D.Double(); |
672 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
673 |
//System.out.println("createLwPolyline: ptAux = " + ptAux);
|
674 |
lineString.add(ptAux); |
675 |
//if (lineString.pointNr() == 1) firstPt = ptAux;
|
676 |
if (isDoubleFeatured) polygon.add(ptAux);
|
677 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
678 |
} |
679 |
} else {
|
680 |
for (int k=arc.size()-1; k>=0; k--) { |
681 |
Point2D ptAux = new Point2D.Double(); |
682 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
683 |
lineString.add(ptAux); |
684 |
if (isDoubleFeatured) polygon.add(ptAux);
|
685 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
686 |
} |
687 |
} |
688 |
hasBulge = false;
|
689 |
bulgeLwp = 0.0;
|
690 |
} else {
|
691 |
//System.out.println("createLwPolyline: hasBulge siempre es false");
|
692 |
lineString.add( proj.createPoint( x, y ) ); |
693 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
694 |
} |
695 |
if (j == 1) { |
696 |
firstX = x; |
697 |
firstY = y; |
698 |
} |
699 |
x = 0.0; y = 0.0; |
700 |
} else if (g.getCode() == 42) { |
701 |
//System.out.println("createLwPolyline: Lee el bulgeLwp");
|
702 |
hasBulge = true;
|
703 |
bulgeLwp = ((Double) g.getData()).doubleValue();
|
704 |
} |
705 |
|
706 |
} |
707 |
if (isDoubleFeatured) {
|
708 |
//geometria.add(proj.createPoint(firstX, firstY));
|
709 |
lineString.add(proj.createPoint(firstX, firstY)); |
710 |
polygon.add(proj.createPoint(firstX, firstY)); |
711 |
} |
712 |
|
713 |
lastFeaBordes = feaBordes; |
714 |
if (isDoubleFeatured) lastFeaFondos = feaFondos;
|
715 |
|
716 |
// 041130: Rellena las props con los atributos.
|
717 |
completeAttributes(lastFeaBordes); |
718 |
completeAttributes(lastFeaFondos); |
719 |
|
720 |
//features.add(feature);
|
721 |
if (addingToBlock == false) { |
722 |
features.add(feaBordes); |
723 |
if (isDoubleFeatured) features.add(feaFondos);
|
724 |
} else {
|
725 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator);
|
726 |
blk.add(feaBordes); |
727 |
if (isDoubleFeatured) blk.add(feaFondos);
|
728 |
} |
729 |
isDoubleFeatured = false;
|
730 |
} |
731 |
|
732 |
public void createLine(DxfGroupVector grp) throws Exception { |
733 |
double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0; |
734 |
double elev = 0.0; |
735 |
DxfGroup g = null;
|
736 |
Point2D pt1 = null, pt2 = null; |
737 |
LineString lineString = new LineString();
|
738 |
Feature feature = new Feature();
|
739 |
|
740 |
feature.setProp("dxfEntity", "Line"); |
741 |
if (grp.hasCode(8)) |
742 |
feature.setProp("layer", grp.getDataAsString(8)); |
743 |
if (grp.hasCode(39)) { |
744 |
Double doub = new Double(grp.getDataAsDouble(39)); |
745 |
String string = doub.toString();
|
746 |
feature.setProp("thickness", string);
|
747 |
} else {
|
748 |
Double doub = new Double(0.0); |
749 |
feature.setProp("thickness", doub.toString());
|
750 |
} |
751 |
if (grp.hasCode(62)) { |
752 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
753 |
String string = integer.toString();
|
754 |
feature.setProp("color", string);
|
755 |
feature.setProp("colorByLayer", "false"); |
756 |
} else {
|
757 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
758 |
int clr = layer.colorNumber;
|
759 |
Integer integer = new Integer(clr); |
760 |
String string = integer.toString();
|
761 |
feature.setProp("color", string);
|
762 |
feature.setProp("colorByLayer", "true"); |
763 |
} |
764 |
x = grp.getDataAsDouble(10);
|
765 |
y = grp.getDataAsDouble(20);
|
766 |
if (grp.hasCode(30)) { |
767 |
z1 = grp.getDataAsDouble(30);
|
768 |
elev = z1; |
769 |
Double doub = new Double(elev); |
770 |
String string = doub.toString();
|
771 |
feature.setProp("elevation", string);
|
772 |
} |
773 |
pt1 = proj.createPoint(x, y); |
774 |
x = grp.getDataAsDouble(11);
|
775 |
y = grp.getDataAsDouble(21);
|
776 |
if (grp.hasCode(31)) { |
777 |
z2 = grp.getDataAsDouble(31);
|
778 |
} else {
|
779 |
// Cuando no se especifican z para las lineas se asume que la
|
780 |
// z es cero.
|
781 |
Double doub = new Double(0.0); |
782 |
feature.setProp("elevation", doub.toString());
|
783 |
} |
784 |
pt2 = proj.createPoint(x, y); |
785 |
if (grp.hasCode(210)) |
786 |
xtruX = grp.getDataAsDouble(210);
|
787 |
if (grp.hasCode(220)) |
788 |
xtruY = grp.getDataAsDouble(220);
|
789 |
if (grp.hasCode(230)) |
790 |
xtruZ = grp.getDataAsDouble(230);
|
791 |
Point3D point_in1 = new Point3D(pt1.getX(), pt1.getY(), z1);
|
792 |
Point3D point_in2 = new Point3D(pt2.getX(), pt2.getY(), z2);
|
793 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
794 |
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
795 |
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
796 |
pt1.setLocation(point_out1); |
797 |
pt2.setLocation(point_out2); |
798 |
lineString.add(pt1); |
799 |
lineString.add(pt2); |
800 |
|
801 |
feature.setGeometry(lineString); |
802 |
|
803 |
// 041130: Rellena las props con los atributos.
|
804 |
completeAttributes(feature); |
805 |
|
806 |
//features.add(feature);
|
807 |
if (addingToBlock == false) { |
808 |
//System.out.println("createLine(): A?adimos una linea a la lista de entidades");
|
809 |
features.add(feature); |
810 |
} else {
|
811 |
//System.out.println("createLine(): A?adimos una linea al bloque " + iterator);
|
812 |
blk.add(feature); |
813 |
} |
814 |
} |
815 |
|
816 |
/* (non-Javadoc)
|
817 |
* @see org.cresques.io.DxfFile.EntityFactory#createText(org.cresques.io.DxfGroupVector)
|
818 |
*/
|
819 |
public void createText(DxfGroupVector grp) throws Exception { |
820 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
821 |
DxfGroup g = null;
|
822 |
Point2D pt1 = null, pt2 = null; |
823 |
Point2D pt = null; |
824 |
Point point = new Point(); |
825 |
|
826 |
point.isText = true;
|
827 |
|
828 |
Feature feature = new Feature();
|
829 |
|
830 |
feature.setProp("dxfEntity", "Text"); |
831 |
if (grp.hasCode(8)) |
832 |
feature.setProp("layer", grp.getDataAsString(8)); |
833 |
if (grp.hasCode(39)) { |
834 |
Double doub = new Double(grp.getDataAsDouble(39)); |
835 |
String string = doub.toString();
|
836 |
feature.setProp("thickness", string);
|
837 |
} else {
|
838 |
Double doub = new Double(0.0); |
839 |
feature.setProp("thickness", doub.toString());
|
840 |
} |
841 |
if (grp.hasCode(62)) { |
842 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
843 |
String string = integer.toString();
|
844 |
feature.setProp("color", string);
|
845 |
feature.setProp("colorByLayer", "false"); |
846 |
} else {
|
847 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
848 |
int clr = layer.colorNumber;
|
849 |
Integer integer = new Integer(clr); |
850 |
String string = integer.toString();
|
851 |
feature.setProp("color", string);
|
852 |
feature.setProp("colorByLayer", "true"); |
853 |
} |
854 |
if (grp.hasCode(1)) { |
855 |
String strAux1 = grp.getDataAsString(1); |
856 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
857 |
feature.setProp("text", strAux1);
|
858 |
} else {
|
859 |
feature.setProp("text", "No Text Code"); |
860 |
} |
861 |
if (grp.hasCode(40)) { |
862 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
863 |
String heightS = heightD.toString();
|
864 |
feature.setProp("textHeight", heightS);
|
865 |
} else {
|
866 |
feature.setProp("textHeight", "20.0"); |
867 |
} |
868 |
if (grp.hasCode(50)) { |
869 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
870 |
String rotS = rotD.toString();
|
871 |
feature.setProp("textRotation", rotS);
|
872 |
//System.out.println("rotS = " + rotS);
|
873 |
} else {
|
874 |
feature.setProp("textRotation", "0.0"); |
875 |
} |
876 |
x = grp.getDataAsDouble(10);
|
877 |
y = grp.getDataAsDouble(20);
|
878 |
if (grp.hasCode(30)){ |
879 |
z = grp.getDataAsDouble(30);
|
880 |
Double doub = new Double(z); |
881 |
String string = doub.toString();
|
882 |
feature.setProp("elevation", string);
|
883 |
} else {
|
884 |
Double doub = new Double(0.0); |
885 |
feature.setProp("elevation", doub.toString());
|
886 |
} |
887 |
if (grp.hasCode(210)) |
888 |
xtruX = grp.getDataAsDouble(210);
|
889 |
if (grp.hasCode(220)) |
890 |
xtruY = grp.getDataAsDouble(220);
|
891 |
if (grp.hasCode(230)) |
892 |
xtruZ = grp.getDataAsDouble(230);
|
893 |
Point3D point_in = new Point3D(x, y, z);
|
894 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
895 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
896 |
x = point_out.getX(); |
897 |
y = point_out.getY(); |
898 |
point.add(new Point2D.Double(x, y)); |
899 |
feature.setGeometry(point); |
900 |
|
901 |
// 041130: Rellena las props con los atributos.
|
902 |
completeAttributes(feature); |
903 |
|
904 |
//features.add(feature);
|
905 |
if (addingToBlock == false) { |
906 |
features.add(feature); |
907 |
} else {
|
908 |
//System.out.println("createText(): A?adimos un text al bloque " + iterator);
|
909 |
blk.add(feature); |
910 |
} |
911 |
} |
912 |
|
913 |
public void createMText(DxfGroupVector grp) throws Exception { |
914 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
915 |
DxfGroup g = null;
|
916 |
Point2D pt1 = null, pt2 = null; |
917 |
Point2D pt = null; |
918 |
Point point = new Point(); |
919 |
|
920 |
point.isText = true;
|
921 |
|
922 |
Feature feature = new Feature();
|
923 |
|
924 |
feature.setProp("dxfEntity", "Text"); |
925 |
if (grp.hasCode(8)) |
926 |
feature.setProp("layer", grp.getDataAsString(8)); |
927 |
if (grp.hasCode(39)) { |
928 |
Double doub = new Double(grp.getDataAsDouble(39)); |
929 |
String string = doub.toString();
|
930 |
feature.setProp("thickness", string);
|
931 |
} else {
|
932 |
Double doub = new Double(0.0); |
933 |
feature.setProp("thickness", doub.toString());
|
934 |
} |
935 |
if (grp.hasCode(62)) { |
936 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
937 |
String string = integer.toString();
|
938 |
feature.setProp("color", string);
|
939 |
feature.setProp("colorByLayer", "false"); |
940 |
} else {
|
941 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
942 |
int clr = layer.colorNumber;
|
943 |
Integer integer = new Integer(clr); |
944 |
String string = integer.toString();
|
945 |
feature.setProp("color", string);
|
946 |
feature.setProp("colorByLayer", "true"); |
947 |
} |
948 |
if (grp.hasCode(1)) { |
949 |
String strAux1 = grp.getDataAsString(1); |
950 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
951 |
feature.setProp("text", strAux1);
|
952 |
} else {
|
953 |
feature.setProp("text", "No Text Code"); |
954 |
} |
955 |
if (grp.hasCode(40)) { |
956 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
957 |
String heightS = heightD.toString();
|
958 |
feature.setProp("textHeight", heightS);
|
959 |
} else {
|
960 |
feature.setProp("textHeight", "20.0"); |
961 |
} |
962 |
if (grp.hasCode(50)) { |
963 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
964 |
String rotS = rotD.toString();
|
965 |
feature.setProp("textRotation", rotS);
|
966 |
//System.out.println("rotS = " + rotS);
|
967 |
} else {
|
968 |
feature.setProp("textRotation", "0.0"); |
969 |
} |
970 |
if (grp.hasCode(71)) { |
971 |
int attachPoint = grp.getDataAsInt(71); |
972 |
if (attachPoint == 1) { |
973 |
} else if (attachPoint == 2) { |
974 |
} else if (attachPoint == 3) { |
975 |
} else if (attachPoint == 4) { |
976 |
} else if (attachPoint == 5) { |
977 |
} else if (attachPoint == 6) { |
978 |
} else if (attachPoint == 7) { |
979 |
} else if (attachPoint == 8) { |
980 |
} else if (attachPoint == 9) { |
981 |
} |
982 |
} |
983 |
if (grp.hasCode(72)) { |
984 |
int drawDirection = grp.getDataAsInt(71); |
985 |
if (drawDirection == 1) { |
986 |
} else if (drawDirection == 3) { |
987 |
} else if (drawDirection == 5) { |
988 |
} |
989 |
} |
990 |
if (grp.hasCode(73)) { |
991 |
int spacingStyle = grp.getDataAsInt(71); |
992 |
if (spacingStyle == 1) { |
993 |
} else if (spacingStyle == 2) { |
994 |
} |
995 |
} |
996 |
x = grp.getDataAsDouble(10);
|
997 |
y = grp.getDataAsDouble(20);
|
998 |
if (grp.hasCode(30)){ |
999 |
z = grp.getDataAsDouble(30);
|
1000 |
Double doub = new Double(z); |
1001 |
String string = doub.toString();
|
1002 |
feature.setProp("elevation", string);
|
1003 |
} else {
|
1004 |
Double doub = new Double(0.0); |
1005 |
feature.setProp("elevation", doub.toString());
|
1006 |
} |
1007 |
if (grp.hasCode(210)) |
1008 |
xtruX = grp.getDataAsDouble(210);
|
1009 |
if (grp.hasCode(220)) |
1010 |
xtruY = grp.getDataAsDouble(220);
|
1011 |
if (grp.hasCode(230)) |
1012 |
xtruZ = grp.getDataAsDouble(230);
|
1013 |
Point3D point_in = new Point3D(x, y, z);
|
1014 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1015 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1016 |
x = point_out.getX(); |
1017 |
y = point_out.getY(); |
1018 |
point.add(new Point2D.Double(x, y)); |
1019 |
feature.setGeometry(point); |
1020 |
|
1021 |
// 041130: Rellena las props con los atributos.
|
1022 |
completeAttributes(feature); |
1023 |
|
1024 |
//features.add(feature);
|
1025 |
if (addingToBlock == false) { |
1026 |
features.add(feature); |
1027 |
} else {
|
1028 |
//System.out.println("createText(): A?adimos un text al bloque " + iterator);
|
1029 |
blk.add(feature); |
1030 |
} |
1031 |
} |
1032 |
|
1033 |
public void createPoint(DxfGroupVector grp) throws Exception { |
1034 |
double x = 0.0, y = 0.0, z = 0.0; |
1035 |
DxfGroup g = null;
|
1036 |
Point2D pt = null; |
1037 |
Point point = new Point(); |
1038 |
Feature feature = new Feature();
|
1039 |
|
1040 |
feature.setProp("dxfEntity", "Point"); |
1041 |
if (grp.hasCode(8)) |
1042 |
feature.setProp("layer", grp.getDataAsString(8)); |
1043 |
if (grp.hasCode(39)) { |
1044 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1045 |
String string = doub.toString();
|
1046 |
feature.setProp("thickness", string);
|
1047 |
} else {
|
1048 |
Double doub = new Double(0.0); |
1049 |
feature.setProp("thickness", doub.toString());
|
1050 |
} |
1051 |
if (grp.hasCode(62)) { |
1052 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1053 |
String string = integer.toString();
|
1054 |
feature.setProp("color", string);
|
1055 |
feature.setProp("colorByLayer", "false"); |
1056 |
} else {
|
1057 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1058 |
int clr = layer.colorNumber;
|
1059 |
Integer integer = new Integer(clr); |
1060 |
String string = integer.toString();
|
1061 |
feature.setProp("color", string);
|
1062 |
feature.setProp("colorByLayer", "true"); |
1063 |
} |
1064 |
x = grp.getDataAsDouble(10);
|
1065 |
y = grp.getDataAsDouble(20);
|
1066 |
if (grp.hasCode(30)) { |
1067 |
z = grp.getDataAsDouble(30);
|
1068 |
Double doub = new Double(z); |
1069 |
String string = doub.toString();
|
1070 |
feature.setProp("elevation", string);
|
1071 |
} else {
|
1072 |
Double doub = new Double(0.0); |
1073 |
feature.setProp("elevation", doub.toString());
|
1074 |
} |
1075 |
if (grp.hasCode(210)) |
1076 |
xtruX = grp.getDataAsDouble(210);
|
1077 |
if (grp.hasCode(220)) |
1078 |
xtruY = grp.getDataAsDouble(220);
|
1079 |
if (grp.hasCode(230)) |
1080 |
xtruZ = grp.getDataAsDouble(230);
|
1081 |
Point3D point_in = new Point3D(x, y, z);
|
1082 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1083 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1084 |
x = point_out.getX(); |
1085 |
y = point_out.getY(); |
1086 |
point.add(new Point2D.Double(x, y)); |
1087 |
feature.setGeometry(point); |
1088 |
|
1089 |
// 041130: Rellena las props con los atributos.
|
1090 |
completeAttributes(feature); |
1091 |
/*for (int i=0;i<attributes.size();i++) {
|
1092 |
String[] att = new String[2];
|
1093 |
att = (String[])attributes.get(i);
|
1094 |
feature.setProp(att[0],att[1]);
|
1095 |
}*/
|
1096 |
|
1097 |
//features.add(feature);
|
1098 |
if (addingToBlock == false) { |
1099 |
features.add(feature); |
1100 |
} else {
|
1101 |
//System.out.println("createPoint(): A?adimos un punto al bloque " + iterator);
|
1102 |
blk.add(feature); |
1103 |
} |
1104 |
} |
1105 |
|
1106 |
public void createCircle(DxfGroupVector grp) throws Exception { |
1107 |
double x = 0.0, y = 0.0, z = 0.0; |
1108 |
double r = 0.0; |
1109 |
DxfGroup g = null;
|
1110 |
LineString lineString = new LineString();
|
1111 |
Polygon polygon = new Polygon(); |
1112 |
Feature feaBordes = new Feature();
|
1113 |
Feature feaFondos = new Feature();
|
1114 |
|
1115 |
feaBordes.setProp("dxfEntity", "Circle"); |
1116 |
feaFondos.setProp("dxfEntity", "Circle"); |
1117 |
if (grp.hasCode(8)) |
1118 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1119 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1120 |
if (grp.hasCode(39)) { |
1121 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1122 |
String string = doub.toString();
|
1123 |
feaBordes.setProp("thickness", string);
|
1124 |
feaFondos.setProp("thickness", string);
|
1125 |
} else {
|
1126 |
Double doub = new Double(0.0); |
1127 |
feaBordes.setProp("thickness", doub.toString());
|
1128 |
feaFondos.setProp("thickness", doub.toString());
|
1129 |
} |
1130 |
if (grp.hasCode(62)) { |
1131 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1132 |
String string = integer.toString();
|
1133 |
feaBordes.setProp("color", string);
|
1134 |
feaFondos.setProp("color", string);
|
1135 |
feaBordes.setProp("colorByLayer", "false"); |
1136 |
feaFondos.setProp("colorByLayer", "false"); |
1137 |
} else {
|
1138 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1139 |
int clr = layer.colorNumber;
|
1140 |
Integer integer = new Integer(clr); |
1141 |
String string = integer.toString();
|
1142 |
feaBordes.setProp("color", string);
|
1143 |
feaFondos.setProp("color", string);
|
1144 |
feaBordes.setProp("colorByLayer", "true"); |
1145 |
feaFondos.setProp("colorByLayer", "true"); |
1146 |
} |
1147 |
x = grp.getDataAsDouble(10);
|
1148 |
y = grp.getDataAsDouble(20);
|
1149 |
if (grp.hasCode(30)) { |
1150 |
z = grp.getDataAsDouble(30);
|
1151 |
Double doub = new Double(z); |
1152 |
String string = doub.toString();
|
1153 |
feaBordes.setProp("elevation", string);
|
1154 |
feaFondos.setProp("elevation", string);
|
1155 |
} else {
|
1156 |
Double doub = new Double(0.0); |
1157 |
feaBordes.setProp("elevation", doub.toString());
|
1158 |
feaFondos.setProp("elevation", doub.toString());
|
1159 |
} |
1160 |
if (grp.hasCode(40)) r = grp.getDataAsDouble(40); |
1161 |
if (grp.hasCode(210)) |
1162 |
xtruX = grp.getDataAsDouble(210);
|
1163 |
if (grp.hasCode(220)) |
1164 |
xtruY = grp.getDataAsDouble(220);
|
1165 |
if (grp.hasCode(230)) |
1166 |
xtruZ = grp.getDataAsDouble(230);
|
1167 |
Point3D point_in = new Point3D(x, y, z);
|
1168 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1169 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1170 |
x = point_out.getX(); |
1171 |
y = point_out.getY(); |
1172 |
|
1173 |
Point2D center = proj.createPoint( x, y);
|
1174 |
Point2D[] pts = new Point2D[360]; |
1175 |
int angulo = 0; |
1176 |
for (angulo=0; angulo<360; angulo++) { |
1177 |
pts[angulo] = new Point2D.Double(center.getX(), center.getY()); |
1178 |
pts[angulo].setLocation(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[angulo].getY() + r * Math.cos(angulo*Math.PI/(double)180.0)); |
1179 |
if (pts.length == 1) { |
1180 |
firstPt = pts[angulo]; |
1181 |
} |
1182 |
} |
1183 |
for (int i=0; i<pts.length; i++) { |
1184 |
lineString.add(pts[i]); |
1185 |
polygon.add(pts[i]); |
1186 |
} |
1187 |
|
1188 |
feaBordes.setGeometry(lineString); |
1189 |
feaFondos.setGeometry(polygon); |
1190 |
|
1191 |
// 041130: Rellena las props con los atributos.
|
1192 |
completeAttributes(feaBordes); |
1193 |
completeAttributes(feaFondos); |
1194 |
|
1195 |
//features.add(feature);
|
1196 |
if (addingToBlock == false) { |
1197 |
//System.out.println("createCircle(): A?ade un circulo a la lista de entidades");
|
1198 |
features.add(feaBordes); |
1199 |
features.add(feaFondos); |
1200 |
} else {
|
1201 |
//System.out.println("createCircle(): A?adimos un circulo al bloque " + iterator);
|
1202 |
blk.add(feaBordes); |
1203 |
blk.add(feaFondos); |
1204 |
} |
1205 |
} |
1206 |
|
1207 |
public void createArc(DxfGroupVector grp) throws Exception { |
1208 |
double x = 0.0, y = 0.0, z = 0.0; |
1209 |
double r = 0.0, empieza = 0.0, acaba = 0.0; |
1210 |
DxfGroup g = null;
|
1211 |
LineString lineString = new LineString();
|
1212 |
Feature feature = new Feature();
|
1213 |
|
1214 |
feature.setProp("dxfEntity", "Arc"); |
1215 |
if (grp.hasCode(8)) |
1216 |
feature.setProp("layer", grp.getDataAsString(8)); |
1217 |
if (grp.hasCode(39)) { |
1218 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1219 |
String string = doub.toString();
|
1220 |
feature.setProp("thickness", string);
|
1221 |
} else {
|
1222 |
Double doub = new Double(0.0); |
1223 |
feature.setProp("thickness", doub.toString());
|
1224 |
} |
1225 |
if (grp.hasCode(62)) { |
1226 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1227 |
String string = integer.toString();
|
1228 |
feature.setProp("color", string);
|
1229 |
feature.setProp("colorByLayer", "false"); |
1230 |
} else {
|
1231 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1232 |
int clr = layer.colorNumber;
|
1233 |
Integer integer = new Integer(clr); |
1234 |
String string = integer.toString();
|
1235 |
feature.setProp("color", string);
|
1236 |
feature.setProp("colorByLayer", "true"); |
1237 |
} |
1238 |
x = grp.getDataAsDouble(10);
|
1239 |
y = grp.getDataAsDouble(20);
|
1240 |
if (grp.hasCode(30)) { |
1241 |
z = grp.getDataAsDouble(30);
|
1242 |
Double doub = new Double(z); |
1243 |
String string = doub.toString();
|
1244 |
feature.setProp("elevation", string);
|
1245 |
} else {
|
1246 |
Double doub = new Double(0.0); |
1247 |
feature.setProp("elevation", doub.toString());
|
1248 |
} |
1249 |
if (grp.hasCode(40)) r = grp.getDataAsDouble(40); |
1250 |
if (grp.hasCode(50)) empieza = grp.getDataAsDouble(50); |
1251 |
if (grp.hasCode(51)) acaba = grp.getDataAsDouble(51); |
1252 |
if (grp.hasCode(210)) |
1253 |
xtruX = grp.getDataAsDouble(210);
|
1254 |
if (grp.hasCode(220)) |
1255 |
xtruY = grp.getDataAsDouble(220);
|
1256 |
if (grp.hasCode(230)) |
1257 |
xtruZ = grp.getDataAsDouble(230);
|
1258 |
Point3D point_in = new Point3D(x, y, z);
|
1259 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1260 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1261 |
x = point_out.getX(); |
1262 |
y = point_out.getY(); |
1263 |
|
1264 |
Point2D center = proj.createPoint( x, y);
|
1265 |
//System.out.println("empieza = " + empieza + ", acaba = " + acaba);
|
1266 |
int iempieza = (int)empieza; |
1267 |
int iacaba = (int)acaba; |
1268 |
//System.out.println("iempieza = " + iempieza + ", iacaba = " + iacaba);
|
1269 |
double angulo = 0; |
1270 |
Point2D[] pts = null; |
1271 |
if (empieza <= acaba) {
|
1272 |
pts = new Point2D[(iacaba-iempieza)+2]; |
1273 |
angulo = empieza; |
1274 |
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)); |
1275 |
for (int i=1; i<=(iacaba-iempieza)+1; i++) { |
1276 |
angulo = (double)(iempieza+i);
|
1277 |
pts[i] = 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)); |
1278 |
} |
1279 |
angulo = acaba; |
1280 |
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)); |
1281 |
} else {
|
1282 |
pts = new Point2D[(360-iempieza)+iacaba+2]; |
1283 |
angulo = empieza; |
1284 |
//System.out.println("pts[0] = " + pts[0] + ", center = " + center + ", angulo = " + angulo);
|
1285 |
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)); |
1286 |
for (int i=1; i<=(360-iempieza); i++) { |
1287 |
angulo = (double)(iempieza+i);
|
1288 |
pts[i] = 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)); |
1289 |
} |
1290 |
for (int i=(360-iempieza)+1; i<=(360-iempieza)+iacaba; i++) { |
1291 |
angulo = (double)(i-(360-iempieza)); |
1292 |
pts[i] = 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)); |
1293 |
} |
1294 |
angulo = acaba; |
1295 |
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)); |
1296 |
} |
1297 |
for (int i=0; i<pts.length; i++) { |
1298 |
lineString.add(pts[i]); |
1299 |
} |
1300 |
|
1301 |
feature.setGeometry(lineString); |
1302 |
|
1303 |
// 041130: Rellena las props con los atributos.
|
1304 |
completeAttributes(feature); |
1305 |
|
1306 |
//features.add(feature);
|
1307 |
if (addingToBlock == false) { |
1308 |
features.add(feature); |
1309 |
} else {
|
1310 |
//System.out.println("createArc(): A?adimos un arco al bloque " + iterator);
|
1311 |
blk.add(feature); |
1312 |
} |
1313 |
} |
1314 |
|
1315 |
public void createInsert(DxfGroupVector grp) throws Exception { |
1316 |
double x = 0.0, y = 0.0, z = 0.0; |
1317 |
DxfGroup g = null;
|
1318 |
Point2D pt = new Point2D.Double(0.0, 0.0); |
1319 |
Point2D scaleFactor = new Point2D.Double(1.0, 1.0); |
1320 |
double rotAngle = 0.0; |
1321 |
String blockName = ""; |
1322 |
|
1323 |
InsPoint insert = new InsPoint();
|
1324 |
Feature feature = new Feature();
|
1325 |
Point secondGeom = new Point(); |
1326 |
Feature secondFeat = new Feature();
|
1327 |
int attributesFollowFlag = 0; |
1328 |
|
1329 |
feature.setProp("dxfEntity", "Insert"); |
1330 |
secondFeat.setProp("dxfEntity", "Insert"); |
1331 |
if (grp.hasCode(2)) { |
1332 |
blockName = grp.getDataAsString(2);
|
1333 |
//feature.setProp("blockName", blockName);
|
1334 |
insert.setBlockName(blockName); |
1335 |
} |
1336 |
if (grp.hasCode(8)) { |
1337 |
feature.setProp("layer", grp.getDataAsString(8)); |
1338 |
secondFeat.setProp("layer", grp.getDataAsString(8)); |
1339 |
} |
1340 |
|
1341 |
Double doub = new Double(0.0); |
1342 |
secondFeat.setProp("thickness", doub.toString());
|
1343 |
|
1344 |
if (grp.hasCode(62)) { |
1345 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1346 |
String string = integer.toString();
|
1347 |
feature.setProp("color", string);
|
1348 |
secondFeat.setProp("color", string);
|
1349 |
feature.setProp("colorByLayer", "false"); |
1350 |
secondFeat.setProp("colorByLayer", "false"); |
1351 |
} else {
|
1352 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1353 |
int clr = layer.colorNumber;
|
1354 |
Integer integer = new Integer(clr); |
1355 |
String string = integer.toString();
|
1356 |
feature.setProp("color", string);
|
1357 |
secondFeat.setProp("color", string);
|
1358 |
feature.setProp("colorByLayer", "true"); |
1359 |
secondFeat.setProp("colorByLayer", "true"); |
1360 |
} |
1361 |
if (grp.hasCode(66)) { |
1362 |
attributesFollowFlag = grp.getDataAsInt(66);
|
1363 |
} |
1364 |
if (grp.hasCode(10)) x = grp.getDataAsDouble(10); |
1365 |
if (grp.hasCode(20)) y = grp.getDataAsDouble(20); |
1366 |
if (grp.hasCode(30)) { |
1367 |
z = grp.getDataAsDouble(30);
|
1368 |
Double doubz = new Double(z); |
1369 |
String string = doubz.toString();
|
1370 |
feature.setProp("elevation", string);
|
1371 |
secondFeat.setProp("elevation", string);
|
1372 |
} else {
|
1373 |
Double elev = new Double(z); |
1374 |
//feature.setProp("elevation", doub.toString());
|
1375 |
feature.setProp("elevation", elev.toString());
|
1376 |
secondFeat.setProp("elevation", elev.toString());
|
1377 |
} |
1378 |
if (grp.hasCode(41)) { |
1379 |
scaleFactor.setLocation(grp.getDataAsDouble(41), scaleFactor.getY());
|
1380 |
//Double scaleFactorX = new Double(scaleFactor.getX());
|
1381 |
//feature.setProp("scaleFactorX", scaleFactorX.toString());
|
1382 |
insert.setScaleFactor(scaleFactor); |
1383 |
} else {
|
1384 |
//Double scaleFactorX = new Double(scaleFactor.getX());
|
1385 |
//feature.setProp("scaleFactorX", scaleFactorX.toString());
|
1386 |
insert.setScaleFactor(scaleFactor); |
1387 |
} |
1388 |
if (grp.hasCode(42)) { |
1389 |
scaleFactor.setLocation(scaleFactor.getX(), grp.getDataAsDouble(42));
|
1390 |
//Double scaleFactorY = new Double(scaleFactor.getY());
|
1391 |
//feature.setProp("scaleFactorY", scaleFactorY.toString());
|
1392 |
insert.setScaleFactor(scaleFactor); |
1393 |
} else {
|
1394 |
//Double scaleFactorY = new Double(scaleFactor.getY());
|
1395 |
//feature.setProp("scaleFactorY", scaleFactorY.toString());
|
1396 |
insert.setScaleFactor(scaleFactor); |
1397 |
} |
1398 |
if (grp.hasCode(43)) { |
1399 |
// TODO La coordenada z
|
1400 |
} |
1401 |
if (grp.hasCode(50)) { |
1402 |
rotAngle = grp.getDataAsDouble(50);
|
1403 |
//Double objRotAngle = new Double(rotAngle);
|
1404 |
//feature.setProp("rotAngle", objRotAngle.toString());
|
1405 |
insert.setRotAngle(rotAngle); |
1406 |
} |
1407 |
if (grp.hasCode(210)) |
1408 |
xtruX = grp.getDataAsDouble(210);
|
1409 |
if (grp.hasCode(220)) |
1410 |
xtruY = grp.getDataAsDouble(220);
|
1411 |
if (grp.hasCode(230)) |
1412 |
xtruZ = grp.getDataAsDouble(230);
|
1413 |
Point3D point_in = new Point3D(x, y, z);
|
1414 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1415 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1416 |
x = point_out.getX(); |
1417 |
y = point_out.getY(); |
1418 |
|
1419 |
insert.setBlkList(blkList); |
1420 |
|
1421 |
insert.encuentraBloque(blockName); |
1422 |
|
1423 |
insert.add(new Point2D.Double(x, y)); |
1424 |
secondGeom.add(new Point2D.Double(x, y)); |
1425 |
|
1426 |
feature.setGeometry(insert); |
1427 |
secondFeat.setGeometry(secondGeom); |
1428 |
|
1429 |
// 041130: Rellena las props con los atributos.
|
1430 |
completeAttributes(feature); |
1431 |
completeAttributes(secondFeat); |
1432 |
/*for (int i=0;i<attributes.size();i++) {
|
1433 |
String[] att = new String[2];
|
1434 |
att = (String[])attributes.get(i);
|
1435 |
secondFeat.setProp(att[0],att[1]);
|
1436 |
}*/
|
1437 |
|
1438 |
if (insert.getBlockFound()==true && attributesFollowFlag!=1) gestionaInsert(feature); |
1439 |
|
1440 |
//if (addingToBlock == false) {
|
1441 |
//features.add(secondFeat);
|
1442 |
//}
|
1443 |
//if (addingToBlock == true/* && insert.getBlockFound() == true*/) {
|
1444 |
//System.out.println("createInsert(): A?adimos un insert al bloque " + iterator);
|
1445 |
//blk.add(feature);
|
1446 |
//}
|
1447 |
|
1448 |
// 041129: A?adido para implementar los ATTRIBS.
|
1449 |
if (attributesFollowFlag==1) { |
1450 |
isDoubleFeatured = true;
|
1451 |
lastFeaBordes = feature; |
1452 |
lastFeaFondos = secondFeat; |
1453 |
} else {
|
1454 |
if (addingToBlock == false) { |
1455 |
features.add(secondFeat); |
1456 |
} |
1457 |
if (addingToBlock == true/* && insert.getBlockFound() == true*/) { |
1458 |
//System.out.println("createInsert(): A?adimos un insert al bloque " + iterator);
|
1459 |
blk.add(feature); |
1460 |
} |
1461 |
} |
1462 |
} |
1463 |
|
1464 |
public void createSolid(DxfGroupVector grp) throws Exception { |
1465 |
double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0, z3 = 0.0, z4 = 0.0; |
1466 |
DxfGroup g = null;
|
1467 |
//Point2D pt1 = null, pt2 = null, pt3 = null, pt4 = null;
|
1468 |
Point2D[] pts = new Point2D[4]; |
1469 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1470 |
|
1471 |
LineString lineString = new LineString();
|
1472 |
Polygon polygon = new Polygon(); |
1473 |
Feature feaBordes = new Feature();
|
1474 |
Feature feaFondos = new Feature();
|
1475 |
double elev = 0; |
1476 |
|
1477 |
feaBordes.setProp("dxfEntity", "Solid"); |
1478 |
feaFondos.setProp("dxfEntity", "Solid"); |
1479 |
if (grp.hasCode(8)) |
1480 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1481 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1482 |
x = grp.getDataAsDouble(10);
|
1483 |
y = grp.getDataAsDouble(20);
|
1484 |
if (grp.hasCode(30)) { |
1485 |
z1 = grp.getDataAsDouble(30);
|
1486 |
elev = z1; |
1487 |
Double doub = new Double(elev); |
1488 |
String string = doub.toString();
|
1489 |
feaBordes.setProp("elevation", string);
|
1490 |
feaFondos.setProp("elevation", string);
|
1491 |
} else {
|
1492 |
Double doub = new Double(0.0); |
1493 |
feaBordes.setProp("elevation", doub.toString());
|
1494 |
feaFondos.setProp("elevation", doub.toString());
|
1495 |
} |
1496 |
pts[0] = proj.createPoint(x, y);
|
1497 |
x = grp.getDataAsDouble(11);
|
1498 |
y = grp.getDataAsDouble(21);
|
1499 |
if (grp.hasCode(31)) z2 = grp.getDataAsDouble(31); |
1500 |
pts[1] = proj.createPoint(x, y);
|
1501 |
x = grp.getDataAsDouble(12);
|
1502 |
y = grp.getDataAsDouble(22);
|
1503 |
if (grp.hasCode(32)) z3 = grp.getDataAsDouble(32); |
1504 |
pts[2] = proj.createPoint(x, y);
|
1505 |
x = grp.getDataAsDouble(13);
|
1506 |
y = grp.getDataAsDouble(23);
|
1507 |
if (grp.hasCode(33)) z2 = grp.getDataAsDouble(33); |
1508 |
pts[3] = proj.createPoint(x, y);
|
1509 |
if (grp.hasCode(39)) { |
1510 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1511 |
String string = doub.toString();
|
1512 |
feaBordes.setProp("thickness", string);
|
1513 |
feaFondos.setProp("thickness", string);
|
1514 |
} else {
|
1515 |
Double doub = new Double(0.0); |
1516 |
feaBordes.setProp("thickness", doub.toString());
|
1517 |
feaFondos.setProp("thickness", doub.toString());
|
1518 |
} |
1519 |
if (grp.hasCode(62)) { |
1520 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1521 |
String string = integer.toString();
|
1522 |
feaBordes.setProp("color", string);
|
1523 |
feaFondos.setProp("color", string);
|
1524 |
feaBordes.setProp("colorByLayer", "false"); |
1525 |
feaFondos.setProp("colorByLayer", "false"); |
1526 |
} else {
|
1527 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1528 |
int clr = layer.colorNumber;
|
1529 |
Integer integer = new Integer(clr); |
1530 |
String string = integer.toString();
|
1531 |
feaBordes.setProp("color", string);
|
1532 |
feaFondos.setProp("color", string);
|
1533 |
feaBordes.setProp("colorByLayer", "true"); |
1534 |
feaFondos.setProp("colorByLayer", "true"); |
1535 |
} |
1536 |
if (grp.hasCode(210)) |
1537 |
xtruX = grp.getDataAsDouble(210);
|
1538 |
if (grp.hasCode(220)) |
1539 |
xtruY = grp.getDataAsDouble(220);
|
1540 |
if (grp.hasCode(230)) |
1541 |
xtruZ = grp.getDataAsDouble(230);
|
1542 |
Point3D point_in1 = new Point3D(pts[0].getX(), pts[0].getY(), z1); |
1543 |
Point3D point_in2 = new Point3D(pts[1].getX(), pts[1].getY(), z2); |
1544 |
Point3D point_in3 = new Point3D(pts[2].getX(), pts[2].getY(), z3); |
1545 |
Point3D point_in4 = new Point3D(pts[3].getX(), pts[3].getY(), z4); |
1546 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1547 |
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
1548 |
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
1549 |
Point2D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
|
1550 |
Point2D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
|
1551 |
pts[0].setLocation(point_out1);
|
1552 |
pts[1].setLocation(point_out2);
|
1553 |
pts[2].setLocation(point_out3);
|
1554 |
pts[3].setLocation(point_out4);
|
1555 |
|
1556 |
Point2D aux = pts[2]; |
1557 |
pts[2] = pts[3]; |
1558 |
pts[3] = aux;
|
1559 |
|
1560 |
for (int i=0; i<pts.length; i++) { |
1561 |
lineString.add(pts[i]); |
1562 |
polygon.add(pts[i]); |
1563 |
} |
1564 |
|
1565 |
// Para cerrarlos.
|
1566 |
lineString.add(pts[0]);
|
1567 |
polygon.add(pts[0]);
|
1568 |
|
1569 |
feaBordes.setGeometry(lineString); |
1570 |
feaFondos.setGeometry(polygon); |
1571 |
|
1572 |
// 041130: Rellena las props con los atributos.
|
1573 |
completeAttributes(feaBordes); |
1574 |
completeAttributes(feaFondos); |
1575 |
|
1576 |
//features.add(feature);
|
1577 |
if (addingToBlock == false) { |
1578 |
//System.out.println("createSolid(): A?ade un solid a la lista de entidades");
|
1579 |
features.add(feaBordes); |
1580 |
features.add(feaFondos); |
1581 |
} else {
|
1582 |
//System.out.println("createSolid(): A?adimos un circulo al bloque " + iterator);
|
1583 |
blk.add(feaBordes); |
1584 |
blk.add(feaFondos); |
1585 |
} |
1586 |
} |
1587 |
|
1588 |
public void createSpline(DxfGroupVector grp) throws Exception { |
1589 |
double x = 0.0, y = 0.0, z = 0.0, elev = 0.0; |
1590 |
//double elev = 0.0;
|
1591 |
DxfGroup g = null;
|
1592 |
LineString lineString = new LineString();
|
1593 |
Polygon polygon = new Polygon(); |
1594 |
//Geometry geometria;
|
1595 |
//Feature feature= new Feature();
|
1596 |
Feature feaBordes= new Feature();
|
1597 |
Feature feaFondos= new Feature();
|
1598 |
int flags = 0; |
1599 |
|
1600 |
//feature.setProp("dxfEntity", "LwPolyline");
|
1601 |
feaBordes.setProp("dxfEntity", "Spline"); |
1602 |
feaFondos.setProp("dxfEntity", "Spline"); |
1603 |
if (grp.hasCode(8)) { |
1604 |
//feature.setProp("layer", grp.getDataAsString(8));
|
1605 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1606 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1607 |
} |
1608 |
if (grp.hasCode(39)) { |
1609 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1610 |
String string = doub.toString();
|
1611 |
//feature.setProp("thickness", string);
|
1612 |
feaBordes.setProp("thickness", string);
|
1613 |
feaFondos.setProp("thickness", string);
|
1614 |
} else {
|
1615 |
Double doub = new Double(0.0); |
1616 |
//feature.setProp("thickness", doub.toString());
|
1617 |
feaBordes.setProp("thickness", doub.toString());
|
1618 |
feaFondos.setProp("thickness", doub.toString());
|
1619 |
} |
1620 |
if (grp.hasCode(62)) { |
1621 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1622 |
String string = integer.toString();
|
1623 |
//feature.setProp("color", string);
|
1624 |
feaBordes.setProp("color", string);
|
1625 |
feaFondos.setProp("color", string);
|
1626 |
feaBordes.setProp("colorByLayer", "false"); |
1627 |
feaFondos.setProp("colorByLayer", "false"); |
1628 |
} else {
|
1629 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1630 |
int clr = layer.colorNumber;
|
1631 |
Integer integer = new Integer(clr); |
1632 |
String string = integer.toString();
|
1633 |
//feature.setProp("color", string);
|
1634 |
feaBordes.setProp("color", string);
|
1635 |
feaFondos.setProp("color", string);
|
1636 |
feaBordes.setProp("colorByLayer", "true"); |
1637 |
feaFondos.setProp("colorByLayer", "true"); |
1638 |
} |
1639 |
if (grp.hasCode(70)) |
1640 |
flags = grp.getDataAsInt(70);
|
1641 |
if ((flags & 0x01) == 0x01) { |
1642 |
//geometria = new Polygon();
|
1643 |
feaBordes.setGeometry(lineString); |
1644 |
feaFondos.setGeometry(polygon); |
1645 |
isDoubleFeatured = true;
|
1646 |
} else {
|
1647 |
//geometria = new LineString();
|
1648 |
feaBordes.setGeometry(lineString); |
1649 |
isDoubleFeatured = false;
|
1650 |
} |
1651 |
|
1652 |
int j = 0; |
1653 |
double firstX = 0.0; |
1654 |
double firstY = 0.0; |
1655 |
double firstZ = 0.0; |
1656 |
for (int i=0; i<grp.size(); i++) { |
1657 |
g = (DxfGroup) grp.get(i); |
1658 |
if (g.getCode() == 10) { |
1659 |
j++; |
1660 |
x = ((Double) g.getData()).doubleValue();
|
1661 |
} else if (g.getCode() == 20) { |
1662 |
y = ((Double) g.getData()).doubleValue();
|
1663 |
//if (y <= 1.0) throw new Exception("Y == "+y);
|
1664 |
//lineString.add( proj.createPoint( x, y ) );
|
1665 |
//polygon.add( proj.createPoint( x, y ) );
|
1666 |
//geometria.add( proj.createPoint( x, y ) );
|
1667 |
} else if (g.getCode() == 30) { |
1668 |
z = ((Double) g.getData()).doubleValue();
|
1669 |
// OJO --> proj.createPoint no acepta ptos con 3 coordenadas,
|
1670 |
// ni gvSIG en esta fase de desarrollo.
|
1671 |
lineString.add(proj.createPoint(x, y)); |
1672 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
1673 |
if (j == 1) { |
1674 |
firstX = x; |
1675 |
firstY = y; |
1676 |
firstZ = z; |
1677 |
} |
1678 |
elev = z; |
1679 |
x = 0.0; y = 0.0; z = 0.0; |
1680 |
} |
1681 |
} |
1682 |
|
1683 |
Double doub = new Double(elev); |
1684 |
String string = doub.toString();
|
1685 |
//feature.setProp("elevation", string);
|
1686 |
feaBordes.setProp("elevation", string);
|
1687 |
feaFondos.setProp("elevation", string);
|
1688 |
|
1689 |
if (isDoubleFeatured) {
|
1690 |
//geometria.add(proj.createPoint(firstX, firstY));
|
1691 |
lineString.add(proj.createPoint(firstX, firstY)); |
1692 |
polygon.add(proj.createPoint(firstX, firstY)); |
1693 |
} |
1694 |
|
1695 |
lastFeaBordes = feaBordes; |
1696 |
if (isDoubleFeatured) lastFeaFondos = feaFondos;
|
1697 |
|
1698 |
// 041130: Rellena las props con los atributos.
|
1699 |
completeAttributes(feaBordes); |
1700 |
completeAttributes(feaFondos); |
1701 |
|
1702 |
//features.add(feature);
|
1703 |
if (addingToBlock == false) { |
1704 |
features.add(feaBordes); |
1705 |
if (isDoubleFeatured) features.add(feaFondos);
|
1706 |
} else {
|
1707 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator);
|
1708 |
blk.add(feaBordes); |
1709 |
if (isDoubleFeatured) blk.add(feaFondos);
|
1710 |
} |
1711 |
isDoubleFeatured = false;
|
1712 |
} |
1713 |
public void createAttdef(DxfGroupVector grp) throws Exception { |
1714 |
DxfGroup g = null;
|
1715 |
|
1716 |
String defaultValue = ""; |
1717 |
String tagString = ""; |
1718 |
String textStyleName = ""; |
1719 |
String attribute[] = new String[2]; |
1720 |
boolean tagDefined = false; |
1721 |
boolean defValDefined = false; |
1722 |
|
1723 |
if (grp.hasCode(1)) { |
1724 |
defaultValue = grp.getDataAsString(1);
|
1725 |
attribute[1] = DxfConvTexts.ConvertText(defaultValue);
|
1726 |
defValDefined = true;
|
1727 |
if (tagDefined) attributes.add(attribute);
|
1728 |
} |
1729 |
if (grp.hasCode(2)) { |
1730 |
tagString = grp.getDataAsString(2);
|
1731 |
attribute[0] = DxfConvTexts.ConvertText(tagString);
|
1732 |
tagDefined = true;
|
1733 |
if (defValDefined) attributes.add(attribute);
|
1734 |
} |
1735 |
if (grp.hasCode(7)) { |
1736 |
textStyleName = grp.getDataAsString(7);
|
1737 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
1738 |
} |
1739 |
setNewAttributes(); |
1740 |
} |
1741 |
public void createAttrib(DxfGroupVector grp) throws Exception { |
1742 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
1743 |
DxfGroup g = null;
|
1744 |
//Point2D pt1 = null, pt2 = null;
|
1745 |
Point2D pt = null; |
1746 |
Point point = new Point(); |
1747 |
|
1748 |
point.isText = true;
|
1749 |
|
1750 |
String defaultValue = ""; |
1751 |
String tagString = ""; |
1752 |
String textStyleName = ""; |
1753 |
String att[] = new String[2]; |
1754 |
boolean tagDefined = false; |
1755 |
boolean defValDefined = false; |
1756 |
int attributeFlags = 0; |
1757 |
|
1758 |
Feature insFea = lastFeaBordes; |
1759 |
Feature ptFea = lastFeaFondos; |
1760 |
|
1761 |
Feature feature = new Feature();
|
1762 |
|
1763 |
feature.setProp("dxfEntity", "Attrib"); // <-- Es un INSERT con attributes. |
1764 |
if (grp.hasCode(8)) |
1765 |
feature.setProp("layer", grp.getDataAsString(8)); |
1766 |
if (grp.hasCode(39)) { |
1767 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1768 |
String string = doub.toString();
|
1769 |
feature.setProp("thickness", string);
|
1770 |
} else {
|
1771 |
Double doub = new Double(0.0); |
1772 |
feature.setProp("thickness", doub.toString());
|
1773 |
} |
1774 |
if (grp.hasCode(62)) { |
1775 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1776 |
String string = integer.toString();
|
1777 |
feature.setProp("color", string);
|
1778 |
feature.setProp("colorByLayer", "false"); |
1779 |
} else {
|
1780 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1781 |
int clr = layer.colorNumber;
|
1782 |
Integer integer = new Integer(clr); |
1783 |
String string = integer.toString();
|
1784 |
feature.setProp("color", string);
|
1785 |
feature.setProp("colorByLayer", "true"); |
1786 |
} |
1787 |
|
1788 |
if (grp.hasCode(1)) { |
1789 |
String strAux1 = grp.getDataAsString(1); |
1790 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
1791 |
defaultValue = strAux1; |
1792 |
att[1] = DxfConvTexts.ConvertText(defaultValue);
|
1793 |
defValDefined = true;
|
1794 |
if (tagDefined) {
|
1795 |
insFea.setProp(att[0], att[1]); |
1796 |
ptFea.setProp(att[0], att[1]); |
1797 |
} |
1798 |
feature.setProp("text", strAux1);
|
1799 |
} |
1800 |
if (grp.hasCode(2)) { |
1801 |
String strAux2 = grp.getDataAsString(2); |
1802 |
strAux2 = DxfConvTexts.ConvertText(strAux2); |
1803 |
tagString = strAux2; |
1804 |
att[0] = DxfConvTexts.ConvertText(tagString);
|
1805 |
tagDefined = true;
|
1806 |
if (defValDefined) {
|
1807 |
insFea.setProp(att[0], att[1]); |
1808 |
ptFea.setProp(att[0], att[1]); |
1809 |
} |
1810 |
} |
1811 |
if (grp.hasCode(7)) { |
1812 |
textStyleName = grp.getDataAsString(7);
|
1813 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
1814 |
} |
1815 |
if (grp.hasCode(70)) { |
1816 |
attributeFlags = grp.getDataAsInt(70);
|
1817 |
} |
1818 |
|
1819 |
if (grp.hasCode(40)) { |
1820 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
1821 |
String heightS = heightD.toString();
|
1822 |
feature.setProp("textHeight", heightS);
|
1823 |
} else {
|
1824 |
feature.setProp("textHeight", "20.0"); |
1825 |
} |
1826 |
if (grp.hasCode(50)) { |
1827 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
1828 |
String rotS = rotD.toString();
|
1829 |
feature.setProp("textRotation", rotS);
|
1830 |
} else {
|
1831 |
feature.setProp("textRotation", "0.0"); |
1832 |
} |
1833 |
x = grp.getDataAsDouble(10);
|
1834 |
y = grp.getDataAsDouble(20);
|
1835 |
if (grp.hasCode(30)){ |
1836 |
z = grp.getDataAsDouble(30);
|
1837 |
Double doub = new Double(z); |
1838 |
String string = doub.toString();
|
1839 |
feature.setProp("elevation", string);
|
1840 |
} else {
|
1841 |
Double doub = new Double(0.0); |
1842 |
feature.setProp("elevation", doub.toString());
|
1843 |
} |
1844 |
if (grp.hasCode(210)) |
1845 |
xtruX = grp.getDataAsDouble(210);
|
1846 |
if (grp.hasCode(220)) |
1847 |
xtruY = grp.getDataAsDouble(220);
|
1848 |
if (grp.hasCode(230)) |
1849 |
xtruZ = grp.getDataAsDouble(230);
|
1850 |
Point3D point_in = new Point3D(x, y, z);
|
1851 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1852 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1853 |
x = point_out.getX(); |
1854 |
y = point_out.getY(); |
1855 |
point.add(new Point2D.Double(x, y)); |
1856 |
feature.setGeometry(point); |
1857 |
|
1858 |
// 041130: Rellena las props con los atributos.
|
1859 |
completeAttributes(feature); |
1860 |
|
1861 |
if (attributeFlags==8) { |
1862 |
if (addingToBlock == false) { |
1863 |
features.add(feature); |
1864 |
} else {
|
1865 |
blk.add(feature); |
1866 |
} |
1867 |
} |
1868 |
} |
1869 |
|
1870 |
public void createBlock(DxfGroupVector grp) throws Exception { |
1871 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1872 |
blk = new FeatureCollection(proj);
|
1873 |
|
1874 |
Point2D basePoint = new Point2D.Double(); |
1875 |
String blockName = ""; |
1876 |
//System.out.println("createBlock(): Creamos nuevo bloque, el bloque " + iterator);
|
1877 |
|
1878 |
addingToBlock = true;
|
1879 |
//System.out.println("createBlock(): A?adimos el bloque " + iterator + " a la lista de bloques");
|
1880 |
blkList.add(iterator, blk); |
1881 |
|
1882 |
//System.out.println("createBlock(): Rellenamos la informacion del bloque " + iterator);
|
1883 |
|
1884 |
if (grp.hasCode(8)) |
1885 |
blk.setProp("layer", grp.getDataAsString(8)); |
1886 |
if (grp.hasCode(62)) { |
1887 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1888 |
String string = integer.toString();
|
1889 |
blk.setProp("color", string);
|
1890 |
blk.setProp("colorByLayer", "false"); |
1891 |
} else {
|
1892 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1893 |
int clr = layer.colorNumber;
|
1894 |
Integer integer = new Integer(clr); |
1895 |
String string = integer.toString();
|
1896 |
blk.setProp("color", string);
|
1897 |
blk.setProp("colorByLayer", "true"); |
1898 |
} |
1899 |
|
1900 |
if (grp.hasCode(1)) { |
1901 |
blockName = grp.getDataAsString(1);
|
1902 |
//blk.setBlkName(blockName);
|
1903 |
blk.setProp("blockName", blockName);
|
1904 |
} |
1905 |
if (grp.hasCode(2)) { |
1906 |
blockName = grp.getDataAsString(2);
|
1907 |
//blk.setBlkName(blockName);
|
1908 |
blk.setProp("blockName", blockName);
|
1909 |
} |
1910 |
// 041001: Anulado porque provoca que no se visualizen bloques de la
|
1911 |
// leyenda en m54643.dxf.
|
1912 |
/*if (grp.hasCode(3)) {
|
1913 |
blockName = grp.getDataAsString(3);
|
1914 |
//blk.setBlkName(blockName);
|
1915 |
blk.setProp("blockName", blockName);
|
1916 |
}*/
|
1917 |
if (grp.hasCode(10)) { |
1918 |
//basePoint.setLocation(grp.getDataAsDouble(10), basePoint.getY());
|
1919 |
//blk.setBPoint(basePoint);
|
1920 |
Double basePointX = new Double(grp.getDataAsDouble(10)); |
1921 |
blk.setProp("basePointX", basePointX.toString());
|
1922 |
} |
1923 |
if (grp.hasCode(20)) { |
1924 |
//basePoint.setLocation(basePoint.getX(), grp.getDataAsDouble(20));
|
1925 |
//blk.setBPoint(basePoint);
|
1926 |
Double basePointY = new Double(grp.getDataAsDouble(20)); |
1927 |
blk.setProp("basePointY", basePointY.toString());
|
1928 |
} |
1929 |
if (grp.hasCode(30)) { |
1930 |
//basePoint.setLocation(basePoint.getZ(), grp.getDataAsDouble(30));
|
1931 |
//blk.setBPoint(basePoint);
|
1932 |
Double basePointZ = new Double(grp.getDataAsDouble(30)); |
1933 |
blk.setProp("basePointZ", basePointZ.toString());
|
1934 |
} |
1935 |
if (grp.hasCode(70)) { |
1936 |
//blk.flags = grp.getDataAsInt(70);
|
1937 |
Integer blockFlags = new Integer(grp.getDataAsInt(70)); |
1938 |
blk.setProp("blockFlags", blockFlags.toString());
|
1939 |
// 041103: Hoy por hoy esto no lo utilizamos.
|
1940 |
} |
1941 |
} |
1942 |
|
1943 |
public void endBlk(DxfGroupVector grp) throws Exception { |
1944 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1945 |
setAddingToBlock(false);
|
1946 |
iterator = iterator + 1;
|
1947 |
} |
1948 |
|
1949 |
public void testBlocks() { |
1950 |
//System.out.println("getBlkList() = " + getBlkList());
|
1951 |
Vector blkList = getBlkList();
|
1952 |
FeatureCollection block = null;
|
1953 |
Feature feature = null;
|
1954 |
InsPoint insert = null;
|
1955 |
Point2D point1 = new Point2D.Double(); |
1956 |
Point2D point2 = new Point2D.Double(); |
1957 |
//System.out.println("blkList = " + blkList);
|
1958 |
//System.out.println("blkList.size() = " + blkList.size());
|
1959 |
for (int i=0; i<blkList.size(); i++) { |
1960 |
//System.out.println("compruebaBloques(): Bloque " + i +" de " + blkList.size());
|
1961 |
block = (FeatureCollection) blkList.get(i); |
1962 |
int aux = block.size();
|
1963 |
for (int j=0; j<aux; j++) { |
1964 |
feature = (Feature)block.get(j); |
1965 |
//if (feature.getGeometry() instanceof InsPoint && feature.getProp("isAnInsert") == "true") {
|
1966 |
if (feature.getGeometry() instanceof InsPoint) { |
1967 |
insert = (InsPoint)feature.getGeometry(); |
1968 |
String nomBlock = insert.getBlockName();
|
1969 |
//System.out.println("compruebaBloques(): Bloque = " + i + ", elemento = " + j + ", inserta el bloque = " + nomBlock);
|
1970 |
//System.out.println("compruebaBloques(): insert.get(0) = " + insert.get(0));
|
1971 |
//System.out.println("compruebaBloques(): feature.getProp(rotAngle) = " + insert.getRotAngle());
|
1972 |
//System.out.println("compruebaBloques(): insert.getScaleFactor() = " + insert.getScaleFactor());
|
1973 |
//if (feature.getProp("blockFound") == "false") {
|
1974 |
if (insert.getBlockFound() == false) { |
1975 |
//System.out.println("compruebaBloques(): Ahora se ocupa del DxfInsert " + nomBlock);
|
1976 |
insert.encuentraBloque(nomBlock); |
1977 |
//gestionaInsert(feature);
|
1978 |
//block.add(feature);
|
1979 |
} |
1980 |
|
1981 |
} |
1982 |
} |
1983 |
} |
1984 |
} |
1985 |
|
1986 |
private void gestionaInsert(Feature feature) { |
1987 |
Feature feature2 = null;
|
1988 |
Point point = null; |
1989 |
LineString lineString = null;
|
1990 |
Polygon polygon = null; |
1991 |
InsPoint insert = new InsPoint();
|
1992 |
insert = (InsPoint)feature.getGeometry(); |
1993 |
double bPointX = 0.0; |
1994 |
double bPointY = 0.0; |
1995 |
//if (insert.getBlockFound() == true) {
|
1996 |
bPointX = Double.parseDouble(insert.getBlock().getProp("basePointX")); |
1997 |
bPointY = Double.parseDouble(insert.getBlock().getProp("basePointY")); |
1998 |
//}
|
1999 |
double sFactorX = insert.getScaleFactor().getX();
|
2000 |
double sFactorY = insert.getScaleFactor().getY();
|
2001 |
double rAngleGra = insert.getRotAngle();
|
2002 |
double rAngleRad = rAngleGra*Math.PI/180.0; |
2003 |
InsPoint insert2 = null;
|
2004 |
|
2005 |
for (int i=0; i<insert.getBlock().size(); i++) { |
2006 |
//System.out.println("gestionaInserts: insert.getBlock().features.size() = " + insert.getBlock().size());
|
2007 |
feature2 = (Feature)insert.getBlock().get(i); |
2008 |
|
2009 |
// Para que los elementos dentro del bloque tengan la misma layer
|
2010 |
// y color que el insert al que corresponden.
|
2011 |
// Segun la especificacion del formato DXF de Autodesk, la layer
|
2012 |
// de las entities dentro de un bloque es la del bloque. La
|
2013 |
// layer especifica para estos elementos en la defincion del
|
2014 |
// bloque se ignora.
|
2015 |
//System.out.println("gestionaInsert(): layer = " + feature2.getProp("layer"));
|
2016 |
if ((feature2.getProp("colorByLayer").equals("false") || feature2.getProp("layer").equals("0")) && !feature.getProp("layer").equals("0")) { |
2017 |
feature2.setProp("color", feature.getProp("color")); |
2018 |
} |
2019 |
feature2.setProp("layer", feature.getProp("layer")); |
2020 |
|
2021 |
Point2D point1 = new Point2D.Double(); |
2022 |
Point2D point11 = new Point2D.Double(); |
2023 |
Point2D pointAux = null; |
2024 |
|
2025 |
if (feature2.getGeometry() instanceof InsPoint){ |
2026 |
|
2027 |
//System.out.println("gestionaInsert(): Encuentra bloques dentro de bloques");
|
2028 |
|
2029 |
insert2 = (InsPoint)feature2.getGeometry(); |
2030 |
point1 = insert2.get(0);
|
2031 |
|
2032 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
2033 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2034 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2035 |
point11.setLocation(laX, laY); |
2036 |
InsPoint insert3 = new InsPoint();
|
2037 |
|
2038 |
insert3.add(point11); |
2039 |
|
2040 |
insert3.setBlkList(insert2.getBlkList()); |
2041 |
insert3.setBlock(insert2.getBlock()); |
2042 |
insert3.setBlockName(insert2.getBlockName()); |
2043 |
insert3.setRotAngle(insert2.getRotAngle()); |
2044 |
Point2D newScale = new Point2D.Double(insert2.getScaleFactor().getX() * sFactorX, insert2.getScaleFactor().getY() * sFactorY); |
2045 |
insert3.setScaleFactor(newScale); |
2046 |
|
2047 |
Feature feature3 = new Feature();
|
2048 |
feature3.setProp("layer", feature2.getProp("layer")); |
2049 |
feature3.setProp("color", feature2.getProp("color")); |
2050 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2051 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2052 |
|
2053 |
//041130
|
2054 |
for (int j=0;j<attributes.size();j++) { |
2055 |
String[] att = new String[2]; |
2056 |
att = (String[])attributes.get(j); |
2057 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2058 |
} |
2059 |
|
2060 |
feature3.setGeometry(insert3); |
2061 |
|
2062 |
gestionaInsert(feature3); |
2063 |
} else if (feature2.getGeometry() instanceof LineString) { |
2064 |
lineString = (LineString)feature2.getGeometry(); |
2065 |
LineString lineString2 = new LineString();
|
2066 |
Point2D[] points = new Point2D[lineString.pointNr()]; |
2067 |
Point2D[] pointss = new Point2D[lineString.pointNr()]; |
2068 |
for (int j=0; j<lineString.pointNr(); j++) { |
2069 |
points[j] = (Point2D)lineString.get(j);
|
2070 |
pointss[j] = new Point2D.Double(); |
2071 |
|
2072 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
2073 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2074 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2075 |
pointss[j].setLocation(laX, laY); |
2076 |
lineString2.add(pointss[j]); |
2077 |
} |
2078 |
|
2079 |
Feature feature3 = new Feature();
|
2080 |
feature3.setProp("layer", feature2.getProp("layer")); |
2081 |
feature3.setProp("color", feature2.getProp("color")); |
2082 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2083 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2084 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2085 |
|
2086 |
//041130
|
2087 |
for (int j=0;j<attributes.size();j++) { |
2088 |
String[] att = new String[2]; |
2089 |
att = (String[])attributes.get(j); |
2090 |
/*System.out.println("gestionaInsert(): att[0] = " + att[0]);
|
2091 |
System.out.println("gestionaInsert(): feature2.getProp(att[0]) = " + feature2.getProp(att[0]));
|
2092 |
System.out.println("gestionaInsert(): feature2.getProp(layer) = " + feature2.getProp("layer"));
|
2093 |
System.out.println("gestionaInsert(): feature2.getProp(color) = " + feature2.getProp("color"));
|
2094 |
System.out.println("gestionaInsert(): feature2.getProp(dxfEntity) = " + feature2.getProp("dxfEntity"));
|
2095 |
System.out.println("gestionaInsert(): feature2.getProp(thickness) = " + feature2.getProp("thickness"));*/
|
2096 |
String str = att[0]; |
2097 |
feature3.setProp(str,feature2.getProp(str)); |
2098 |
} |
2099 |
|
2100 |
feature3.setGeometry(lineString2); |
2101 |
|
2102 |
if (addingToBlock == false) { |
2103 |
features.add(feature3); |
2104 |
} |
2105 |
} else if (feature2.getGeometry() instanceof Polygon) { |
2106 |
polygon = (Polygon)feature2.getGeometry();
|
2107 |
Polygon polygon2 = new Polygon(); |
2108 |
Point2D[] points = new Point2D[polygon.pointNr()]; |
2109 |
Point2D[] pointss = new Point2D[polygon.pointNr()]; |
2110 |
for (int j=0; j<polygon.pointNr(); j++) { |
2111 |
points[j] = (Point2D)polygon.get(j);
|
2112 |
pointss[j] = new Point2D.Double(); |
2113 |
|
2114 |
points[j].setLocation(points[j].getX() - bPointX, points[j].getY() - bPointY); |
2115 |
double laX = insert.get(0).getX() + ((points[j].getX()*sFactorX)*Math.cos(rAngleRad) + (points[j].getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2116 |
double laY = insert.get(0).getY() + ((points[j].getX()*sFactorX)*Math.sin(rAngleRad) + (points[j].getY()*sFactorY)*Math.cos(rAngleRad)); |
2117 |
pointss[j].setLocation(laX, laY); |
2118 |
polygon2.add(pointss[j]); |
2119 |
} |
2120 |
|
2121 |
Feature feature3 = new Feature();
|
2122 |
feature3.setProp("layer", feature2.getProp("layer")); |
2123 |
feature3.setProp("color", feature2.getProp("color")); |
2124 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2125 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2126 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2127 |
|
2128 |
//041130
|
2129 |
for (int j=0;j<attributes.size();j++) { |
2130 |
String[] att = new String[2]; |
2131 |
att = (String[])attributes.get(j); |
2132 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2133 |
} |
2134 |
|
2135 |
feature3.setGeometry(polygon2); |
2136 |
|
2137 |
if (addingToBlock == false) { |
2138 |
features.add(feature3); |
2139 |
} |
2140 |
} else if (feature2.getGeometry() instanceof Point) { |
2141 |
point = (Point)feature2.getGeometry();
|
2142 |
point1 = point.get(0);
|
2143 |
|
2144 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
2145 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2146 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2147 |
point11.setLocation(laX, laY); |
2148 |
Point pointt = new Point(); |
2149 |
pointt.add(point11); |
2150 |
|
2151 |
Feature feature3 = new Feature();
|
2152 |
feature3.setProp("layer", feature2.getProp("layer")); |
2153 |
feature3.setProp("color", feature2.getProp("color")); |
2154 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2155 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2156 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2157 |
if (point.isText) {
|
2158 |
feature3.setProp("text", feature2.getProp("text")); |
2159 |
feature3.setProp("textHeight", feature2.getProp("textHeight")); |
2160 |
double auxR = Double.parseDouble(feature2.getProp("textRotation")); |
2161 |
//System.out.println("auxR = " + auxR);
|
2162 |
auxR = auxR + rAngleGra; |
2163 |
feature3.setProp("textRotation", Double.toString(auxR)); |
2164 |
//System.out.println("gestionaInsert(): feature3.getProp(textRotation) = " + feature3.getProp("textRotation"));
|
2165 |
pointt.isText = true;
|
2166 |
} |
2167 |
|
2168 |
//041130
|
2169 |
for (int j=0;j<attributes.size();j++) { |
2170 |
String[] att = new String[2]; |
2171 |
att = (String[])attributes.get(j); |
2172 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2173 |
} |
2174 |
|
2175 |
feature3.setGeometry(pointt); |
2176 |
|
2177 |
//if (addingToBlock == false) {
|
2178 |
features.add(feature3); |
2179 |
//}
|
2180 |
} else {
|
2181 |
System.out.println("gestionaInsert(): Encontrado elemento desconocido"); |
2182 |
} |
2183 |
} |
2184 |
} |
2185 |
|
2186 |
private void addFace(int [] face) { |
2187 |
hasFaces = true;
|
2188 |
if (faces == null) |
2189 |
faces = new Vector(); |
2190 |
faces.add(face); |
2191 |
} |
2192 |
|
2193 |
/**
|
2194 |
* Quita los atributos repetidos.
|
2195 |
*/
|
2196 |
public void depureAttributes() { |
2197 |
//String[] att = null;
|
2198 |
/*Set conjunto = new HashSet();
|
2199 |
for (int i=0;i<attributes.size();i++) {
|
2200 |
att = (String[])attributes.get(i);
|
2201 |
String str = att[0];
|
2202 |
conjunto.add(str);
|
2203 |
}
|
2204 |
//conjunto.addAll(attributes);
|
2205 |
Vector atts = new Vector();
|
2206 |
Vector atts2 = new Vector();
|
2207 |
atts.addAll(conjunto);
|
2208 |
for (int i=0;i<atts.size();i++) {
|
2209 |
if (((String[])(attributes.get(i)))[0] == atts.get(i)) {
|
2210 |
atts2.add(i, attributes.get(i));
|
2211 |
}
|
2212 |
}*/
|
2213 |
|
2214 |
String[] lastAtt = new String[2]; |
2215 |
for (int i=0;i<attributes.size();i++) { |
2216 |
String[] att = (String[])attributes.get(i); |
2217 |
for (int j=i+1;j<attributes.size();j++) { |
2218 |
//System.out.println("depureAttributes(): j = " + j);
|
2219 |
String[] st = (String[])attributes.get(j); |
2220 |
String st1 = att[0]; |
2221 |
String st2 = st[0]; |
2222 |
//System.out.println("depureAttributes(): st1 = " + st1);
|
2223 |
//System.out.println("depureAttributes(): st2 = " + st2);
|
2224 |
if (st2.equals(st1)) {
|
2225 |
//System.out.println("depureAttributes(): Borra el st2");
|
2226 |
attributes.remove(j); |
2227 |
} |
2228 |
if (i==attributes.size()-1) { |
2229 |
lastAtt = att; |
2230 |
} |
2231 |
} |
2232 |
} |
2233 |
for (int i=attributes.size()-2;i>=0;i--) { |
2234 |
String[] att = (String[])attributes.get(i); |
2235 |
String st1 = lastAtt[0]; |
2236 |
String st2 = att[0]; |
2237 |
if (st2.equals(st1)) {
|
2238 |
attributes.remove(i); |
2239 |
} |
2240 |
} |
2241 |
|
2242 |
/*String[] attStrs = new String[attributes.size()];
|
2243 |
Vector attribs = new Vector();
|
2244 |
for (int i=0;i<attributes.size();i++) {
|
2245 |
att = (String[])attributes.get(i);
|
2246 |
attStrs[i] = att[0];
|
2247 |
}
|
2248 |
Set attStrsNR = new HashSet();
|
2249 |
for (int i=0;i<attStrs.length;i++) {
|
2250 |
attStrsNR.add(attStrs[i]);
|
2251 |
}
|
2252 |
String[] attStrsNRA = new String[attStrsNR.size()];
|
2253 |
attStrsNR.toArray(attStrsNRA);
|
2254 |
for (int i=0;i<attStrsNR.size();i++) {
|
2255 |
att[0] = attStrsNRA[i];
|
2256 |
attribs.add(att);
|
2257 |
}
|
2258 |
for (int i=0;i<attributes.size();i++) {
|
2259 |
att = (String[])attributes.get(i);
|
2260 |
String[] att2 = new String[2];
|
2261 |
for (int j=0;j<attribs.size();j++) {
|
2262 |
att2 = (String[])attribs.get(j);
|
2263 |
if (att[0].equals(att2[0])) {
|
2264 |
att2[1] = att[1];
|
2265 |
}
|
2266 |
attribs.set(j, att2);
|
2267 |
}
|
2268 |
}
|
2269 |
attributes = attribs;*/
|
2270 |
} |
2271 |
|
2272 |
/**
|
2273 |
* Hace los setProp para los atributos extra.
|
2274 |
* @param feature
|
2275 |
*/
|
2276 |
private void completeAttributes(Feature feature) { |
2277 |
// 041130: Rellena las props con los atributos.
|
2278 |
for (int i=0;i<attributes.size();i++) { |
2279 |
String[] att = new String[2]; |
2280 |
att = (String[])attributes.get(i); |
2281 |
feature.setProp(att[0],att[1]); |
2282 |
} |
2283 |
} |
2284 |
|
2285 |
/**
|
2286 |
* Copia los atributos extra cargados en InsPoint y ya perfectamente definidos a los
|
2287 |
* elementos del bloque al que referencia el punto de insercion.
|
2288 |
* @param insert
|
2289 |
*/
|
2290 |
private void copyAttributes(Feature feaInsert) { |
2291 |
Feature feature = null;
|
2292 |
InsPoint insert = new InsPoint();
|
2293 |
insert = (InsPoint)feaInsert.getGeometry(); |
2294 |
for (int i=0; i<insert.getBlock().size(); i++) { |
2295 |
feature = (Feature)insert.getBlock().get(i); |
2296 |
for (int j=0;j<attributes.size();j++) { |
2297 |
String[] att = new String[2]; |
2298 |
att = (String[])attributes.get(j); |
2299 |
feature.setProp(att[0],feaInsert.getProp(att[0])); |
2300 |
} |
2301 |
} |
2302 |
} |
2303 |
|
2304 |
/**
|
2305 |
* Se ejecuta cuando se declaran nuevos atributos, es decir, tras cada ATTDEF.
|
2306 |
* A?ade estos atributos a las features existentes.
|
2307 |
*/
|
2308 |
private void setNewAttributes() { |
2309 |
for (int i=0;i<features.size();i++) { |
2310 |
Feature fea = new Feature();
|
2311 |
fea = (Feature)features.get(i); |
2312 |
completeAttributes(fea); |
2313 |
} |
2314 |
for (int i=0;i<blkList.size();i++) { |
2315 |
FeatureCollection bloque = new FeatureCollection(proj);
|
2316 |
bloque = (FeatureCollection)blkList.get(i); |
2317 |
for (int j=0;j<bloque.size();j++) { |
2318 |
Feature fea = new Feature();
|
2319 |
fea = (Feature)bloque.get(j); |
2320 |
completeAttributes(fea); |
2321 |
} |
2322 |
} |
2323 |
} |
2324 |
|
2325 |
public Vector getAttributes() { |
2326 |
return attributes;
|
2327 |
} |
2328 |
|
2329 |
/* (non-Javadoc)
|
2330 |
* @see org.cresques.io.DxfFile.EntityFactory#getExtent()
|
2331 |
*/
|
2332 |
public Extent getExtent() {
|
2333 |
Feature feature = new Feature();
|
2334 |
Extent extent = new Extent();
|
2335 |
Iterator iter = features.iterator();
|
2336 |
while (iter.hasNext()) {
|
2337 |
feature = (Feature)iter.next(); |
2338 |
extent.add(feature.getExtent()); |
2339 |
} |
2340 |
return extent;
|
2341 |
} |
2342 |
|
2343 |
public void setProjection(IProjection p) { |
2344 |
proj = p; |
2345 |
} |
2346 |
|
2347 |
/* (non-Javadoc)
|
2348 |
* @see org.cresques.io.DxfFile.EntityFactory#reProject(org.cresques.geo.ReProjection)
|
2349 |
*/
|
2350 |
public void reProject(ICoordTrans rp) { |
2351 |
Feature feature = new Feature();
|
2352 |
Extent extent = new Extent();
|
2353 |
Iterator iter = features.iterator();
|
2354 |
while (iter.hasNext()) {
|
2355 |
feature = (Feature)iter.next(); |
2356 |
((Projected) feature).reProject(rp); |
2357 |
extent.add(feature.getExtent()); |
2358 |
} |
2359 |
setProjection(rp.getPDest()); |
2360 |
} |
2361 |
|
2362 |
/* (non-Javadoc)
|
2363 |
* @see org.cresques.geo.Projected#getProjection()
|
2364 |
*/
|
2365 |
public IProjection getProjection() {
|
2366 |
return proj;
|
2367 |
} |
2368 |
|
2369 |
public IObjList getObjects() { return features;} |
2370 |
|
2371 |
public void draw(Graphics2D g, ViewPortData vp) { |
2372 |
Iterator iter = features.iterator();
|
2373 |
Extent extent; |
2374 |
while (iter.hasNext()) {
|
2375 |
Feature feature = new Feature();
|
2376 |
feature = (Feature)iter.next(); |
2377 |
extent = feature.getExtent(); |
2378 |
if (vp.getExtent().minX()> extent.maxX()) continue; |
2379 |
if (vp.getExtent().minY()> extent.maxY()) continue; |
2380 |
if (vp.getExtent().maxX()< extent.minX()) continue; |
2381 |
if (vp.getExtent().maxY()< extent.minY()) continue; |
2382 |
//if (!feature.layer.frozen)
|
2383 |
feature.draw(g, vp); |
2384 |
} |
2385 |
} |
2386 |
|
2387 |
public static Vector createArc(Point2D coord1, Point2D coord2, double bulge) { |
2388 |
return new DxfCalArcs(coord1, coord2, bulge).getPoints(1); |
2389 |
} |
2390 |
|
2391 |
/* (non-Javadoc)
|
2392 |
* @see org.cresques.io.DxfFile.EntityFactory#getBlkList()
|
2393 |
*/
|
2394 |
public Vector getBlkList() { |
2395 |
return blkList;
|
2396 |
} |
2397 |
|
2398 |
/* (non-Javadoc)
|
2399 |
* @see org.cresques.io.DxfFile.EntityFactory#getDxfEntityList()
|
2400 |
*/
|
2401 |
public DxfEntityList getDxfEntityList() {
|
2402 |
// TODO Auto-generated method stub
|
2403 |
return null; |
2404 |
} |
2405 |
|
2406 |
/* (non-Javadoc)
|
2407 |
* @see org.cresques.io.DxfFile.EntityFactory#getBlk()
|
2408 |
*/
|
2409 |
public DxfBlock getBlk() {
|
2410 |
// TODO Auto-generated method stub
|
2411 |
return null; |
2412 |
} |
2413 |
|
2414 |
} |