Revision 42283 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/Spline2D.java
Spline2D.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.geom.jts.primitive.curve.spline; |
24 | 24 |
|
25 |
import java.util.ArrayList; |
|
26 |
|
|
25 | 27 |
import com.vividsolutions.jts.geom.Coordinate; |
26 | 28 |
|
27 | 29 |
import org.gvsig.fmap.geom.Geometry; |
... | ... | |
56 | 58 |
/** |
57 | 59 |
* @param subtype |
58 | 60 |
*/ |
59 |
protected Spline2D() {
|
|
61 |
public Spline2D() {
|
|
60 | 62 |
super(Geometry.SUBTYPES.GEOM2D); |
63 |
this.coordinates = new ArrayListCoordinateSequence(new ArrayList<Coordinate>()); |
|
61 | 64 |
} |
62 | 65 |
|
63 | 66 |
/** |
... | ... | |
93 | 96 |
* @see org.gvsig.fmap.geom.Geometry#cloneGeometry() |
94 | 97 |
*/ |
95 | 98 |
public Geometry cloneGeometry() { |
96 |
return new Spline2D((Coordinate[]) coordinates.clone());
|
|
99 |
return new Spline2D(cloneCoordinates().toCoordinateArray());
|
|
97 | 100 |
} |
98 | 101 |
|
99 | 102 |
/* (non-Javadoc) |
... | ... | |
151 | 154 |
*/ |
152 | 155 |
public MultiPoint toPoints() throws GeometryException { |
153 | 156 |
MultiPoint multiPoint = new MultiPoint2D(); |
154 |
Coordinate[] coordinates = getJTS().getCoordinates();
|
|
157 |
Coordinate[] coordinates = getSplineCoordinates().toCoordinateArray();
|
|
155 | 158 |
multiPoint.ensureCapacity(coordinates.length); |
156 | 159 |
for (int i = 0; i < coordinates.length; i++) { |
157 | 160 |
multiPoint.addPoint(new Point2D(coordinates[i])); |
... | ... | |
164 | 167 |
*/ |
165 | 168 |
public MultiLine toLines() throws GeometryException { |
166 | 169 |
MultiLine multiLine = new MultiLine2D(); |
167 |
Line line = new Line2D(getJTS().getCoordinates()); |
|
170 |
Line line = new Line2D(getSplineCoordinates().toCoordinateArray()); //getJTS().getCoordinates());
|
|
168 | 171 |
multiLine.addPrimitive(line); |
169 | 172 |
return multiLine; |
170 | 173 |
} |
... | ... | |
174 | 177 |
*/ |
175 | 178 |
public MultiPolygon toPolygons() throws GeometryException { |
176 | 179 |
MultiPolygon multiPolygon = new MultiPolygon2D(); |
177 |
Polygon polygon = new Polygon2D(getJTS().getCoordinates());
|
|
180 |
Polygon polygon = new Polygon2D(getSplineCoordinates().toCoordinateArray());
|
|
178 | 181 |
multiPolygon.addPrimitive(polygon); |
179 | 182 |
return multiPolygon; |
180 | 183 |
} |
181 | 184 |
|
185 |
|
|
186 |
/* (non-Javadoc) |
|
187 |
* @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#getVertex(int) |
|
188 |
*/ |
|
189 |
public Point getVertex(int index) { |
|
190 |
Point2D vertex = new Point2D(this.coordinates.get(index)); |
|
191 |
anyVertex = vertex; |
|
192 |
return vertex; |
|
193 |
} |
|
194 |
|
|
182 | 195 |
} |
Also available in: Unified diff