All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VehicleModelLoadHandler.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "AsyncModels.h"
7 #include "IAsyncModelObserver.h"
8 #include "IAsyncModel.h"
9 #include "VehicleModelNodeRepository.h"
10 #include "SceneModel.h"
11 #include <string>
12 #include <vector>
13 #include <set>
14 
15 namespace Eegeo
16 {
17  namespace Traffic
18  {
20  {
21  public:
23  Traffic::VehicleModelNodeRepository& vehicleModelNodeRepository,
24  const std::vector<Config::TrafficSimulationVehicleConfiguration>& vehiclesConfigList,
25  std::set<std::string> &nodeSuffixes)
26  : m_vehicleModelNodeRepository(vehicleModelNodeRepository)
27  , m_vehiclesConfigList(vehiclesConfigList)
28  , m_nodeSuffixes(nodeSuffixes)
29  {
30  }
31 
32  void OnModelLoadSuccess(const Io::AsyncModels::IAsyncModel& loadedModel)
33  {
35 
36  Eegeo_TTY("Succeeded load of model at %s\n", loadedModel.GetUrl().c_str());
37 
38  if(loadedModel.TryGetModel(pModel))
39  {
40  Eegeo_TTY("Adding to repo.\n");
41 
42  m_vehicleModelNodeRepository.AddVehicleNodesFromModel(pModel, m_vehiclesConfigList, m_nodeSuffixes);
43  }
44  }
45 
46  void OnModelLoadFail(const Io::AsyncModels::IAsyncModel& loadedModel)
47  {
48  Eegeo_TTY("Failed load of model at %s\n", loadedModel.GetUrl().c_str());
49  }
50 
51  private:
52  Traffic::VehicleModelNodeRepository& m_vehicleModelNodeRepository;
53  const std::vector<Config::TrafficSimulationVehicleConfiguration>& m_vehiclesConfigList;
54  std::set<std::string> m_nodeSuffixes;
55  };
56  }
57 }