All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TrafficCongestionSimulationController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "TrafficCongestion.h"
7 #include "ITrafficCongestionService.h"
8 #include "ITrafficThemeModelObserver.h"
9 #include "TrafficCongestionStateChangedCallback.h"
10 #include "Traffic.h"
11 #include "Navigation.h"
12 #include "NavigationGraphAddedCallback.h"
13 #include "NavigationGraphRemovalCallback.h"
14 #include "MortonKey.h"
15 #include "VectorMathDecl.h"
16 #include "Rendering.h"
17 
18 
19 namespace Eegeo
20 {
21  namespace TrafficCongestion
22  {
24  : protected Eegeo::NonCopyable,
26  {
27  public:
30  Eegeo::Traffic::VehicleRenderablesModel& pVehicleRenderablesModel,
32  const TrafficCongestionConfig& config,
36 
38 
39  void Update(float dt, const dv3& cameraEcefLocation);
40  void SubmitForRendering(Eegeo::Traffic::VehicleRenderer& vehicleRenderer, const dv3& ecefCameraPosition);
41 
42 
43  void ToggleEnable()
44  {
45  m_enabled = !m_enabled;
46  }
47 
48  bool GetEnabled() { return m_enabled; }
49 
50  void OnThemeChanged(const Eegeo::Traffic::Themes::TrafficThemeModel& themeModel);
51  void OnThemeStateChanged(const Eegeo::Traffic::Themes::TrafficThemeModel& themeModel);
52 
53  private:
54 
55 
56  void HandleNavGraphAdded(const Resources::Roads::Navigation::NavigationGraph& navGraph);
57  void HandleNavGraphRemoved(const Resources::Roads::Navigation::NavigationGraph& navGraph);
58  void HandleTrafficCongestionModelChanged(const TrafficCongestion::TrafficCongestionModelCell& changed);
59 
60  typedef std::map<Eegeo::Streaming::MortonKey, TrafficCongestionSimulationCell*, Streaming::MortonKeyCompare> TMortonKeyToSimulationCellMap;
61 
65 
66  Eegeo::TrafficCongestion::TrafficCongestionModel& m_trafficCongestionModel;
67  Eegeo::Traffic::VehicleRenderablesModel& m_vehicleRenderablesModel;
69 
70  const TrafficCongestionConfig& m_config;
71 
72  TMortonKeyToSimulationCellMap m_keyToSimulationCell;
73  bool m_enabled;
74 
76  Traffic::Themes::TrafficThemeModel& m_trafficThemeModel;
77  Streaming::CameraFrustumStreamingVolume& m_streamingVolume;
78  };
79  }
80 }