Package es.situm.sdk.location.util
Class CoordinateConverter
java.lang.Object
es.situm.sdk.location.util.CoordinateConverter
- All Implemented Interfaces:
android.os.Parcelable
Utility class to convert between cartesian coordinates and geographical coordinates.
-
Nested Class Summary
-
Field Summary
FieldsFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionCoordinateConverter(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
Modifier and TypeMethodDescriptionintbooleaninthashCode()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.toCartesianCoordinate(Coordinate 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 coordinatesvoidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
CREATOR
-
-
Constructor Details
-
CoordinateConverter
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
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
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
Transform geographical coordinates to cartesian coordinates (within the area defined in the constructor)- Parameters:
coordinate- Not null.- Returns:
- Not null.
-
toCoordinate
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
-
hashCode
public int hashCode()
-