All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GpsGlobeCameraComponent.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "GlobeCamera.h"
7 #include "Location.h"
8 #include "VectorMathDecl.h"
9 #include "Space.h"
10 #include "GpsGlobeCameraComponentConfiguration.h"
11 #include "Rendering.h"
12 
13 namespace Eegeo
14 {
15  namespace Camera
16  {
17  namespace GlobeCamera
18  {
20  {
21  public:
23  Location::NavigationService& navigationService,
24  const GlobeCameraTouchController& touchController,
25  const GpsGlobeCameraComponentConfiguration& configuration,
26  const Rendering::EnvironmentFlatteningService& environmentFlatteningService
27  );
28  virtual ~GpsGlobeCameraComponent() { };
29 
30  virtual bool TryGetViewSettings(
31  float deltaSeconds,
32  Space::EcefTangentBasis& out_interestBasis,
33  float& out_distanceToInterest,
34  const GlobeCameraTouchSettings& existingTouchSettings,
35  GlobeCameraTouchSettings& out_touchSettings);
36 
37  virtual bool IsGpsActive() const;
38  virtual bool IsCompassActive() const;
39  virtual bool TryGetDefaultGpsView(Space::EcefTangentBasis& out_interestBasis, float& out_distanceToInterest);
40 
41  virtual void SetCompassModeOffset(const Space::EcefTangentBasis& interestBasis, Space::EcefTangentBasis& out_interestBasis);
42 
43  private:
44  void HandleGpsCancelGestures(const v2& touchPanPixelDelta, float touchRotateAngleDelta);
45  void UpdateGpsControl(float deltaSeconds, bool& out_allowTouchRotate, bool& out_allowTouchPan);
46  void UpdateCompassCamera(float deltaSeconds, const Space::EcefTangentBasis& cameraInterest, v3& out_heading, float& out_compassHeadingVelocity) const;
47 
48  float CalculateCompassModeOffset(const dv3& interestLocation);
49 
50  const GlobeCameraController& m_globeCamera;
51  Location::NavigationService& m_navigationService;
52  const GlobeCameraTouchController& m_touchController;
53  const GpsGlobeCameraComponentConfiguration m_configuration;
54 
55  float m_compassHeadingVelocity;
56  bool m_gpsActiveLastFrame;
57 
58  const Rendering::EnvironmentFlatteningService& m_environmentFlatteningService;
59  };
60  }
61  }
62 }