WSF
WsfRoute Class Reference

A collection of WsfWaypoint objects that represent a path to be followed. More...

#include <WsfRoute.hpp>

Inheritance diagram for WsfRoute:
Collaboration diagram for WsfRoute:

Classes

struct  RouteIntersection

Public Types

using WaypointVector = std::vector<WsfWaypoint>
using WayptVecIter = std::vector<WsfWaypoint>::iterator
using WaypointPtrVector = std::vector<WsfWaypoint*>
using WaypointSegment = std::pair<WsfWaypoint, WsfWaypoint>
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Public Member Functions

 WsfRoute ()=default
 WsfRoute (const std::string &aName)
 WsfRoute (const WsfRoute &aSrc)
 Copy constructor (for Clone()).
 ~WsfRoute () override
WsfRouteoperator= (const WsfRoute &aRhs)
WsfWaypointoperator[] (size_t aIndex)
const WsfWaypointoperator[] (size_t aIndex) const
WsfRouteClone () const override
virtual bool Initialize (double aSimTime=0.0)
bool ProcessInput (UtInput &aInput) override
const char * GetScriptClassName () const override
void Append (const WsfWaypoint &aWaypoint)
 Add the given point to the end of the waypoint vector.
void Append (const WsfRoute &aRoute)
 Add all the waypoints of the given route to the end of the current route.
void Insert (WayptVecIter aIter, const WsfWaypoint &aWaypoint)
void Insert (int aIndex, const WsfWaypoint &aWaypoint)
void Remove (unsigned int aWaypointIndex)
void Transform (double aRefLat, double aRefLon, double aHeading)
void TransformNED (double aNorth, double aEast, double aDown)
void GetSubroute (const WsfWaypoint &aFromWaypoint, const WsfWaypoint &aToWaypoint, WsfRoute &aRoute) const
void GetSubroute (int aStartIndex, int aEndIndex, WsfRoute &aRoute) const
void AppendSubroute (int aStartIndex, int aEndIndex, WsfRoute &aRoute) const
void GetAllNodes (WaypointPtrVector &aWaypointPtrVector)
int GetAdjacentNodeIndices (int aWaypointIndex, int *aAdjacentNodeIndices) const
int FindWaypointIndex (double aLat, double aLon, double aAlt)
int FindWaypointIndex (const WsfWaypoint &aWpt)
bool IsBetweenWaypoints (const double aPointLL[2], const unsigned int aFirstWaypointIndex, const unsigned int aSecondWaypointIndex, const double aTolerancePercentage=0.01) const
double GetDistance (int aFromWaypointIndex, int aToWaypointIndex) const
double GetDistanceOffset (const double aFromLL[2], const double aToLL[2], const double aPointLL[2], double &aOffsetDist) const
double GetDistanceAlongRoute (const double aFromLL[2], const double aToLL[2]) const
double GetDistanceAlongRoute (const double aFromLL[2], const double aToLL[2], double &aOffsetDist) const
bool GetEndPointsAtDistance (double aDistance, int &aWaypointIndex) const
bool PointAlongRoute (double aDistanceFromStart, double aPointAlongRoute[2], int &aSegmentIndex)
bool ProjectOntoRoute (const double aPointLL[2], int &aSegmentIndex, double aProjectedLL[2], double &aDistance) const
bool ProjectOntoRoute (const double aPointLL[2], double &aDistanceFromRoute, double &aDistanceAlongRoute) const
int ProjectOntoRouteFast (const double aPointLL[2], double &aDistanceFromRoute, double &aDistanceAlongRoute) const
bool ProjectOntoRouteGivenClosestWaypoint (double aLat, double aLon, int aClosestWaypointIndex, int &aSegmentIndex, double aProjectedLL[2])
int Intersect (WsfRoute &aOtherRoute, std::vector< RouteIntersection > &aIntersections)
double GetTotalLength () const
 Get the total distance along all waypoints in the route.
double GetTravelTime () const
 Get the time to travel the route given the speed of each segment.
double GetTravelTimeToPosition (const double aPosition[2]) const
WsfWaypointGetWaypointAt (size_t aIndex)
const WsfWaypointGetWaypointAt (size_t aIndex) const
unsigned int GetWaypointIndexAt (WsfStringId aLabelId) const
bool IsGlobalRoute () const
void SetNetworkRouteId (unsigned int aRouteId)
unsigned int GetNetworkRouteId () const
 Get the network route Id associated with this route.
void SetSpeed (double aSpeed)
double GetSpeed (unsigned int aIndex) const
const WaypointVectorGetWaypoints () const
WayptVecIter Begin ()
 Return an iterator to the first waypoint in the route.
WayptVecIter End ()
void Clear ()
 Remove all waypoints from a route.
bool Empty () const
unsigned int GetSize () const
void Print (ut::log::MessageStream &aStream) const
 Adds details to the notes of aStream.
void Swap (WsfRoute &aRhs)
 Swap two WsfRoute's efficiently.
UtReferenceCount * GetWaypointReferenceCount ()
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
UtScriptRef * ScriptRef ()
 Return a script reference to this route, managed by the application.
UtScriptRef * ConstScriptRef () const
UtScriptRef * ScriptRefManage ()
 Return a script reference to this route, managed by the scripting language.
bool ProcessNavigationInput (UtInput &aInput)
void ProcessWaypoint (UtInput &aInput, WsfWaypoint &aWaypoint)
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)
Public Member Functions inherited from WsfAuxDataEnabled
 WsfAuxDataEnabled ()=default
 WsfAuxDataEnabled (const WsfAuxDataEnabled &aSrc)=default
WsfAuxDataEnabledoperator= (const WsfAuxDataEnabled &aRhs)
 WsfAuxDataEnabled (WsfAuxDataEnabled &&)=default
WsfAuxDataEnabledoperator= (WsfAuxDataEnabled &&)=default
virtual ~WsfAuxDataEnabled () noexcept
void SetAuxData (const WsfAttributeContainer &aAuxData)
void DeleteAuxData ()
 Delete the aux data container from the object.
void MergeAuxData (const WsfAuxDataEnabled &aSrc)
 Merge the object's aux data with aux data from an existing object.
void UpdateAuxData (const WsfAuxDataEnabled &aSrc)
 Update the object's aux data with aux data from an existing object.
bool HasAuxData () const
 Returns true if this object has aux data.
bool ProcessInput (UtInput &aInput)
template<typename T>
void Serialize (T &aBuff)
 (De)serialization for XIO
WsfAttributeContainerGetAuxData ()
const WsfAttributeContainerGetAuxData () const noexcept
const WsfAttributeContainerGetAuxDataConst () const noexcept

Static Public Member Functions

static std::unique_ptr< UtScriptClass > CreateScriptClass (const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
static std::unique_ptr< UtScriptClass > CreateIteratorScriptClass (const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
static bool ProjectOntoRoute (const double aPointLL[2], const double aSegmentStartLL[2], const double aSegmentEndLL[2], double aWaypointLL[2])
static void ProcessInputBlock (UtInputBlock &aInputBlock, WsfRoute *aRoutePtr, bool aAllowName)

Static Public Attributes

static constexpr const char * cTYPE_KIND = "route"
Static Public Attributes inherited from WsfAuxDataEnabled
static UtCallbackListN< void(const WsfAuxDataEnabled *)> AuxDataAccessed
static UtCallbackListN< void(const WsfAuxDataEnabled *)> AuxDataDestroyed

Additional Inherited Members

 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Detailed Description

A collection of WsfWaypoint objects that represent a path to be followed.

Member Typedef Documentation

◆ WaypointPtrVector

◆ WaypointSegment

◆ WaypointVector

using WsfRoute::WaypointVector = std::vector<WsfWaypoint>

◆ WayptVecIter

using WsfRoute::WayptVecIter = std::vector<WsfWaypoint>::iterator

Constructor & Destructor Documentation

◆ WsfRoute() [1/3]

◆ WsfRoute() [2/3]

WsfRoute::WsfRoute ( const std::string & aName)

Constructor for a named, but empty, route

Parameters
aNameA string containing the name of the route.

References WsfObject::SetName(), and WsfObject::WsfObject().

◆ WsfRoute() [3/3]

WsfRoute::WsfRoute ( const WsfRoute & aSrc)

◆ ~WsfRoute()

WsfRoute::~WsfRoute ( )
override

Member Function Documentation

◆ Append() [1/2]

void WsfRoute::Append ( const WsfRoute & aRoute)

Add all the waypoints of the given route to the end of the current route.

References Append(), GetSize(), and WsfRoute().

◆ Append() [2/2]

◆ AppendSubroute()

void WsfRoute::AppendSubroute ( int aStartIndex,
int aEndIndex,
WsfRoute & aRoute ) const

Given a 'start' route index and an 'end' route index, both of which represent waypoints that are contained within the referenced route, append the sub-route that begins and ends with those waypoints.

Parameters
aStartIndexThe first waypoint index in the sub-route.
aEndIndexThe last waypoint index in the sub-route.
aRouteThe route to be appended with the sub-route.

References Append(), and WsfRoute().

Referenced by GetSubroute(), and WsfRoute().

◆ Begin()

WayptVecIter WsfRoute::Begin ( )
inline

Return an iterator to the first waypoint in the route.

◆ Clear()

◆ Clone()

◆ ConstScriptRef()

UtScriptRef * WsfRoute::ConstScriptRef ( ) const

Return a const script reference to this route, managed by the application. Script accessors will be forbidden from modifying this object.

References cCONST_ROUTE_ID, ScriptRef(), and WsfRoute().

Referenced by UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), and UT_DEFINE_SCRIPT_METHOD().

◆ CreateIteratorScriptClass()

std::unique_ptr< UtScriptClass > WsfRoute::CreateIteratorScriptClass ( const std::string & aClassName,
UtScriptTypes * aScriptTypesPtr )
static

◆ CreateScriptClass()

std::unique_ptr< UtScriptClass > WsfRoute::CreateScriptClass ( const std::string & aClassName,
UtScriptTypes * aScriptTypesPtr )
static

Create the 'class' object for the script system. This is invoked once by WsfScriptManager to create the 'class' object that defines the interface to instances of this class from the script system.

References CreateScriptClass(), and WsfRoute().

Referenced by CreateScriptClass(), WsfScriptManager::RegisterTypes(), and WsfRoute().

◆ Empty()

◆ End()

WayptVecIter WsfRoute::End ( )
inline

Return an iterator to the end of the vector (i.e., whether the iterator is past the last waypoint in the vector).

◆ FindWaypointIndex() [1/2]

◆ FindWaypointIndex() [2/2]

int WsfRoute::FindWaypointIndex ( double aLat,
double aLon,
double aAlt )

◆ GetAdjacentNodeIndices()

int WsfRoute::GetAdjacentNodeIndices ( int aWaypointIndex,
int * aAdjacentNodeIndices ) const

Determine which nodes are adjacent to a node given its index.

Parameters
aWaypointIndexThe waypoint index around which to find adjacent nodes.
aAdjacentNodeIndices[output] The (0, 1, or 2) adjacent node indices in the route.
Returns
The number of adjacent nodes (0, 1, or 2)

Referenced by WsfRoute().

◆ GetAllNodes()

void WsfRoute::GetAllNodes ( WaypointPtrVector & aWaypointPtrVector)

Loop through the waypoints and return a vector containing only those points whose intersection identifier is non-zero.

Parameters
aWaypointPtrVector[output] A vector of waypoint pointers whose intersection identifier is non-zero.
Note
In the context of a route a "node" is defined to be either the first or last waypoint in the route or a waypoint where two or more routes intersect. This method returns all waypoints that are nodes.

Referenced by WsfRoute().

◆ GetDistance()

double WsfRoute::GetDistance ( int aFromWaypointIndex,
int aToWaypointIndex ) const

Get the distance along the route between two waypoints.

Parameters
aFromWaypointIndexThe beginning waypoint index for which the distance is calculated.
aToWaypointIndexThe ending waypoint index for which the distance is calculated.
Returns
The distance, along a great circle route, between 'from' and 'to' waypoints

References GetDistanceAlongRoute().

Referenced by XWsfOSM_Traffic::ChangeScriptedLane(), GetDistanceAlongRoute(), GetDistanceAlongRoute(), WsfFuel::GetQuantityRequired(), and WsfRoute().

◆ GetDistanceAlongRoute() [1/2]

double WsfRoute::GetDistanceAlongRoute ( const double aFromLL[2],
const double aToLL[2] ) const

Get the distance along the route between ANY two waypoints along the route.

Parameters
aFromLLThe beginning point for which the distance is calculated.
aToLLThe ending point for which the distance is calculated.
Returns
The distance, along a great circle route, between the 'from' and 'to' input waypoints. negative - 'to' appears in route prior to 'from' positive - 'from' appears in route prior to 'to' std::numeric_limits<int>::max() if either 'from' or 'to' are not along the route.
Note
This method differs from GetDistance in that the 'from' and 'to' waypoints are NOT required to be a waypoints of the route.

References GetDistance(), IsBetweenWaypoints(), and waypointIndex.

Referenced by Append(), XWsfOSM_Traffic::ChangeScriptedLane(), GetDistance(), Insert(), Remove(), and WsfRoute().

◆ GetDistanceAlongRoute() [2/2]

double WsfRoute::GetDistanceAlongRoute ( const double aFromLL[2],
const double aToLL[2],
double & aOffsetDist ) const

Get the distance along the route between ANY waypoint on the route and an arbitrary (lat, lon) along with the perpendicular offset distance of (lat, lon) to the route.

Parameters
aFromLLThe beginning point for which the distance is calculated.
aToLLThe ending point for which the distances are calculated.
aOffsetDist[output] The perpendicular distance from the specified point to the point on the route.
Returns
The distance, along a great circle route, between the 'from' and 'to' input waypoints. negative - 'to' appears in route prior to 'from' positive - 'from' appears in route prior to 'to'
Note
This method returns the distance to the first segment of route ahead of aFromLL which aToLL's perpendicular intercepts. Caution: there maybe smaller offsets distance further along route.

References GetDistance(), GetDistanceOffset(), IsBetweenWaypoints(), and waypointIndex.

◆ GetDistanceOffset()

double WsfRoute::GetDistanceOffset ( const double aFromLL[2],
const double aToLL[2],
const double aPointLL[2],
double & aOffsetDist ) const

Get the distance and offset along the route between two waypoints.

Parameters
aFromLLThe beginning point for which the distance is calculated.
aToLLThe ending point for which the distance is calculated.
aPointLLThe point for which the distances are calculated.
aOffsetDistthe dist (aLat, aLon) is off the route between the waypoints
Returns
The distance, along a great circle route, between the 'from' and 'to' input points.

Referenced by GetDistanceAlongRoute(), and WsfRoute().

◆ GetEndPointsAtDistance()

bool WsfRoute::GetEndPointsAtDistance ( double aDistance,
int & aSegmentIndex ) const
Parameters
aDistanceA distance along the route.
aSegmentIndexSet to the index of the waypoint which comes before the specified distance. aSegmentIndex will never be the last waypoint.

References WsfWaypoint::SetDistanceAlongRoute().

Referenced by PointAlongRoute(), and WsfRoute().

◆ GetNetworkRouteId()

unsigned int WsfRoute::GetNetworkRouteId ( ) const
inline

Get the network route Id associated with this route.

Returns
The route Id associated with this route.

Referenced by XWsfOSM_Traffic::ChangeScriptedLane().

◆ GetScriptClassName()

const char * WsfRoute::GetScriptClassName ( ) const
override

◆ GetSize()

◆ GetSpeed()

double WsfRoute::GetSpeed ( unsigned int aIndex) const
inline

Get the speed at the requested waypoint on a route

Returns
The speed at a specific waypoint along a route.

Referenced by GetTravelTime(), GetTravelTimeToPosition(), WsfNavigationMesh::RefineFromCurrentPosition(), and WsfRouteMover::Update().

◆ GetSubroute() [1/2]

void WsfRoute::GetSubroute ( const WsfWaypoint & aFromWaypoint,
const WsfWaypoint & aToWaypoint,
WsfRoute & aRoute ) const

Given a 'start' waypoint and an 'end' waypoint, both of which are contained within the referenced route, return the sub-route that begins and ends with those waypoints.

Parameters
aFromWaypointThe first waypoint in the sub-route.
aToWaypointThe last waypoint in the sub-route.
aRoute[output] The desired sub-route.

References GetSubroute(), and WsfRoute().

Referenced by GetSubroute(), if(), UT_DEFINE_SCRIPT_METHOD(), and WsfRoute().

◆ GetSubroute() [2/2]

void WsfRoute::GetSubroute ( int aStartIndex,
int aEndIndex,
WsfRoute & aRoute ) const

Given a 'start' route index and an 'end' route index, both of which represent waypoints that are contained within the referenced route, return the sub-route that begins and ends with those waypoints.

Parameters
aStartIndexThe first waypoint index in the sub-route.
aEndIndexThe last waypoint index in the sub-route.
aRoute[output] The desired sub-route.

References AppendSubroute(), Clear(), and WsfRoute().

◆ GetTotalLength()

double WsfRoute::GetTotalLength ( ) const
inline

Get the total distance along all waypoints in the route.

Returns
The sum of the lengths between consecutive waypoints in the route.

◆ GetTravelTime()

double WsfRoute::GetTravelTime ( ) const

Get the time to travel the route given the speed of each segment.

References WsfPath::cDOUBLE_NOT_SET, and GetSpeed().

Referenced by WsfRoadMover::CreateRoute(), WsfFuel::FuelSecondsRemaining(), and WsfRoadMover::GetTravelTime().

◆ GetTravelTimeToPosition()

double WsfRoute::GetTravelTimeToPosition ( const double aPosition[2]) const

◆ GetWaypointAt() [1/2]

◆ GetWaypointAt() [2/2]

const WsfWaypoint & WsfRoute::GetWaypointAt ( size_t aIndex) const

Return a reference to the waypoint in the route specified by the given index.

Parameters
aIndexThe waypoint number to be referenced.
Returns
A const reference to the waypoint element specified by 'aIndex.'

◆ GetWaypointIndexAt()

unsigned int WsfRoute::GetWaypointIndexAt ( WsfStringId aLabelId) const

Return a index to the waypoint in the route specified by the given label.

Parameters
aLabelIdThe waypoint label.
Returns
The index of the first waypoint with the given label or the value of Size() if a waypoint with the given label could not be found.

Referenced by WsfWaypointMover::GetFutureLocationWCS().

◆ GetWaypointReferenceCount()

UtReferenceCount * WsfRoute::GetWaypointReferenceCount ( )
inline

Returns the reference count for waypoints owned by this route. If the route is resized, waypoint references are invalidated. This allows scripts to access waypoint references safely.

◆ GetWaypoints()

const WaypointVector & WsfRoute::GetWaypoints ( ) const
inline

Gets the vector of the actual waypoints

Returns
Returns the WaypointVector mWaypoints

Referenced by WsfRouteNetwork::Append(), WsfFuel::GetQuantityRequired(), and WsfSA_Processor::UpdateNavData().

◆ Initialize()

bool WsfRoute::Initialize ( double aSimTime = 0.0)
virtual

Perform initialization of the route.

Returns
'true' if the initialization succeeded; 'false' otherwise.

References WsfObject::GetNameId(), ok, and SetNetworkRouteId().

Referenced by WsfRoute().

◆ Insert() [1/2]

void WsfRoute::Insert ( int aIndex,
const WsfWaypoint & aWaypoint )

References Insert().

◆ Insert() [2/2]

◆ Intersect()

int WsfRoute::Intersect ( WsfRoute & aOtherRoute,
std::vector< RouteIntersection > & aIntersections )

Returns a list of intersections between two routes. Assumes that both routes contain only latitude-longitude waypoints.

References WsfRoute::RouteIntersection::mPoint, WsfRoute::RouteIntersection::mWaypointIndex1, WsfRoute::RouteIntersection::mWaypointIndex2, std::swap(), and WsfRoute().

Referenced by UT_DEFINE_SCRIPT_METHOD(), and WsfRoute().

◆ IsBetweenWaypoints()

bool WsfRoute::IsBetweenWaypoints ( const double aPointLL[2],
const unsigned int aFirstWaypointIndex,
const unsigned int aSecondWaypointIndex,
const double aTolerancePercentage = 0.01 ) const

Determine if a waypoint is between two other waypoints.

Parameters
aPointLLThe point of interest along the route.
aFirstWaypointIndexThe first route waypoint index.
aSecondWaypointIndexThe second route waypoint index.
aTolerancePercentageThe percentage of firstSecondDistance that aPointLL can be off the path and still be considered to be "between"
Returns
'true' if the given point is between the two waypoints; 'false' otherwise.

Referenced by GetDistanceAlongRoute(), GetDistanceAlongRoute(), ProjectOntoRoute(), and WsfRoute().

◆ IsGlobalRoute()

bool WsfRoute::IsGlobalRoute ( ) const

References WsfObject::GetName().

Referenced by ProcessNavigationInput().

◆ operator=()

WsfRoute & WsfRoute::operator= ( const WsfRoute & aRhs)

Set one route equal to another.

Parameters
aRhsThe route to which the left-hand-side route is equated.

References WsfAuxDataEnabled::operator=(), WsfObject::operator=(), and WsfRoute().

◆ operator[]() [1/2]

WsfWaypoint & WsfRoute::operator[] ( size_t aIndex)

Return a reference to the waypoint in the route specified by the given index.

Parameters
aIndexThe waypoint number to be referenced.
Returns
A non-const reference to the waypoint element specified by 'aIndex.'

References GetWaypointAt().

Referenced by WsfRoute().

◆ operator[]() [2/2]

const WsfWaypoint & WsfRoute::operator[] ( size_t aIndex) const

Return a reference to the waypoint in the route specified by the given index.

Parameters
aIndexThe waypoint number to be referenced.
Returns
A const reference to the waypoint element specified by 'aIndex'

References GetWaypointAt().

◆ PointAlongRoute()

bool WsfRoute::PointAlongRoute ( double aDistanceFromStart,
double aPointAlongRoute[2],
int & aSegmentIndex )

Computes a location along a route given a distance from the start of the route.

Parameters
aDistanceFromStartThe distance from the start of the route
aPointAlongRouteSet to the point on the route at the specified distance from start.
aSegmentIndexSet to the segment index at which the point occurs
Returns
True if successful

References d2, WsfWaypoint::GetDistanceAlongRoute(), GetEndPointsAtDistance(), WsfWaypoint::GetLat(), and WsfWaypoint::GetLon().

Referenced by WsfRoute().

◆ Print()

void WsfRoute::Print ( ut::log::MessageStream & aStream) const

Adds details to the notes of aStream.

Used to print out a route for debugging purposes.

References WsfObject::GetName().

Referenced by UT_DEFINE_SCRIPT_METHOD().

◆ ProcessInput()

bool WsfRoute::ProcessInput ( UtInput & aInput)
overridevirtual

Process input from a generic source.

Examine the current input command. If it is NOT one of the commands recognized by this class then it simply returns 'false'. If it is one of the commands recognized by this class then it processes the command and returns 'true'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the class or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.
Note
If a derived class does not recognize the command (i.e.: the return value is false) then it should call the base class ProcessInput method. This chain should continue until either the command is recognized or the top-level base class is encountered.

Reimplemented from WsfObject.

References WsfAuxDataEnabled::ProcessInput(), and ProcessNavigationInput().

Referenced by ProcessInputBlock().

◆ ProcessInputBlock()

void WsfRoute::ProcessInputBlock ( UtInputBlock & aInputBlock,
WsfRoute * aRoutePtr,
bool aAllowName )
static

◆ ProcessNavigationInput()

◆ ProcessWaypoint()

◆ ProjectOntoRoute() [1/3]

bool WsfRoute::ProjectOntoRoute ( const double aPointLL[2],
const double aSegmentStartLL[2],
const double aSegmentEndLL[2],
double aProjectedLL[2] )
static

Projects the given point onto the provided segment.

Parameters
aPointLLThe point to project.
aSegmentStartLLThe segment start point
aSegmentEndLLThe segment end point
aProjectedLLSet to the location of the point projected onto the segment
Returns
Returns true if the projection was possible.

Referenced by ProjectOntoRoute(), ProjectOntoRoute(), ProjectOntoRouteGivenClosestWaypoint(), and WsfRoute().

◆ ProjectOntoRoute() [2/3]

bool WsfRoute::ProjectOntoRoute ( const double aPointLL[2],
double & aDistanceFromRoute,
double & aDistanceAlongRoute ) const

Projects a point onto the closest segment in the route.

Parameters
aPointLLThe point to project Latitude/Longitude
aDistanceFromRouteSet to the distance the given point is from the projected point.
aDistanceAlongRouteSet to the distance along the route at which the point projected point occurs returns True if successful

References ProjectOntoRoute().

◆ ProjectOntoRoute() [3/3]

bool WsfRoute::ProjectOntoRoute ( const double aPointLL[2],
int & aSegmentIndex,
double aProjectedLL[2],
double & aDistance ) const

Projects the given point onto the closest segment in the route.

Parameters
aPointLLThe point to project.
aSegmentIndexSet to the segment index used to project
aProjectedLLSet to the location of the point projected onto the segment
aDistanceSet to the distance from the segment
Returns
Returns true if the projection was possible.

References end(), WsfWaypoint::GetLat(), WsfWaypoint::GetLon(), IsBetweenWaypoints(), and ProjectOntoRoute().

◆ ProjectOntoRouteFast()

int WsfRoute::ProjectOntoRouteFast ( const double aPointLL[2],
double & aDistanceFromRoute,
double & aDistanceAlongRoute ) const

Projects a point onto the closest segment in the route.

Parameters
aPointLLThe point to project Latitude/Longitude
aDistanceFromRouteSet to the distance the given point is from the projected point.
aDistanceAlongRouteSet to the distance along the route at which the point projected point occurs returns Index of closest segment, or -1 if failure

References WsfWaypoint::GetDistanceAlongRoute(), WsfWaypoint::GetLat(), and WsfWaypoint::GetLon().

Referenced by WsfRoute().

◆ ProjectOntoRouteGivenClosestWaypoint()

bool WsfRoute::ProjectOntoRouteGivenClosestWaypoint ( double aLat,
double aLon,
int aClosestWaypointIndex,
int & aSegmentIndex,
double aProjectedLL[2] )

Projects the given latitude/longitude onto a segment where the provided closest waypoint is one of the endpoints of the segment.

Parameters
aLatThe latitude to project.
aLonThe longitude to project.
aClosestWaypointIndexThe closest waypoint to the provided latitude/longitude.
aSegmentIndexThe index of the waypoint at segment start
aProjectedLLSet to the projected point.
Returns
Returns true if the projection was possible.

References WsfWaypoint::GetLat(), WsfWaypoint::GetLon(), and ProjectOntoRoute().

Referenced by WsfRoute().

◆ Remove()

void WsfRoute::Remove ( unsigned int aWaypointIndex)

References GetDistanceAlongRoute().

Referenced by WsfRoute().

◆ ScriptRef()

UtScriptRef * WsfRoute::ScriptRef ( )

Return a script reference to this route, managed by the application.

References gRouteClassPtr.

Referenced by ConstScriptRef().

◆ ScriptRefManage()

UtScriptRef * WsfRoute::ScriptRefManage ( )

◆ Serialize()

template<typename T>
void WsfRoute::Serialize ( T & aBuff)
inline

For XIO (de)serialization.

References WsfObject::Serialize().

◆ SetNetworkRouteId()

void WsfRoute::SetNetworkRouteId ( unsigned int aRouteId)

Assign a route with a particular route Id.

Parameters
aRouteIdThe route id to associate with the route.

Referenced by Initialize().

◆ SetSpeed()

void WsfRoute::SetSpeed ( double aSpeed)

Set the speed of all waypoints in the route

Parameters
aSpeedThe speed to which all waypoints in the route will be set.

Referenced by WsfNavigationMesh::ComputeSetRoute(), WsfPathFinder::ComputeSetRoute(), WsfRoadMover::CreateRoute(), WsfRouteMover::FindAndSetPath(), WsfNavigationMesh::RefineFromCurrentPosition(), and WsfRouteMover::Update().

◆ Swap()

void WsfRoute::Swap ( WsfRoute & aRhs)
inline

Swap two WsfRoute's efficiently.

References std::swap(), and WsfRoute().

Referenced by std::swap().

◆ Transform()

void WsfRoute::Transform ( double aRefLat,
double aRefLon,
double aHeading )

Transform a relative route to an absolute route by applying a rotation and a translation. This method is useful for transforming a pattern constructed of relative positions into an absolute route that can be used by a mover. rotation and a translation. Waypoints of type cRELATIVE_OFFSET are rotated and translated to become points of cLATITUDE_AND_LONGITUDE.

Parameters
aRefLatThe latitude coordinate (degrees) of the local coordinate system's origin.
aRefLonThe longitude coordinate (degrees) of the local coordinate system's origin.
aHeadingThe heading (degrees) of the X axis from north.
Note
In an unrotated frame +X is North and +Y is East.

References WsfWaypoint::cLATITUDE_AND_LONGITUDE, WsfWaypoint::cLOCATION_MASK, and WsfWaypoint::cRELATIVE_OFFSET.

Referenced by ProcessNavigationInput(), and WsfRoute().

◆ TransformNED()

void WsfRoute::TransformNED ( double aNorth,
double aEast,
double aDown )

Transform an absolute route by a given offset. Only waypoints of type cLATITUDE_AND_LONGITUDE are translated.

Parameters
aNorthThe distance the waypoint will be translated in the north direction (meters).
aEastThe distance the waypoint will be translated in the east direction (meters).
aDownThe distance the waypoint will be translated in the down direction (meters).

References WsfWaypoint::cLATITUDE_AND_LONGITUDE.

Referenced by ProcessNavigationInput(), and WsfRoute().

Member Data Documentation

◆ cTYPE_KIND

const char* WsfRoute::cTYPE_KIND = "route"
staticconstexpr

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved