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 
52 class PQAPPLICATIONCOMPONENTS_EXPORT pqRenderViewSelectionReaction :
53  public pqSelectionReaction
54 {
55  Q_OBJECT
56  typedef pqSelectionReaction Superclass;
57 public:
59  {
73  SELECT_SURFACE_POINTS_TOOLTIP
74  };
75 
79  QAction* parentAction, pqRenderView* view, SelectionMode mode,
80  QActionGroup* modifierGroup = NULL);
82 
83 signals:
84  void selectedCustomBox(int xmin, int ymin, int xmax, int ymax);
85  void selectedCustomBox(const int region[4]);
86  void selectedCustomPolygon(vtkIntArray* polygon);
87 
88 private slots:
93  virtual void actionTriggered(bool val);
94 
96  virtual void updateEnableState();
97 
100  void setView(pqView* view);
101 
103  void beginSelection();
104 
107  void endSelection();
108 
110  void preSelection();
111 
114  void onMouseStop();
115 
116 private:
118  void selectionChanged(vtkObject*, unsigned long, void* calldata);
119 
122  void onMouseMove();
123 
126  void onLeftButtonRelease();
127  void onWheelRotate();
128 
129  // Get the current state of selection modifier
130  int getSelectionModifier();
131 
132  // Check this selection is compatible with another type of selection
133  bool isCompatible(SelectionMode mode);
134 
135  // Display/hide the tooltip of the selected point in mode SELECT_SURFACE_POINTS_TOOLTIP.
136  void UpdateTooltip();
137 
138 private:
139  Q_DISABLE_COPY(pqRenderViewSelectionReaction)
140  QPointer<pqRenderView> View;
141  SelectionMode Mode;
142  bool DisableSelectionModifiers;
143  int PreviousRenderViewMode;
144  vtkWeakPointer<vtkObject> ObservedObject;
145  unsigned long ObserverIds[4];
146  QCursor ZoomCursor;
147  QTimer MouseMovingTimer;
148  bool MouseMoving;
149 
150  static QPointer<pqRenderViewSelectionReaction> ActiveReaction;
151 
153  void cleanupObservers();
154 };
155 
156 #endif
virtual int getSelectionModifier()
Get the current state of selection modifier, if any.
virtual void updateEnableState()
Definition: pqReaction.h:67
This is a PQ abstraction of a generic view module.
Definition: pqView.h:55
pqRenderViewSelectionReaction handles various selection modes available on RenderViews.
Generric reaction for creating selections on views.