Class CoordinateSequences
Object
CoordinateSequences
CoordinateSequences
Utility functions for coordinate sequences (extends the same named JTS class)
- Author:
- Andrea Aime - OpenGeo, Martin Davis - OpenGeo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcarriedMeasures(CoordinateSequence sequence) Measures the sequence really carries, zero when the M ordinate is not filled in: a shapefile PolyLineZ declares a measure and leaves it NaN.static intcomputeOrientation(CoordinateSequence cs, int p1, int p2, int q) static intGets the effective dimension of a CoordinateSequence.static intGets the dimension of the coordinates in aGeometry, by reading it from a componentCoordinateSequence.static booleanReturns true if the two geometries are equal in N dimensions (normal geometry equality is only 2D)static CoordinateSequenceFirst coordinate sequence of a geometry inGeometry.apply(CoordinateSequenceFilter)order, null when the geometry holds none.static booleanisCCW(CoordinateSequence ring) Computes whether a ring defined by an array ofCoordinates is oriented counter-clockwise.static int[]ordinateIndices(CoordinateSequence sequence, boolean includeMeasures) Ordinate indices to read for a coordinate, in encoding order: X, Y, the height when the sequence fills one, then the measures when asked for.static intspatialDimension(CoordinateSequence sequence) X, Y and the height when the sequence carries a usable one.Methods inherited from class CoordinateSequences
copy, copyCoord, ensureValidRing, extend, indexOf, isEqual, isRing, minCoordinate, minCoordinateIndex, minCoordinateIndex, reverse, scroll, scroll, scroll, swap, toString
-
Constructor Details
-
CoordinateSequences
public CoordinateSequences()
-
-
Method Details
-
isCCW
Computes whether a ring defined by an array ofCoordinates is oriented counter-clockwise.- The list of points is assumed to have the first and last points equal.
- This will handle coordinate lists which contain repeated points.
- Parameters:
ring- an array of Coordinates forming a ring- Returns:
- true if the ring is oriented counter-clockwise.
-
computeOrientation
-
firstSequence
First coordinate sequence of a geometry inGeometry.apply(CoordinateSequenceFilter)order, null when the geometry holds none. It is the same sequencecoordinateDimension(Geometry)reads its answer from. -
coordinateDimension
Gets the dimension of the coordinates in aGeometry, by reading it from a componentCoordinateSequence. This will be usually either 2 or 3.- Parameters:
g- a Geometry- Returns:
- the dimension of the coordinates in the Geometry
-
coordinateDimension
Gets the effective dimension of a CoordinateSequence. This is a workaround for the issue that CoordinateArraySequence does not keep an accurate dimension - it always reports dim=3, even if there is no Z ordinate (ie they are NaN). This method checks for that case and reports dim=2. Only the first coordinate is checked.There is one small hole: if a CoordinateArraySequence is empty, the dimension will be reported as 3.
- Parameters:
seq- a CoordinateSequence- Returns:
- the effective dimension of the coordinate sequence
-
ordinateIndices
Ordinate indices to read for a coordinate, in encoding order: X, Y, the height when the sequence fills one, then the measures when asked for. Callers write exactly these ordinates, so what is counted and what is written can never disagree. -
spatialDimension
X, Y and the height when the sequence carries a usable one. Measured sequences report their layout faithfully, so the declared dimension is used, while the heuristic is needed for the rest because CoordinateArraySequence reports three ordinates even for plain 2D data. -
carriedMeasures
Measures the sequence really carries, zero when the M ordinate is not filled in: a shapefile PolyLineZ declares a measure and leaves it NaN. Only the first coordinate is checked, like the dimension is, so measures are all-or-nothing per geometry: a NaN measure on a later coordinate is encoded as NaN. -
equalsND
Returns true if the two geometries are equal in N dimensions (normal geometry equality is only 2D)
-