![]() |
VR-Forces 4.0.4 Class Documentation
|
DtSurfaceEntityPatrolBetweenController; patrol between waypoint behavior for a surface entity. More...

Public Member Functions | |
| DtSurfaceEntityPatrolBetweenController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtSurfaceEntityPatrolBetweenController () |
| destructor | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | processPatrolBetweenTask (DtSimMessage *msg) |
| Retrives the names of the waypoints for the patrol from the task message. | |
| virtual bool | atGoal () |
| Overridden to swap goal waypoints every time a waypoint is reached. | |
| virtual bool | passedGoal () |
| Overridden to swap goal waypoints if a waypoint has been passed. | |
| virtual void | doMoving (double desiredSpeed) |
| Overridden to call sailTo. | |
first waypoint | |
{@ The first point to patrol between, stored in the process state repository | |
| virtual const DtString & | firstWaypoint () const |
| virtual void | setFirstWaypoint (const DtString &waypoint) |
second waypoint | |
{@ The second point to patrol between, stored in the process state repository | |
| virtual const DtString & | secondWaypoint () const |
| virtual void | setSecondWaypoint (const DtString &waypoint) |
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 | patrolBetweenCallback (DtSimMessage *msg, void *usrData) |
| Called when a patrol between message is received. | |
Protected Member Functions | |
| virtual void | registerTaskMsgCallbacks () |
| Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolBetweenCallback as the function pointer, and the 'this' pointer as the user data. | |
| DtSurfaceEntityPatrolBetweenController () | |
| Default constructor; not implemented. | |
| DtSurfaceEntityPatrolBetweenController (const DtSurfaceEntityPatrolBetweenController &orig) | |
| copy constructor; not implemented | |
| const DtSurfaceEntityPatrolBetweenController & | operator= (const DtSurfaceEntityPatrolBetweenController &orig) |
| assignment operator; not implemented | |
DtSurfaceEntityPatrolBetweenController; patrol between waypoint behavior for a surface entity.
End User Description:
DtSurfaceEntityPatrolBetweenController (surfEntPtlBtwn.h) is derived from DtSurfaceEntityMoveToController. Instead of calling taskComplete() when a waypoint is reached (as Move To Waypoint would do), it switches the destination to the other waypoint in its derived atGoal() and passedGoal() functions. It overrides registerTaskMsgCallbacks() to register for DtPatrolTwoPointsType.
Uses Descriptor Type: DtSurfaceEntityPilotControllerDescriptor
| DtSurfaceEntityPatrolBetweenController::DtSurfaceEntityPatrolBetweenController | ( | 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 DtSurfaceEntityPatrolBetweenController::~DtSurfaceEntityPatrolBetweenController | ( | ) | [virtual] |
destructor
Default constructor; not implemented.
| DtSurfaceEntityPatrolBetweenController::DtSurfaceEntityPatrolBetweenController | ( | const DtSurfaceEntityPatrolBetweenController & | orig | ) | [protected] |
copy constructor; not implemented
| static DtSimComponent* DtSurfaceEntityPatrolBetweenController::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 DtSurfaceEntityMoveToController.
| virtual DtString DtSurfaceEntityPatrolBetweenController::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 DtSurfaceEntityMoveToController.
| static void DtSurfaceEntityPatrolBetweenController::patrolBetweenCallback | ( | DtSimMessage * | msg, |
| void * | usrData | ||
| ) | [static] |
Called when a patrol between 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 between tasks. When this callback is activated, the user data pointer is cast to an instance of this class upon which processPatrolBetweenTask is called with the patrol between task message.
| virtual void DtSurfaceEntityPatrolBetweenController::processPatrolBetweenTask | ( | DtSimMessage * | msg | ) | [virtual] |
Retrives the names of the waypoints for the patrol from the task message.
Called by patrolBetweenCallback to store the names of the first and second waypoints from the task message in the process state repository. The reverse flag in the PSR is reset to false. The control object name in the PSR is set to the name of the first waypoint to initialize the move to behavior from the base class. A call to setupControlPoint is made to the base class to initialize the waypoint, and if it fails an error is printed to the object console and taskComplete() is called to end the task. Finally, setupGoalVector is called with the location of myControlPoint.
| virtual const DtString& DtSurfaceEntityPatrolBetweenController::firstWaypoint | ( | ) | const [virtual] |
| virtual void DtSurfaceEntityPatrolBetweenController::setFirstWaypoint | ( | const DtString & | waypoint | ) | [virtual] |
| virtual const DtString& DtSurfaceEntityPatrolBetweenController::secondWaypoint | ( | ) | const [virtual] |
| virtual void DtSurfaceEntityPatrolBetweenController::setSecondWaypoint | ( | const DtString & | waypoint | ) | [virtual] |
| virtual bool DtSurfaceEntityPatrolBetweenController::atGoal | ( | ) | [virtual] |
Overridden to swap goal waypoints every time a waypoint is reached.
Calls DtSurfaceEntityMoveToController::atGoal to check to see if the current waypoint has been reached. If so, the value of the reverse flag is checked in the process state repository. If it is true, it's set to false and the control object name in the PSR is set to the first waypoint. If it is false, it's set to true and the control object name in the PSR is set to the second waypoint. Because patrol is a never-ending task, this function always returns false.
Reimplemented from DtSurfaceEntityMoveToController.
| virtual bool DtSurfaceEntityPatrolBetweenController::passedGoal | ( | ) | [virtual] |
Overridden to swap goal waypoints if a waypoint has been passed.
Calls DtSurfaceEntityMoveToController::passedGoal to check to see if the current waypoint has been passed. If so, the value of the reverse flag is checked in the process state repository. If it is true, it's set to false and the control object name in the PSR is set to the first waypoint. If it is false, it's set to true and the control object name in the PSR is set to the second waypoint. Because patrol is a never-ending task, this function always returns false.
Reimplemented from DtSurfaceEntityMoveToController.
| virtual void DtSurfaceEntityPatrolBetweenController::doMoving | ( | double | desiredSpeed | ) | [virtual] |
Overridden to call sailTo.
Because patrol is a never-ending task, doMoving is overridden to make sure that sailTo is called with the position of the current waypoint and that the base class does not call driftTo (which would bring the entity to a stop). Sets myLastDistanceSquared to myDistanceSquared.
Reimplemented from DtSurfaceEntityMoveToController.
| virtual void DtSurfaceEntityPatrolBetweenController::registerTaskMsgCallbacks | ( | ) | [protected, virtual] |
Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolBetweenCallback as the function pointer, and the 'this' pointer as the user data.
Reimplemented from DtSurfaceEntityMoveToController.
| const DtSurfaceEntityPatrolBetweenController& DtSurfaceEntityPatrolBetweenController::operator= | ( | const DtSurfaceEntityPatrolBetweenController & | orig | ) | [protected] |
assignment operator; not implemented