VTK  9.1.0
vtkOpenVRInteractorStyle.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: Visualization Toolkit
4Module: vtkOpenVRInteractorStyle.h
5
6Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7All rights reserved.
8See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10This software is distributed WITHOUT ANY WARRANTY; without even
11the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
20#ifndef vtkOpenVRInteractorStyle_h
21#define vtkOpenVRInteractorStyle_h
22
23#include "vtkRenderingOpenVRModule.h" // For export macro
24
25#include "vtkEventData.h" // for enums
27#include "vtkNew.h" // for ivars
28#include "vtkOpenVRRenderWindow.h" // for enums
29
30class vtkCell;
31class vtkPlane;
35class vtkVRMenuWidget;
36class vtkTextActor3D;
37class vtkSelection;
38class vtkSphereSource;
39
40class VTKRENDERINGOPENVR_EXPORT vtkOpenVRInteractorStyle : public vtkInteractorStyle3D
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
51 void OnSelect3D(vtkEventData* edata) override;
52 void OnNextPose3D(vtkEventData* edata) override;
53 void OnViewerMovement3D(vtkEventData* edata) override;
54 void OnMove3D(vtkEventData* edata) override;
55 void OnMenu3D(vtkEventData* edata) override;
57
59
73
75
78 void OnPan() override;
79 void OnPinch() override;
80 void OnRotate() override;
82
84
87 void ProbeData(vtkEventDataDevice controller);
89 virtual void PositionProp(vtkEventData*, double* lwpos = nullptr, double* lwori = nullptr);
90 virtual void Clip(vtkEventDataDevice3D*);
92
94
102
104
109 vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string& text);
111
113
118 vtkSetMacro(HoverPick, bool);
119 vtkGetMacro(HoverPick, bool);
120 vtkBooleanMacro(HoverPick, bool);
122
124
127 vtkSetMacro(GrabWithRay, bool);
128 vtkGetMacro(GrabWithRay, bool);
129 vtkBooleanMacro(GrabWithRay, bool);
131
133 {
134 return this->InteractionState[static_cast<int>(device)];
135 }
136
137 void ShowRay(vtkEventDataDevice controller);
138 void HideRay(vtkEventDataDevice controller);
139
140 void ShowBillboard(const std::string& text);
142
143 void ShowPickSphere(double* pos, double radius, vtkProp3D*);
146
148 void SetDrawControls(bool);
149
151
152 // allow the user to add options to the menu
153 vtkVRMenuWidget* GetMenu() { return this->Menu.Get(); }
154
155protected:
158
160
161 // Ray drawing
163
167 static void MenuCallback(
168 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
169
173
174 // device input to interaction state mapping
175 std::map<std::tuple<vtkCommand::EventIds, vtkEventDataAction>, int> InputMap;
177
178 // Utility routines
179 void StartAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
180 void EndAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
181
182 // Pick using hardware selector
183 bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly);
184
187
191 int InteractionState[vtkEventDataNumberOfDevices];
194
196
201
202private:
204 void operator=(const vtkOpenVRInteractorStyle&) = delete;
205};
206
207#endif
supports function callbacks
abstract class to specify cell behavior
Definition: vtkCell.h:147
a simple class to control print indentation
Definition: vtkIndent.h:113
extends interaction to support 3D input
abstract base class for most VTK objects
Definition: vtkObject.h:73
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller.
extended from vtkInteractorStyle3D to override command methods
virtual void EndDolly3D(vtkEventDataDevice3D *)
Interaction mode entry points.
static void MenuCallback(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void Clip(vtkEventDataDevice3D *)
Methods for intertaction.
~vtkOpenVRInteractorStyle() override
void HideRay(vtkEventDataDevice controller)
void ShowPickCell(vtkCell *cell, vtkProp3D *)
virtual void EndPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
virtual void PositionProp(vtkEventData *, double *lwpos=nullptr, double *lwori=nullptr)
Methods for intertaction.
void AddTooltipForInput(vtkEventDataDevice device, vtkEventDataDeviceInput input)
Controls helpers drawing.
void ShowRay(vtkEventDataDevice controller)
void ProbeData(vtkEventDataDevice controller)
Methods for intertaction.
std::map< std::tuple< vtkCommand::EventIds, vtkEventDataAction >, int > InputMap
void AddTooltipForInput(vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string &text)
Define the helper text that goes with an input, deprecated as open vr mostly provides it.
void OnPinch() override
Multitouch events binding.
vtkNew< vtkVRMenuRepresentation > MenuRepresentation
vtkNew< vtkTextActor3D > TextActor3D
void OnPan() override
Multitouch events binding.
static vtkOpenVRInteractorStyle * New()
virtual void StartClip(vtkEventDataDevice3D *)
Interaction mode entry points.
void OnRotate() override
Multitouch events binding.
vtkNew< vtkVRMenuWidget > Menu
virtual void EndClip(vtkEventDataDevice3D *)
Interaction mode entry points.
virtual void StartDolly3D(vtkEventDataDevice3D *)
Interaction mode entry points.
int GetInteractionState(vtkEventDataDevice device)
void LoadNextCameraPose()
Methods for intertaction.
vtkNew< vtkVRHardwarePicker > HardwarePicker
void MapInputToAction(vtkCommand::EventIds eid, int state)
Map controller inputs to actions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void EndPick(vtkEventDataDevice3D *)
Interaction mode entry points.
void OnMove3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
void EndAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
virtual void StartLoadCamPose(vtkEventDataDevice3D *)
Interaction mode entry points.
void OnViewerMovement3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
void ShowBillboard(const std::string &text)
void OnSelect3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
virtual void EndLoadCamPose(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkNew< vtkSphereSource > Sphere
void StartAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
void OnMenu3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
void UpdateRay(vtkEventDataDevice controller)
void ShowPickSphere(double *pos, double radius, vtkProp3D *)
void SetInteractor(vtkRenderWindowInteractor *iren) override
Set/Get the Interactor wrapper being controlled by this object.
void OnNextPose3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
void MapInputToAction(vtkCommand::EventIds eid, vtkEventDataAction action, int state)
Map controller inputs to actions.
virtual void StartPick(vtkEventDataDevice3D *)
Interaction mode entry points.
virtual void StartPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly)
void EndPickCallback(vtkSelection *sel)
perform various plane computations
Definition: vtkPlane.h:143
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
platform-independent render window interaction including picking and frame rate control.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
create a polygonal sphere centered at the origin
An actor that displays text.
pick an actor/prop given a controller position and orientation
Widget representation for vtkVRMenuWidget Implementation of the popup panel representation for the vt...
3D widget to display a menu in VR
@ radius
Definition: vtkX3D.h:258
@ string
Definition: vtkX3D.h:496
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:36
vtkEventDataAction
Definition: vtkEventData.h:55
vtkEventDataDeviceInput
Definition: vtkEventData.h:40
const int vtkEventDataNumberOfInputs
Definition: vtkEventData.h:51