public final class Cartographic extends Object implements IEquatable<Cartographic>, IEquatableEpsilon<Cartographic>, ImmutableValueType
Constructor and Description |
---|
Cartographic()
Initializes a new instance.
|
Cartographic(double[] elements)
Initializes a set of
Cartographic coordinates from the first 3 consecutive elements in the provided array. |
Cartographic(double[] elements,
int startIndex)
Initializes a set of
Cartographic coordinates from the provided array. |
Cartographic(double longitude,
double latitude,
double height)
Initializes a set of
Cartographic coordinates from the provided values. |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Cartographic left,
Cartographic right)
Returns
true if the two instances are exactly equal. |
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
boolean |
equalsEpsilon(Cartographic other,
double epsilon)
Indicates whether each coordinate value of another instance of this type
is within the required tolerance of the corresponding coordinate value of this instance.
|
boolean |
equalsType(Cartographic other)
Indicates whether another instance of this type is exactly equal to this instance.
|
double |
get(int index)
|
double |
getHeight()
Gets the linear coordinate measured perpendicular to the surface of the ellipsoid and positive above the surface.
|
boolean |
getIsUndefined()
Gets a value indicating whether or not any of the coordinates for this instance have the value
Double.NaN . |
double |
getLatitude()
Gets the angular coordinate measured perpendicular to the equatorial plane.
|
int |
getLength()
Gets the number of elements in this set of coordinates.
|
double |
getLongitude()
Gets the angular coordinate lying in the equatorial plane of the ellipsoid and measured from the prime meridian.
|
static Cartographic |
getUndefined()
Gets a set of
Cartographic coordinates with values of Double.NaN . |
static Cartographic |
getZero()
Gets a set of
Cartographic coordinates representing the zero vector. |
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
boolean |
isAtPole()
|
boolean |
isAtPole(double epsilon)
Indicates whether the absolute value of the
Latitude (get ) equals Constants.HalfPi within the provided tolerance. |
boolean |
isEquivalent(Cartographic other)
Indicates whether another instance of this type is mathematically equivalent to this instance.
|
boolean |
isEquivalent(Cartographic other,
double epsilon)
Indicates whether another instance of this type is mathematically equivalent to this instance, within the required tolerance.
|
static boolean |
notEquals(Cartographic left,
Cartographic right)
Returns
true if the two instances are not exactly equal. |
String |
toString()
Returns the string representation of the value of this instance.
|
public Cartographic()
public Cartographic(double longitude, double latitude, double height)
Cartographic
coordinates from the provided values.longitude
- The angular coordinate lying in the equatorial plane of the ellipsoid and measured from the prime meridian.latitude
- The angular coordinate measured perpendicular to the equatorial plane.height
- The linear coordinate measured perpendicular to the surface of the ellipsoid and positive above the surface.public Cartographic(@Nonnull double[] elements)
Cartographic
coordinates from the first 3 consecutive elements in the provided array.elements
- The array of coordinate values.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- An object of this type must be constructed from an array with at least 3 elements
.public Cartographic(@Nonnull double[] elements, int startIndex)
Cartographic
coordinates from the provided array.elements
- The array of coordinate values.startIndex
- The index of the first element in the array to use.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- Thrown when an object of this type is constructed from an array with less than 3 elements
.@Nonnull public static Cartographic getZero()
Cartographic
coordinates representing the zero vector.@Nonnull public static Cartographic getUndefined()
Cartographic
coordinates with values of Double.NaN
.
Use IsUndefined
(get
) to test whether a Cartographic
instance
is undefined since it will return true
if any of the coordinate values
are Double.NaN
.
public final double getLongitude()
public final double getLatitude()
public final double getHeight()
public final int getLength()
public final boolean getIsUndefined()
Double.NaN
.public final boolean isAtPole()
true
if this point is at the pole; otherwise false
.public final boolean isAtPole(double epsilon)
Latitude
(get
) equals Constants.HalfPi
within the provided tolerance.epsilon
- The tolerance for the comparison.true
if this point is at the pole, within tolerance; otherwise false
.public final double get(int index)
index
of 0, 1, and 2 corresponding to the coordinates
Longitude
(get
), Latitude
(get
), and Height
(get
).index
- The index to retrieve.index
.ArgumentOutOfRangeException
- Thrown when index
is less than 0 or greater than or equal to Length
(get
).public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public final boolean equalsType(@Nonnull Cartographic other)
This method performs a strict comparison of each coordinate value.
Consider using Cartographic.isEquivalent(agi.foundation.coordinates.Cartographic)
to account for longitude ambiguity for points at the poles.
equalsType
in interface IEquatable<Cartographic>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public final boolean equalsEpsilon(@Nonnull Cartographic other, double epsilon)
This method performs a strict comparison of each coordinate value relative to the specified tolerance.
Consider using Cartographic.isEquivalent(agi.foundation.coordinates.Cartographic,double)
to account for longitude ambiguity for points near the poles.
equalsEpsilon
in interface IEquatableEpsilon<Cartographic>
other
- The set of Cartographic
coordinates to compare to this instance.epsilon
- The limit at which the absolute differences between the coordinate values will not be considered equal.true
if the absolute differences are less than or equal to epsilon
; otherwise false
.public final boolean isEquivalent(@Nonnull Cartographic other)
other
- The set of Cartographic
coordinates to compare to this instance.true
if they are equivalent; otherwise false
.public final boolean isEquivalent(@Nonnull Cartographic other, double epsilon)
other
- The set of Cartographic
coordinates to compare to this instance.epsilon
- The limit at which the absolute differences between the coordinate values will not be considered equal.true
if they are equivalent; otherwise false
.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
public static boolean equals(@Nonnull Cartographic left, @Nonnull Cartographic right)
true
if the two instances are exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
represents the same value as right
; otherwise false
.public static boolean notEquals(@Nonnull Cartographic left, @Nonnull Cartographic right)
true
if the two instances are not exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
does not represent the same value as right
; otherwise false
.