All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DefaultCommandsModule.h
1 #pragma once
2 
3 #include "Types.h"
4 #include "EegeoWorld.h"
5 #include "CommandRegistry.h"
6 #include "CommandTerminal.h"
7 #include "Helpers.h"
8 
9 #include "HelpCommand.h"
10 #include "ListCommandsCommand.h"
11 #include "EchoCommand.h"
12 #include "ExecCommand.h"
13 
14 #include "FpsStatsCommand.h"
15 #include "ResetStatsCommand.h"
16 #include "MemStatsCommand.h"
17 #include "NetStatsCommand.h"
18 #include "RenderStatsCommand.h"
19 
20 #include "StreamToggleCommand.h"
21 #include "StreamListCommand.h"
22 #include "StreamStatsCommand.h"
23 
24 #include "CameraLocationCommand.h"
25 #include "CameraTiltToggleCommand.h"
26 #include "CameraJumpCommand.h"
27 #include "CameraJumpIndoorsCommand.h"
28 
29 #include "RoadNamesOpacityCommand.h"
30 
31 #include "TransportPresentationModule.h"
32 #include "PlaceNamesPresentationModule.h"
33 #include "LabelsModule.h"
34 
35 #include "SetCongestionCommand.h"
36 
37 #include "PrecacheCancelCommand.h"
38 #include "PrecacheStatusCommand.h"
39 #include "PrecacheViewCommand.h"
40 
41 #include "DrawDebugLineCommand.h"
42 #include "DrawDebugTextCommand.h"
43 #include "DrawDebugScreenTextCommand.h"
44 #include "DrawDebugSphereCommand.h"
45 
46 #include "NewRouteCommand.h"
47 #include "RouteFittingCommand.h"
48 
49 #include "StreamingModule.h"
50 #include "DebugRenderingModule.h"
51 
52 #include "ProfileShowCommand.h"
53 #include "ProfileEnableCommand.h"
54 #include "PlaceNamesEnableCommand.h"
55 #include "PerformanceTestBeginCommand.h"
56 #include "PerformanceTestRunner.h"
57 #include "PerformanceTestRegisterSplineCommand.h"
58 
59 #include "SetShadowColorCommand.h"
60 #include "SetLightColorCommand.h"
61 #include "DumpLightingCommand.h"
62 #include "SysInfoCommand.h"
63 
64 #include "ChangeThemeStateCommand.h"
65 #include "CityThemesModule.h"
66 #include "WebCacheClearCommand.h"
67 #include "SetWebProxyCommand.h"
68 
69 #include "ChangeCoverageTreeManifestCommand.h"
70 #include "ChangeThemeManifestCommand.h"
71 
72 #include "LabelLayerEnableCommand.h"
73 
74 #include "GlowmapsEnableCommand.h"
75 #include "MapModule.h"
76 #include "MapCameraModule.h"
77 
78 namespace Eegeo
79 {
80  namespace Debug
81  {
82  namespace DebugServer
83  {
85  {
86  public:
88  Debug::IDebugStats& debugStats,
90  Eegeo::Camera::ICameraJumpController& cameraJumpController,
91  Eegeo::Streaming::IFrustumVolumeProvider& frustumVolumeProvider,
92  Eegeo::Routes::IRouteCreator& routeCreator,
94  Commands::CommandRegistry& commandRegistry,
95  Commands::CommandBuffer& commandBuffer,
97 
98  : m_world(world)
99  , m_globeCameraController(globeCameraController)
100  , m_cameraJumpController(cameraJumpController)
101  , m_routeCreator(routeCreator)
102  , m_frustumVolumeProvider(frustumVolumeProvider)
103  , m_debugStats(debugStats)
104  , m_performanceTestRunner(perfTestRunner)
105  , m_registry(commandRegistry)
106  , m_commandBuffer(commandBuffer)
107  , m_fileIO(fileIO)
108  {
109  AddDefaultCommands();
110  }
111 
113  {
114  for (std::vector<Commands::Command*>::iterator it = m_defaultCommands.begin();
115  it != m_defaultCommands.end();
116  ++it)
117  {
118  Eegeo_DELETE (*it);
119  }
120 
121  m_defaultCommands.clear();
122  }
123 
124  private:
125  void AddDefaultCommands()
126  {
127  AddCommand(Eegeo_NEW(Commands::HelpCommand)(m_registry));
128  AddCommand(Eegeo_NEW(Commands::EchoCommand)());
129  AddCommand(Eegeo_NEW(Commands::ExecCommand)(m_fileIO, m_commandBuffer));
130  AddCommand(Eegeo_NEW(Commands::ListCommandsCommand)(m_registry));
131 
132  AddCommand(Eegeo_NEW(Commands::Stats::FpsStatsCommand)(m_debugStats));
133  AddCommand(Eegeo_NEW(Commands::Stats::ResetStatsCommand)(m_debugStats));
134  AddCommand(Eegeo_NEW(Commands::Stats::MemStatsCommand)(m_debugStats));
135  AddCommand(Eegeo_NEW(Commands::Stats::NetStatsCommand)(m_debugStats));
136  AddCommand(Eegeo_NEW(Commands::Stats::RenderStatsCommand)(m_debugStats));
137 
138  Modules::Map::StreamingModule& streamingModule = m_world.GetStreamingModule();
139  auto& mapCameraModule = m_world.GetMapModule().GetMapCameraModule();
140 
141  AddCommand(Eegeo_NEW(Commands::Stream::StreamToggleCommand)(streamingModule.GetStreamingController()));
142  AddCommand(Eegeo_NEW(Commands::Stream::StreamListCommand)(m_debugStats));
143  AddCommand(Eegeo_NEW(Commands::Stream::StreamStatsCommand)(m_debugStats, streamingModule.GetPayloadPool()));
144 
145  AddCommand(Eegeo_NEW(Commands::Camera::CameraLocationCommand)(m_debugStats));
146  AddCommand(Eegeo_NEW(Commands::Camera::CameraTiltToggleCommand)(m_globeCameraController));
147  AddCommand(Eegeo_NEW(Commands::Camera::CameraJumpCommand)(m_cameraJumpController));
148  AddCommand(Eegeo_NEW(Commands::Camera::CameraJumpIndoorsCommand)(mapCameraModule.GetMapCameraService()));
149 
150  Modules::Map::Layers::TransportPresentationModule& transportPresentationModule = m_world.GetTransportPresentationModule();
151  Modules::TrafficModule& trafficModule = m_world.GetTrafficModule();
152 
153  AddCommand(Eegeo_NEW(Commands::Roads::RoadNamesOpacityCommand)(transportPresentationModule.GetRoadNamesFadeController()));
154  AddCommand(Eegeo_NEW(Commands::TrafficCongestion::SetCongestionCommand)(trafficModule.GetTrafficCongestionService()));
155 
156  AddCommand(Eegeo_NEW(Commands::Precache::PrecacheCancelCommand)(streamingModule.GetPrecachingService()));
157  AddCommand(Eegeo_NEW(Commands::Precache::PrecacheStatusCommand)(streamingModule.GetPrecachingService()));
158  AddCommand(Eegeo_NEW(Commands::Precache::PrecacheViewCommand)(streamingModule.GetPrecachingService(),
159  m_frustumVolumeProvider));
160 
161  Modules::Core::DebugRenderingModule& debugRenderingModule = m_world.GetDebugRenderingModule();
162 
163  AddCommand(Eegeo_NEW(Commands::Rendering::DrawDebugLineCommand)(debugRenderingModule.GetDebugRenderer()));
164  AddCommand(Eegeo_NEW(Commands::Rendering::DrawDebugTextCommand)(debugRenderingModule.GetDebugRenderer()));
165  AddCommand(Eegeo_NEW(Commands::Rendering::DebugDrawScreenTextCommand)(debugRenderingModule.GetDebugRenderer()));
166  AddCommand(Eegeo_NEW(Commands::Rendering::DrawDebugSphereCommand)(debugRenderingModule.GetDebugRenderer()));
167 
168  AddCommand(Eegeo_NEW(Commands::Routes::NewRouteCommand)(m_routeCreator, m_cameraJumpController));
169  AddCommand(Eegeo_NEW(Commands::Routes::RouteFittingCommand)(m_routeCreator));
170 
171  AddCommand(Eegeo_NEW(Commands::Profile::ProfileShowCommand)(m_world.GetProfiler()));
172  AddCommand(Eegeo_NEW(Commands::Profile::ProfileEnableCommand)(m_world.GetProfiler()));
173  AddCommand(Eegeo_NEW(Commands::Profile::PerformanceTestRegisterSplineCommand)(m_performanceTestRunner));
174  AddCommand(Eegeo_NEW(Commands::Profile::PerformanceTestBeginCommand)(m_performanceTestRunner));
175 
176  Modules::Map::Layers::PlaceNamesPresentationModule& placenamesPresentationModule = m_world.GetPlaceNamesPresentationModule();
177 
178  AddCommand(Eegeo_NEW(Commands::PlaceNames::PlaceNamesEnableCommand)(placenamesPresentationModule.GetPlaceNamesViewFilter()));
179 
180  Eegeo::Resources::CityThemes::ThemeStateController& themeStateController = m_world.GetCityThemesModule().GetThemeStateController();
181  AddCommand(Eegeo_NEW(Commands::Lighting::SetShadowColorCommand)(themeStateController));
182  AddCommand(Eegeo_NEW(Commands::Lighting::SetLightColorCommand)(themeStateController));
183  AddCommand(Eegeo_NEW(Commands::Lighting::DumpLightingCommand)(themeStateController));
184  AddCommand(Eegeo_NEW(Commands::SysInfoCommand)());
185 
186  AddCommand(Eegeo_NEW(Commands::Themes::ChangeThemeStateCommand)(m_world.GetCityThemesModule().GetCityThemesService()));
187 
188  AddCommand(Eegeo_NEW(Commands::Web::WebCacheClearCommand)(m_world.GetPlatformAbstractionModule().GetHttpCache()));
189  AddCommand(Eegeo_NEW(Commands::Web::SetWebProxyCommand)(m_world.GetPlatformAbstractionModule().GetProxySettings()));
190 
192  AddCommand(Eegeo_NEW(Commands::Themes::ChangeThemeManifestCommand));
193 
194  Eegeo::Labels::LabelsModule& labelsModule = m_world.GetMapModule().GetLabelsModule();
195  AddCommand(Eegeo_NEW(Commands::Labels::LabelLayerEnableCommand)(labelsModule.GetModifiableLabelLayerFilterModel(), labelsModule.GetLabelLayerService()));
196 
197  AddCommand(Eegeo_NEW(Commands::Glowmaps::GlowmapsEnableCommand)(m_world.GetTerrainStreamingModule().GetChunkedLcmTerrainBuilder()));
198  }
199 
200  void AddCommand(Commands::Command* command)
201  {
202  m_registry.RegisterCommand(command);
203  m_defaultCommands.push_back(command);
204  }
205 
206  EegeoWorld& m_world;
207  Eegeo::Camera::GlobeCamera::GlobeCameraController& m_globeCameraController;
208  Eegeo::Camera::ICameraJumpController& m_cameraJumpController;
209  Eegeo::Routes::IRouteCreator& m_routeCreator;
210  Eegeo::Streaming::IFrustumVolumeProvider& m_frustumVolumeProvider;
211  Debug::IDebugStats& m_debugStats;
212  Eegeo::Debug::Profile::PerformanceTestRunner& m_performanceTestRunner;
213  Commands::CommandRegistry& m_registry;
214  Commands::CommandBuffer& m_commandBuffer;
215  Eegeo::Helpers::IFileIO& m_fileIO;
216  std::vector<Commands::Command*> m_defaultCommands;
217  };
218  }
219  }
220 }