vtkSMRenderViewProxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkSMRenderViewProxy_h
13 #define vtkSMRenderViewProxy_h
14 
15 #include "vtkNew.h" // needed for vtkInteractorObserver.
16 #include "vtkRemotingViewsModule.h" //needed for exports
17 #include "vtkSMViewProxy.h"
18 
19 class vtkCamera;
20 class vtkCollection;
21 class vtkFloatArray;
22 class vtkIntArray;
23 class vtkRenderer;
24 class vtkRenderWindow;
26 
28 {
29 public:
30  static vtkSMRenderViewProxy* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35 
38  bool SelectSurfaceCells(const int region[4], vtkCollection* selectedRepresentations,
39  vtkCollection* selectionSources, bool multiple_selections = false,
40  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
41  bool SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
42  vtkCollection* selectionSources, bool multiple_selections = false,
43  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
44  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
45  vtkCollection* selectionSources, bool multiple_selections = false);
46  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
47  vtkCollection* selectionSources, bool multiple_selections = false);
48  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
49  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
50  bool selectBlocks = false);
51  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
52  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
53  bool selectBlocks = false);
55 
57 
60  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
61  int component, double range[]);
62  bool ComputeVisibleScalarRange(
63  int fieldAssociation, const char* scalarName, int component, double range[]);
65 
70  vtkSMRepresentationProxy* Pick(int x, int y);
71 
81  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex, int& rank);
82 
91  bool ConvertDisplayToPointOnSurface(const int display_position[2], double world_position[3],
92  double world_normal[3], bool snapOnMeshPoint = false);
93 
99  virtual bool IsSelectionAvailable();
100 
104  void SynchronizeGeometryBounds();
105 
107 
112  void ResetCamera(bool closest = false, double offsetRatio = 0.9);
113  void ResetCamera(double bounds[6], bool closest = false, double offsetRatio = 0.9);
114  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
115  bool closest = false, double offsetRatio = 0.9);
117 
123  virtual void ZoomTo(vtkSMProxy* representation, bool closest = false, double offsetRatio = 0.9);
124 
126 
130  virtual const char* IsSelectVisibleCellsAvailable();
131  virtual const char* IsSelectVisiblePointsAvailable();
133 
140  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
141 
146 
150  vtkRenderer* GetRenderer();
151 
158  void UpdateVTKObjects() override;
159 
161  {
162  Roll = 0,
163  Elevation,
164  Azimuth,
165  Zoom
166  };
168 
172  vtkCamera* GetActiveCamera();
173  void AdjustActiveCamera(const CameraAdjustmentType&, const double&);
174  void AdjustActiveCamera(const int&, const double&);
175  void AdjustAzimuth(const double& value);
176  void AdjustElevation(const double& value);
177  void AdjustRoll(const double& value);
178  void AdjustZoom(const double& value);
179  void ApplyIsometricView();
180  void ResetActiveCameraToDirection(const double& look_x, const double& look_y,
181  const double& look_z, const double& up_x, const double& up_y, const double& up_z);
182  void ResetActiveCameraToPositiveX();
183  void ResetActiveCameraToNegativeX();
184  void ResetActiveCameraToPositiveY();
185  void ResetActiveCameraToNegativeY();
186  void ResetActiveCameraToPositiveZ();
187  void ResetActiveCameraToNegativeZ();
189 
198  void SynchronizeCameraProperties();
199 
203  virtual bool LastRenderWasInteractive();
204 
209  void Update() override;
210 
214  bool GetNeedsUpdate() override;
215 
220  bool StreamingUpdate(bool render_if_needed);
221 
226  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
227 
231  vtkRenderWindow* GetRenderWindow() override;
232 
238  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
239 
243  vtkFloatArray* CaptureDepthBuffer();
244 
248  virtual const char* GetSelectionRepresentationProxyName() { return "SelectionRepresentation"; }
249 
254  vtkSMProxy* vtkNotUsed(fromSelectionRep), vtkSMProxy* vtkNotUsed(toSelectionRep))
255  {
256  }
257 
262  void ComputeVisibleBounds(vtkSMProxy* representation, double* bounds);
263 
268  bool ClearSelectionCache(bool force = false);
269 
270 protected:
272  ~vtkSMRenderViewProxy() override;
273 
278  void RenderForImageCapture() override;
279 
283  void UpdateLOD();
284 
289  void MarkDirty(vtkSMProxy* modifiedProxy) override;
290 
291  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
292  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
293  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
294  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
295  bool selectBlocks);
296 
297  vtkTypeUInt32 PreRender(bool interactive) override;
298  void PostRender(bool interactive) override;
299 
304  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
305  vtkCollection* selectionSources, int modifier, bool selectBlocks);
306 
310  void CreateVTKObjects() override;
311 
317  bool IsInSelectionMode();
318 
320 
321  // Internal fields for the observer mechanism that is used to invalidate
322  // the cache of selection when the current user became master
323  unsigned long NewMasterObserverId;
324  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
325 
327 
328 private:
330  void operator=(const vtkSMRenderViewProxy&) = delete;
331 
336  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
337  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
338  bool selectBlocks = false);
339 
341 };
342 
343 #endif
Proxy for a representations.
int
#define VTKREMOTINGVIEWS_EXPORT
vtkRenderWindow * GetRenderWindow()
Superclass for all view proxies.
virtual void Update()
static vtkSMViewProxy * New()
Store messages for the interpreter.
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void CopySelectionRepresentationProperties(vtkSMProxy *vtkNotUsed(fromSelectionRep), vtkSMProxy *vtkNotUsed(toSelectionRep))
Function to copy selection representation properties.
virtual vtkRenderWindowInteractor * GetInteractor()
Returns the interactor.
virtual const char * GetSelectionRepresentationProxyName()
Get the SelectionRepresentation proxy name.
virtual void UpdateVTKObjects()
Update the VTK object on the server by pushing the values of all modified properties (un-modified pro...
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:140
value
virtual void SetupInteractor(vtkRenderWindowInteractor *iren)
A client process need to set the interactor to enable interactivity.
helper class that make it easier to hook vtkRenderWindowInteractor and vtkSMViewProxy.
unsigned long NewMasterObserverId