public final class MilitaryGridReferenceSystem extends Object implements IEquatable<MilitaryGridReferenceSystem>, IEquatableEpsilon<MilitaryGridReferenceSystem>, ImmutableValueType
Constructor and Description |
---|
MilitaryGridReferenceSystem(String grid,
String square,
double easting,
double northing)
Initializes a set of Military Grid Reference System (MGRS)
coordinates from the provided values.
|
MilitaryGridReferenceSystem(UniversalPolarStereographic coordinates)
Initializes a set of Military Grid Reference System (MGRS)
coordinates from the provided
Universal Polar Stereographic (UPS) coordinates. |
MilitaryGridReferenceSystem(UniversalTransverseMercator coordinates,
Ellipsoid ellipsoid)
Initializes a set of Military Grid Reference System (MGRS)
coordinates from the provided
Universal Transverse Mercator (UTM) coordinates and ellipsoid. |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(MilitaryGridReferenceSystem left,
MilitaryGridReferenceSystem 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(MilitaryGridReferenceSystem 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(MilitaryGridReferenceSystem other)
Indicates whether another instance of this type is exactly equal to this instance.
|
double |
getEasting()
Gets the eastward distance of the location into the square.
|
String |
getGrid()
Gets the 1 or 3 character grid zone designator.
|
double |
getNorthing()
Gets the northward distance of the location into the grid.
|
String |
getSquare()
Gets the 2 character 100,000 meter square designator.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
static boolean |
notEquals(MilitaryGridReferenceSystem left,
MilitaryGridReferenceSystem right)
Returns
true if the two instances are not exactly equal. |
String |
toString()
Returns the string representation of the value of this instance.
|
boolean |
tryConvertToUniversalPolarStereographic(UniversalPolarStereographic[] ups)
Attempts to convert this instance to a set of
UniversalPolarStereographic coordinates. |
boolean |
tryConvertToUniversalTransverseMercator(Ellipsoid ellipsoid,
UniversalTransverseMercator[] utm)
Attempts to convert this instance to a set of
UniversalTransverseMercator coordinates. |
public MilitaryGridReferenceSystem(@Nonnull String grid, @Nonnull String square, double easting, double northing)
grid
- The 1 or 3 character grid zone designator.square
- The 2 character 100,000 meter square designator.easting
- The eastward distance of the location into the square.northing
- The northward distance of the location into the square.ArgumentNullException
- Thrown when grid
or square
is null
.public MilitaryGridReferenceSystem(@Nonnull UniversalPolarStereographic coordinates)
Universal Polar Stereographic (UPS)
coordinates.coordinates
- The UPS coordinates.public MilitaryGridReferenceSystem(@Nonnull UniversalTransverseMercator coordinates, @Nonnull Ellipsoid ellipsoid)
Universal Transverse Mercator (UTM)
coordinates and ellipsoid.coordinates
- The UTM coordinates.ellipsoid
- The reference ellipsoid.ArgumentNullException
- Thrown when ellipsoid
is null
.public final boolean tryConvertToUniversalPolarStereographic(@Nonnull UniversalPolarStereographic[] ups)
UniversalPolarStereographic
coordinates.ups
- The converted coordinates.true
if this instance could be converted to the desired coordinate type; otherwise false
.public final boolean tryConvertToUniversalTransverseMercator(@Nonnull Ellipsoid ellipsoid, @Nonnull UniversalTransverseMercator[] utm)
UniversalTransverseMercator
coordinates.ellipsoid
- The reference ellipsoid.utm
- The converted coordinates.true
if this instance could be converted to the desired coordinate type; otherwise false
.ArgumentNullException
- Thrown when ellipsoid
is null
.@Nonnull public final String getSquare()
public final double getEasting()
public final double getNorthing()
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 MilitaryGridReferenceSystem other)
equalsType
in interface IEquatable<MilitaryGridReferenceSystem>
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 MilitaryGridReferenceSystem other, double epsilon)
equalsEpsilon
in interface IEquatableEpsilon<MilitaryGridReferenceSystem>
other
- The set of MilitaryGridReferenceSystem
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 int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
public static boolean equals(@Nonnull MilitaryGridReferenceSystem left, @Nonnull MilitaryGridReferenceSystem 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 MilitaryGridReferenceSystem left, @Nonnull MilitaryGridReferenceSystem 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
.