Revision 5136
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/dxf/DxfWriter.java | ||
---|---|---|
138 | 138 |
createPoint3D(handle, k, geom); |
139 | 139 |
k++; |
140 | 140 |
} else if (geom.getGeometryType()==FShape.LINE) { |
141 |
createLwPolyline2D(handle, k, geom); |
|
141 |
createLwPolyline2D(handle, k, geom, false);
|
|
142 | 142 |
k++; |
143 | 143 |
} else if (geom.getGeometryType()==(FShape.LINE | FShape.Z)) { |
144 | 144 |
dxf3DFile = true; |
145 | 145 |
k = createPolyline3D(handle, k, geom); |
146 | 146 |
} else if (geom.getGeometryType()==FShape.POLYGON) { |
147 |
createPolygon2D(handle, k, geom); |
|
147 |
// createPolygon2D(handle, k, geom); |
|
148 |
createLwPolyline2D(handle, k, geom, true); |
|
148 | 149 |
k++; |
149 | 150 |
} else if (geom.getGeometryType()==(FShape.POLYGON | FShape.Z)) { |
150 | 151 |
dxf3DFile = true; |
151 |
k = createPolygon3D(handle, k, geom); |
|
152 |
k = createPolyline3D(handle, k, geom); |
|
153 |
// k = createPolygon3D(handle, k, geom); |
|
152 | 154 |
} else if (geom.getGeometryType()==FShape.CIRCLE) { |
153 | 155 |
FCircle2D circle = (FCircle2D) geom.getInternalShape(); |
154 | 156 |
createCircle2D(handle, k, circle); |
... | ... | |
503 | 505 |
createPoint3D(handle, k, geom); |
504 | 506 |
k++; |
505 | 507 |
} else if (geom.getGeometryType() == FShape.LINE) { |
506 |
createLwPolyline2D(handle, k, geom); |
|
508 |
createLwPolyline2D(handle, k, geom, false);
|
|
507 | 509 |
k++; |
508 | 510 |
} else if (geom.getGeometryType() == (FShape.LINE | FShape.Z)) { |
509 | 511 |
dxf3DFile = true; |
510 | 512 |
k = createPolyline3D(handle, k, geom); |
511 | 513 |
} else if (geom.getGeometryType() == FShape.POLYGON) { |
512 |
createPolygon2D(handle, k, geom); |
|
514 |
// createPolygon2D(handle, k, geom); |
|
515 |
createLwPolyline2D(handle, k, geom, true); |
|
513 | 516 |
k++; |
514 | 517 |
} else if (geom.getGeometryType() == (FShape.POLYGON | FShape.Z)) { |
515 | 518 |
dxf3DFile = true; |
... | ... | |
651 | 654 |
} |
652 | 655 |
|
653 | 656 |
/** |
657 |
* @deprecated |
|
654 | 658 |
* @param handle |
655 | 659 |
* @param k |
656 | 660 |
* @param geom |
... | ... | |
829 | 833 |
* @param geom |
830 | 834 |
* @throws Exception |
831 | 835 |
*/ |
832 |
private void createLwPolyline2D(int handle, int k, IGeometry geom) |
|
836 |
private void createLwPolyline2D(int handle, int k, IGeometry geom, boolean isPolygon)
|
|
833 | 837 |
throws Exception { |
834 |
DxfGroupVector polv = new DxfGroupVector();
|
|
838 |
DxfGroupVector polv = null;
|
|
835 | 839 |
DxfGroup polylineLayer = new DxfGroup(8, "default"); |
836 |
polv.add(polylineLayer); |
|
840 |
|
|
837 | 841 |
DxfGroup handleGroup = new DxfGroup(); |
838 | 842 |
handleGroup.setCode(5); |
839 | 843 |
handleGroup.setData(new Integer(handle + k).toString()); |
840 |
polv.add(handleGroup); |
|
844 |
|
|
841 | 845 |
Vector vpoints = new Vector(); |
846 |
|
|
847 |
DxfGroup polylineFlag = new DxfGroup(); |
|
848 |
polylineFlag.setCode(70); |
|
849 |
if (isPolygon) |
|
850 |
polylineFlag.setData(new Integer(1)); // cerrada |
|
851 |
else |
|
852 |
polylineFlag.setData(new Integer(0)); // abierta |
|
853 |
|
|
842 | 854 |
PathIterator theIterator = geom.getPathIterator(null); // polyLine.getPathIterator(null, |
843 | 855 |
// flatness); |
856 |
|
|
844 | 857 |
double[] theData = new double[6]; |
845 | 858 |
while (!theIterator.isDone()) { |
846 | 859 |
int theType = theIterator.currentSegment(theData); |
847 | 860 |
switch (theType) { |
848 | 861 |
case PathIterator.SEG_MOVETO: |
862 |
if (polv != null) |
|
863 |
{ |
|
864 |
for (int j = 0; j < vpoints.size(); j++) { |
|
865 |
DxfGroup xvertex = new DxfGroup(); |
|
866 |
xvertex.setCode(10); |
|
867 |
xvertex.setData(new Double(((FPoint2D) vpoints.get(j)).getX())); |
|
868 |
DxfGroup yvertex = new DxfGroup(); |
|
869 |
yvertex.setCode(20); |
|
870 |
yvertex.setData(new Double(((FPoint2D) vpoints.get(j)).getY())); |
|
871 |
polv.add(xvertex); |
|
872 |
polv.add(yvertex); |
|
873 |
} |
|
874 |
entityMaker.createLwPolyline(polv); |
|
875 |
} |
|
876 |
polv = new DxfGroupVector(); |
|
877 |
polv.add(polylineLayer); |
|
878 |
polv.add(handleGroup); |
|
879 |
polv.add(polylineFlag); |
|
880 |
vpoints.clear(); |
|
849 | 881 |
vpoints.add(new FPoint2D(theData[0], theData[1])); |
850 | 882 |
break; |
851 | 883 |
case PathIterator.SEG_LINETO: |
852 | 884 |
vpoints.add(new FPoint2D(theData[0], theData[1])); |
853 | 885 |
break; |
886 |
case PathIterator.SEG_QUADTO: |
|
887 |
break; |
|
888 |
case PathIterator.SEG_CUBICTO: |
|
889 |
break; |
|
890 |
case PathIterator.SEG_CLOSE: |
|
891 |
polylineFlag.setData(new Integer(1)); // cerrada |
|
892 |
break; |
|
893 |
|
|
854 | 894 |
} |
855 | 895 |
theIterator.next(); |
856 | 896 |
} |
857 |
DxfGroup polylineFlag = new DxfGroup(); |
|
858 |
polylineFlag.setCode(70); |
|
859 |
polylineFlag.setData(new Integer(0)); |
|
860 |
polv.add(polylineFlag); |
|
897 |
|
|
861 | 898 |
for (int j = 0; j < vpoints.size(); j++) { |
862 | 899 |
DxfGroup xvertex = new DxfGroup(); |
863 | 900 |
xvertex.setCode(10); |
Also available in: Unified diff