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 "vtkParaViewDeprecation.h" // For PARAVIEW_DEPRECATED_IN_6_2_0
17 #include "vtkRemotingViewsModule.h" // needed for exports
18 #include "vtkSMViewProxy.h" // for base class
19 #include "vtkTuple.h" // for vtkTuple
20 
21 #include <memory> // for std::unique_ptr
22 
23 class vtkCamera;
24 class vtkCollection;
25 class vtkFloatArray;
26 class vtkIntArray;
27 class vtkRenderer;
28 class vtkRenderWindow;
30 
32 {
33 public:
34  static vtkSMRenderViewProxy* New();
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
39 
42  bool SelectSurfaceCells(const int region[4], vtkCollection* selectedRepresentations,
43  vtkCollection* selectionSources, bool multiple_selections = false,
44  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
45  bool SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
46  vtkCollection* selectionSources, bool multiple_selections = false,
47  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
48  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
49  vtkCollection* selectionSources, bool multiple_selections = false);
50  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
51  vtkCollection* selectionSources, bool multiple_selections = false);
52  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
53  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
54  bool selectBlocks = false);
55  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
56  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
57  bool selectBlocks = false);
59 
61 
64  bool SelectPointsByArrayValue(vtkCollection* selectedRepresentations,
65  vtkCollection* selectionSources, vtkSMRepresentationProxy* source, const char* arrayName,
66  vtkIdType idValue, bool multiple_selections = false, int modifier = 0,
67  bool selectBlocks = false);
68  bool SelectCellsByArrayValue(vtkCollection* selectedRepresentations,
69  vtkCollection* selectionSources, vtkSMRepresentationProxy* source, const char* arrayName,
70  vtkIdType idValue, bool multiple_selections = false, int modifier = 0,
71  bool selectBlocks = false);
73 
75 
78  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
79  int component, double range[]);
80  bool ComputeVisibleScalarRange(
81  int fieldAssociation, const char* scalarName, int component, double range[]);
83 
88  vtkSMRepresentationProxy* Pick(int x, int y);
89 
99  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex, int& rank);
100 
109  bool ConvertDisplayToPointOnSurface(const int display_position[2], double world_position[3],
110  double world_normal[3], bool snapOnMeshPoint = false);
111 
117  virtual bool IsSelectionAvailable();
118 
122  void SynchronizeGeometryBounds();
123 
125 
130  void ResetCamera(bool closest = false, double offsetRatio = 0.9);
131  void ResetCamera(double bounds[6], bool closest = false, double offsetRatio = 0.9);
132  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
133  bool closest = false, double offsetRatio = 0.9);
135 
141  virtual void ZoomTo(vtkSMProxy* representation, bool closest = false, double offsetRatio = 0.9);
142 
144 
148  virtual const char* IsSelectVisibleCellsAvailable();
149  virtual const char* IsSelectVisiblePointsAvailable();
151 
158  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
159 
164 
168  vtkRenderer* GetRenderer();
169 
176  void UpdateVTKObjects() override;
177 
179  {
180  Roll = 0,
181  Elevation,
182  Azimuth,
183  Zoom
184  };
186 
190  vtkCamera* GetActiveCamera();
191  void AdjustActiveCamera(const CameraAdjustmentType&, const double&);
192  void AdjustActiveCamera(const int&, const double&);
193  void AdjustAzimuth(const double& value);
194  void AdjustElevation(const double& value);
195  void AdjustRoll(const double& value);
196  void AdjustZoom(const double& value);
197  void ApplyIsometricView();
198  void ResetActiveCameraToDirection(const double& look_x, const double& look_y,
199  const double& look_z, const double& up_x, const double& up_y, const double& up_z);
200  void ResetActiveCameraToPositiveX();
201  void ResetActiveCameraToNegativeX();
202  void ResetActiveCameraToPositiveY();
203  void ResetActiveCameraToNegativeY();
204  void ResetActiveCameraToPositiveZ();
205  void ResetActiveCameraToNegativeZ();
207 
216  void SynchronizeCameraProperties();
217 
221  virtual bool LastRenderWasInteractive();
222 
227  void Update() override;
228 
232  bool GetNeedsUpdate() override;
233 
238  bool StreamingUpdate(bool render_if_needed);
239 
244  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
245 
249  vtkRenderWindow* GetRenderWindow() override;
250 
256  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
257 
261  vtkFloatArray* CaptureDepthBuffer();
262 
266  virtual const char* GetSelectionRepresentationProxyName() { return "SelectionRepresentation"; }
267 
272  vtkSMProxy* vtkNotUsed(fromSelectionRep), vtkSMProxy* vtkNotUsed(toSelectionRep))
273  {
274  }
275 
280  void ComputeVisibleBounds(vtkSMProxy* representation, double* bounds);
281 
286  bool ClearSelectionCache(bool force = false);
287 
293  void SetEnableSynchronizableActors(bool);
294  bool GetEnableSynchronizableActors();
295 
301  bool GetIsInCAVE();
302 
308  int GetNumberOfDisplays();
309 
317  double GetEyeSeparation();
318 
324  bool GetUseOffAxisProjection();
325 
331  bool GetShowBorders();
332 
338  bool GetFullScreen();
339 
346  vtkTuple<int, 4> GetGeometry(int index);
347 
353  bool GetShow2DOverlays(int index);
354 
361  bool GetHasCorners(int index);
362 
369  vtkTuple<double, 3> GetLowerLeft(int index);
370 
377  vtkTuple<double, 3> GetLowerRight(int index);
378 
385  vtkTuple<double, 3> GetUpperRight(int index);
386 
390  PARAVIEW_DEPRECATED_IN_6_2_0("SetResizingWindow has been removed. Simply remove the function.")
391  vtkSetMacro(ResizingWindow, bool);
392 
399  const char* GetName(int index);
400 
401  int GetStereoType(int index);
402  bool GetStereoEnabled(int index);
403 
410  int GetViewerId(int index);
411 
417  int GetNumberOfViewers();
418 
424  int GetId(int viewerIndex);
425 
431  double GetEyeSeparation(int viewerIndex);
432 
433 protected:
435  ~vtkSMRenderViewProxy() override;
436 
441  void RenderForImageCapture() override;
442 
446  void UpdateLOD();
447 
452  void MarkDirty(vtkSMProxy* modifiedProxy) override;
453 
454  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
455  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
456  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
457  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
458  bool selectBlocks);
459 
460  vtkTypeUInt32 PreRender(bool interactive) override;
461  void PostRender(bool interactive) override;
462 
467  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
468  vtkCollection* selectionSources, int modifier, bool selectBlocks);
469 
473  void CreateVTKObjects() override;
474 
480  bool IsInSelectionMode();
481 
483 
484  // Internal fields for the observer mechanism that is used to invalidate
485  // the cache of selection when the current user became master
486  unsigned long NewMasterObserverId;
487  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
488  // Update ANARI properties in the correct order
489  void UpdateAnariProperties();
490 
492 
493 private:
495  void operator=(const vtkSMRenderViewProxy&) = delete;
496 
501  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
502  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
503  bool selectBlocks = false);
504 
508  void UpdateStereoProperties();
509 
514  bool SelectByArrayValue(vtkCollection* selectedRepresentations, vtkCollection* selectionSources,
515  vtkSMRepresentationProxy* repr, int fieldAssociation, const char* arrayName, vtkIdType idValue,
516  bool multiple_selections, int modifier = 0, bool select_blocks = false);
517 
519 
520  class vtkInternals;
521  std::unique_ptr<vtkInternals> Internal;
522 
523  bool ResizingWindow = false;
524 };
525 
526 #endif
Proxy for a representations.
#define PARAVIEW_DEPRECATED_IN_6_2_0(reason)
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