WSF
WsfRouteNetwork Class Reference

A collection of WsfRoute object that represents a connected network (such as a road network). More...

#include <WsfRouteNetwork.hpp>

Inheritance diagram for WsfRouteNetwork:
Collaboration diagram for WsfRouteNetwork:

Classes

class  RoutePoint
 Specifies a location along a route. More...
struct  RouteNode
 Represents a node key for use with the RouteGraph class. More...
struct  RouteEdge
 Represents an edge key for use with the RouteGraph class. More...
class  RouteCostFunc
 A cost function used by the shortest_path algorithm provided by the RouteGraph class. More...

Public Types

using WaypointAddr = std::pair<int, int>
 A waypoint address. Minimal information required to look up a waypoint.
using WaypointAddrList = std::vector<WaypointAddr>
using RouteGraph = UtGraphT<RouteNode, RouteEdge, false, double>
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Public Member Functions

 WsfRouteNetwork ()
WsfRouteNetworkoperator= (const WsfRouteNetwork &)=delete
 ~WsfRouteNetwork () override
WsfRouteNetworkClone () const override
bool ProcessInput (UtInput &aInput) override
bool Initialize ()
WSF_DEPRECATED bool Add (WsfRoute *aRoute)
bool Add (std::unique_ptr< WsfRoute > aRoutePtr)
bool AppendShortestPathOnNetwork (RoutePoint aPoint1, RoutePoint aPoint2, WsfRoute &aPath)
bool GenerateShortestPathBetweenWaypoints (const WsfWaypoint &aFromWaypoint, const WsfWaypoint &aToWaypoint, WsfRoute &aPath)
bool GeneratePathOffRouteToRoute (double aStartLat, double aStartLon, double aEndLat, double aEndLon, WsfRoute &aPath)
bool GeneratePathBetweenClosestWaypoints (double aStartLat, double aStartLon, double aEndLat, double aEndLon, WsfRoute &aPath)
bool GeneratePathBetweenClosestSegments (double aStartLat, double aStartLon, double aEndLat, double aEndLon, WsfRoute &aPath, bool aLeaveRouteNetwork=true)
bool FindClosestWaypoint (double aLat, double aLon, WsfWaypoint &aWpt, double &aDistance)
 Returns the closest waypoint relative to the provided latitude and longitude.
bool FindClosestSegment (double aLat, double aLon, RoutePoint &aProjectedPoint, double &aDistanceToSegment)
unsigned int GetRouteCount () const
WsfRouteoperator[] (unsigned int aIndex)
 Return a reference to the route by index in the network.
std::vector< const WsfRoute * > GetRoutes () const
 Returns the list of routes in the route network.
void Append (const RoutePoint &aPoint, WsfRoute &aRoute)
void AppendSubroute (const RoutePoint &aPoint1, const RoutePoint &aPoint2, WsfRoute &aRoute)
 Append a sub-route between aPoint1 and aPoint2, which share the same route.
int GetAdjacentNodeIndices (const RoutePoint &aPoint, int *aIndices)
void BuildQuadtree ()
const RouteGraphGetGraph () const
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)

Static Public Member Functions

static std::unique_ptr< UtScriptClass > CreateScriptClass (const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
static bool CompareWaypointAddrRoute (const WaypointAddr &aLhs, const WaypointAddr &aRhs)

Public Attributes

WsfStringId cSTART_NODE_ID
WsfStringId cSTOP_NODE_ID

Protected Member Functions

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

Friends

struct RouteCostFunc

Detailed Description

A collection of WsfRoute object that represents a connected network (such as a road network).

Member Typedef Documentation

◆ RouteGraph

using WsfRouteNetwork::RouteGraph = UtGraphT<RouteNode, RouteEdge, false, double>

◆ WaypointAddr

using WsfRouteNetwork::WaypointAddr = std::pair<int, int>

A waypoint address. Minimal information required to look up a waypoint.

◆ WaypointAddrList

Constructor & Destructor Documentation

◆ WsfRouteNetwork() [1/2]

◆ ~WsfRouteNetwork()

WsfRouteNetwork::~WsfRouteNetwork ( )
override

◆ WsfRouteNetwork() [2/2]

WsfRouteNetwork::WsfRouteNetwork ( const WsfRouteNetwork & aSrc)
protected

Copy constructor (for Clone()).

References cSTART_NODE_ID, cSTOP_NODE_ID, WsfObject::WsfObject(), and WsfRouteNetwork().

Member Function Documentation

◆ Add() [1/2]

bool WsfRouteNetwork::Add ( std::unique_ptr< WsfRoute > aRoutePtr)

◆ Add() [2/2]

bool WsfRouteNetwork::Add ( WsfRoute * aRoute)

References Add().

Referenced by Add(), operator=(), and ProcessInput().

◆ Append()

◆ AppendShortestPathOnNetwork()

◆ AppendSubroute()

void WsfRouteNetwork::AppendSubroute ( const RoutePoint & aPoint1,
const RoutePoint & aPoint2,
WsfRoute & aRoute )

◆ BuildQuadtree()

void WsfRouteNetwork::BuildQuadtree ( )

Referenced by Initialize(), and RouteCostFunc.

◆ Clone()

WsfRouteNetwork * WsfRouteNetwork::Clone ( ) const
overridevirtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements WsfObject.

References WsfRouteNetwork().

◆ CompareWaypointAddrRoute()

bool WsfRouteNetwork::CompareWaypointAddrRoute ( const WaypointAddr & aLhs,
const WaypointAddr & aRhs )
inlinestatic

◆ CreateScriptClass()

std::unique_ptr< UtScriptClass > WsfRouteNetwork::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.

Referenced by operator=(), and WsfScriptManager::RegisterTypes().

◆ FindClosestSegment()

bool WsfRouteNetwork::FindClosestSegment ( double aLat,
double aLon,
RoutePoint & aProjectedPoint,
double & aDistanceToSegment )

◆ FindClosestWaypoint()

bool WsfRouteNetwork::FindClosestWaypoint ( double aLat,
double aLon,
WsfWaypoint & aWpt,
double & aDistance )

Returns the closest waypoint relative to the provided latitude and longitude.

References Initialize().

Referenced by GeneratePathBetweenClosestWaypoints(), and operator=().

◆ GeneratePathBetweenClosestSegments()

bool WsfRouteNetwork::GeneratePathBetweenClosestSegments ( double aStartLat,
double aStartLon,
double aEndLat,
double aEndLon,
WsfRoute & aPath,
bool aLeaveRouteNetwork = true )

Creates the following path: ShortestPath(Wpt1, Wpt2) where, Wpt1 - the closest waypoint or segment normal projection to (aStartLat, aStartLon) Wpt2 - the closest waypoint or segment normal projection to (aEndLat, aEndLon) ShortestPath(Wpt1, Wpt2) - the shortest path between Wpt1 to Wpt2 including both Wpt1 and Wpt2. If aLeaveRouteNetwork is true, the mover will go to the specified aEndLat/aEndLon after reaching the closest point on the route network.

References WsfRoute::Append(), AppendShortestPathOnNetwork(), WsfRoute::Clear(), FindClosestSegment(), Initialize(), WsfWaypoint::SetLat(), and WsfWaypoint::SetLon().

Referenced by WsfRoadMover::CreateRoute(), and operator=().

◆ GeneratePathBetweenClosestWaypoints()

bool WsfRouteNetwork::GeneratePathBetweenClosestWaypoints ( double aStartLat,
double aStartLon,
double aEndLat,
double aEndLon,
WsfRoute & aPath )

Creates the following path: ShortestPath(Wpt1, Wpt2) where, Wpt1 - the closest waypoint to (aStartLat, aStartLon) Wpt2 - the closest waypoint to (aEndLat, aEndLon) ShortestPath(Wpt1, Wpt2) - the shortest path between Wpt1 to Wpt2 including both Wpt1 and Wpt2.

References WsfRoute::Clear(), FindClosestWaypoint(), and GenerateShortestPathBetweenWaypoints().

Referenced by WsfRoadMover::CreateRoute(), GeneratePathOffRouteToRoute(), and operator=().

◆ GeneratePathOffRouteToRoute()

bool WsfRouteNetwork::GeneratePathOffRouteToRoute ( double aStartLat,
double aStartLon,
double aEndLat,
double aEndLon,
WsfRoute & aPath )

Creates the following path: (aStartLat, aStartLon) -> ShortestPath(Wpt1, Wpt2) -> (aEndLat, aEndLon) where, Wpt1 - the closest waypoint to (aStartLat, aStartLon) Wpt2 - the closest waypoint to (aEndLat, aEndLon) ShortestPath(Wpt1, Wpt2) - the shortest path between Wpt1 to Wpt2 including both Wpt1 and Wpt2.

References WsfRoute::Append(), WsfRoute::Clear(), WsfRoute::Empty(), GeneratePathBetweenClosestWaypoints(), WsfRoute::GetSize(), WsfWaypoint::SetLat(), and WsfWaypoint::SetLon().

Referenced by operator=().

◆ GenerateShortestPathBetweenWaypoints()

bool WsfRouteNetwork::GenerateShortestPathBetweenWaypoints ( const WsfWaypoint & aFromWaypoint,
const WsfWaypoint & aToWaypoint,
WsfRoute & aPath )

◆ GetAdjacentNodeIndices()

◆ GetGraph()

const RouteGraph & WsfRouteNetwork::GetGraph ( ) const
inline

◆ GetRouteCount()

unsigned int WsfRouteNetwork::GetRouteCount ( ) const
inline

◆ GetRoutes()

std::vector< const WsfRoute * > WsfRouteNetwork::GetRoutes ( ) const

Returns the list of routes in the route network.

Referenced by UT_DEFINE_SCRIPT_METHOD().

◆ Initialize()

bool WsfRouteNetwork::Initialize ( )

◆ operator=()

◆ operator[]()

WsfRoute & WsfRouteNetwork::operator[] ( unsigned int aIndex)

Return a reference to the route by index in the network.

◆ ProcessInput()

bool WsfRouteNetwork::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 Add(), WsfScenario::FromInput(), WsfRouteTypes::Get(), and WsfObject::GetName().

◆ RouteCostFunc

friend struct RouteCostFunc
friend

References BuildQuadtree().

Member Data Documentation

◆ cSTART_NODE_ID

WsfStringId WsfRouteNetwork::cSTART_NODE_ID

◆ cSTOP_NODE_ID

WsfStringId WsfRouteNetwork::cSTOP_NODE_ID

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