Revision 44612 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2D.java
Polygon2D.java | ||
---|---|---|
46 | 46 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2D; |
47 | 47 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2D; |
48 | 48 |
import org.gvsig.fmap.geom.jts.primitive.ring.Ring2D; |
49 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
|
49 | 50 |
import org.gvsig.fmap.geom.jts.util.JTSUtils; |
50 | 51 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
51 | 52 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
... | ... | |
83 | 84 |
closePrimitive(); |
84 | 85 |
} |
85 | 86 |
|
87 |
public Polygon2D(ArrayListCoordinateSequence coordinates) { |
|
88 |
super(Geometry.TYPES.POLYGON, coordinates); |
|
89 |
closePrimitive(); |
|
90 |
} |
|
91 |
|
|
86 | 92 |
/* |
87 | 93 |
* (non-Javadoc) |
88 | 94 |
* |
... | ... | |
97 | 103 |
} |
98 | 104 |
|
99 | 105 |
@Override |
106 |
public Geometry force2D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
107 |
ArrayListCoordinateSequence coordinates2D = new ArrayListCoordinateSequence(coordinates.size()); |
|
108 |
for (Coordinate coordinate : this.coordinates) { |
|
109 |
coordinates2D.add(new Coordinate(coordinate.x, coordinate.y)); |
|
110 |
} |
|
111 |
Polygon2D poligon2D = new Polygon2D(coordinates2D); |
|
112 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
113 |
poligon2D.addInteriorRing((Ring)getInteriorRing(i).force2D()); |
|
114 |
} |
|
115 |
return poligon2D; |
|
116 |
} |
|
117 |
|
|
118 |
@Override |
|
100 | 119 |
@SuppressWarnings("CloneDoesntCallSuperClone") |
101 | 120 |
public Polygon clone() throws CloneNotSupportedException { |
102 | 121 |
return this.cloneGeometry(); |
Also available in: Unified diff