29#ifndef WSFPATHFINDER_HPP
30#define WSFPATHFINDER_HPP
32#include "wsf_export.h"
107 public UtGraphT<WsfPFNode, WsfPFEdge, false, double>,
111 using PFGraph = UtGraphT<WsfPFNode, WsfPFEdge, false, double>;
137 node_iterator
GetGrid(
long aX,
long aY);
139 void SetGrid(
unsigned long aX,
unsigned long aY, node_iterator aIterPtr);
149 bool GetConsiderNode(
const WsfPFNode& aNode);
150 bool GetConsiderNode(
const WsfGeoPoint& aGeoPoint);
151 int GetNumberOfZones();
158 WsfZone* GetZoneByName(
const std::string& aZoneName);
161 bool ComputeSetRoute(
WsfMover& aMover,
WsfRoute& aRoute,
int& aInitialPointIndex)
override;
172 bool ContainsZone(
WsfZone* aZonePtr);
173 bool ContainsZone(
const std::string& aZoneName);
175 bool PointIsInGridBounds(
int x,
int y);
179 bool IsDuplicateEdge(node_iterator nodeIter,
const WsfPFNode& aNode2,
const WsfPFEdge& tmpEdge);
180 bool shortest_path(const_node_iterator aSrcNodeIter,
181 const_node_iterator aDstNodeIter,
184 const cost_func* aCostFuncPtr =
nullptr)
const override;
227 return (aNode1.
mWeight == std::numeric_limits<double>::max() ?
false :
true);
257 void Add(std::unique_ptr<WsfPathFinder> aPathFinderPtr);
263 using PathFinderMap = std::map<std::string, std::unique_ptr<WsfPathFinder>>;
266 PathFinderMap mPathFinders;
bool operator!=(int aId, const WsfStringInt &aRhs)
Not equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:75
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Provides the capability to draw shapes into the WSF replay file.
Definition WsfDraw.hpp:35
Definition WsfGeoPoint.hpp:29
double GetDistanceFrom(double aLocationWCS[3]) const
Definition WsfGeoPoint.cpp:151
Definition WsfMover.hpp:37
WsfObjectTypeList(WsfScenario &aScenario, unsigned int aFlags, const std::string &aBlockName)
Definition WsfObjectTypeList.hpp:76
Definition WsfPathFinder.hpp:58
std::vector< WsfPFNode * > mNeighbors
Definition WsfPathFinder.hpp:72
float mNormalAngle
Definition WsfPathFinder.hpp:75
WsfGeoPoint mLoc
Definition WsfPathFinder.hpp:79
bool mMarkedPt
Definition WsfPathFinder.hpp:78
void setMarked(bool b)
Definition WsfPathFinder.cpp:1333
WsfPFNode(long aX, long aY, float aBaseWeight, WsfGeoPoint &aLoc)
Definition WsfPathFinder.cpp:1301
bool operator<(const WsfPFNode &aRhs) const
Definition WsfPathFinder.cpp:1328
int mNetworkIndex
Definition WsfPathFinder.hpp:80
long mY
Definition WsfPathFinder.hpp:74
long mX
Definition WsfPathFinder.hpp:73
bool getMarked()
Definition WsfPathFinder.cpp:1338
float mBaseWeight
Definition WsfPathFinder.hpp:76
void AddNeighbor(WsfPFNode *aNodePtr)
Definition WsfPathFinder.cpp:1343
double mWeight
Definition WsfPathFinder.hpp:77
WsfPathFinder * Find(const std::string &aPathFinderName) const
Definition WsfPathFinder.cpp:1465
bool Initialize(WsfSimulation *aSimulationPtr)
Definition WsfPathFinder.cpp:1484
void Add(std::unique_ptr< WsfPathFinder > aPathFinderPtr)
Definition WsfPathFinder.cpp:1475
WsfPathFinderList()
Definition WsfPathFinder.cpp:1459
~WsfPathFinderList()=default
WsfPathFinderTypes(WsfScenario &aScenario)
Definition WsfPathFinder.cpp:1353
std::unique_ptr< WsfPathFinder > ProcessPathFinderInput(UtInput &aInput)
Definition WsfPathFinder.cpp:1358
virtual LoadResult LoadInstance(UtInput &aInput)
Create an instance of a 'type object' of this class.
Definition WsfPathFinder.cpp:1398
void ProcessBlock(UtInputBlock &aInputBlock, WsfPathFinder *aPFPtr, bool init)
Definition WsfPathFinder.cpp:1432
bool ProcessInput(UtInput &aInput) override
Definition WsfPathFinder.cpp:1454
Definition WsfPathFinder.hpp:209
double operator()(const WsfPFNode &aNode1, const WsfPFNode &aNode2) const override
Definition WsfPathFinder.hpp:217
bool consider_node(const WsfPFNode &aNode1) const override
Definition WsfPathFinder.hpp:224
double operator()(const WsfPFEdge &aEdge, const WsfPFNode &aNode1, const WsfPFNode &aNode2) const override
Definition WsfPathFinder.hpp:211
Definition WsfPathFinder.hpp:109
WsfDraw * mDebugDrawObjPtr
Definition WsfPathFinder.hpp:205
std::vector< node_iterator > mGrid
Definition WsfPathFinder.hpp:199
long mXSize
Definition WsfPathFinder.hpp:196
UtGraphT< WsfPFNode, WsfPFEdge, false, double > PFGraph
Definition WsfPathFinder.hpp:111
double mGridSizeDegrees
Definition WsfPathFinder.hpp:194
virtual void DebugDrawZones()
Definition WsfPathFinder.cpp:1052
WsfPathFinder(WsfScenario *aScenarioPtr, WsfGeoPoint &aUpperLeftPtr, WsfGeoPoint &aLowerRightPtr, double aGridSizeDegrees)
Definition WsfPathFinder.cpp:64
void RecalculateWeights()
Definition WsfPathFinder.cpp:259
const char * GetScriptClassName() const override
Definition WsfPathFinder.cpp:1295
void RemoveZone(WsfZone *aZonePtr)
Definition WsfPathFinder.cpp:216
node_iterator GetGridAbsolute(unsigned long idx)
Definition WsfPathFinder.cpp:423
WsfGeoPoint GetLowerRight()
Definition WsfPathFinder.hpp:154
WsfGeoPoint mUpperLeft
Definition WsfPathFinder.hpp:191
WsfSimulation * mSimulationPtr
Definition WsfPathFinder.hpp:187
WsfGeoPoint mLowerRight
Definition WsfPathFinder.hpp:192
long GetXSize()
Definition WsfPathFinder.hpp:147
bool ProcessInput(UtInput &aInput) override
Definition WsfPathFinder.cpp:465
std::list< WsfZone * > mZones
Definition WsfPathFinder.hpp:188
void SetGrid(unsigned long aX, unsigned long aY, node_iterator aIterPtr)
Definition WsfPathFinder.cpp:454
WsfSimulation * GetSimulation() const
Definition WsfPathFinder.hpp:169
double GetGridSizeDegrees()
Definition WsfPathFinder.hpp:152
void print() const
Definition WsfPathFinder.cpp:368
bool mDebugEnabled
Definition WsfPathFinder.hpp:206
WsfGeoPoint GetUpperLeft()
Definition WsfPathFinder.hpp:153
WsfGeoPoint GetNodeLocation(int nodeIndex)
Definition WsfPathFinder.cpp:428
void AddZone(WsfZone *aZonePtr, double aWeight)
Definition WsfPathFinder.cpp:206
bool DebugEnabled() const
Definition WsfPathFinder.hpp:168
virtual bool FindPath(const WsfGeoPoint &aStartPtr, WsfGeoPoint &aEndPtr, WsfRoute &aRoute, double &aCost)
Definition WsfPathFinder.cpp:314
virtual void SetDebugEnabled(bool aDebugEnabled)
Definition WsfPathFinder.hpp:167
virtual bool Initialize(WsfSimulation *aSimulationPtr)
Definition WsfPathFinder.cpp:102
node_iterator GetGrid(long aX, long aY)
Definition WsfPathFinder.cpp:418
long mYSize
Definition WsfPathFinder.hpp:197
void SetGridAbsolute(unsigned long aX, node_iterator aIterPtr)
Definition WsfPathFinder.cpp:459
std::map< WsfZone *, double > mZoneWeights
Definition WsfPathFinder.hpp:189
long GetYSize()
Definition WsfPathFinder.hpp:148
void DebugDrawGrid()
Definition WsfPathFinder.cpp:1029
WsfScenario * mScenarioPtr
Definition WsfPathFinder.hpp:186
virtual const WsfPFNode * GetClosestNode(const WsfGeoPoint &aPointPtr)
Definition WsfPathFinder.cpp:292
bool mInitialized
Definition WsfPathFinder.hpp:200
Definition WsfRouteComputer.hpp:26
A collection of WsfWaypoint objects that represent a path to be followed.
Definition WsfRoute.hpp:40
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
WsfScriptObjectClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfScriptObjectClass.cpp:24
UT_DECLARE_SCRIPT_METHOD(RandomLocation)
UT_DECLARE_SCRIPT_METHOD(NearEndOfPath)
UT_DECLARE_SCRIPT_METHOD(FindClosestValidPoint)
UT_DECLARE_SCRIPT_METHOD(FindClosestPointOnEdge)
UT_DECLARE_SCRIPT_METHOD(DebugDrawGrid)
UT_DECLARE_SCRIPT_METHOD(SetDebugEnabled)
WsfScriptPathFinderClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfPathFinder.cpp:1083
UT_DECLARE_SCRIPT_METHOD(DebugEnabled)
UT_DECLARE_SCRIPT_METHOD(DebugDrawZones)
The main controller for a simulation.
Definition WsfSimulation.hpp:109
WsfUncloneableObject()
Definition WsfObject.hpp:148
Definition WsfZone.hpp:63
Definition WsfPathFinder.hpp:87
WsfPFNode * mDstNodePtr
Definition WsfPathFinder.hpp:101
bool operator==(const WsfPFEdge &aRhs) const
Definition WsfPathFinder.hpp:95
double mLength
Definition WsfPathFinder.hpp:102
WsfPFEdge(WsfPFNode *aSrcNodePtr, WsfPFNode *aDstNodePtr)
Definition WsfPathFinder.hpp:88
WsfPFNode * mSrcNodePtr
Definition WsfPathFinder.hpp:100