Class GeometryUtils


  • public final class GeometryUtils
    extends java.lang.Object
    Utilities for GEOMETRY data type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DIMENSION_SYSTEM_XY
      Code of 2D (XY) dimension system.
      static int DIMENSION_SYSTEM_XYM
      Code of M (XYM) dimension system.
      static int DIMENSION_SYSTEM_XYZ
      Code of Z (XYZ) dimension system.
      static int DIMENSION_SYSTEM_XYZM
      Code of ZM (XYZM) dimension system.
      static int GEOMETRY_COLLECTION
      GEOMETRYCOLLECTION geometry type.
      static int LINE_STRING
      LINESTRING geometry type.
      static int M
      Number of M coordinate.
      static int MAX_X
      Maximum X coordinate index.
      static int MAX_Y
      Maximum Y coordinate index.
      static int MIN_X
      Minimum X coordinate index.
      static int MIN_Y
      Minimum Y coordinate index.
      static int MULTI_LINE_STRING
      MULTILINESTRING geometry type.
      static int MULTI_POINT
      MULTIPOINT geometry type.
      static int MULTI_POLYGON
      MULTIPOLYGON geometry type.
      static int POINT
      POINT geometry type.
      static int POLYGON
      POLYGON geometry type.
      static int X
      Number of X coordinate.
      static int Y
      Number of Y coordinate.
      static int Z
      Number of Z coordinate.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GeometryUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static double checkFinite​(double d)
      Throw exception if param is not finite value (ie.
      static double[] getEnvelope​(byte[] ewkb)
      Calculates an envelope of a specified geometry.
      static boolean intersects​(double[] envelope1, double[] envelope2)
      Checks whether two envelopes intersect with each other.
      (package private) static double toCanonicalDouble​(double d)
      Normalizes all NaNs into single type on NaN and negative zero to positive zero.
      static double[] union​(double[] envelope1, double[] envelope2)
      Returns union of two envelopes.
      • Methods inherited from class java.lang.Object

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

      • GeometryUtils

        private GeometryUtils()
    • Method Detail

      • getEnvelope

        public static double[] getEnvelope​(byte[] ewkb)
        Calculates an envelope of a specified geometry.
        Parameters:
        ewkb - EWKB of a geometry
        Returns:
        envelope, or null
      • intersects

        public static boolean intersects​(double[] envelope1,
                                         double[] envelope2)
        Checks whether two envelopes intersect with each other.
        Parameters:
        envelope1 - first envelope, or null
        envelope2 - second envelope, or null
        Returns:
        whether the specified envelopes intersects
      • union

        public static double[] union​(double[] envelope1,
                                     double[] envelope2)
        Returns union of two envelopes. This method does not modify the specified envelopes, but may return one of them as a result.
        Parameters:
        envelope1 - first envelope, or null
        envelope2 - second envelope, or null
        Returns:
        union of two envelopes
      • toCanonicalDouble

        static double toCanonicalDouble​(double d)
        Normalizes all NaNs into single type on NaN and negative zero to positive zero.
        Parameters:
        d - double value
        Returns:
        normalized value
      • checkFinite

        static double checkFinite​(double d)
        Throw exception if param is not finite value (ie. NaN/inf/etc)
        Parameters:
        d - a double value
        Returns:
        the same double value