WsfRoute

WsfRoute inherits WsfObject

Construction: WsfRoute newObj = WsfRoute();
Clone: WsfRoute newObj = WsfRoute(other);
Container

Example:

WsfWaypoint wp = route[i];

WsfRoute route = WsfRoute.CopyGlobal("my_route");
WsfWaypoint wpt = route[0]; # Access the first waypoint
wpt.SetSpeed(200); # Set the speed to 200 m/s
# CAUTION: The indexing operator returns a reference to the waypoint, and
#          may become a null reference if the route is modified
#          using a method like Append()

Static Methods

WsfRoute Create(string aRouteName)

Returns a named but empty new route.

WsfRoute CopyGlobal(string aRouteName)

Returns a copy of a global route defined in the input file, named aRouteName.

WsfRoute FindGlobal(string aRouteName)

Returns a reference to a global route defined in the input file, named aRouteName. The returned route may not be modified directly, use CopyGlobal() if modification is required.

Array<string> GlobalRoutes()

Returns the names of all the global routes as an array of strings.

Methods

void Append(WsfWaypoint aWaypoint)
void Append(WsfRoute aRoute)
void Append(WsfGeoPoint aGeoPoint, double aSpeed)
void Append(string aRouteName)

Appends the specified data to the end of the current route.

void Insert(int aBeforeIndex, WsfWaypoint aNewWaypoint)

Inserts the supplied waypoint into the route before the waypoint at the specified index. aBeforeIndex must be in the range [0, Size()-1].

void Remove(int aWaypointIndex)

Removes a waypoint from the route. aWaypointIndex must be in the range [0, Size()-1].

WsfRoute Copy()

Returns a copy of the route.

int Size()

Returns the number of waypoints in the route.

WsfWaypoint Waypoint(int aIndex)
WsfWaypoint Waypoint(string aLabel)

Returns the waypoint at aIndex, or the waypoint with label aLabel. Waypoint(int) is equivalent to the index operator: “route[int]”.

Note

This returns a reference to the waypoint. Modification of the waypoint affects the route. If waypoints are added or removed from the route, the waypoint reference may become invalidated.

WsfWaypoint Front()

Returns the first waypoint in the route.

Note

This returns a reference to the waypoint. Modification of the waypoint affects the route. If waypoints are added or removed from the route, the waypoint reference may become invalidated.

WsfWaypoint Back()

Returns the last waypoint in the route.

Note

This returns a reference to the waypoint. Modification of the waypoint affects the route. If waypoints are added or removed from the route, the waypoint reference may become invalidated.

void Print()

Prints the route to the console for debugging purposes.

void SetAltitude(double aAltitude)
void SetAltitude(double aAltitude, string aAltReference)

Changes the altitude of all the waypoints belonging to the route.

Note

If no altitude reference is specified, the original waypoint altitude reference (e.g., agl, msl) will be used.

double GetSpeed(int aIndex)

Returns the speed at the specified waypoint.

void SetSpeed(double aSpeed)

Sets the speed value of each waypoint in the route.

void SetSpeed(int aIndex, double aSpeed)

Sets the speed value of the waypoint at the specified index.

void Transform(double aLatitude, double aLongitude, double aHeading)

Transforms the route at the given location aligned with the specified heading. This is typically used to orient orbits in a particular direction.

void AddCallbackToWaypoint(string aCallbackName, int aIndex)

Adds the specified callback to the waypoint at the specified index.

void AddCallbackToLastWaypoint(string aCallbackName)

Adds the specified callback to the last waypoint in the route.

void AddCallbackToLastWaypoint(string aCallbackName, string aProcessorName)

Adds the specified callback from the specified processor to the last waypoint in the route.

void AddCallbackToLastWaypoint(Method aMethod)

Adds the specified callback Method to the last waypoint in the route. The given method should take 0 or 1 argument as follows:

void A_Method()
void A_Method(WsfPlatform aCaller)
double TotalLength()

Returns total length of the route in meters.

WsfGeoPoint LocationAtDistance(double aDistance)

Returns a WsfGeoPoint at a location along the route at the specified distance from the start of the route.

Note

This method is accurate with routes containing Latitude/Longitude points only.

double DistanceAlongRoute(WsfGeoPoint aLocation)

Given a point on or near the route, this computes the approximate distance from the start of the route.

Note

This method is accurate with routes containing Latitude/Longitude points only.

double DistanceFromRoute(WsfGeoPoint aLocation)

Computes the distance between the given point and the closest segment on the route.

Note

This method is accurate with routes containing Latitude/Longitude points only.

WsfRoute SubrouteByDistance(double aDistance1, double aDistance2)

Computes a sub-route from this route given a starting and ending distance from the route’s first point. If aDistance1 is less than aDistance2, the resulting route will be reversed. Both distance values should be in the range [0, TotalLength()].

Example:

WsfRoute reversed = route.SubrouteByDistance(route.TotalLength(), 0)

Note

This method is accurate with routes containing Latitude/Longitude points only.

Array<Object> Intersect(WsfRoute aOtherRoute)

Computes the intersection of this route and aOtherRoute assuming straight segments. Ignores altitude differences between the routes. Returns an array with 3 elements for each intersection: (int segment_index_1, int segment_index_2, WsfGeoPoint intersection_location). The segment_indexes give the waypoint index where the intersection occurs for each route.

Iterator WsfRouteIterator GetIterator()

Returns an iterator that points to the beginning of the route. This is used by the script language to support the foreach command, but may also be used directly.

Auxiliary Data Methods

Auxiliary Data is a collection of optional named user data attributes that can be stored with the object. The framework will maintain the attributes but in no other way attempts to use the data contained within. The definition and use of any attribute is defined purely by the user.

bool AuxDataBool(string aName)
int AuxDataInt(string aName)
double AuxDataDouble(string aName)
string AuxDataString(string aName)
Object AuxDataObject(string aName)

Retrieve the value of the auxiliary data attribute with the indicated name. If the attribute does not exist then a default value will be returned (false for bool, 0 for int and 0.0 for double).

bool AuxDataExists(string aName)
bool CheckAuxData(string aName)

Returns true if an auxiliary data member exists with the specified name.

bool HasAuxData()

Returns true if the object has auxiliary data.

bool DeleteAuxData(string aName)

Delete the auxiliary data attribute with the indicated name. Returns true if the attribute exists and was deleted, or false if the attribute did not exist.

void SetAuxData(string aName, bool aValue)
void SetAuxData(string aName, int aValue)
void SetAuxData(string aName, double aValue)
void SetAuxData(string aName, string aValue)
void SetAuxData(string aName, Object aValue)

Set the value of the auxiliary data attribute with the indicated name. The last form of SetAuxData() can store any script object type.

Map<string, string> GetAllAuxDataTypes()

Return the names and types of all auxiliary data attributes in the form of a Map<string,string>. Map keys are valid names of auxiliary data attributes. Map values are type names corresponding to valid auxiliary data attribute names.