# error This library requires C++
#endif
-
#include <simgear/compiler.h>
-#include STL_STRING
#include <vector>
-SG_USING_STD(string);
-SG_USING_STD(vector);
+using std::vector;
#include <simgear/route/waypoint.hxx>
route_list route;
int current_wp;
- void update_distance(int index);
+ void update_distance_and_track(int index);
public:
return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" );
}
}
+
+ inline SGWayPoint get_previous() const {
+ if ( (current_wp > 0) && (current_wp < (int)route.size()) ) {
+ return route[current_wp - 1];
+ } else {
+ return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" );
+ }
+ }
+
+ inline SGWayPoint get_next() const {
+ if ( (current_wp + 1) < (int)route.size() ) {
+ return route[current_wp+1];
+ } else {
+ return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" );
+ }
+ }
/**
* Set the current waypoint
}
}
+ inline int current_index() const {
+ return current_wp;
+ }
+
/** Increment the current waypoint pointer. */
inline void increment_current() {
if ( current_wp < (int)route.size() - 1 ) {
/** Delete waypoint waypoint with index n (last one if n < 0) */
void delete_waypoint( int n = 0 );
-
+
/**
- * 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 most accurate
- * results, use with CARTESIAN way points.
+ * Helper, sum the distance members of each waypoint
*/
- double distance_off_route( double x, double y ) const;
+ double total_distance() const;
};