VTK  9.0.1
vtkScenePicker.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScenePicker.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
43 #ifndef vtkScenePicker_h
44 #define vtkScenePicker_h
45 
46 #include "vtkObject.h"
47 #include "vtkRenderingCoreModule.h" // For export macro
48 
49 class vtkRenderer;
50 class vtkProp;
53 class vtkScenePickerSelectionRenderCommand;
54 
55 class VTKRENDERINGCORE_EXPORT vtkScenePicker : public vtkObject
56 {
57 
58  friend class vtkRenderer;
59  friend class vtkScenePickerSelectionRenderCommand;
60 
61 public:
62  static vtkScenePicker* New();
63  vtkTypeMacro(vtkScenePicker, vtkObject);
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
70  virtual void SetRenderer(vtkRenderer*);
71  vtkGetObjectMacro(Renderer, vtkRenderer);
73 
79  vtkIdType GetCellId(int displayPos[2]);
80 
86  vtkIdType GetVertexId(int displayPos[2]);
87 
93  vtkProp* GetViewProp(int displayPos[2]);
94 
96 
101  vtkSetMacro(EnableVertexPicking, vtkTypeBool);
102  vtkGetMacro(EnableVertexPicking, vtkTypeBool);
103  vtkBooleanMacro(EnableVertexPicking, vtkTypeBool);
105 
106 protected:
108  ~vtkScenePicker() override;
109 
110  // Pick render entire viewport
111  // Automatically invoked from vtkRenderer at the end of a still render.
112  void PickRender();
113 
114  // Pick render a region of the renderwindow
115  void PickRender(int x0, int y0, int x1, int y1);
116 
117  // Internal update method retrieves info from the Selector
118  void Update(int displayPos[2]);
119 
120  // The RenderWindowInteractor must be set, so that avoid scene picks (which
121  // involve extra renders) during interaction. This is done by observing the
122  // RenderWindowInteractor for start and end interaction events.
124 
133  int LastQueriedDisplayPos[2];
134  vtkScenePickerSelectionRenderCommand* SelectionRenderCommand;
135 
137 
138 private:
139  vtkScenePicker(const vtkScenePicker&) = delete;
140  void operator=(const vtkScenePicker&) = delete;
141 };
142 
143 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
Definition: vtkRenderer.h:59
Picks an entire viewport at one shot.
vtkTypeBool EnableVertexPicking
static vtkScenePicker * New()
virtual void SetRenderer(vtkRenderer *)
Set the renderer.
vtkRenderWindowInteractor * Interactor
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void PickRender(int x0, int y0, int x1, int y1)
vtkRenderer * Renderer
void SetInteractor(vtkRenderWindowInteractor *)
~vtkScenePicker() override
vtkIdType GetCellId(int displayPos[2])
Get cell id at the pick position.
void Update(int displayPos[2])
vtkIdType VertId
vtkHardwareSelector * Selector
vtkProp * GetViewProp(int displayPos[2])
Get actor at the pick position.
vtkScenePickerSelectionRenderCommand * SelectionRenderCommand
vtkTimeStamp PickRenderTime
vtkIdType CellId
vtkIdType GetVertexId(int displayPos[2])
Get cell id at the pick position.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:338