![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Generated by VR-Forces Component Code Generator 00003 ** WARNING: Changes to this file WILL BE LOST if file is regenerated. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: humanMoveAlongController.h,v $ $Revision: 1.9 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00014 00015 #ifndef humanMoveAlongController_H_ 00016 #define humanMoveAlongController_H_ 00017 00018 #include "vrfobjcore/singleTaskControllerComponent.h" 00019 #include "vrfmodel/vrfmodelDefines.h" 00020 00021 class DtCgf; 00022 class DtHumanStateRepository; 00023 class DtSimMessage; 00024 class DtHumanMoveAlongPSR; 00025 class DtHumanMovementControlOutputPortGroup; 00026 class DtVectorOutputPort; 00027 class DtLocalVectorIterator; 00028 class DtCollisionInputPort; 00029 class DtInputPortGroup; 00030 class DtHumanMoveAlongControllerDescriptor; 00031 00041 class DT_DLL_vrfmodel DtHumanMoveAlongController : public DtSingleTaskControllerComponent 00042 { 00043 private: 00045 DtHumanMoveAlongController(); 00047 DtHumanMoveAlongController(const DtHumanMoveAlongController& orig); 00049 DtHumanMoveAlongController& operator=( 00050 const DtHumanMoveAlongController& orig); 00051 public: 00054 DtHumanMoveAlongController(const DtString& name, DtVrfObject* owner, 00055 DtSimManager* simManager, DtComponentDescriptor* desc=0, 00056 DtReaderWriterRegistry *parentRegistry=0); 00057 00059 virtual ~DtHumanMoveAlongController(); 00060 00062 virtual bool init(); 00063 00066 virtual DtString type() const; 00067 00071 virtual void tick(); 00072 00076 static void moveAlongCallback(DtSimMessage * msg, void * usr); 00077 00080 virtual void processMoveAlongTask(DtSimMessage * msg); 00081 00085 static void routeChangedCallback(DtVrfObject* obj, void * usr); 00086 virtual void processRouteChanged(DtVrfObject* obj); 00087 00089 virtual void registerTaskMsgCallbacks(); 00090 00098 virtual bool setupRoute(); 00099 00106 virtual bool setupDestination(); 00107 00109 virtual double findDesiredSpeed(); 00110 00116 virtual void stop(); 00117 00119 static void objectAddedCb(DtVrfObject * vrfObject, void * usr); 00120 00122 static DtSimComponent* creator(const DtString& name, DtVrfObject* owner, 00123 DtSimManager* simManager, DtComponentDescriptor* desc=0, 00124 DtReaderWriterRegistry* parentRegistry=0); 00125 00127 virtual bool createPorts(); 00128 00130 virtual bool createPortGroups(); 00131 00137 virtual bool createPSR(); 00138 00141 virtual void doMoving(); 00142 00144 virtual double findDesiredHeading(); 00145 00147 virtual bool destinationIsInsideObstruction( 00148 const DtVector& localDestination) const; 00149 00152 virtual bool decideToGiveUpTask() const; 00153 00154 protected: 00155 00159 virtual void buildLocalRoute(); 00160 00163 virtual void emptyVertexList(); 00164 00168 virtual void processObjectAdded(DtVrfObject * vrfObject); 00169 00172 virtual void clearTask(); 00173 00175 virtual void moveToDestination(); 00176 00178 virtual void invalidateDestinationVector() const; 00179 virtual double distanceToDestination() const; 00180 00189 virtual bool atDestination(); 00190 00200 virtual bool passedDestination(); 00201 00210 virtual bool getDestination(DtVector & destination); 00211 00216 virtual const DtVector& destinationVector() const; 00217 00226 virtual void setupDestinationVector() const; 00227 00232 virtual double atDistance() const; 00233 00239 virtual bool stayOnRoute() const; 00240 00246 virtual double minCorrectionDistance() const; 00247 00255 virtual double maxCorrectionDistance() const; 00256 00260 virtual double maxCorrectionAngle() const; 00261 00265 virtual bool getCurrentRouteSegment(DtVector& routeSegmentStart, 00266 DtVector& routeSegmentEnd) const; 00267 00268 protected: 00269 00272 00278 DtCollisionInputPort* myCollisionAvoidancePort; 00279 00282 DtInputPortGroup* myCollisionAvoidancePortGroup; 00283 00285 DtHumanMovementControlOutputPortGroup* myHumanMovementControlOutputPortGroup; 00286 00292 DtVectorOutputPort* myDestinationOutputPort; 00293 00295 00296 DtHumanStateRepository* myHumanStateRepository; 00297 00300 DtHumanMoveAlongPSR* myProcessState; 00301 00302 DtHumanMoveAlongControllerDescriptor* myHumanMoveAlongControllerDescriptor; 00303 00306 DtVrfObject* myRoute; 00307 00310 bool myRouteHasChanged; 00311 bool myResetVertex; 00312 00313 bool myFirstTick; 00314 00315 int myPreviousVertex; 00316 00317 bool myAtDestination; 00318 bool myNearDestination; 00319 bool myPassedDestination; 00320 00321 double myDistanceSquared; 00322 DtVector myLocalDestination; 00323 DtVector myWorldDestination; 00324 double myCurrentSpeed; 00325 mutable bool myDestinationVectorIsValid; 00326 mutable DtVector myDestinationVector; 00327 }; 00328 00331 void registerDtHumanMoveAlongController(DtCgf* cgf); 00332 #endif