Class DistanceUnits

    • Method Detail

      • valueOf

        public static DistanceUnits valueOf​(String str)
        Parses a string representation of distance units and returns its implementing class instance. Preferred way to parse a DistanceUnits would be to use AbstractSpatialFieldType.parseDistanceUnits(String), since it will default to one defined on the field type if the string is null.
        str - String representation of distance units, e.g. "kilometers", "miles" etc. (null ok)
        an instance of the concrete DistanceUnits, null if not found.
      • getSupportedUnits

        public static Set<String> getSupportedUnits()
      • getEarthRadius

        public double getEarthRadius()
        Radius of the earth in this distance units
      • multiplierFromThisUnitToDegrees

        public double multiplierFromThisUnitToDegrees()
        multiplier needed to convert a distance in current units to degrees
      • multiplierFromDegreesToThisUnit

        public double multiplierFromDegreesToThisUnit()
        multiplier needed to convert a distance in degrees to current units
      • getStringIdentifier

        public String getStringIdentifier()
        the string identifier associated with this units instance
      • addUnits

        public static void addUnits​(String strId,
                                    double earthRadius,
                                    double multiplierThisToDegrees)
        Custom distance units can be supplied using this method. It's thread-safe.
        strId - string identifier for the units
        earthRadius - radius of earth in supplied units
        multiplierThisToDegrees - multiplier to convert to degrees