VTK  9.0.20210301
vtkAbstractPicker.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPicker.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 =========================================================================*/
58 #ifndef vtkAbstractPicker_h
59 #define vtkAbstractPicker_h
60 
61 #include "vtkObject.h"
62 #include "vtkRenderingCoreModule.h" // For export macro
63 
64 class vtkRenderer;
65 class vtkProp;
66 class vtkPropCollection;
67 
68 class VTKRENDERINGCORE_EXPORT vtkAbstractPicker : public vtkObject
69 {
70 public:
71  vtkTypeMacro(vtkAbstractPicker, vtkObject);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
78  vtkGetObjectMacro(Renderer, vtkRenderer);
80 
82 
86  vtkGetVectorMacro(SelectionPoint, double, 3);
88 
90 
93  vtkGetVectorMacro(PickPosition, double, 3);
95 
102  virtual int Pick(
103  double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) = 0;
104 
110  int Pick(double selectionPt[3], vtkRenderer* ren)
111  {
112  return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);
113  }
114 
120  virtual int Pick3DPoint(double /* selectionPt */[3], vtkRenderer* /*ren*/)
121  {
122  vtkErrorMacro("Pick3DPoint called without implementation");
123  return 0;
124  }
125 
131  virtual int Pick3DRay(double /* selectionPt */[3], double /* orient */[4], vtkRenderer* /*ren*/)
132  {
133  vtkErrorMacro("Pick3DRay called without implementation");
134  return 0;
135  }
136 
138 
143  vtkSetMacro(PickFromList, vtkTypeBool);
144  vtkGetMacro(PickFromList, vtkTypeBool);
145  vtkBooleanMacro(PickFromList, vtkTypeBool);
147 
152 
157 
162 
166  vtkPropCollection* GetPickList() { return this->PickList; }
167 
168 protected:
170  ~vtkAbstractPicker() override;
171 
172  virtual void Initialize();
173 
174  vtkRenderer* Renderer; // pick occurred in this renderer's viewport
175  double SelectionPoint[3]; // selection point in window (pixel) coordinates
176  double PickPosition[3]; // selection point in world coordinates
177 
178  // use the following to control picking from a list
181 
182 private:
183  vtkAbstractPicker(const vtkAbstractPicker&) = delete;
184  void operator=(const vtkAbstractPicker&) = delete;
185 };
186 
187 #endif
vtkAbstractPicker::AddPickList
void AddPickList(vtkProp *)
Add an actor to the pick list.
vtkAbstractPicker::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractPicker::GetPickList
vtkPropCollection * GetPickList()
Return the list of actors in the PickList.
Definition: vtkAbstractPicker.h:166
vtkAbstractPicker::Pick
int Pick(double selectionPt[3], vtkRenderer *ren)
provided.
Definition: vtkAbstractPicker.h:110
vtkAbstractPicker::PickFromList
vtkTypeBool PickFromList
Definition: vtkAbstractPicker.h:179
vtkAbstractPicker::Pick3DPoint
virtual int Pick3DPoint(double[3], vtkRenderer *)
Perform pick operation with selection point provided.
Definition: vtkAbstractPicker.h:120
vtkAbstractPicker::Renderer
vtkRenderer * Renderer
Definition: vtkAbstractPicker.h:174
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:63
vtkAbstractPicker
define API for picking subclasses
Definition: vtkAbstractPicker.h:69
vtkAbstractPicker::vtkAbstractPicker
vtkAbstractPicker()
vtkAbstractPicker::Initialize
virtual void Initialize()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkAbstractPicker::Pick3DRay
virtual int Pick3DRay(double[3], double[4], vtkRenderer *)
Perform pick operation with selection point and orientation provided.
Definition: vtkAbstractPicker.h:131
vtkObject.h
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:68
vtkAbstractPicker::DeletePickList
void DeletePickList(vtkProp *)
Delete an actor from the pick list.
vtkAbstractPicker::InitializePickList
void InitializePickList()
Initialize list of actors in pick list.
vtkAbstractPicker::~vtkAbstractPicker
~vtkAbstractPicker() override
vtkAbstractPicker::PickList
vtkPropCollection * PickList
Definition: vtkAbstractPicker.h:180
vtkAbstractPicker::Pick
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)=0
Perform pick operation with selection point provided.
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69