Class CoordinateSequences
- Object
-
- CoordinateSequences
-
- CoordinateSequences
-
public class CoordinateSequences extends CoordinateSequences
Utility functions for coordinate sequences (extends the same named JTS class)- Author:
- Andrea Aime - OpenGeo, Martin Davis - OpenGeo
-
-
Constructor Summary
Constructors Constructor Description CoordinateSequences()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
computeOrientation(CoordinateSequence cs, int p1, int p2, int q)
static int
coordinateDimension(CoordinateSequence seq)
Gets the effective dimension of a CoordinateSequence.static int
coordinateDimension(Geometry g)
Gets the dimension of the coordinates in aGeometry
, by reading it from a componentCoordinateSequence
.static boolean
equalsND(Geometry g1, Geometry g2)
Returns true if the two geometries are equal in N dimensions (normal geometry equality is only 2D)static boolean
isCCW(CoordinateSequence ring)
Computes whether a ring defined by an array ofCoordinate
s is oriented counter-clockwise.-
Methods inherited from class CoordinateSequences
copy, copyCoord, ensureValidRing, extend, indexOf, isEqual, isRing, minCoordinate, minCoordinateIndex, minCoordinateIndex, reverse, scroll, scroll, scroll, swap, toString
-
-
-
-
Method Detail
-
isCCW
public static boolean isCCW(CoordinateSequence ring)
Computes whether a ring defined by an array ofCoordinate
s 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
public static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q)
-
coordinateDimension
public static int coordinateDimension(Geometry g)
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
public static int coordinateDimension(CoordinateSequence seq)
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
-
-