Revision 44617 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/curve/spline/BaseSpline3DM.java

View differences:

BaseSpline3DM.java
32 32
import org.gvsig.fmap.geom.aggregate.MultiLine;
33 33
import org.gvsig.fmap.geom.aggregate.MultiPoint;
34 34
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
35
import org.gvsig.fmap.geom.jts.MCoordinate;
36 35
import org.gvsig.fmap.geom.jts.aggregate.MultiLine3DM;
37 36
import org.gvsig.fmap.geom.jts.aggregate.MultiPoint3DM;
38 37
import org.gvsig.fmap.geom.jts.aggregate.MultiPolygon3DM;
39 38
import org.gvsig.fmap.geom.jts.primitive.curve.line.Line3DM;
40 39
import org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline.Spline;
41
import org.gvsig.fmap.geom.jts.primitive.point.Point2DM;
42 40
import org.gvsig.fmap.geom.jts.primitive.point.Point3D;
43 41
import org.gvsig.fmap.geom.jts.primitive.point.Point3DM;
44
import org.gvsig.fmap.geom.jts.primitive.point.PointJTS;
45 42
import org.gvsig.fmap.geom.jts.primitive.surface.polygon.Polygon3DM;
46 43
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence;
47 44
import org.gvsig.fmap.geom.jts.util.JTSUtils;
48 45
import org.gvsig.fmap.geom.jts.util.ReadOnlyCoordinates;
49 46
import org.gvsig.fmap.geom.primitive.Line;
47
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
50 48
import org.gvsig.fmap.geom.primitive.Point;
51 49
import org.gvsig.fmap.geom.primitive.Polygon;
52 50

  
......
64 62

  
65 63

  
66 64
    /**
67
     * @param polygon
65
     * @param type
68 66
     */
69 67
    public BaseSpline3DM(int type) {
70 68
        super(type, Geometry.SUBTYPES.GEOM3DM);
71
        this.coordinates = new ArrayListCoordinateSequence(new ArrayList<Coordinate>());
69
        this.coordinates = new ArrayListCoordinateSequence(new ArrayList<>());
72 70
    }
73 71

  
74 72
    /**
75
     * @param subtype
73
     * @param type
76 74
     * @param coordinates
77
     * @param aVertex
78 75
     */
79 76
    public BaseSpline3DM(int type, Coordinate[] coordinates) {
80 77
        super(type, Geometry.SUBTYPES.GEOM3DM);
......
87 84
        }
88 85
    }
89 86

  
90
    /* (non-Javadoc)
91
     * @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double)
92
     */
93
    public void addVertex(double x, double y) {
94
        this.addVertex(new Point3DM(x, y, 0, 0));
95
        }
87
    public OrientablePrimitive addVertex(double x, double y) {
88
        return this.addVertex(new Point3DM(x, y, 0, 0));
89
    }
96 90

  
97
    /* (non-Javadoc)
98
     * @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double, double)
99
     */
100
    public void addVertex(double x, double y, double z) {
101
        this.addVertex(new Point3DM(x, y, z, 0));
91
    public OrientablePrimitive addVertex(double x, double y, double z) {
92
        return this.addVertex(new Point3DM(x, y, z, 0));
102 93
    }
103 94

  
104
    /* (non-Javadoc)
105
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#fixPoint(org.gvsig.fmap.geom.primitive.Point)
106
     */
107 95
    @Override
108 96
    protected Point fixPoint(Point point) {
109 97
        if (point instanceof Point3DM) {
......
115 103
        }
116 104
    }
117 105

  
118
    /* (non-Javadoc)
119
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#getSplineCoordinates()
120
     */
121 106
    @Override
122 107
    protected ArrayListCoordinateSequence getSplineCoordinates() {
123 108
        ArrayListCoordinateSequence splineCoordinates = new ArrayListCoordinateSequence();
......
159 144
        return splineCoordinates;
160 145
    }
161 146

  
162
    /* (non-Javadoc)
163
     * @see org.gvsig.fmap.geom.primitive.Line#toPoints()
164
     */
147
    @Override
165 148
    public MultiPoint toPoints() throws GeometryException {
166 149
        MultiPoint multiPoint = new MultiPoint3DM();
167
        Coordinate[] coordinates = getJTS().getCoordinates();
168
        multiPoint.ensureCapacity(coordinates.length);
169
        for (int i = 0; i < coordinates.length; i++) {
170
            multiPoint.addPoint(new Point3DM(this.getProjection(), coordinates[i]));
150
        Coordinate[] theCoordinates = getJTS().getCoordinates();
151
        multiPoint.ensureCapacity(theCoordinates.length);
152
        for (Coordinate theCoordinate : theCoordinates) {
153
            multiPoint.addPoint(new Point3DM(this.getProjection(), theCoordinate));
171 154
        }
172 155
        return multiPoint;
173 156
    }
174 157

  
175
    /* (non-Javadoc)
176
     * @see org.gvsig.fmap.geom.primitive.Line#toLines()
177
     */
158
    @Override
178 159
    public MultiLine toLines() throws GeometryException {
179 160
        MultiLine multiLine = new MultiLine3DM();
180 161
        Line line = new Line3DM(getJTS().getCoordinates());
......
182 163
        return multiLine;
183 164
    }
184 165

  
185
    /* (non-Javadoc)
186
     * @see org.gvsig.fmap.geom.primitive.Line#toPolygons()
187
     */
166
    @Override
188 167
    public MultiPolygon toPolygons() throws GeometryException {
189 168
        MultiPolygon multiPolygon = new MultiPolygon3DM();
190 169
        Polygon polygon = new Polygon3DM(getJTS().getCoordinates());
......
192 171
        return multiPolygon;
193 172
    }
194 173

  
195

  
196
    /* (non-Javadoc)
197
     * @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#getVertex(int)
198
     */
199 174
    public Point getVertex(int index) {
200 175
        Point3DM vertex = new Point3DM(this.getProjection(), this.coordinates.get(index));
201 176
        anyVertex = vertex;

Also available in: Unified diff