30 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
38 #include <QtWidgets/QAction>
39 #include <QtGui/QCursor>
40 #include <QtCore/QObject>
41 #include <QtCore/QPointer>
42 #include <QtWidgets/QShortcut>
43 #include <QtCore/QTimer>
52 #include <vtkSmartPointer.h>
53 #include <vtkWeakPointer.h>
61 class vtkRenderWindowInteractor;
63 class vtkInteractorStyle;
104 QActionGroup* modifierGroup =
nullptr);
134 bool isActive()
const;
143 return ActiveReaction;
152 static void endActiveSelection();
162 void handleSelectionChanged(vtkObject* caller,
163 unsigned long eventId,
169 Q_INVOKABLE
void handleMouseMove();
174 Q_INVOKABLE
void handleLeftButtonPress();
179 Q_INVOKABLE
void handleLeftButtonRelease();
184 Q_INVOKABLE
void handleWheelRotate();
189 Q_INVOKABLE
void handleRightButtonPressed();
194 Q_INVOKABLE
void handleRightButtonRelease();
207 void vtkOnSelectionChanged(vtkObject* caller,
208 unsigned long eventId,
210 void vtkOnMouseMove(vtkObject* caller,
211 unsigned long eventId,
213 void vtkOnLeftButtonPress(vtkObject* caller,
214 unsigned long eventId,
216 void vtkOnLeftButtonRelease(vtkObject* caller,
217 unsigned long eventId,
219 void vtkOnWheelRotate(vtkObject* caller,
220 unsigned long eventId,
222 void vtkOnRightButtonPressed(vtkObject* caller,
223 unsigned long eventId,
225 void vtkOnRightButtonRelease(vtkObject* caller,
226 unsigned long eventId,
228 void vtkOnMiddleButtonPressed(vtkObject* caller,
229 unsigned long eventId,
231 void vtkOnMiddleButtonRelease(vtkObject* caller,
232 unsigned long eventId,
270 virtual void actionTriggered(
bool val);
280 virtual void updateEnableState();
296 virtual void beginSelection();
310 virtual void endSelection();
317 virtual void onMouseStop();
324 virtual void clearSelectionCache();
338 virtual void selectionChanged(vtkObject* caller,
339 unsigned long eventId,
347 virtual void onMouseMove();
352 virtual void onLeftButtonPress();
359 virtual void onLeftButtonRelease();
366 virtual void onWheelRotate();
371 virtual void onRightButtonPressed();
376 virtual void onRightButtonRelease();
381 virtual void onMiddleButtonPressed();
387 virtual void onMiddleButtonRelease();
394 virtual void preSelection();
401 virtual void fastPreSelection();
408 virtual void updateTooltip();
418 virtual int getSelectionModifier();
434 virtual void cleanupObservers();
439 void uncheckSelectionModifiers();
450 void selectCellsOnSurface(
int region[4],
int selectionModifier);
457 void selectPointsOnSurface(
int region[4],
int selectionModifier);
464 void selectFrustumCells(
int region[4],
int selectionModifier);
471 void selectFrustumPoints(
int region[4],
int selectionModifier);
482 int selectionModifier,
483 const QString& description);
490 void selectPolygonCells(vtkIntArray*
polygon,
int selectionModifier);
497 void selectPolygonPoints(vtkIntArray*
polygon,
int selectionModifier);
504 void selectBlock(
int region[4],
int selectionModifier);
528 bool isSelectingCells()
const;
533 bool isInteractiveMode()
const;
538 bool isTooltipMode()
const;
543 void setCursor(
const QCursor& cursor);
553 void storeCurrentStyle();
563 void setupInteractorStyle();
568 void setupObservers();
577 void addCameraMovementObservers(
int startIndex);
585 void setRubberBand3DStyle(
bool renderOnMouseMove);
590 void showInstructionDialog();
594 QPointer<QAction> m_parentAction;
595 QPointer<QActionGroup> m_modifierGroup;
604 vtkRenderWindowInteractor* m_interactor =
nullptr;
605 vtkRenderer* m_renderer =
nullptr;
610 int m_previousRenderViewMode = -1;
613 unsigned long m_observerIds[8] = {0, 0, 0, 0, 0, 0, 0, 0};
614 vtkWeakPointer<vtkObject> m_observedObject;
617 unsigned long m_styleObserverId = 0;
620 QCursor m_zoomCursor;
623 QTimer m_mouseMovingTimer;
624 bool m_mouseMoving =
false;
625 int m_mousePosition[2] = {0, 0};
628 int m_zoomStartPosition[2] = {0, 0};
629 bool m_zoomTracking =
false;
632 bool m_disablePreSelection =
false;
635 QString m_plainTooltipText;
636 QShortcut* m_copyTooltipShortcut =
nullptr;
639 vtkIdType m_hoveredId = -1;
640 vtkPolyData* m_currentPolyData =
nullptr;
647 static QPointer<cvRenderViewSelectionReaction> ActiveReaction;
650 static const int TOOLTIP_WAITING_TIME = 400;
boost::geometry::model::polygon< point_xy > polygon
cvRenderViewSelectionReaction handles all selection modes in a single class
static cvRenderViewSelectionReaction * activeReaction()
Get the currently active reaction (static)
void zoomToBoxCompleted(int xmin, int ymin, int xmax, int ymax)
Emitted when zoom to box is completed.
::SelectionMode SelectionMode
void selectedCustomPolygon(vtkIntArray *polygon)
Emitted for custom polygon selection.
ecvGenericVisualizer3D * getVisualizer() const
Get the current visualizer.
QAction * parentAction() const
Get the parent action.
SelectionMode mode() const
Get the selection mode.
void selectionFinished(const cvSelectionData &selectionData)
Emitted when selection is finished.
void selectedCustomBox(int xmin, int ymin, int xmax, int ymax)
Emitted for custom box selection.
::SelectionModifier SelectionModifier
void selectedCustomBox(const int region[4])
Encapsulates selection data without exposing VTK types.
Helper class for highlighting selected elements in the visualizer.
Selection pipeline abstraction layer.
Generic visualizer 3D interface.
SelectionMode
Selection modes matching ParaView's SelectionMode enum.
SelectionModifier
Selection modifiers for combining selections.
#define QPCL_ENGINE_LIB_API