00001 #ifndef _DIRECTION_H 00002 #define _DIRECTION_H 00003 00004 #include "stdafx.h" 00005 #include <vector> 00006 #include "Vehicle.h" 00007 #include "Lane.h" 00008 00009 typedef std::vector< std::vector<Vehicle*> > M2D; 00010 00013 class Direction { 00014 00015 public: 00016 void clear(); 00017 Direction(); 00018 virtual ~Direction(); 00019 00020 void setRoadSegments(std::vector<RoadSegment*> segments); 00021 void setOutputDetector(OutputDetector* OutputDet); 00022 00023 OutputDetector* getOutputDetector(); 00024 Lane& getLane(int i); 00025 int getNoLanes(); 00026 M2D getVehiclesM2D(); 00027 M2D getGlobalPos(); 00028 00029 bool update(const double step, const double curTime); 00030 void init(bool DirPos, OutputDetector* OutDet, bool AllowLaneChange, int RoadLength, bool DriveOnRight); 00031 void createLanes(int iFirstLane, 00032 std::vector<int> vLaneLengths, 00033 std::vector<Detector*> detectors, 00034 std::vector<RoadSegment*> segments); 00035 00036 private: 00037 void CheckDetectorTimes(double step); 00038 00039 bool m_DriveOnRight; 00040 bool m_AllowLaneChanging; 00041 double m_RoadLength; 00042 bool m_DirPos; 00043 int m_NoLanes; 00044 00045 OutputDetector* m_pOutputDetector; 00046 std::vector<Lane> m_vLanes; 00047 std::vector<Detector*> m_vDetectors; 00048 std::vector<RoadSegment*> m_vRoadSegments; 00049 00050 }; 00051 #endif