VTK: Rendering/ZSpace/vtkZSpaceInteractorStyle.h Source File

| VTK 9.3.1

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
35 #include "vtkInteractorStyle3D.h"
36 #include "vtkNew.h" // for ivar
37 #include "vtkRenderingZSpaceModule.h" // for export macro
38
39 VTK_ABI_NAMESPACE_BEGIN
40
41 class vtkCell;
42 class vtkPlane;
43 class vtkSelection;
44 class vtkDataSet;
45 class vtkTextActor;
46 class vtkZSpaceRayActor;
47 class vtkZSpaceHardwarePicker;
48
49 class VTKRENDERINGZSPACE_EXPORT vtkZSpaceInteractorStyle : public vtkInteractorStyle3D
50 {
51 public:
52 static vtkZSpaceInteractorStyle* New();
53 vtkTypeMacro(vtkZSpaceInteractorStyle, vtkInteractorStyle3D);
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
70 virtual void StartPick(vtkEventDataDevice3D*);
71 virtual void EndPick(vtkEventDataDevice3D*);
72 virtual void StartPositionProp(vtkEventDataDevice3D*);
73 virtual void EndPositionProp(vtkEventDataDevice3D*);
75
77
80 void ProbeData(vtkEventDataDevice3D*);
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
100 void UpdateRay(vtkEventDataDevice3D*);
101
105 vtkSetMacro(ZSpaceRayActor, vtkZSpaceRayActor*);
106
108
112 vtkSetClampMacro(PickingFieldAssociation, int, vtkDataObject::FIELD_ASSOCIATION_POINTS,
113 vtkDataObject::FIELD_ASSOCIATION_CELLS);
114 vtkGetMacro(PickingFieldAssociation, int);
116
117 protected:
118 vtkZSpaceInteractorStyle();
119 ~vtkZSpaceInteractorStyle() override = default;
120
126 void EndPickCallback(vtkSelection* sel);
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
146 bool FindDataSet(vtkSelection* sel, vtkSmartPointer<vtkDataSet>& ds, vtkIdType& aid);
147
152 std::string GetPickedText(vtkDataSet* ds, const vtkIdType& aid);
153
157 void CreatePickCell(vtkCell* cell);
158
162 void CreatePickPoint(double* point);
163
168 void UpdatePickActor();
169
173 void RemovePickActor();
174
183 bool HoverPick = false;
184
185 // Used to draw picked cells or points
186 vtkNew<vtkActor> PickActor;
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;
190 vtkNew<vtkTextActor> TextActor;
191 vtkZSpaceRayActor* ZSpaceRayActor;
192
193 // Used to do the actual picking action (not the interactive picking).
194 vtkNew<vtkZSpaceHardwarePicker> HardwarePicker;
195
196 // The field association used when picking with the ray
197 int PickingFieldAssociation = vtkDataObject::FIELD_ASSOCIATION_CELLS;
198
199 private:
200 vtkZSpaceInteractorStyle(const vtkZSpaceInteractorStyle&) = delete;
201 void operator=(const vtkZSpaceInteractorStyle&) = delete;
202 };
203
204 VTK_ABI_NAMESPACE_END
205
206 #endif
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkDataObject::FIELD_ASSOCIATION_POINTS
@ FIELD_ASSOCIATION_POINTS
Definition: vtkDataObject.h:262
vtkDataObject::FIELD_ASSOCIATION_CELLS
@ FIELD_ASSOCIATION_CELLS
Definition: vtkDataObject.h:263
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkEventDataDevice3D
Definition: vtkEventData.h:150
vtkEventData
Definition: vtkEventData.h:58
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInteractorStyle3D
extends interaction to support 3D input
Definition: vtkInteractorStyle3D.h:56
vtkNew< vtkActor >
vtkPlane
perform various plane computations
Definition: vtkPlane.h:35
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:48
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:59
vtkSmartPointer< vtkDataSet >
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:55
vtkZSpaceHardwarePicker
Pick an actor/prop given the stylus position and orientation.
Definition: vtkZSpaceHardwarePicker.h:34
vtkZSpaceInteractorStyle
vtkZSpaceInteractorStyle extends vtkInteractorStyle3D to override command methods.
Definition: vtkZSpaceInteractorStyle.h:50
vtkZSpaceInteractorStyle::GetPickedText
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 ...
vtkZSpaceInteractorStyle::OnSelect3D
void OnSelect3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkZSpaceInteractorStyle::FindDataSet
bool FindDataSet(vtkSelection *sel, vtkSmartPointer< vtkDataSet > &ds, vtkIdType &aid)
From the selection 'sel', find the corresponding dataset 'ds' and the point/cell id 'aid'.
vtkZSpaceInteractorStyle::StartPick
virtual void StartPick(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkZSpaceInteractorStyle::RemovePickActor
void RemovePickActor()
Remove the PickActor and the TextActor from the renderer.
vtkZSpaceInteractorStyle::StartAction
void StartAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
Utility routines.
vtkZSpaceInteractorStyle::PositionProp
virtual void PositionProp(vtkEventData *, double *lwpos=nullptr, double *lwori=nullptr)
Methods for interaction.
vtkZSpaceInteractorStyle::UpdatePickActor
void UpdatePickActor()
Update the PickActor and the TextActor depending on the PickedInteractionProp position and visibility...
vtkZSpaceInteractorStyle::ProbeData
void ProbeData(vtkEventDataDevice3D *)
Methods for interaction.
vtkZSpaceInteractorStyle::vtkZSpaceInteractorStyle
vtkZSpaceInteractorStyle()
vtkZSpaceInteractorStyle::OnMove3D
void OnMove3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkZSpaceInteractorStyle::TextActor
vtkNew< vtkTextActor > TextActor
Definition: vtkZSpaceInteractorStyle.h:190
vtkZSpaceInteractorStyle::EndPositionProp
virtual void EndPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkZSpaceInteractorStyle::EndPickCallback
void EndPickCallback(vtkSelection *sel)
Create the text to display information about the selection, create the PickActor to draw the picked c...
vtkZSpaceInteractorStyle::~vtkZSpaceInteractorStyle
~vtkZSpaceInteractorStyle() override=default
vtkZSpaceInteractorStyle::CreatePickCell
void CreatePickCell(vtkCell *cell)
Create the PickActor to show the picked cell.
vtkZSpaceInteractorStyle::EndAction
void EndAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
Utility routines.
vtkZSpaceInteractorStyle::OnPositionProp3D
void OnPositionProp3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkZSpaceInteractorStyle::UpdateRay
void UpdateRay(vtkEventDataDevice3D *)
Use FindPickedActor to update the InteractionProp.
vtkZSpaceInteractorStyle::OnPick3D
void OnPick3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkZSpaceInteractorStyle::HardwarePicker
vtkNew< vtkZSpaceHardwarePicker > HardwarePicker
Definition: vtkZSpaceInteractorStyle.h:194
vtkZSpaceInteractorStyle::HardwareSelect
bool HardwareSelect(vtkEventDataDevice3D *edd, bool actorPassOnly)
Do a selection using the vtkZSpaceHardwarePicker.
vtkZSpaceInteractorStyle::EndPick
virtual void EndPick(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkZSpaceInteractorStyle::CreatePickPoint
void CreatePickPoint(double *point)
Create the PickActor to show the picked point.
vtkZSpaceInteractorStyle::New
static vtkZSpaceInteractorStyle * New()
vtkZSpaceInteractorStyle::ZSpaceRayActor
vtkZSpaceRayActor * ZSpaceRayActor
Definition: vtkZSpaceInteractorStyle.h:191
vtkZSpaceInteractorStyle::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkZSpaceInteractorStyle::StartPositionProp
virtual void StartPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkZSpaceInteractorStyle::PickActor
vtkNew< vtkActor > PickActor
Definition: vtkZSpaceInteractorStyle.h:186
vtkZSpaceRayActor
An actor for displaying a ray.
Definition: vtkZSpaceRayActor.h:24
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkDataObject.h
vtkEventData.h
vtkInteractorStyle3D.h
vtkNew.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315