pqRenderViewSelectionReaction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqRenderViewSelectionReaction.h
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqRenderViewSelectionReaction_h
33 #define pqRenderViewSelectionReaction_h
34 
35 #include "pqSelectionReaction.h"
36 #include "vtkWeakPointer.h"
37 #include <QCursor>
38 #include <QPointer>
39 #include <QTimer>
40 
42 class pqRenderView;
43 class pqView;
44 class vtkIntArray;
45 class vtkObject;
47 
57 {
58  Q_OBJECT
59  typedef pqSelectionReaction Superclass;
60 
61 public:
63  {
82  SELECT_SURFACE_CELLS_TOOLTIP
83  };
84 
89  pqRenderViewSelectionReaction(QAction* parentAction, pqRenderView* view, SelectionMode mode,
90  QActionGroup* modifierGroup = NULL);
92 
93 Q_SIGNALS:
94  void selectedCustomBox(int xmin, int ymin, int xmax, int ymax);
95  void selectedCustomBox(const int region[4]);
96  void selectedCustomPolygon(vtkIntArray* polygon);
97 
98 private Q_SLOTS:
105  virtual void actionTriggered(bool val);
106 
111  void updateEnableState() override;
112 
117  void setView(pqView* view);
118 
122  void setRepresentation(pqDataRepresentation* representation);
123 
127  void beginSelection();
128 
133  void endSelection();
134 
138  void preSelection();
139 
143  void fastPreSelection();
144 
149  void onMouseStop();
150 
151 private:
155  void selectionChanged(vtkObject*, unsigned long, void* calldata);
156 
161  void onMouseMove();
162 
167  void onLeftButtonRelease();
168  void onWheelRotate();
169 
170  // Get the current state of selection modifier
171  int getSelectionModifier() override;
172 
173  // Check this selection is compatible with another type of selection
174  bool isCompatible(SelectionMode mode);
175 
176  // Display/hide the tooltip of the selected point in mode SELECT_SURFACE_POINTS_TOOLTIP.
177  void UpdateTooltip();
178 
179 private:
180  Q_DISABLE_COPY(pqRenderViewSelectionReaction)
181  QPointer<pqRenderView> View;
182  QPointer<pqDataRepresentation> Representation;
183  QMetaObject::Connection RepresentationConnection;
184  SelectionMode Mode;
185  bool DisableSelectionModifiers;
186  int PreviousRenderViewMode;
187  vtkWeakPointer<vtkObject> ObservedObject;
188  unsigned long ObserverIds[4];
189  QCursor ZoomCursor;
190  QTimer MouseMovingTimer;
191  bool MouseMoving;
192  int MousePosition[2];
193  vtkSMPVRepresentationProxy* CurrentRepresentation = nullptr;
194 
195  static QPointer<pqRenderViewSelectionReaction> ActiveReaction;
196 
200  void cleanupObservers();
201 };
202 
203 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
representation for "Render View" like views in ParaView.
virtual int getSelectionModifier()
Get the current state of selection modifier, if any.
virtual void updateEnableState()
Definition: pqReaction.h:76
#define PQAPPLICATIONCOMPONENTS_EXPORT
This is a PQ abstraction of a generic view module.
Definition: pqView.h:54
pqRenderViewSelectionReaction handles various selection modes available on RenderViews.
Generric reaction for creating selections on views.