All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PointOnMap.h
1 #pragma once
2 
3 #include "Positioning.h"
4 #include "Types.h"
5 #include "IPointOnMap.h"
6 #include "VectorMath.h"
7 #include "LatLongAltitude.h"
8 #include "ICallback.h"
9 #include "Interiors.h"
10 #include "MapLayers.h"
11 #include "Rendering.h"
12 
13 namespace Eegeo
14 {
15  namespace Positioning
16  {
17  class PointOnMap : public IPointOnMap, private Eegeo::NonCopyable
18  {
19  public:
20 
21  PointOnMap(IdType pointOnMapId,
22  PointOnMapTerrainHeightComponent* pTerrainHeightComponent,
23  PointOnMapInteriorComponent* pInteriorComponent,
24  const IPositioningViewComponent& positioningViewComponent,
25  double latitudeDegrees,
26  double longitudeDegrees,
27  double elevation,
28  ElevationMode::Type elevationMode);
29 
30  ~PointOnMap();
31 
32  // accessors
33 
34  virtual IdType GetId() const { return m_id; }
35 
36  virtual ChangedEvent& Changed();
37 
38  virtual const IPositioningViewComponent& GetViewComponent() const;
39 
40  virtual bool IsIndoor() const;
41 
42  virtual Resources::Interiors::InteriorId GetIndoorMapId() const;
43 
44  virtual int GetIndoorMapFloorId() const;
45 
46  virtual ElevationMode::Type GetElevationMode() const;
47 
48  virtual double GetElevation() const;
49 
50  virtual Space::LatLong GetCoordinate() const;
51 
52 
53  // query derived state
54 
55  virtual Space::LatLongAltitude GetDerivedCoordinate() const;
56 
57  virtual double GetDerivedAltitude() const;
58 
59  virtual double GetDerivedCollapsibleAltitude() const;
60 
61  virtual int GetDerivedIndoorMapFloorIndex() const;
62 
63  // mutate state
64 
65  virtual void SetCoordinate(double latitudeDegrees, double longitudeDegrees);
66 
67  virtual void SetElevation(double elevation);
68 
69  virtual void SetElevationMode(ElevationMode::Type elevationMode);
70 
71  virtual void SetIndoorMapId(const Resources::Interiors::InteriorId& indoorMapId);
72 
73  virtual void SetIndoorMapFloorId(int indoorMapFloorId);
74 
75  private:
76  void UpdatePositionEcef();
77 
78  double CalcDerivedAltitude() const;
79 
80  void OnTerrainComponentChanged();
81 
82  void OnInteriorComponentChanged();
83 
84  void NotifyComponentsNeedRefresh();
85 
86  Helpers::TCallback0<PointOnMap> m_terrainComponentChanged;
87  Helpers::TCallback0<PointOnMap> m_interiorComponentChanged;
88 
89  IdType m_id;
90  PointOnMapTerrainHeightComponent* m_pTerrainHeightComponent;
91  PointOnMapInteriorComponent* m_pInteriorComponent;
92  const IPositioningViewComponent& m_positioningViewComponent;
93 
94  double m_latitudeDegrees;
95  double m_longitudeDegrees;
96  double m_elevation;
97  ElevationMode::Type m_elevationMode;
98 
99  double m_derivedAltitude;
100  double m_derivedCollapsibleAltitude;
101 
102  Helpers::TEvent0<ChangedEvent> m_changedEvent;
103  };
104  }
105 }