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 
300  double GetEyeSeparation();
301 
307  bool GetShowBorders();
308 
314  bool GetFullScreen();
315 
322  vtkTuple<int, 4> GetGeometry(int index);
323 
330  bool GetHasCorners(int index);
331 
338  vtkTuple<double, 3> GetLowerLeft(int index);
339 
346  vtkTuple<double, 3> GetLowerRight(int index);
347 
354  vtkTuple<double, 3> GetUpperRight(int index);
355 
356 protected:
358  ~vtkSMRenderViewProxy() override;
359 
364  void RenderForImageCapture() override;
365 
369  void UpdateLOD();
370 
375  void MarkDirty(vtkSMProxy* modifiedProxy) override;
376 
377  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
378  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
379  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
380  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
381  bool selectBlocks);
382 
383  vtkTypeUInt32 PreRender(bool interactive) override;
384  void PostRender(bool interactive) override;
385 
390  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
391  vtkCollection* selectionSources, int modifier, bool selectBlocks);
392 
396  void CreateVTKObjects() override;
397 
403  bool IsInSelectionMode();
404 
406 
407  // Internal fields for the observer mechanism that is used to invalidate
408  // the cache of selection when the current user became master
409  unsigned long NewMasterObserverId;
410  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
411 
413 
414 private:
416  void operator=(const vtkSMRenderViewProxy&) = delete;
417 
422  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
423  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
424  bool selectBlocks = false);
425 
427 
428  class vtkInternals;
429  std::unique_ptr<vtkInternals> Internal;
430 };
431 
432 #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