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/Ring2D.java

View differences:

Ring2D.java
29 29
import com.vividsolutions.jts.geomgraph.Position;
30 30
import com.vividsolutions.jts.operation.buffer.BufferParameters;
31 31
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
32

  
33 32
import org.cresques.cts.ICoordTrans;
34

  
35 33
import org.gvsig.fmap.geom.Geometry;
36 34
import org.gvsig.fmap.geom.GeometryException;
37 35
import org.gvsig.fmap.geom.aggregate.MultiLine;
38 36
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
39 37
import org.gvsig.fmap.geom.jts.aggregate.MultiLine2D;
40 38
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2D;
39
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
41 40
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine2D;
42 41
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2D;
43 42
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon2D;
43
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence;
44 44
import org.gvsig.fmap.geom.jts.util.JTSUtils;
45 45
import org.gvsig.fmap.geom.operation.GeometryOperationException;
46 46
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
......
71 71
        super(Geometry.TYPES.RING, coordinates);
72 72
    }
73 73

  
74
    public Ring2D(ArrayListCoordinateSequence coordinates) {
75
        super(Geometry.TYPES.RING, coordinates);
76
    }
77

  
74 78
    /* (non-Javadoc)
75 79
     * @see org.gvsig.fmap.geom.Geometry#cloneGeometry()
76 80
     */
......
150 154
              forceClose(0);
151 155
          }
152 156
      }
157
      
158
    @Override
159
    public Geometry force2D() throws GeometryOperationNotSupportedException, GeometryOperationException {
160
        ArrayListCoordinateSequence coordinates2D = new ArrayListCoordinateSequence(coordinates.size());
161
        for (Coordinate coordinate : this.coordinates) {
162
            coordinates2D.add(new Coordinate(coordinate.x, coordinate.y));
163
        }
164
        Ring2D ring = new Ring2D(coordinates2D);
165
        ring.setProjection(this.getProjection());
166
        return ring;
167
    }
168

  
169
    @Override
170
    public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException {
171
        ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size());
172
        for (Coordinate coordinate : this.coordinates) {
173
            coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, 0));
174
        }
175
        Ring2DM ring = new Ring2DM(coordinates2DM);
176
        ring.setProjection(this.getProjection());
177
        return ring;
178
    }
179

  
180
    @Override
181
    public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException {
182
        ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size());
183
        for (Coordinate coordinate : this.coordinates) {
184
            coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, 0));
185
        }
186
        Ring3D ring = new Ring3D(coordinates3D);
187
        ring.setProjection(this.getProjection());
188
        return ring;
189
    }
190

  
191
    @Override
192
    public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException {
193
        ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size());
194
        for (Coordinate coordinate : this.coordinates) {
195
            coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, 0, 0));
196
        }
197
        Ring3DM ring = new Ring3DM(coordinates3DM);
198
        ring.setProjection(this.getProjection());
199
        return ring;
200
    }
201
      
153 202
}

Also available in: Unified diff