ParaView
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 
41 class pqRenderView;
42 class pqView;
43 class vtkIntArray;
44 class vtkObject;
45 
54 class PQAPPLICATIONCOMPONENTS_EXPORT pqRenderViewSelectionReaction : public pqSelectionReaction
55 {
56  Q_OBJECT
57  typedef pqSelectionReaction Superclass;
58 
59 public:
61  {
75  SELECT_SURFACE_POINTS_TOOLTIP
76  };
77 
82  pqRenderViewSelectionReaction(QAction* parentAction, pqRenderView* view, SelectionMode mode,
83  QActionGroup* modifierGroup = NULL);
85 
86 signals:
87  void selectedCustomBox(int xmin, int ymin, int xmax, int ymax);
88  void selectedCustomBox(const int region[4]);
89  void selectedCustomPolygon(vtkIntArray* polygon);
90 
91 private slots:
98  virtual void actionTriggered(bool val);
99 
103  virtual void updateEnableState();
104 
109  void setView(pqView* view);
110 
114  void beginSelection();
115 
120  void endSelection();
121 
125  void preSelection();
126 
131  void onMouseStop();
132 
133 private:
137  void selectionChanged(vtkObject*, unsigned long, void* calldata);
138 
143  void onMouseMove();
144 
149  void onLeftButtonRelease();
150  void onWheelRotate();
151 
152  // Get the current state of selection modifier
153  int getSelectionModifier();
154 
155  // Check this selection is compatible with another type of selection
156  bool isCompatible(SelectionMode mode);
157 
158  // Display/hide the tooltip of the selected point in mode SELECT_SURFACE_POINTS_TOOLTIP.
159  void UpdateTooltip();
160 
161 private:
162  Q_DISABLE_COPY(pqRenderViewSelectionReaction)
163  QPointer<pqRenderView> View;
164  SelectionMode Mode;
165  bool DisableSelectionModifiers;
166  int PreviousRenderViewMode;
167  vtkWeakPointer<vtkObject> ObservedObject;
168  unsigned long ObserverIds[4];
169  QCursor ZoomCursor;
170  QTimer MouseMovingTimer;
171  bool MouseMoving;
172 
173  static QPointer<pqRenderViewSelectionReaction> ActiveReaction;
174 
178  void cleanupObservers();
179 };
180 
181 #endif
virtual int getSelectionModifier()
Get the current state of selection modifier, if any.
virtual void updateEnableState()
Definition: pqReaction.h:75
This is a PQ abstraction of a generic view module.
Definition: pqView.h:56
pqRenderViewSelectionReaction handles various selection modes available on RenderViews.
Generric reaction for creating selections on views.