ParaView
pqRenderView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqRenderView.h
5 
6  Copyright (c) 2005-2008 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 pqRenderViewModule_h
33 #define pqRenderViewModule_h
34 
35 #include "pqRenderViewBase.h"
36 #include <QColor> // needed for return type.
37 
39 class QAction;
40 class QVTKWidget;
41 class vtkCollection;
42 class vtkIntArray;
44 
45 // This is a PQ abstraction of a render view.
46 class PQCORE_EXPORT pqRenderView : public pqRenderViewBase
47 {
48  Q_OBJECT
50 
51 public:
52  static QString renderViewType() { return "RenderView"; }
53 
54  // Constructor:
55  // \c group :- SManager registration group name.
56  // \c name :- SManager registration name.
57  // \c view :- RenderView proxy.
58  // \c server:- server on which the proxy is created.
59  // \c parent:- QObject parent.
60  pqRenderView(const QString& group, const QString& name, vtkSMViewProxy* renModule,
61  pqServer* server, QObject* parent = NULL);
62 
63  // This version allows subclasses to substitute their own renderViewType.
64  pqRenderView(const QString& tname, const QString& group, const QString& name,
65  vtkSMViewProxy* renModule, pqServer* server, QObject* parent = NULL);
66 
67  // Destructor.
68  virtual ~pqRenderView();
69 
73  virtual vtkSMRenderViewProxy* getRenderViewProxy() const;
74 
80  virtual void resetCamera();
81 
85  void resetCenterOfRotation();
86 
90  bool getOrientationAxesVisibility() const;
91 
95  bool getOrientationAxesInteractivity() const;
96 
100  QColor getOrientationAxesLabelColor() const;
101 
105  QColor getOrientationAxesOutlineColor() const;
106 
111  bool getResetCenterWithCamera() const { return this->ResetCenterWithCamera; }
112 
117  {
118  return this->UseMultipleRepresentationSelection;
119  }
120 
124  bool getCenterAxesVisibility() const;
125 
129  void getCenterOfRotation(double center[3]) const;
130 
136  virtual bool supportsUndo() const { return true; }
137 
142  virtual bool canUndo() const;
143  virtual bool canRedo() const;
144 
150  void linkUndoStack(pqRenderView* other);
151  void unlinkUndoStack(pqRenderView* other);
152 
157  void clearUndoStack();
158 
162  void resetViewDirection(
163  double look_x, double look_y, double look_z, double up_x, double up_y, double up_z);
164 
171  virtual void setCursor(const QCursor&);
172 
173 public:
178  void selectOnSurface(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
179  void selectPointsOnSurface(
180  int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
181 
187  pqDataRepresentation* pick(int pos[2]);
188 
194  pqDataRepresentation* pickBlock(int pos[2], unsigned int& flatIndex);
195 
200  void selectFrustum(int rectangle[4]);
201  void selectFrustumPoints(int rectangle[4]);
202 
207  void selectBlock(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
208 
213  void selectPolygonPoints(
214  vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
215 
220  void selectPolygonCells(
221  vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
222 
223 signals:
224  // Triggered when interaction mode change underneath
225  void updateInteractionMode(int mode);
226 
227 public slots:
228  // Toggle the orientation axes visibility.
229  void setOrientationAxesVisibility(bool visible);
230 
231  // Toggle orientation axes interactivity.
232  void setOrientationAxesInteractivity(bool interactive);
233 
234  // Set orientation axes label color.
235  void setOrientationAxesLabelColor(const QColor&);
236 
237  // Set orientation axes outline color.
238  void setOrientationAxesOutlineColor(const QColor&);
239 
240  // Set the center of rotation. For this to work,
241  // one should have approriate interaction style (vtkPVInteractorStyle subclass)
242  // and camera manipulators that use the center of rotation.
243  // They are setup correctly by default.
244  void setCenterOfRotation(double x, double y, double z);
245  void setCenterOfRotation(double xyz[3]) { this->setCenterOfRotation(xyz[0], xyz[1], xyz[2]); }
246 
247  // Toggle center axes visibility.
248  void setCenterAxesVisibility(bool visible);
249 
254  void setResetCenterWithCamera(bool b) { this->ResetCenterWithCamera = b; }
255 
260  {
261  this->UseMultipleRepresentationSelection = b;
262  }
263 
267  void linkToOtherView();
268 
273  virtual void undo();
274 
279  virtual void redo();
280 
284  void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); }
285 
289  void updateInteractionMode(pqOutputPort* opPort);
290 
291 private slots:
292  // Called when vtkSMRenderViewProxy fires
293  // ResetCameraEvent.
294  void onResetCameraEvent();
295 
300  void onUndoStackChanged();
301 
305  void onInteractionModeChange();
306 
307 protected:
308  // When true, the camera center of rotation will be reset when the
309  // user reset the camera.
311 
312  // When true, the selection will be performed on all representations.
314 
318  void fakeUndoRedo(bool redo, bool self);
319 
325  void fakeInteraction(bool start);
326 
331  virtual QWidget* createWidget();
332 
336  virtual void initialize();
337 
338 private:
339  class pqInternal;
340  pqInternal* Internal;
341  void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points,
342  int selectionModifier, bool select_blocks);
343  void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points,
344  int selectionModifier, bool select_blocks);
345 
346  void emitSelectionSignal(QList<pqOutputPort*>);
347  void collectSelectionPorts(vtkCollection* selectedRepresentations,
348  vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier,
349  bool select_blocks);
350 
351  void InternalConstructor(vtkSMViewProxy* renModule);
352 };
353 
354 #endif
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item...
Definition: pqOutputPort.h:57
virtual void resetCamera()=0
Resets the camera to include all visible data.
void setUseMultipleRepresentationSelection(bool b)
Set whether selection will be done on multiple representations.
Definition: pqRenderView.h:259
bool getResetCenterWithCamera() const
Get whether resetCamera() resets the center of rotation as well.
Definition: pqRenderView.h:111
virtual void redo()
Called to redo interaction.
Definition: pqView.h:140
Superclass for all view proxies.
bool UseMultipleRepresentationSelection
Definition: pqRenderView.h:313
bool getUseMultipleRepresentationSelection() const
Get whether selection will be done on multiple representations.
Definition: pqRenderView.h:116
void resetCenterOfRotationIfNeeded()
Resets center of rotation if this->ResetCenterWithCamera is true.
Definition: pqRenderView.h:284
void setCenterOfRotation(double xyz[3])
Definition: pqRenderView.h:245
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:153
implementation for View that includes render window and renderers.
void setResetCenterWithCamera(bool b)
Get/Set whether resetCamera() resets the center of rotation as well.
Definition: pqRenderView.h:254
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:158
pqRenderViewBase is an abstract base class for all render-view based views.
virtual void undo()
Called to undo interaction.
Definition: pqView.h:134
bool ResetCenterWithCamera
Definition: pqRenderView.h:310
virtual bool supportsUndo() const
Returns if this view module can support undo/redo.
Definition: pqRenderView.h:136
virtual void initialize()
Use this method to initialize the pqObject state using the underlying vtkSMProxy. ...
virtual QWidget * createWidget()
Creates a new instance of the QWidget subclass to be used to show this view.
static QString renderViewType()
Definition: pqRenderView.h:52
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:64