]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runwaybase.cxx
Document that property write-protection is not a security measure
[flightgear.git] / src / Airports / runwaybase.cxx
index 01855347c620c407ed5695a9f639a0621d54eda0..d5176c88b370db4ae83d9552519dd45b536c231a 100644 (file)
@@ -1,6 +1,6 @@
 // runwaybase.cxx -- a base class for runways and taxiways
 //
-// Written by James Turber, started December 2008.
+// Written by James Turner, started December 2008.
 //
 // Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
@@ -26,6 +26,7 @@
 #endif
 
 #include <simgear/compiler.h>
+#include <simgear/props/props.hxx>
 
 #include "runwaybase.hxx"
 
@@ -44,49 +45,53 @@ using std::string;
  * 9 - dirt helipad
  * 12 -  lakebed
  */
+const char * FGRunwayBase::surfaceName( int surface_code )
+{
+  switch( surface_code ) {
+    case 1: return "asphalt";
+    case 2: return "concrete";
+    case 3: return "turf";
+    case 4: return "dirt";
+    case 5: return "gravel";
+    case 6: return "asphalt helipad";
+    case 7: return "concrete helipad";
+    case 8: return "turf helipad";
+    case 9: return "dirt helipad";
+    case 12: return "lakebed";
+    default: return "unknown";
+  }
+}
 
-FGRunwayBase::FGRunwayBase(Type aTy, const string& aIdent,
+FGRunwayBase::FGRunwayBase(PositionedID aGuid, Type aTy, const string& aIdent,
                         const SGGeod& aGeod,
                         const double heading, const double length,
                         const double width,
-                        const int surface_code,
-                        bool index) :
-  FGPositioned(aTy, aIdent, aGeod)
+                        const int surface_code) :
+  FGPositioned(aGuid, aTy, aIdent, aGeod)
 {
   _heading = heading;
   _length = length;
   _width = width;
   _surface_code = surface_code;
-  
-  init(index);
 }
 
 SGGeod FGRunwayBase::pointOnCenterline(double aOffset) const
 {
-  SGGeod result;
-  double dummyAz2;
-  double halfLengthMetres = lengthM() * 0.5;
-  
-  SGGeodesy::direct(mPosition, _heading, 
-    aOffset - halfLengthMetres,
-    result, dummyAz2);
+  SGGeod result = SGGeodesy::direct(geod(), _heading, aOffset);
+  result.setElevationM(geod().getElevationM());
+    
   return result;
 }
 
-
-
 SGGeod FGRunwayBase::pointOffCenterline(double aOffset, double lateralOffset) const
 {
   SGGeod result;
   SGGeod temp;
   double dummyAz2;
-  double halfLengthMetres = lengthM() * 0.5;
 
-  SGGeodesy::direct(mPosition, _heading, 
-    aOffset - halfLengthMetres,
-    temp, dummyAz2);
+  SGGeodesy::direct(geod(), _heading, aOffset, temp, dummyAz2);
 
-  SGGeodesy::direct(temp, (_heading+90.0), 
+  SGGeodesy::direct(temp, SGMiscd::normalizePeriodic(0, 360,_heading+90.0),
     lateralOffset,
     result, dummyAz2);
 
@@ -99,11 +104,12 @@ bool FGRunwayBase::isHardSurface() const
   return ((_surface_code == 1) || (_surface_code == 2));
 }
 
-FGTaxiway::FGTaxiway(const string& aIdent,
+FGTaxiway::FGTaxiway(PositionedID aGuid,
+                     const string& aIdent,
                         const SGGeod& aGeod,
                         const double heading, const double length,
                         const double width,
                         const int surface_code) :
-  FGRunwayBase(TAXIWAY, aIdent, aGeod, heading, length, width, surface_code, false)
+  FGRunwayBase(aGuid, TAXIWAY, aIdent, aGeod, heading, length, width, surface_code)
 {
 }