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.ParcelableUtility 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 intdescribeContents()booleanequals(java.lang.Object o)inthashCode()AngletoAngle(Angle yaw)Converts an angle from building system coordinate to Earth system coordinate.AngletoCartesianAngle(Angle earthAngle)Converts an angle from Earth system coordinate to building system coordinate.CartesianCoordinatetoCartesianCoordinate(Coordinate coordinate)Transform geographical coordinates to cartesian coordinates (within the area defined in the constructor)CoordinatetoCoordinate(CartesianCoordinate fromCartesianCoordinate)Transform cartesian coordinates (within the area defined in the constructor) into geographical coordinatesvoidwriteToParcel(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 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:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags)- Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-