14 |
14 |
import org.cresques.px.gml.FeatureCollection;
|
15 |
15 |
import org.cresques.px.gml.InsPoint;
|
16 |
16 |
import org.cresques.px.gml.LineString;
|
|
17 |
import org.cresques.px.gml.LineString3D;
|
17 |
18 |
import org.cresques.px.gml.Point;
|
18 |
19 |
import org.cresques.px.gml.Polygon;
|
|
20 |
import org.cresques.px.gml.Polygon3D;
|
19 |
21 |
|
20 |
|
import java.util.HashSet;
|
21 |
22 |
import java.util.Iterator;
|
22 |
|
import java.util.Set;
|
23 |
23 |
import java.util.Vector;
|
24 |
24 |
import java.awt.Graphics2D;
|
25 |
|
import java.awt.geom.GeneralPath;
|
26 |
25 |
import java.awt.geom.Point2D;
|
27 |
26 |
|
28 |
27 |
/**
|
... | ... | |
38 |
37 |
double bulge = 0.0;
|
39 |
38 |
double xtruX=0.0, xtruY=0.0, xtruZ=1.0;
|
40 |
39 |
int polylineFlag = 0;
|
41 |
|
Point2D firstPt = new Point2D.Double();
|
42 |
|
Point2D ptAnterior = null;
|
|
40 |
Point3D firstPt = new Point3D();
|
|
41 |
Point3D ptAnterior = null;
|
43 |
42 |
|
44 |
43 |
boolean addingToBlock = false;
|
45 |
44 |
int iterator = 0;
|
... | ... | |
85 |
84 |
}
|
86 |
85 |
|
87 |
86 |
public void createPolyline(DxfGroupVector grp) throws Exception {
|
88 |
|
LineString lineString = new LineString();
|
89 |
|
Polygon polygon = new Polygon();
|
|
87 |
LineString3D lineString3D = new LineString3D();
|
|
88 |
Polygon3D polygon3D = new Polygon3D();
|
90 |
89 |
//Feature feature= new Feature();
|
91 |
90 |
Feature feaBordes= new Feature();
|
92 |
91 |
Feature feaFondos= new Feature();
|
... | ... | |
161 |
160 |
if (grp.hasCode(230))
|
162 |
161 |
xtruZ = grp.getDataAsDouble(230);
|
163 |
162 |
if ((flags & 0x01) == 0x01 || (flags & 0x40) == 0x40) {
|
164 |
|
feaBordes.setGeometry(lineString);
|
165 |
|
feaFondos.setGeometry(polygon);
|
|
163 |
feaBordes.setGeometry(lineString3D);
|
|
164 |
feaFondos.setGeometry(polygon3D);
|
166 |
165 |
lastFeaBordes = feaBordes;
|
167 |
166 |
lastFeaFondos = feaFondos;
|
168 |
167 |
isDoubleFeatured = true;
|
169 |
168 |
} else if ((flags & 0x01) == 0x00) {
|
170 |
|
feaBordes.setGeometry(lineString);
|
|
169 |
feaBordes.setGeometry(lineString3D);
|
171 |
170 |
lastFeaBordes = feaBordes;
|
172 |
171 |
isDoubleFeatured = false;
|
173 |
172 |
} else {
|
... | ... | |
178 |
177 |
|
179 |
178 |
public void endSeq() throws Exception {
|
180 |
179 |
if (isDoubleFeatured) {
|
181 |
|
if (lastFeaBordes.getGeometry() instanceof LineString) {
|
182 |
|
Feature feaBordes = lastFeaBordes;
|
183 |
|
Feature feaFondos = lastFeaFondos;
|
184 |
|
LineString lineString = (LineString)feaBordes.getGeometry();
|
185 |
|
Polygon polygon = (Polygon)feaFondos.getGeometry();
|
186 |
|
lineString.add(firstPt);
|
|
180 |
if (lastFeaBordes.getGeometry() instanceof LineString3D) {
|
|
181 |
Feature feaBordes = lastFeaBordes;
|
|
182 |
Feature feaFondos = lastFeaFondos;
|
|
183 |
LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
|
|
184 |
Polygon3D polygon3D = (Polygon3D)feaFondos.getGeometry();
|
|
185 |
lineString3D.add(firstPt);
|
187 |
186 |
// 041103: linea anulada porque hay pol?gonos en los que al final
|
188 |
187 |
// a?ade el (0,0). Parece que a?adimos el punto inicial
|
189 |
188 |
// del pol?gono una vez pero parece que el pol?gono, por
|
... | ... | |
194 |
193 |
if (bulge!=0) {
|
195 |
194 |
|
196 |
195 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
197 |
|
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge);
|
198 |
|
lineString.remove(lineString.pointNr()-1);
|
199 |
|
lineString.remove(lineString.pointNr()-1);
|
200 |
|
polygon.remove(lineString.pointNr()-1);
|
201 |
|
polygon.remove(lineString.pointNr()-1);
|
|
196 |
Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr()-2).getX(), lineString3D.get(lineString3D.pointNr()-2).getY()), new Point2D.Double(lineString3D.get(lineString3D.pointNr()-1).getX(), lineString3D.get(lineString3D.pointNr()-1).getY()), bulge);
|
|
197 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
198 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
199 |
polygon3D.remove(lineString3D.pointNr()-1);
|
|
200 |
polygon3D.remove(lineString3D.pointNr()-1);
|
202 |
201 |
if (bulge>0) {
|
203 |
202 |
for (int i=0; i<arc.size(); i++) {
|
204 |
203 |
Point2D ptAux = new Point2D.Double();
|
|
204 |
double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
|
205 |
205 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
206 |
|
lineString.add(ptAux);
|
207 |
|
polygon.add(ptAux);
|
208 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
206 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
207 |
lineString3D.add(ptAux3D);
|
|
208 |
polygon3D.add(ptAux3D);
|
|
209 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
209 |
210 |
}
|
210 |
211 |
} else {
|
211 |
212 |
for (int i=arc.size()-1; i>=0; i--) {
|
212 |
213 |
Point2D ptAux = new Point2D.Double();
|
|
214 |
double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
|
213 |
215 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
214 |
|
lineString.add(ptAux);
|
215 |
|
polygon.add(ptAux);
|
216 |
|
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
|
|
216 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
217 |
lineString3D.add(ptAux3D);
|
|
218 |
polygon3D.add(ptAux3D);
|
|
219 |
if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
|
217 |
220 |
}
|
218 |
221 |
}
|
219 |
222 |
// 041122
|
... | ... | |
243 |
246 |
//System.out.println("endSeq(): hasFaces = " + hasFaces);
|
244 |
247 |
//System.out.println("endSeq(): i0 = " + i0);
|
245 |
248 |
//System.out.println("endSeq(): lineString.pointNr() = " + lineString.pointNr());
|
246 |
|
ls1.add((Point2D)lineString.get(i0-1));
|
247 |
|
pl1.add((Point2D)polygon.get(i0-1));
|
|
249 |
ls1.add((Point2D)lineString3D.get(i0-1));
|
|
250 |
pl1.add((Point2D)polygon3D.get(i0-1));
|
248 |
251 |
//ls1.add((Point2D)lineString.get(Math.abs(i1)-1));
|
249 |
252 |
//pl1.add((Point2D)polygon.get(Math.abs(i1)-1));
|
250 |
253 |
} else {
|
251 |
|
ls2.add((Point2D)lineString.get(i0-1));
|
252 |
|
pl2.add((Point2D)polygon.get(i0-1));
|
|
254 |
ls2.add((Point2D)lineString3D.get(i0-1));
|
|
255 |
pl2.add((Point2D)polygon3D.get(i0-1));
|
253 |
256 |
//ls2.add((Point2D)lineString.get(Math.abs(i1)-1));
|
254 |
257 |
//pl2.add((Point2D)polygon.get(Math.abs(i1)-1));
|
255 |
258 |
}
|
... | ... | |
272 |
275 |
lastFeaBordes.setGeometry(ls);
|
273 |
276 |
lastFeaFondos.setGeometry(pl);
|
274 |
277 |
} else {
|
275 |
|
lastFeaBordes.setGeometry(lineString);
|
276 |
|
lastFeaFondos.setGeometry(polygon);
|
|
278 |
lastFeaBordes.setGeometry(lineString3D);
|
|
279 |
lastFeaFondos.setGeometry(polygon3D);
|
277 |
280 |
}
|
278 |
281 |
|
279 |
282 |
// 041130: Rellena las props con los atributos.
|
... | ... | |
314 |
317 |
// Caso no contemplado.
|
315 |
318 |
}
|
316 |
319 |
} else {
|
317 |
|
if (lastFeaBordes.getGeometry() instanceof LineString) {
|
|
320 |
if (lastFeaBordes.getGeometry() instanceof LineString3D) {
|
318 |
321 |
Feature feaBordes = lastFeaBordes;
|
319 |
|
LineString lineString = (LineString)feaBordes.getGeometry();
|
|
322 |
LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
|
320 |
323 |
if (bulge!=0) {
|
321 |
324 |
|
322 |
325 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
323 |
|
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge);
|
324 |
|
lineString.remove(lineString.pointNr()-1);
|
325 |
|
lineString.remove(lineString.pointNr()-1);
|
|
326 |
Vector arc = createArc(new Point2D.Double(lineString3D.get(lineString3D.pointNr()-2).getX(), lineString3D.get(lineString3D.pointNr()-2).getY()), new Point2D.Double(lineString3D.get(lineString3D.pointNr()-1).getX(), lineString3D.get(lineString3D.pointNr()-1).getY()), bulge);
|
|
327 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
328 |
lineString3D.remove(lineString3D.pointNr()-1);
|
326 |
329 |
if (bulge>0) {
|
327 |
330 |
for (int i=0; i<arc.size(); i++) {
|
328 |
331 |
Point2D ptAux = new Point2D.Double();
|
|
332 |
double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
|
329 |
333 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
330 |
|
lineString.add(ptAux);
|
331 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
334 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
335 |
lineString3D.add(ptAux3D);
|
|
336 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
332 |
337 |
}
|
333 |
338 |
} else {
|
334 |
339 |
for (int i=arc.size()-1; i>=0; i--) {
|
335 |
340 |
Point2D ptAux = new Point2D.Double();
|
|
341 |
double z = ((Point3D)lineString3D.get(lineString3D.pointNr()-2)).getZ();
|
336 |
342 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
337 |
|
lineString.add(ptAux);
|
338 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
343 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
344 |
lineString3D.add(ptAux3D);
|
|
345 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
339 |
346 |
}
|
340 |
347 |
}
|
341 |
348 |
// 041122
|
... | ... | |
358 |
365 |
i1 = face[i];
|
359 |
366 |
if (i0 > 0) {
|
360 |
367 |
if ((facesIterador%2)!=0) {
|
361 |
|
ls1.add((Point2D)lineString.get(i0-1));
|
|
368 |
ls1.add((Point2D)lineString3D.get(i0-1));
|
362 |
369 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
363 |
370 |
} else {
|
364 |
|
ls2.add((Point2D)lineString.get(i0-1));
|
|
371 |
ls2.add((Point2D)lineString3D.get(i0-1));
|
365 |
372 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
366 |
373 |
}
|
367 |
374 |
facesIterador = facesIterador + 1;
|
... | ... | |
379 |
386 |
ls.add(facesFirstPoint);
|
380 |
387 |
lastFeaBordes.setGeometry(ls);
|
381 |
388 |
} else {
|
382 |
|
lastFeaBordes.setGeometry(lineString);
|
|
389 |
lastFeaBordes.setGeometry(lineString3D);
|
383 |
390 |
}
|
384 |
391 |
|
385 |
392 |
// 041130: Rellena las props con los atributos.
|
... | ... | |
410 |
417 |
if (isDoubleFeatured) {
|
411 |
418 |
Feature feaBordes = lastFeaBordes;
|
412 |
419 |
Feature feaFondos = lastFeaFondos;
|
413 |
|
LineString lineString = (LineString)feaBordes.getGeometry();
|
414 |
|
Polygon polygon = (Polygon)feaFondos.getGeometry();
|
|
420 |
LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
|
|
421 |
Polygon3D polygon3D = (Polygon3D)feaFondos.getGeometry();
|
415 |
422 |
if (grp.hasCode(8)) {
|
416 |
423 |
feaBordes.setProp("layer", grp.getDataAsString(8));
|
417 |
424 |
feaFondos.setProp("layer", grp.getDataAsString(8));
|
... | ... | |
426 |
433 |
}
|
427 |
434 |
Point3D point_in = new Point3D(x, y, z);
|
428 |
435 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
429 |
|
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
|
436 |
Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
430 |
437 |
x = point_out.getX();
|
431 |
438 |
y = point_out.getY();
|
|
439 |
z = point_out.getZ();
|
432 |
440 |
//System.out.println("addVertex(): vFlags = " + vFlags);
|
433 |
441 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) {
|
434 |
442 |
int [] face = {0,0,0,0};
|
... | ... | |
441 |
449 |
// Son vertices que se trataran cuando se implementen
|
442 |
450 |
// los splines. En principio no se hace nada con ellos.
|
443 |
451 |
} else {
|
444 |
|
Point2D pt = proj.createPoint( x, y);
|
445 |
|
lineString.add(pt);
|
446 |
|
polygon.add(pt);
|
447 |
|
if (lineString.pointNr() == 1) {
|
|
452 |
Point3D pt = new Point3D(proj.createPoint( x, y).getX(), proj.createPoint( x, y).getY(), z);
|
|
453 |
lineString3D.add(pt);
|
|
454 |
polygon3D.add(pt);
|
|
455 |
if (lineString3D.pointNr() == 1) {
|
448 |
456 |
firstPt = pt;
|
449 |
457 |
}
|
450 |
458 |
if (bulge == 0.0) {
|
... | ... | |
458 |
466 |
} else { bulge_aux = 0.0; }
|
459 |
467 |
//int cnt = lineString.pointNr();
|
460 |
468 |
//System.out.println("addVertex(): lineString.pointNr() = " + lineString.pointNr());
|
461 |
|
lineString.remove(lineString.pointNr()-1);
|
462 |
|
lineString.remove(lineString.pointNr()-1);
|
|
469 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
470 |
lineString3D.remove(lineString3D.pointNr()-1);
|
463 |
471 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
464 |
|
polygon.remove(polygon.pointNr()-1);
|
465 |
|
polygon.remove(polygon.pointNr()-1);
|
|
472 |
polygon3D.remove(polygon3D.pointNr()-1);
|
|
473 |
polygon3D.remove(polygon3D.pointNr()-1);
|
466 |
474 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
467 |
475 |
if (bulge>0) {
|
468 |
476 |
for (int i=0; i<arc.size(); i++) {
|
469 |
477 |
Point2D ptAux = new Point2D.Double();
|
470 |
478 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
471 |
|
lineString.add(ptAux);
|
472 |
|
polygon.add(ptAux);
|
473 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
479 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
480 |
lineString3D.add(ptAux3D);
|
|
481 |
polygon3D.add(ptAux3D);
|
|
482 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
474 |
483 |
}
|
475 |
484 |
} else {
|
476 |
485 |
for (int i=arc.size()-1; i>=0; i--) {
|
477 |
486 |
Point2D ptAux = new Point2D.Double();
|
478 |
487 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
479 |
|
lineString.add(ptAux);
|
480 |
|
polygon.add(ptAux);
|
481 |
|
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
|
482 |
|
}
|
|
488 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
489 |
lineString3D.add(ptAux3D);
|
|
490 |
polygon3D.add(ptAux3D);
|
|
491 |
if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
|
|
492 |
}
|
483 |
493 |
}
|
484 |
494 |
bulge = bulge_aux;
|
485 |
495 |
}
|
... | ... | |
487 |
497 |
}
|
488 |
498 |
} else {
|
489 |
499 |
Feature feaBordes = lastFeaBordes;
|
490 |
|
LineString lineString = (LineString)feaBordes.getGeometry();
|
|
500 |
LineString3D lineString3D = (LineString3D)feaBordes.getGeometry();
|
491 |
501 |
if (grp.hasCode(8))
|
492 |
502 |
feaBordes.setProp("layer", grp.getDataAsString(8));
|
493 |
503 |
if (grp.hasCode(70)) {
|
... | ... | |
500 |
510 |
}
|
501 |
511 |
Point3D point_in = new Point3D(x, y, z);
|
502 |
512 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
503 |
|
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
|
513 |
Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
504 |
514 |
x = point_out.getX();
|
505 |
515 |
y = point_out.getY();
|
|
516 |
z = point_out.getZ();
|
506 |
517 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) {
|
507 |
518 |
int [] face = {0,0,0,0};
|
508 |
519 |
face[0] = grp.getDataAsInt(71);
|
... | ... | |
513 |
524 |
} else if ((vFlags & 16) == 16) {
|
514 |
525 |
// no se hace nada.
|
515 |
526 |
} else {
|
516 |
|
Point2D pt = proj.createPoint( x, y);
|
517 |
|
lineString.add(pt);
|
|
527 |
Point3D pt = new Point3D(proj.createPoint( x, y).getX(), proj.createPoint( x, y).getY(), z);
|
|
528 |
lineString3D.add(pt);
|
518 |
529 |
//System.out.println("addVertex: pt = " + pt);
|
519 |
|
if (lineString.pointNr() == 1) {
|
|
530 |
if (lineString3D.pointNr() == 1) {
|
520 |
531 |
firstPt = pt;
|
521 |
532 |
//System.out.println("addVertex(Primer pto de la lineString, firstPt=pt): firstPt = " + firstPt);
|
522 |
533 |
}
|
... | ... | |
536 |
547 |
//System.out.println("addVertex: arco del ptAnterior al ptActual.");
|
537 |
548 |
//System.out.println("addVertex: ptAnterior = " + ptAnterior + ", ptActual = " + pt);
|
538 |
549 |
// Borro los puntos inicio y final del arco.
|
539 |
|
lineString.remove(lineString.pointNr()-1);
|
540 |
|
lineString.remove(lineString.pointNr()-1);
|
|
550 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
551 |
lineString3D.remove(lineString3D.pointNr()-1);
|
541 |
552 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
542 |
553 |
if (bulge>0) {
|
543 |
554 |
for (int i=0; i<arc.size(); i++) {
|
544 |
555 |
Point2D ptAux = new Point2D.Double();
|
545 |
556 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
546 |
|
lineString.add(ptAux);
|
547 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
557 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
558 |
lineString3D.add(ptAux3D);
|
|
559 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
548 |
560 |
}
|
549 |
561 |
} else {
|
550 |
562 |
for (int i=arc.size()-1; i>=0; i--) {
|
551 |
563 |
Point2D ptAux = new Point2D.Double();
|
552 |
564 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
|
553 |
|
lineString.add(ptAux);
|
554 |
|
if (lineString.pointNr() == 1) firstPt = ptAux;
|
|
565 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), z);
|
|
566 |
lineString3D.add(ptAux3D);
|
|
567 |
if (lineString3D.pointNr() == 1) firstPt = ptAux3D;
|
555 |
568 |
}
|
556 |
569 |
}
|
557 |
570 |
bulge = bulge_aux;
|
... | ... | |
565 |
578 |
double x = 0.0, y = 0.0;
|
566 |
579 |
double elev = 0.0;
|
567 |
580 |
DxfGroup g = null;
|
568 |
|
LineString lineString = new LineString();
|
569 |
|
Polygon polygon = new Polygon();
|
|
581 |
LineString3D lineString3D = new LineString3D();
|
|
582 |
Polygon3D polygon3D = new Polygon3D();
|
570 |
583 |
//Geometry geometria;
|
571 |
584 |
//Feature feature= new Feature();
|
572 |
585 |
Feature feaBordes= new Feature();
|
... | ... | |
629 |
642 |
flags = grp.getDataAsInt(70);
|
630 |
643 |
if ((flags & 0x01) == 0x01) {
|
631 |
644 |
//geometria = new Polygon();
|
632 |
|
feaBordes.setGeometry(lineString);
|
633 |
|
feaFondos.setGeometry(polygon);
|
|
645 |
feaBordes.setGeometry(lineString3D);
|
|
646 |
feaFondos.setGeometry(polygon3D);
|
634 |
647 |
isDoubleFeatured = true;
|
635 |
648 |
} else {
|
636 |
649 |
//geometria = new LineString();
|
637 |
|
feaBordes.setGeometry(lineString);
|
|
650 |
feaBordes.setGeometry(lineString3D);
|
638 |
651 |
isDoubleFeatured = false;
|
639 |
652 |
}
|
640 |
653 |
if (grp.hasCode(90))
|
... | ... | |
666 |
679 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
667 |
680 |
//polygon.remove(polygon.pointNr()-1);
|
668 |
681 |
//polygon.remove(polygon.pointNr()-1);
|
669 |
|
Vector arc = createArc(lineString.get(lineString.pointNr()-1), finalPoint, bulgeLwp);
|
670 |
|
lineString.remove(lineString.pointNr()-1);
|
671 |
|
if (isDoubleFeatured) polygon.remove(polygon.pointNr()-1);
|
|
682 |
Vector arc = createArc(((LineString3D)lineString3D).get(lineString3D.pointNr()-1), finalPoint, bulgeLwp);
|
|
683 |
lineString3D.remove(lineString3D.pointNr()-1);
|
|
684 |
if (isDoubleFeatured) polygon3D.remove(polygon3D.pointNr()-1);
|
672 |
685 |
if (bulgeLwp>0) {
|
673 |
686 |
for (int k=0; k<arc.size(); k++) {
|
674 |
687 |
Point2D ptAux = new Point2D.Double();
|
675 |
688 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY());
|
676 |
689 |
//System.out.println("createLwPolyline: ptAux = " + ptAux);
|
677 |
|
lineString.add(ptAux);
|
|
690 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), elev);
|
|
691 |
lineString3D.add(ptAux3D);
|
678 |
692 |
//if (lineString.pointNr() == 1) firstPt = ptAux;
|
679 |
|
if (isDoubleFeatured) polygon.add(ptAux);
|
680 |
|
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
|
|
693 |
if (isDoubleFeatured) polygon3D.add(ptAux3D);
|
|
694 |
if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
|
681 |
695 |
}
|
682 |
696 |
} else {
|
683 |
697 |
for (int k=arc.size()-1; k>=0; k--) {
|
684 |
698 |
Point2D ptAux = new Point2D.Double();
|
685 |
699 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY());
|
686 |
|
lineString.add(ptAux);
|
687 |
|
if (isDoubleFeatured) polygon.add(ptAux);
|
688 |
|
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux;
|
|
700 |
Point3D ptAux3D = new Point3D(ptAux.getX(), ptAux.getY(), elev);
|
|
701 |
lineString3D.add(ptAux3D);
|
|
702 |
if (isDoubleFeatured) polygon3D.add(ptAux3D);
|
|
703 |
if (lineString3D.pointNr() == 1 || polygon3D.pointNr() == 1) firstPt = ptAux3D;
|
689 |
704 |
}
|
690 |
705 |
}
|
691 |
706 |
hasBulge = false;
|
692 |
707 |
bulgeLwp = 0.0;
|
693 |
708 |
} else {
|
694 |
709 |
//System.out.println("createLwPolyline: hasBulge siempre es false");
|
695 |
|
lineString.add( proj.createPoint( x, y ) );
|
696 |
|
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
|
710 |
Point3D ptAux3D = new Point3D(proj.createPoint( x, y ).getX(), proj.createPoint( x, y ).getY(), elev);
|
|
711 |
lineString3D.add(ptAux3D);
|
|
712 |
if (isDoubleFeatured) polygon3D.add(ptAux3D);
|
697 |
713 |
}
|
698 |
714 |
if (j == 1) {
|
699 |
715 |
firstX = x;
|
... | ... | |
709 |
725 |
}
|
710 |
726 |
if (isDoubleFeatured) {
|
711 |
727 |
//geometria.add(proj.createPoint(firstX, firstY));
|
712 |
|
lineString.add(proj.createPoint(firstX, firstY));
|
713 |
|
polygon.add(proj.createPoint(firstX, firstY));
|
|
728 |
Point3D ptAux3D = new Point3D(proj.createPoint(firstX, firstY).getX(), proj.createPoint(firstX, firstY).getY(), elev);
|
|
729 |
lineString3D.add(ptAux3D);
|
|
730 |
polygon3D.add(ptAux3D);
|
714 |
731 |
}
|
715 |
732 |
|
716 |
733 |
lastFeaBordes = feaBordes;
|
... | ... | |
737 |
754 |
double elev = 0.0;
|
738 |
755 |
DxfGroup g = null;
|
739 |
756 |
Point2D pt1 = null, pt2 = null;
|
740 |
|
LineString lineString = new LineString();
|
|
757 |
LineString3D lineString3D = new LineString3D();
|
741 |
758 |
Feature feature = new Feature();
|
742 |
759 |
|
743 |
760 |
feature.setProp("dxfEntity", "Line");
|
... | ... | |
771 |
788 |
elev = z1;
|
772 |
789 |
Double doub = new Double(elev);
|
773 |
790 |
String string = doub.toString();
|
774 |
|
feature.setProp("elevation", string);
|
|
791 |
//feature.setProp("elevation", string);
|
775 |
792 |
}
|
776 |
793 |
pt1 = proj.createPoint(x, y);
|
777 |
794 |
x = grp.getDataAsDouble(11);
|
... | ... | |
782 |
799 |
// Cuando no se especifican z para las lineas se asume que la
|
783 |
800 |
// z es cero.
|
784 |
801 |
Double doub = new Double(0.0);
|
785 |
|
feature.setProp("elevation", doub.toString());
|
|
802 |
//feature.setProp("elevation", doub.toString());
|
786 |
803 |
}
|
787 |
804 |
pt2 = proj.createPoint(x, y);
|
788 |
805 |
if (grp.hasCode(210))
|
... | ... | |
794 |
811 |
Point3D point_in1 = new Point3D(pt1.getX(), pt1.getY(), z1);
|
795 |
812 |
Point3D point_in2 = new Point3D(pt2.getX(), pt2.getY(), z2);
|
796 |
813 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
797 |
|
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
798 |
|
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
799 |
|
pt1.setLocation(point_out1);
|
800 |
|
pt2.setLocation(point_out2);
|
801 |
|
lineString.add(pt1);
|
802 |
|
lineString.add(pt2);
|
|
814 |
Point3D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
|
815 |
Point3D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
|
816 |
//pt1.setLocation(point_out1);
|
|
817 |
//pt2.setLocation(point_out2);
|
|
818 |
lineString3D.add(point_out1);
|
|
819 |
lineString3D.add(point_out2);
|
803 |
820 |
|
804 |
|
feature.setGeometry(lineString);
|
|
821 |
feature.setGeometry(lineString3D);
|
805 |
822 |
|
806 |
823 |
// 041130: Rellena las props con los atributos.
|
807 |
824 |
completeAttributes(feature);
|
... | ... | |
1109 |
1126 |
public void createCircle(DxfGroupVector grp) throws Exception {
|
1110 |
1127 |
double x = 0.0, y = 0.0, z = 0.0;
|
1111 |
1128 |
double r = 0.0;
|
|
1129 |
Point3D firstPt = new Point3D();
|
1112 |
1130 |
DxfGroup g = null;
|
1113 |
|
LineString lineString = new LineString();
|
1114 |
|
Polygon polygon = new Polygon();
|
|
1131 |
LineString3D lineString3D = new LineString3D();
|
|
1132 |
Polygon3D polygon3D = new Polygon3D();
|
1115 |
1133 |
Feature feaBordes = new Feature();
|
1116 |
1134 |
Feature feaFondos = new Feature();
|
1117 |
1135 |
|
... | ... | |
1169 |
1187 |
xtruZ = grp.getDataAsDouble(230);
|
1170 |
1188 |
Point3D point_in = new Point3D(x, y, z);
|
1171 |
1189 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1172 |
|
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
|
1190 |
Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1173 |
1191 |
x = point_out.getX();
|
1174 |
1192 |
y = point_out.getY();
|
|
1193 |
z = point_out.getZ();
|
1175 |
1194 |
|
1176 |
1195 |
Point2D center = proj.createPoint( x, y);
|
1177 |
|
Point2D[] pts = new Point2D[360];
|
|
1196 |
Point3D[] pts = new Point3D[360];
|
1178 |
1197 |
int angulo = 0;
|
1179 |
1198 |
for (angulo=0; angulo<360; angulo++) {
|
1180 |
|
pts[angulo] = new Point2D.Double(center.getX(), center.getY());
|
1181 |
|
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));
|
|
1199 |
pts[angulo] = new Point3D(center.getX(), center.getY(), z);
|
|
1200 |
pts[angulo] = new Point3D(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[angulo].getY() + r * Math.cos(angulo*Math.PI/(double)180.0), z);
|
1182 |
1201 |
if (pts.length == 1) {
|
1183 |
1202 |
firstPt = pts[angulo];
|
1184 |
1203 |
}
|
1185 |
1204 |
}
|
1186 |
1205 |
for (int i=0; i<pts.length; i++) {
|
1187 |
|
lineString.add(pts[i]);
|
1188 |
|
polygon.add(pts[i]);
|
|
1206 |
lineString3D.add(pts[i]);
|
|
1207 |
polygon3D.add(pts[i]);
|
1189 |
1208 |
}
|
1190 |
1209 |
|
1191 |
|
feaBordes.setGeometry(lineString);
|
1192 |
|
feaFondos.setGeometry(polygon);
|
|
1210 |
feaBordes.setGeometry(lineString3D);
|
|
1211 |
feaFondos.setGeometry(polygon3D);
|
1193 |
1212 |
|
1194 |
1213 |
// 041130: Rellena las props con los atributos.
|
1195 |
1214 |
completeAttributes(feaBordes);
|
... | ... | |
1211 |
1230 |
double x = 0.0, y = 0.0, z = 0.0;
|
1212 |
1231 |
double r = 0.0, empieza = 0.0, acaba = 0.0;
|
1213 |
1232 |
DxfGroup g = null;
|
1214 |
|
LineString lineString = new LineString();
|
|
1233 |
LineString3D lineString3D = new LineString3D();
|
1215 |
1234 |
Feature feature = new Feature();
|
1216 |
1235 |
|
1217 |
1236 |
feature.setProp("dxfEntity", "Arc");
|
... | ... | |
1260 |
1279 |
xtruZ = grp.getDataAsDouble(230);
|
1261 |
1280 |
Point3D point_in = new Point3D(x, y, z);
|
1262 |
1281 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1263 |
|
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
|
1282 |
Point3D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1264 |
1283 |
x = point_out.getX();
|
1265 |
1284 |
y = point_out.getY();
|
|
1285 |
z = point_out.getZ();
|
1266 |
1286 |
|
1267 |
1287 |
Point2D center = proj.createPoint( x, y);
|
1268 |
1288 |
//System.out.println("empieza = " + empieza + ", acaba = " + acaba);
|
... | ... | |
1270 |
1290 |
int iacaba = (int)acaba;
|
1271 |
1291 |
//System.out.println("iempieza = " + iempieza + ", iacaba = " + iacaba);
|
1272 |
1292 |
double angulo = 0;
|
1273 |
|
Point2D[] pts = null;
|
|
1293 |
Point3D[] pts = null;
|
1274 |
1294 |
if (empieza <= acaba) {
|
1275 |
|
pts = new Point2D[(iacaba-iempieza)+2];
|
|
1295 |
pts = new Point3D[(iacaba-iempieza)+2];
|
1276 |
1296 |
angulo = empieza;
|
1277 |
|
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));
|
|
1297 |
pts[0] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1278 |
1298 |
for (int i=1; i<=(iacaba-iempieza)+1; i++) {
|
1279 |
1299 |
angulo = (double)(iempieza+i);
|
1280 |
|
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));
|
|
1300 |
pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1281 |
1301 |
}
|
1282 |
1302 |
angulo = acaba;
|
1283 |
|
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));
|
|
1303 |
pts[(iacaba-iempieza)+1] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1284 |
1304 |
} else {
|
1285 |
|
pts = new Point2D[(360-iempieza)+iacaba+2];
|
|
1305 |
pts = new Point3D[(360-iempieza)+iacaba+2];
|
1286 |
1306 |
angulo = empieza;
|
1287 |
1307 |
//System.out.println("pts[0] = " + pts[0] + ", center = " + center + ", angulo = " + angulo);
|
1288 |
|
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));
|
|
1308 |
pts[0] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1289 |
1309 |
for (int i=1; i<=(360-iempieza); i++) {
|
1290 |
1310 |
angulo = (double)(iempieza+i);
|
1291 |
|
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));
|
|
1311 |
pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1292 |
1312 |
}
|
1293 |
1313 |
for (int i=(360-iempieza)+1; i<=(360-iempieza)+iacaba; i++) {
|
1294 |
1314 |
angulo = (double)(i-(360-iempieza));
|
1295 |
|
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));
|
|
1315 |
pts[i] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1296 |
1316 |
}
|
1297 |
1317 |
angulo = acaba;
|
1298 |
|
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));
|
|
1318 |
pts[(360-iempieza)+iacaba+1] = new Point3D(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0), z);
|
1299 |
1319 |
}
|
1300 |
1320 |
for (int i=0; i<pts.length; i++) {
|
1301 |
|
lineString.add(pts[i]);
|
|
1321 |
lineString3D.add(pts[i]);
|
1302 |
1322 |
}
|
1303 |
1323 |
|
1304 |
|
feature.setGeometry(lineString);
|
|
1324 |
feature.setGeometry(lineString3D);
|
1305 |
1325 |
|
1306 |
1326 |
// 041130: Rellena las props con los atributos.
|
1307 |
1327 |
completeAttributes(feature);
|
... | ... | |
1468 |
1488 |
double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0, z3 = 0.0, z4 = 0.0;
|
1469 |
1489 |
DxfGroup g = null;
|
1470 |
1490 |
//Point2D pt1 = null, pt2 = null, pt3 = null, pt4 = null;
|
1471 |
|
Point2D[] pts = new Point2D[4];
|
|
1491 |
Point3D[] pts = new Point3D[4];
|
1472 |
1492 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1473 |
1493 |
|
1474 |
|
LineString lineString = new LineString();
|
1475 |
|
Polygon polygon = new Polygon();
|
|
1494 |
LineString3D lineString3D = new LineString3D();
|
|
1495 |
Polygon3D polygon3D = new Polygon3D();
|
1476 |
1496 |
Feature feaBordes = new Feature();
|
1477 |
1497 |
Feature feaFondos = new Feature();
|
1478 |
|
double elev = 0;
|
|
1498 |
//double elev = 0;
|
1479 |
1499 |
|
1480 |
1500 |
feaBordes.setProp("dxfEntity", "Solid");
|
1481 |
1501 |
feaFondos.setProp("dxfEntity", "Solid");
|
... | ... | |
1486 |
1506 |
y = grp.getDataAsDouble(20);
|
1487 |
1507 |
if (grp.hasCode(30)) {
|
1488 |
1508 |
z1 = grp.getDataAsDouble(30);
|
1489 |
|
elev = z1;
|
1490 |
|
Double doub = new Double(elev);
|
1491 |
|
String string = doub.toString();
|
1492 |
|
feaBordes.setProp("elevation", string);
|
1493 |
|
feaFondos.setProp("elevation", string);
|
|
1509 |
//elev = z1;
|
|
1510 |
//Double doub = new Double(elev);
|
|
1511 |
//String string = doub.toString();
|
|
1512 |
//feaBordes.setProp("elevation", string);
|
|
1513 |
//feaFondos.setProp("elevation", string);
|
1494 |
1514 |
} else {
|
1495 |
1515 |
Double doub = new Double(0.0);
|
1496 |
1516 |
feaBordes.setProp("elevation", doub.toString());
|
1497 |
1517 |
feaFondos.setProp("elevation", doub.toString());
|
1498 |
1518 |
}
|
1499 |
|
pts[0] = proj.createPoint(x, y);
|
|
1519 |
Point3D pto3D = new Point3D(proj.createPoint(x, y).getX(), proj.createPoint(x, y).getY(), z1);
|
|
1520 |
pts[0] = pto3D;
|
1500 |
1521 |
x = grp.getDataAsDouble(11);
|
1501 |
1522 |
y = grp.getDataAsDouble(21);
|
1502 |
1523 |
if (grp.hasCode(31)) z2 = grp.getDataAsDouble(31);
|
1503 |
|
pts[1] = proj.createPoint(x, y);
|
|
1524 |
pto3D = new Point3D(proj.createPoint(x, y).getX(), proj.createPoint(x, y).getY(), z2);
|
|
1525 |
pts[1] = pto3D;
|
1504 |
1526 |
x = grp.getDataAsDouble(12);
|
1505 |
1527 |
y = grp.getDataAsDouble(22);
|
1506 |
1528 |
if (grp.hasCode(32)) z3 = grp.getDataAsDouble(32);
|
1507 |
|
pts[2] = proj.createPoint(x, y);
|
|
1529 |
pto3D = new Point3D(proj.createPoint(x, y).getX(), proj.createPoint(x, y).getY(), z3);
|
|
1530 |
pts[2] = pto3D;
|
1508 |
1531 |
x = grp.getDataAsDouble(13);
|
1509 |
1532 |
y = grp.getDataAsDouble(23);
|
1510 |
|
if (grp.hasCode(33)) z2 = grp.getDataAsDouble(33);
|
1511 |
|
pts[3] = proj.createPoint(x, y);
|
|
1533 |
if (grp.hasCode(33)) z4 = grp.getDataAsDouble(33);
|
|
1534 |
pto3D = new Point3D(proj.createPoint(x, y).getX(), proj.createPoint(x, y).getY(), z4);
|
|
1535 |
pts[3] = pto3D;
|
1512 |
1536 |
if (grp.hasCode(39)) {
|
1513 |
1537 |
Double doub = new Double(grp.getDataAsDouble(39));
|
1514 |
1538 |
String string = doub.toString();
|
... | ... | |
1547 |
1571 |
Point3D point_in3 = new Point3D(pts[2].getX(), pts[2].getY(), z3);
|
1548 |
1572 |
Point3D point_in4 = new Point3D(pts[3].getX(), pts[3].getY(), z4);
|
1549 |
1573 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1550 |
|
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
1551 |
|
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
1552 |
|
Point2D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
|
1553 |
|
Point2D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
|
1554 |
|
pts[0].setLocation(point_out1);
|
1555 |
|
pts[1].setLocation(point_out2);
|
1556 |
|
pts[2].setLocation(point_out3);
|
1557 |
|
pts[3].setLocation(point_out4);
|
|
1574 |
Point3D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
|
1575 |
Point3D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
|
1576 |
Point3D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
|
|
1577 |
Point3D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
|
|
1578 |
pts[0] = new Point3D(point_out1);
|
|
1579 |
pts[1] = new Point3D(point_out2);
|
|
1580 |
pts[2] = new Point3D(point_out3);
|
|
1581 |
pts[3] = new Point3D(point_out4);
|
1558 |
1582 |
|
1559 |
|
Point2D aux = pts[2];
|
|
1583 |
Point3D aux = pts[3];
|
1560 |
1584 |
pts[2] = pts[3];
|
1561 |
1585 |
pts[3] = aux;
|
1562 |
1586 |
|
1563 |
1587 |
for (int i=0; i<pts.length; i++) {
|
1564 |
|
lineString.add(pts[i]);
|
1565 |
|
polygon.add(pts[i]);
|
|
1588 |
lineString3D.add(pts[i]);
|
|
1589 |
polygon3D.add(pts[i]);
|
1566 |
1590 |
}
|
1567 |
1591 |
|
1568 |
1592 |
// Para cerrarlos.
|
1569 |
|
lineString.add(pts[0]);
|
1570 |
|
polygon.add(pts[0]);
|
|
1593 |
lineString3D.add(pts[0]);
|
|
1594 |
polygon3D.add(pts[0]);
|
1571 |
1595 |
|
1572 |
|
feaBordes.setGeometry(lineString);
|
1573 |
|
feaFondos.setGeometry(polygon);
|
|
1596 |
feaBordes.setGeometry(lineString3D);
|
|
1597 |
feaFondos.setGeometry(polygon3D);
|
1574 |
1598 |
|
1575 |
1599 |
// 041130: Rellena las props con los atributos.
|
1576 |
1600 |
completeAttributes(feaBordes);
|
... | ... | |
1589 |
1613 |
}
|
1590 |
1614 |
|
1591 |
1615 |
public void createSpline(DxfGroupVector grp) throws Exception {
|
1592 |
|
double x = 0.0, y = 0.0, z = 0.0, elev = 0.0;
|
|
1616 |
double x = 0.0, y = 0.0, z = 0.0; //elev = 0.0;
|
1593 |
1617 |
//double elev = 0.0;
|
1594 |
1618 |
DxfGroup g = null;
|
1595 |
|
LineString lineString = new LineString();
|
1596 |
|
Polygon polygon = new Polygon();
|
|
1619 |
LineString3D lineString3D = new LineString3D();
|
|
1620 |
Polygon3D polygon3D = new Polygon3D();
|
1597 |
1621 |
//Geometry geometria;
|
1598 |
1622 |
//Feature feature= new Feature();
|
1599 |
1623 |
Feature feaBordes= new Feature();
|
... | ... | |
1643 |
1667 |
flags = grp.getDataAsInt(70);
|
1644 |
1668 |
if ((flags & 0x01) == 0x01) {
|
1645 |
1669 |
//geometria = new Polygon();
|
1646 |
|
feaBordes.setGeometry(lineString);
|
1647 |
|
feaFondos.setGeometry(polygon);
|
|
1670 |
feaBordes.setGeometry(lineString3D);
|
|
1671 |
feaFondos.setGeometry(polygon3D);
|
1648 |
1672 |
isDoubleFeatured = true;
|
1649 |
1673 |
} else {
|
1650 |
1674 |
//geometria = new LineString();
|
1651 |
|
feaBordes.setGeometry(lineString);
|
|
1675 |
feaBordes.setGeometry(lineString3D);
|
1652 |
1676 |
isDoubleFeatured = false;
|
1653 |
1677 |
}
|
1654 |
1678 |
|
... | ... | |
1671 |
1695 |
z = ((Double) g.getData()).doubleValue();
|
1672 |
1696 |
// OJO --> proj.createPoint no acepta ptos con 3 coordenadas,
|
1673 |
1697 |
// ni gvSIG en esta fase de desarrollo.
|
1674 |
|
lineString.add(proj.createPoint(x, y));
|
1675 |
|
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
|
1698 |
Point3D p3d = new Point3D(proj.createPoint(x, y).getX(), proj.createPoint(x, y).getY(), z);
|
|
1699 |
lineString3D.add(p3d);
|
|
1700 |
if (isDoubleFeatured) polygon3D.add(p3d);
|
1676 |
1701 |
if (j == 1) {
|
1677 |
1702 |
firstX = x;
|
1678 |
1703 |
firstY = y;
|
1679 |
1704 |
firstZ = z;
|
1680 |
1705 |
}
|
1681 |
|
elev = z;
|
|
1706 |
//elev = z;
|
1682 |
1707 |
x = 0.0; y = 0.0; z = 0.0;
|
1683 |
1708 |
}
|
1684 |
1709 |
}
|
1685 |
1710 |
|
1686 |
|
Double doub = new Double(elev);
|
1687 |
|
String string = doub.toString();
|
|
1711 |
//Double doub = new Double(elev);
|
|
1712 |
//String string = doub.toString();
|
1688 |
1713 |
//feature.setProp("elevation", string);
|
1689 |
|
feaBordes.setProp("elevation", string);
|
1690 |
|
feaFondos.setProp("elevation", string);
|
|
1714 |
//feaBordes.setProp("elevation", string);
|
|
1715 |
//feaFondos.setProp("elevation", string);
|
1691 |
1716 |
|
1692 |
1717 |
if (isDoubleFeatured) {
|
1693 |
1718 |
//geometria.add(proj.createPoint(firstX, firstY));
|
1694 |
|
lineString.add(proj.createPoint(firstX, firstY));
|
1695 |
|
polygon.add(proj.createPoint(firstX, firstY));
|
|
1719 |
Point3D p3d = new Point3D(proj.createPoint(firstX, firstY).getX(), proj.createPoint(firstX, firstY).getY(), z);
|
|
1720 |
lineString3D.add(p3d);
|
|
1721 |
polygon3D.add(p3d);
|
1696 |
1722 |
}
|
1697 |
1723 |
|
1698 |
1724 |
lastFeaBordes = feaBordes;
|
... | ... | |
1980 |
2006 |
//gestionaInsert(feature);
|
1981 |
2007 |
//block.add(feature);
|
1982 |
2008 |
}
|
1983 |
|
|
1984 |
2009 |
}
|
1985 |
2010 |
}
|
1986 |
2011 |
}
|
... | ... | |
1989 |
2014 |
private void gestionaInsert(Feature feature) {
|
1990 |
2015 |
Feature feature2 = null;
|
1991 |
2016 |
Point point = null;
|
1992 |
|
LineString lineString = null;
|
1993 |
|
Polygon polygon = null;
|
|
2017 |
LineString3D lineString3D = null;
|
|
2018 |
Polygon3D polygon3D = null;
|
1994 |
2019 |
InsPoint insert = new InsPoint();
|
1995 |
2020 |
insert = (InsPoint)feature.getGeometry();
|
1996 |
2021 |
double bPointX = 0.0;
|
... | ... | |
2063 |
2088 |
feature3.setGeometry(insert3);
|
2064 |
2089 |
|
2065 |
2090 |
gestionaInsert(feature3);
|
2066 |
|
} else if (feature2.getGeometry() instanceof LineString) {
|
2067 |
|
lineString = (LineString)feature2.getGeometry();
|
2068 |
|
LineString lineString2 = new LineString();
|
2069 |
|
Point2D[] points = new Point2D[lineString.pointNr()];
|
2070 |
|
Point2D[] pointss = new Point2D[lineString.pointNr()];
|
2071 |
|
for (int j=0; j<lineString.pointNr(); j++) {
|
2072 |
|
points[j] = (Point2D)lineString.get(j);
|
2073 |
|
pointss[j] = new Point2D.Double();
|
|
2091 |
} else if (feature2.getGeometry() instanceof LineString3D) {
|
|
2092 |
lineString3D = (LineString3D)feature2.getGeometry();
|
|
2093 |
LineString3D lineString2 = new LineString3D();
|
|
2094 |
Point3D[] points = new Point3D[lineString3D.pointNr()];
|
|
2095 |
Point3D[] pointss = new Point3D[lineString3D.pointNr()];
|
|
2096 |
for (int j=0; j<lineString3D.pointNr(); j++) {
|
|
2097 |
points[j] = (Point3D)lineString3D.get(j);
|
|
2098 |
pointss[j] = new Point3D();
|
2074 |
2099 |
|
2075 |
2100 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY);
|
2076 |
2101 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad));
|
... | ... | |
2083 |
2108 |
feature3.setProp("layer", feature2.getProp("layer"));
|
2084 |
2109 |
feature3.setProp("color", feature2.getProp("color"));
|
2085 |
2110 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity"));
|
2086 |
|
feature3.setProp("elevation", feature2.getProp("elevation"));
|
|
2111 |
if (feature2.getProp("elevation")!=null) feature3.setProp("elevation", feature2.getProp("elevation"));
|
2087 |
2112 |
feature3.setProp("thickness", feature2.getProp("thickness"));
|
2088 |
2113 |
|
2089 |
2114 |
//041130
|
... | ... | |
2105 |
2130 |
if (addingToBlock == false) {
|
2106 |
2131 |
features.add(feature3);
|
2107 |
2132 |
}
|
2108 |
|
} else if (feature2.getGeometry() instanceof Polygon) {
|
2109 |
|
polygon = (Polygon)feature2.getGeometry();
|
2110 |
|
Polygon polygon2 = new Polygon();
|
2111 |
|
Point2D[] points = new Point2D[polygon.pointNr()];
|
2112 |
|
Point2D[] pointss = new Point2D[polygon.pointNr()];
|
2113 |
|
for (int j=0; j<polygon.pointNr(); j++) {
|
2114 |
|
points[j] = (Point2D)polygon.get(j);
|
2115 |
|
pointss[j] = new Point2D.Double();
|
|
2133 |
} else if (feature2.getGeometry() instanceof Polygon3D) {
|
|
2134 |
polygon3D = (Polygon3D)feature2.getGeometry();
|
|
2135 |
Polygon3D polygon2 = new Polygon3D();
|
|
2136 |
Point3D[] points = new Point3D[polygon3D.pointNr()];
|
|
2137 |
Point3D[] pointss = new Point3D[polygon3D.pointNr()];
|
|
2138 |
for (int j=0; j<polygon3D.pointNr(); j++) {
|
|
2139 |
points[j] = (Point3D)polygon3D.get(j);
|
|
2140 |
pointss[j] = new Point3D();
|
2116 |
2141 |
|
2117 |
2142 |
points[j].setLocation(points[j].getX() - bPointX, points[j].getY() - bPointY);
|
2118 |
2143 |
double laX = insert.get(0).getX() + ((points[j].getX()*sFactorX)*Math.cos(rAngleRad) + (points[j].getY()*sFactorY)*(-1)*Math.sin(rAngleRad));
|
... | ... | |
2125 |
2150 |
feature3.setProp("layer", feature2.getProp("layer"));
|
2126 |
2151 |
feature3.setProp("color", feature2.getProp("color"));
|
2127 |
2152 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity"));
|
2128 |
|
feature3.setProp("elevation", feature2.getProp("elevation"));
|
|
2153 |
if (feature2.getProp("elevation")!=null) feature3.setProp("elevation", feature2.getProp("elevation"));
|
2129 |
2154 |
feature3.setProp("thickness", feature2.getProp("thickness"));
|
2130 |
2155 |
|
2131 |
2156 |
//041130
|