Class PointType

java.lang.Object
org.openhab.core.library.types.PointType
All Implemented Interfaces:
Command, ComplexType, State, Type

@NonNullByDefault public class PointType extends Object implements ComplexType, Command, State
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 Details

  • 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 by ItemUpdater.receiveUpdate(org.openhab.core.items.events.ItemStateEvent))
    • PointType

      public PointType(DecimalType latitude, DecimalType longitude)
    • PointType

      public PointType(DecimalType latitude, DecimalType longitude, DecimalType altitude)
    • PointType

      public PointType(StringType latitude, StringType longitude)
    • PointType

      public PointType(StringType latitude, StringType longitude, StringType altitude)
    • PointType

      public PointType(String value)
  • Method Details

    • getLatitude

      public DecimalType getLatitude()
    • getLongitude

      public DecimalType getLongitude()
    • getAltitude

      public DecimalType getAltitude()
    • setAltitude

      public void setAltitude(DecimalType altitude)
    • getGravity

      public DecimalType getGravity()
    • bearingTo

      public DecimalType bearingTo(PointType otherPoint)
      Return the bearing in degrees from otherPoint following a great circle path.
      Parameters:
      otherPoint -
      Returns:
      bearing in degrees
      See Also:
    • distanceFrom

      public DecimalType distanceFrom(PointType otherPoint)
      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

      public String format(@Nullable String pattern)
      Formats the value of this type according to a pattern (see Formatter). 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.
      Specified by:
      format in interface Type
      Parameters:
      pattern - the pattern to use containing indexes to reference the single elements of this type
      Returns:
      the formatted string
    • valueOf

      public static PointType valueOf(String value)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toFullString

      public String 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 interface Type
      Returns:
      a full string representation of the type to be consumed by 'valueOf(String)'
    • getConstituents

      public SortedMap<String,PrimitiveType> getConstituents()
      Description copied from interface: ComplexType
      Returns all constituents with their names as a sorted map
      Specified by:
      getConstituents in interface ComplexType
      Returns:
      all constituents with their names
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object