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 ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
64  int component, double range[]);
65  bool ComputeVisibleScalarRange(
66  int fieldAssociation, const char* scalarName, int component, double range[]);
68 
73  vtkSMRepresentationProxy* Pick(int x, int y);
74 
84  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex, int& rank);
85 
94  bool ConvertDisplayToPointOnSurface(const int display_position[2], double world_position[3],
95  double world_normal[3], bool snapOnMeshPoint = false);
96 
102  virtual bool IsSelectionAvailable();
103 
107  void SynchronizeGeometryBounds();
108 
110 
115  void ResetCamera(bool closest = false, double offsetRatio = 0.9);
116  void ResetCamera(double bounds[6], bool closest = false, double offsetRatio = 0.9);
117  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
118  bool closest = false, double offsetRatio = 0.9);
120 
126  virtual void ZoomTo(vtkSMProxy* representation, bool closest = false, double offsetRatio = 0.9);
127 
129 
133  virtual const char* IsSelectVisibleCellsAvailable();
134  virtual const char* IsSelectVisiblePointsAvailable();
136 
143  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
144 
149 
153  vtkRenderer* GetRenderer();
154 
161  void UpdateVTKObjects() override;
162 
164  {
165  Roll = 0,
166  Elevation,
167  Azimuth,
168  Zoom
169  };
171 
175  vtkCamera* GetActiveCamera();
176  void AdjustActiveCamera(const CameraAdjustmentType&, const double&);
177  void AdjustActiveCamera(const int&, const double&);
178  void AdjustAzimuth(const double& value);
179  void AdjustElevation(const double& value);
180  void AdjustRoll(const double& value);
181  void AdjustZoom(const double& value);
182  void ApplyIsometricView();
183  void ResetActiveCameraToDirection(const double& look_x, const double& look_y,
184  const double& look_z, const double& up_x, const double& up_y, const double& up_z);
185  void ResetActiveCameraToPositiveX();
186  void ResetActiveCameraToNegativeX();
187  void ResetActiveCameraToPositiveY();
188  void ResetActiveCameraToNegativeY();
189  void ResetActiveCameraToPositiveZ();
190  void ResetActiveCameraToNegativeZ();
192 
201  void SynchronizeCameraProperties();
202 
206  virtual bool LastRenderWasInteractive();
207 
212  void Update() override;
213 
217  bool GetNeedsUpdate() override;
218 
223  bool StreamingUpdate(bool render_if_needed);
224 
229  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
230 
234  vtkRenderWindow* GetRenderWindow() override;
235 
241  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
242 
246  vtkFloatArray* CaptureDepthBuffer();
247 
251  virtual const char* GetSelectionRepresentationProxyName() { return "SelectionRepresentation"; }
252 
257  vtkSMProxy* vtkNotUsed(fromSelectionRep), vtkSMProxy* vtkNotUsed(toSelectionRep))
258  {
259  }
260 
265  void ComputeVisibleBounds(vtkSMProxy* representation, double* bounds);
266 
271  bool ClearSelectionCache(bool force = false);
272 
278  void SetEnableSynchronizableActors(bool);
279  bool GetEnableSynchronizableActors();
280 
286  bool GetIsInCAVE();
287 
293  int GetNumberOfDisplays();
294 
302  double GetEyeSeparation();
303 
309  bool GetUseOffAxisProjection();
310 
316  bool GetShowBorders();
317 
323  bool GetFullScreen();
324 
331  vtkTuple<int, 4> GetGeometry(int index);
332 
338  bool GetShow2DOverlays(int index);
339 
346  bool GetHasCorners(int index);
347 
354  vtkTuple<double, 3> GetLowerLeft(int index);
355 
362  vtkTuple<double, 3> GetLowerRight(int index);
363 
370  vtkTuple<double, 3> GetUpperRight(int index);
371 
375  vtkSetMacro(ResizingWindow, bool);
376 
383  const char* GetName(int index);
384 
391  int GetViewerId(int index);
392 
398  int GetNumberOfViewers();
399 
405  int GetId(int viewerIndex);
406 
412  double GetEyeSeparation(int viewerIndex);
413 
414 protected:
416  ~vtkSMRenderViewProxy() override;
417 
422  void RenderForImageCapture() override;
423 
427  void UpdateLOD();
428 
433  void MarkDirty(vtkSMProxy* modifiedProxy) override;
434 
435  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
436  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
437  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
438  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
439  bool selectBlocks);
440 
441  vtkTypeUInt32 PreRender(bool interactive) override;
442  void PostRender(bool interactive) override;
443 
448  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
449  vtkCollection* selectionSources, int modifier, bool selectBlocks);
450 
454  void CreateVTKObjects() override;
455 
461  bool IsInSelectionMode();
462 
464 
465  // Internal fields for the observer mechanism that is used to invalidate
466  // the cache of selection when the current user became master
467  unsigned long NewMasterObserverId;
468  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
469  // Update ANARI properties in the correct order
470  void UpdateAnariProperties();
471 
473 
474 private:
476  void operator=(const vtkSMRenderViewProxy&) = delete;
477 
482  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
483  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
484  bool selectBlocks = false);
485 
487 
488  class vtkInternals;
489  std::unique_ptr<vtkInternals> Internal;
490 
491  bool ResizingWindow = false;
492 };
493 
494 #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
index