All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MapCameraModel.h
1 #pragma once
2 
3 #include "MapCamera.h"
4 #include "Types.h"
5 #include "ScreenProperties.h"
6 #include "CameraState.h"
7 #include "MapCameraEvents.h"
8 #include "Space.h"
9 #include "MapCameraPosition.h"
10 #include "MapCameraAnimationOptions.h"
11 #include "MapCameraUpdate.h"
12 #include "MapCameraGestureState.h"
13 
14 namespace Eegeo
15 {
16  namespace Camera
17  {
18  namespace MapCamera
19  {
21  {
22  public:
24  const Rendering::ScreenProperties& screenProperties,
25  IMapCameraModelChangedEvent& mapCameraModelChangedEvent,
26  IMapCameraModelScreenPropertiesChangedEvent& screenProperyChangedEvent,
27  IMapCameraTransitionCancelledEvent& mapCameraTransitionCancelledEvent
28  );
29 
30  ~MapCameraModel();
31 
32  void SetScreenProperties(const Rendering::ScreenProperties& screenProperties);
33 
34  const Rendering::ScreenProperties& GetScreenProperties() const;
35 
36  void SetUsingCustomStreamingCamera(bool usingCustomStreamingCamera);
37 
38  bool IsUsingCustomStreamingCamera() const { return m_isUsingCustomStreamingCamera; }
39 
40  void SetUsingCustomRenderCamera(bool usingCustomRenderCamera);
41 
42  bool IsUsingCustomRenderCamera() const { return m_isUsingCustomRenderCamera; }
43 
44  IMapCameraModelChangedEvent& GetMapCameraChangedEvent() const;
45  IMapCameraModelScreenPropertiesChangedEvent& GetScreenPropertiesChangedEvent() const;
46 
47  // MapCameraCoordinator sets state on this model after IndoorOutdoorModalCameraController has done 'update'
48  void SetUpdateState(
49  const MapCameraPosition& mapCameraPosition,
50  const MapCameraGestureState& mapCameraGestureState
51  );
52 
53  void SetMoveState(const MapCameraPosition& mapCameraPosition);
54 
55  void SetAnimationState(
56  int animationId,
57  const MapCameraPosition& animationTarget,
58  double animationDuration,
59  bool isInterruptByGestureAllowed,
60  bool isInterruptByApiAllowed,
61  bool isAnimationSnapToTarget
62  );
63 
64  void ClearAnimationState();
65 
66  void SetIndoorMapEntryInitialDistance(double indoorMapEntryInitialDistance);
67  double GetIndoorMapEntryInitialDistance() const { return m_indoorMapEntryInitialDistance; }
68 
69  const MapCameraPosition& GetMapCameraPosition() const { return m_mapCameraPosition;}
70  const MapCameraGestureState& GetMapCameraGesture() const { return m_mapCameraGestureState; }
71 
72  int GetAnimationId() const { return m_animationId; }
73  double GetAnimationDuration() const { return m_animationDuration; }
74  const MapCameraPosition& GetAnimationTarget() const { return m_animationTarget; }
75  bool IsInterruptAnimationByGestureAllowed() const { return m_isInterruptAnimationByGestureAllowed; }
76  bool IsInterruptByApiAllowed() const { return m_isInterruptByApiAllowed; }
77  bool IsAnimationSnapToTarget() const { return m_isAnimationSnapToTarget; }
78  bool IsAnimating() const { return m_animationId != InvalidMapCameraAnimationId; }
79 
80  void SetIndoorRestriction(bool indoorRestrictionApplied);
81  bool IsIndoorRestrictionEnabled() const { return m_isIndoorRestrictionApplied; }
82 
83  void SetVerticallyLocked(bool isVerticallyLocked);
84  bool IsVerticallyLocked() const { return m_isVerticallyLocked; }
85 
86  private:
87 
88  void SetUpdateStateInternal(
89  const MapCameraPosition& mapCameraPosition,
90  const MapCameraGestureState& mapCameraGestureState,
91  bool forceMove
92  );
93 
94  void RaiseChangedEvent(const MapCameraOperation::Type operation);
95 
96  void RaiseGestureEvents(bool prevGestureActive,
97  bool newGestureActive,
98  bool changed,
99  MapCameraOperation::Type start,
100  MapCameraOperation::Type end,
101  MapCameraOperation::Type change);
102 
103 
104 
105  // canonical state for map camera
106  Rendering::ScreenProperties m_screenProperties;
107  MapCameraGestureState m_mapCameraGestureState;
108  MapCameraPosition m_mapCameraPosition;
109  MapCameraPosition m_animationTarget;
110  int m_animationId;
111  double m_animationDuration;
112  bool m_isInterruptAnimationByGestureAllowed;
113  bool m_isInterruptByApiAllowed;
114  bool m_isAnimationSnapToTarget;
115  double m_indoorMapEntryInitialDistance;
116  bool m_isMoving;
117  bool m_isUsingCustomStreamingCamera;
118  bool m_isUsingCustomRenderCamera;
119  bool m_isIndoorRestrictionApplied;
120  bool m_isVerticallyLocked;
121 
122  IMapCameraModelChangedEvent& m_mapCameraModelChangedEvent;
123  IMapCameraModelScreenPropertiesChangedEvent& m_screenProperyChangedEvent;
124  IMapCameraTransitionCancelledEvent& m_mapCameraTransitionCancelledEvent;
125  };
126  }
127  }
128 }