pqRenderView.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqRenderView_h
5 #define pqRenderView_h
6 
7 #include "pqRenderViewBase.h"
8 #include <QColor> // needed for return type.
9 #include <QCursor> // needed for return type.
10 
12 class QAction;
13 class vtkCollection;
14 class vtkIntArray;
16 
17 // This is a PQ abstraction of a render view.
19 {
20  Q_OBJECT
22 
23 public:
24  static QString renderViewType() { return "RenderView"; }
25 
26  // Constructor:
27  // \c group :- SManager registration group name.
28  // \c name :- SManager registration name.
29  // \c view :- RenderView proxy.
30  // \c server:- server on which the proxy is created.
31  // \c parent:- QObject parent.
32  pqRenderView(const QString& group, const QString& name, vtkSMViewProxy* renModule,
33  pqServer* server, QObject* parent = nullptr);
34 
35  // This version allows subclasses to substitute their own renderViewType.
36  pqRenderView(const QString& tname, const QString& group, const QString& name,
37  vtkSMViewProxy* renModule, pqServer* server, QObject* parent = nullptr);
38 
39  // Destructor.
40  ~pqRenderView() override;
41 
45  virtual vtkSMRenderViewProxy* getRenderViewProxy() const;
46 
54  void resetCamera(bool closest = false, double offsetRatio = 0.9) override;
55 
59  virtual void resetCenterOfRotation();
60 
64  virtual void resetParallelScale();
65 
69  virtual bool getOrientationAxesVisibility() const;
70 
74  virtual bool getOrientationAxesInteractivity() const;
75 
79  virtual QColor getOrientationAxesLabelColor() const;
80 
84  virtual QColor getOrientationAxesOutlineColor() const;
85 
89  virtual bool getResetCenterWithCamera() const { return this->ResetCenterWithCamera; }
90 
95  {
96  return this->UseMultipleRepresentationSelection;
97  }
98 
102  virtual bool getCenterAxesVisibility() const;
103 
107  virtual void getCenterOfRotation(double center[3]) const;
108 
113  bool supportsUndo() const override { return true; }
114 
116 
120  bool canUndo() const override;
121  bool canRedo() const override;
123 
128  bool supportsCapture() const override { return true; }
129 
131 
136  virtual void linkUndoStack(pqRenderView* other);
137  virtual void unlinkUndoStack(pqRenderView* other);
139 
143  virtual void clearUndoStack();
144 
148  virtual void resetViewDirection(
149  double look_x, double look_y, double look_z, double up_x, double up_y, double up_z);
150  virtual void adjustView(const int& adjustType, const double& angle);
151  virtual void adjustAzimuth(const double& value);
152  virtual void adjustElevation(const double& value);
153  virtual void adjustRoll(const double& value);
154  virtual void adjustZoom(const double& value);
155  virtual void applyIsometricView();
156  virtual void resetViewDirectionToPositiveX();
157  virtual void resetViewDirectionToNegativeX();
158  virtual void resetViewDirectionToPositiveY();
159  virtual void resetViewDirectionToNegativeY();
160  virtual void resetViewDirectionToPositiveZ();
161  virtual void resetViewDirectionToNegativeZ();
162 
164 
170  virtual void setCursor(const QCursor&);
171  virtual QCursor cursor();
173 
175 
179  void setCursorVisible(bool visible);
180  bool cursorVisible();
182 
184  virtual void selectCellsOnSurface(int rectangle[4],
185  int selectionModifier = pqView::PV_SELECTION_DEFAULT, const char* array = nullptr);
186  virtual void selectPointsOnSurface(int rectangle[4],
187  int selectionModifier = pqView::PV_SELECTION_DEFAULT, const char* array = nullptr);
189 
195  virtual pqDataRepresentation* pick(int pos[2]);
196 
207  virtual pqDataRepresentation* pickBlock(int pos[2], unsigned int& flatIndex, int& rank);
208 
210  virtual void selectFrustumCells(
211  int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
212  virtual void selectFrustumPoints(
213  int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
214  virtual void selectFrustumBlocks(
215  int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
217 
222  virtual void selectBlock(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
223 
225 
229  virtual void selectPolygonPoints(
230  vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
231  virtual void selectPolygonCells(
232  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  void undo() override;
292 
297  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 ResetCameraEvent.
321  virtual void onResetCameraEvent();
322 
327  virtual void onUndoStackChanged();
328 
329 protected: // NOLINT(readability-redundant-access-specifiers)
333  virtual void fakeUndoRedo(bool redo, bool self);
334 
340  virtual void fakeInteraction(bool start);
341 
346  QWidget* createWidget() override;
347 
351  void initialize() override;
352 
353  // When true, the camera center of rotation will be reset when the
354  // user reset the camera.
356 
357  // When true, the selection will be performed on all representations.
359 
360 private:
361  void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points,
362  int selectionModifier, bool select_blocks, const char* array = nullptr);
363 
364  void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points,
365  int selectionModifier, bool select_blocks);
366 
367  void emitSelectionSignal(QList<pqOutputPort*> outputPorts, int selectionModifier);
368 
369  void collectSelectionPorts(vtkCollection* selectedRepresentations,
370  vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier,
371  bool select_blocks);
372 
373  void InternalConstructor(vtkSMViewProxy* renModule);
374 
375  class pqInternal;
376  pqInternal* Internal;
377 };
378 
379 #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:29
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:109
Superclass for all view proxies.
bool UseMultipleRepresentationSelection
Definition: pqRenderView.h:358
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:113
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:128
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:94
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:122
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:89
mode
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:127
pqRenderViewBase is an abstract base class for all render-view based views.
value
virtual void undo()
Called to undo interaction.
Definition: pqView.h:103
bool ResetCenterWithCamera
Definition: pqRenderView.h:355
center
virtual void resetCamera(bool closest=false, double offsetRatio=0.9)=0
Resets the camera to include all visible data.
scale
static QString renderViewType()
Definition: pqRenderView.h:24
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35