vtkSMRenderViewProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMRenderViewProxy.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
24 #ifndef vtkSMRenderViewProxy_h
25 #define vtkSMRenderViewProxy_h
26 
27 #include "vtkNew.h" // needed for vtkInteractorObserver.
28 #include "vtkRemotingViewsModule.h" //needed for exports
29 #include "vtkSMViewProxy.h"
30 class vtkCamera;
31 class vtkCollection;
32 class vtkFloatArray;
33 class vtkIntArray;
34 class vtkRenderer;
35 class vtkRenderWindow;
37 
39 {
40 public:
41  static vtkSMRenderViewProxy* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
49  bool SelectSurfaceCells(const int region[4], vtkCollection* selectedRepresentations,
50  vtkCollection* selectionSources, bool multiple_selections = false,
51  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
52  bool SelectSurfacePoints(const int region[4], vtkCollection* selectedRepresentations,
53  vtkCollection* selectionSources, bool multiple_selections = false,
54  int modifier = /* replace */ 0, bool select_blocks = false, const char* arrayName = nullptr);
55  bool SelectFrustumCells(const int region[4], vtkCollection* selectedRepresentations,
56  vtkCollection* selectionSources, bool multiple_selections = false);
57  bool SelectFrustumPoints(const int region[4], vtkCollection* selectedRepresentations,
58  vtkCollection* selectionSources, bool multiple_selections = false);
59  bool SelectPolygonPoints(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
60  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
61  bool selectBlocks = false);
62  bool SelectPolygonCells(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
63  vtkCollection* selectionSources, bool multiple_selections = false, int modifier = 0,
64  bool selectBlocks = false);
66 
68 
71  bool ComputeVisibleScalarRange(const int region[4], int fieldAssociation, const char* scalarName,
72  int component, double range[]);
73  bool ComputeVisibleScalarRange(
74  int fieldAssociation, const char* scalarName, int component, double range[]);
76 
81  vtkSMRepresentationProxy* Pick(int x, int y);
82 
92  vtkSMRepresentationProxy* PickBlock(int x, int y, unsigned int& flatIndex, int& rank);
93 
102  bool ConvertDisplayToPointOnSurface(const int display_position[2], double world_position[3],
103  double world_normal[3], bool snapOnMeshPoint = false);
104 
110  virtual bool IsSelectionAvailable();
111 
113 
116  void ResetCamera(bool closest = false);
117  void ResetCamera(double bounds[6], bool closest = false);
118  void ResetCamera(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
119  bool closest = false);
121 
125  virtual void ZoomTo(vtkSMProxy* representation, bool closest = false);
126 
128 
132  virtual const char* IsSelectVisibleCellsAvailable();
133  virtual const char* IsSelectVisiblePointsAvailable();
135 
142  void SetupInteractor(vtkRenderWindowInteractor* iren) override;
143 
148 
152  vtkRenderer* GetRenderer();
153 
155  {
156  Roll = 0,
157  Elevation,
158  Azimuth,
159  Zoom
160  };
162 
166  vtkCamera* GetActiveCamera();
167  void AdjustActiveCamera(const CameraAdjustmentType&, const double&);
168  void AdjustActiveCamera(const int&, const double&);
169  void AdjustAzimuth(const double& value);
170  void AdjustElevation(const double& value);
171  void AdjustRoll(const double& value);
172  void AdjustZoom(const double& value);
173  void ApplyIsometricView();
174  void ResetActiveCameraToDirection(const double& look_x, const double& look_y,
175  const double& look_z, const double& up_x, const double& up_y, const double& up_z);
176  void ResetActiveCameraToPositiveX();
177  void ResetActiveCameraToNegativeX();
178  void ResetActiveCameraToPositiveY();
179  void ResetActiveCameraToNegativeY();
180  void ResetActiveCameraToPositiveZ();
181  void ResetActiveCameraToNegativeZ();
183 
192  void SynchronizeCameraProperties();
193 
197  virtual bool LastRenderWasInteractive();
198 
203  void Update() override;
204 
208  bool GetNeedsUpdate() override;
209 
214  bool StreamingUpdate(bool render_if_needed);
215 
220  const char* GetRepresentationType(vtkSMSourceProxy* producer, int outputPort) override;
221 
225  vtkRenderWindow* GetRenderWindow() override;
226 
232  vtkSMViewProxyInteractorHelper* GetInteractorHelper();
233 
237  vtkFloatArray* CaptureDepthBuffer();
238 
239 protected:
241  ~vtkSMRenderViewProxy() override;
242 
247  void RenderForImageCapture() override;
248 
252  void UpdateLOD();
253 
258  void MarkDirty(vtkSMProxy* modifiedProxy) override;
259 
260  bool SelectFrustumInternal(const int region[4], vtkCollection* selectedRepresentations,
261  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation);
262  bool SelectPolygonInternal(vtkIntArray* polygon, vtkCollection* selectedRepresentations,
263  vtkCollection* selectionSources, bool multiple_selections, int fieldAssociation, int modifier,
264  bool selectBlocks);
265 
266  vtkTypeUInt32 PreRender(bool interactive) override;
267  void PostRender(bool interactive) override;
268 
273  bool FetchLastSelection(bool multiple_selections, vtkCollection* selectedRepresentations,
274  vtkCollection* selectionSources, int modifier, bool selectBlocks);
275 
279  void CreateVTKObjects() override;
280 
286  bool IsInSelectionMode();
287 
289 
294  bool ClearSelectionCache(bool force = false);
295 
296  // Internal fields for the observer mechanism that is used to invalidate
297  // the cache of selection when the current user became master
298  unsigned long NewMasterObserverId;
299  void NewMasterCallback(vtkObject* src, unsigned long event, void* data);
300 
302 
303 private:
305  void operator=(const vtkSMRenderViewProxy&) = delete;
306 
311  bool SelectInternal(const vtkClientServerStream& cmd, vtkCollection* selectedRepresentations,
312  vtkCollection* selectionSources, bool multiple_selections, int modifier = /* replace */ 0,
313  bool selectBlocks = false);
314 
316 };
317 
318 #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 vtkRenderWindowInteractor * GetInteractor()
Returns the interactor.
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:152
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