|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfaa.tg.units.AMeasure
faa.tg.units.Angle
faa.tg.units.TrueBearing
public class TrueBearing
TrueBearing represents the object for measuring the direction of travel
from one position to another, as an angle measured clockwise from true
north.
TrueBearing values are between 0 and 360 degrees inclusive (0 == 360).
Bearing is expressed in units of degrees from North (North = 0.0 deg.).
Furthermore, East = 90 deg., South = 180 deg., and West = 270 degrees.
NOTE: Does not define add(TrueBearing) and sub(TrueBearing) because a
TrueBearing plus a turn Angle will yield another TrueBearing.
It doesn't really make sense to add a bearing to a bearing.
However, this means that when you call add(Angle) or sub(Angle)
you must cast the result back to a TrueBearing.
And it is appropriate for a bearing minus a bearing to return a
turn Angle, but calcTurnAngle(start, end) is provided to correctly
normalize value.
See section 5.6 of the Detailed Design Document for a discussion
of design issues.
See the source: TrueBearing.java
Units.radians,
AUnits,
AMeasure,
TrueHeading,
GroundTrackHeading,
MagneticHeading,
Serialized Form| Field Summary | |
|---|---|
static java.lang.String |
CVS_VERSION_ID
The CVS Version ID |
static TrueBearing |
DEG_180
|
static TrueBearing |
DEG_270
|
static TrueBearing |
DEG_30
|
static TrueBearing |
DEG_360
|
static TrueBearing |
DEG_5
|
static TrueBearing |
DEG_60
|
static TrueBearing |
DEG_90
|
(package private) static long |
serialVersionUID
|
| Fields inherited from class faa.tg.units.Angle |
|---|
D180_DIV_PI, DEG_1, DEG_330, DEG_NEG180, DEG_NEG270, DEG_NEG30, DEG_NEG5, DEG_NEG90, DEG_PER_RAD, NEG_NINETY_DEG, NEG_ONEEIGHTY_DEG, NINETY_DEG, ONEEIGHTY_DEG, PI, PI_DIV_180, PI_DIV_2, PI_DIV_4, PI_MUL_2, PI_MUL_4, RAD_PER_DEG, THIRTY_DEG, THREETHIRTY_DEG, TWOSEVENTY_DEG, ZERO |
| Fields inherited from class faa.tg.units.AMeasure |
|---|
DEC0, DEC0_, DEC00, DEC000, DEC1, DEC1_, DEC12, DEC12_, DEC1L, DEC1L_, DEC2, DEC2_, DEC3, DEC3_, DEC4, DEC4_, DEC5, DEC5_, DEC6, DEC6_, DEC7, DEC7_, DEC9, DEC9_, itsValue, TIME_FRACTION |
| Constructor Summary | |
|---|---|
TrueBearing(Angle angle)
Constructs a TrueBearing with a bearing equivalent to the given angle. |
|
TrueBearing(double theValue,
AngleUnits theUnits)
Constructor for the TrueBearing class. |
|
TrueBearing(java.lang.String dmsStr)
Constructor for TrueBearing that parses a parameter string to determine its value. |
|
| Method Summary | |
|---|---|
static Angle |
calcTurnAngle(TrueBearing start,
TrueBearing end)
This subtraction method returns the turn Angle created by subtracting the start TrueBearing from the end TrueBearing. |
boolean |
eq(TrueBearing theMeasure)
This method provides a test for equality: for TrueBearings, a normalized value of 0 is equal to a normalized value of 360. |
boolean |
ge(TrueBearing theMeasure)
This method provides a test for greater than / equal to. |
java.lang.String |
getFuzzyString()
Returns a string of N, NE, E, SE, S, SW, W, or NW depending on the value. |
boolean |
gt(TrueBearing theMeasure)
This method provides a test for greater than. |
boolean |
le(TrueBearing theMeasure)
This method provides a test for less than / equal to. |
boolean |
lt(TrueBearing theMeasure)
This method provides a test for less than. |
static void |
main(java.lang.String[] args)
|
protected static double |
normalizeRange(double value,
AUnits units)
Normalizes the TrueBearing value to be >= 0 and <= 360. |
double |
ratio(TrueBearing val)
This division method produces a dimensionless ratio of like measures. |
TrueBearing |
reciprocal()
Constructs a value that has a bearing equivalent to the reciprocal of this bearing. |
TrueBearing |
sub(TrueBearing subtrahend)
This subtraction method subtracts a value with like units. |
java.lang.String |
toString()
Returns the String representation of this object in its original form. |
static TrueBearing |
toTrueBearing(org.w3c.dom.Element hdgElem)
Creates a TrueBearing from an XML element containing AttributeNodes for a bearing's units and value; if a type is also specified a type of "T" or "True" will return a TrueHeading for that value, or a type of "G" or "Ground" will return a GroundTrackHeading. |
| Methods inherited from class faa.tg.units.Angle |
|---|
abs, add, aeq, as, average, cos, diff, eq, ge, gt, isBetween, le, lt, parseDmsString, ratio, reciprocalAngle, removeDelimiters, sin, sub, tan, toDmsString, toRadialString, toText |
| Methods inherited from class faa.tg.units.AMeasure |
|---|
absoluteValue, add, as, as, clone, compareTo, debug, div, eq, equals, ge, getAUnit, getCanonicalUnit, getCanonicalValue, getInitialUnit, getUnitClass, gt, hashCode, isBetween, le, lt, mul, ratio, sub, toAMeasure, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
public static final java.lang.String CVS_VERSION_ID
public static final TrueBearing DEG_5
public static final TrueBearing DEG_30
public static final TrueBearing DEG_60
public static final TrueBearing DEG_90
public static final TrueBearing DEG_180
public static final TrueBearing DEG_270
public static final TrueBearing DEG_360
| Constructor Detail |
|---|
public TrueBearing(double theValue,
AngleUnits theUnits)
theValue - the magnitude of TrueBearing as a doubletheUnits - the units of the value that will be stored (ex: rad)public TrueBearing(Angle angle)
angle - The angle that will be used to create the true bearing.
public TrueBearing(java.lang.String dmsStr)
throws java.lang.NumberFormatException
ddd-mm-ss.sss ddd-mm-ss ddd-mm.mmm ddd-mm ddd.ddd dd-mm-ss.sss dd-mm-ss dd-mm.mmm dd-mm dd.ddd ddd:mm:ss.sss ddd:mm:ss ddd:mm.mmm ddd:mm ddd dd:mm:ss.sss dd:mm:ss dd:mm.mmm dd:mm dd dddmmss.sss dddmmss dddmm.mmm dddmm ddmmss.sss ddmmss ddmm.mmm ddmmIn addition, the string may start or end with one of the following hemisphere designation characters:
N S E W + -
Note: the degrees field must have either 2 or 3 digits; minutes and
seconds fields (not including decimal fraction) must be 2 digits.
dmsStr - A String in degrees:minutes:seconds format.
If in [D]DD:MM:SS, the string should start or end with
a N-S, E-W or +/- direction designator.
java.lang.NumberFormatException - If the string could not be parsed.Angle.parseDmsString(String)| Method Detail |
|---|
public static Angle calcTurnAngle(TrueBearing start,
TrueBearing end)
The turn measured from the heading differences must be less than 180 degrees, so that turns that cross the 360 degree direction boundary can be detected (since the direction of turn is not specified).
start - The starting direction.end - The ending direction.
protected static double normalizeRange(double value,
AUnits units)
public static TrueBearing toTrueBearing(org.w3c.dom.Element hdgElem)
throws java.lang.IllegalArgumentException,
org.w3c.dom.DOMException
hdgElem - Bearing Element with attributes for units and value
(and possibly type).
org.w3c.dom.DOMException - XML construction error.
java.lang.IllegalArgumentException - XML did not correctly specify bearing.
java.lang.NullPointerException - TrueBearing element was null.public TrueBearing reciprocal()
public TrueBearing sub(TrueBearing subtrahend)
subtrahend - The unit of measure to subtract from this measure.
public double ratio(TrueBearing val)
public boolean eq(TrueBearing theMeasure)
It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.
public boolean lt(TrueBearing theMeasure)
public boolean gt(TrueBearing theMeasure)
public boolean ge(TrueBearing theMeasure)
public boolean le(TrueBearing theMeasure)
public java.lang.String toString()
toString in class AngleUnitspublic java.lang.String getFuzzyString()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||