gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
selection-event.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_SELECTION_EVENT_HH
18#define GEPETTO_GUI_SELECTION_EVENT_HH
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
22#include <gepetto/viewer/node.h>
23
24#include <QAtomicInt>
25#include <QObject>
26#include <QString>
27#include <QVector3D>
28
29namespace gepetto {
30namespace gui {
31class SelectionEvent : public QObject {
32 Q_OBJECT
33
34 public:
36
38 Qt::KeyboardModifiers modKey = Qt::NoModifier)
39 : type_(t),
40 node_(node),
41 modKey_(modKey),
42 hasIntersection_(false),
43 c_(-1) {
44 if (node) nodeName_ = QString::fromStdString(node->getID());
45 }
46
47 SelectionEvent(const Type& t, Qt::KeyboardModifiers modKey)
48 : type_(t), modKey_(modKey), hasIntersection_(false), c_(-1) {}
49
51 const osgUtil::LineSegmentIntersector::Intersection& it);
52
53 const NodePtr_t& node() const { return node_; }
54
55 void modKey(const Qt::KeyboardModifiers& m) { modKey_ = m; }
56
59 void setCounter(int c) { c_ = c; }
60
61 public slots:
62 Type type() const { return type_; }
63 QString nodeName() const { return nodeName_; }
64 Qt::KeyboardModifiers modKey() const { return modKey_; }
65
66 bool hasIntersection() { return hasIntersection_; }
67 const unsigned int& primitiveIndex() const { return primitiveIndex_; }
68 QVector3D normal(bool local) const {
69 return (local ? localNormal_ : worldNormal_);
70 }
71 QVector3D point(bool local) const {
72 return (local ? localPoint_ : worldPoint_);
73 }
78 void done();
79
80 private:
81 Type type_;
82 QString nodeName_;
83 NodePtr_t node_;
84 Qt::KeyboardModifiers modKey_;
85
86 bool hasIntersection_;
87 unsigned int primitiveIndex_;
88 QVector3D localPoint_, localNormal_, worldPoint_, worldNormal_;
89 QAtomicInt c_;
90};
91} // namespace gui
92} // namespace gepetto
93
94#endif // GEPETTO_GUI_SELECTION_EVENT_HH
Definition selection-event.hh:31
SelectionEvent(const Type &t, Qt::KeyboardModifiers modKey)
Definition selection-event.hh:47
QVector3D normal(bool local) const
Definition selection-event.hh:68
Qt::KeyboardModifiers modKey() const
Definition selection-event.hh:64
Type type() const
Definition selection-event.hh:62
void modKey(const Qt::KeyboardModifiers &m)
Definition selection-event.hh:55
SelectionEvent(const Type &t, NodePtr_t node=NodePtr_t(), Qt::KeyboardModifiers modKey=Qt::NoModifier)
Definition selection-event.hh:37
void setupIntersection(const osgUtil::LineSegmentIntersector::Intersection &it)
QString nodeName() const
Definition selection-event.hh:63
const unsigned int & primitiveIndex() const
Definition selection-event.hh:67
bool hasIntersection()
Definition selection-event.hh:66
Type
Definition selection-event.hh:35
@ FromBodyTree
Definition selection-event.hh:35
@ FromOsgWindow
Definition selection-event.hh:35
QVector3D point(bool local) const
Definition selection-event.hh:71
void setCounter(int c)
Definition selection-event.hh:59
const NodePtr_t & node() const
Definition selection-event.hh:53
viewer::NodePtr_t NodePtr_t
Definition fwd.hh:52
Definition action-search-bar.hh:27