##

GLWidget.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_GLWIDGET_HH_
#define GAZEBO_GUI_GLWIDGET_HH_
#include <memory>
#include <string>
#include <vector>
#include "gazebo/gui/qt.h"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace common
{
class MouseEvent;
}
namespace gui
{
class GLWidgetPrivate;
class GZ_GUI_VISIBLE GLWidget : public QWidget
{
Q_OBJECT
public: enum SelectionLevels {
MODEL,
LINK
};
public: explicit GLWidget(QWidget *_parent = 0);
public: virtual ~GLWidget();
public: void ViewScene(rendering::ScenePtr _scene);
public: rendering::UserCameraPtr Camera() const;
public: rendering::ScenePtr Scene() const;
public: void Clear();
public: std::vector<rendering::VisualPtr> SelectedVisuals() const;
signals: void clicked();
signals: void selectionMsgReceived(const QString &_name);
protected: virtual void moveEvent(QMoveEvent *_e);
protected: virtual void paintEvent(QPaintEvent *_e);
protected: virtual void resizeEvent(QResizeEvent *_e);
protected: virtual void showEvent(QShowEvent *_e);
protected: virtual void enterEvent(QEvent *_event);
protected: void keyPressEvent(QKeyEvent *_event);
protected: void keyReleaseEvent(QKeyEvent *_event);
protected: void wheelEvent(QWheelEvent *_event);
protected: void mousePressEvent(QMouseEvent *_event);
protected: void mouseDoubleClickEvent(QMouseEvent *_event);
protected: void mouseMoveEvent(QMouseEvent *_event);
protected: void mouseReleaseEvent(QMouseEvent *_event);
protected: virtual QPaintEngine *paintEngine() const;
private: std::string OgreHandle() const;
private: bool OnMouseMove(const common::MouseEvent &_event);
private: void OnMouseMoveNormal();
private: void OnMouseMoveMakeEntity();
private: bool OnMouseRelease(const common::MouseEvent &_event);
private: void OnMouseReleaseNormal();
private: void OnMouseReleaseMakeEntity();
private: bool OnMousePress(const common::MouseEvent &_event);
private: void OnMousePressNormal();
private: void OnMousePressMakeEntity();
private: bool OnMouseDoubleClick(const common::MouseEvent &_event);
private: void OnRequest(ConstRequestPtr &_msg);
private: void OnCreateScene(const std::string &_name);
private: void OnRemoveScene(const std::string &_name);
private: void OnMoveMode(bool _mode);
private: void OnCreateEntity(const std::string &_type,
const std::string &_data);
private: void OnFPS();
private: void OnOrbit();
private: void OnManipMode(const std::string &_mode);
private: void OnSetSelectedEntity(const std::string &_name,
const std::string &_mode);
private: bool eventFilter(QObject *_obj, QEvent *_event);
private: void ClearSelection();
private: void SetSelectedVisual(rendering::VisualPtr _vis);
private: void DeselectAllVisuals();
private: void OnAlignMode(const std::string &_axis,
const std::string &_config, const std::string &_target,
const bool _preview, const bool _inverted = false);
private: void Copy(const std::string &_name);
private: void Paste(const std::string &_name);
private slots: void OnCopy();
private slots: void OnPaste();
private slots: void OnModelEditor(bool _checked);
private slots: void OnOrtho();
private slots: void OnPerspective();
private: void SetMouseEventButton(const Qt::MouseButton &_button);
private: void SetMouseEventButtons(const Qt::MouseButtons &_buttons);
private: std::unique_ptr<GLWidgetPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::UserCameraPtr
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:94
gazebo::gui::GLWidget::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *_event)
gazebo::gui::GLWidget::LINK
Link level.
Definition: GLWidget.hh:50
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::GLWidget::paintEngine
virtual QPaintEngine * paintEngine() const
Override paintEngine to stop Qt From trying to draw on top of OGRE.
gazebo::gui::GLWidget::~GLWidget
virtual ~GLWidget()
gazebo::gui::GLWidget::selectionMsgReceived
void selectionMsgReceived(const QString &_name)
QT signal to notify when we received a selection msg.
common
common
Definition: FuelModelDatabase.hh:37
system.hh
msgs.hh
gazebo::gui::GLWidget::enterEvent
virtual void enterEvent(QEvent *_event)
gazebo::gui::GLWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *_event)
gazebo::gui::GLWidget::GLWidget
GLWidget(QWidget *_parent=0)
gazebo::gui::GLWidget::ViewScene
void ViewScene(rendering::ScenePtr _scene)
View a scene in this widget.
gazebo::gui::GLWidget::keyPressEvent
void keyPressEvent(QKeyEvent *_event)
gazebo::rendering::ScenePtr
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
gazebo::gui::GLWidget::Clear
void Clear()
RenderTypes.hh
gazebo::gui::GLWidget::mousePressEvent
void mousePressEvent(QMouseEvent *_event)
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::GLWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *_e)
gazebo::gui::GLWidget
Definition: GLWidget.hh:40
gazebo::gui::GLWidget::SelectionLevels
SelectionLevels
Unique identifiers for all selection levels supported.
Definition: GLWidget.hh:46
gazebo::gui::GLWidget::paintEvent
virtual void paintEvent(QPaintEvent *_e)
gazebo::gui::GLWidget::wheelEvent
void wheelEvent(QWheelEvent *_event)
gazebo::gui::GLWidget::clicked
void clicked()
gazebo::gui::GLWidget::SelectedVisuals
std::vector< rendering::VisualPtr > SelectedVisuals() const
Returns the list of selected visuals.
gazebo::gui::GLWidget::Camera
rendering::UserCameraPtr Camera() const
Return the user camera.
gazebo::gui::GLWidget::showEvent
virtual void showEvent(QShowEvent *_e)
Custom processing for the QT showEvent.
gazebo::rendering::VisualPtr
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
gazebo::gui::GLWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *_event)
gazebo::gui::GLWidget::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *_event)
gazebo::gui::GLWidget::MODEL
Model level.
Definition: GLWidget.hh:48
gazebo::gui::GLWidget::Scene
rendering::ScenePtr Scene() const
Return the scene.
gazebo::gui::GLWidget::moveEvent
virtual void moveEvent(QMoveEvent *_e)
gazebo::common::MouseEvent
Generic description of a mouse event.
Definition: MouseEvent.hh:35