WSF
WsfPathFinder Class Reference

#include <WsfPathFinder.hpp>

Inheritance diagram for WsfPathFinder:
Collaboration diagram for WsfPathFinder:

Classes

class  pf_cost_func

Public Types

using PFGraph = UtGraphT<WsfPFNode, WsfPFEdge, false, double>
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Public Member Functions

 WsfPathFinder (WsfScenario *aScenarioPtr, WsfGeoPoint &aUpperLeftPtr, WsfGeoPoint &aLowerRightPtr, double aGridSizeDegrees)
 WsfPathFinder (WsfScenario *aScenarioPtr)
 ~WsfPathFinder () override
virtual bool Initialize (WsfSimulation *aSimulationPtr)
bool ProcessInput (UtInput &aInput) override
const char * GetScriptClassName () const override
void AddZone (WsfZone *aZonePtr, double aWeight)
void RemoveZone (WsfZone *aZonePtr)
void RecalculateWeights ()
virtual bool FindPath (const WsfGeoPoint &aStartPtr, WsfGeoPoint &aEndPtr, WsfRoute &aRoute, double &aCost)
virtual const WsfPFNodeGetClosestNode (const WsfGeoPoint &aPointPtr)
void print () const
node_iterator GetGrid (long aX, long aY)
node_iterator GetGridAbsolute (unsigned long idx)
void SetGrid (unsigned long aX, unsigned long aY, node_iterator aIterPtr)
void SetGridAbsolute (unsigned long aX, node_iterator aIterPtr)
void DebugDrawGrid ()
virtual void DebugDrawZones ()
WsfGeoPoint GetNodeLocation (int nodeIndex)
long GetXSize ()
long GetYSize ()
bool GetConsiderNode (const WsfPFNode &aNode)
bool GetConsiderNode (const WsfGeoPoint &aGeoPoint)
int GetNumberOfZones ()
double GetGridSizeDegrees ()
WsfGeoPoint GetUpperLeft ()
WsfGeoPoint GetLowerRight ()
WsfGeoPointFindClosestPointOnEdge (double aSimTime, const WsfGeoPoint &aGeoPoint)
virtual WsfGeoPointFindClosestValidPoint (double aSimTime, const WsfGeoPoint &aGeoPoint)
WsfGeoPointFindClosestPointInQuadrant (const WsfGeoPoint &aGeoPoint, int aQuadrant)
WsfZoneGetZoneByName (const std::string &aZoneName)
bool ComputeFindPath (WsfMover &aMover, WsfRoute &aRoute) override
bool ComputeSetRoute (WsfMover &aMover, WsfRoute &aRoute, int &aInitialPointIndex) override
bool ComputeUpdateRoute (WsfMover &aMover, WsfRoute &aRoute) override
bool ComputeExtrapolate (WsfMover &aMover, WsfRoute &aRoute) override
bool ReturnToRoute (WsfMover &aMover, WsfRoute &aRoute) override
virtual WsfGeoPoint GetRandomLocation ()
virtual void SetDebugEnabled (bool aDebugEnabled)
bool DebugEnabled () const
WsfSimulationGetSimulation () const
Public Member Functions inherited from WsfUncloneableObject
 WsfUncloneableObject ()
WsfObjectClone () const override
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 WsfRouteComputer
virtual ~WsfRouteComputer ()
virtual bool IsNavMesh ()
virtual bool GetEnabled ()

Protected Member Functions

bool ContainsZone (WsfZone *aZonePtr)
bool ContainsZone (const std::string &aZoneName)
bool PointIsInGridBounds (int x, int y)
bool IsDuplicateEdge (node_iterator nodeIter, const WsfPFNode &aNode2, const WsfPFEdge &tmpEdge)
bool shortest_path (const_node_iterator aSrcNodeIter, const_node_iterator aDstNodeIter, NodeList &aPath, double &aCost, const cost_func *aCostFuncPtr=nullptr) const override
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Protected Attributes

WsfScenariomScenarioPtr
WsfSimulationmSimulationPtr
std::list< WsfZone * > mZones
std::map< WsfZone *, double > mZoneWeights
WsfGeoPoint mUpperLeft
WsfGeoPoint mLowerRight
double mGridSizeDegrees
long mXSize
long mYSize
std::vector< node_iterator > mGrid
bool mInitialized
WsfDrawmDebugDrawObjPtr
bool mDebugEnabled

Member Typedef Documentation

◆ PFGraph

using WsfPathFinder::PFGraph = UtGraphT<WsfPFNode, WsfPFEdge, false, double>

Constructor & Destructor Documentation

◆ WsfPathFinder() [1/2]

WsfPathFinder::WsfPathFinder ( WsfScenario * aScenarioPtr,
WsfGeoPoint & aUpperLeftPtr,
WsfGeoPoint & aLowerRightPtr,
double aGridSizeDegrees )

◆ WsfPathFinder() [2/2]

◆ ~WsfPathFinder()

WsfPathFinder::~WsfPathFinder ( )
override

Member Function Documentation

◆ AddZone()

void WsfPathFinder::AddZone ( WsfZone * aZonePtr,
double aWeight )

◆ ComputeExtrapolate()

bool WsfPathFinder::ComputeExtrapolate ( WsfMover & aMover,
WsfRoute & aRoute )
overridevirtual

Called when a mover begins extrapolating at the end of a route.

Parameters
aMoverThe mover that is performing the movement.
aRouteA route which will replace extrapolation behavior if 'true' is returned. Returns 'true' if aRoute was modified.

Reimplemented from WsfRouteComputer.

References WsfRoute::Append(), WsfRoute::Clear(), FindPath(), WsfMover::GetDefaultRoute(), WsfWaypoint::GetLocationLLA(), WsfPlatformPart::GetPlatform(), WsfRoute::GetSize(), WsfRoute::GetWaypointAt(), and WsfObject::SetName().

◆ ComputeFindPath()

bool WsfPathFinder::ComputeFindPath ( WsfMover & aMover,
WsfRoute & aRoute )
overridevirtual

Called when FindAndSetPath is called on a mover

Parameters
aMoverThe mover that is performing the movement.
aRouteThe route to be transformed. Returns 'true' if aRoute was modified.

Reimplemented from WsfRouteComputer.

References ComputeSetRoute().

◆ ComputeSetRoute()

bool WsfPathFinder::ComputeSetRoute ( WsfMover & aMover,
WsfRoute & aRoute,
int & aInitialPointIndex )
overridevirtual

Called when a mover is given an initial route.

Parameters
aMoverThe mover that is performing the movement.
aRouteThe route to be transformed.
aInitialPointIndexThe index of the point within the route where movement is to start. Returns 'true' if aRoute was modified.

Reimplemented from WsfRouteComputer.

References WsfRoute::Append(), FindPath(), WsfWaypoint::GetAlt(), WsfWaypoint::GetLat(), WsfWaypoint::GetLon(), WsfRoute::GetSize(), WsfRoute::GetWaypointAt(), WsfRoute::SetSpeed(), and success.

Referenced by ComputeFindPath(), and ComputeUpdateRoute().

◆ ComputeUpdateRoute()

bool WsfPathFinder::ComputeUpdateRoute ( WsfMover & aMover,
WsfRoute & aRoute )
overridevirtual

Called when a mover is given an updated route.

Parameters
aMoverThe mover that is performing the movement.
aRouteThe route to be transformed. Returns 'true' if aRoute was modified.

Reimplemented from WsfRouteComputer.

References ComputeSetRoute().

◆ ContainsZone() [1/2]

bool WsfPathFinder::ContainsZone ( const std::string & aZoneName)
protected

References mZones.

◆ ContainsZone() [2/2]

bool WsfPathFinder::ContainsZone ( WsfZone * aZonePtr)
protected

References mZones.

Referenced by AddZone().

◆ DebugDrawGrid()

void WsfPathFinder::DebugDrawGrid ( )

◆ DebugDrawZones()

void WsfPathFinder::DebugDrawZones ( )
virtual

◆ DebugEnabled()

bool WsfPathFinder::DebugEnabled ( ) const
inline

References mDebugEnabled.

Referenced by FindClosestValidPoint().

◆ FindClosestPointInQuadrant()

◆ FindClosestPointOnEdge()

WsfGeoPoint * WsfPathFinder::FindClosestPointOnEdge ( double aSimTime,
const WsfGeoPoint & aGeoPoint )

◆ FindClosestValidPoint()

◆ FindPath()

◆ GetClosestNode()

const WsfPFNode * WsfPathFinder::GetClosestNode ( const WsfGeoPoint & aPointPtr)
virtual

◆ GetConsiderNode() [1/2]

bool WsfPathFinder::GetConsiderNode ( const WsfGeoPoint & aGeoPoint)

◆ GetConsiderNode() [2/2]

bool WsfPathFinder::GetConsiderNode ( const WsfPFNode & aNode)

◆ GetGrid()

WsfPathFinder::node_iterator WsfPathFinder::GetGrid ( long aX,
long aY )

◆ GetGridAbsolute()

WsfPathFinder::node_iterator WsfPathFinder::GetGridAbsolute ( unsigned long idx)

◆ GetGridSizeDegrees()

double WsfPathFinder::GetGridSizeDegrees ( )
inline

References mGridSizeDegrees.

◆ GetLowerRight()

WsfGeoPoint WsfPathFinder::GetLowerRight ( )
inline

References mLowerRight.

◆ GetNodeLocation()

WsfGeoPoint WsfPathFinder::GetNodeLocation ( int nodeIndex)

◆ GetNumberOfZones()

int WsfPathFinder::GetNumberOfZones ( )

References mZones.

◆ GetRandomLocation()

WsfGeoPoint WsfPathFinder::GetRandomLocation ( )
virtual

◆ GetScriptClassName()

const char * WsfPathFinder::GetScriptClassName ( ) const
override

◆ GetSimulation()

◆ GetUpperLeft()

WsfGeoPoint WsfPathFinder::GetUpperLeft ( )
inline

References mUpperLeft.

◆ GetXSize()

long WsfPathFinder::GetXSize ( )
inline

◆ GetYSize()

long WsfPathFinder::GetYSize ( )
inline

◆ GetZoneByName()

WsfZone * WsfPathFinder::GetZoneByName ( const std::string & aZoneName)

References mZones.

◆ Initialize()

bool WsfPathFinder::Initialize ( WsfSimulation * aSimulationPtr)
virtual

◆ IsDuplicateEdge()

bool WsfPathFinder::IsDuplicateEdge ( node_iterator nodeIter,
const WsfPFNode & aNode2,
const WsfPFEdge & tmpEdge )
protected

References WsfPFNode::mX, and WsfPFNode::mY.

◆ PointIsInGridBounds()

bool WsfPathFinder::PointIsInGridBounds ( int x,
int y )
protected

References mXSize, and mYSize.

◆ print()

void WsfPathFinder::print ( ) const

References begin(), end(), and mInitialized.

◆ ProcessInput()

bool WsfPathFinder::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.

Reimplemented in WsfTerrainPathFinder.

References AddZone(), WsfZoneDefinition::cPOLYGONAL, WsfObjectTypeList< T >::Find(), WsfScenario::FindType(), WsfScenario::FromInput(), WsfZoneTypes::Get(), WsfGeoPoint::GetLocationWCS(), WsfZoneSet::GetNumZones(), WsfZoneDefinition::GetPoints(), GetSimulation(), WsfZoneSet::GetZoneAtIndex(), mGridSizeDegrees, mLowerRight, mUpperLeft, WsfZone::Point::mX, WsfZone::Point::mY, mZones, mZoneWeights, and WsfGeoPoint::ProcessInput().

Referenced by WsfPathFinderTypes::ProcessBlock().

◆ RecalculateWeights()

void WsfPathFinder::RecalculateWeights ( )

◆ RemoveZone()

void WsfPathFinder::RemoveZone ( WsfZone * aZonePtr)

References mZones, and mZoneWeights.

◆ ReturnToRoute()

◆ SetDebugEnabled()

virtual void WsfPathFinder::SetDebugEnabled ( bool aDebugEnabled)
inlinevirtual

References mDebugEnabled.

◆ SetGrid()

void WsfPathFinder::SetGrid ( unsigned long aX,
unsigned long aY,
node_iterator aIterPtr )

References mGrid, and mXSize.

Referenced by Initialize(), and WsfTerrainPathFinder::Initialize().

◆ SetGridAbsolute()

void WsfPathFinder::SetGridAbsolute ( unsigned long aX,
node_iterator aIterPtr )

References mGrid.

Referenced by WsfNavigationMesh::InsertCellIntoGrid().

◆ shortest_path()

bool WsfPathFinder::shortest_path ( const_node_iterator aSrcNodeIter,
const_node_iterator aDstNodeIter,
NodeList & aPath,
double & aCost,
const cost_func * aCostFuncPtr = nullptr ) const
overrideprotected

References mInitialized.

Referenced by FindPath().

Member Data Documentation

◆ mDebugDrawObjPtr

◆ mDebugEnabled

bool WsfPathFinder::mDebugEnabled
protected

◆ mGrid

◆ mGridSizeDegrees

◆ mInitialized

◆ mLowerRight

◆ mScenarioPtr

WsfScenario* WsfPathFinder::mScenarioPtr
protected

Referenced by WsfPathFinder(), and WsfPathFinder().

◆ mSimulationPtr

◆ mUpperLeft

◆ mXSize

◆ mYSize

◆ mZones

◆ mZoneWeights

std::map<WsfZone*, double> WsfPathFinder::mZoneWeights
protected

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