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
supports function callbacks
abstract class to specify cell behavior
Definition: vtkCell.h:58
a simple class to control print indentation
Definition: vtkIndent.h:34
extends interaction to support 3D input
abstract base class for most VTK objects
Definition: vtkObject.h:63
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.
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.
static vtkOpenVRInteractorStyle * New()
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:34
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
platform-independent render window interaction including picking and frame rate control.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:54
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