LVRPickingInteractor.hpp
Go to the documentation of this file.
1 
34 #ifndef LVRPICKINGINTERACTOR_HPP_
35 #define LVRPICKINGINTERACTOR_HPP_
36 
37 #include <QObject>
38 #include <QMessageBox>
39 
40 #include <vtkIdTypeArray.h>
41 #include <vtkTextActor.h>
42 #include <QTreeWidgetItem>
43 #include <vtkInteractorStyleTrackballCamera.h>
44 #include <vtkInteractorStyleRubberBandPick.h>
45 #include <vtkSmartPointer.h>
46 #include <vtkRenderer.h>
47 #include <vtkMath.h>
48 #include <vtkDataSetMapper.h>
49 
50 #include <boost/shared_array.hpp>
51 
52 #include <memory>
54 #include <map>
55 
56 namespace lvr2
57 {
58 
59 
61 {
62  Q_OBJECT
63 public:
64  static LVRPickingInteractor* New();
67  void setRenderer(vtkSmartPointer<vtkRenderer> renderer);
68  void removeLabel(const int&);
69  //LVRPickingInteractor(vtkSmartPointer<vtkRenderer> renderer);
70  virtual ~LVRPickingInteractor();
71 
75  virtual void OnLeftButtonDown();
76  virtual void OnLeftButtonUp();
77  virtual void OnMouseMove();
78  virtual void OnMiddleButtonUp();
79  virtual void OnMiddleButtonDown();
80  virtual void OnRightButtonUp();
81  virtual void OnRightButtonDown();
82  virtual void OnMouseWheelBackward();
83  virtual void OnMouseWheelForward();
84 
85  virtual void OnChar();
86  virtual void OnTimer();
87 
91  virtual void OnKeyPress();
92 
96  virtual void OnKeyRelease();
97 
98  virtual void OnKeyDown();
99 
100  virtual void Dolly();
101  virtual void Dolly(double factor);
102  virtual void Pan();
103  virtual void Spin();
104  virtual void Zoom();
105  virtual void Rotate();
106 
107 
111  vtkSmartPointer<vtkTextActor> getTextActor(){ return m_textActor; }
112 
113  void updateFocalPoint();
114  void setPoints(vtkSmartPointer<vtkPolyData> points);
115  vtkSmartPointer<vtkPolyData> getPoints();
116 
117  std::vector<uint16_t>& getLabeles();
118 public Q_SLOTS:
119  void correspondenceSearchOn();
121 
122  void labelingOn();
123  void labelingOff();
124  void setLabeledPointVisibility(int, bool);
125  void setLabel(int, std::vector<int>);
126  void requestLabels();
127 
128  void labelModeChanged(bool);
129  void newLabel(QTreeWidgetItem*);
130  void setLassoTool(bool);
131  void labelSelected(uint16_t);
132 
133  void setMotionFactor(double factor);
134  void setRotationFactor(double factor);
135 
136  void setFocalPointRendering(int state);
137  void setStereoMode(int state);
138 
139  void pickFocalPoint();
140 
141  void modeTerrain();
142  void modeTrackball();
143  void modeShooter();
144 
145  void resetCamera();
146 
147 Q_SIGNALS:
148  void clusterSelected(double*);
149  void firstPointPicked(double*);
150  void secondPointPicked(double*);
151  void pointSelected(vtkActor*, int);
152  void pointsLabeled(uint16_t, int);
153  void responseLabels(std::vector<uint16_t>);
154  void labelingStarted(bool);
155 
156 private:
157 
161 
162  void handlePicking();
163 
164  // ------------------------- TRACKBALL
165 
166  void dollyTrackball();
167  void dollyTrackball(double factor);
168  void panTrackball();
169  void spinTrackball();
170  void zoomTrackball();
171  void rotateTrackball();
172 
175  void onMouseMoveTrackball();
182 
183  // ------------------------ TERRAIN
184 
185  void dollyTerrain();
186  void dollyTerrain(double factor);
187  void panTerrain();
188  void spinTerrain();
189  void zoomTerrain();
190  void rotateTerrain();
191 
193  void onLeftButtonUpTerrain();
194  void onMouseMoveTerrain();
197  void onRightButtonUpTerrain();
201 
202  // ------------------------ SHOOTER
203 
204  void dollyShooter();
205  void dollyShooter(double factor);
206  void panShooter();
207  void spinShooter();
208  void zoomShooter();
209  void rotateShooter();
210  void hoverShooter();
211  void resetViewUpShooter();
212  void strafeShooter(double factor);
213 
215  void onLeftButtonUpShooter();
216  void onMouseMoveShooter();
219  void onRightButtonUpShooter();
223 
224  //Labeling
225  bool isInside(std::vector<vtkVector2i>* polygon, int& pX, int& pY);
226  void calculateSelection(bool select);
228  void discardChanges();
229  void updateActor(int);
230 
233 
235  vtkSmartPointer<vtkTextActor> m_textActor;
236  vtkSmartPointer<vtkActor> m_sphereActor;
237  vtkSmartPointer<vtkActor> m_cubeActor;
238  vtkSmartPointer<vtkActor> m_polyActor;
239  std::vector<bool> m_selectedPoints;
240  std::map<uint16_t, vtkSmartPointer<vtkActor>> m_labelActors;
241  vtkSmartPointer<vtkActor> m_selectedActor;
242  std::vector<uint16_t> m_pointLabels;
243  vtkSmartPointer<vtkPolyData> m_points;
244  vtkSmartPointer<vtkDataSetMapper> m_selectedMapper;
245  vtkSmartPointer<vtkIdTypeArray> m_selectedIds;
246 
247  vtkSmartPointer<vtkRenderer> m_renderer;
248 
252 
253  unsigned int m_numberOfClicks;
257 
258 
259  double m_viewUp[3];
260 
263 
266 
267  std::map<uint16_t, QColor> m_labelColors;
268 
269 
270 };
271 
272 } /* namespace lvr2 */
273 
274 #endif /* LVRPICKINGINTERACTOR_HPP_ */
void pointSelected(vtkActor *, int)
vtkSmartPointer< vtkActor > m_polyActor
vtkSmartPointer< vtkActor > m_selectedActor
bool isInside(std::vector< vtkVector2i > *polygon, int &pX, int &pY)
std::vector< uint16_t > & getLabeles()
vtkSmartPointer< vtkDataSetMapper > m_selectedMapper
void setPoints(vtkSmartPointer< vtkPolyData > points)
void responseLabels(std::vector< uint16_t >)
vtkSmartPointer< vtkActor > m_sphereActor
void secondPointPicked(double *)
vtkSmartPointer< vtkRenderer > m_renderer
vtkSmartPointer< vtkActor > m_cubeActor
std::map< uint16_t, vtkSmartPointer< vtkActor > > m_labelActors
static LVRPickingInteractor * New()
vtkSmartPointer< vtkIdTypeArray > m_selectedIds
std::vector< bool > m_selectedPoints
void setLabel(int, std::vector< int >)
void pointsLabeled(uint16_t, int)
void newLabel(QTreeWidgetItem *)
vtkTypeMacro(LVRPickingInteractor, LVRInteractorStylePolygonPick)
void setRenderer(vtkSmartPointer< vtkRenderer > renderer)
std::vector< uint16_t > m_pointLabels
vtkSmartPointer< vtkTextActor > m_textActor
Text actor to display info if in picking mode.
PickMode m_pickMode
Indicates picking mode.
void clusterSelected(double *)
void firstPointPicked(double *)
Like TrackBallCamera, but this can pick props underneath a rubber band selection rectangle.
std::map< uint16_t, QColor > m_labelColors
virtual void OnLeftButtonDown()
Overloaded mouse event handling.
virtual void OnKeyPress()
Overloaded keyboard press event handling.
vtkSmartPointer< vtkPolyData > m_points
vtkSmartPointer< vtkPolyData > getPoints()
virtual void OnKeyRelease()
Overloaded keyboard release event handling.
void setRotationFactor(double factor)
vtkSmartPointer< vtkTextActor > getTextActor()
returns the text-actor, needed to readd-it after clearing the render window


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08