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/math/Vector3.hh"
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  namespace rendering
32  {
35 
38  class GZ_RENDERING_VISIBLE OrbitViewController : public ViewController
39  {
45  public: OrbitViewController(UserCameraPtr _camera,
46  const std::string &_name = "OrbitViewController");
47 
49  public: virtual ~OrbitViewController();
50 
52  public: virtual void Init();
53 
54  // Documentation inherited
56  public: virtual void Init(const math::Vector3 &_focalPoint,
57  const double _yaw = 0, const double _pitch = 0) GAZEBO_DEPRECATED(8.0);
58 
59  // Documentation inherited
60  public: virtual void Init(const ignition::math::Vector3d &_focalPoint,
61  const double _yaw = 0, const double _pitch = 0);
62 
64  public: virtual void Update();
65 
68  public: virtual void HandleMouseEvent(const common::MouseEvent &_event);
69 
72  public: static std::string GetTypeString();
73 
76  public: void SetDistance(float _d);
77 
81  public: void SetFocalPoint(const math::Vector3 &_fp)
82  GAZEBO_DEPRECATED(8.0);
83 
86  public: void SetFocalPoint(const ignition::math::Vector3d &_fp);
87 
91  public: math::Vector3 GetFocalPoint() const GAZEBO_DEPRECATED(8.0);
92 
95  public: ignition::math::Vector3d FocalPoint() const;
96 
97  // Documentation inherited from parent
98  public: void HandleKeyReleaseEvent(const std::string &_key);
99 
100  // Documentation inherited from parent
101  public: virtual void HandleKeyPressEvent(const std::string &_key);
102 
103  public: double Pitch() const;
104 
105  public: double Yaw() const;
106 
110  protected: void TranslateLocal(const math::Vector3 &_vec)
111  GAZEBO_DEPRECATED(8.0);
112 
116  protected: void TranslateGlobal(const math::Vector3 &_vec)
117  GAZEBO_DEPRECATED(8.0);
118 
121  protected: void TranslateLocal(const ignition::math::Vector3d &_vec);
122 
125  protected: void TranslateGlobal(const ignition::math::Vector3d &_vec);
126 
129  protected: void Zoom(float _amount);
130 
134  protected: double NormalizeYaw(double _v);
135 
139  protected: double NormalizePitch(double _v);
140 
142  protected: void UpdateRefVisual();
143 
147  protected: void Orbit(double _dy, double _dp);
148 
150  protected: float yaw;
151 
153  protected: float pitch;
154 
156  protected: float distance;
157 
159  protected: VisualPtr refVisual;
160 
162  protected: std::string key;
163 
166  protected: bool init;
167 
169  protected: ignition::math::Vector3d focalPoint;
170  };
172  }
173 }
174 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:93
float distance
Distance to the focal point.
Definition: OrbitViewController.hh:156
VisualPtr refVisual
A reference visual.
Definition: OrbitViewController.hh:159
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
Orbit view controller.
Definition: OrbitViewController.hh:38
float yaw
Yaw value.
Definition: OrbitViewController.hh:150
ignition::math::Vector3d focalPoint
The focal point.
Definition: OrbitViewController.hh:169
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
float pitch
Pitch value.
Definition: OrbitViewController.hh:153
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:113
bool init
A flag used to inidicate that the view controller has just been initialized.
Definition: OrbitViewController.hh:166
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
std::string key
Key that is currently pressed.
Definition: OrbitViewController.hh:162
Base class for view controllers.
Definition: ViewController.hh:42