VTK  9.2.5
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 vtkCallbackCommand;
36 class vtkLineSource;
37 class vtkPolyDataMapper;
38 class vtkRenderer;
39 class vtkTextActor3D;
40 class vtkTransform;
41 
42 class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
43 {
44 public:
46 
49  vtkTypeMacro(vtkVRControlsHelper, vtkProp);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54  {
55  Back = -1,
56  Front = 1
57  };
58 
59  enum DrawSides
60  {
61  Left = -1,
62  Right = 1
63  };
64 
66 
72 
74 
82 
84 
87  void SetText(const std::string& str);
89 
90  void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char* txt)
91  {
92  if (!s || !txt)
93  {
94  return;
95  }
96  this->ComponentName = std::string(s);
97  this->DrawSide = drawSide;
98  this->ButtonSide = buttonSide;
99  this->SetText(std::string(txt));
100  }
101 
102  void SetEnabled(bool enabled);
103  vtkGetMacro(Enabled, bool);
104  vtkBooleanMacro(Enabled, bool);
105 
107 
108  virtual void SetRenderer(vtkRenderer* ren);
110 
111 protected:
114 
115  double FrameSize[2];
116 
117  // The text
120 
121  // The line
125 
127 
128  // Tooltip parameters
130  int DrawSide; // Left/Right
131  int ButtonSide; // Front/Back
132 
133  bool Enabled;
134 
135  double ControlPositionLC[3];
136 
137  // The renderer in which this widget is placed
139 
141  unsigned long ObserverTag;
142  static void MoveEvent(vtkObject* object, unsigned long event, void* clientdata, void* calldata);
143 
148  virtual void InitControlPosition() = 0;
149 
151  double LastPhysicalTranslation[3];
152  double LastEventPosition[3];
153  double LastEventOrientation[4];
156 
157 private:
158  vtkVRControlsHelper(const vtkVRControlsHelper&) = delete;
159  void operator=(const vtkVRControlsHelper&) = delete;
160 };
161 
162 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:119
create a line defined by two end points
abstract base class for most VTK objects
Definition: vtkObject.h:82
map vtkPolyData to graphics primitives
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
abstract specification for renderers
Definition: vtkRenderer.h:182
An actor that displays text.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
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 overridden in subclasses to init the member variable ControlPositionLC to position the toolti...
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:56
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