OrbitViewController.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GAZEBO_RENDERING_ORBITVIEWCONTROLLER_HH_
18#define GAZEBO_RENDERING_ORBITVIEWCONTROLLER_HH_
19
20#include <string>
21
22#include <ignition/math/Vector3.hh>
23
26#include "gazebo/util/system.hh"
27
28namespace gazebo
29{
30 namespace rendering
31 {
34
37 class GZ_RENDERING_VISIBLE OrbitViewController : public ViewController
38 {
45 const std::string &_name = "OrbitViewController");
46
48 public: virtual ~OrbitViewController();
49
51 public: virtual void Init();
52
53 // Documentation inherited
54 public: virtual void Init(const ignition::math::Vector3d &_focalPoint,
55 const double _yaw = 0, const double _pitch = 0);
56
58 public: virtual void Update();
59
62 public: virtual void HandleMouseEvent(const common::MouseEvent &_event);
63
66 public: static std::string GetTypeString();
67
70 public: void SetDistance(float _d);
71
74 public: void SetFocalPoint(const ignition::math::Vector3d &_fp);
75
78 public: ignition::math::Vector3d FocalPoint() const;
79
80 // Documentation inherited from parent
81 public: void HandleKeyReleaseEvent(const std::string &_key);
82
83 // Documentation inherited from parent
84 public: virtual void HandleKeyPressEvent(const std::string &_key);
85
86 public: double Pitch() const;
87
88 public: double Yaw() const;
89
92 protected: void TranslateLocal(const ignition::math::Vector3d &_vec);
93
96 protected: void TranslateGlobal(const ignition::math::Vector3d &_vec);
97
100 protected: void Zoom(float _amount);
101
105 protected: double NormalizeYaw(double _v);
106
110 protected: double NormalizePitch(double _v);
111
113 protected: void UpdateRefVisual();
114
118 protected: void Orbit(double _dy, double _dp);
119
121 protected: float yaw;
122
124 protected: float pitch;
125
127 protected: float distance;
128
131
133 protected: std::string key;
134
137 protected: bool init;
138
140 protected: ignition::math::Vector3d focalPoint;
141 };
143 }
144}
145#endif
rendering
Definition RenderEngine.hh:31
Generic description of a mouse event.
Definition MouseEvent.hh:36
Orbit view controller.
Definition OrbitViewController.hh:38
float distance
Distance to the focal point.
Definition OrbitViewController.hh:127
void TranslateLocal(const ignition::math::Vector3d &_vec)
Translate the focal point in the local coordinate frame.
void Zoom(float _amount)
Zoom the camera.
float pitch
Pitch value.
Definition OrbitViewController.hh:124
VisualPtr refVisual
A reference visual.
Definition OrbitViewController.hh:130
double NormalizeYaw(double _v)
Normalize yaw value.
virtual void Init()
Initialize the controller.
void TranslateGlobal(const ignition::math::Vector3d &_vec)
Translate the focal point in the global coordinate frame.
bool init
A flag used to inidicate that the view controller has just been initialized.
Definition OrbitViewController.hh:137
virtual ~OrbitViewController()
Destructor.
OrbitViewController(UserCameraPtr _camera, const std::string &_name="OrbitViewController")
Constructor.
float yaw
Yaw value.
Definition OrbitViewController.hh:121
ignition::math::Vector3d FocalPoint() const
Get the focal point.
static std::string GetTypeString()
Get the type name of this view controller.
void UpdateRefVisual()
Update the reference visual.
double NormalizePitch(double _v)
Normalize pitch value.
std::string key
Key that is currently pressed.
Definition OrbitViewController.hh:133
void SetFocalPoint(const ignition::math::Vector3d &_fp)
Set the focal point.
virtual void HandleMouseEvent(const common::MouseEvent &_event)
Handle a mouse event.
virtual void HandleKeyPressEvent(const std::string &_key)
Handle a key press event.
virtual void Init(const ignition::math::Vector3d &_focalPoint, const double _yaw=0, const double _pitch=0)
Initialize with a focus point.
void Orbit(double _dy, double _dp)
Update the camera's pose based on a rotation update.
ignition::math::Vector3d focalPoint
The focal point.
Definition OrbitViewController.hh:140
void SetDistance(float _d)
Set the distance to the focal point.
void HandleKeyReleaseEvent(const std::string &_key)
Handle a key release event.
Base class for view controllers.
Definition ViewController.hh:42
std::shared_ptr< Visual > VisualPtr
Definition RenderTypes.hh:114
boost::shared_ptr< UserCamera > UserCameraPtr
Definition RenderTypes.hh:94
Forward declarations for the common classes.
Definition Animation.hh:27