Package org.h2.util.geometry
Class GeometryUtils
java.lang.Object
org.h2.util.geometry.GeometryUtils
Utilities for GEOMETRY data type.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Converter output target that determines minimal dimension system for a geometry.static final class
Converter output target that calculates an envelope.static class
Converter output target. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Code of 2D (XY) dimension system.static final int
Code of M (XYM) dimension system.static final int
Code of Z (XYZ) dimension system.static final int
Code of ZM (XYZM) dimension system.static final int
GEOMETRYCOLLECTION geometry type.static final int
LINESTRING geometry type.static final int
Number of M coordinate.static final int
Maximum X coordinate index.static final int
Maximum Y coordinate index.static final int
Minimum X coordinate index.static final int
Minimum Y coordinate index.static final int
MULTILINESTRING geometry type.static final int
MULTIPOINT geometry type.static final int
MULTIPOLYGON geometry type.static final int
POINT geometry type.static final int
POLYGON geometry type.static final int
Number of X coordinate.static final int
Number of Y coordinate.static final int
Number of Z coordinate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(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.
-
Field Details
-
POINT
public static final int POINTPOINT geometry type.- See Also:
-
LINE_STRING
public static final int LINE_STRINGLINESTRING geometry type.- See Also:
-
POLYGON
public static final int POLYGONPOLYGON geometry type.- See Also:
-
MULTI_POINT
public static final int MULTI_POINTMULTIPOINT geometry type.- See Also:
-
MULTI_LINE_STRING
public static final int MULTI_LINE_STRINGMULTILINESTRING geometry type.- See Also:
-
MULTI_POLYGON
public static final int MULTI_POLYGONMULTIPOLYGON geometry type.- See Also:
-
GEOMETRY_COLLECTION
public static final int GEOMETRY_COLLECTIONGEOMETRYCOLLECTION geometry type.- See Also:
-
X
public static final int XNumber of X coordinate.- See Also:
-
Y
public static final int YNumber of Y coordinate.- See Also:
-
Z
public static final int ZNumber of Z coordinate.- See Also:
-
M
public static final int MNumber of M coordinate.- See Also:
-
DIMENSION_SYSTEM_XY
public static final int DIMENSION_SYSTEM_XYCode of 2D (XY) dimension system.- See Also:
-
DIMENSION_SYSTEM_XYZ
public static final int DIMENSION_SYSTEM_XYZCode of Z (XYZ) dimension system. Can also be used in bit masks to determine presence of dimension Z.- See Also:
-
DIMENSION_SYSTEM_XYM
public static final int DIMENSION_SYSTEM_XYMCode of M (XYM) dimension system. Can also be used in bit masks to determine presence of dimension M.- See Also:
-
DIMENSION_SYSTEM_XYZM
public static final int DIMENSION_SYSTEM_XYZMCode of ZM (XYZM) dimension system. Can be also combined fromDIMENSION_SYSTEM_XYZ
andDIMENSION_SYSTEM_XYM
using bitwise OR.- See Also:
-
MIN_X
public static final int MIN_XMinimum X coordinate index.- See Also:
-
MAX_X
public static final int MAX_XMaximum X coordinate index.- See Also:
-
MIN_Y
public static final int MIN_YMinimum Y coordinate index.- See Also:
-
MAX_Y
public static final int MAX_YMaximum Y coordinate index.- See Also:
-
-
Constructor Details
-
GeometryUtils
private GeometryUtils()
-
-
Method Details
-
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 nullenvelope2
- 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 nullenvelope2
- 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
-