VTK
vtkPickingManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPickingManager.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 =========================================================================*/
15 
16 /*==============================================================================
17 
18  Library: MSVTK
19 
20  Copyright (c) Kitware Inc.
21 
22  Licensed under the Apache License, Version 2.0 (the "License");
23  you may not use this file except in compliance with the License.
24  You may obtain a copy of the License at
25 
26  http://www.apache.org/licenses/LICENSE-2.0.txt
27 
28  Unless required by applicable law or agreed to in writing, software
29  distributed under the License is distributed on an "AS IS" BASIS,
30  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  See the License for the specific language governing permissions and
32  limitations under the License.
33 
34 ==============================================================================*/
35 
73 #ifndef vtkPickingManager_h
74 #define vtkPickingManager_h
75 
76 #include "vtkObject.h"
77 #include "vtkRenderingCoreModule.h" // For export macro
78 
79 class vtkAbstractPicker;
81 class vtkAssemblyPath;
82 class vtkRenderer;
84 
85 class VTKRENDERINGCORE_EXPORT vtkPickingManager : public vtkObject
86 {
87 public:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
93 
98  vtkBooleanMacro(Enabled, bool);
99  vtkSetMacro(Enabled, bool);
100  vtkGetMacro(Enabled, bool);
102 
104 
113  void SetOptimizeOnInteractorEvents(bool optimize);
114  vtkGetMacro(OptimizeOnInteractorEvents, bool);
116 
118 
122  vtkGetMacro(Interactor, vtkRenderWindowInteractor*);
124 
132  void AddPicker(vtkAbstractPicker* picker, vtkObject* object = nullptr);
133 
138  void RemovePicker(vtkAbstractPicker* picker, vtkObject* object = nullptr);
139 
145  void RemoveObject(vtkObject* object);
146 
153  bool Pick(vtkAbstractPicker* picker, vtkObject* object);
154 
160  bool Pick(vtkObject* object);
161 
167  bool Pick(vtkAbstractPicker* picker);
168 
176  vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z,
177  vtkAbstractPropPicker* picker,
178  vtkRenderer* renderer,
179  vtkObject* obj);
180 
187 
193 
194 protected:
196  ~vtkPickingManager() override;
197 
198  // Used to associate the manager with the interactor
200  bool Enabled;
202 
203 private:
204  vtkPickingManager(const vtkPickingManager&) = delete;
205  void operator=(const vtkPickingManager&) = delete;
206 
207  class vtkInternal;
208  vtkInternal* Internal;
209 };
210 
211 #endif
vtkPickingManager::GetNumberOfPickers
int GetNumberOfPickers()
Return the number of pickers registered.
vtkPickingManager::GetAssemblyPath
vtkAssemblyPath * GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker *picker, vtkRenderer *renderer, vtkObject *obj)
If the picking manager is enabled, it runs the picking selection process and return the assembly path...
vtkPickingManager::Enabled
bool Enabled
Definition: vtkPickingManager.h:200
vtkPickingManager::SetOptimizeOnInteractorEvents
void SetOptimizeOnInteractorEvents(bool optimize)
Enable/Disable optimization depending on the renderWindowInteractor events.
vtkPickingManager::Pick
bool Pick(vtkAbstractPicker *picker, vtkObject *object)
Run the picking selection process and return true if the object is associated with the given picker i...
vtkPickingManager::vtkPickingManager
vtkPickingManager()
vtkPickingManager::RemoveObject
void RemoveObject(vtkObject *object)
Remove all occurrence of the object from the registered list.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkAbstractPicker
define API for picking subclasses
Definition: vtkAbstractPicker.h:69
vtkAssemblyPath
a list of nodes that form an assembly path
Definition: vtkAssemblyPath.h:45
vtkPickingManager::AddPicker
void AddPicker(vtkAbstractPicker *picker, vtkObject *object=nullptr)
Register a picker into the picking manager.
vtkPickingManager::SetInteractor
void SetInteractor(vtkRenderWindowInteractor *iren)
Set the window interactor associated with the manager.
vtkPickingManager::OptimizeOnInteractorEvents
bool OptimizeOnInteractorEvents
Definition: vtkPickingManager.h:201
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkPickingManager::Pick
bool Pick(vtkAbstractPicker *picker)
Run the picking selection process and return if picker is the one selected.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:79
vtkPickingManager::New
static vtkPickingManager * New()
vtkPickingManager::Interactor
vtkRenderWindowInteractor * Interactor
Definition: vtkPickingManager.h:199
vtkAbstractPropPicker
abstract API for pickers that can pick an instance of vtkProp
Definition: vtkAbstractPropPicker.h:80
vtkObject.h
vtkPickingManager::Pick
bool Pick(vtkObject *object)
Run the picking selection process and return true if the object is associated with the best picker.
vtkPickingManager::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkPickingManager::~vtkPickingManager
~vtkPickingManager() override
vtkPickingManager::RemovePicker
void RemovePicker(vtkAbstractPicker *picker, vtkObject *object=nullptr)
Unregister the picker from the picking manager.
vtkPickingManager::GetNumberOfObjectsLinked
int GetNumberOfObjectsLinked(vtkAbstractPicker *picker)
Return the number of objects linked with a given picker.
vtkPickingManager
Definition: vtkPickingManager.h:86