VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
railPathController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
15 #include <matrix/vlVector.h>
17 #include "vrfutil/railSegment.h"
18 #include "features/aStarGraph.h"
19 
20 
21 class DtRailPathTask;
24 class DtAsyncJobMapEntry;
25 class DtScriptedTaskTask;
26 
58 {
59 private:
66 
67 public:
68 
71  DtRailPathController(const DtString& name,
72  DtLocalObject* owner,
73  DtSimulationServices* simManager,
74  DtComponentDescriptor* desc = NULL,
75  DtReaderWriterRegistry* parentRegistry = NULL);
76 
77  virtual ~DtRailPathController() override;
78 
80  virtual bool init() override;
81 
87  virtual bool createPSR();
88 
89  virtual void preFirstTickInit() override;
90 
91  static void railTaskCallback(DtSimMessage* msg, void* usr, DtSimTaskStatePtr taskStatePtr);
92  static void scriptedTaskCallback(DtSimMessage* msg, void* usr, DtSimTaskStatePtr taskStatePtr);
93  static void deprecatedMovementTaskCallback(DtSimMessage* msg, void* usr, DtSimTaskStatePtr taskStatePtr);
94 
95  virtual DtSimTaskStatePtr currentTaskState() const override;
96 
99  virtual const char* type() const override;
100 
102  virtual void registerTaskMsgCallbacks() override;
103 
104  static void taskCompleteReportCallback(DtSimMessage* msg, void* usr);
105 
106  virtual void processTaskCompleteReport(DtSimMessage* msg);
107  virtual void processDeprecatedMovementTask(DtSimMessage* msg, DtSimTaskStatePtr taskStatePtr);
108 
109  static void destinationChangedCallback(const DtLocalObject* obj, void* usrData);
110 
115  virtual void processDestinationChanged();
116 
120 
121  virtual void processSetLocationComplete();
123 
125  virtual void tick() override;
126 
129  virtual MAKVRinTerra::DtAStarGraph::DtWeightFactorsList featureWeights();
130 
133  virtual double offRoadPathWeight() const;
134 
135 protected:
137  virtual void processRailTaskMsg(const DtTaskMessage& msg, DtSimTaskStatePtr taskStatePtr);
139  virtual void processScriptedRoadTaskMsg(const DtTaskMessage& msg, DtSimTaskStatePtr taskStatePtr);
141  virtual void processRailPathTask(const DtRailPathTask* task, DtSimTaskStatePtr taskStatePtr);
142 
143 
144  virtual void clearCurrentPath();
145  virtual bool setupPathFromRailList(DtRailSegmentList*, bool testRange = true);
146  virtual bool setupPathFromRoute(const DtSimObject* route, bool startClosestPoint, DtIteratorDirection traversalDirection);
147 
149  virtual bool isEntityCloseEnoughToRoad(
150  DtRailSegment* railSegment, double distance, double& actualDistSq) const;
151 
153  virtual bool isEntityOnRoad(DtRailSegment* railSegment) const;
154 
155  double maxSearchRadius(const DtVector& start, const DtVector& end);
156 
158  virtual bool setupPathToDestination(const DtVector& start, const DtVector& end);
159 
163  virtual void clearTask() override;
164 
165 public:
166 
170  static DtSimComponent * creator(const DtString& name,
171  DtLocalObject* owner,
172  DtSimulationServices* simManager,
173  DtComponentDescriptor* desc = 0,
174  DtReaderWriterRegistry* parentRegistry = 0);
175 
176 protected:
178  std::shared_ptr<DtAsyncJobMapEntry> myPathJobEntry;
179 
183 
186 
188  boost::signals2::scoped_connection mySetLocationCompleteConnection;
189 };
190 
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
bool myDestinationChangedCallbackRegistered
Definition: railPathController.h:185
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:194
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtSimObjectReference myDestination
Bookkeeping for callback registration.
Definition: railPathController.h:187
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
DtRailSegment are segments entities can follow when using the rail movement system.
Definition: railSegment.h:20
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
std::shared_ptr< DtSimTaskState > DtSimTaskStatePtr
Definition: taskAndTaskStateDefines.h:18
DtRailPathControllerPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: railPathController.h:182
std::list< DtWeightFactor > DtWeightFactorsList
Definition: aStarGraph.h:229
DtRailPathControllerDescriptor; descriptor for the DDtRailPathController component.
Definition: railPathControllerDescriptor.h:23
virtual bool init() override
Calls setRadio()
DtIteratorDirection
Definition: iteratorBase.h:23
const DtRailPathControllerDescriptor * myPathDescriptor
Definition: railPathController.h:184
std::shared_ptr< DtAsyncJobMapEntry > myPathJobEntry
Token for asynchronous path plan task.
Definition: railPathController.h:178
Specialized classes.
Definition: scriptedTaskTask.h:277
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
File: simMsg.h.
Definition: simMessage.h:35
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
virtual DtSimTaskStatePtr currentTaskState() const
class DtRailPathControllerPSR:
Definition: railPathControllerPSR.h:28
DtRailPathController is a controller that models movement along a generated path for an entity making...
Definition: railPathController.h:57
Handle to async job.
Definition: asyncJobMapEntry.h:29
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:80
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
virtual void clearTask() override
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
File: railPathTask.h.
Definition: railPathTask.h:45
A DtTaskMsg is a DtRadioMsg with a pointer to a task. The type of the taskMsg is just the type of the...
Definition: taskMessage.h:21
A locally simulated VRF object.
Definition: localObject.h:98
boost::signals2::scoped_connection mySetLocationCompleteConnection
Definition: railPathController.h:188

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)