Revision 236 branches/v02_desarrollo/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java
DxfFeatureMaker.java | ||
---|---|---|
482 | 482 |
Feature feaBordes= new Feature(); |
483 | 483 |
Feature feaFondos= new Feature(); |
484 | 484 |
int flags = 0; |
485 |
int NumberOfVertices = 0; |
|
485 | 486 |
|
486 | 487 |
//feature.setProp("dxfEntity", "LwPolyline"); |
487 | 488 |
feaBordes.setProp("dxfEntity", "LwPolyline"); |
... | ... | |
546 | 547 |
feaBordes.setGeometry(lineString); |
547 | 548 |
isDoubleFeatured = false; |
548 | 549 |
} |
550 |
if (grp.hasCode(90)) |
|
551 |
NumberOfVertices = grp.getDataAsInt(90); |
|
549 | 552 |
|
550 | 553 |
int j = 0; |
551 | 554 |
double firstX = 0.0; |
552 | 555 |
double firstY = 0.0; |
556 |
boolean hasBulge = false; |
|
557 |
double bulgeLwp = 0.0; |
|
553 | 558 |
for (int i=0; i<grp.size(); i++) { |
554 | 559 |
g = (DxfGroup) grp.get(i); |
555 | 560 |
if (g.getCode() == 10) { |
... | ... | |
561 | 566 |
//lineString.add( proj.createPoint( x, y ) ); |
562 | 567 |
//polygon.add( proj.createPoint( x, y ) ); |
563 | 568 |
//geometria.add( proj.createPoint( x, y ) ); |
564 |
lineString.add( proj.createPoint( x, y ) ); |
|
565 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) ); |
|
566 |
if (j == 1) { |
|
567 |
firstX = x; |
|
568 |
firstY = y; |
|
569 |
//lineString.add( proj.createPoint( x, y ) ); |
|
570 |
//if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) ); |
|
571 |
|
|
572 |
if (hasBulge) { |
|
573 |
Point2D finalPoint = new Point2D.Double(x, y); |
|
574 |
//lineString.remove(lineString.pointNr()-1); |
|
575 |
//lineString.remove(lineString.pointNr()-1); |
|
576 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr()); |
|
577 |
//polygon.remove(polygon.pointNr()-1); |
|
578 |
//polygon.remove(polygon.pointNr()-1); |
|
579 |
Vector arc = createArc(lineString.get(lineString.pointNr()-1), finalPoint, bulgeLwp); |
|
580 |
lineString.remove(lineString.pointNr()-1); |
|
581 |
if (isDoubleFeatured) polygon.remove(polygon.pointNr()-1); |
|
582 |
if (bulgeLwp>0) { |
|
583 |
for (int k=0; k<arc.size(); k++) { |
|
584 |
Point2D ptAux = new Point2D.Double(); |
|
585 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
|
586 |
//System.out.println("createLwPolyline: ptAux = " + ptAux); |
|
587 |
lineString.add(ptAux); |
|
588 |
//if (lineString.pointNr() == 1) firstPt = ptAux; |
|
589 |
if (isDoubleFeatured) polygon.add(ptAux); |
|
590 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
|
591 |
} |
|
592 |
} else { |
|
593 |
for (int k=arc.size()-1; k>=0; k--) { |
|
594 |
Point2D ptAux = new Point2D.Double(); |
|
595 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
|
596 |
lineString.add(ptAux); |
|
597 |
if (isDoubleFeatured) polygon.add(ptAux); |
|
598 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
|
599 |
} |
|
600 |
} |
|
601 |
hasBulge = false; |
|
602 |
bulgeLwp = 0.0; |
|
603 |
} else { |
|
604 |
//System.out.println("createLwPolyline: hasBulge siempre es false"); |
|
605 |
lineString.add( proj.createPoint( x, y ) ); |
|
606 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) ); |
|
569 | 607 |
} |
570 |
x = 0.0; y = 0.0; |
|
608 |
|
|
609 |
} else if (g.getCode() == 42) { |
|
610 |
//System.out.println("createLwPolyline: Lee el bulgeLwp"); |
|
611 |
hasBulge = true; |
|
612 |
bulgeLwp = ((Double) g.getData()).doubleValue(); |
|
571 | 613 |
} |
614 |
if (j == 1) { |
|
615 |
firstX = x; |
|
616 |
firstY = y; |
|
617 |
} |
|
618 |
x = 0.0; y = 0.0; |
|
619 |
|
|
572 | 620 |
} |
573 | 621 |
if (isDoubleFeatured) { |
574 | 622 |
//geometria.add(proj.createPoint(firstX, firstY)); |
Also available in: Unified diff