Revision 47432 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/Polygon3DM.java
Polygon3DM.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.geom.jts.primitive.surface.polygon; |
24 | 24 |
|
25 |
import com.vividsolutions.jts.geom.Coordinate; |
|
26 |
import com.vividsolutions.jts.geom.CoordinateSequence; |
|
27 |
import java.awt.Shape; |
|
25 | 28 |
import java.awt.geom.AffineTransform; |
26 | 29 |
import java.awt.geom.PathIterator; |
27 | 30 |
import java.util.ArrayList; |
28 | 31 |
import java.util.Iterator; |
29 | 32 |
import java.util.List; |
30 |
|
|
31 |
import com.vividsolutions.jts.geom.Coordinate; |
|
32 |
import java.awt.Shape; |
|
33 |
import java.awt.geom.GeneralPath; |
|
34 |
|
|
35 | 33 |
import org.cresques.cts.ICoordTrans; |
36 |
|
|
37 | 34 |
import org.gvsig.fmap.geom.Geometry; |
38 | 35 |
import org.gvsig.fmap.geom.GeometryException; |
39 | 36 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
... | ... | |
41 | 38 |
import org.gvsig.fmap.geom.jts.GeometryJTS; |
42 | 39 |
import org.gvsig.fmap.geom.jts.aggregate.MultiLine3DM; |
43 | 40 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon3DM; |
44 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX;
|
|
41 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
|
|
45 | 42 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine3DM; |
46 | 43 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line3DM; |
47 | 44 |
import org.gvsig.fmap.geom.jts.primitive.point.Point3DM; |
48 |
import org.gvsig.fmap.geom.jts.primitive.ring.Ring2D; |
|
49 | 45 |
import org.gvsig.fmap.geom.jts.primitive.ring.Ring3DM; |
50 | 46 |
import org.gvsig.fmap.geom.jts.primitive.surface.split.SurfaceSplitOperation; |
51 | 47 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
... | ... | |
87 | 83 |
closePrimitive(); |
88 | 84 |
} |
89 | 85 |
|
86 |
public Polygon3DM(ArrayListCoordinateSequence coordinates) { |
|
87 |
super(Geometry.TYPES.POLYGON, coordinates); |
|
88 |
closePrimitive(); |
|
89 |
} |
|
90 | 90 |
|
91 |
|
|
91 | 92 |
/* (non-Javadoc) |
92 | 93 |
* @see org.gvsig.fmap.geom.primitive.Surface#setSurfaceAppearance(org.gvsig.fmap.geom.primitive.SurfaceAppearance) |
93 | 94 |
*/ |
... | ... | |
215 | 216 |
} |
216 | 217 |
|
217 | 218 |
@Override |
219 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
220 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
221 |
for (Coordinate coordinate : this.coordinates) { |
|
222 |
coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, coordinate.getOrdinate(CoordinateSequence.M))); |
|
223 |
} |
|
224 |
Polygon2DM poligon2DM = new Polygon2DM(coordinates2DM); |
|
225 |
poligon2DM.setProjection(this.getProjection()); |
|
226 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
227 |
poligon2DM.addInteriorRing((Ring)getInteriorRing(i).force2DM()); |
|
228 |
} |
|
229 |
return poligon2DM; |
|
230 |
} |
|
231 |
|
|
232 |
@Override |
|
233 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
234 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
235 |
for (Coordinate coordinate : this.coordinates) { |
|
236 |
coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, coordinate.getOrdinate(CoordinateSequence.Z))); |
|
237 |
} |
|
238 |
Polygon3D poligon3D = new Polygon3D(coordinates3D); |
|
239 |
poligon3D.setProjection(this.getProjection()); |
|
240 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
241 |
poligon3D.addInteriorRing((Ring)getInteriorRing(i).force3D()); |
|
242 |
} |
|
243 |
return poligon3D; |
|
244 |
} |
|
245 |
|
|
246 |
@Override |
|
247 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
248 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
249 |
for (Coordinate coordinate : this.coordinates) { |
|
250 |
coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, coordinate.z, coordinate.getOrdinate(CoordinateSequence.M))); |
|
251 |
} |
|
252 |
Polygon3DM poligon3DM = new Polygon3DM(coordinates3DM); |
|
253 |
poligon3DM.setProjection(this.getProjection()); |
|
254 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
255 |
poligon3DM.addInteriorRing((Ring)getInteriorRing(i).force3DM()); |
|
256 |
} |
|
257 |
return poligon3DM; |
|
258 |
} |
|
259 |
|
|
260 |
|
|
261 |
@Override |
|
218 | 262 |
@SuppressWarnings("CloneDoesntCallSuperClone") |
219 | 263 |
public Polygon clone() throws CloneNotSupportedException { |
220 | 264 |
return this.cloneGeometry(); |
... | ... | |
316 | 360 |
for (int i = 0; i < this.getNumVertices(); i++) { |
317 | 361 |
Coordinate coordinate = this.coordinates.get(i); |
318 | 362 |
Coordinate otherCoordinate = other.coordinates.get(i); |
319 |
if (otherCoordinate.getOrdinate(2) != coordinate.getOrdinate(2)) {
|
|
363 |
if (otherCoordinate.getOrdinate(CoordinateSequence.Z) != coordinate.getOrdinate(CoordinateSequence.Z)) {
|
|
320 | 364 |
return false; |
321 | 365 |
} |
322 |
if (otherCoordinate.getOrdinate(3) != coordinate.getOrdinate(3)) {
|
|
366 |
if (otherCoordinate.getOrdinate(CoordinateSequence.M) != coordinate.getOrdinate(CoordinateSequence.M)) {
|
|
323 | 367 |
return false; |
324 | 368 |
} |
325 | 369 |
} |
Also available in: Unified diff