Package org.opencms.util
Class CmsGeoUtil
- java.lang.Object
-
- org.opencms.util.CmsGeoUtil
-
public final class CmsGeoUtil extends java.lang.Object
Utility methods for processing geo coordinates.
-
-
Constructor Summary
Constructors Constructor Description CmsGeoUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
parseCoordinates(java.lang.String coordinates)
Parses coordinates, either from a lat,lon pair or from the JSON generated by the location picker.static java.lang.String
parseLocationPickerCoordinates(java.lang.String jsonValue)
Parses a location picker JSON value and returns the coordinates contained therein.static boolean
validateCoordinates(java.lang.String coordinates)
Validates a coordinates string and returns the validation result.static boolean
validateLatitude(java.lang.String latitude)
Validates a latitude string.static boolean
validateLocationPickerCoordinates(JSONObject jsonObject)
Validates the coordinates contained in a given location picker JSON value.static boolean
validateLongitude(java.lang.String longitude)
Validates a longitude string.static boolean
validateRadius(java.lang.String radius)
Validates a radius string.static boolean
validateUnits(java.lang.String units)
Validates a units string.
-
-
-
Constructor Detail
-
CmsGeoUtil
public CmsGeoUtil()
-
-
Method Detail
-
parseCoordinates
public static java.lang.String parseCoordinates(java.lang.String coordinates)
Parses coordinates, either from a lat,lon pair or from the JSON generated by the location picker.- Parameters:
coordinates
- the coordinates string- Returns:
- the parsed coordinates
-
parseLocationPickerCoordinates
public static java.lang.String parseLocationPickerCoordinates(java.lang.String jsonValue)
Parses a location picker JSON value and returns the coordinates contained therein.- Parameters:
jsonValue
- the JSON value as string- Returns:
- the coordinates string or null if there are no valid location picker coordinates
-
validateCoordinates
public static boolean validateCoordinates(java.lang.String coordinates)
Validates a coordinates string and returns the validation result.- Parameters:
coordinates
- the coordinates string to validate- Returns:
- whether the coordinates are valid (true) or invalid (false)
-
validateLatitude
public static boolean validateLatitude(java.lang.String latitude)
Validates a latitude string.- Parameters:
latitude
- the latitude string to validate- Returns:
- whether the string is a valid latitude value (true) or not (false)
-
validateLocationPickerCoordinates
public static boolean validateLocationPickerCoordinates(JSONObject jsonObject)
Validates the coordinates contained in a given location picker JSON value.- Parameters:
jsonObject
- the JSON value- Returns:
- whether JSON contains valid coordinates (true) or not (false)
-
validateLongitude
public static boolean validateLongitude(java.lang.String longitude)
Validates a longitude string.- Parameters:
longitude
- the longitude string to validate- Returns:
- whether the string is a valid longitude value (true) or not (false)
-
validateRadius
public static boolean validateRadius(java.lang.String radius)
Validates a radius string.- Parameters:
radius
- the radius- Returns:
- whether a valid radius string or not
-
validateUnits
public static boolean validateUnits(java.lang.String units)
Validates a units string.- Parameters:
units
- the units string- Returns:
- whether a valid units string or not
-
-