#include STL_STRING
#include <vector>
-FG_USING_STD(string);
-FG_USING_STD(vector);
+SG_USING_STD(string);
+SG_USING_STD(vector);
-#include "waypoint.hxx"
+#include <simgear/route/waypoint.hxx>
class SGRoute {
// add a waypoint
inline void add_waypoint( const SGWayPoint &wp ) {
route.push_back( wp );
+
+ int size = route.size();
+ if ( size > 1 ) {
+ SGWayPoint next_to_last = route[ size - 2 ];
+ double tmpd, tmpc;
+ wp.CourseAndDistance( next_to_last, &tmpc, &tmpd );
+ route[size - 1].set_distance( tmpd );
+ }
}
// get the number of waypoints
route.erase( route.begin() );
}
}
+
+ // Calculate perpendicular distance from the current route segment
+ // This routine assumes all points are laying on a flat plane and
+ // ignores the altitude (or Z) dimension. For best results, use
+ // with CARTESIAN way points.
+ double distance_off_route( double x, double y ) const;
};