VTK  9.0.1
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 =========================================================================*/
20 #ifndef vtkOpenVRInteractorStyle_h
21 #define vtkOpenVRInteractorStyle_h
22 
23 #include "vtkRenderingOpenVRModule.h" // For export macro
24 
25 #include "vtkEventData.h" // for enums
26 #include "vtkInteractorStyle3D.h"
27 #include "vtkNew.h" // for ivars
28 #include "vtkOpenVRRenderWindow.h" // for enums
29 
30 class vtkCell;
31 class vtkPlane;
36 class vtkTextActor3D;
37 class vtkSelection;
38 class vtkSphereSource;
39 
40 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRInteractorStyle : public vtkInteractorStyle3D
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
51  void OnButton3D(vtkEventData* edata) override;
52  void OnMove3D(vtkEventData* edata) override;
54 
56 
60  virtual void EndPick(vtkEventDataDevice3D*);
66  virtual void EndClip(vtkEventDataDevice3D*);
70 
72 
75  void OnPan() override;
76  void OnPinch() override;
77  void OnRotate() override;
79 
81 
84  void ProbeData(vtkEventDataDevice controller);
86  virtual void PositionProp(vtkEventData*);
87  virtual void Clip(vtkEventDataDevice3D*);
89 
91 
98 
100 
104  vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string& text);
106 
108 
113  vtkSetMacro(HoverPick, bool);
114  vtkGetMacro(HoverPick, bool);
115  vtkBooleanMacro(HoverPick, bool);
117 
119 
122  vtkSetMacro(GrabWithRay, bool);
123  vtkGetMacro(GrabWithRay, bool);
124  vtkBooleanMacro(GrabWithRay, bool);
126 
128  {
129  return this->InteractionState[static_cast<int>(device)];
130  }
131 
132  void ShowRay(vtkEventDataDevice controller);
133  void HideRay(vtkEventDataDevice controller);
134 
135  void ShowBillboard(const std::string& text);
137 
138  void ShowPickSphere(double* pos, double radius, vtkProp3D*);
141 
143  void SetDrawControls(bool);
144 
146 
147  // allow the user to add options to the menu
148  vtkOpenVRMenuWidget* GetMenu() { return this->Menu.Get(); }
149 
150 protected:
153 
155 
156  // Ray drawing
157  void UpdateRay(vtkEventDataDevice controller);
158 
162  static void MenuCallback(
163  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
164 
168 
169  // device input to interaction state mapping
172 
173  // Utility routines
174  void StartAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
175  void EndAction(int VTKIS_STATE, vtkEventDataDevice3D* edata);
176 
177  // Pick using hardware selector
178  bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly);
179 
180  bool HoverPick;
182 
186  int InteractionState[vtkEventDataNumberOfDevices];
189 
191 
196 
197 private:
198  vtkOpenVRInteractorStyle(const vtkOpenVRInteractorStyle&) = delete; // Not implemented.
199  void operator=(const vtkOpenVRInteractorStyle&) = delete; // Not implemented.
200 };
201 
202 #endif
vtkPlane
perform various plane computations
Definition: vtkPlane.h:32
vtkOpenVRInteractorStyle::MapInputToAction
void MapInputToAction(vtkEventDataDevice device, vtkEventDataDeviceInput input, int state)
Map controller inputs to actions.
vtkOpenVRInteractorStyle::SetInteractor
void SetInteractor(vtkRenderWindowInteractor *iren) override
Set/Get the Interactor wrapper being controlled by this object.
vtkOpenVRRenderWindow.h
vtkEventData
Definition: vtkEventData.h:66
vtkEventDataDeviceInput
vtkEventDataDeviceInput
Definition: vtkEventData.h:39
vtkOpenVRInteractorStyle::GetMenu
vtkOpenVRMenuWidget * GetMenu()
Definition: vtkOpenVRInteractorStyle.h:148
vtkInteractorStyle3D.h
vtkEventDataDevice3D
Definition: vtkEventData.h:146
vtkOpenVRInteractorStyle::Clip
virtual void Clip(vtkEventDataDevice3D *)
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
vtkOpenVRInteractorStyle::EndDolly3D
virtual void EndDolly3D(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::StartPositionProp
virtual void StartPositionProp(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::HidePickActor
void HidePickActor()
vtkOpenVRInteractorStyle::GetInteractionState
int GetInteractionState(vtkEventDataDevice device)
Definition: vtkOpenVRInteractorStyle.h:127
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:45
vtkOpenVRInteractorStyle::OnButton3D
void OnButton3D(vtkEventData *edata) override
Override generic event bindings to call the corresponding action.
vtkOpenVRControlsHelper
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller.
Definition: vtkOpenVRControlsHelper.h:49
vtkOpenVRInteractorStyle::PickActor
vtkNew< vtkActor > PickActor
Definition: vtkOpenVRInteractorStyle.h:166
vtkOpenVRInteractorStyle::StartDolly3D
virtual void StartDolly3D(vtkEventDataDevice3D *)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:54
vtkOpenVRInteractorStyle::EndPositionProp
virtual void EndPositionProp(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::AddTooltipForInput
void AddTooltipForInput(vtkEventDataDevice device, vtkEventDataDeviceInput input)
Controls helpers drawing.
vtkEventDataNumberOfInputs
const int vtkEventDataNumberOfInputs
Definition: vtkEventData.h:49
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:58
vtkOpenVRInteractorStyle::HoverPick
bool HoverPick
Definition: vtkOpenVRInteractorStyle.h:180
vtkOpenVRInteractorStyle::StartAction
void StartAction(int VTKIS_STATE, vtkEventDataDevice3D *edata)
vtkOpenVRInteractorStyle::ShowPickSphere
void ShowPickSphere(double *pos, double radius, vtkProp3D *)
vtkOpenVRInteractorStyle::LoadNextCameraPose
void LoadNextCameraPose()
vtkOpenVRInteractorStyle::ShowRay
void ShowRay(vtkEventDataDevice controller)
vtkOpenVRHardwarePicker
pick an actor/prop given a controller position and orientation
Definition: vtkOpenVRHardwarePicker.h:35
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.
vtkOpenVRInteractorStyle::Sphere
vtkNew< vtkSphereSource > Sphere
Definition: vtkOpenVRInteractorStyle.h:167
vtkOpenVRInteractorStyle::EndClip
virtual void EndClip(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::New
static vtkOpenVRInteractorStyle * New()
vtkOpenVRInteractorStyle::OnPan
void OnPan() override
Multitouch events binding.
vtkEventDataNumberOfDevices
const int vtkEventDataNumberOfDevices
Definition: vtkEventData.h:35
vtkOpenVRInteractorStyle::EndLoadCamPose
virtual void EndLoadCamPose(vtkEventDataDevice3D *)
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:41
vtkOpenVRInteractorStyle::SetDrawControls
void SetDrawControls(bool)
vtkOpenVRInteractorStyle::ProbeData
void ProbeData(vtkEventDataDevice controller)
Methods for intertaction.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:57
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
vtkOpenVRInteractorStyle::~vtkOpenVRInteractorStyle
~vtkOpenVRInteractorStyle() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkOpenVRInteractorStyle::UpdateRay
void UpdateRay(vtkEventDataDevice controller)
vtkOpenVRInteractorStyle::vtkOpenVRInteractorStyle
vtkOpenVRInteractorStyle()
vtkEventData.h
vtkNew< vtkOpenVRMenuWidget >
vtkOpenVRInteractorStyle::AddTooltipForInput
void AddTooltipForInput(vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string &text)
Define the helper text that goes with an input.
vtkOpenVRInteractorStyle::EndPick
virtual void EndPick(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::StartLoadCamPose
virtual void StartLoadCamPose(vtkEventDataDevice3D *)
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:74
vtkOpenVRInteractorStyle::Menu
vtkNew< vtkOpenVRMenuWidget > Menu
Definition: vtkOpenVRInteractorStyle.h:159
vtkOpenVRInteractorStyle::StartClip
virtual void StartClip(vtkEventDataDevice3D *)
vtkOpenVRInteractorStyle::MenuRepresentation
vtkNew< vtkOpenVRMenuRepresentation > MenuRepresentation
Definition: vtkOpenVRInteractorStyle.h:160
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:165
vtkOpenVRInteractorStyle::ToggleDrawControls
void ToggleDrawControls()
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26
vtkNew.h
vtkOpenVRInteractorStyle
extended from vtkInteractorStyle3D to override command methods
Definition: vtkOpenVRInteractorStyle.h:41
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:45
vtkOpenVRInteractorStyle::ShowBillboard
void ShowBillboard(const std::string &text)
vtkOpenVRInteractorStyle::HardwareSelect
bool HardwareSelect(vtkEventDataDevice controller, bool actorPassOnly)
vtkOpenVRInteractorStyle::ShowPickCell
void ShowPickCell(vtkCell *cell, vtkProp3D *)
vtkOpenVRInteractorStyle::HardwarePicker
vtkNew< vtkOpenVRHardwarePicker > HardwarePicker
Definition: vtkOpenVRInteractorStyle.h:190
vtkOpenVRInteractorStyle::EndPickCallback
void EndPickCallback(vtkSelection *sel)
vtkOpenVRMenuWidget
3D widget to display a menu in VR
Definition: vtkOpenVRMenuWidget.h:36
vtkOpenVRInteractorStyle::StartPick
virtual void StartPick(vtkEventDataDevice3D *)
Interaction mode entry points.
vtkOpenVRInteractorStyle::GrabWithRay
bool GrabWithRay
Definition: vtkOpenVRInteractorStyle.h:181
vtkOpenVRInteractorStyle::PositionProp
virtual void PositionProp(vtkEventData *)
vtkX3D::radius
@ radius
Definition: vtkX3D.h:258
vtkOpenVRMenuRepresentation
Widget representation for vtkOpenVRPanelWidget Implementation of the popup panel representation for t...
Definition: vtkOpenVRMenuRepresentation.h:44
vtkOpenVRInteractorStyle::MenuCommand
vtkCallbackCommand * MenuCommand
Definition: vtkOpenVRInteractorStyle.h:161
vtkOpenVRInteractorStyle::OnMove3D
void OnMove3D(vtkEventData *edata) override
Generic 3D event bindings can be overridden in subclasses.
vtkOpenVRInteractorStyle::OnPinch
void OnPinch() override