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/Polygon2DM.java
Polygon2DM.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 com.vividsolutions.jts.geom.GeometryFactory; |
|
33 |
import com.vividsolutions.jts.geomgraph.Position; |
|
34 |
import com.vividsolutions.jts.operation.buffer.BufferParameters; |
|
35 |
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder; |
|
36 |
import java.awt.Shape; |
|
37 |
import java.awt.geom.GeneralPath; |
|
38 |
|
|
39 | 33 |
import org.cresques.cts.ICoordTrans; |
40 |
|
|
41 | 34 |
import org.gvsig.fmap.geom.Geometry; |
42 | 35 |
import org.gvsig.fmap.geom.GeometryException; |
43 | 36 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
... | ... | |
45 | 38 |
import org.gvsig.fmap.geom.jts.GeometryJTS; |
46 | 39 |
import org.gvsig.fmap.geom.jts.aggregate.MultiLine2DM; |
47 | 40 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2DM; |
48 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX;
|
|
41 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
|
|
49 | 42 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine2DM; |
50 | 43 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2DM; |
51 | 44 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2DM; |
52 |
import org.gvsig.fmap.geom.jts.primitive.ring.Ring2D; |
|
53 | 45 |
import org.gvsig.fmap.geom.jts.primitive.ring.Ring2DM; |
54 | 46 |
import org.gvsig.fmap.geom.jts.primitive.surface.split.SurfaceSplitOperation; |
55 | 47 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
... | ... | |
89 | 81 |
super(Geometry.TYPES.POLYGON, coordinates); |
90 | 82 |
closePrimitive(); |
91 | 83 |
} |
84 |
|
|
85 |
public Polygon2DM(ArrayListCoordinateSequence coordinates) { |
|
86 |
super(Geometry.TYPES.POLYGON, coordinates); |
|
87 |
closePrimitive(); |
|
88 |
} |
|
89 |
|
|
92 | 90 |
|
93 | 91 |
/* (non-Javadoc) |
94 | 92 |
* @see org.gvsig.fmap.geom.primitive.Surface#setSurfaceAppearance(org.gvsig.fmap.geom.primitive.SurfaceAppearance) |
... | ... | |
128 | 126 |
} |
129 | 127 |
|
130 | 128 |
@Override |
129 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
130 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
131 |
for (Coordinate coordinate : this.coordinates) { |
|
132 |
coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, coordinate.getOrdinate(CoordinateSequence.M))); |
|
133 |
} |
|
134 |
Polygon2DM poligon2DM = new Polygon2DM(coordinates2DM); |
|
135 |
poligon2DM.setProjection(this.getProjection()); |
|
136 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
137 |
poligon2DM.addInteriorRing((Ring)getInteriorRing(i).force2DM()); |
|
138 |
} |
|
139 |
return poligon2DM; |
|
140 |
} |
|
141 |
|
|
142 |
@Override |
|
143 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
144 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
145 |
for (Coordinate coordinate : this.coordinates) { |
|
146 |
coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, 0)); |
|
147 |
} |
|
148 |
Polygon3D poligon3D = new Polygon3D(coordinates3D); |
|
149 |
poligon3D.setProjection(this.getProjection()); |
|
150 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
151 |
poligon3D.addInteriorRing((Ring)getInteriorRing(i).force3D()); |
|
152 |
} |
|
153 |
return poligon3D; |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
157 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
158 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
159 |
for (Coordinate coordinate : this.coordinates) { |
|
160 |
coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, 0, coordinate.getOrdinate(CoordinateSequence.M))); |
|
161 |
} |
|
162 |
Polygon3DM poligon3DM = new Polygon3DM(coordinates3DM); |
|
163 |
poligon3DM.setProjection(this.getProjection()); |
|
164 |
for (int i = 0; i < getNumInteriorRings(); i++){ |
|
165 |
poligon3DM.addInteriorRing((Ring)getInteriorRing(i).force3DM()); |
|
166 |
} |
|
167 |
return poligon3DM; |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
@Override |
|
131 | 172 |
@SuppressWarnings("CloneDoesntCallSuperClone") |
132 | 173 |
public Polygon clone() throws CloneNotSupportedException { |
133 | 174 |
return this.cloneGeometry(); |
... | ... | |
314 | 355 |
return false; |
315 | 356 |
} |
316 | 357 |
for(int i=0; i < this.getNumVertices(); i++){ |
317 |
if(other.coordinates.get(i).getOrdinate(2)!=this.coordinates.get(i).getOrdinate(2)){
|
|
358 |
if(other.coordinates.get(i).getOrdinate(CoordinateSequence.M)!=this.coordinates.get(i).getOrdinate(CoordinateSequence.M)){
|
|
318 | 359 |
return false; |
319 | 360 |
}; |
320 | 361 |
} |
Also available in: Unified diff