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 vtkCollection;
41 class vtkIntArray;
43 
44 // This is a PQ abstraction of a render view.
46 {
47  Q_OBJECT
49 
50 public:
51  static QString renderViewType() { return "RenderView"; }
52 
53  // Constructor:
54  // \c group :- SManager registration group name.
55  // \c name :- SManager registration name.
56  // \c view :- RenderView proxy.
57  // \c server:- server on which the proxy is created.
58  // \c parent:- QObject parent.
59  pqRenderView(const QString& group, const QString& name, vtkSMViewProxy* renModule,
60  pqServer* server, QObject* parent = NULL);
61 
62  // This version allows subclasses to substitute their own renderViewType.
63  pqRenderView(const QString& tname, const QString& group, const QString& name,
64  vtkSMViewProxy* renModule, pqServer* server, QObject* parent = NULL);
65 
66  // Destructor.
67  ~pqRenderView() override;
68 
72  virtual vtkSMRenderViewProxy* getRenderViewProxy() const;
73 
79  void resetCamera() override;
80 
84  virtual void resetCenterOfRotation();
85 
90  virtual void resetParallelScale();
91 
95  virtual bool getOrientationAxesVisibility() const;
96 
100  virtual bool getOrientationAxesInteractivity() const;
101 
105  virtual QColor getOrientationAxesLabelColor() const;
106 
110  virtual QColor getOrientationAxesOutlineColor() const;
111 
116  virtual bool getResetCenterWithCamera() const { return this->ResetCenterWithCamera; }
117 
122  {
123  return this->UseMultipleRepresentationSelection;
124  }
125 
129  virtual bool getCenterAxesVisibility() const;
130 
134  virtual void getCenterOfRotation(double center[3]) const;
135 
141  bool supportsUndo() const override { return true; }
142 
147  bool canUndo() const override;
148  bool canRedo() const override;
149 
155  bool supportsCapture() const override { return true; }
156 
162  virtual void linkUndoStack(pqRenderView* other);
163  virtual void unlinkUndoStack(pqRenderView* other);
164 
169  virtual void clearUndoStack();
170 
174  virtual void resetViewDirection(
175  double look_x, double look_y, double look_z, double up_x, double up_y, double up_z);
176 
183  virtual void setCursor(const QCursor&);
184 
189  virtual void selectOnSurface(int rectangle[4],
190  int selectionModifier = pqView::PV_SELECTION_DEFAULT, const char* array = nullptr);
191  virtual void selectPointsOnSurface(int rectangle[4],
192  int selectionModifier = pqView::PV_SELECTION_DEFAULT, const char* array = nullptr);
193 
199  virtual pqDataRepresentation* pick(int pos[2]);
200 
206  virtual pqDataRepresentation* pickBlock(int pos[2], unsigned int& flatIndex);
207 
212  virtual void selectFrustum(int rectangle[4]);
213  virtual void selectFrustumPoints(int rectangle[4]);
214 
219  virtual void selectBlock(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
220 
225  virtual void selectPolygonPoints(
226  vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
227 
232  virtual void selectPolygonCells(
233  vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
234 
235 Q_SIGNALS:
236  // Triggered when interaction mode change underneath
237  void updateInteractionMode(int mode);
238 
239 public Q_SLOTS:
240  // Toggle the orientation axes visibility.
241  virtual void setOrientationAxesVisibility(bool visible);
242 
243  // Toggle orientation axes interactivity.
244  virtual void setOrientationAxesInteractivity(bool interactive);
245 
246  // Set orientation axes label color.
247  virtual void setOrientationAxesLabelColor(const QColor&);
248 
249  // Set orientation axes outline color.
250  virtual void setOrientationAxesOutlineColor(const QColor&);
251 
252  // Set the center of rotation. For this to work,
253  // one should have appropriate interaction style (vtkPVInteractorStyle subclass)
254  // and camera manipulators that use the center of rotation.
255  // They are setup correctly by default.
256  virtual void setCenterOfRotation(double x, double y, double z);
257  virtual void setCenterOfRotation(double xyz[3])
258  {
259  this->setCenterOfRotation(xyz[0], xyz[1], xyz[2]);
260  }
261 
262  // Set the parallel scale
263  virtual void setParallelScale(double scale);
264 
265  // Toggle center axes visibility.
266  virtual void setCenterAxesVisibility(bool visible);
267 
272  virtual void setResetCenterWithCamera(bool b) { this->ResetCenterWithCamera = b; }
273 
278  {
279  this->UseMultipleRepresentationSelection = b;
280  }
281 
285  virtual void linkToOtherView();
286 
291  virtual void undo() override;
292 
297  virtual void redo() override;
298 
302  virtual void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); }
303 
307  virtual void updateInteractionMode(pqOutputPort* opPort);
308 
309 protected Q_SLOTS:
313  virtual void onInteractionModeChange();
314 
318  virtual void onGenericFilmicPresetsChange();
319 
320  // Called when vtkSMRenderViewProxy fires
321  // ResetCameraEvent.
322  virtual void onResetCameraEvent();
323 
328  virtual void onUndoStackChanged();
329 
330 protected:
334  virtual void fakeUndoRedo(bool redo, bool self);
335 
341  virtual void fakeInteraction(bool start);
342 
347  QWidget* createWidget() override;
348 
352  void initialize() override;
353 
354  // When true, the camera center of rotation will be reset when the
355  // user reset the camera.
357 
358  // When true, the selection will be performed on all representations.
360 
361 private:
362  void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points,
363  int selectionModifier, bool select_blocks, const char* array = nullptr);
364 
365  void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points,
366  int selectionModifier, bool select_blocks);
367 
368  void emitSelectionSignal(QList<pqOutputPort*> outputPorts, int selectionModifier);
369 
370  void collectSelectionPorts(vtkCollection* selectedRepresentations,
371  vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier,
372  bool select_blocks);
373 
374  void InternalConstructor(vtkSMViewProxy* renModule);
375 
376  class pqInternal;
377  pqInternal* Internal;
378 };
379 
380 #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:58
virtual void resetCamera()=0
Resets the camera to include all visible data.
void initialize() override
Use this method to initialize the pqObject state using the underlying vtkSMProxy. ...
virtual void redo()
Called to redo interaction.
Definition: pqView.h:139
Superclass for all view proxies.
bool UseMultipleRepresentationSelection
Definition: pqRenderView.h:359
QWidget * createWidget() override
Creates a new instance of the QWidget subclass to be used to show this view.
bool supportsUndo() const override
Returns if this view module can support undo/redo.
Definition: pqRenderView.h:141
virtual void setUseMultipleRepresentationSelection(bool b)
Set whether selection will be done on multiple representations.
Definition: pqRenderView.h:277
name
bool supportsCapture() const override
Returns if this view module can support image capture.
Definition: pqRenderView.h:155
virtual void setResetCenterWithCamera(bool b)
Get/Set whether resetCamera() resets the center of rotation as well.
Definition: pqRenderView.h:272
virtual void resetCenterOfRotationIfNeeded()
Resets center of rotation if this->ResetCenterWithCamera is true.
Definition: pqRenderView.h:302
virtual bool getUseMultipleRepresentationSelection() const
Get whether selection will be done on multiple representations.
Definition: pqRenderView.h:121
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:152
implementation for View that includes render window and renderers.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
virtual void setCenterOfRotation(double xyz[3])
Definition: pqRenderView.h:257
virtual bool getResetCenterWithCamera() const
Get whether resetCamera() resets the center of rotation as well.
Definition: pqRenderView.h:116
mode
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:157
pqRenderViewBase is an abstract base class for all render-view based views.
virtual void undo()
Called to undo interaction.
Definition: pqView.h:133
bool ResetCenterWithCamera
Definition: pqRenderView.h:356
center
scale
static QString renderViewType()
Definition: pqRenderView.h:51
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:64