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 
33 class vtkActor;
34 class vtkProperty;
35 class vtkPolyData;
36 class vtkPolyDataMapper;
37 class vtkCellArray;
38 class vtkPoints;
39 class vtkTextActor3D;
40 
41 class vtkLineSource;
42 class vtkPolyDataMapper;
43 class vtkRenderer;
44 class vtkCallbackCommand;
45 
46 
47 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRControlsHelper : public vtkProp
48 {
49 public:
53  static vtkOpenVRControlsHelper *New();
54 
56 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
63  enum ButtonSides {
64  Back = -1,
65  Front = 1
66  };
67 
68  enum DrawSides {
69  Left = -1,
70  Right = 1
71  };
72 
74 
77  void BuildRepresentation();
78  void UpdateRepresentation(vtkEventDataDevice3D *);
80 
82 
85  void ReleaseGraphicsResources(vtkWindow*) override;
86  int RenderOpaqueGeometry(vtkViewport*) override;
88  int HasTranslucentPolygonalGeometry() override;
90 
92 
95  void SetText(vtkStdString str);
97 
98  void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char *txt)
99  {
100  if (!s || !txt)
101  {
102  return;
103  }
104  this->ComponentName = vtkStdString(s);
105  this->DrawSide = drawSide;
106  this->ButtonSide = buttonSide;
107  this->SetText(vtkStdString(txt));
108  }
109 
110  void SetEnabled(bool enabled);
111  vtkGetMacro(Enabled, bool);
112  vtkBooleanMacro(Enabled, bool);
113 
114  void SetDevice(vtkEventDataDevice val);
115 
116  virtual void SetRenderer(vtkRenderer *ren);
117  virtual vtkRenderer* GetRenderer();
118 
119 protected:
121  ~vtkOpenVRControlsHelper() override;
122 
123 
124  double FrameSize[2];
125 
126  // The text
129 
130  // The line
134 
136 
137  //Tooltip parameters
139  int DrawSide; // Left/Right
140  int ButtonSide; // Front/Back
141 
142  bool Enabled;
143 
144  double ControlPositionLC[3];
145 
146  // The renderer in which this widget is placed
148 
150  unsigned long ObserverTag;
151  static void MoveEvent(vtkObject* object,
152  unsigned long event,
153  void* clientdata,
154  void* calldata);
155 
156  void InitControlPosition();
157 
158 private:
160  void operator=(const vtkOpenVRControlsHelper&) = delete;
161 };
162 
163 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
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:65
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:222
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:294
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:303
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:224
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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