Class GeometryUtils

java.lang.Object
io.jmix.maps.utils.GeometryUtils

public final class GeometryUtils extends Object
Utility class containing methods connected with JTS library.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.locationtech.jts.geom.LineString
    createLineString(org.locationtech.jts.geom.Coordinate[] coordinates)
    Creates a LineString using the given coordinates.
    static org.locationtech.jts.geom.MultiLineString
    createMultiLineString(org.locationtech.jts.geom.LineString[] lineStrings)
    Creates a MultiLineString using the given LineStrings.
    static org.locationtech.jts.geom.MultiPoint
    createMultiPoint(org.locationtech.jts.geom.Point[] points)
    Creates a MultiPoint using the given Points.
    static org.locationtech.jts.geom.MultiPolygon
    createMultiPolygon(org.locationtech.jts.geom.Polygon[] polygons)
    Creates a MultiPolygon using the given Polygons.
    static org.locationtech.jts.geom.Point
    createPoint(double x, double y)
    Creates a point with the given coordinates.
    static org.locationtech.jts.geom.Polygon
    createPolygon(org.locationtech.jts.geom.Coordinate[] shell)
    Creates a Polygon with the given exterior boundary.
    static Double
    getAltitude(org.locationtech.jts.geom.Coordinate c)
    Returns double value of the altitude of the JTS's Coordinate.
    static org.locationtech.jts.geom.GeometryFactory
    Creates a GeometryFactory having EPSG:4326 spatial-reference ID.
    static Double
    getLatitude(org.locationtech.jts.geom.Coordinate c)
    Returns double value of the latitude of the JTS's Coordinate.
    static Double
    getLongitude(org.locationtech.jts.geom.Coordinate c)
    Returns double value of the longitude of the JTS's Coordinate.
    static org.locationtech.jts.geom.LineString
    Converts WKT representation of a polyline to a LineString object.
    static org.locationtech.jts.geom.MultiLineString
    Converts WKT representation of a multilinestring to a MultiLineString object.
    static org.locationtech.jts.geom.MultiPoint
    Converts WKT representation of a multipoint to a MultiPoint object.
    static org.locationtech.jts.geom.MultiPolygon
    Converts WKT representation of a multipolygon to a MultiPolygon object.
    static org.locationtech.jts.geom.Point
    Converts WKT representation of a point to a Point object.
    static org.locationtech.jts.geom.Polygon
    Converts WKT representation of a polygon to a Polygon object.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getLatitude

      public static Double getLatitude(org.locationtech.jts.geom.Coordinate c)
      Returns double value of the latitude of the JTS's Coordinate.
      Parameters:
      c - JTS's Coordinate
      Returns:
      Double value of the latitude
    • getLongitude

      public static Double getLongitude(org.locationtech.jts.geom.Coordinate c)
      Returns double value of the longitude of the JTS's Coordinate.
      Parameters:
      c - JTS's Coordinate
      Returns:
      Double value of the longitude
    • getAltitude

      public static Double getAltitude(org.locationtech.jts.geom.Coordinate c)
      Returns double value of the altitude of the JTS's Coordinate.
      Parameters:
      c - JTS's Coordinate
      Returns:
      Double value of the altitude
    • wktStringToPoint

      public static org.locationtech.jts.geom.Point wktStringToPoint(String wktString)
      Converts WKT representation of a point to a Point object.
      Parameters:
      wktString - WKT representation of a point
      Returns:
      Point object
    • wktStringToLineString

      public static org.locationtech.jts.geom.LineString wktStringToLineString(String wktString)
      Converts WKT representation of a polyline to a LineString object.
      Parameters:
      wktString - WKT representation of a linestring
      Returns:
      LineString object
    • wktStringToPolygon

      public static org.locationtech.jts.geom.Polygon wktStringToPolygon(String wktString)
      Converts WKT representation of a polygon to a Polygon object.
      Parameters:
      wktString - WKT representation of a polygon
      Returns:
      Polygon object
    • wktStringToMultiPoint

      public static org.locationtech.jts.geom.MultiPoint wktStringToMultiPoint(String wktString)
      Converts WKT representation of a multipoint to a MultiPoint object.
      Parameters:
      wktString - WKT representation of a multipoint
      Returns:
      MultiPoint object
    • wktStringToMultiLineString

      public static org.locationtech.jts.geom.MultiLineString wktStringToMultiLineString(String wktString)
      Converts WKT representation of a multilinestring to a MultiLineString object.
      Parameters:
      wktString - WKT representation of a multi polyline
      Returns:
      MultiLineString object
    • wktStringToMultiPolygon

      public static org.locationtech.jts.geom.MultiPolygon wktStringToMultiPolygon(String wktString)
      Converts WKT representation of a multipolygon to a MultiPolygon object.
      Parameters:
      wktString - WKT representation of a multi polygon
      Returns:
      MultiPolygon object
    • getGeometryFactory

      public static org.locationtech.jts.geom.GeometryFactory getGeometryFactory()
      Creates a GeometryFactory having EPSG:4326 spatial-reference ID.
      Returns:
      GeometryFactory
    • createPoint

      public static org.locationtech.jts.geom.Point createPoint(double x, double y)
      Creates a point with the given coordinates.

      Delegates creating Point to GeometryFactory initialized with EPSG:4326.

      Parameters:
      x - the x-value
      y - the y-value
      Returns:
      Point object
    • createLineString

      public static org.locationtech.jts.geom.LineString createLineString(org.locationtech.jts.geom.Coordinate[] coordinates)
      Creates a LineString using the given coordinates.

      Delegates creating LineString to GeometryFactory initialized with EPSG:4326.

      Parameters:
      coordinates - an array without null elements
      Returns:
      linestring object
    • createPolygon

      public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.Coordinate[] shell)
      Creates a Polygon with the given exterior boundary.

      Delegates creating Polygon to GeometryFactory initialized with EPSG:4326.

      Parameters:
      shell - the outer boundary of the new Polygon
      Returns:
      a polygon object
    • createMultiPoint

      public static org.locationtech.jts.geom.MultiPoint createMultiPoint(org.locationtech.jts.geom.Point[] points)
      Creates a MultiPoint using the given Points.

      Delegates creating MultiPoint to GeometryFactory initialized with EPSG:4326.

      Parameters:
      points - an array of Points (without null elements)
      Returns:
      a multipoint
    • createMultiLineString

      public static org.locationtech.jts.geom.MultiLineString createMultiLineString(org.locationtech.jts.geom.LineString[] lineStrings)
      Creates a MultiLineString using the given LineStrings.

      Delegates creating MultiLineString to GeometryFactory initialized with EPSG:4326.

      Parameters:
      lineStrings - array of linestrings
      Returns:
      a multilinestring
    • createMultiPolygon

      public static org.locationtech.jts.geom.MultiPolygon createMultiPolygon(org.locationtech.jts.geom.Polygon[] polygons)
      Creates a MultiPolygon using the given Polygons.

      Delegates creating MultiPolygon to GeometryFactory initialized with EPSG:4326.

      Parameters:
      polygons - array of polygons
      Returns:
      a multipolygon