Package org.openhab.core.library.types
Class PointType
java.lang.Object
org.openhab.core.library.types.PointType
- All Implemented Interfaces:
Command
,ComplexType
,State
,Type
This type can be used for items that are dealing with GPS or
location awareness functionality.
- Author:
- Gaël L'hopital - Initial contribution, John Cocula - Initial contribution
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefault constructor creates a point at sea level where the equator (0° latitude) and the prime meridian (0° longitude) intersect.PointType
(DecimalType latitude, DecimalType longitude) PointType
(DecimalType latitude, DecimalType longitude, DecimalType altitude) PointType
(StringType latitude, StringType longitude) PointType
(StringType latitude, StringType longitude, StringType altitude) -
Method Summary
Modifier and TypeMethodDescriptionReturn the bearing in degrees from otherPoint following a great circle path.distanceFrom
(PointType otherPoint) Return the distance in meters from otherPoint, ignoring altitude.boolean
Formats the value of this type according to a pattern (seeFormatter
).Returns all constituents with their names as a sorted mapint
hashCode()
void
setAltitude
(DecimalType altitude) Get a string representation that contains the whole internal representation of the type.toString()
static PointType
-
Field Details
-
LOCATION_PATTERN
- See Also:
-
EARTH_GRAVITATIONAL_CONSTANT
public static final double EARTH_GRAVITATIONAL_CONSTANT- See Also:
-
WGS84_A
public static final double WGS84_A- See Also:
-
KEY_LATITUDE
- See Also:
-
KEY_LONGITUDE
- See Also:
-
KEY_ALTITUDE
- See Also:
-
-
Constructor Details
-
PointType
public PointType()Default constructor creates a point at sea level where the equator (0° latitude) and the prime meridian (0° longitude) intersect. A nullary constructor is needed byItemUpdater.receiveUpdate(org.openhab.core.items.events.ItemStateEvent)
) -
PointType
-
PointType
-
PointType
-
PointType
-
PointType
-
-
Method Details
-
getLatitude
-
getLongitude
-
getAltitude
-
setAltitude
-
getGravity
-
bearingTo
Return the bearing in degrees from otherPoint following a great circle path.- Parameters:
otherPoint
-- Returns:
- bearing in degrees
- See Also:
-
distanceFrom
Return the distance in meters from otherPoint, ignoring altitude. This algorithm also ignores the oblate spheroid shape of Earth and assumes a perfect sphere, so results are inexact.- Parameters:
otherPoint
-- Returns:
- distance in meters
- See Also:
-
format
Formats the value of this type according to a pattern (seeFormatter
). One single value of this type can be referenced by the pattern using an index. The item order is defined by the natural (alphabetical) order of their keys. -
valueOf
-
toString
-
toFullString
Description copied from interface:Type
Get a string representation that contains the whole internal representation of the type.The returned string could be consumed by the static 'valueOf(String)' method of the respective type to build a new type that is equal to this type.
- Specified by:
toFullString
in interfaceType
- Returns:
- a full string representation of the type to be consumed by 'valueOf(String)'
-
getConstituents
Description copied from interface:ComplexType
Returns all constituents with their names as a sorted map- Specified by:
getConstituents
in interfaceComplexType
- Returns:
- all constituents with their names
-
hashCode
public int hashCode() -
equals
-