ParaView
pqView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqView.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 pqView_h
33 #define pqView_h
34 
35 #include "pqProxy.h"
36 #include "vtkSetGet.h" // needed for VTK_LEGACY.
37 #include <QSize> // needed for QSize.
38 
39 class pqOutputPort;
40 class pqPipelineSource;
41 class pqRepresentation;
42 class pqServer;
43 class pqUndoStack;
44 class pqViewInternal;
45 class QWidget;
46 class vtkImageData;
47 class vtkSMSourceProxy;
48 class vtkSMViewProxy;
49 class vtkView;
50 
56 class PQCORE_EXPORT pqView : public pqProxy
57 {
58  Q_OBJECT
59  typedef pqProxy Superclass;
60 
61 public:
63  {
64  PV_SELECTION_DEFAULT = 0,
67  PV_SELECTION_TOGGLE
68  };
69 
70  virtual ~pqView();
71 
75  vtkSMViewProxy* getViewProxy() const;
76 
81  virtual vtkView* getClientSideView() const;
82 
92  QWidget* widget();
93 
101  virtual bool supportsUndo() const { return false; }
102 
106  QString getViewType() const { return this->ViewType; }
107 
112  static int computeMagnification(const QSize& fullsize, QSize& viewsize);
113 
114 public slots:
118  virtual void render();
119 
123  virtual void forceRender();
124 
128  void cancelPendingRenders();
129 
134  virtual void undo() {}
135 
140  virtual void redo() {}
141 
147  virtual void resetDisplay() {}
148 
149 public:
153  virtual bool canUndo() const { return false; }
154 
158  virtual bool canRedo() const { return false; }
159 
165  virtual QSize getSize();
166 
176  virtual vtkImageData* captureImage(int magnification);
177 
183  virtual vtkImageData* captureImage(const QSize& size);
184 
188  bool writeImage(const QString& filename, const QSize&, int quality = -1);
189 
193  bool hasRepresentation(pqRepresentation* repr) const;
194 
198  int getNumberOfRepresentations() const;
199 
200  // Returns the number of representations currently visible in the view.
201  int getNumberOfVisibleRepresentations() const;
202  int getNumberOfVisibleDataRepresentations() const;
203 
208  pqRepresentation* getRepresentation(int index) const;
209 
213  QList<pqRepresentation*> getRepresentations() const;
214 
219  // vtkSMViewProxy::CanDisplayData().
220  bool canDisplay(pqOutputPort* opPort) const;
221 
226  virtual void emitSelectionSignals(bool frustum);
227 
228 signals:
234  void updateDataEvent();
235 
239  void representationAdded(pqRepresentation*);
240 
244  void representationRemoved(pqRepresentation*);
245 
251  void beginRender();
252 
258  void endRender();
259 
263  void representationVisibilityChanged(pqRepresentation* repr, bool visible);
264 
268  void canUndoChanged(bool);
269 
273  void canRedoChanged(bool);
274 
281  void selected(pqOutputPort* opport);
282 
287  void selectionModeChanged(bool frustum);
288 
293  void picked(pqOutputPort* opport);
294 
299  void beginProgress();
300 
305  void endProgress();
306 
312  void progress(const QString& message, int percent_progress);
313 
322  void multipleSelected(QList<pqOutputPort*> opports);
323 
324 private slots:
328  void onRepresentationsChanged();
329 
333  void onRepresentationVisibilityChanged(bool);
334 
339  void representationCreated(pqRepresentation* repr);
340 
347  void tryRender();
348 
355  void onBeginRender();
356  void onEndRender();
357 
358 protected:
368  pqView(const QString& type, const QString& group, const QString& name, vtkSMViewProxy* view,
369  pqServer* server, QObject* parent = NULL);
370 
377  virtual void initialize();
378 
382  virtual QWidget* createWidget() = 0;
383 
384 private:
385  Q_DISABLE_COPY(pqView)
386 
387  pqViewInternal* Internal;
388  QString ViewType;
389 };
390 
391 #endif
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item...
Definition: pqOutputPort.h:57
SelectionModifier
Definition: pqView.h:62
virtual void redo()
Called to redo interaction.
Definition: pqView.h:140
Superclass for all view proxies.
This is PQ representation for a single representation.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:56
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:153
proxy for a VTK source on a server
virtual void resetDisplay()
Called to reset the view&#39;s display.
Definition: pqView.h:147
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:56
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:158
QString getViewType() const
Returns the type of this view module.
Definition: pqView.h:106
virtual void initialize()
PQ representation for a vtkSMProxy that can be involved in a pipeline.
virtual void undo()
Called to undo interaction.
Definition: pqView.h:134
virtual bool supportsUndo() const
Returns if this view module can support undo/redo.
Definition: pqView.h:101
pqUndoStack represents a vtkSMUndoStack along with a a vtkSMUndoStackBuilder.
Definition: pqUndoStack.h:56
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:64