Class CoordinateConverter

java.lang.Object
es.situm.sdk.location.util.CoordinateConverter
All Implemented Interfaces:
android.os.Parcelable

public class CoordinateConverter extends 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 Object>, android.os.Parcelable.Creator<T extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final android.os.Parcelable.Creator<CoordinateConverter>
     

    Fields inherited from interface android.os.Parcelable

    CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    int
     
    Converts an angle from building system coordinate to Earth system coordinate.
    toCartesianAngle(Angle earthAngle)
    Converts an angle from Earth system coordinate to building system coordinate.
    Transform geographical coordinates to cartesian coordinates (within the area defined in the constructor)
    toCoordinate(CartesianCoordinate fromCartesianCoordinate)
    Transform cartesian coordinates (within the area defined in the constructor) into geographical coordinates
    void
    writeToParcel(android.os.Parcel dest, int flags)
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • 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:
      IllegalArgumentException - if some provided parameter is null.
  • Method Details

    • toAngle

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

      @NonNull public Angle toCartesianAngle(Angle earthAngle)
      Converts an angle from Earth system coordinate to building system coordinate. The returned value is between 0 and 360 degrees.
      Parameters:
      earthAngle - 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object