Revision 42267 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/line/Line3D.java
Line3D.java | ||
---|---|---|
25 | 25 |
import com.vividsolutions.jts.geom.Coordinate; |
26 | 26 |
|
27 | 27 |
import org.gvsig.fmap.geom.Geometry; |
28 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2D; |
|
29 |
import org.gvsig.fmap.geom.jts.primitive.point.Point2DM; |
|
28 |
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX; |
|
30 | 29 |
import org.gvsig.fmap.geom.jts.primitive.point.Point3D; |
31 | 30 |
import org.gvsig.fmap.geom.jts.primitive.point.Point3DM; |
32 |
import org.gvsig.fmap.geom.jts.utils.ArrayListCoordinateSequence; |
|
33 |
import org.gvsig.fmap.geom.jts.utils.ReadOnlyCoordinates; |
|
31 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
|
32 |
import org.gvsig.fmap.geom.jts.util.ReadOnlyCoordinates; |
|
33 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
34 | 34 |
import org.gvsig.fmap.geom.primitive.Point; |
35 | 35 |
|
36 | 36 |
|
... | ... | |
59 | 59 |
public Line3D(Coordinate[] coordinates) { |
60 | 60 |
this(); |
61 | 61 |
this.coordinates = new ArrayListCoordinateSequence(new ReadOnlyCoordinates(coordinates)); |
62 |
vertex = new Point3D(this.coordinates.get(0)); |
|
62 |
if(coordinates.length<1){ |
|
63 |
anyVertex = new Point3D(0,0,0); |
|
64 |
} else { |
|
65 |
anyVertex = new Point3D(coordinates[0].x, coordinates[0].y, coordinates[0].z); |
|
66 |
} |
|
63 | 67 |
} |
64 | 68 |
|
65 | 69 |
|
... | ... | |
67 | 71 |
* @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double) |
68 | 72 |
*/ |
69 | 73 |
public void addVertex(double x, double y) { |
70 |
this.addVertex(x, y, 0);
|
|
74 |
this.addVertex(new Point3D(x, y, 0));
|
|
71 | 75 |
} |
72 | 76 |
|
73 | 77 |
/* (non-Javadoc) |
74 | 78 |
* @see org.gvsig.fmap.geom.primitive.OrientablePrimitive#addVertex(double, double, double) |
75 | 79 |
*/ |
76 | 80 |
public void addVertex(double x, double y, double z) { |
77 |
this.coordinates.add(new Point3D(x, y, z).getJTSCoordinate());
|
|
81 |
this.addVertex(new Point3D(x, y, z));
|
|
78 | 82 |
} |
79 | 83 |
|
80 | 84 |
/* (non-Javadoc) |
... | ... | |
97 | 101 |
return new Point3D(point.getX(), point.getY(), 0); |
98 | 102 |
} |
99 | 103 |
} |
104 |
|
|
105 |
/* |
|
106 |
* (non-Javadoc) |
|
107 |
* |
|
108 |
* @see org.gvsig.fmap.geom.Geometry#getGeneralPath() |
|
109 |
*/ |
|
110 |
public GeneralPathX getGeneralPath() { |
|
111 |
return new DefaultGeneralPathX(new LineIterator(null),true,((Point3D)anyVertex).getZ()); |
|
112 |
} |
|
100 | 113 |
} |
Also available in: Unified diff