All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BuildingHighlightService.h
1 #pragma once
2 
3 #include "BuildingHighlights.h"
4 #include "Types.h"
5 #include "IBuildingHighlightService.h"
6 #include "ICallback.h"
7 #include "BuildingFootprints.h"
8 #include "Collision.h"
9 #include "Geometry.h"
10 #include "EegeoRootDeclarations.h"
11 
12 #include <map>
13 #include <memory>
14 #include <vector>
15 
16 namespace Eegeo
17 {
18  namespace BuildingHighlights
19  {
20 
22  {
23  public:
25  IBuildingHighlightModelFactory& buildingHighlightModelFactory,
26  BuildingHighlightModelRepository& buildingHighlightModelRepository,
27  BuildingFootprints::BuildingFootprintService& buildingFootprintService,
28  Collision::IFeatureRayCastingService& featureRayCastingService,
29  Collision::ILandmarkCollisionMeshService& landmarkCollisionMeshService,
30  const IBuildingHighlightCameraState& buildingHighlightCameraState
31  );
32 
33  virtual ~BuildingHighlightService();
34 
35  BuildingHighlightId Create(const BuildingHighlightCreateParams& createParams) override;
36 
37  void Destroy(BuildingHighlightId modelId) override;
38 
39  void Update() override;
40 
41  bool Exists(BuildingHighlightId modelId) const override;
42 
43  BuildingHighlightModel& Get(BuildingHighlightId modelId) const override;
44 
45  private:
46 
47  typedef BuildingFootprints::BuildingFootprintServiceRequestId RequestId;
48  typedef std::vector<std::pair<RequestId, BuildingHighlightId> > TRequestToHighlightStore;
49  typedef std::vector<std::pair<BuildingHighlightId, BuildingInformation>> THighlightToBuildingStore;
50 
52 
53  void ProcessPendingLandmarkResults();
54  void CancelPendingLandmarkInfoForHighlight(BuildingHighlightId highlightId);
55 
56  void OnBuildingFootprintRequestComplete(const Eegeo::BuildingFootprints::BuildingFootprintServiceQueryResult& result);
57 
58  void CancelPendingFootprintRequestForHighlight(BuildingHighlightId highlightId);
59 
60  void OnLandmarkCollisionMeshesChanged(const Collision::LandmarkCollisionMeshesChangedMessage& message);
61 
62  void OnHighlightRemoved(BuildingHighlightModel* const & item);
63 
64  BuildingInformation MakeBuildingInformationFromRayCastResult(const Collision::FeatureRayCastResult& featureRayCastResult) const;
65 
66  BuildingInformation MakeBuildingInformationFromLandmarkMaterialPrefix(const std::string& landmarkMaterialPrefix) const;
67 
68  Geometry::Ray MakeSelectionRay(const BuildingHighlightCreateParams& createParams) const;
69  Geometry::Ray MakeSelectionRayFromScreenPoint(const v2& screenPoint) const;
70 
71  IBuildingHighlightModelFactory& m_buildingHighlightModelFactory;
72  BuildingHighlightModelRepository& m_buildingHighlightModelRepository;
73  BuildingFootprints::BuildingFootprintService& m_buildingFootprintService;
74  Collision::IFeatureRayCastingService& m_featureRayCastingService;
75  Collision::ILandmarkCollisionMeshService& m_landmarkCollisionMeshService;
76  const IBuildingHighlightCameraState& m_buildingHighlightCameraState;
77 
78  TRequestToHighlightStore m_pendingRequests;
79  THighlightToBuildingStore m_pendingLandmarkBuildingInfo;
80  std::multimap<std::string, BuildingHighlightId> m_pendingLandmarkPlaceholderMaterialPrefixes;
81 
84  std::unique_ptr<BuildingHighlightModelRepositoryObserver> m_buildingHighlightModelRepositoryObserver;
85  };
86 
87  }
88 }