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

View differences:

Polygon2D.java
42 42
import org.gvsig.fmap.geom.jts.aggregate.MultiLine2D;
43 43
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon2D;
44 44
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX;
45
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate;
45 46
import org.gvsig.fmap.geom.jts.primitive.curve.line.BaseLine2D;
46 47
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line2D;
47 48
import org.gvsig.fmap.geom.jts.primitive.point.Point2D;
......
120 121
    }
121 122

  
122 123
    @Override
124
    public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException {
125
        ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size());
126
        for (Coordinate coordinate : this.coordinates) {
127
            coordinates2DM.add(MCoordinate.create2dWithMeasure(coordinate.x, coordinate.y, 0));
128
        }
129
        Polygon2DM poligon2DM = new Polygon2DM(coordinates2DM);
130
        poligon2DM.setProjection(this.getProjection());
131
        for (int i = 0; i < getNumInteriorRings(); i++){
132
            poligon2DM.addInteriorRing((Ring)getInteriorRing(i).force2DM());
133
        }
134
        return poligon2DM;
135
    }
136

  
137
    @Override
138
    public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException {
139
        ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size());
140
        for (Coordinate coordinate : this.coordinates) {
141
            coordinates3D.add(new Coordinate(coordinate.x, coordinate.y, 0));
142
        }
143
        Polygon3D poligon3D = new Polygon3D(coordinates3D);
144
        poligon3D.setProjection(this.getProjection());
145
        for (int i = 0; i < getNumInteriorRings(); i++){
146
            poligon3D.addInteriorRing((Ring)getInteriorRing(i).force3D());
147
        }
148
        return poligon3D;
149
    }
150

  
151
    @Override
152
    public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException {
153
        ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size());
154
        for (Coordinate coordinate : this.coordinates) {
155
            coordinates3DM.add(MCoordinate.create3dWithMeasure(coordinate.x, coordinate.y, 0, 0));
156
        }
157
        Polygon3DM poligon3DM = new Polygon3DM(coordinates3DM);
158
        poligon3DM.setProjection(this.getProjection());
159
        for (int i = 0; i < getNumInteriorRings(); i++){
160
            poligon3DM.addInteriorRing((Ring)getInteriorRing(i).force3DM());
161
        }
162
        return poligon3DM;
163
    }
164

  
165
    @Override
123 166
    @SuppressWarnings("CloneDoesntCallSuperClone")
124 167
    public Polygon clone() throws CloneNotSupportedException {
125 168
        return this.cloneGeometry();

Also available in: Unified diff