Class CoordinateConverter

  • All Implemented Interfaces:
    android.os.Parcelable

    public class CoordinateConverter
    extends java.lang.Object
    implements android.os.Parcelable
    Utility class to convert between cartesian coordinates and geographical coordinates.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T extends java.lang.Object>, android.os.Parcelable.Creator<T extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static android.os.Parcelable.Creator<CoordinateConverter> CREATOR  
      • Fields inherited from interface android.os.Parcelable

        CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
    • Constructor Summary

      Constructors 
      Constructor Description
      CoordinateConverter​(Dimensions dimensions, Coordinate center)
      Define how cartesian area is placed in geographical space, aligned with east-west and north-south axis.
      CoordinateConverter​(Dimensions dimensions, Coordinate center, Angle rotation)
      Define how the cartesian area is placed in geographical space, with a rotation with respect to east-west axis.
    • Constructor Detail

      • CoordinateConverter

        public CoordinateConverter​(@NonNull
                                   Dimensions dimensions,
                                   @NonNull
                                   Coordinate center)
        Define how cartesian area is placed in geographical space, aligned with east-west and north-south axis.
        Parameters:
        dimensions - Not null. Dimensions of cartesian area, in meters. E.g. Building.getDimensions()
        center - Not null. Geographical coordinates of middle point of cartesian area. E.g. Building.getCenter()
      • CoordinateConverter

        public CoordinateConverter​(@NonNull
                                   Dimensions dimensions,
                                   @NonNull
                                   Coordinate center,
                                   @NonNull
                                   Angle rotation)
        Define how the cartesian area is placed in geographical space, with a rotation with respect to east-west axis.
        Parameters:
        dimensions - Not null. Dimensions of cartesian area, in meters. E.g. Building.getDimensions()
        center - Not null. Geographical coordinates of middle point of cartesian area. E.g. Building.getCenter()
        rotation - Not null. Rotation angle of the cartesian area, around the center point. E.g. Building.getRotation()
        Throws:
        java.lang.IllegalArgumentException - if some provided parameter is null.
    • Method Detail

      • toAngle

        @NonNull
        public Angle toAngle​(Angle yaw)
        Converts and angle from building system coordinate to Earth system coordinate. The returned value is between 0 and 360 degrees.
        Parameters:
        yaw - the angle to convert
      • toCartesianCoordinate

        @NonNull
        public CartesianCoordinate toCartesianCoordinate​(@NonNull
                                                         Coordinate coordinate)
        Transform geographical coordinates to cartesian coordinates (within the area defined in the constructor)
        Parameters:
        coordinate - Not null.
        Returns:
        Not null.
      • toCoordinate

        @NonNull
        public Coordinate toCoordinate​(@NonNull
                                       CartesianCoordinate fromCartesianCoordinate)
        Transform cartesian coordinates (within the area defined in the constructor) into geographical coordinates
        Parameters:
        fromCartesianCoordinate - Not null.
        Returns:
        Not null.
      • 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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object