ParaView
vtkSMRenderViewProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMRenderViewProxy.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 =========================================================================*/
24 #ifndef vtkSMRenderViewProxy_h
25 #define vtkSMRenderViewProxy_h
26 
27 #include "vtkNew.h" // needed for vtkInteractorObserver.
28 #include "vtkPVServerManagerRenderingModule.h" //needed for exports
29 #include "vtkSMViewProxy.h"
30 class vtkCamera;
31 class vtkCollection;
32 class vtkFloatArray;
33 class vtkIntArray;
34 class vtkRenderer;
35 class vtkRenderWindow;
36 class vtkRenderWinwInteractor;
39 
40 class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMRenderViewProxy : public vtkSMViewProxy
41 {
42 public:
43  static vtkSMRenderViewProxy* New();
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48 
51  bool SelectSurfaceCells(const int region[4], vtkCollection* selectedRepresentations,
52  vtkCollection* selectionSources, bool multiple_selections = false);
53  bool SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
54  vtkCollection* selectionSources, bool multiple_selections = false);
55  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
56  vtkCollection* selectionSources, bool multiple_selections = false);
57  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
58  vtkCollection* selectionSources, bool multiple_selections = false);
59  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
60  vtkCollection* selectionSources, bool multiple_selections = false);
61  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
62  vtkCollection* selectionSources, bool multiple_selections = false);
64 
66 
69  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
70  int component, double range[]);
71  bool ComputeVisibleScalarRange(
72  int fieldAssociation, const char* scalarName, int component, double range[]);
74 
79  vtkSMRepresentationProxy* Pick(int x, int y);
80 
86  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex);
87 
94  bool ConvertDisplayToPointOnSurface(
95  const int display_position[2], double world_position[3], bool snapOnMeshPoint = false);
96 
102  virtual bool IsSelectionAvailable();
103 
105 
108  void ResetCamera();
109  void ResetCamera(double bounds[6]);
110  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
112 
116  void ZoomTo(vtkSMProxy* representation);
117 
119 
123  virtual const char* IsSelectVisibleCellsAvailable();
124  virtual const char* IsSelectVisiblePointsAvailable();
126 
133  virtual void SetupInteractor(vtkRenderWindowInteractor* iren);
134 
138  virtual vtkRenderWindowInteractor* GetInteractor();
139 
143  vtkRenderer* GetRenderer();
144 
148  vtkCamera* GetActiveCamera();
149 
158  void SynchronizeCameraProperties();
159 
163  virtual bool LastRenderWasInteractive();
164 
168  double GetZBufferValue(int x, int y);
169 
174  virtual void Update();
175 
179  virtual bool GetNeedsUpdate();
180 
185  bool StreamingUpdate(bool render_if_needed);
186 
191  virtual const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort);
192 
196  virtual vtkRenderWindow* GetRenderWindow();
197 
203  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
204 
208  vtkFloatArray* CaptureDepthBuffer();
209 
214  vtkFloatArray* GetValuesFloat();
215 
217 
221  void StartCaptureValues();
222  void StopCaptureValues();
223 
227  int GetValueRenderingMode();
228  void SetValueRenderingMode(int mode);
230 
231 protected:
234 
238  void UpdateLOD();
239 
244  virtual void MarkDirty(vtkSMProxy* modifiedProxy);
245 
247 
250  virtual vtkImageData* CaptureWindowInternal(int magnification);
251  virtual void CaptureWindowInternalRender();
253 
254  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
255  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
256  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
257  vtkCollection* selectionSources, bool multiple_selections, const char* method);
258 
259  virtual vtkTypeUInt32 PreRender(bool interactive);
260  virtual void PostRender(bool interactive);
261 
266  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
267  vtkCollection* selectionSources);
268 
272  virtual void CreateVTKObjects();
273 
279  bool IsInSelectionMode();
280 
282  void ClearSelectionCache(bool force = false);
283 
284  // Internal fields for the observer mechanism that is used to invalidate
285  // the cache of selection when the current user became master
286  unsigned long NewMasterObserverId;
287  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
288 
291 
292 private:
293  vtkSMRenderViewProxy(const vtkSMRenderViewProxy&) VTK_DELETE_FUNCTION;
294  void operator=(const vtkSMRenderViewProxy&) VTK_DELETE_FUNCTION;
295 
296  vtkNew<vtkSMViewProxyInteractorHelper> InteractorHelper;
297 };
298 
299 #endif
virtual const char * GetRepresentationType(vtkSMSourceProxy *producer, int outputPort)
Returns the xml name of the representation proxy to create to show the data produced in this view...
virtual bool GetNeedsUpdate()
Returns true if the subsequent call to Update() will result in an actual update.
vtkSMDataDeliveryManager * DeliveryManager
virtual void PostRender(bool vtkNotUsed(interactive))
Superclass for all view proxies.
static vtkSMViewProxy * New()
virtual void CreateVTKObjects()
Called at the end of CreateVTKObjects().
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 void MarkDirty(vtkSMProxy *modifiedProxy)
Dirty means this algorithm will execute during next update.
virtual vtkTypeUInt32 PreRender(bool vtkNotUsed(interactive))
implementation for View that includes render window and renderers.
proxy for a VTK source on a server
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.
virtual void Update()
Called vtkPVView::Update on the server-side.
helper class that make it easier to hook vtkRenderWindowInteractor and vtkSMViewProxy.
unsigned long NewMasterObserverId
void PrintSelf(ostream &os, vtkIndent indent)
server-manager class for vtkPVDataDeliveryManager.