OrbitViewController.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 _ORBITVIEWCONTROLLER_HH_
18 #define _ORBITVIEWCONTROLLER_HH_
19 
20 #include <string>
21 
24 #include "gazebo/math/Vector3.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace rendering
30  {
33 
37  {
40  public: OrbitViewController(UserCameraPtr _camera);
41 
43  public: virtual ~OrbitViewController();
44 
46  public: virtual void Init();
47 
48  // Documentation inherited
49  public: virtual void Init(const math::Vector3 &_focalPoint,
50  const double _yaw = 0, const double _pitch = 0);
51 
53  public: virtual void Update();
54 
57  public: virtual void HandleMouseEvent(const common::MouseEvent &_event);
58 
61  public: static std::string GetTypeString();
62 
65  public: void SetDistance(float _d);
66 
69  public: void SetFocalPoint(const math::Vector3 &_fp);
70 
73  public: math::Vector3 GetFocalPoint() const;
74 
75  // Documentation inherited from parent
76  public: void HandleKeyReleaseEvent(const std::string &_key);
77 
78  // Documentation inherited from parent
79  public: virtual void HandleKeyPressEvent(const std::string &_key);
80 
81  public: double Pitch() const;
82 
83  public: double Yaw() const;
84 
87  protected: void TranslateLocal(const math::Vector3 &_vec);
88 
91  protected: void TranslateGlobal(const math::Vector3 &_vec);
92 
95  protected: void Zoom(float _amount);
96 
100  protected: double NormalizeYaw(double _v);
101 
105  protected: double NormalizePitch(double _v);
106 
108  protected: void UpdateRefVisual();
109 
113  protected: void Orbit(double _dy, double _dp);
114 
116  protected: float yaw;
117 
119  protected: float pitch;
120 
122  protected: float distance;
123 
125  protected: VisualPtr refVisual;
126 
128  protected: std::string key;
129 
132  protected: bool init;
133 
136  };
138  }
139 }
140 #endif
float distance
Distance to the focal point.
Definition: OrbitViewController.hh:122
math::Vector3 focalPoint
The focal point.
Definition: OrbitViewController.hh:135
Generic description of a mouse event.
Definition: MouseEvent.hh:35
float pitch
Pitch value.
Definition: OrbitViewController.hh:119
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Orbit view controller.
Definition: OrbitViewController.hh:36
float yaw
Yaw value.
Definition: OrbitViewController.hh:116
#define GZ_RENDERING_VISIBLE
Definition: system.hh:241
VisualPtr refVisual
A reference visual.
Definition: OrbitViewController.hh:125
bool init
A flag used to inidicate that the view controller has just been initialized.
Definition: OrbitViewController.hh:132
std::string key
Key that is currently pressed.
Definition: OrbitViewController.hh:128
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:107
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:91
Base class for view controllers.
Definition: ViewController.hh:34