gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
pick-handler.hh
Go to the documentation of this file.
1// Copyright (c) 2015-2018, LAAS-CNRS
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3//
4// This file is part of gepetto-viewer.
5// gepetto-viewer is free software: you can redistribute it
6// and/or modify it under the terms of the GNU Lesser General Public
7// License as published by the Free Software Foundation, either version
8// 3 of the License, or (at your option) any later version.
9//
10// gepetto-viewer is distributed in the hope that it will be
11// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Lesser Public License for more details. You should have
14// received a copy of the GNU Lesser General Public License along with
15// gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17#ifndef GEPETTO_GUI_PICK_HANDLER_HH
18#define GEPETTO_GUI_PICK_HANDLER_HH
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
22#include <QModelIndex>
23#include <QObject>
25#include <osg/ref_ptr>
26#include <osgGA/GUIEventHandler>
27
28namespace osgUtil {
29class LineSegmentIntersector;
30}
31
32namespace gepetto {
33namespace gui {
34class PointIntersector;
35
36class PickHandler : public osgGA::GUIEventHandler {
37 public:
39
40 virtual ~PickHandler();
41
42 virtual bool handle(const osgGA::GUIEventAdapter& ea,
43 osgGA::GUIActionAdapter& aa);
44
45 void getUsage(osg::ApplicationUsage& usage) const;
46
47 private:
48 typedef osg::ref_ptr<osgUtil::LineSegmentIntersector> LineSegmentIntersector;
49
50 void computeLineIntersection(osgGA::GUIActionAdapter& aa, const float& x,
51 const float& y);
52
54 LineSegmentIntersector computeLineOrPointIntersection(
55 osgGA::GUIActionAdapter& aa, const float& x, const float& y);
56
57 void selectionNodeUnderCursor(osgGA::GUIActionAdapter& aa, const float& x,
58 const float& y, int modMask);
59
60 void centerViewToMouse(osgGA::GUIActionAdapter& aa, const float& x,
61 const float& y);
62
63 void setCameraToSelected(osgGA::GUIActionAdapter& aa, bool zoom);
64
65 QtOsgKeyboard mapper_;
67 OSGWidget* parent_;
68 bool pushed_;
69 float lastX_, lastY_;
70
71 LineSegmentIntersector lineIntersector_;
72 osg::ref_ptr<PointIntersector> pointIntersector_;
73};
74} // namespace gui
75} // namespace gepetto
76
77#endif // GEPETTO_GUI_PICK_HANDLER_HH
Widget that displays scenes.
Definition osgwidget.hh:44
Definition pick-handler.hh:36
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
PickHandler(OSGWidget *parent, WindowsManagerPtr_t wsm)
void getUsage(osg::ApplicationUsage &usage) const
Definition qt-osg-keyboard.hh:27
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition fwd.hh:59
Definition action-search-bar.hh:27
Definition pick-handler.hh:28