VTK  9.1.0
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;
35class vtkProperty;
36class vtkPolyData;
38class vtkCellArray;
39class vtkPoints;
40class vtkTextActor3D;
41class vtkTransform;
42
43class vtkLineSource;
45class vtkRenderer;
47
48class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
49{
50public:
52
56 void PrintSelf(ostream& os, vtkIndent indent) override;
58
60 {
61 Back = -1,
62 Front = 1
63 };
64
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
117protected:
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
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
163private:
165 void operator=(const vtkVRControlsHelper&) = delete;
166};
167
168#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
supports function callbacks
object to represent cell connectivity
Definition: vtkCellArray.h:290
a simple class to control print indentation
Definition: vtkIndent.h:113
create a line defined by two end points
abstract base class for most VTK objects
Definition: vtkObject.h:73
represent and manipulate 3D points
Definition: vtkPoints.h:143
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
represent surface properties of a geometric object
Definition: vtkProperty.h:171
abstract specification for renderers
Definition: vtkRenderer.h:173
An actor that displays text.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
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:36
@ 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