Class JTSUtils


  • public final class JTSUtils
    extends java.lang.Object
    Utilities for Geometry data type from JTS library.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JTSUtils.GeometryTarget
      Converter output target that creates a JTS Geometry.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JTSUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void addCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total)  
      private static void addCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total, double x, double y)  
      private static void addRing​(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int size)  
      static org.locationtech.jts.geom.Geometry ewkb2geometry​(byte[] ewkb)
      Converts EWKB to a JTS geometry object.
      static org.locationtech.jts.geom.Geometry ewkb2geometry​(byte[] ewkb, int dimensionSystem)
      Converts EWKB to a JTS geometry object.
      static byte[] geometry2ewkb​(org.locationtech.jts.geom.Geometry geometry)
      Converts Geometry to EWKB.
      static byte[] geometry2ewkb​(org.locationtech.jts.geom.Geometry geometry, int dimensionSystem)
      Converts Geometry to EWKB.
      static int getDimensionSystem​(org.locationtech.jts.geom.Geometry geometry)
      Determines a dimension system of a JTS Geometry object.
      private static int getDimensionSystem1​(org.locationtech.jts.geom.Geometry geometry)  
      private static int getDimensionSystemFromCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence, int index)  
      private static int getDimensionSystemFromSequence​(org.locationtech.jts.geom.CoordinateSequence sequence)  
      static void parseGeometry​(org.locationtech.jts.geom.Geometry geometry, GeometryUtils.Target target)
      Parses a JTS Geometry object.
      private static void parseGeometry​(org.locationtech.jts.geom.Geometry geometry, GeometryUtils.Target target, int parentType)
      Parses a JTS Geometry object.
      • Methods inherited from class java.lang.Object

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

      • JTSUtils

        private JTSUtils()
    • Method Detail

      • ewkb2geometry

        public static org.locationtech.jts.geom.Geometry ewkb2geometry​(byte[] ewkb)
        Converts EWKB to a JTS geometry object.
        Parameters:
        ewkb - source EWKB
        Returns:
        JTS geometry object
      • ewkb2geometry

        public static org.locationtech.jts.geom.Geometry ewkb2geometry​(byte[] ewkb,
                                                                       int dimensionSystem)
        Converts EWKB to a JTS geometry object.
        Parameters:
        ewkb - source EWKB
        dimensionSystem - dimension system
        Returns:
        JTS geometry object
      • geometry2ewkb

        public static byte[] geometry2ewkb​(org.locationtech.jts.geom.Geometry geometry)
        Converts Geometry to EWKB.
        Parameters:
        geometry - source geometry
        Returns:
        EWKB representation
      • geometry2ewkb

        public static byte[] geometry2ewkb​(org.locationtech.jts.geom.Geometry geometry,
                                           int dimensionSystem)
        Converts Geometry to EWKB.
        Parameters:
        geometry - source geometry
        dimensionSystem - dimension system
        Returns:
        EWKB representation
      • parseGeometry

        public static void parseGeometry​(org.locationtech.jts.geom.Geometry geometry,
                                         GeometryUtils.Target target)
        Parses a JTS Geometry object.
        Parameters:
        geometry - geometry to parse
        target - output target
      • parseGeometry

        private static void parseGeometry​(org.locationtech.jts.geom.Geometry geometry,
                                          GeometryUtils.Target target,
                                          int parentType)
        Parses a JTS Geometry object.
        Parameters:
        geometry - geometry to parse
        target - output target
        parentType - type of parent geometry collection, or 0 for the root geometry
      • addRing

        private static void addRing​(org.locationtech.jts.geom.CoordinateSequence sequence,
                                    GeometryUtils.Target target,
                                    int size)
      • addCoordinate

        private static void addCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence,
                                          GeometryUtils.Target target,
                                          int index,
                                          int total)
      • addCoordinate

        private static void addCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence,
                                          GeometryUtils.Target target,
                                          int index,
                                          int total,
                                          double x,
                                          double y)
      • getDimensionSystem

        public static int getDimensionSystem​(org.locationtech.jts.geom.Geometry geometry)
        Determines a dimension system of a JTS Geometry object.
        Parameters:
        geometry - geometry to parse
        Returns:
        the dimension system
      • getDimensionSystem1

        private static int getDimensionSystem1​(org.locationtech.jts.geom.Geometry geometry)
      • getDimensionSystemFromSequence

        private static int getDimensionSystemFromSequence​(org.locationtech.jts.geom.CoordinateSequence sequence)
      • getDimensionSystemFromCoordinate

        private static int getDimensionSystemFromCoordinate​(org.locationtech.jts.geom.CoordinateSequence sequence,
                                                            int index)