# error This library requires C++
#endif
-
#include <simgear/compiler.h>
-#include STL_STRING
#include <vector>
-SG_USING_STD(string);
SG_USING_STD(vector);
#include <simgear/route/waypoint.hxx>
route_list route;
int current_wp;
+ void update_distance(int index);
+
public:
/** Constructor */
* Add waypoint (default), or insert waypoint at position n.
* @param wp a waypoint
*/
- void add_waypoint( const SGWayPoint &wp, int n = -1 ) {
- if ( n < 0 || n >= (int)route.size() )
- route.push_back( wp );
- else
- route.insert( route.begin() + n, 1, 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 );
- }
- }
-
+ void add_waypoint( const SGWayPoint &wp, int n = -1 );
/**
* Get the number of waypoints (i.e. route length )
* @return route length
inline void delete_first() { delete_waypoint(0); }
/** Delete waypoint waypoint with index n (last one if n < 0) */
- void delete_waypoint( int n = 0 ) {
- if ( !route.size() )
- return;
- if ( n < 0 || n >= (int)route.size() )
- n = route.size() - 1;
-
- route.erase( route.begin() + n );
- }
+ void delete_waypoint( int n = 0 );
/**
* Calculate perpendicular distance from the current route segment