![]() |
VR-Forces 4.0.4 Class Documentation
|
DtSurfaceEntityPatrolRouteController is a controller that models patrolling along a route for surface entities. More...

Public Member Functions | |
| DtSurfaceEntityPatrolRouteController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtSurfaceEntityPatrolRouteController () |
| destructor | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | processPatrolRouteTask (DtSimMessage *msg) |
| Retrives the name of the route for the patrol from the task message. | |
| virtual void | registerTaskMsgCallbacks () |
| Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolRouteCallback as the function pointer, and the 'this' pointer as the user data. | |
| virtual void | doMoving (double desiredSpeed) |
| Overridden to call sailTo, preventing the base class from using a driftTo which would cause the entity to stop. | |
| virtual bool | targetNextVertex () |
| Overridden to continually loop route state. | |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| static void | patrolRouteCallback (DtSimMessage *msg, void *usrData) |
| Called when a patrol route message is received. | |
Protected Member Functions | |
| DtSurfaceEntityPatrolRouteController () | |
| Default constructor; not implemented. | |
| DtSurfaceEntityPatrolRouteController (const DtSurfaceEntityPatrolRouteController &orig) | |
| copy constructor; not implemented | |
| const DtSurfaceEntityPatrolRouteController & | operator= (const DtSurfaceEntityPatrolRouteController &orig) |
| assignment operator; not implemented | |
DtSurfaceEntityPatrolRouteController is a controller that models patrolling along a route for surface entities.
End User Description:
DtSurfaceEntityPatrolRouteController (surfEntPtrlRt.h) is derived from DtSurfaceEntityMoveAlongController. It changes the functionality of DtSurfaceEntityMoveAlongController from Move Along Route to Patrol Along Route by modifying the route state when the end of a route is reached, instead of completing the task. DtSurfaceEntityPatrolRouteController adds uses the reverse flag from the process state repository to keep track of the direction in which the route is being followed. It overrides registerTaskMsgCallbacks() to register for DtPatrolRouteType. By overriding doMoving(), the controller can insure that sailTo() is always called (as opposed to the base class which calls driftTo() at the end of the route). Overriding targetNextVertex() allows continuous iteration back and forth through the vertices, and maintains the reverse flag.
Uses Descriptor Type: DtSurfaceEntityPilotControllerDescriptor
| DtSurfaceEntityPatrolRouteController::DtSurfaceEntityPatrolRouteController | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtSurfaceEntityPatrolRouteController::~DtSurfaceEntityPatrolRouteController | ( | ) | [virtual] |
destructor
Default constructor; not implemented.
| DtSurfaceEntityPatrolRouteController::DtSurfaceEntityPatrolRouteController | ( | const DtSurfaceEntityPatrolRouteController & | orig | ) | [protected] |
copy constructor; not implemented
| static DtSimComponent* DtSurfaceEntityPatrolRouteController::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
Reimplemented from DtSurfaceEntityMoveAlongController.
| virtual DtString DtSurfaceEntityPatrolRouteController::type | ( | ) | const [virtual] |
Returns a string identifies the class type of component.
Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.
Reimplemented from DtSurfaceEntityMoveAlongController.
| static void DtSurfaceEntityPatrolRouteController::patrolRouteCallback | ( | DtSimMessage * | msg, |
| void * | usrData | ||
| ) | [static] |
Called when a patrol route message is received.
Instances of this component will register this callback in registerTaskMsgCallbacks (with their own 'this' pointer as user data) by calling addTaskProcessorCallback in order to request for notification of patrol route tasks. When this callback is activated, the user data pointer is cast to an instance of this class upon which processPatrolRouteTask is called with the patrol route task message.
| virtual void DtSurfaceEntityPatrolRouteController::processPatrolRouteTask | ( | DtSimMessage * | msg | ) | [virtual] |
Retrives the name of the route for the patrol from the task message.
Called by patrolRouteCallback to store the names of the route in the process state repository. The reverse flag in the PSR is reset to false. The route is lookup up in the object manager and a pointer to it is stored in myRoute. The route verticies are then copied in the route state in the process state repository and setToClosest is called on the PSR with the location of the entity. A verticesChangedCallback is added on the route with routeChangedCallback as the function pointer. The myRouteHasChanged flag is set to false. A call is made to setupControlPoint() to initilize the base class.
| virtual void DtSurfaceEntityPatrolRouteController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolRouteCallback as the function pointer, and the 'this' pointer as the user data.
Reimplemented from DtSurfaceEntityMoveAlongController.
| virtual void DtSurfaceEntityPatrolRouteController::doMoving | ( | double | desiredSpeed | ) | [virtual] |
Overridden to call sailTo, preventing the base class from using a driftTo which would cause the entity to stop.
Reimplemented from DtSurfaceEntityMoveAlongController.
| virtual bool DtSurfaceEntityPatrolRouteController::targetNextVertex | ( | ) | [virtual] |
Overridden to continually loop route state.
Checks to see if the current vertex in the route state (from the process state repository) is the last vertex in the route. If so the reverse flag is flipped, and the route state is reset. Once the route state is upddated, next() is called to advance to the next vertex, setupControlPoint() is called to initilize the base class and doMoving() is called with findDesiredSpeed().
Reimplemented from DtSurfaceEntityMoveAlongController.
| const DtSurfaceEntityPatrolRouteController& DtSurfaceEntityPatrolRouteController::operator= | ( | const DtSurfaceEntityPatrolRouteController & | orig | ) | [protected] |
assignment operator; not implemented