Class LocationDataSource.Location

  • Direct Known Subclasses:
    NmeaDataSource.Location
    Enclosing class:
    LocationDataSource

    public static class LocationDataSource.Location
    extends Object
    A location update provided by a LocationDataSource, consisting primarily of a Point representing a geographical location, and attributes of location change such as the course (direction of travel), and the velocity (speed of location change).

    Also provides information about the accuracy of the location - the possible difference between the true ground location and that reported by the data source from getPosition().

    Since:
    100.0.0
    See Also:
    LocationDisplay.getLocation()
    • Constructor Detail

      • Location

        public Location​(Point position)
        Creates a new Location with given Point. Other properties will have default values.
        Parameters:
        position - a Point object representing the geographical position of the new Location
        Throws:
        IllegalArgumentException - if position is null or the spatial reference of position is null
        Since:
        100.0.0
      • Location

        public Location​(Point position,
                        double horizontalAccuracy,
                        double velocity,
                        double course,
                        boolean lastKnown)
        Creates a new Location with given Point, accuracy, velocity, course, and whether the location represents a last known location or not.
        Parameters:
        position - a Point object representing the geographical position of the new Location
        horizontalAccuracy - the horizontal accuracy of the new location
        velocity - the current speed of the locations movement
        course - the current direction of the locations movement
        lastKnown - true if the location represents a last known position; false if the position information is current
        Throws:
        IllegalArgumentException - if position is null or the spatial reference of position is null
        Since:
        100.0.0
      • Location

        public Location​(Point position,
                        double horizontalAccuracy,
                        double verticalAccuracy,
                        double velocity,
                        double course,
                        boolean lastKnown,
                        Calendar timeStamp)
        Creates a new location with the given Point, horizontal accuracy, vertical accuracy, velocity, course, whether the location represents a last known location or not, and timeStamp.
        Parameters:
        position - a Point object representing the geographical position of the new Location
        horizontalAccuracy - the horizontal accuracy of the new location
        verticalAccuracy - the vertical accuracy of the new location
        velocity - the current speed of the locations movement
        course - the current direction of the locations movement
        lastKnown - true if the location represents a last known position; false if the position information is current
        timeStamp - the date and time the location was determined
        Throws:
        IllegalArgumentException - if position is null or the spatial reference of position is null
        Since:
        100.4.0
    • Method Detail

      • getTimeStamp

        public Calendar getTimeStamp()
        Gets the date and time the location was determined.
        Returns:
        a Calendar object representing the time the location was determined
        Since:
        100.4.0
      • getCourse

        public double getCourse()
        Returns the current direction of the locations movement, in degrees clockwise from north. The course is used by the LocationDisplay to determine the rotation of the map when using LocationDisplay.AutoPanMode.NAVIGATION. Default value is 0.0.
        Returns:
        a double value representing the direction the device is moving, in degrees clockwise from north
        Since:
        100.0.0
      • getHorizontalAccuracy

        public double getHorizontalAccuracy()
        Returns the horizontal accuracy value of the location, in meters, used by the LocationDisplay to determine the size of the LocationDisplay.getAccuracySymbol() when LocationDisplay.isShowAccuracy() is true. Default value is 0.0.

        For example, an accuracy value of 20 would indicate that the true location may be anywhere within a 20 meter radius of the reported position.

        Returns:
        the accuracy of the reported location, in meters
        Since:
        100.0.0
      • getVerticalAccuracy

        public double getVerticalAccuracy()
        Gets the vertical accuracy of the location in meters.
        Returns:
        the vertical accuracy of the location in meters, Double.NaN if no vertical accuracy is available for the location.
        Since:
        100.3.0
      • getPosition

        public Point getPosition()
        A Point representing the geographical position of the Location, defined in the spatial reference used by this LocationDataSource.

        You can find out which spatial reference is used by calling getPosition().

        Returns:
        the geographical position of the Location
        Since:
        100.0.0
      • isLastKnown

        public boolean isLastKnown()
        Indicates if the location represents a last known position, or is current. Default value is false.

        For many types of location provider, it may take a while to receive the first location update. Last known locations can provide a suitable surrogate until current location information can be retrieved.

        Returns:
        true if this location represents a last known position; false if the location is current
        Since:
        100.0.0