All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InteriorsLabelController.h
1 // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IInteriorsLabelController.h"
6 #include "Rendering.h"
7 #include <string>
8 #include "Interiors.h"
9 #include "CallbackCollection.h"
10 #include "TextMeshes.h"
11 #include "PlaceNames.h"
12 #include "Fonts.h"
13 #include "IRenderableFilter.h"
14 #include "Camera.h"
15 #include "InteriorsLabelParser.h"
16 #include "InteriorsEntitiesRepository.h"
17 #include "TextRenderableConfiguration.h"
18 
19 #include <vector>
20 #include <map>
21 
22 namespace Eegeo
23 {
24  namespace Resources
25  {
26  namespace Interiors
27  {
28  namespace Entities
29  {
31  {
32  public:
33  InteriorsLabelsController(InteriorsEntitiesRepository& interiorsEntitiesRepository,
36  Rendering::Materials::MaterialIdGenerator& materialIdGenerator,
37  Rendering::Shaders::ShaderIdGenerator& shaderIdGenerator,
38  const Fonts::FontInstance& font,
39  const Rendering::Shaders::TextShaderSet& textShaderSet,
41  PlaceNames::PlaceNamesController& placenamesController,
42  InteriorInteractionModel& interiorInteractionModel,
43  InteriorTransitionModel& interiorTransitionModel,
44  const IImmutableInteriorViewModel& interiorViewModel,
45  const Rendering::ScreenProperties& screenProperties,
46  const bool labelsVisibleWhenExpanded,
47  bool enableGenerateLabelViews,
48  float fontSize
49  );
50 
52 
53  void AddLabelToOmit(const std::string& labelName);
54  void RemoveLabelToOmit(const std::string& labelName);
55 
56  const TFloorIndexToModelsMap& GetFloorIndexToModels() const { return m_floorIndexToModels; }
57 
58  void RegisterLabelsBuiltCallback(Helpers::ICallback0& callback);
59  void UnregisterLabelsBuiltCallback(Helpers::ICallback0& callback);
60 
61  private:
62  Helpers::TCallback0<InteriorsLabelsController> m_interiorModelChangedCallback;
63  Helpers::TCallback0<InteriorsLabelsController> m_interiorInteractionStateChangedCallback;
64 
65  Helpers::TCallback0<InteriorsLabelsController> m_interiorTransitionChangedCallback;
66 
67  void HandleInteriorModelChanged();
68 
69  void HandleInteriorInteractionStateChanged();
70 
71  void HandleInteriorTransitionChanged();
72 
73  void RefreshPlacenames();
74 
75  bool ShouldShowLabels() const;
76 
77  const int GetCurrentVisibleFloorIndex() const;
78  void TransformLabelToFloor(PlaceNames::PlaceNameView& view, int floorIndex);
79 
82  Helpers::CallbackCollection0 m_labelsBuiltForInteriorCallbacks;
83 
84  bool CanProcessEntities(const std::string& interiorName, const TEntityModelVector& entities) const;
85  void OnEntitiesAdded(const std::string& interiorName, const TEntityModelVector& entities);
86  void OnEntitiesRemoved(const std::string& interiorName, const TEntityModelVector& entities);
87 
88  void RemoveAllLabels();
89  void StoreCreatedLabels(const TFloorIndexToModelsMap& newFloorsToModels);
90  void PresentNewLabelsForCurrentFloor(const TFloorIndexToModelsMap& newFloorIndexToModels);
91 
92  InteriorsEntitiesRepository& m_interiorsEntitiesRepository;
93  InteriorInteractionModel& m_interiorInteractionModel;
94  InteriorTransitionModel& m_interiorTransitionModel;
95  const IImmutableInteriorViewModel& m_interiorViewModel;
96 
97  // Views
98  Fonts::FontMaterialSet* m_pLabelsFontMaterialSet;
100  Rendering::Materials::ITextMaterialFactory* m_pTextMaterialFactory;
101  TextMeshes::InstancedTextMeshBuilder* m_pLabelsTextMeshBuilder;
102  Resources::PlaceNames::PlaceNameViewBuilder* m_pLabelsViewBuilder;
103  PlaceNames::PlaceNamesController& m_placenamesController;
104  const bool m_labelsVisibleWhenExpanded;
105  const bool m_enableGenerateLabelViews;
106  const float m_fontSize;
107 
108  TFloorIndexToModelsMap m_floorIndexToModels;
109  int m_addedForFloorIndex;
110 
111  std::set<std::string> m_labelsToOmit;
112  };
113  }
114  }
115  }
116 }