VTK  9.3.20240914
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
30#ifndef vtkZSpaceInteractorStyle_h
31#define vtkZSpaceInteractorStyle_h
32
33#include "vtkDataObject.h" // for vtkDataObject enums
34#include "vtkEventData.h" // for enums
36#include "vtkNew.h" // for ivar
37#include "vtkRenderingZSpaceModule.h" // for export macro
38
39VTK_ABI_NAMESPACE_BEGIN
40
41class vtkCell;
42class vtkPlane;
43class vtkSelection;
44class vtkDataSet;
45class vtkTextActor;
48
49class VTKRENDERINGZSPACE_EXPORT vtkZSpaceInteractorStyle : public vtkInteractorStyle3D
50{
51public:
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
57
60 void OnPick3D(vtkEventData* edata) override;
61 void OnPositionProp3D(vtkEventData* edata) override;
62 void OnMove3D(vtkEventData* edata) override;
63 void OnSelect3D(vtkEventData* edata) override;
65
67
75
77
81 virtual void PositionProp(vtkEventData*, double* lwpos = nullptr, double* lwori = nullptr);
83
85
90 vtkSetMacro(HoverPick, bool);
91 vtkGetMacro(HoverPick, bool);
92 vtkBooleanMacro(HoverPick, bool);
94
101
105 vtkSetMacro(ZSpaceRayActor, vtkZSpaceRayActor*);
106
108
112 vtkSetClampMacro(PickingFieldAssociation, int, vtkDataObject::FIELD_ASSOCIATION_POINTS,
114 vtkGetMacro(PickingFieldAssociation, int);
116
117protected:
119 ~vtkZSpaceInteractorStyle() override = default;
120
127
129
132 void StartAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
133 void EndAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
135
141 bool HardwareSelect(vtkEventDataDevice3D* edd, bool actorPassOnly);
142
147
152 std::string GetPickedText(vtkDataSet* ds, const vtkIdType& aid);
153
158
162 void CreatePickPoint(double* point);
163
169
174
183 bool HoverPick = false;
184
185 // Used to draw picked cells or points
187 // XXX Very good chance we can swap it with this->InteractionProp
188 // The text actor is linked to this prop
189 vtkProp3D* PickedInteractionProp = nullptr;
192
193 // Used to do the actual picking action (not the interactive picking).
195
196 // The field association used when picking with the ray
197 int PickingFieldAssociation = vtkDataObject::FIELD_ASSOCIATION_CELLS;
198
199private:
201 void operator=(const vtkZSpaceInteractorStyle&) = delete;
202};
203
204VTK_ABI_NAMESPACE_END
205
206#endif
abstract class to specify cell behavior
Definition vtkCell.h:130
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
a simple class to control print indentation
Definition vtkIndent.h:108
extends interaction to support 3D input
Allocate and hold a VTK object.
Definition vtkNew.h:167
perform various plane computations
Definition vtkPlane.h:138
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
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 information about the point or cell defined by the index 'aid' in the d...
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