##

OrbitViewController.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_RENDERING_ORBITVIEWCONTROLLER_HH_
#define GAZEBO_RENDERING_ORBITVIEWCONTROLLER_HH_
#include <string>
#include <ignition/math/Vector3.hh>
#include "gazebo/rendering/Visual.hh"
#include "gazebo/rendering/ViewController.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace rendering
{
class GZ_RENDERING_VISIBLE OrbitViewController : public ViewController
{
public: OrbitViewController(UserCameraPtr _camera,
const std::string &_name = "OrbitViewController");
public: virtual ~OrbitViewController();
public: virtual void Init();
// Documentation inherited
public: virtual void Init(const ignition::math::Vector3d &_focalPoint,
const double _yaw = 0, const double _pitch = 0);
public: virtual void Update();
public: virtual void HandleMouseEvent(const common::MouseEvent &_event);
public: static std::string GetTypeString();
public: void SetDistance(float _d);
public: void SetFocalPoint(const ignition::math::Vector3d &_fp);
public: ignition::math::Vector3d FocalPoint() const;
// Documentation inherited from parent
public: void HandleKeyReleaseEvent(const std::string &_key);
// Documentation inherited from parent
public: virtual void HandleKeyPressEvent(const std::string &_key);
public: double Pitch() const;
public: double Yaw() const;
protected: void TranslateLocal(const ignition::math::Vector3d &_vec);
protected: void TranslateGlobal(const ignition::math::Vector3d &_vec);
protected: void Zoom(float _amount);
protected: double NormalizeYaw(double _v);
protected: double NormalizePitch(double _v);
protected: void UpdateRefVisual();
protected: void Orbit(double _dy, double _dp);
protected: float yaw;
protected: float pitch;
protected: float distance;
protected: VisualPtr refVisual;
protected: std::string key;
protected: bool init;
protected: ignition::math::Vector3d focalPoint;
};
}
}
#endif
gazebo::rendering::OrbitViewController::key
std::string key
Key that is currently pressed.
Definition: OrbitViewController.hh:133
gazebo::rendering::OrbitViewController::Init
virtual void Init()
Initialize the controller.
gazebo::rendering::OrbitViewController::~OrbitViewController
virtual ~OrbitViewController()
Destructor.
gazebo::rendering::UserCameraPtr
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:94
gazebo::rendering::OrbitViewController::NormalizePitch
double NormalizePitch(double _v)
Normalize pitch value.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::OrbitViewController::TranslateGlobal
void TranslateGlobal(const ignition::math::Vector3d &_vec)
Translate the focal point in the global coordinate frame.
gazebo::rendering::OrbitViewController::yaw
float yaw
Yaw value.
Definition: OrbitViewController.hh:121
gazebo::rendering::OrbitViewController::refVisual
VisualPtr refVisual
A reference visual.
Definition: OrbitViewController.hh:130
system.hh
gazebo::rendering::OrbitViewController::focalPoint
ignition::math::Vector3d focalPoint
The focal point.
Definition: OrbitViewController.hh:140
gazebo::rendering::OrbitViewController::Orbit
void Orbit(double _dy, double _dp)
Update the camera's pose based on a rotation update.
gazebo::rendering::OrbitViewController
Orbit view controller.
Definition: OrbitViewController.hh:37
ViewController.hh
gazebo::rendering::OrbitViewController::HandleKeyReleaseEvent
void HandleKeyReleaseEvent(const std::string &_key)
Handle a key release event.
gazebo::rendering::OrbitViewController::SetFocalPoint
void SetFocalPoint(const ignition::math::Vector3d &_fp)
Set the focal point.
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::OrbitViewController::SetDistance
void SetDistance(float _d)
Set the distance to the focal point.
gazebo::rendering::OrbitViewController::HandleMouseEvent
virtual void HandleMouseEvent(const common::MouseEvent &_event)
Handle a mouse event.
gazebo::rendering::OrbitViewController::UpdateRefVisual
void UpdateRefVisual()
Update the reference visual.
Visual.hh
gazebo::rendering::OrbitViewController::init
bool init
A flag used to inidicate that the view controller has just been initialized.
Definition: OrbitViewController.hh:137
gazebo::rendering::OrbitViewController::pitch
float pitch
Pitch value.
Definition: OrbitViewController.hh:124
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::rendering::OrbitViewController::HandleKeyPressEvent
virtual void HandleKeyPressEvent(const std::string &_key)
Handle a key press event.
gazebo::rendering::OrbitViewController::FocalPoint
ignition::math::Vector3d FocalPoint() const
Get the focal point.
gazebo::rendering::OrbitViewController::NormalizeYaw
double NormalizeYaw(double _v)
Normalize yaw value.
gazebo::rendering::OrbitViewController::Pitch
double Pitch() const
gazebo::rendering::OrbitViewController::Update
virtual void Update()
Update.
gazebo::rendering::OrbitViewController::GetTypeString
static std::string GetTypeString()
Get the type name of this view controller.
gazebo::rendering::VisualPtr
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
gazebo::rendering::OrbitViewController::TranslateLocal
void TranslateLocal(const ignition::math::Vector3d &_vec)
Translate the focal point in the local coordinate frame.
gazebo::rendering::ViewController
Base class for view controllers.
Definition: ViewController.hh:41
gazebo::rendering::OrbitViewController::Zoom
void Zoom(float _amount)
Zoom the camera.
gazebo::rendering::OrbitViewController::distance
float distance
Distance to the focal point.
Definition: OrbitViewController.hh:127
gazebo::rendering::OrbitViewController::OrbitViewController
OrbitViewController(UserCameraPtr _camera, const std::string &_name="OrbitViewController")
Constructor.
gazebo::rendering::OrbitViewController::Yaw
double Yaw() const
gazebo::common::MouseEvent
Generic description of a mouse event.
Definition: MouseEvent.hh:35