VTK  9.3.1
vtkAbstractPicker.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
46 #ifndef vtkAbstractPicker_h
47 #define vtkAbstractPicker_h
48 
49 #include "vtkObject.h"
50 #include "vtkRenderingCoreModule.h" // For export macro
51 
52 VTK_ABI_NAMESPACE_BEGIN
53 class vtkRenderer;
54 class vtkProp;
55 class vtkPropCollection;
56 
57 class VTKRENDERINGCORE_EXPORT vtkAbstractPicker : public vtkObject
58 {
59 public:
60  vtkTypeMacro(vtkAbstractPicker, vtkObject);
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
64 
67  vtkGetObjectMacro(Renderer, vtkRenderer);
69 
71 
75  vtkGetVectorMacro(SelectionPoint, double, 3);
77 
79 
82  vtkGetVectorMacro(PickPosition, double, 3);
84 
91  virtual int Pick(
92  double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) = 0;
93 
99  int Pick(double selectionPt[3], vtkRenderer* ren)
100  {
101  return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);
102  }
103 
109  virtual int Pick3DPoint(double /* selectionPt */[3], vtkRenderer* /*ren*/)
110  {
111  vtkErrorMacro("Pick3DPoint called without implementation");
112  return 0;
113  }
114 
120  virtual int Pick3DRay(double /* selectionPt */[3], double /* orient */[4], vtkRenderer* /*ren*/)
121  {
122  vtkErrorMacro("Pick3DRay called without implementation");
123  return 0;
124  }
125 
127 
132  vtkSetMacro(PickFromList, vtkTypeBool);
133  vtkGetMacro(PickFromList, vtkTypeBool);
134  vtkBooleanMacro(PickFromList, vtkTypeBool);
136 
140  void InitializePickList();
141 
145  void AddPickList(vtkProp*);
146 
150  void DeletePickList(vtkProp*);
151 
155  vtkPropCollection* GetPickList() { return this->PickList; }
156 
157 protected:
159  ~vtkAbstractPicker() override;
160 
161  virtual void Initialize();
162 
163  vtkRenderer* Renderer; // pick occurred in this renderer's viewport
164  double SelectionPoint[3]; // selection point in window (pixel) coordinates
165  double PickPosition[3]; // selection point in world coordinates
166 
167  // use the following to control picking from a list
170 
171 private:
172  vtkAbstractPicker(const vtkAbstractPicker&) = delete;
173  void operator=(const vtkAbstractPicker&) = delete;
174 };
175 
176 VTK_ABI_NAMESPACE_END
177 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPropCollection * GetPickList()
Return the list of actors in the PickList.
vtkRenderer * Renderer
abstract specification for renderers
Definition: vtkRenderer.h:61
virtual int Pick3DPoint(double[3], vtkRenderer *)
Perform pick operation with selection point provided.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int Pick3DRay(double[3], double[4], vtkRenderer *)
Perform pick operation with selection point and orientation provided.
define API for picking subclasses
vtkPropCollection * PickList
int Pick(double selectionPt[3], vtkRenderer *ren)
provided.
vtkTypeBool PickFromList