VTK  9.1.0
vtkVRControlsHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkVRControlsHelper.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 vtkVRControlsHelper_h
25 #define vtkVRControlsHelper_h
26 
27 #include "vtkEventData.h" // for vtkEventDataDevice
28 #include "vtkNew.h" // for iVar
29 #include "vtkProp.h"
30 #include "vtkRenderingVRModule.h" // For export macro
31 #include "vtkWeakPointer.h" // needed for vtkWeakPointer iVar.
32 #include <string> // for std::string
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 class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
49 {
50 public:
52 
55  vtkTypeMacro(vtkVRControlsHelper, vtkProp);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60  {
61  Back = -1,
62  Front = 1
63  };
64 
65  enum DrawSides
66  {
67  Left = -1,
68  Right = 1
69  };
70 
72 
78 
80 
88 
90 
93  void SetText(const std::string& str);
95 
96  void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char* txt)
97  {
98  if (!s || !txt)
99  {
100  return;
101  }
102  this->ComponentName = std::string(s);
103  this->DrawSide = drawSide;
104  this->ButtonSide = buttonSide;
105  this->SetText(std::string(txt));
106  }
107 
108  void SetEnabled(bool enabled);
109  vtkGetMacro(Enabled, bool);
110  vtkBooleanMacro(Enabled, bool);
111 
113 
114  virtual void SetRenderer(vtkRenderer* ren);
116 
117 protected:
120 
121  double FrameSize[2];
122 
123  // The text
126 
127  // The line
131 
133 
134  // Tooltip parameters
136  int DrawSide; // Left/Right
137  int ButtonSide; // Front/Back
138 
139  bool Enabled;
140 
141  double ControlPositionLC[3];
142 
143  // The renderer in which this widget is placed
145 
147  unsigned long ObserverTag;
148  static void MoveEvent(vtkObject* object, unsigned long event, void* clientdata, void* calldata);
149 
154  virtual void InitControlPosition() = 0;
155 
157  double LastPhysicalTranslation[3];
158  double LastEventPosition[3];
159  double LastEventOrientation[4];
162 
163 private:
164  vtkVRControlsHelper(const vtkVRControlsHelper&) = delete;
165  void operator=(const vtkVRControlsHelper&) = delete;
166 };
167 
168 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
supports function callbacks
object to represent cell connectivity
Definition: vtkCellArray.h:181
a simple class to control print indentation
Definition: vtkIndent.h:34
create a line defined by two end points
Definition: vtkLineSource.h:61
abstract base class for most VTK objects
Definition: vtkObject.h:63
represent and manipulate 3D points
Definition: vtkPoints.h:34
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
represent surface properties of a geometric object
Definition: vtkProperty.h:62
abstract specification for renderers
Definition: vtkRenderer.h:73
An actor that displays text.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller.
void SetEnabled(bool enabled)
vtkTextActor3D * TextActor
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
virtual void InitControlPosition()=0
Must be overriden in subclasses to init the member variable ControlPositionLC to position the tooltip...
static void MoveEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkCallbackCommand * MoveCallbackCommand
vtkNew< vtkTransform > TempTransform
void SetTooltipInfo(const char *s, int buttonSide, int drawSide, const char *txt)
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
vtkWeakPointer< vtkRenderer > Renderer
void SetDevice(vtkEventDataDevice val)
vtkEventDataDevice Device
virtual void SetRenderer(vtkRenderer *ren)
vtkPolyDataMapper * LineMapper
void SetText(const std::string &str)
Set Tooltip text (used by TextActor)
~vtkVRControlsHelper() override
void BuildRepresentation()
Methods to interface with the vtkVRPanelWidget.
virtual vtkRenderer * GetRenderer()
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
void UpdateRepresentation()
Methods to interface with the vtkVRPanelWidget.
vtkLineSource * LineSource
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ enabled
Definition: vtkX3D.h:265
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26