pqView.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 pqView_h
5 #define pqView_h
6 
7 #include "pqProxy.h"
8 #include <QSize> // needed for QSize.
9 
10 class pqOutputPort;
11 class pqPipelineSource;
12 class pqRepresentation;
13 class pqServer;
14 class pqUndoStack;
15 class pqViewInternal;
16 class QWidget;
17 class vtkSMSourceProxy;
18 class vtkSMViewProxy;
19 class vtkView;
20 
26 class PQCORE_EXPORT pqView : public pqProxy
27 {
28  Q_OBJECT
29  typedef pqProxy Superclass;
30 
31 public:
33  {
34  PV_SELECTION_DEFAULT = 0,
37  PV_SELECTION_TOGGLE
38  };
39 
40  ~pqView() override;
41 
45  vtkSMViewProxy* getViewProxy() const;
46 
51  virtual vtkView* getClientSideView() const;
52 
62  QWidget* widget();
63 
70  virtual bool supportsUndo() const { return false; }
71 
76  virtual bool supportsCapture() const { return false; }
77 
81  QString getViewType() const { return this->ViewType; }
82 
83 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
87  virtual void render();
88 
92  virtual void forceRender();
93 
97  void cancelPendingRenders();
98 
103  virtual void undo() {}
104 
109  virtual void redo() {}
110 
116  virtual void resetDisplay(bool closest = false) { (void)closest; }
117 
118 public: // NOLINT(readability-redundant-access-specifiers)
122  virtual bool canUndo() const { return false; }
123 
127  virtual bool canRedo() const { return false; }
128 
134  virtual QSize getSize();
135 
139  bool hasRepresentation(pqRepresentation* repr) const;
140 
144  int getNumberOfRepresentations() const;
145 
146  // Returns the number of representations currently visible in the view.
147  int getNumberOfVisibleRepresentations() const;
148  int getNumberOfVisibleDataRepresentations() const;
149 
154  pqRepresentation* getRepresentation(int index) const;
155 
159  QList<pqRepresentation*> getRepresentations() const;
160 
166  bool canDisplay(pqOutputPort* opPort) const;
167 
168 Q_SIGNALS:
174  void updateDataEvent();
175 
179  void representationAdded(pqRepresentation*);
180 
184  void representationRemoved(pqRepresentation*);
185 
191  void beginRender();
192 
198  void endRender();
199 
203  void representationVisibilityChanged(pqRepresentation* repr, bool visible);
204 
208  void canUndoChanged(bool);
209 
213  void canRedoChanged(bool);
214 
221  void selected(pqOutputPort* opport);
222 
227  void picked(pqOutputPort* opport);
228 
233  void beginProgress();
234 
239  void endProgress();
240 
246  void progress(const QString& message, int percent_progress);
247 
256  void multipleSelected(QList<pqOutputPort*> opports);
257 
258 private Q_SLOTS:
262  void onRepresentationsChanged();
263 
267  void onRepresentationVisibilityChanged(bool);
268 
273  void representationCreated(pqRepresentation* repr);
274 
281  void tryRender();
282 
289  void onBeginRender();
290  void onEndRender();
291 
292 protected:
302  pqView(const QString& type, const QString& group, const QString& name, vtkSMViewProxy* view,
303  pqServer* server, QObject* parent = nullptr);
304 
311  void initialize() override;
312 
316  virtual QWidget* createWidget() = 0;
317 
318 private:
319  Q_DISABLE_COPY(pqView)
320 
321  pqViewInternal* Internal;
322  QString ViewType;
323 };
324 
325 #endif
pqView::canUndo
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:122
pqView::PV_SELECTION_SUBTRACTION
@ PV_SELECTION_SUBTRACTION
Definition: pqView.h:36
pqView::getViewType
QString getViewType() const
Returns the type of this view module.
Definition: pqView.h:81
pqView
This is a PQ abstraction of a generic view module.
Definition: pqView.h:26
pqUndoStack
pqUndoStack represents a vtkSMUndoStack along with a a vtkSMUndoStackBuilder.
Definition: pqUndoStack.h:28
pqView::resetDisplay
virtual void resetDisplay(bool closest=false)
Called to reset the view's display.
Definition: pqView.h:116
pqRepresentation
This is PQ representation for a single representation.
Definition: pqRepresentation.h:19
pqServer
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35
pqView::canRedo
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:127
pqView::supportsUndo
virtual bool supportsUndo() const
Returns if this view module can support undo/redo.
Definition: pqView.h:70
pqView::PV_SELECTION_ADDITION
@ PV_SELECTION_ADDITION
Definition: pqView.h:35
vtkSMSourceProxy
proxy for a VTK source on a server
Definition: vtkSMSourceProxy.h:37
pqProxy::initialize
virtual void initialize()
vtkView
pqPipelineSource
PQ representation for a vtkSMProxy that can be involved in a pipeline.
Definition: pqPipelineSource.h:32
pqView::redo
virtual void redo()
Called to redo interaction.
Definition: pqView.h:109
pqView::undo
virtual void undo()
Called to undo interaction.
Definition: pqView.h:103
vtkSMViewProxy
Superclass for all view proxies.
Definition: vtkSMViewProxy.h:42
pqView::supportsCapture
virtual bool supportsCapture() const
Returns if this view module can support image capture.
Definition: pqView.h:76
pqProxy
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:28
progress
progress
pqOutputPort
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item.
Definition: pqOutputPort.h:29
pqProxy.h
pqView::SelectionModifier
SelectionModifier
Definition: pqView.h:32