]> git.mxchange.org Git - flightgear.git/commitdiff
Airways routing is driven via Nasal now.
authorJames Turner <zakalawe@mac.com>
Wed, 9 May 2012 08:39:33 +0000 (09:39 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 9 May 2012 08:39:33 +0000 (09:39 +0100)
src/Autopilot/route_mgr.cxx
src/Autopilot/route_mgr.hxx

index 7aa3b15fc6ce1c9ac29dcf74022639495487035b..39778e3931ae69bd36d47ab2b6ba77afb473b971 100644 (file)
@@ -51,7 +51,6 @@
 #include "Main/fg_props.hxx"
 #include "Navaids/positioned.hxx"
 #include <Navaids/waypoint.hxx>
-#include <Navaids/airways.hxx>
 #include <Navaids/procedure.hxx>
 #include "Airports/simple.hxx"
 #include "Airports/runways.hxx"
@@ -290,9 +289,6 @@ void FGRouteMgr::init() {
   cruise->getChild("speed-kts", 0, true);
   cruise->setDoubleValue("speed-kts", 160.0);
   
-  _routingType = cruise->getChild("routing", 0, true);
-  _routingType->setIntValue(ROUTE_HIGH_AIRWAYS);
-  
   totalDistance = fgGetNode(RM "total-distance", true);
   totalDistance->setDoubleValue(0.0);
   distanceToGo = fgGetNode(RM "distance-remaining-nm", true);
@@ -592,69 +588,6 @@ void FGRouteMgr::removeLegAtIndex(int aIndex)
   _plan->deleteIndex(aIndex);
 }
   
-/**
- * route between index-1 and index, using airways.
- */
-bool FGRouteMgr::routeToIndex(int index, RouteType aRouteType)
-{
-  WayptRef wp1;
-  WayptRef wp2;
-  
-  if (index == -1) {
-    index = numLegs();
-  }
-  
-  if (index == 0) {
-    if (!_plan->departureAirport()) {
-      SG_LOG(SG_AUTOPILOT, SG_WARN, "routeToIndex: no departure set");
-      return false;
-    }
-    
-    wp1 = new NavaidWaypoint(_plan->departureAirport().get(), NULL);
-  } else {
-    wp1 = wayptAtIndex(index - 1);
-  }
-  
-  if (index >= numLegs()) {
-    if (!_plan->destinationAirport()) {
-      SG_LOG(SG_AUTOPILOT, SG_WARN, "routeToIndex: no destination set");
-      return false;
-    }
-    
-    wp2 = new NavaidWaypoint(_plan->destinationAirport().get(), NULL);
-  } else {
-    wp2 = wayptAtIndex(index);
-  }
-  
-  double distNm = SGGeodesy::distanceNm(wp1->position(), wp2->position());
-  if (distNm < 100.0) {
-    SG_LOG(SG_AUTOPILOT, SG_INFO, "routeToIndex: existing waypoints are nearby, direct route");
-    return true;
-  }
-  
-  WayptVec r;
-  switch (aRouteType) {
-  case ROUTE_HIGH_AIRWAYS:
-    Airway::highLevel()->route(wp1, wp2, r);
-    break;
-    
-  case ROUTE_LOW_AIRWAYS:
-    Airway::lowLevel()->route(wp1, wp2, r);
-    break;
-    
-  case ROUTE_VOR:
-    throw sg_exception("VOR routing not supported yet");
-  }
-  
-  if (r.empty()) {
-    SG_LOG(SG_AUTOPILOT, SG_INFO, "routeToIndex: no route found");
-    return false;
-  }
-
-  _plan->insertWayptsAtIndex(r, index);
-  return true;
-}
-
 void FGRouteMgr::departureChanged()
 {
   _plan->clearWayptsWithFlag(WPT_DEPARTURE);
@@ -849,11 +782,6 @@ void FGRouteMgr::InputListener::valueChanged(SGPropertyNode *prop)
             r++;
         if (*r)
             mgr->flightPlan()->insertWayptAtIndex(mgr->waypointFromString(r), pos);
-    } else if (!strncmp(s, "@ROUTE", 6)) {
-      char* r;
-      int endIndex = strtol(s + 6, &r, 10);
-      RouteType rt = (RouteType) mgr->_routingType->getIntValue();
-      mgr->routeToIndex(endIndex, rt);
     } else if (!strcmp(s, "@POSINIT")) {
       mgr->initAtPosition();
     } else
index bb885c7df30b96de86276cb50c02a8e580a5624f..f3c939f0ecd23bcbe1ab3a99b130c7957d3fb398 100644 (file)
@@ -57,20 +57,6 @@ public:
   void unbind ();
   void update (double dt);
   
-  typedef enum {
-    ROUTE_HIGH_AIRWAYS, ///< high-level airways routing
-    ROUTE_LOW_AIRWAYS, ///< low-level airways routing
-    ROUTE_VOR ///< VOR-VOR routing
-  } RouteType;
-  
-  /**
-   * Insert waypoints from index-1 to index. In practice this means you can
-   * 'fill in the gaps' between defined waypoints. If index=0, the departure
-   * airport is used as index-1; if index is -1, the destination airport is
-   * used as the final waypoint.
-   */
-  bool routeToIndex(int index, RouteType aRouteType);
-        
   bool isRouteActive() const;
          
   int currentIndex() const;
@@ -156,8 +142,6 @@ private:
     SGPropertyNode_ptr _pathNode;
     SGPropertyNode_ptr _currentWpt;
     
-    /// integer property corresponding to the RouteType enum
-    SGPropertyNode_ptr _routingType;
     
     /** 
      * Signal property to notify people that the route was edited