]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATCutils.hxx
The most important part is that it fixes possible
[flightgear.git] / src / ATC / ATCutils.hxx
index 6576bf1aca358c3bfb9ef24df980211cead572d1..2acfc9d186fff567522dbf19fe7dc9c16ece1ddd 100644 (file)
@@ -18,6 +18,9 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+#include <Airports/simple.hxx>
+#include <Airports/runways.hxx>
+
 #include <math.h>
 #include <simgear/math/point3d.hxx>
 #include <string>
@@ -34,12 +37,33 @@ SG_USING_STD(string);
 *
 ********************************/
 
+// Convert any number to spoken digits
+string ConvertNumToSpokenDigits(const string &n);
+
+// Convert an integer to spoken digits
+string ConvertNumToSpokenDigits(int n);
+
 // Convert a 2 digit rwy number to a spoken-style string
-string convertNumToSpokenString(int n);
+string ConvertRwyNumToSpokenString(int n);
+
+// Convert rwy number string to a spoken-style string
+// eg "05L" to "zero five left"
+// Assumes we get a two-digit string optionally appended with R, L, or C
+// eg 01 07L 29R 36
+// Anything else is not guaranteed to be handled correctly!
+string ConvertRwyNumToSpokenString(const string &s);
 
 // Return the phonetic letter of a letter represented as an integer 1->26
 string GetPhoneticIdent(int i);
 
+// Return the phonetic letter of a character in the range a-z or A-Z.
+// Currently always returns prefixed by lowercase.
+string GetPhoneticIdent(char c);
+
+// Get the compass direction associated with a heading in degrees
+// Currently returns 8 direction resolution (N, NE, E etc...)
+// Might be modified in future to return 4, 8 or 16 resolution but defaulting to 8. 
+string GetCompassDirection(double h);
 
 /*******************************
 *
@@ -47,8 +71,8 @@ string GetPhoneticIdent(int i);
 *
 ********************************/
 
-// Given two positions, get the HORIZONTAL separation
-double dclGetHorizontalSeparation(Point3D pos1, Point3D pos2);
+// Given two positions (lat & lon in degrees), get the HORIZONTAL separation (in meters)
+double dclGetHorizontalSeparation(const Point3D& pos1, const Point3D& pos2);
 
 // Given a point and a line, get the HORIZONTAL shortest distance from the point to a point on the line.
 // Expects to be fed orthogonal co-ordinates, NOT lat & lon !
@@ -56,4 +80,43 @@ double dclGetLinePointSeparation(double px, double py, double x1, double y1, dou
 
 // Given a position (lat/lon/elev), heading, vertical angle, and distance, calculate the new position.
 // Assumes that the ground is not hit!!!  Expects heading and angle in degrees, distance in meters.
-Point3D dclUpdatePosition(Point3D pos, double heading, double angle, double distance);
+Point3D dclUpdatePosition(const Point3D& pos, double heading, double angle, double distance);
+
+// Get a heading from one lat/lon to another (in degrees)
+double GetHeadingFromTo(const Point3D& A, const Point3D& B);
+
+// Given a heading (in degrees), bound it from 0 -> 360
+void dclBoundHeading(double &hdg);
+
+// smallest difference between two angles in degrees
+// difference is negative if a1 > a2 and positive if a2 > a1
+double GetAngleDiff_deg( const double &a1, const double &a2);
+
+
+/*******************************
+*
+*      Airport-related functions
+*
+********************************/
+
+// The next two functions are straight copies of their fg.... equivalents
+// in fg_init.cxx, and are just here temporarily until some rationalisation occurs.
+
+// find basic airport location info from airport database
+bool dclFindAirportID( const string& id, FGAirport *a );
+
+// get airport elevation IN METERS
+double dclGetAirportElev( const string& id );
+
+// get airport position (elev portion in FEET)
+Point3D dclGetAirportPos( const string& id );
+
+/****************
+*
+*   Runways
+*
+****************/
+
+// Given a Point3D (lon/lat/elev) and an FGRunway struct, determine if the point lies on the runway
+bool OnRunway(const Point3D& pt, const FGRunway& rwy);
+