|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mil.af.afit.router.CoreUtilities
Field Summary | |
static int |
AMPM
Specifies the use of AM/PM (12hour) time when converting integer time to a string. |
static int |
MILITARY
Specifies the use of military (24hour) time when converting integer time to a string. |
Constructor Summary | |
CoreUtilities()
|
Method Summary | |
static void |
assignROZTimesToSites(RestrictedOperatingZone roz,
SiteList siteList)
Assigns the time windows and walls contained in the restricted operating zone to the sites contained in the site list. |
static java.lang.String |
doubleLatToString(double lat,
java.lang.String format)
Converts a latitude to a string. |
static java.lang.String |
doubleLonToString(double lon,
java.lang.String format)
Converts a longitude to a string in the form "DDDMMSS E" where "DDD" could be two or three digits and "E" could be "E" or "W" for east or west, respectively. |
static double |
getGreatCircleDistance(double lat1,
double lon1,
double lat2,
double lon2)
Calculates the great circle distance between two latitudes and longitudes (in degrees and fractions of degrees). |
static double |
getGroundSpeed(double airSpeed,
double windSpeed,
double delta)
This calculates the ground speed based on the air speed, wind speed, and difference between their headings, delta. |
static int |
getTimeToTravel(double startLat,
double startLon,
double endLat,
double endLon,
double windBearing,
double windSpeed,
double airSpeed)
Calculates the time it take to travel from a starting point to an ending point taking into consideration wind speed and direction and vehicle speed. |
static double |
getTrueHeading(double startLat,
double startLon,
double endLat,
double endLon,
double distance)
Calculates the true heading on the so-called great circle's spherical triangle. |
static java.lang.String |
intTimeToString(int iTime)
Converts an integer time to a string in military (24hour) format. |
static java.lang.String |
intTimeToString(int iTime,
int type)
Converts an integer time to a string in Kernel.MILITARY (24hour) format or 12hour Kernel.AMPM format. |
static int |
reverseDirection(int originalDirection)
This takes a direction (in degrees, clockwise from North) and returns the opposite direction. |
static double |
stringLatLonToDouble(java.lang.String coord,
java.lang.String format)
Used to convert a string representation of N/S/E/W lat/lons to a double. |
static double |
stringLatToDouble(java.lang.String sLat,
java.lang.String format)
Converts a latitude stored as a string into a double. |
static double |
stringLonToDouble(java.lang.String sLon,
java.lang.String format)
Converts a longitude stored as a string into a double. |
static int |
stringTimeToInt(java.lang.String sTime)
Converts a string time to integer time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MILITARY
intTimeToString(int)
public static final int AMPM
intTimeToString(int)
Constructor Detail |
public CoreUtilities()
Method Detail |
public static final int getTimeToTravel(double startLat, double startLon, double endLat, double endLon, double windBearing, double windSpeed, double airSpeed)
startLat
- starting latitudestartLon
- starting longitudeendLat
- ending latitudeendLon
- ending longitudewindBearing
- bearing of wind, clockwise from NorthwindSpeed
- wind speed in knotsairSpeed
- vehicle speed in knotspublic static final double getGreatCircleDistance(double lat1, double lon1, double lat2, double lon2)
d = 60 * arccos[ sin L1 * sin L2 + cos L1 * cos L2 * cos( l2 - l1 ) ]
where L1 and L2 are latitudes and little L's l1 and l2 are longitudes.
The code was adapted from Kevin O'Rourke's earlier code.
lat1
- first latitudelon1
- first longitudelat2
- second latitudelon2
- second longitudepublic static final double getTrueHeading(double startLat, double startLon, double endLat, double endLon, double distance)
d
sin[L2] -(cos[--] sin[L1])
60
H = arccos[----------------------------]
d
cos[L1] sin[--]
60
The true heading, then, is
| H, sin( l2 - l1 ) < 0
trueHeading = |
| 360 - H, sin( l2 - l1 ) >= 0
startLat
- starting latitudestartLon
- starting longitudeendLat
- ending latitudeendLon
- ending longitudedistance
- distance between the pointspublic static final double getGroundSpeed(double airSpeed, double windSpeed, double delta)
A = WS * cos( 180 - delta )
C = WS * sin( 180 - delta )
_________
/ 2 2
B = \/ AS - C
ground speed = A + B
airSpeed
- vehicle's air speed in knotswindSpeed
- wind speed in knotsdelta
- distance in degrees between the wind and vehicle directionspublic static final java.lang.String intTimeToString(int iTime)
iTime
- integer time to convert to a stringpublic static final java.lang.String intTimeToString(int iTime, int type)
iTime
- integer time to convert to a stringpublic static final int stringTimeToInt(java.lang.String sTime)
intTimeToString
such as "1040h" or "1330h +1 day". It is fairly robust against
alternates involving extra spaces and characters.sTime
- string time to convertpublic static final java.lang.String doubleLatToString(double lat, java.lang.String format)
lat
- latitude to convertpublic static final java.lang.String doubleLonToString(double lon, java.lang.String format)
lat
- longitude to convertpublic static final double stringLatToDouble(java.lang.String sLat, java.lang.String format)
sLat
- latitude as stringpublic static final double stringLonToDouble(java.lang.String sLon, java.lang.String format)
sLat
- longitude as stringpublic static final double stringLatLonToDouble(java.lang.String coord, java.lang.String format)
coord
- string representation of a lat/lonpublic static final void assignROZTimesToSites(RestrictedOperatingZone roz, SiteList siteList)
roz
- restricted operating zone from which to get time windows and wallssiteList
- site list containing sites to modify based on the restricted operating zonepublic static final int reverseDirection(int originalDirection)
originalDirection
- original direction
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |