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 "vtkRemotingViewsModule.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;
38 
39 class VTKREMOTINGVIEWS_EXPORT vtkSMRenderViewProxy : public vtkSMViewProxy
40 {
41 public:
42  static vtkSMRenderViewProxy* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  bool SelectSurfaceCells(const int region[4], vtkCollection* selectedRepresentations,
51  vtkCollection* selectionSources, bool multiple_selections = false,
52  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
53  bool SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
54  vtkCollection* selectionSources, bool multiple_selections = false,
55  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
56  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
57  vtkCollection* selectionSources, bool multiple_selections = false);
58  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
59  vtkCollection* selectionSources, bool multiple_selections = false);
60  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
61  vtkCollection* selectionSources, bool multiple_selections = false);
62  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
63  vtkCollection* selectionSources, bool multiple_selections = false);
65 
67 
70  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
71  int component, double range[]);
72  bool ComputeVisibleScalarRange(
73  int fieldAssociation, const char* scalarName, int component, double range[]);
75 
80  vtkSMRepresentationProxy* Pick(int x, int y);
81 
87  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex);
88 
95  bool ConvertDisplayToPointOnSurface(
96  const int display_position[2], double world_position[3], bool snapOnMeshPoint = false);
97 
103  virtual bool IsSelectionAvailable();
104 
106 
109  void ResetCamera();
110  void ResetCamera(double bounds[6]);
111  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
113 
117  virtual void ZoomTo(vtkSMProxy* representation);
118 
120 
124  virtual const char* IsSelectVisibleCellsAvailable();
125  virtual const char* IsSelectVisiblePointsAvailable();
127 
134  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
135 
140 
144  vtkRenderer* GetRenderer();
145 
149  vtkCamera* GetActiveCamera();
150 
159  void SynchronizeCameraProperties();
160 
164  virtual bool LastRenderWasInteractive();
165 
170  void Update() override;
171 
175  bool GetNeedsUpdate() override;
176 
181  bool StreamingUpdate(bool render_if_needed);
182 
187  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
188 
192  vtkRenderWindow* GetRenderWindow() override;
193 
199  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
200 
204  vtkFloatArray* CaptureDepthBuffer();
205 
210  vtkFloatArray* GetValuesFloat();
211 
213 
217  void StartCaptureValues();
218  void StopCaptureValues();
219 
223  int GetValueRenderingMode();
224  void SetValueRenderingMode(int mode);
226 
227 protected:
229  ~vtkSMRenderViewProxy() override;
230 
235  void RenderForImageCapture() override;
236 
240  void UpdateLOD();
241 
246  void MarkDirty(vtkSMProxy* modifiedProxy) override;
247 
248  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
249  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
250  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
251  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
252 
253  vtkTypeUInt32 PreRender(bool interactive) override;
254  void PostRender(bool interactive) override;
255 
260  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
261  vtkCollection* selectionSources, int modifier, bool selectBlocks);
262 
266  void CreateVTKObjects() override;
267 
273  bool IsInSelectionMode();
274 
276  void ClearSelectionCache(bool force = false);
277 
278  // Internal fields for the observer mechanism that is used to invalidate
279  // the cache of selection when the current user became master
280  unsigned long NewMasterObserverId;
281  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
282 
284 
285 private:
287  void operator=(const vtkSMRenderViewProxy&) = delete;
288 
293  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
294  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
295  bool selectBlocks = false);
296 
298 };
299 
300 #endif
Proxy for a representations.
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,...
void CreateVTKObjects() override
Called at the end of CreateVTKObjects().
virtual bool GetNeedsUpdate()
Returns true if the subsequent call to Update() will result in an actual update.
virtual void PostRender(bool vtkNotUsed(interactive))
Superclass for all view proxies.
static vtkSMViewProxy * New()
virtual vtkRenderWindow * GetRenderWindow()
Return the vtkRenderWindow used by this view, if any.
Store messages for the interpreter.
void PrintSelf(ostream &os, vtkIndent indent) override
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))
This method is called before executing code that could cause a render on the underlying vtkPVView.
virtual void RenderForImageCapture()
This method is called whenever the view wants to render to during image capture.
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