]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlan.hxx
toggle fullscreen: also adapt GUI plane when resizing
[flightgear.git] / src / AIModel / AIFlightPlan.hxx
index c32d88345cdf0bba5a7abc04ebbd2ffd77868e0a..94476aa8dc49254747b4ddc9cca5abdd312a0ffb 100644 (file)
 #ifndef _FG_AIFLIGHTPLAN_HXX
 #define _FG_AIFLIGHTPLAN_HXX
 
-#include <simgear/compiler.h>
 #include <vector>
 #include <string>
+
+#include <simgear/compiler.h>
 #include <simgear/math/SGMath.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
+#include <Navaids/positioned.hxx>
+#include <Airports/dynamics.hxx>
 
+// forward decls
 class FGTaxiRoute;
 class FGRunway;
 class FGAIAircraft;
 class FGAirport;
 
+typedef SGSharedPtr<FGAirport> FGAirportRef;
+
 class FGAIWaypoint {
 private:
    std::string name;
@@ -121,7 +128,8 @@ public:
    void setLeadDistance(double distance_ft);
    double getLeadDistance( void ) const {return lead_distance;}
    double getBearing(FGAIWaypoint* previous, FGAIWaypoint* next) const;
-   double getBearing(double lat, double lon, FGAIWaypoint* next) const;
+   double getBearing(const SGGeod& aPos, FGAIWaypoint* next) const;
+  
    double checkTrackLength(std::string wptName);
   time_t getStartTime() const { return start_time; }
    time_t getArrivalTime() const { return arrivalTime; }
@@ -133,8 +141,7 @@ public:
 
   void setLeg(int val) { leg = val;}
   void setTime(time_t st) { start_time = st; }
-  int getGate() const { return gateId; }
-  void setGate(int id) { gateId = id; };
+
 
   double getLeadInAngle() const { return leadInAngle; }
   const std::string& getRunway() const;
@@ -143,9 +150,9 @@ public:
   bool getRepeat(void) const { return repeat; }
   void restart(void);
   int getNrOfWayPoints() { return waypoints.size(); }
-  int getRouteIndex(int i); // returns the AI related index of this current routes. 
-  FGTaxiRoute *getTaxiRoute() { return taxiRoute; }
-  void deleteTaxiRoute();
+
+  int getRouteIndex(int i); // returns the AI related index of this current routes.
+
   std::string getRunway() { return activeRunway; }
   bool isActive(time_t time) {return time >= this->getStartTime();}
 
@@ -166,6 +173,8 @@ public:
   
   void shortenToFirst(unsigned int number, std::string name);
 
+  void setGate(ParkingAssignment pka);
+  FGParking* getParkingGate();
 private:
   FGAIFlightPlan *sid;
   typedef std::vector <FGAIWaypoint*> wpt_vector_type;
@@ -182,14 +191,15 @@ private:
   time_t start_time;
   time_t arrivalTime;       // For AI/ATC purposes.
   int leg;
-  int gateId, lastNodeVisited;
+  ParkingAssignment gate;
+  PositionedID lastNodeVisited;
   std::string activeRunway;
-  FGTaxiRoute *taxiRoute;
   std::string name;
   bool isValid;
-
+  FGAirportRef departure, arrival;
+  
   void createPushBackFallBack(FGAIAircraft *, bool, FGAirport*, double radius, const std::string&, const std::string&, const std::string&);
-  bool createClimb(FGAIAircraft *, bool, FGAirport *, double, double, const std::string&);
+  bool createClimb(FGAIAircraft *, bool, FGAirport *, FGAirport* arrival, double, double, const std::string&);
   bool createCruise(FGAIAircraft *, bool, FGAirport*, FGAirport*, double, double, double, double, const std::string&);
   bool createDescent(FGAIAircraft *, FGAirport *,  double latitude, double longitude, double speed, double alt,const std::string&, double distance);
   bool createLanding(FGAIAircraft *, FGAirport *, const std::string&);
@@ -214,6 +224,28 @@ private:
 
   //void createCruiseFallback(bool, FGAirport*, FGAirport*, double, double, double, double);
  void evaluateRoutePart(double deplat, double deplon, double arrlat, double arrlon);
+  
+  /**
+   * look for and parse an PropertyList flight-plan file - essentially
+   * a flat list waypoint objects, encoded to properties
+   */
+  bool parseProperties(const std::string& filename);
+  
+  void createWaypoints(FGAIAircraft *ac,
+                       double course,
+                       time_t start,
+                       FGAirport *dep,
+                       FGAirport *arr,
+                       bool firstLeg,
+                       double radius,
+                       double alt,
+                       double lat,
+                       double lon,
+                       double speed,
+                       const std::string& fltType,
+                       const std::string& acType,
+                       const std::string& airline);
+  
  public:
   wpt_vector_iterator getFirstWayPoint() { return waypoints.begin(); };
   wpt_vector_iterator getLastWayPoint()  { return waypoints.end(); };