ParaView
vtkSMViewProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMViewProxy.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
32 #ifndef vtkSMViewProxy_h
33 #define vtkSMViewProxy_h
34 
35 #include "vtkPVServerManagerRenderingModule.h" //needed for exports
36 #include "vtkSMProxy.h"
37 
38 class vtkImageData;
39 class vtkRenderer;
40 class vtkRenderWindow;
41 class vtkRenderWindowInteractor;
43 class vtkSMSourceProxy;
44 class vtkView;
45 
46 class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMViewProxy : public vtkSMProxy
47 {
48 public:
49  static vtkSMViewProxy* New();
50  vtkTypeMacro(vtkSMViewProxy, vtkSMProxy);
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
54 
57  vtkSetMacro(Enable, bool);
58  vtkGetMacro(Enable, bool);
59  vtkBooleanMacro(Enable, bool);
61 
65  virtual void StillRender();
66 
70  virtual void InteractiveRender();
71 
75  virtual void Update();
76 
82  virtual bool CanDisplayData(vtkSMSourceProxy* producer, int outputPort);
83 
92  virtual vtkSMRepresentationProxy* CreateDefaultRepresentation(vtkSMProxy*, int);
93 
103  virtual const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort);
104 
109  virtual vtkSMRepresentationProxy* FindRepresentation(vtkSMSourceProxy* producer, int outputPort);
110 
116  vtkImageData* CaptureWindow(int magnification);
117 
121  vtkView* GetClientSideView();
122 
127  int WriteImage(const char* filename, const char* writerName, int magnification = 1);
128 
134  virtual bool HasDirtyRepresentation() { return this->GetNeedsUpdate(); }
135 
137 
142  vtkGetMacro(NeedsUpdate, bool);
144 
153  virtual vtkRenderWindow* GetRenderWindow() { return NULL; }
154 
160  virtual vtkRenderWindowInteractor* GetInteractor() { return NULL; }
161 
171  virtual void SetupInteractor(vtkRenderWindowInteractor* iren) { (void)iren; }
172 
180  virtual bool MakeRenderWindowInteractor(bool quiet = false);
181 
183 
186  static void SetTransparentBackground(bool val);
187  static bool GetTransparentBackground();
189 
191 
199  virtual bool HideOtherRepresentationsIfNeeded(vtkSMProxy* repr);
201  {
202  return self ? self->HideOtherRepresentationsIfNeeded(repr) : false;
203  }
205 
206 protected:
207  vtkSMViewProxy();
208  ~vtkSMViewProxy();
209 
210  //
214  virtual vtkImageData* CaptureWindowInternal(int vtkNotUsed(magnification)) { return NULL; }
215 
216  virtual vtkTypeUInt32 PreRender(bool vtkNotUsed(interactive)) { return this->GetLocation(); }
217  virtual void PostRender(bool vtkNotUsed(interactive)) {}
218 
228  virtual bool IsContextReadyForRendering();
229 
233  virtual void CreateVTKObjects();
234 
239 
244  bool GetLocalProcessSupportsInteraction();
245 
246  vtkSetStringMacro(DefaultRepresentationName);
248 
249  bool Enable;
250 
251 private:
252  vtkSMViewProxy(const vtkSMViewProxy&) VTK_DELETE_FUNCTION;
253  void operator=(const vtkSMViewProxy&) VTK_DELETE_FUNCTION;
254 
255  static bool TransparentBackground;
256 
257  // When view's time changes, there's no way for the client-side proxies to
258  // know that they may re-execute and their data info is invalid. So mark those
259  // dirty explicitly.
260  void ViewTimeChanged();
261 
262  // Actual logic for taking a screenshot.
263  vtkImageData* CaptureWindowSingle(int magnification);
264  class vtkRendererSaveInfo;
265  vtkRendererSaveInfo* PrepareRendererBackground(vtkRenderer*, double, double, double, bool);
266  void RestoreRendererBackground(vtkRenderer*, vtkRendererSaveInfo*);
267 };
268 
269 #endif
virtual vtkTypeUInt32 GetLocation()
Get/Set the location where the underlying VTK-objects are created.
virtual void PostRender(bool vtkNotUsed(interactive))
virtual int ReadXMLAttributes(vtkSMSessionProxyManager *pm, vtkPVXMLElement *element)
Read attributes from an XML element.
Superclass for all view proxies.
void operator=(const vtkSMProxy &) VTK_DELETE_FUNCTION
char * DefaultRepresentationName
virtual vtkRenderWindow * GetRenderWindow()
Return the vtkRenderWindow used by this view, if any.
virtual vtkImageData * CaptureWindowInternal(int vtkNotUsed(magnification))
Subclasses should override this method to do the actual image capture.
virtual vtkRenderWindowInteractor * GetInteractor()
Returns the interactor.
virtual vtkTypeUInt32 PreRender(bool vtkNotUsed(interactive))
proxy for a VTK source on a server
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
void PrintSelf(ostream &os, vtkIndent indent)
static bool HideOtherRepresentationsIfNeeded(vtkSMViewProxy *self, vtkSMProxy *repr)
Method used to hide other representations if the view has a <ShowOneRepresentationAtATime> hint...
virtual bool HasDirtyRepresentation()
Return true any internal representation is dirty.
static vtkSMProxy * New()
virtual void CreateVTKObjects()
Given a class name (by setting VTKClassName) and server ids (by setting ServerIDs), this methods instantiates the objects on the server(s)
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
virtual void SetupInteractor(vtkRenderWindowInteractor *iren)
A client process need to set the interactor to enable interactivity.
This is used by vtkPVXMLParser to represent an XML document starting at the root element.