##

ModelManipulator.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_GUI_MODELMANIPULATOR_HH_
#define GAZEBO_GUI_MODELMANIPULATOR_HH_
#include <memory>
#include <string>
#include <ignition/math/Vector2.hh>
#include <ignition/math/Vector3.hh>
#include <ignition/math/Pose3.hh>
#include "gazebo/common/MouseEvent.hh"
#include "gazebo/common/KeyEvent.hh"
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/common/SingletonT.hh"
#include "gazebo/util/system.hh"
GZ_SINGLETON_DECLARE(GZ_GUI_VISIBLE, gazebo, gui, ModelManipulator)
namespace gazebo
{
namespace gui
{
class ModelManipulatorPrivate;
class GZ_GUI_VISIBLE ModelManipulator : public SingletonT<ModelManipulator>
{
private: ModelManipulator();
private: virtual ~ModelManipulator();
public: void Init();
public: void Clear();
public: void Detach();
public: void SetManipulationMode(const std::string &_mode);
public: void SetAttachedVisual(rendering::VisualPtr _vis);
public: void OnMousePressEvent(const common::MouseEvent &_event);
public: void OnMouseMoveEvent(const common::MouseEvent &_event);
public: void OnMouseReleaseEvent(const common::MouseEvent &_event);
public: void OnKeyPressEvent(const common::KeyEvent &_event);
public: void OnKeyReleaseEvent(const common::KeyEvent &_event);
public: void RotateEntity(rendering::VisualPtr &_vis,
const ignition::math::Vector3d &_axis,
const bool _local = false);
public: void TranslateEntity(rendering::VisualPtr &_vis,
const ignition::math::Vector3d &_axis,
const bool _local = false);
public: void ScaleEntity(rendering::VisualPtr &_vis,
const ignition::math::Vector3d &_axis,
const bool _local = false);
public: static ignition::math::Vector3d SnapPoint(
const ignition::math::Vector3d &_point,
const double _interval = 1.0, const double _sensitivity = 0.4);
public: static ignition::math::Vector3d MousePositionOnPlane(
rendering::CameraPtr _camera,
const common::MouseEvent &_event);
public: static ignition::math::Vector3d MouseMoveDistance(
rendering::CameraPtr _camera,
const ignition::math::Vector2i &_start,
const ignition::math::Vector2i &_end,
const ignition::math::Pose3d &_pose,
const ignition::math::Vector3d &_axis, const bool _local);
private: ignition::math::Vector3d MouseMoveDistance(
const ignition::math::Pose3d &_pose,
const ignition::math::Vector3d &_axis, const bool _local) const;
private: void SetMouseMoveVisual(rendering::VisualPtr _vis);
private: void PublishVisualPose(rendering::VisualPtr _vis);
private: void PublishVisualScale(rendering::VisualPtr _vis);
private: ignition::math::Vector3d UpdateScale(
const ignition::math::Vector3d &_axis,
const ignition::math::Vector3d &_scale, const std::string &_geom);
private: friend class SingletonT<ModelManipulator>;
private: std::unique_ptr<ModelManipulatorPrivate> dataPtr;
};
}
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo
gazebo
Definition: ModelManipulator.hh:35
SingletonT
Singleton template class.
Definition: SingletonT.hh:33
system.hh
RenderTypes.hh
gazebo::common::KeyEvent
Generic description of a keyboard event.
Definition: KeyEvent.hh:32
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::gui::ModelManipulator
Manipulator tool for translating/rotating/scaling models and links.
Definition: ModelManipulator.hh:46
KeyEvent.hh
gazebo::rendering::VisualPtr
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
gazebo::rendering::CameraPtr
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:90
gui
gui
Definition: ModelManipulator.hh:35
GZ_SINGLETON_DECLARE
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61
SingletonT.hh
MouseEvent.hh
gazebo::common::MouseEvent
Generic description of a mouse event.
Definition: MouseEvent.hh:35