]> git.mxchange.org Git - flightgear.git/blobdiff - src/Autopilot/route_mgr.hxx
header cleanups
[flightgear.git] / src / Autopilot / route_mgr.hxx
index 2ab4df22be1ad27631e65fc329027e1fd3862791..67a27d7c8b9636c811b3f593fde6c08152f1ef58 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 
 #include <simgear/compiler.h>
 
-#include STL_STRING
+#include <string>
 #include <vector>
 
-SG_USING_STD(string);
-SG_USING_STD(vector);
+using std::string;
+using std::vector;
 
 #include <simgear/props/props.hxx>
 #include <simgear/route/route.hxx>
@@ -58,51 +58,70 @@ private:
     SGRoute *route;
 
     // automatic inputs
-    SGPropertyNode *lon;
-    SGPropertyNode *lat;
-    SGPropertyNode *alt;
+    SGPropertyNode_ptr lon;
+    SGPropertyNode_ptr lat;
+    SGPropertyNode_ptr alt;
 
     // automatic outputs
-    SGPropertyNode *true_hdg_deg;
+    SGPropertyNode_ptr true_hdg_deg;
+    SGPropertyNode_ptr target_altitude_ft;
+    SGPropertyNode_ptr altitude_lock;
 
-    SGPropertyNode *wp0_id;
-    SGPropertyNode *wp0_dist;
-    SGPropertyNode *wp0_eta;
+    SGPropertyNode_ptr wp0_id;
+    SGPropertyNode_ptr wp0_dist;
+    SGPropertyNode_ptr wp0_eta;
 
-    SGPropertyNode *wp1_id;
-    SGPropertyNode *wp1_dist;
-    SGPropertyNode *wp1_eta;
+    SGPropertyNode_ptr wp1_id;
+    SGPropertyNode_ptr wp1_dist;
+    SGPropertyNode_ptr wp1_eta;
 
-    SGPropertyNode *wpn_id;
-    SGPropertyNode *wpn_dist;
-    SGPropertyNode *wpn_eta;
+    SGPropertyNode_ptr wpn_id;
+    SGPropertyNode_ptr wpn_dist;
+    SGPropertyNode_ptr wpn_eta;
 
 
+    class Listener : public SGPropertyChangeListener {
+    public:
+        Listener(FGRouteMgr *m) : mgr(m) {}
+        virtual void valueChanged (SGPropertyNode * prop);
+    private:
+        FGRouteMgr *mgr;
+    };
+
+    SGPropertyNode_ptr input;
+    Listener *listener;
+    SGPropertyNode_ptr mirror;
+    bool altitude_set;
+
+    int make_waypoint( SGWayPoint **wp, const string& target );
+    void update_mirror();
+    bool near_ground();
+
 public:
 
     FGRouteMgr();
     ~FGRouteMgr();
 
     void init ();
+    void postinit ();
     void bind ();
     void unbind ();
     void update (double dt);
 
     bool build ();
 
-    void add_waypoint( const SGWayPoint& wp ) {
-        route->add_waypoint( wp );
-    }
+    int new_waypoint( const string& tgt_alt, int n = -1 );
+    void add_waypoint( const SGWayPoint& wp, int n = -1 );
+    SGWayPoint pop_waypoint( int i = 0 );
 
     SGWayPoint get_waypoint( int i ) const {
         return route->get_waypoint(i);
     }
 
-    SGWayPoint pop_waypoint();
-
     int size() const {
         return route->size();
     }
+
 };