public class CoordinateDD extends Object implements ICoordinate
ICoordinate.UNITS
Modifier and Type | Field and Description |
---|---|
double |
eastWest
Decimal degrees east (or west iff negative).
|
double |
northSouth
Decimal degrees north (or south iff negative).
|
Constructor and Description |
---|
CoordinateDD(double northSouth,
double eastWest)
Constructor for a coordinate using decimal degrees.
|
CoordinateDD(double northSouth,
double eastWest,
boolean adjustToMinMax)
Constructor for a coordinate using decimal degrees.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(ICoordinate o,
ICoordinate.UNITS units)
Computes the distance to the specified coordinate and returns that
distance in the specified units.
|
boolean |
equals(CoordinateDD o)
True iff the two coordinates are exactly the same.
|
boolean |
equals(ICoordinate o)
Return true if two coordinates are exactly the same.
|
static CoordinateDD |
parse(String text)
Parses coordinates expressed in decimal degrees.
|
CoordinateDD |
toDD()
Convert to decimal degrees.
|
CoordinateDDM |
toDDM()
Convert to degrees and decimal minutes.
|
CoordinateDMS |
toDMS()
Convert to degrees, minutes and (tenths of) seconds.
|
String |
toString()
Returns the coordinate in decimal degrees as
|
public final double northSouth
public final double eastWest
public CoordinateDD(double northSouth, double eastWest)
northSouth
- Decimal degrees north (or south iff negative). The range is
[-90:+90].eastWest
- Decimal degrees east (or west iff negative). The range is
(-180:+180]. Note that a value of 180W is normalized to 180E
by this constructor.IllegalArgumentException
- if northSouth is out of the range [-90:+90].IllegalArgumentException
- if eastWest is out of the range [-180:+180].public CoordinateDD(double northSouth, double eastWest, boolean adjustToMinMax)
northSouth
- Decimal degrees north (or south iff negative). The range is
[-90:+90].eastWest
- Decimal degrees east (or west iff negative). The range is
(-180:+180].adjustToMinMax
- If this parameter is set to true we may pass in values that are out of
range. Such values are adjusted to the respective MIN and MAX
values. If set to false, exceptions are thrown.IllegalArgumentException
- if adjustToMinMax is false AND northSouth is out of the range [-90:+90].IllegalArgumentException
- if adjustToMinMax is false AND if eastWest is out of the range [-180:+180].public String toString()
+32.30642, -122.61458
public static CoordinateDD parse(String text) throws ParseException
36.07263, -79.79197 36.07263/-79.79197 36.07263 -79.79197 +36.0726355 -79.7919754
text
- The text.ParseException
public boolean equals(ICoordinate o)
ICoordinate
Note: Coordinates MUST be expressed in the same system before they may be compared. E.g., Degrees, Minutes and Seconds or Degrees and Decimal Minutes or Decimal Degrees.
equals
in interface ICoordinate
o
- Another coordinate.public boolean equals(CoordinateDD o)
o
- public CoordinateDMS toDMS()
toDMS
in interface ICoordinate
public double distance(ICoordinate o, ICoordinate.UNITS units)
ICoordinate
distance
in interface ICoordinate
o
- Another coordinate.units
- The units in which the distance will be reported.public CoordinateDDM toDDM()
ICoordinate
toDDM
in interface ICoordinate
public CoordinateDD toDD()
ICoordinate
toDD
in interface ICoordinate
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.