|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The internal representation of a list of coordinates inside a Geometry.
There are some cases in which you might want Geometries to store their points using something other than the JTS Coordinate class. For example, you may want to experiment with another implementation, such as an array of x’s and an array of y’s. or you might want to use your own coordinate class, one that supports extra attributes like M-values.
You can do this by implementing the CoordinateSequence and CoordinateSequenceFactory interfaces. You would then create a GeometryFactory parameterized by your CoordinateSequenceFactory, and use this GeometryFactory to create new Geometries. All of these new Geometries will use your CoordinateSequence implementation.
For an example, see the code for
com.vividsolutions.jtsexample.geom.TwoArrayCoordinateSequenceExample
.
A note on performance. If your CoordinateSequence is not based on an array of Coordinates, it may incur a performance penalty when its #toArray method is called because the array needs to be built from scratch.
DefaultCoordinateSequenceFactory
,
TwoArrayCoordinateSequenceFactory
Method Summary | |
java.lang.Object |
clone()
Returns a deep copy of this collection. |
Coordinate |
getCoordinate(int i)
Returns (possibly a copy of) the ith Coordinate in this collection. |
int |
size()
Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data in Coordinate objects). |
Coordinate[] |
toCoordinateArray()
Returns (possibly copies of) the Coordinates in this collection. |
Method Detail |
public Coordinate getCoordinate(int i)
Note that in the future the semantics of this method may change to guarantee that the Coordinate returned is always a copy. Callers are advised not to assume that they can modify a CoordinateSequence by modifying the Coordinate returned by this method.
public int size()
public Coordinate[] toCoordinateArray()
public java.lang.Object clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |