public static CalculateNewPosition ( LatLongClass PresentPosition, double Distance, double Azimuth ) : LatLongClass | ||
PresentPosition | LatLongClass | |
Distance | double | |
Azimuth | double | |
return | LatLongClass |
public static LatLongClass CalculateNewPosition(LatLongClass PresentPosition, double Distance, double Azimuth)
{
LatLongClass NewPosition = new LatLongClass();
// instantiate the calculator
GeodeticCalculator geoCalc = new GeodeticCalculator();
// select a reference elllipsoid
Ellipsoid reference = Ellipsoid.WGS84;
// set Lincoln Memorial coordinates
GlobalCoordinates Present_Pos;
Present_Pos = new GlobalCoordinates(new Angle(PresentPosition.GetLatLongDecimal().LatitudeDecimal), new Angle(PresentPosition.GetLatLongDecimal().LongitudeDecimal));
// now, plug the result into to direct solution
GlobalCoordinates dest;
Angle endBearing = new Angle();
double Distance_In_Meeters = (Distance * NMtoKM * 1000.0);
dest = geoCalc.CalculateEndingGlobalCoordinates(reference, Present_Pos, Azimuth, Distance_In_Meeters, out endBearing);
NewPosition.SetPosition(new LatLongDecimal(dest.Latitude.Degrees, dest.Longitude.Degrees));
return NewPosition;
}
private static void DecodeAzimuthAndDistance(ref GeoCordSystemDegMinSecUtilities.LatLongClass NewPosition, double Distance, double Azimuth) { GeoCordSystemDegMinSecUtilities.LatLongClass ResultPosition = new GeoCordSystemDegMinSecUtilities.LatLongClass(); ////////////////////////////////////////////////////////////////////////////////// // // Here loop through the defined radars and determine the source of the data. // Once the source is determined calculate the extact position of the target // by taking the position of the radar and applying the range and bearing. // Display time of reception // Extract the cu // rrent SIC/SAC so the correct radar can be applied // ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)CAT01.I001DataItems[CAT01.ItemIDToIndex("010")].value; foreach (SystemAdaptationDataSet.Radar RDS in SystemAdaptationDataSet.RadarDataSet) { // If the current SIC/SAC code matched the code of one of the defined radars // then go ahead and calculate the Lat/Long position. if (RDS.SIC == SIC_SAC_TIME.SIC.ToString() && RDS.SAC == SIC_SAC_TIME.SAC.ToString()) { ResultPosition = GeoCordSystemDegMinSecUtilities.CalculateNewPosition(RDS.RadarPosition, Distance, Azimuth); } } NewPosition.SetPosition(ResultPosition.GetLatLongDecimal()); }