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 
36 #include "pqProxy.h"
37 #include "vtkSetGet.h" // needed for VTK_LEGACY.
38 #include <QSize> // needed for QSize.
39 
40 class pqOutputPort;
41 class pqPipelineSource;
42 class pqRepresentation;
43 class pqServer;
44 class pqUndoStack;
45 class pqViewInternal;
46 class QWidget;
47 class vtkImageData;
48 class vtkSMSourceProxy;
49 class vtkSMViewProxy;
50 class vtkView;
51 
55 class PQCORE_EXPORT pqView : public pqProxy
56 {
57  Q_OBJECT
58  typedef pqProxy Superclass;
59 public:
61  PV_SELECTION_DEFAULT = 0,
64  PV_SELECTION_TOGGLE
65  };
66 
67  virtual ~pqView();
68 
70  vtkSMViewProxy* getViewProxy() const;
71 
74  virtual vtkView* getClientSideView() const;
75 
83  QWidget* widget();
84 
90  virtual bool supportsUndo() const { return false; }
91 
93  QString getViewType() const
94  { return this->ViewType; }
95 
98  static int computeMagnification(const QSize& fullsize, QSize& viewsize);
99 
100 public slots:
102  virtual void render();
103 
105  virtual void forceRender();
106 
108  void cancelPendingRenders();
109 
112  virtual void undo() {}
113 
116  virtual void redo() {}
117 
121  virtual void resetDisplay() {}
122 
123 public:
125  virtual bool canUndo() const {return false;}
126 
128  virtual bool canRedo() const {return false;}
129 
133  virtual QSize getSize();
134 
142  virtual vtkImageData* captureImage(int magnification);
143 
147  virtual vtkImageData* captureImage(const QSize& size);
148 
150  bool writeImage(const QString& filename, const QSize&, int quality=-1);
151 
153  bool hasRepresentation(pqRepresentation* repr) const;
154 
156  int getNumberOfRepresentations() const;
157 
158  // Returns the number of representations currently visible in the view.
159  int getNumberOfVisibleRepresentations() const;
160  int getNumberOfVisibleDataRepresentations() const;
161 
164  pqRepresentation* getRepresentation(int index) const;
165 
167  QList<pqRepresentation*> getRepresentations() const;
168 
171  //vtkSMViewProxy::CanDisplayData().
172  bool canDisplay(pqOutputPort* opPort) const;
173 
176  virtual void emitSelectionSignals(bool frustum);
177 
178 signals:
182  void updateDataEvent();
183 
185  void representationAdded(pqRepresentation*);
186 
188  void representationRemoved(pqRepresentation*);
189 
193  void beginRender();
194 
198  void endRender();
199 
201  void representationVisibilityChanged(pqRepresentation* repr, bool visible);
202 
204  void canUndoChanged(bool);
205 
207  void canRedoChanged(bool);
208 
213  void selected(pqOutputPort* opport);
214 
217  void selectionModeChanged(bool frustum);
218 
221  void picked(pqOutputPort* opport);
222 
225  void beginProgress();
226 
229  void endProgress();
230 
234  void progress(const QString& message, int percent_progress);
235 
242  void multipleSelected(QList<pqOutputPort*> opports);
243 
244 private slots:
246  void onRepresentationsChanged();
247 
249  void onRepresentationVisibilityChanged(bool);
250 
253  void representationCreated(pqRepresentation* repr);
254 
259  void tryRender();
260 
265  void onBeginRender();
266  void onEndRender();
267 
268 protected:
276  pqView( const QString& type,
277  const QString& group,
278  const QString& name,
279  vtkSMViewProxy* view,
280  pqServer* server,
281  QObject* parent=NULL);
282 
287  virtual void initialize();
288 
290  virtual QWidget* createWidget() = 0;
291 
292 private:
293  Q_DISABLE_COPY(pqView)
294 
295  pqViewInternal* Internal;
296  QString ViewType;
297 };
298 
299 #endif
300 
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item...
Definition: pqOutputPort.h:55
SelectionModifier
Definition: pqView.h:60
virtual void redo()
Called to redo interaction.
Definition: pqView.h:116
This is PQ representation for a single representation.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:55
virtual bool canUndo() const
Returns true if undo can be done.
Definition: pqView.h:125
virtual void resetDisplay()
Called to reset the view&#39;s display.
Definition: pqView.h:121
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:52
virtual bool canRedo() const
Returns true if redo can be done.
Definition: pqView.h:128
QString getViewType() const
Returns the type of this view module.
Definition: pqView.h:93
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:112
virtual bool supportsUndo() const
Returns if this view module can support undo/redo.
Definition: pqView.h:90
pqUndoStack represents a vtkSMUndoStack along with a a vtkSMUndoStackBuilder.
Definition: pqUndoStack.h:54
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:62