All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TrafficCongestionSimulationCell.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Navigation.h"
7 #include "VectorMathDecl.h"
8 #include "TrafficCongestion.h"
9 #include "TrafficCongestionVehicleModel.h"
10 #include "TrafficCongestionConfig.h"
11 #include <map>
12 
13 namespace Eegeo
14 {
15  namespace TrafficCongestion
16  {
18  {
19  public:
20  typedef std::map<int, TrafficCongestionVehicles *> TRoadIndexToVehicles;
21 
23  const TrafficCongestionConfig& config,
25  TrafficCongestionVehicleFactory& vehicleFactory
26  );
28 
29  void AddRoadCongestionFor(int roadIndex, CongestionLevel::CongestionLevelValues severity);
30  void Update(float dt, Traffic::VehicleRenderablesModel& vehicleRenderablesModel, const dv3& cameraEcefLocation);
31  void HandleStateChanged(const TrafficCongestionStateData& state);
32  void HandleThemeChanged(const TrafficCongestionThemeData& data);
33 
34  void Clear();
35  void UpdateFromModel(const TrafficCongestionModelCell& model);
36 
37  private:
38  void AddVehicle(int roadIndex, const CongestionSettings& settings, bool addFromTo, bool addToFrom);
39  void AddVehicleAt(
40  VehicleDirection::DirectionValues vehicleDirection,
41  int roadIndex,
42  int segmentIndex,
43  float distanceTravelled,
44  float speedMultiplier);
45 
47  const TrafficCongestionConfig& m_config;
48  TrafficCongestionVehicleFactory& m_vehicleFactory;
49  TRoadIndexToVehicles m_roadIndexToVehicleModels;
50  };
51  }
52 }