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/Ring3DM.java
Ring3DM.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.MultiLine3DM; |
40 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2D; |
|
41 | 38 |
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon3DM; |
42 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine3D;
|
|
39 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
|
|
43 | 40 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine3DM; |
44 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2DM; |
|
45 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line3D; |
|
46 | 41 |
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line3DM; |
47 |
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon3D; |
|
48 | 42 |
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon3DM; |
43 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
|
49 | 44 |
import org.gvsig.fmap.geom.jts.util.JTSUtils; |
50 | 45 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
51 | 46 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
... | ... | |
76 | 71 |
super(Geometry.TYPES.RING, coordinates); |
77 | 72 |
closePrimitive(); |
78 | 73 |
} |
74 |
|
|
75 |
public Ring3DM(ArrayListCoordinateSequence coordinates) { |
|
76 |
super(Geometry.TYPES.RING, coordinates); |
|
77 |
} |
|
78 |
|
|
79 | 79 |
|
80 | 80 |
/* (non-Javadoc) |
81 | 81 |
* @see org.gvsig.fmap.geom.Geometry#cloneGeometry() |
... | ... | |
167 | 167 |
for(int i=0; i < this.getNumVertices(); i++){ |
168 | 168 |
Coordinate coordinate = this.coordinates.get(i); |
169 | 169 |
Coordinate otherCoordinate = other.coordinates.get(i); |
170 |
if (otherCoordinate.getOrdinate(2) != coordinate.getOrdinate(2)) {
|
|
170 |
if (otherCoordinate.getOrdinate(CoordinateSequence.Z) != coordinate.getOrdinate(CoordinateSequence.Z)) {
|
|
171 | 171 |
return false; |
172 | 172 |
} |
173 |
if (otherCoordinate.getOrdinate(3) != coordinate.getOrdinate(3)) {
|
|
173 |
if (otherCoordinate.getOrdinate(CoordinateSequence.M) != coordinate.getOrdinate(CoordinateSequence.M)) {
|
|
174 | 174 |
return false; |
175 | 175 |
} |
176 | 176 |
} |
... | ... | |
179 | 179 |
return false; |
180 | 180 |
} |
181 | 181 |
} |
182 |
@Override |
|
183 |
public Geometry force2D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
184 |
ArrayListCoordinateSequence coordinates2D = new ArrayListCoordinateSequence(coordinates.size()); |
|
185 |
for (Coordinate coordinate : this.coordinates) { |
|
186 |
coordinates2D.add(new Coordinate(coordinate.x, coordinate.y)); |
|
187 |
} |
|
188 |
Ring2D ring = new Ring2D(coordinates2D); |
|
189 |
ring.setProjection(this.getProjection()); |
|
190 |
return ring; |
|
191 |
} |
|
192 |
|
|
193 |
@Override |
|
194 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
195 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
196 |
for (Coordinate coordinate : this.coordinates) { |
|
197 |
coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, 0)); |
|
198 |
} |
|
199 |
Ring2DM ring = new Ring2DM(coordinates2DM); |
|
200 |
ring.setProjection(this.getProjection()); |
|
201 |
return ring; |
|
202 |
} |
|
203 |
|
|
204 |
@Override |
|
205 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
206 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
207 |
for (Coordinate coordinate : this.coordinates) { |
|
208 |
coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, 0)); |
|
209 |
} |
|
210 |
Ring3D ring = new Ring3D(coordinates3D); |
|
211 |
ring.setProjection(this.getProjection()); |
|
212 |
return ring; |
|
213 |
} |
|
214 |
|
|
215 |
@Override |
|
216 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
217 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
218 |
for (Coordinate coordinate : this.coordinates) { |
|
219 |
coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, 0, 0)); |
|
220 |
} |
|
221 |
Ring3DM ring = new Ring3DM(coordinates3DM); |
|
222 |
ring.setProjection(this.getProjection()); |
|
223 |
return ring; |
|
224 |
} |
|
225 |
|
|
182 | 226 |
} |
Also available in: Unified diff