Package io.github.sebasbaumh.postgis
Klasse PostGisUtil
java.lang.Object
io.github.sebasbaumh.postgis.PostGisUtil
Class for helper functions.
- Autor:
- Sebastian Baumhekel
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final byteBig endian encoding.static final char[]Characters for converting data to hex strings.static final byteLittle endian encoding. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic doublecalcAreaSigned(Iterable<Point> points) Calculates the area of the outer ring of the given polygon (signed).static <T extends Geometry>
booleancheckConsistency(Iterable<T> geoms) Do some internal consistency checks on the given geometries.static booleanequalsDouble(double a, double b) Compares two double values respectingDouble.NaNvalues.static <T,U> boolean equalsIterable(Iterable<T> la, Iterable<U> lb) Checks, if the givenIterables contain the same elements (in the same order).static <T> TfirstOrDefault(Iterable<T> elements) Returns the first or a default element of the given collection.static <T> TlastOrDefault(Iterable<T> elements) Gets the last element of the givenIterable.static StringRemoves brackets from the givenString.Splits a string likeString.split(String)without any support for regular expressions, but faster.static inttoHexByte(char c) Converts the given hexadecimal character to its byte representation. i.e.static byte[]toHexBytes(String hex) Converts the given string in hexadecimal format to the corresponding bytes.static StringtoHexString(byte[] data) Converts the byte data to a hexadecimal string.
-
Felddetails
-
BIG_ENDIAN
public static final byte BIG_ENDIANBig endian encoding.- Siehe auch:
-
HEX_CHAR
public static final char[] HEX_CHARCharacters for converting data to hex strings. -
LITTLE_ENDIAN
public static final byte LITTLE_ENDIANLittle endian encoding.- Siehe auch:
-
-
Methodendetails
-
calcAreaSigned
Calculates the area of the outer ring of the given polygon (signed).- Parameter:
points- points- Gibt zurück:
- area (signed depending on direction)
-
checkConsistency
Do some internal consistency checks on the given geometries. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. BinaryWriter may produce invalid results on inconsistent geometries.- Parameter:
geoms- geometries- Gibt zurück:
- true if all checks are passed.
-
equalsDouble
public static boolean equalsDouble(double a, double b) Compares two double values respectingDouble.NaNvalues. -
equalsIterable
Checks, if the givenIterables contain the same elements (in the same order). -
firstOrDefault
Returns the first or a default element of the given collection.- Parameter:
elements- collection- Gibt zurück:
- first element if it exists, else default element
-
lastOrDefault
Gets the last element of the givenIterable.- Parameter:
elements- elements- Gibt zurück:
- last element on success, else null
-
removeBrackets
Removes brackets from the givenString. -
split
Splits a string likeString.split(String)without any support for regular expressions, but faster.- Parameter:
value-Stringto split.separator- separator- Gibt zurück:
- the array of strings computed by splitting this string
-
toHexByte
public static int toHexByte(char c) Converts the given hexadecimal character to its byte representation. i.e. 'A'->10- Parameter:
c- character- Gibt zurück:
- byte value
- Löst aus:
IllegalArgumentException- if character is not '0'-'9', 'a'-'f' or 'A'-'F'
-
toHexBytes
Converts the given string in hexadecimal format to the corresponding bytes.- Parameter:
hex-Stringin hex- Gibt zurück:
- byte data
-
toHexString
Converts the byte data to a hexadecimal string.- Parameter:
data- byte data- Gibt zurück:
- hexadecimal
String(lower case)
-