Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jflight.model
Class BaseWpt  view BaseWpt download BaseWpt.java

java.lang.Object
  extended byjflight.model.BaseWpt
Direct Known Subclasses:
Thermal, Trk, Wpt

public class BaseWpt
extends java.lang.Object

Pure waypoint-definition, just the coordinates


Field Summary
 double dlat
          latitude in degrees
 double dlon
          longitude in degrees
 int height
           
static java.text.DecimalFormat latiFormat
           
static java.text.DecimalFormat longiFormat
           
 double rlat
          coordinate in radians
 double rlon
          coordinate in radians
 
Constructor Summary
BaseWpt()
          Constructor BaseWpt Sets coordinate to zero.
BaseWpt(double lat, double lon)
          Constructor BaseWpt Sets coordinate to specified value.
BaseWpt(double lat, double lon, int height)
          Constructor BaseWpt Sets coordinate and height to specified value.
 
Method Summary
private  double degreeAsDDMMmmm(double value)
           
 double dist(BaseWpt wpt)
          Method dist
Calculates the distance between two waypoints
 boolean equalsCrdNearly(java.lang.Object anObject)
          test coordinates only
 double getDlat()
          Getter for property dlat.
 double getDlon()
          Getter for property dlon.
 int getHeight()
          Getter for property height.
 double getLatAsDDMMmmm()
          Method getLatAsDDMMmmm
 int[] getLatSeparatedToDDMMmmm()
          Method getLatAsDDMMmmm
 double getLonAsDDMMmmm()
          Method getLatAsDDMMmmm
 int[] getLonSeparatedToDDMMmmm()
          Method getLatAsDDMMmmm
 double getRlat()
          Getter for property rlat.
 double getRlon()
          Getter for property rlon.
static double mod(double d1, double d2)
          modulo function; for d2 > 0
 BaseWpt poc(double dist, double tc)
          Method poc ("point on course")
Calculates a waypoint on the course
A point {lat,lon} is a distance d out on the tc radial from point 1 if:
lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
IF (cos(lat)=0)
lon=lon1 // endpoint a pole
ELSE
lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
wrong? -> lon=mod(lon1+asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
ENDIF
This algorithm is limited to distances such that dlon
 void setDlat(double dlat)
          Setter for property dlat.
 void setDlon(double dlon)
          Setter for property dlon.
 void setHeight(int height)
          Setter for property height.
 void setRlat(double rlat)
          Setter for property rlat.
 void setRlon(double rlon)
          Setter for property rlon.
 double tc(BaseWpt wpt)
          Method tc
Course between points: We obtain the initial course, tc1, (at point 1) from point 1 to point 2 by the following.
 java.lang.String toString()
          Method toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dlat

public double dlat
latitude in degrees


dlon

public double dlon
longitude in degrees


rlat

public double rlat
coordinate in radians


rlon

public double rlon
coordinate in radians


height

public int height

longiFormat

public static java.text.DecimalFormat longiFormat

latiFormat

public static java.text.DecimalFormat latiFormat
Constructor Detail

BaseWpt

public BaseWpt()
Constructor BaseWpt Sets coordinate to zero.


BaseWpt

public BaseWpt(double lat,
               double lon)
Constructor BaseWpt Sets coordinate to specified value.


BaseWpt

public BaseWpt(double lat,
               double lon,
               int height)
Constructor BaseWpt Sets coordinate and height to specified value.

Method Detail

toString

public java.lang.String toString()
Method toString


dist

public double dist(BaseWpt wpt)
Method dist
Calculates the distance between two waypoints


tc

public double tc(BaseWpt wpt)
Method tc
Course between points: We obtain the initial course, tc1, (at point 1) from point 1 to point 2 by the following.
For starting points other than the poles:
IF sin(lon2-lon1)<0
tc1= acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
ELSE
tc1=2*pi-acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
ENDIF
Def.: wpt1 = "from wpt", wpt2 = "to wpt"
Could be more accurate !!!


mod

public static double mod(double d1,
                         double d2)
modulo function; for d2 > 0


poc

public BaseWpt poc(double dist,
                   double tc)
Method poc ("point on course")
Calculates a waypoint on the course
A point {lat,lon} is a distance d out on the tc radial from point 1 if:
lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
IF (cos(lat)=0)
lon=lon1 // endpoint a pole
ELSE
lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
wrong? -> lon=mod(lon1+asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
ENDIF
This algorithm is limited to distances such that dlon


equalsCrdNearly

public boolean equalsCrdNearly(java.lang.Object anObject)
test coordinates only


getLatAsDDMMmmm

public double getLatAsDDMMmmm()
Method getLatAsDDMMmmm


getLonAsDDMMmmm

public double getLonAsDDMMmmm()
Method getLatAsDDMMmmm


getLatSeparatedToDDMMmmm

public int[] getLatSeparatedToDDMMmmm()
Method getLatAsDDMMmmm


getLonSeparatedToDDMMmmm

public int[] getLonSeparatedToDDMMmmm()
Method getLatAsDDMMmmm


degreeAsDDMMmmm

private double degreeAsDDMMmmm(double value)

getDlat

public double getDlat()
Getter for property dlat.


setDlat

public void setDlat(double dlat)
Setter for property dlat.


getDlon

public double getDlon()
Getter for property dlon.


setDlon

public void setDlon(double dlon)
Setter for property dlon.


getRlat

public double getRlat()
Getter for property rlat.


setRlat

public void setRlat(double rlat)
Setter for property rlat.


getRlon

public double getRlon()
Getter for property rlon.


setRlon

public void setRlon(double rlon)
Setter for property rlon.


getHeight

public int getHeight()
Getter for property height.


setHeight

public void setHeight(int height)
Setter for property height.