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 
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, int modifier = 0,
62  bool selectBlocks = false);
63  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
64  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
65  bool selectBlocks = false);
67 
69 
72  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
73  int component, double range[]);
74  bool ComputeVisibleScalarRange(
75  int fieldAssociation, const char* scalarName, int component, double range[]);
77 
82  vtkSMRepresentationProxy* Pick(int x, int y);
83 
89  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex);
90 
97  bool ConvertDisplayToPointOnSurface(
98  const int display_position[2], double world_position[3], bool snapOnMeshPoint = false);
99 
105  virtual bool IsSelectionAvailable();
106 
108 
111  void ResetCamera();
112  void ResetCamera(double bounds[6]);
113  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
115 
119  virtual void ZoomTo(vtkSMProxy* representation);
120 
122 
126  virtual const char* IsSelectVisibleCellsAvailable();
127  virtual const char* IsSelectVisiblePointsAvailable();
129 
136  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
137 
142 
146  vtkRenderer* GetRenderer();
147 
151  vtkCamera* GetActiveCamera();
152 
161  void SynchronizeCameraProperties();
162 
166  virtual bool LastRenderWasInteractive();
167 
172  void Update() override;
173 
177  bool GetNeedsUpdate() override;
178 
183  bool StreamingUpdate(bool render_if_needed);
184 
189  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
190 
194  vtkRenderWindow* GetRenderWindow() override;
195 
201  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
202 
206  vtkFloatArray* CaptureDepthBuffer();
207 
212  vtkFloatArray* GetValuesFloat();
213 
215 
219  void StartCaptureValues();
220  void StopCaptureValues();
221 
225  int GetValueRenderingMode();
226  void SetValueRenderingMode(int mode);
228 
229 protected:
231  ~vtkSMRenderViewProxy() override;
232 
237  void RenderForImageCapture() override;
238 
242  void UpdateLOD();
243 
248  void MarkDirty(vtkSMProxy* modifiedProxy) override;
249 
250  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
251  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
252  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
253  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
254  bool selectBlocks);
255 
256  vtkTypeUInt32 PreRender(bool interactive) override;
257  void PostRender(bool interactive) override;
258 
263  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
264  vtkCollection* selectionSources, int modifier, bool selectBlocks);
265 
269  void CreateVTKObjects() override;
270 
276  bool IsInSelectionMode();
277 
279  void ClearSelectionCache(bool force = false);
280 
281  // Internal fields for the observer mechanism that is used to invalidate
282  // the cache of selection when the current user became master
283  unsigned long NewMasterObserverId;
284  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
285 
287 
288 private:
290  void operator=(const vtkSMRenderViewProxy&) = delete;
291 
296  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
297  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
298  bool selectBlocks = false);
299 
301 };
302 
303 #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.
#define VTKREMOTINGVIEWS_EXPORT
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