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 
22 #include <osg/ref_ptr>
23 #include <osgGA/GUIEventHandler>
24 
25 #include <QObject>
26 #include <QModelIndex>
27 
29 
30 namespace osgUtil {
31  class LineSegmentIntersector;
32 }
33 
34 namespace gepetto {
35  namespace gui {
36  class PickHandler : public osgGA::GUIEventHandler
37  {
38  public:
40 
41  virtual ~PickHandler();
42 
43  virtual bool handle( const osgGA::GUIEventAdapter& ea,
44  osgGA::GUIActionAdapter& aa );
45 
46  void getUsage (osg::ApplicationUsage &usage) const;
47 
48  private:
49  void computeIntersection (osgGA::GUIActionAdapter& aa,
50  const float& x, const float& y);
51 
52  void selectionNodeUnderCursor (osgGA::GUIActionAdapter& aa,
53  const float& x, const float& y, int modMask);
54 
55  void centerViewToMouse (osgGA::GUIActionAdapter& aa,
56  const float& x, const float& y);
57 
58  void setCameraToSelected (osgGA::GUIActionAdapter& aa, bool zoom);
59 
60  QtOsgKeyboard mapper_;
62  OSGWidget* parent_;
63  bool pushed_;
64  float lastX_, lastY_;
65 
66  osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector_;
67  };
68  }
69 }
70 
71 #endif // GEPETTO_GUI_PICK_HANDLER_HH
Definition: pick-handler.hh:36
Definition: action-search-bar.hh:27
Definition: pick-handler.hh:30
Widget that displays scenes.
Definition: osgwidget.hh:44
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition: fwd.hh:55
Definition: qt-osg-keyboard.hh:26