Version: 9.15.0
SPV3D_CADSelection.h
Go to the documentation of this file.
1 // Copyright (C) 2023-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #pragma once
21 
22 #include <pqSelectionReaction.h>
23 
24 #include <vtkSmartPointer.h>
25 #include <vtkWeakPointer.h>
26 
27 #include <QCursor>
28 #include <QPointer>
29 #include <QTimer>
30 #include <QPushButton>
31 #include <QComboBox>
32 
33 class vtkObject;
34 class pqView;
35 class pqRenderView;
36 class vtkIntArray;
37 class pqDataRepresentation;
38 class vtkSMRepresentationProxy;
39 class vtkSMSourceProxy;
40 
50 {
51  Q_OBJECT
52 
53 public:
55  {
60  };
61 
66  SPV3D_CADSelection(QObject *parent, pqRenderView* view, SelectionMode mode);
67 
68  ~SPV3D_CADSelection() override;
69 
74 
75 public Q_SLOTS:
82  virtual void actionTriggered(bool val);
83 
84 private Q_SLOTS:
89  void setView(pqView* view);
90 
94  void setRepresentation(pqDataRepresentation* representation);
95 
99  void beginSelection();
100 
105  void endSelection();
106 
107  void updateEnableState();
108 
110 
113  void onRightButtonPress();
114  void onRightButtonRelease();
116 
117 private:
118 
122  void selectionChanged(vtkObject*, unsigned long, void* calldata);
123 
128  void onMouseMove();
129 
133  void onLeftButtonRelease();
134 
135  // Get the current state of selection modifier
136  int getSelectionModifier();
137 
141  void fastSelection(bool presel = false);
142 
146  void cleanupObservers();
147 
149  QPointer<pqRenderView> View;
150  QPointer<pqDataRepresentation> Representation;
151  QMetaObject::Connection RepresentationConnection;
152  vtkSMRepresentationProxy* CurrentRepresentation = nullptr;
155  vtkWeakPointer<vtkObject> ObservedObject;
156  unsigned long ObserverIds[4];
159  bool DisablePreSelection = false;
160 };
@ View
Definition: SalomePyQt.h:80
For more information see QT documentation.
Definition: SUIT_Application.h:42
SPV3D_CADSelection handles various selection modes available on RenderViews.
Definition: SPV3D_CADSelection.h:50
void selectionChanged(vtkObject *, unsigned long, void *calldata)
callback called when the vtkPVRenderView is done with selection.
Definition: SPV3D_CADSelection.cxx:426
void beginSelection()
starts the selection i.e.
Definition: SPV3D_CADSelection.cxx:192
void onRightButtonPress()
Disable preselection during rotation using the right button.
Definition: SPV3D_CADSelection.cxx:322
QMetaObject::Connection RepresentationConnection
Definition: SPV3D_CADSelection.h:151
~SPV3D_CADSelection() override
Definition: SPV3D_CADSelection.cxx:85
Q_DISABLE_COPY(SPV3D_CADSelection) QPointer< pqRenderView > View
int MousePosition[2]
Definition: SPV3D_CADSelection.h:157
unsigned long ObserverIds[4]
Definition: SPV3D_CADSelection.h:156
void setRepresentation(pqDataRepresentation *representation)
Called when the active representation changes.
Definition: SPV3D_CADSelection.cxx:166
void onLeftButtonRelease()
callback called for click events when in 'interactive selection' modes.
Definition: SPV3D_CADSelection.cxx:313
void onRightButtonRelease()
Definition: SPV3D_CADSelection.cxx:328
virtual void actionTriggered(bool val)
For checkable actions, this calls this->beginSelection() or this->endSelection() is val is true or fa...
Definition: SPV3D_CADSelection.cxx:138
void endSelection()
finishes the selection.
Definition: SPV3D_CADSelection.cxx:238
SPV3D_CADSelection(QObject *parent, pqRenderView *view, SelectionMode mode)
If view is nullptr, this reaction will track the active-view maintained by pqActiveObjects.
Definition: SPV3D_CADSelection.cxx:48
int getSelectionModifier()
Definition: SPV3D_CADSelection.cxx:441
void cleanupObservers()
cleans up observers.
Definition: SPV3D_CADSelection.cxx:464
QComboBox * selectionComboBox
Definition: SPV3D_CADSelection.h:158
void setView(pqView *view)
Called when this object was created with nullptr as the view and the active view changes.
Definition: SPV3D_CADSelection.cxx:151
vtkWeakPointer< vtkObject > ObservedObject
Definition: SPV3D_CADSelection.h:155
vtkSMRepresentationProxy * CurrentRepresentation
Definition: SPV3D_CADSelection.h:152
void SetMode(const SPV3D_CADSelection::SelectionMode mode)
Set the selectionMode.
Definition: SPV3D_CADSelection.cxx:91
int PreviousRenderViewMode
Definition: SPV3D_CADSelection.h:154
QPointer< pqDataRepresentation > Representation
Definition: SPV3D_CADSelection.h:150
SelectionMode Mode
Definition: SPV3D_CADSelection.h:153
bool DisablePreSelection
Definition: SPV3D_CADSelection.h:159
void updateEnableState()
Definition: SPV3D_CADSelection.cxx:97
void fastSelection(bool presel=false)
makes fast selection.
Definition: SPV3D_CADSelection.cxx:334
SelectionMode
Definition: SPV3D_CADSelection.h:55
@ SELECT_EDGES
Definition: SPV3D_CADSelection.h:58
@ SELECT_VERTICES
Definition: SPV3D_CADSelection.h:59
@ SELECT_FACES
Definition: SPV3D_CADSelection.h:57
@ SELECT_SOLIDS
Definition: SPV3D_CADSelection.h:56
void onMouseMove()
callback called for mouse move events when in 'interactive selection' modes.
Definition: SPV3D_CADSelection.cxx:278