VTK  9.3.0
vtkZSpaceInteractorStyle.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
27#ifndef vtkZSpaceInteractorStyle_h
28#define vtkZSpaceInteractorStyle_h
29
30#include "vtkDataObject.h" // for vtkDataObject enums
31#include "vtkEventData.h" // for enums
33#include "vtkNew.h" // for ivar
34#include "vtkRenderingZSpaceModule.h" // for export macro
35
36VTK_ABI_NAMESPACE_BEGIN
37
38class vtkCell;
39class vtkPlane;
40class vtkSelection;
41class vtkDataSet;
42class vtkTextActor;
45
46class VTKRENDERINGZSPACE_EXPORT vtkZSpaceInteractorStyle : public vtkInteractorStyle3D
47{
48public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
54
57 void OnPick3D(vtkEventData* edata) override;
58 void OnPositionProp3D(vtkEventData* edata) override;
59 void OnMove3D(vtkEventData* edata) override;
60 void OnSelect3D(vtkEventData* edata) override;
62
64
72
74
78 virtual void PositionProp(vtkEventData*, double* lwpos = nullptr, double* lwori = nullptr);
80
82
87 vtkSetMacro(HoverPick, bool);
88 vtkGetMacro(HoverPick, bool);
89 vtkBooleanMacro(HoverPick, bool);
91
98
102 vtkSetMacro(ZSpaceRayActor, vtkZSpaceRayActor*);
103
105
109 vtkSetClampMacro(PickingFieldAssociation, int, vtkDataObject::FIELD_ASSOCIATION_POINTS,
111 vtkGetMacro(PickingFieldAssociation, int);
113
114protected:
116 ~vtkZSpaceInteractorStyle() override = default;
117
124
126
129 void StartAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
130 void EndAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
132
138 bool HardwareSelect(vtkEventDataDevice3D* edd, bool actorPassOnly);
139
144
149 std::string GetPickedText(vtkDataSet* ds, const vtkIdType& aid);
150
155
159 void CreatePickPoint(double* point);
160
166
171
180 bool HoverPick = false;
181
182 // Used to draw picked cells or points
184 // XXX Very good chance we can swap it with this->InteractionProp
185 // The text actor is linked to this prop
186 vtkProp3D* PickedInteractionProp = nullptr;
189
190 // Used to do the actual picking action (not the interactive picking).
192
193 // The field association used when picking with the ray
194 int PickingFieldAssociation = vtkDataObject::FIELD_ASSOCIATION_CELLS;
195
196private:
198 void operator=(const vtkZSpaceInteractorStyle&) = delete;
199};
200
201VTK_ABI_NAMESPACE_END
202
203#endif
abstract class to specify cell behavior
Definition vtkCell.h:50
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
a simple class to control print indentation
Definition vtkIndent.h:29
extends interaction to support 3D input
Allocate and hold a VTK object.
Definition vtkNew.h:51
perform various plane computations
Definition vtkPlane.h:26
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:39
data object that represents a "selection" in VTK.
Hold a reference to a vtkObjectBase instance.
An actor that displays text.
Pick an actor/prop given the stylus position and orientation.
vtkZSpaceInteractorStyle extends vtkInteractorStyle3D to override command methods.
std::string GetPickedText(vtkDataSet *ds, const vtkIdType &aid)
Create a string that contains informations about the point or cell defined by the index 'aid' in the ...
void OnSelect3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
bool FindDataSet(vtkSelection *sel, vtkSmartPointer< vtkDataSet > &ds, vtkIdType &aid)
From the selection 'sel', find the corresponding dataset 'ds' and the point/cell id 'aid'.
virtual void StartPick(vtkEventDataDevice3D *)
Interaction mode entry points.
void RemovePickActor()
Remove the PickActor and the TextActor from the renderer.
void StartAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
Utility routines.
virtual void PositionProp(vtkEventData *, double *lwpos=nullptr, double *lwori=nullptr)
Methods for interaction.
void UpdatePickActor()
Update the PickActor and the TextActor depending on the PickedInteractionProp position and visibility...
void ProbeData(vtkEventDataDevice3D *)
Methods for interaction.
void OnMove3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
static vtkZSpaceInteractorStyle * New()
virtual void EndPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
void EndPickCallback(vtkSelection *sel)
Create the text to display information about the selection, create the PickActor to draw the picked c...
~vtkZSpaceInteractorStyle() override=default
void CreatePickCell(vtkCell *cell)
Create the PickActor to show the picked cell.
void EndAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
Utility routines.
void OnPositionProp3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
void UpdateRay(vtkEventDataDevice3D *)
Use FindPickedActor to update the InteractionProp.
void OnPick3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkNew< vtkZSpaceHardwarePicker > HardwarePicker
bool HardwareSelect(vtkEventDataDevice3D *edd, bool actorPassOnly)
Do a selection using the vtkZSpaceHardwarePicker.
virtual void EndPick(vtkEventDataDevice3D *)
Interaction mode entry points.
void CreatePickPoint(double *point)
Create the PickActor to show the picked point.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void StartPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
An actor for displaying a ray.
int vtkIdType
Definition vtkType.h:315