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" // for base class
18 #include "vtkTuple.h" // for vtkTuple
19 
20 #include <memory> // for std::unique_ptr
21 
22 class vtkCamera;
23 class vtkCollection;
24 class vtkFloatArray;
25 class vtkIntArray;
26 class vtkRenderer;
27 class vtkRenderWindow;
29 
31 {
32 public:
33  static vtkSMRenderViewProxy* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
38 
41  bool SelectSurfaceCells(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 SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
45  vtkCollection* selectionSources, bool multiple_selections = false,
46  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
47  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
48  vtkCollection* selectionSources, bool multiple_selections = false);
49  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
50  vtkCollection* selectionSources, bool multiple_selections = false);
51  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
52  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
53  bool selectBlocks = false);
54  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
55  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
56  bool selectBlocks = false);
58 
60 
63  bool SelectPointsByArrayValue(vtkCollection* selectedRepresentations,
64  vtkCollection* selectionSources, vtkSMRepresentationProxy* source, const char* arrayName,
65  vtkIdType idValue, bool multiple_selections = false, int modifier = 0,
66  bool selectBlocks = false);
67  bool SelectCellsByArrayValue(vtkCollection* selectedRepresentations,
68  vtkCollection* selectionSources, vtkSMRepresentationProxy* source, const char* arrayName,
69  vtkIdType idValue, bool multiple_selections = false, int modifier = 0,
70  bool selectBlocks = false);
72 
74 
77  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
78  int component, double range[]);
79  bool ComputeVisibleScalarRange(
80  int fieldAssociation, const char* scalarName, int component, double range[]);
82 
87  vtkSMRepresentationProxy* Pick(int x, int y);
88 
98  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex, int& rank);
99 
108  bool ConvertDisplayToPointOnSurface(const int display_position[2], double world_position[3],
109  double world_normal[3], bool snapOnMeshPoint = false);
110 
116  virtual bool IsSelectionAvailable();
117 
121  void SynchronizeGeometryBounds();
122 
124 
129  void ResetCamera(bool closest = false, double offsetRatio = 0.9);
130  void ResetCamera(double bounds[6], bool closest = false, double offsetRatio = 0.9);
131  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
132  bool closest = false, double offsetRatio = 0.9);
134 
140  virtual void ZoomTo(vtkSMProxy* representation, bool closest = false, double offsetRatio = 0.9);
141 
143 
147  virtual const char* IsSelectVisibleCellsAvailable();
148  virtual const char* IsSelectVisiblePointsAvailable();
150 
157  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
158 
163 
167  vtkRenderer* GetRenderer();
168 
175  void UpdateVTKObjects() override;
176 
178  {
179  Roll = 0,
180  Elevation,
181  Azimuth,
182  Zoom
183  };
185 
189  vtkCamera* GetActiveCamera();
190  void AdjustActiveCamera(const CameraAdjustmentType&, const double&);
191  void AdjustActiveCamera(const int&, const double&);
192  void AdjustAzimuth(const double& value);
193  void AdjustElevation(const double& value);
194  void AdjustRoll(const double& value);
195  void AdjustZoom(const double& value);
196  void ApplyIsometricView();
197  void ResetActiveCameraToDirection(const double& look_x, const double& look_y,
198  const double& look_z, const double& up_x, const double& up_y, const double& up_z);
199  void ResetActiveCameraToPositiveX();
200  void ResetActiveCameraToNegativeX();
201  void ResetActiveCameraToPositiveY();
202  void ResetActiveCameraToNegativeY();
203  void ResetActiveCameraToPositiveZ();
204  void ResetActiveCameraToNegativeZ();
206 
215  void SynchronizeCameraProperties();
216 
220  virtual bool LastRenderWasInteractive();
221 
226  void Update() override;
227 
231  bool GetNeedsUpdate() override;
232 
237  bool StreamingUpdate(bool render_if_needed);
238 
243  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
244 
248  vtkRenderWindow* GetRenderWindow() override;
249 
255  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
256 
260  vtkFloatArray* CaptureDepthBuffer();
261 
265  virtual const char* GetSelectionRepresentationProxyName() { return "SelectionRepresentation"; }
266 
271  vtkSMProxy* vtkNotUsed(fromSelectionRep), vtkSMProxy* vtkNotUsed(toSelectionRep))
272  {
273  }
274 
279  void ComputeVisibleBounds(vtkSMProxy* representation, double* bounds);
280 
285  bool ClearSelectionCache(bool force = false);
286 
292  void SetEnableSynchronizableActors(bool);
293  bool GetEnableSynchronizableActors();
294 
300  bool GetIsInCAVE();
301 
307  int GetNumberOfDisplays();
308 
316  double GetEyeSeparation();
317 
323  bool GetUseOffAxisProjection();
324 
330  bool GetShowBorders();
331 
337  bool GetFullScreen();
338 
345  vtkTuple<int, 4> GetGeometry(int index);
346 
352  bool GetShow2DOverlays(int index);
353 
360  bool GetHasCorners(int index);
361 
368  vtkTuple<double, 3> GetLowerLeft(int index);
369 
376  vtkTuple<double, 3> GetLowerRight(int index);
377 
384  vtkTuple<double, 3> GetUpperRight(int index);
385 
389  vtkSetMacro(ResizingWindow, bool);
390 
397  const char* GetName(int index);
398 
399  int GetStereoType(int index);
400  bool GetStereoEnabled(int index);
401 
408  int GetViewerId(int index);
409 
415  int GetNumberOfViewers();
416 
422  int GetId(int viewerIndex);
423 
429  double GetEyeSeparation(int viewerIndex);
430 
431 protected:
433  ~vtkSMRenderViewProxy() override;
434 
439  void RenderForImageCapture() override;
440 
444  void UpdateLOD();
445 
450  void MarkDirty(vtkSMProxy* modifiedProxy) override;
451 
452  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
453  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
454  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
455  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
456  bool selectBlocks);
457 
458  vtkTypeUInt32 PreRender(bool interactive) override;
459  void PostRender(bool interactive) override;
460 
465  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
466  vtkCollection* selectionSources, int modifier, bool selectBlocks);
467 
471  void CreateVTKObjects() override;
472 
478  bool IsInSelectionMode();
479 
481 
482  // Internal fields for the observer mechanism that is used to invalidate
483  // the cache of selection when the current user became master
484  unsigned long NewMasterObserverId;
485  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
486  // Update ANARI properties in the correct order
487  void UpdateAnariProperties();
488 
490 
491 private:
493  void operator=(const vtkSMRenderViewProxy&) = delete;
494 
499  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
500  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
501  bool selectBlocks = false);
502 
506  void UpdateStereoProperties();
507 
512  bool SelectByArrayValue(vtkCollection* selectedRepresentations, vtkCollection* selectionSources,
513  vtkSMRepresentationProxy* repr, int fieldAssociation, const char* arrayName, vtkIdType idValue,
514  bool multiple_selections, int modifier = 0, bool select_blocks = false);
515 
517 
518  class vtkInternals;
519  std::unique_ptr<vtkInternals> Internal;
520 
521  bool ResizingWindow = false;
522 };
523 
524 #endif
Proxy for a representations.
int
#define VTKREMOTINGVIEWS_EXPORT
vtkRenderWindow * GetRenderWindow()
Superclass for all view proxies.
virtual void Update()
int vtkIdType
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
index