Class JTSUtil

java.lang.Object
io.jmix.mapsui.widget.leaflet.util.JTSUtil

public class JTSUtil extends Object
Helper methods to convert between JTS geometry types and v-leaflet objects.

The CRF is expected to be WGS84 (~EPSG:4326 ~ GPS coordinates) in both directions.

  • Constructor Details

    • JTSUtil

      public JTSUtil()
  • Method Details

    • toLayer

      public static LeafletLayer toLayer(org.locationtech.jts.geom.Geometry geom)
      Translates a JTS Geometry to a LeafletLayer. If given geometry maps to multiple LeafletLayers they are returned in a LLayerGroup.
      Parameters:
      geom - Geometry
      Returns:
      the layer built based on JTS Geometry
    • toLayers

      public static Collection<LeafletLayer> toLayers(org.locationtech.jts.geom.Geometry geom)
      Translates between a JTS Geometry and one or more LeafletLayers
      Parameters:
      geom - Geometry
      Returns:
      a collection of layers built from JTS Geometry
    • toLMarker

      public static LMarker toLMarker(org.locationtech.jts.geom.Point point)
      Translates between a Point and a LMarker
      Parameters:
      point - the point to be translated into marker
      Returns:
      LMarker in given JTS Point
    • toPolyline

      public static LPolyline toPolyline(org.locationtech.jts.geom.LineString lineString)
      Translates between a JTS LineString and a v-leaflet Polyline
      Parameters:
      lineString - the linestring to be converted into polyline
      Returns:
      LPolyline with points from the given LineString
    • toMultiPolyline

      public static LMultiPolyline toMultiPolyline(org.locationtech.jts.geom.MultiLineString multiLineString)
      Translates between a JTS MultiLineString and a v-leaflet LMultiPolyline
      Parameters:
      multiLineString - the JTS multi polyline to be translated into polyline layer
      Returns:
      LMultiPolyline with points from the given MultiLineString
    • toPolygon

      public static LPolygon toPolygon(org.locationtech.jts.geom.Polygon polygon)
      Translates between a JTS Polygon and a v-leaflet LPolygon
      Parameters:
      polygon - the JTS polygon to be translated into polygon layer
      Returns:
      LPolygon with points from the given Polygon
    • toMultiPolygon

      public static LMultiPolygon toMultiPolygon(org.locationtech.jts.geom.MultiPolygon multiPolygon)
      Translates between a JTS MultiPolygon and a v-leaflet LMultiPolygon
      Parameters:
      multiPolygon - the JTS multi polygon to be translated into polygon layer
      Returns:
      LMultiPolygon with points from the given MultiPolygon
    • toPolygon

      public static LPolygon toPolygon(org.locationtech.jts.geom.LinearRing linearRing)
      Translates between a JTS LinearRing and a v-leaflet LPolygon
      Parameters:
      linearRing - the JTS linearring to be translated to polygon layer
      Returns:
      LPolygon with points from the given LinearRing
    • toPointArray

      public static Point[] toPointArray(org.locationtech.jts.geom.Coordinate[] coords)
      Translates between an array of v-leaflet Points and JTS Coordinates
      Parameters:
      coords - the coordinate array to be translated into v-leaflet projects internal Point data type
      Returns:
      point array from given JTS Coordinates
    • toLeafletPointArray

      public static Point[] toLeafletPointArray(org.locationtech.jts.geom.LineString path)
    • toLineString

      public static org.locationtech.jts.geom.LineString toLineString(Point[] points)
    • toLineString

      public static org.locationtech.jts.geom.LineString toLineString(LPolyline polyline)
    • toLinearRing

      public static org.locationtech.jts.geom.LinearRing toLinearRing(LPolyline polyline)
    • toMultiPolyline

      public static org.locationtech.jts.geom.MultiLineString toMultiPolyline(LMultiPolyline multiPolyline)
    • toMultiPolygon

      public static org.locationtech.jts.geom.MultiPolygon toMultiPolygon(LMultiPolygon multiPolygon)
    • toPolygon

      public static org.locationtech.jts.geom.Polygon toPolygon(LPolygon polygon)
    • toPoint

      public static org.locationtech.jts.geom.Point toPoint(Point p)
    • toPoint

      public static org.locationtech.jts.geom.Point toPoint(LMarker lMarker)
    • toLeafletPoint

      public static Point toLeafletPoint(org.locationtech.jts.geom.Point location)
    • getBounds

      public static Bounds getBounds(org.locationtech.jts.geom.Geometry geometry)
    • toBounds

      public static Bounds toBounds(org.locationtech.jts.geom.Coordinate... coordinates)
    • toBounds

      public static Bounds toBounds(org.locationtech.jts.geom.Point topLeft, org.locationtech.jts.geom.Point bottomRight)
    • toLayer

      public static LeafletLayer toLayer(String wellKnownText) throws org.locationtech.jts.io.ParseException
      Throws:
      org.locationtech.jts.io.ParseException