VTK  9.2.6
vtkVRControlsHelper.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: Visualization Toolkit
4Module: vtkVRControlsHelper.h
5
6Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7All rights reserved.
8See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10This software is distributed WITHOUT ANY WARRANTY; without even
11the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12PURPOSE. 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
34class vtkActor;
36class vtkLineSource;
38class vtkRenderer;
39class vtkTextActor3D;
40class vtkTransform;
41
42class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
43{
44public:
46
50 void PrintSelf(ostream& os, vtkIndent indent) override;
52
54 {
55 Back = -1,
56 Front = 1
57 };
58
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
111protected:
114
115 double FrameSize[2];
116
117 // The text
119 std::string Text;
120
121 // The line
125
127
128 // Tooltip parameters
129 std::string ComponentName;
130 int DrawSide; // Left/Right
131 int ButtonSide; // Front/Back
132
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
157private:
159 void operator=(const vtkVRControlsHelper&) = delete;
160};
161
162#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:52
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:40
create a line defined by two end points
Allocate and hold a VTK object.
Definition vtkNew.h:62
abstract base class for most VTK objects
Definition vtkObject.h:63
map vtkPolyData to graphics primitives
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:57
abstract specification for renderers
Definition vtkRenderer.h:73
An actor that displays text.
describes linear transformations via a 4x4 matrix
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.
abstract specification for Viewports
Definition vtkViewport.h:56
a weak reference to a vtkObject.
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
vtkEventDataDevice
platform-independent event data structures