![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 00008 00011 00012 #pragma once 00013 00014 #include <matrix/vlVector.h> 00015 00016 class DtRailSegment; 00017 class DtVrfMovingObjectStateRepository; 00018 class DtRailMovementController; 00019 class DtVrfObject; 00020 00024 00025 #include "vrfmodel/vrfmodelDefines.h" 00026 #include "railObstructionFinder.h" 00027 #include "railObstructionInfo.h" 00028 #include "railObstructionAnalyzer.h" 00029 class DT_DLL_vrfmodel DtRailMovementDriver 00030 { 00031 public: 00032 00035 DtRailMovementDriver(DtRailMovementController * parentController,bool drivingOnLeft, bool allowPassing, 00036 double lookAhead, double hitTime); 00037 00039 virtual ~DtRailMovementDriver(); 00040 00041 virtual void setEntityState(DtVrfMovingObjectStateRepository* state); 00042 00045 virtual double findDrivingSpeed(bool useAcceleration, DtVrfObject* convoyTgt = 0, const double followDist = 0.0, const bool useCatchUpSpeed = true); 00046 00047 virtual double calculateCurrentBrakingDistance() const; 00048 00049 virtual void setCurrentSegment(DtRailSegment * seg); 00050 virtual DtRailSegment* currentSegment(); 00051 00052 virtual void setTurnSpeed(const double speed); 00053 virtual const double turnSpeed() const; 00054 00056 virtual double determineSpeedGivenObs(const double drivingSpeed, 00057 const double hitTime, const DtRailObstructionPtr& obs) const; 00058 00059 00060 virtual bool isSwitchingLeft(const int current, const int passing) const; 00061 virtual bool isSwitchingRight(const int current, const int passing) const; 00062 00064 virtual int findClosestLaneToDrivingLane(const int current, const int driving, const DtRailSegment* road) const; 00065 00066 virtual bool isObstructionConvoyTarget(const int lane, DtRailObstructionPtr &anObstruction, DtString convoyTgt) const; 00067 00068 virtual bool isLaneObstructed(const int lane, DtRailObstructionAnalyzer &analyzer) const; 00069 00070 virtual bool isObstructionStoppedOrSlow(double speed, DtRailObstructionPtr& obs) const; 00071 00072 virtual bool isDrivingLane(const int current, const int driving) const; 00073 00074 00075 virtual int findOpenLeftLane(const int lane, const DtRailSegment* road, DtRailObstructionAnalyzer &analyzer) const; 00076 00077 virtual int findOpenRightLane(const int lane, const DtRailSegment* road, DtRailObstructionAnalyzer &analyzer) const; 00078 00089 virtual int findOpenLane(const int lane, const int passing, const DtRailSegment* road, 00090 DtRailObstructionAnalyzer &analyzer, bool checkOpposite = false) const; 00091 00093 virtual bool isTooCloseToObs(const DtRailObstructionPtr &nextObs, double bvRadiusSq ) const; 00094 00095 virtual bool allowPassing() 00096 { 00097 return myAllowPassing; 00098 } 00099 00100 protected: 00101 00103 DtRailMovementDriver(); 00104 00106 DtRailMovementDriver( 00107 const DtRailMovementDriver& orig); 00108 00110 DtRailMovementDriver& operator=( 00111 const DtRailMovementDriver& orig); 00112 00113 protected: 00114 00115 bool myDrivingOnLeft; 00116 bool myAllowPassing; 00117 00118 double myNearDistanceSq; 00119 bool myNearTurnPoint; 00120 double myTurnSpeed; 00121 double myHitTime; 00122 double myLookAheadDistance; 00123 00124 DtVrfMovingObjectStateRepository* myMovingObjectStateRepository; 00125 DtRailMovementController * myController; 00126 DtRailSegment * myCurrentSegment; 00127 }; 00128 00129