Package org.locationtech.jts.jump.util
Class CoordinateArrays
- java.lang.Object
-
- org.locationtech.jts.jump.util.CoordinateArrays
-
public class CoordinateArrays extends Object
Some utility functions for handling Coordinate arrays.
-
-
Constructor Summary
Constructors Constructor Description CoordinateArrays()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons, List coordArrayList)Extract the coordinate arrays for a geometry into a List.static org.locationtech.jts.geom.Coordinate[]ensureOrientation(org.locationtech.jts.geom.Coordinate[] coord, int desiredOrientation)Sets the orientation of an array of coordinates.static booleanequals(org.locationtech.jts.geom.Coordinate[] coord1, org.locationtech.jts.geom.Coordinate[] coord2)static ListfromCoordinateArrays(List coordArrays, org.locationtech.jts.geom.GeometryFactory fact)Converts a collection of coordinate arrays to a collection of geometries.static voidreverse(org.locationtech.jts.geom.Coordinate[] coord)static org.locationtech.jts.geom.Coordinate[]toCoordinateArray(List coordList)static ListtoCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons)Extract the coordinate arrays for a geometry.static org.locationtech.jts.geom.GeometrytoLineOrPoint(org.locationtech.jts.geom.Coordinate[] coords, org.locationtech.jts.geom.GeometryFactory fact)Converts an array of coordinates to a line or point, as appropriate.
-
-
-
Method Detail
-
toCoordinateArray
public static org.locationtech.jts.geom.Coordinate[] toCoordinateArray(List coordList)
-
reverse
public static void reverse(org.locationtech.jts.geom.Coordinate[] coord)
-
toLineOrPoint
public static org.locationtech.jts.geom.Geometry toLineOrPoint(org.locationtech.jts.geom.Coordinate[] coords, org.locationtech.jts.geom.GeometryFactory fact)Converts an array of coordinates to a line or point, as appropriate.- Parameters:
coords- the coordinates of a line or pointfact- a factory used to create the Geometry- Returns:
- a line if there is more than one coordinate; a point if there is just one coordinate; an empty point otherwise
-
equals
public static boolean equals(org.locationtech.jts.geom.Coordinate[] coord1, org.locationtech.jts.geom.Coordinate[] coord2)
-
fromCoordinateArrays
public static List fromCoordinateArrays(List coordArrays, org.locationtech.jts.geom.GeometryFactory fact)
Converts a collection of coordinate arrays to a collection of geometries.- Parameters:
coordArrays- a collection of Coordinate[]fact- a factory used to create the Geometries- Returns:
- a collection of LineStrings and Points
-
addCoordinateArrays
public static void addCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons, List coordArrayList)Extract the coordinate arrays for a geometry into a List.- Parameters:
g- the Geometry to extract fromcoordArrayList- the List to add the coordinate arrays toorientPolygons- whether or not the arrays in the List should be oriented (clockwise for the shell, counterclockwise for the holes)
-
ensureOrientation
public static org.locationtech.jts.geom.Coordinate[] ensureOrientation(org.locationtech.jts.geom.Coordinate[] coord, int desiredOrientation)Sets the orientation of an array of coordinates.- Parameters:
coord- the coordinates to inspectdesiredOrientation- CGAlgorithms.CLOCKWISE or CGAlgorithms.COUNTERCLOCKWISE- Returns:
- a new array with entries in reverse order, if the orientation is incorrect; otherwise, the original array
-
toCoordinateArrays
public static List toCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons)
Extract the coordinate arrays for a geometry. Polygons will be checked to ensure their rings are oriented correctly. Note: coordinates from Points or MultiPoints will not be extracted.- Parameters:
g- the Geometry to extract fromorientPolygons- ensure that Polygons are correctly oriented- Returns:
- a list of Coordinate[]
-
-