VTK  9.1.0
vtkOpenVRInteractorStyle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkOpenVRInteractorStyle.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 =========================================================================*/
23 #ifndef vtkOpenVRInteractorStyle_h
24 #define vtkOpenVRInteractorStyle_h
25 
26 #include "vtkRenderingOpenVRModule.h" // For export macro
27 
28 #include "vtkEventData.h" // for enums
29 #include "vtkInteractorStyle3D.h"
30 #include "vtkNew.h" // for ivars
31 #include "vtkOpenVRRenderWindow.h" // for enums
32 
33 class vtkCell;
34 class vtkPlane;
38 class vtkVRMenuWidget;
39 class vtkTextActor3D;
40 class vtkSelection;
41 class vtkSphereSource;
42 
43 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRInteractorStyle : public vtkInteractorStyle3D
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  void OnSelect3D(vtkEventData* edata) override;
55  void OnNextPose3D(vtkEventData* edata) override;
56  void OnViewerMovement3D(vtkEventData* edata) override;
57  void OnMove3D(vtkEventData* edata) override;
58  void OnMenu3D(vtkEventData* edata) override;
60 
62 
66  virtual void EndPick(vtkEventDataDevice3D*);
72  virtual void EndClip(vtkEventDataDevice3D*);
76 
78 
81  void OnPan() override;
82  void OnPinch() override;
83  void OnRotate() override;
85 
87 
90  void ProbeData(vtkEventDataDevice controller);
92  virtual void PositionProp(vtkEventData*, double* lwpos = nullptr, double* lwori = nullptr);
93  virtual void Clip(vtkEventDataDevice3D*);
95 
97 
105 
107 
112  vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string& text);
114 
116 
121  vtkSetMacro(HoverPick, bool);
122  vtkGetMacro(HoverPick, bool);
123  vtkBooleanMacro(HoverPick, bool);
125 
127 
130  vtkSetMacro(GrabWithRay, bool);
131  vtkGetMacro(GrabWithRay, bool);
132  vtkBooleanMacro(GrabWithRay, bool);
134 
136  {
137  return this->InteractionState[static_cast<int>(device)];
138  }
139 
140  void ShowRay(vtkEventDataDevice controller);
141  void HideRay(vtkEventDataDevice controller);
142 
143  void ShowBillboard(const std::string& text);
145 
146  void ShowPickSphere(double* pos, double radius, vtkProp3D*);
149 
151  void SetDrawControls(bool);
152 
154 
155  // allow the user to add options to the menu
156  vtkVRMenuWidget* GetMenu() { return this->Menu.Get(); }
157 
158 protected:
161 
163 
164  // Ray drawing
165  void UpdateRay(vtkEventDataDevice controller);
166 
170  static void MenuCallback(
171  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
172 
176 
177  // device input to interaction state mapping
178  std::map<std::tuple<vtkCommand::EventIds, vtkEventDataAction>, int> InputMap;
180 
181  // Utility routines
182  void StartAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
183  void EndAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
184 
185  // Pick using hardware selector
186  bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly);
187 
188  bool HoverPick;
190 
194  int InteractionState[vtkEventDataNumberOfDevices];
197 
199 
204 
205 private:
207  void operator=(const vtkOpenVRInteractorStyle&) = delete;
208 };
209 
210 #endif
vtkOpenVRInteractorStyle::OnSelect3D
void OnSelect3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkPlane
perform various plane computations
Definition: vtkPlane.h:143
vtkOpenVRInteractorStyle::SetInteractor
void SetInteractor(vtkRenderWindowInteractor *iren) override
Set/Get the Interactor wrapper being controlled by this object.
vtkOpenVRRenderWindow.h
vtkEventData
Definition: vtkEventData.h:69
vtkEventDataDeviceInput
vtkEventDataDeviceInput
Definition: vtkEventData.h:40
vtkInteractorStyle3D.h
vtkEventDataDevice3D
Definition: vtkEventData.h:161
vtkVRHardwarePicker
pick an actor/prop given a controller position and orientation
Definition: vtkVRHardwarePicker.h:38
vtkOpenVRInteractorStyle::Clip
virtual void Clip(vtkEventDataDevice3D *)
Methods for intertaction.
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
vtkOpenVRInteractorStyle::EndDolly3D
virtual void EndDolly3D(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::StartPositionProp
virtual void StartPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::HidePickActor
void HidePickActor()
vtkOpenVRInteractorStyle::GetInteractionState
int GetInteractionState(vtkEventDataDevice device)
Definition: vtkOpenVRInteractorStyle.h:135
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:45
vtkOpenVRInteractorStyle::PositionProp
virtual void PositionProp(vtkEventData *, double *lwpos=nullptr, double *lwori=nullptr)
Methods for intertaction.
vtkOpenVRControlsHelper
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller.
Definition: vtkOpenVRControlsHelper.h:31
vtkOpenVRInteractorStyle::GetMenu
vtkVRMenuWidget * GetMenu()
Definition: vtkOpenVRInteractorStyle.h:156
vtkOpenVRInteractorStyle::PickActor
vtkNew< vtkActor > PickActor
Definition: vtkOpenVRInteractorStyle.h:174
vtkOpenVRInteractorStyle::StartDolly3D
virtual void StartDolly3D(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkOpenVRInteractorStyle::EndPositionProp
virtual void EndPositionProp(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::AddTooltipForInput
void AddTooltipForInput(vtkEventDataDevice device, vtkEventDataDeviceInput input)
Controls helpers drawing.
vtkEventDataNumberOfInputs
const int vtkEventDataNumberOfInputs
Definition: vtkEventData.h:51
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
vtkOpenVRInteractorStyle::MapInputToAction
void MapInputToAction(vtkCommand::EventIds eid, int state)
Map controller inputs to actions.
vtkOpenVRInteractorStyle::HoverPick
bool HoverPick
Definition: vtkOpenVRInteractorStyle.h:188
vtkOpenVRInteractorStyle::StartAction
void StartAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
vtkOpenVRInteractorStyle::ShowPickSphere
void ShowPickSphere(double *pos, double radius, vtkProp3D *)
vtkOpenVRInteractorStyle::LoadNextCameraPose
void LoadNextCameraPose()
Methods for intertaction.
vtkOpenVRInteractorStyle::ShowRay
void ShowRay(vtkEventDataDevice controller)
vtkOpenVRInteractorStyle::Menu
vtkNew< vtkVRMenuWidget > Menu
Definition: vtkOpenVRInteractorStyle.h:167
vtkOpenVRInteractorStyle::HideBillboard
void HideBillboard()
vtkOpenVRInteractorStyle::HideRay
void HideRay(vtkEventDataDevice controller)
vtkOpenVRInteractorStyle::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEventDataAction
vtkEventDataAction
Definition: vtkEventData.h:55
vtkOpenVRInteractorStyle::Sphere
vtkNew< vtkSphereSource > Sphere
Definition: vtkOpenVRInteractorStyle.h:175
vtkOpenVRInteractorStyle::EndClip
virtual void EndClip(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkVRMenuRepresentation
Widget representation for vtkVRMenuWidget Implementation of the popup panel representation for the vt...
Definition: vtkVRMenuRepresentation.h:44
vtkOpenVRInteractorStyle::New
static vtkOpenVRInteractorStyle * New()
vtkOpenVRInteractorStyle::InputMap
std::map< std::tuple< vtkCommand::EventIds, vtkEventDataAction >, int > InputMap
Definition: vtkOpenVRInteractorStyle.h:178
vtkOpenVRInteractorStyle::OnNextPose3D
void OnNextPose3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkOpenVRInteractorStyle::OnPan
void OnPan() override
Multitouch events binding.
vtkEventDataNumberOfDevices
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:36
vtkOpenVRInteractorStyle::EndLoadCamPose
virtual void EndLoadCamPose(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:149
vtkOpenVRInteractorStyle::SetDrawControls
void SetDrawControls(bool)
vtkOpenVRInteractorStyle::ProbeData
void ProbeData(vtkEventDataDevice controller)
Methods for intertaction.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:147
vtkOpenVRInteractorStyle::EndAction
void EndAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
vtkOpenVRInteractorStyle::MenuCallback
static void MenuCallback(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkOpenVRInteractorStyle::OnRotate
void OnRotate() override
Multitouch events binding.
vtkOpenVRInteractorStyle::~vtkOpenVRInteractorStyle
~vtkOpenVRInteractorStyle() override
vtkOpenVRInteractorStyle::MapInputToAction
void MapInputToAction(vtkCommand::EventIds eid, vtkEventDataAction action, int state)
Map controller inputs to actions.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkOpenVRInteractorStyle::UpdateRay
void UpdateRay(vtkEventDataDevice controller)
vtkOpenVRInteractorStyle::vtkOpenVRInteractorStyle
vtkOpenVRInteractorStyle()
vtkEventData.h
vtkNew< vtkVRMenuWidget >
vtkOpenVRInteractorStyle::AddTooltipForInput
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.
vtkOpenVRInteractorStyle::EndPick
virtual void EndPick(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::StartLoadCamPose
virtual void StartLoadCamPose(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkOpenVRInteractorStyle::StartClip
virtual void StartClip(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::OnViewerMovement3D
void OnViewerMovement3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkInteractorStyle3D
extends interaction to support 3D input
Definition: vtkInteractorStyle3D.h:67
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkOpenVRInteractorStyle::TextActor3D
vtkNew< vtkTextActor3D > TextActor3D
Definition: vtkOpenVRInteractorStyle.h:173
vtkOpenVRInteractorStyle::ToggleDrawControls
void ToggleDrawControls()
vtkOpenVRInteractorStyle::OnMenu3D
void OnMenu3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26
vtkVRMenuWidget
3D widget to display a menu in VR
Definition: vtkVRMenuWidget.h:36
vtkNew.h
vtkOpenVRInteractorStyle
extended from vtkInteractorStyle3D to override command methods
Definition: vtkOpenVRInteractorStyle.h:44
vtkCommand::EventIds
EventIds
Definition: vtkCommand.h:461
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:154
vtkOpenVRInteractorStyle::ShowBillboard
void ShowBillboard(const std::string &text)
vtkOpenVRInteractorStyle::HardwarePicker
vtkNew< vtkVRHardwarePicker > HardwarePicker
Definition: vtkOpenVRInteractorStyle.h:198
vtkOpenVRInteractorStyle::HardwareSelect
bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly)
vtkOpenVRInteractorStyle::ShowPickCell
void ShowPickCell(vtkCell *cell, vtkProp3D *)
vtkOpenVRInteractorStyle::EndPickCallback
void EndPickCallback(vtkSelection *sel)
vtkOpenVRInteractorStyle::StartPick
virtual void StartPick(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::GrabWithRay
bool GrabWithRay
Definition: vtkOpenVRInteractorStyle.h:189
vtkX3D::radius
@ radius
Definition: vtkX3D.h:258
vtkOpenVRInteractorStyle::MenuCommand
vtkCallbackCommand * MenuCommand
Definition: vtkOpenVRInteractorStyle.h:169
vtkOpenVRInteractorStyle::MenuRepresentation
vtkNew< vtkVRMenuRepresentation > MenuRepresentation
Definition: vtkOpenVRInteractorStyle.h:168
vtkOpenVRInteractorStyle::OnMove3D
void OnMove3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkOpenVRInteractorStyle::OnPinch
void OnPinch() override
Multitouch events binding.