Class GeoProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable

public class GeoProps extends PropCnr
This Geographical property is a container that holds information about client position and an API to work with geographical location services.

The geographic coordinate reference system used by the attributes in this interface is the World Geodetic System (2d) [WGS84].

The latitude and longitude attributes are geographic coordinates specified in decimal degrees.

The altitude attribute denotes the height of the position, specified in meters above the [WGS84] ellipsoid. If the implementation cannot provide altitude information, the value of this attribute is null.

The accuracy attribute denotes the accuracy level of the latitude and longitude coordinates. It is specified in meters and must be supported by all implementations. The value of the accuracy attribute is a non-negative real number.

The altitudeAccuracy attribute is specified in meters. If the implementation cannot provide altitude information, the value of this attribute must be null. Otherwise, the value of the altitudeAccuracy attribute must be a non-negative real number.

The accuracy and altitudeAccuracy values returned by an implementation should correspond to a 95% confidence level.

The heading attribute denotes the direction of travel of the hosting device and is specified in degrees, where 0<=heading<360, counting clockwise relative to the true north. If the implementation cannot provide heading information, the value of this attribute is null. If the hosting device is stationary (i.e. the value of the speed attribute is 0), then the value of the heading attribute is NaN.

The speed attribute denotes the magnitude of the horizontal component of the hosting device's current velocity and is specified in meters per second. If the implementation cannot provide speed information, the value of this attribute must be null. Otherwise, the value of the speed attribute is a non-negative real number.

Author:
Christopher Mindus
  • Field Details

  • Constructor Details

    • GeoProps

      public GeoProps()
      Creates the environment properties without a name.
    • GeoProps

      public GeoProps(Atom atom)
      Creates the environment properties with a name.
      Parameters:
      atom - The atom name.
  • Method Details

    • clone

      public GeoProps clone()
      Clones the properties.
      Overrides:
      clone in class PropCnr
    • isSupported

      public boolean isSupported()
      Returns if geolocation is supported by the device.
    • requestLocation

      public boolean requestLocation(ILocationListener callback)
      Request a new Geolocation from the client.

      If you specify the same callback in multiple calls, only one will be called. Once called, you can use the same instance again for another call followed by another callback.

      Parameters:
      callback - Callback for availability of the new location or the error, null for none.
      Returns:
      true for callback added for reply processing, false if the callback already has been used (or is null).
    • onEventSelf

      public void onEventSelf(GEvent event)
      Checks for state change events and fires it to listeners.
      Specified by:
      onEventSelf in interface IGProp<GProp<?>[]>
      Overrides:
      onEventSelf in class GProp<GProp<?>[]>
      Parameters:
      event - The property event.
    • onRemoteEvent

      public void onRemoteEvent(RemoteEvent event)
      Called when a remote property event should be processed by this property.

      A subclass can override this method to perform appropriate processing and is not required to call super.onRemoteEvent(e).

      The onRemoteEvent is NOT called when in a proxied property container, but rather the normal onEventSelf method.

      Specified by:
      onRemoteEvent in interface IGProp<GProp<?>[]>
      Overrides:
      onRemoteEvent in class GProp<GProp<?>[]>
      Parameters:
      event - The remote event.
    • getLocation

      public GeoLocation getLocation()
      Gets the last location available.
      Returns:
      GeoPosition A new instance data.
    • initialize

      public ILocationService initialize(IClientSessionGyro clientGyro, IAddUserLocation locationAdder)
      Initializes the client session to receive locations.
      Parameters:
      clientGyro - The client session gyro.
      locationAdder - The location adder.
      Returns:
      The location service for the client session.
      Throws:
      IllegalStateException - If already initialized.