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/ring/Ring2DM.java
Ring2DM.java | ||
---|---|---|
23 | 23 |
package org.gvsig.fmap.geom.jts.primitive.ring; |
24 | 24 |
|
25 | 25 |
import com.vividsolutions.jts.geom.Coordinate; |
26 |
import com.vividsolutions.jts.geom.CoordinateSequence; |
|
26 | 27 |
import com.vividsolutions.jts.geom.GeometryFactory; |
27 | 28 |
import com.vividsolutions.jts.geom.LinearRing; |
28 | 29 |
import com.vividsolutions.jts.geomgraph.Position; |
29 | 30 |
import com.vividsolutions.jts.operation.buffer.BufferParameters; |
30 | 31 |
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder; |
31 |
|
|
32 | 32 |
import org.cresques.cts.ICoordTrans; |
33 |
|
|
34 | 33 |
import org.gvsig.fmap.geom.Geometry; |
35 | 34 |
import org.gvsig.fmap.geom.GeometryException; |
36 | 35 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
37 | 36 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
38 |
import org.gvsig.fmap.geom.jts.aggregate.MultiLine2D; |
|
39 | 37 |
import org.gvsig.fmap.geom.jts.aggregate.MultiLine2DM; |
40 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2D; |
|
41 | 38 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2DM; |
42 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine2D;
|
|
39 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
|
|
43 | 40 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine2DM; |
44 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2D; |
|
45 | 41 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2DM; |
46 |
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon2D; |
|
47 | 42 |
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon2DM; |
43 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
|
48 | 44 |
import org.gvsig.fmap.geom.jts.util.JTSUtils; |
49 | 45 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
50 | 46 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
... | ... | |
70 | 66 |
super(Geometry.TYPES.RING, coordinates); |
71 | 67 |
closePrimitive(); |
72 | 68 |
} |
69 |
|
|
70 |
public Ring2DM(ArrayListCoordinateSequence coordinates) { |
|
71 |
super(Geometry.TYPES.RING, coordinates); |
|
72 |
} |
|
73 | 73 |
|
74 |
|
|
74 | 75 |
/* (non-Javadoc) |
75 | 76 |
* @see org.gvsig.fmap.geom.Geometry#cloneGeometry() |
76 | 77 |
*/ |
... | ... | |
158 | 159 |
return false; |
159 | 160 |
} |
160 | 161 |
for(int i=0; i < this.getNumVertices(); i++){ |
161 |
if(other.coordinates.get(i).getOrdinate(2)!=this.coordinates.get(i).getOrdinate(2)){
|
|
162 |
if(other.coordinates.get(i).getOrdinate(CoordinateSequence.M)!=this.coordinates.get(i).getOrdinate(CoordinateSequence.M)){
|
|
162 | 163 |
return false; |
163 | 164 |
}; |
164 | 165 |
} |
... | ... | |
167 | 168 |
return false; |
168 | 169 |
} |
169 | 170 |
} |
171 |
|
|
172 |
@Override |
|
173 |
public Geometry force2D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
174 |
ArrayListCoordinateSequence coordinates2D = new ArrayListCoordinateSequence(coordinates.size()); |
|
175 |
for (Coordinate coordinate : this.coordinates) { |
|
176 |
coordinates2D.add(new Coordinate(coordinate.x, coordinate.y)); |
|
177 |
} |
|
178 |
Ring2D ring = new Ring2D(coordinates2D); |
|
179 |
ring.setProjection(this.getProjection()); |
|
180 |
return ring; |
|
181 |
} |
|
182 |
|
|
183 |
@Override |
|
184 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
185 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
186 |
for (Coordinate coordinate : this.coordinates) { |
|
187 |
coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, 0)); |
|
188 |
} |
|
189 |
Ring2DM ring = new Ring2DM(coordinates2DM); |
|
190 |
ring.setProjection(this.getProjection()); |
|
191 |
return ring; |
|
192 |
} |
|
193 |
|
|
194 |
@Override |
|
195 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
196 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
197 |
for (Coordinate coordinate : this.coordinates) { |
|
198 |
coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, 0)); |
|
199 |
} |
|
200 |
Ring3D ring = new Ring3D(coordinates3D); |
|
201 |
ring.setProjection(this.getProjection()); |
|
202 |
return ring; |
|
203 |
} |
|
204 |
|
|
205 |
@Override |
|
206 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
207 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
208 |
for (Coordinate coordinate : this.coordinates) { |
|
209 |
coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, 0, 0)); |
|
210 |
} |
|
211 |
Ring3DM ring = new Ring3DM(coordinates3DM); |
|
212 |
ring.setProjection(this.getProjection()); |
|
213 |
return ring; |
|
214 |
} |
|
215 |
|
|
170 | 216 |
} |
Also available in: Unified diff