VTK
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 "vtkRenderingCoreModule.h" // For export macro
47 #include "vtkObject.h"
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:
107  vtkScenePicker();
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.
123  void SetInteractor(vtkRenderWindowInteractor *);
124 
133  int LastQueriedDisplayPos[2];
134  vtkScenePickerSelectionRenderCommand* SelectionRenderCommand;
135 
137 private:
138  vtkScenePicker(const vtkScenePicker&) = delete;
139  void operator=(const vtkScenePicker&) = delete;
140 };
141 
142 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkIdType CellId
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderer * Renderer
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkTimeStamp PickRenderTime
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkIdType VertId
int vtkIdType
Definition: vtkType.h:347
vtkRenderWindowInteractor * Interactor
vtkTypeBool EnableVertexPicking
int vtkTypeBool
Definition: vtkABI.h:69
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkHardwareSelector * Selector
Picks an entire viewport at one shot.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkScenePickerSelectionRenderCommand * SelectionRenderCommand