Class Coordinate

  • All Implemented Interfaces:
    android.os.Parcelable

    public class Coordinate
    extends Object
    implements android.os.Parcelable
    A structure that contains geographical coordinate. Instances are immutable.

    See CoordinateConverter to convert between Coordinate and CartesianCoordinate's building coordinate.

    • Field Detail

      • CREATOR

        public static final android.os.Parcelable.Creator<Coordinate> CREATOR
    • Constructor Detail

      • Coordinate

        public Coordinate​(double latitude,
                          double longitude)
      • Coordinate

        public Coordinate​(@NonNull
                          Coordinate copy)
    • Method Detail

      • getLatitude

        public double getLatitude()
        Returns latitude in degrees
        Returns:
        double. Default is 0
      • getLongitude

        public double getLongitude()
        Returns longitude in degrees
        Returns:
        double. Default is 0
      • distanceTo

        public double distanceTo​(Coordinate coordinate)
                          throws IllegalArgumentException
        Calculates the distance (in meters) between this coordinate and another
        Parameters:
        coordinate - the other coordinate. Can't be null
        Returns:
        distance in meters. Never a negative value
        Throws:
        IllegalArgumentException - if cartesianCoordinate is null
      • hashCode

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

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(android.os.Parcel dest,
                                  int flags)
        Specified by:
        writeToParcel in interface android.os.Parcelable