VR-Forces 4.10 Class Documentation
 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 
19 #include <boost/shared_ptr.hpp>
20 
21 class DtRailPathTask;
24 class DtAsyncJobMapEntry;
25 
57 {
58 private:
65 
66 public:
67 
70  DtRailPathController(const DtString& name,
71  DtVrfObject* owner,
72  DtSimManager* simManager,
73  DtComponentDescriptor* desc = NULL,
74  DtReaderWriterRegistry* parentRegistry = NULL);
75 
76  virtual ~DtRailPathController();
77 
79  virtual bool init();
80 
86  virtual bool createPSR();
87 
88  virtual void preFirstTickInit();
89 
90  static void railTaskCallback(DtSimMessage* msg, void* usr, DtSimTaskStatePtr taskStatePtr);
91 
92  virtual DtSimTaskStatePtr currentTaskState() const;
93 
96  virtual const char* type() const;
97 
99  virtual void registerTaskMsgCallbacks();
100 
101  static void taskCompleteReportCallback(DtSimMessage* msg, void* usr);
102 
103  virtual void processTaskCompleteReport(DtSimMessage* msg);
104 
105  static void destinationChangedCallback(const DtVrfObject* obj, void* usrData);
106 
111  virtual void processDestinationChanged(const DtVrfObject* obj);
112 
115 
116  static void objectAboutToBeRemovedCallback(const DtVrfObject* obj, void* usr);
117  virtual void processObjectAboutToBeRemoved(const DtVrfObject* obj);
119 
123 
124  static void setLocationCompleteCallback(const DtVrfObject*, void* usr);
125  virtual void processSetLocationComplete();
127 
129  virtual void tick();
130 
131 protected:
132  virtual void processRailTask(const DtTaskMessage& msg, DtSimTaskStatePtr taskStatePtr);
133 
134  virtual void clearCurrentPath();
135  virtual bool setupPathFromRailList(DtRailSegmentList*, bool testRange = true);
136  virtual bool setupPathFromRoute(const DtVrfObject* route, bool startClosestPoint, DtIteratorDirection traversalDirection);
137 
139  virtual bool isEntityCloseEnoughToRoad(
140  DtRailSegment* railSegment, double distance, double& actualDistSq) const;
141 
143  virtual bool isEntityOnRoad(DtRailSegment* railSegment) const;
144 
145  double maxSearchRadius(const DtVector& start, const DtVector& end);
146 
150  virtual void registerDestinationChangedCallback();
151 
154  virtual void unregisterDestinationChangedCallback();
155 
157  virtual bool setupPathToDestination(const DtVector& start, const DtVector& end);
158 
162  virtual void clearTask();
163 
164  static void destinationDiscovered(void*);
165  virtual void processDestinationDiscovered();
166 
167 public:
168 
172  static DtSimComponent * creator(const DtString& name,
173  DtVrfObject* owner,
174  DtSimManager* simManager,
175  DtComponentDescriptor* desc = 0,
176  DtReaderWriterRegistry* parentRegistry = 0);
177 
178 protected:
180  boost::shared_ptr<DtAsyncJobMapEntry> myPathJobEntry;
181 
185 
188 };
189 
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
bool myDestinationChangedCallbackRegistered
Definition: railPathController.h:187
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:197
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:23
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
Definition: readerWriterRegistry.h:39
virtual const char * type() const =0
Returns a string identifies the class type of component.
virtual bool init()
Calls setRadio()
DtRailPathControllerPSR * myProcessState
Container for state data associated with this component.
Definition: railPathController.h:184
virtual void clearTask()
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
DtBoost::shared_ptr< DtSimTaskState > DtSimTaskStatePtr
Definition: taskAndTaskStateDefines.h:18
DtRailPathControllerDescriptor; descriptor for the DDtRailPathController component.
Definition: railPathControllerDescriptor.h:23
DtIteratorDirection
Definition: iteratorBase.h:23
const DtRailPathControllerDescriptor * myPathDescriptor
Definition: railPathController.h:186
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
File: simMsg.h.
Definition: simMessage.h:35
virtual void tick()
This gives the thread of control to the component.
virtual DtSimTaskStatePtr currentTaskState() const
class DtRailPathControllerPSR:
Definition: railPathControllerPSR.h:27
DtRailPathController is a controller that models movement along a generated path for an entity making...
Definition: railPathController.h:56
Handle to async job.
Definition: asyncJobMapEntry.h:29
boost::shared_ptr< DtAsyncJobMapEntry > myPathJobEntry
Token for asynchronous path plan task.
Definition: railPathController.h:180
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
File: railPathTask.h.
Definition: railPathTask.h:45
A DtTaskMsg is a DtRadioMsg with a pointer to a task.
Definition: taskMessage.h:19

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)