VTK  9.4.20250207
vtkVRControlsHelper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
12#ifndef vtkVRControlsHelper_h
13#define vtkVRControlsHelper_h
14
15#include "vtkEventData.h" // for vtkEventDataDevice
16#include "vtkNew.h" // for iVar
17#include "vtkProp.h"
18#include "vtkRenderingVRModule.h" // For export macro
19#include "vtkWeakPointer.h" // needed for vtkWeakPointer iVar.
20#include <string> // for std::string
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkActor;
25class vtkLineSource;
27class vtkRenderer;
28class vtkTextActor3D;
29class vtkTransform;
30
31class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
32{
33public:
35
39 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43 {
44 Back = -1,
45 Front = 1
46 };
47
49 {
50 Left = -1,
51 Right = 1
52 };
53
55
61
63
71
73
76 void SetText(const std::string& str);
78
79 void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char* txt)
80 {
81 if (!s || !txt)
82 {
83 return;
84 }
85 this->ComponentName = std::string(s);
86 this->DrawSide = drawSide;
87 this->ButtonSide = buttonSide;
88 this->SetText(std::string(txt));
89 }
90
91 void SetEnabled(bool enabled);
92 vtkGetMacro(Enabled, bool);
93 vtkBooleanMacro(Enabled, bool);
94
96
97 virtual void SetRenderer(vtkRenderer* ren);
99
100protected:
103
104 double FrameSize[2];
105
106 // The text
108 std::string Text;
109
110 // The line
114
116
117 // Tooltip parameters
118 std::string ComponentName;
119 int DrawSide; // Left/Right
120 int ButtonSide; // Front/Back
121
123
124 double ControlPositionLC[3];
125
126 // The renderer in which this widget is placed
128
130 unsigned long ObserverTag;
131 static void MoveEvent(vtkObject* object, unsigned long event, void* clientdata, void* calldata);
132
137 virtual void InitControlPosition() = 0;
138
140 double LastPhysicalTranslation[3];
141 double LastEventPosition[3];
142 double LastEventOrientation[4];
145
146private:
148 void operator=(const vtkVRControlsHelper&) = delete;
149};
150
151VTK_ABI_NAMESPACE_END
152#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:108
create a line defined by two end points
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract base class for most VTK objects
Definition vtkObject.h:162
map vtkPolyData to graphics primitives
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
abstract specification for renderers
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:65
a weak reference to a vtkObject.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
vtkEventDataDevice
platform-independent event data structures