VTK
vtkOpenVRControlsHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkOpenVRControlsHelper.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 =========================================================================*/
24 #ifndef vtkOpenVRControlsHelper_h
25 #define vtkOpenVRControlsHelper_h
26 
27 #include "vtkRenderingOpenVRModule.h" // For export macro
28 #include "vtkProp.h"
29 #include "vtkStdString.h" // needed for vtkStdString iVar.
30 #include "vtkWeakPointer.h" // needed for vtkWeakPointer iVar.
31 #include "vtkEventData.h" // for enums
32 #include "vtkNew.h" // for iVar
33 
34 class vtkActor;
35 class vtkProperty;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkCellArray;
39 class vtkPoints;
40 class vtkTextActor3D;
41 class vtkTransform;
42 
43 class vtkLineSource;
44 class vtkPolyDataMapper;
45 class vtkRenderer;
46 class vtkCallbackCommand;
47 
48 
49 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRControlsHelper : public vtkProp
50 {
51 public:
55  static vtkOpenVRControlsHelper *New();
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
65  enum ButtonSides {
66  Back = -1,
67  Front = 1
68  };
69 
70  enum DrawSides {
71  Left = -1,
72  Right = 1
73  };
74 
76 
79  void BuildRepresentation();
80  void UpdateRepresentation();
82 
84 
87  void ReleaseGraphicsResources(vtkWindow*) override;
88  int RenderOpaqueGeometry(vtkViewport*) override;
92 
94 
97  void SetText(vtkStdString str);
99 
100  void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char *txt)
101  {
102  if (!s || !txt)
103  {
104  return;
105  }
106  this->ComponentName = vtkStdString(s);
107  this->DrawSide = drawSide;
108  this->ButtonSide = buttonSide;
109  this->SetText(vtkStdString(txt));
110  }
111 
112  void SetEnabled(bool enabled);
113  vtkGetMacro(Enabled, bool);
114  vtkBooleanMacro(Enabled, bool);
115 
116  void SetDevice(vtkEventDataDevice val);
117 
118  virtual void SetRenderer(vtkRenderer *ren);
119  virtual vtkRenderer* GetRenderer();
120 
121 protected:
123  ~vtkOpenVRControlsHelper() override;
124 
125 
126  double FrameSize[2];
127 
128  // The text
131 
132  // The line
136 
138 
139  //Tooltip parameters
141  int DrawSide; // Left/Right
142  int ButtonSide; // Front/Back
143 
144  bool Enabled;
145 
146  double ControlPositionLC[3];
147 
148  // The renderer in which this widget is placed
150 
152  unsigned long ObserverTag;
153  static void MoveEvent(vtkObject* object,
154  unsigned long event,
155  void* clientdata,
156  void* calldata);
157 
158  void InitControlPosition();
159 
161  double LastPhysicalTranslation[3];
162  double LastEventPosition[3];
163  double LastEventOrientation[4];
166 
167 private:
169  void operator=(const vtkOpenVRControlsHelper&) = delete;
170 };
171 
172 #endif
vtkNew< vtkTransform > TempTransform
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkWeakPointer< vtkRenderer > Renderer
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract base class for most VTK objects
Definition: vtkObject.h:59
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:66
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:224
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:296
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
int vtkTypeBool
Definition: vtkABI.h:69
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:305
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkCallbackCommand * MoveCallbackCommand
supports function callbacks
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:25
An actor that displays text.
create a line defined by two end points
Definition: vtkLineSource.h:42
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:50
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:226
void SetTooltipInfo(const char *s, int buttonSide, int drawSide, const char *txt)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller...
represent and manipulate 3D points
Definition: vtkPoints.h:39