Package es.situm.sdk.location.util
Class CoordinateConverter
- java.lang.Object
-
- es.situm.sdk.location.util.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.
-
-
Field Summary
Fields Modifier and Type Field Description static android.os.Parcelable.Creator<CoordinateConverter>
CREATOR
-
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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
describeContents()
boolean
equals(java.lang.Object o)
int
hashCode()
Angle
toAngle(Angle yaw)
Converts and angle from building system coordinate to Earth system coordinate.CartesianCoordinate
toCartesianCoordinate(Coordinate coordinate)
Transform geographical coordinates to cartesian coordinates (within the area defined in the constructor)Coordinate
toCoordinate(CartesianCoordinate fromCartesianCoordinate)
Transform cartesian coordinates (within the area defined in the constructor) into geographical coordinatesvoid
writeToParcel(android.os.Parcel dest, int flags)
-
-
-
Field Detail
-
CREATOR
public static final android.os.Parcelable.Creator<CoordinateConverter> CREATOR
-
-
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 interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags)
- Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-