All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IndoorOutdoorModalCameraController.h
1 #pragma once
2 
3 #include "MapCamera.h"
4 #include "Camera.h"
5 #include "GlobeCamera.h"
6 #include "Types.h"
7 #include "CameraState.h"
8 #include "Rendering.h"
9 #include "MapCameraUpdate.h"
10 #include "MapCameraPosition.h"
11 #include "MapCameraGestureState.h"
12 
13 
14 namespace Eegeo
15 {
16  namespace Camera
17  {
18  namespace MapCamera
19  {
21  {
22  public:
24  Camera::GlobeCamera::GpsGlobeCameraController& m_gpsGlobeCameraController,
25  Resources::Interiors::InteriorsCameraController& m_interiorsCameraController,
27  MapCameraAnimator& mapCameraAnimator,
28  MapCameraAnimator& mapCameraAnimatorForModeChange,
30  IMapCameraTransitionFinishedEvent& mapCameraTransitionFinishedEvent
31  );
32 
34 
35  void EarlyUpdate(float dt);
36 
37  bool IsModeIndoors() const { return m_isIndoors; }
38  void SetMode(bool isIndoors, const MapCameraPosition& mapCameraPosition);
39  void UpdateIndoorCameraHeightAboveBase(const MapCameraPosition &mapCameraPosition);
40 
41  void SetScreenProperties(const Eegeo::Rendering::ScreenProperties &screenProperties);
42 
43  bool CanAcceptGesture() const;
44 
45  const Camera::CameraState& GetCameraState() const;
46 
47  MapCameraPosition BuildCameraPosition(const MapCameraPosition& previousMapCameraPosition) const;
48 
49  MapCameraGestureState BuildCameraGestureState(const MapCameraGestureState& previousGestureState) const;
50 
51  void Move(const MapCameraPosition& mapCameraPosition);
52 
53  void Animate(
54  const MapCameraAnimationId animationId,
55  const MapCameraPosition& start,
56  const MapCameraPosition& target,
57  double animationDuration,
58  bool isInterruptByGestureAllowed,
59  bool shouldSnap
60  );
61 
62  void ClearAnimation();
63 
64  void SetIndoorEntryFocus(const dv3& indoorEntryFocusLocation, double indoorEntryDistance);
65  void SetIsIndoorMapReady(bool isIndoorMapReady) { m_isIndoorMapReady = isIndoorMapReady;}
66  void SetIndoorRestriction(bool restrictIndoors);
67  void SetVerticallyLocked(bool isVerticallyLocked);
68 
69  private:
70  bool IsAnimating() const;
71  void FinishAnimation();
72 
73  void SetGlobeCameraView(const MapCameraAnimationFrame& frame);
74 
75  void UseIndoorsGlobeCamera();
76  void UseOutdoorsGlobeCamera();
77 
78  void LookAtIndoorEntryFocus();
79  float CalculateIndoorLookAtHeightAboveBase(const MapCameraPosition& mapCameraPosition) const;
80 
81  dv3 GetInterestPointEcef() const;
82  double GetBearingDegrees() const;
83  double GetZenithAngleDegrees() const;
84  double GetDistanceToInterest() const;
85 
86  bool IsPanGestureActive() const;
87  bool HasPanVelocity() const;
88  bool IsRotateGestureActive() const;
89  bool HasRotateVelocity() const;
90  bool IsTilting() const;
91  bool HasZoomVelocity() const;
92 
93 
94  Camera::GlobeCamera::GpsGlobeCameraController& m_gpsGlobeCameraController;
95  Resources::Interiors::InteriorsCameraController& m_interiorsCameraController;
97  MapCameraAnimator& m_mapCameraAnimator;
98  MapCameraAnimator& m_mapCameraAnimatorForModeChange;
99  const Resources::Interiors::IImmutableInteriorViewModel& m_interiorViewModel;
100  IMapCameraTransitionFinishedEvent& m_mapCameraTransitionFinishedEvent;
101 
102  Camera::GlobeCamera::GlobeCameraController* m_pCurrentGlobeCameraController;
103  const Camera::GlobeCamera::GlobeCameraTouchController* m_pCurrentGlobeCameraTouchController;
104 
105  bool m_isIndoors;
106  bool m_isIndoorMapReady;
107  dv3 m_indoorEntryFocus;
108  double m_indoorEntryDistance;
109 
110  MapCameraAnimationId m_currentAnimationId;
111  double m_animationDuration;
112  bool m_interruptByGestureAllowed;
113  double m_animationTime;
114 
115 
116  // auxilliary state derived from current GlobeCameraController
117  Camera::CameraState m_cameraState;
118  };
119  }
120  }
121 }