Class GeoProps

  • All Implemented Interfaces:
    EventListener, IGProp<GProp<?>[]>, IPropCnr, java.lang.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 Detail

      • AVAILABLE

        public static final java.lang.String AVAILABLE
        The available or supported property name.
        See Also:
        Constant Field Values
      • LATITUDE

        public static final java.lang.String LATITUDE
        The "latitude" property name.
        See Also:
        Constant Field Values
      • LONGITUDE

        public static final java.lang.String LONGITUDE
        The "longitude" property name.
        See Also:
        Constant Field Values
      • ALTITUDE

        public static final java.lang.String ALTITUDE
        The "altitude" property name.
        See Also:
        Constant Field Values
      • ACCURACY

        public static final java.lang.String ACCURACY
        The "accuracy" property name.
        See Also:
        Constant Field Values
      • ALTITUDE_ACCURACY

        public static final java.lang.String ALTITUDE_ACCURACY
        The "altitude accuracy" property name.
        See Also:
        Constant Field Values
      • HEADING

        public static final java.lang.String HEADING
        The "heading" property name.
        See Also:
        Constant Field Values
      • ERROR_CODE

        public static final java.lang.String ERROR_CODE
        The "error code" property name: the Integer property.
        • 0 = OK,
        • 1 = PERMISSION_DENIED,
        • 2 = POSITION_UNAVAILABLE,
        • 3 = TIMEOUT.
        See Also:
        Constant Field Values
      • ERROR_MSG

        public static final java.lang.String ERROR_MSG
        The "error code" property name: the String property. This property reflects the last error state, i.e. when not OK. If the errCode is OK, the error message remains.
        See Also:
        Constant Field Values
      • TIMESTAMP

        public static final java.lang.String TIMESTAMP
        The "timestamp" of the position, LongProp, milliseconds since January 1, 1970.
        See Also:
        Constant Field Values
    • Constructor Detail

      • 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 Detail

      • 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:
        java.lang.IllegalStateException - If already initialized.