VTK
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 "vtkRenderingCoreModule.h" // For export macro
62 #include "vtkObject.h"
63 
64 class vtkRenderer;
65 class vtkProp;
66 class vtkPropCollection;
67 
68 class VTKRENDERINGCORE_EXPORT vtkAbstractPicker : public vtkObject
69 {
70 public:
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(double selectionX, double selectionY, double selectionZ,
103  vtkRenderer *renderer) = 0;
104 
110  int Pick(double selectionPt[3], vtkRenderer *ren)
111  {return this->Pick(selectionPt[0],selectionPt[1],selectionPt[2],ren);};
112 
118  virtual int Pick3DPoint(double /* selectionPt */[3], vtkRenderer * /*ren*/)
119  { vtkErrorMacro("Pick3DPoint called without implementation"); return 0;};
120 
126  virtual int Pick3DRay(double /* selectionPt */[3], double /* orient */ [4], vtkRenderer * /*ren*/)
127  { vtkErrorMacro("Pick3DRay called without implementation"); return 0;};
128 
130 
135  vtkSetMacro(PickFromList,vtkTypeBool);
136  vtkGetMacro(PickFromList,vtkTypeBool);
137  vtkBooleanMacro(PickFromList,vtkTypeBool);
139 
143  void InitializePickList();
144 
148  void AddPickList(vtkProp *);
149 
153  void DeletePickList(vtkProp *);
154 
158  vtkPropCollection *GetPickList() {return this->PickList;}
159 
160 protected:
162  ~vtkAbstractPicker() override;
163 
164  virtual void Initialize();
165 
166  vtkRenderer *Renderer; //pick occurred in this renderer's viewport
167  double SelectionPoint[3]; //selection point in window (pixel) coordinates
168  double PickPosition[3]; //selection point in world coordinates
169 
170  // use the following to control picking from a list
173 private:
174  vtkAbstractPicker(const vtkAbstractPicker&) = delete;
175  void operator=(const vtkAbstractPicker&) = delete;
176 };
177 
178 #endif
179 
180 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:63
virtual int Pick3DPoint(double[3], vtkRenderer *)
Perform pick operation with selection point provided.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:39
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