Class CoordinateArrays

java.lang.Object
com.vividsolutions.jump.util.CoordinateArrays

public class CoordinateArrays extends Object
Some utility functions for handling Coordinate arrays.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons, List<org.locationtech.jts.geom.Coordinate[]> 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 boolean
    equals(org.locationtech.jts.geom.Coordinate[] coord1, org.locationtech.jts.geom.Coordinate[] coord2)
     
    static List<org.locationtech.jts.geom.Geometry>
    fromCoordinateArrays(List<org.locationtech.jts.geom.Coordinate[]> coordArrays, org.locationtech.jts.geom.GeometryFactory fact)
    Converts a collection of coordinate arrays to a collection of geometries.
    static List<org.locationtech.jts.geom.Coordinate[]>
    toCoordinateArrays(org.locationtech.jts.geom.Geometry g, boolean orientPolygons)
    Extract the coordinate arrays for a geometry.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CoordinateArrays

      public CoordinateArrays()
  • Method Details

    • 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 point
      fact - 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<org.locationtech.jts.geom.Geometry> fromCoordinateArrays(List<org.locationtech.jts.geom.Coordinate[]> 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<org.locationtech.jts.geom.Coordinate[]> coordArrayList)
      Extract the coordinate arrays for a geometry into a List.
      Parameters:
      g - the Geometry to extract from
      orientPolygons - whether or not the arrays in the List should be oriented (clockwise for the shell, counterclockwise for the holes)
      coordArrayList - the List to add the coordinate arrays to
    • 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 inspect
      desiredOrientation - 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<org.locationtech.jts.geom.Coordinate[]> 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 from
      orientPolygons - ensure that Polygons are correctly oriented
      Returns:
      a list of Coordinate[]