All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BuildingHighlightController.h
1 #pragma once
2 
3 #include "BuildingHighlights.h"
4 #include "Types.h"
5 #include "ICallback.h"
6 #include "BuildingHighlightModelRepository.h"
7 #include "IUpdater.h"
8 #include "Collision.h"
9 #include "Rendering.h"
10 
11 #include <unordered_set>
12 #include <unordered_map>
13 
14 namespace Eegeo
15 {
16  namespace BuildingHighlights
17  {
18  class BuildingHighlightController : public BuildingHighlightModelRepository::ObserverType, public Helpers::IUpdater, private Eegeo::NonCopyable
19  {
20  public:
22  BuildingHighlightModelRepository& buildingHighlightModelRepository,
23  IBuildingHighlightModelChangedEvent& buildingHighlightModelChangedEvent,
24  IBuildingHighlightViewFactory& buildingHighlightViewFactory,
25  BuildingHighlightViewRepository& buildingHighlightViewRepository,
26  Collision::ILandmarkCollisionMeshesChangedEvent& landmarkCollisionMeshesChangedEvent
27  );
28 
29  virtual ~BuildingHighlightController();
30 
31  void Update(float deltaSeconds) override;
32  private:
33  typedef std::unordered_multimap<std::string, BuildingHighlightId> TBuildingIdToModelIds;
34 
35  void OnItemAdded(const ItemType& item) override;
36 
37  void OnItemRemoved(const ItemType& item) override;
38 
39  bool HasViewFor(const BuildingHighlightId& modelId) const;
40 
41  void RefreshViewFor(const BuildingHighlightModel& model);
42 
43  void BindView(const BuildingHighlightModel& model);
44 
45  void UnbindView(const BuildingHighlightModel& model);
46 
47  void UpdateView(IBuildingHighlightView& view);
48 
49  bool TryFindModelInBuildingIdMap(const BuildingHighlightModel& model, TBuildingIdToModelIds::const_iterator& out_iter) const;
50 
51  void AddModelToBuildingIdMap(const BuildingHighlightModel& model);
52 
53  void RemoveModelFromBuildingIdMap(const BuildingHighlightModel& model);
54 
55  void GetModelIdsForBuildingId(const std::string& buildingId, std::vector<BuildingHighlightId>& out_modelIds) const;
56 
57  void OnBuildingHighlightModelChanged(const BuildingHighlightModelChangedMessage& message);
58  void OnLandmarkCollisionMeshesChanged(const Collision::LandmarkCollisionMeshesChangedMessage& message);
59 
60  BuildingHighlightModelRepository& m_buildingHighlightModelRepository;
61  IBuildingHighlightModelChangedEvent& m_buildingHighlightModelChangedEvent;
62  IBuildingHighlightViewFactory& m_buildingHighlightViewFactory;
63  BuildingHighlightViewRepository& m_buildingHighlightViewRepository;
64  Collision::ILandmarkCollisionMeshesChangedEvent& m_landmarkCollisionMeshesChangedEvent;
65 
68 
69  std::unordered_set<const BuildingHighlightModel*> m_modelsNeedingViewRebind;
70 
71  TBuildingIdToModelIds m_buildingIdToModelIds;
72  };
73  }
74 }