VTK  9.3.20240419
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 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkActor;
24 class vtkCallbackCommand;
25 class vtkLineSource;
26 class vtkPolyDataMapper;
27 class vtkRenderer;
28 class vtkTextActor3D;
29 class vtkTransform;
30 
31 class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
32 {
33 public:
35 
38  vtkTypeMacro(vtkVRControlsHelper, vtkProp);
39  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43  {
44  Back = -1,
45  Front = 1
46  };
47 
48  enum DrawSides
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 
100 protected:
103 
104  double FrameSize[2];
105 
106  // The text
109 
110  // The line
114 
116 
117  // Tooltip parameters
119  int DrawSide; // Left/Right
120  int ButtonSide; // Front/Back
121 
122  bool Enabled;
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 
146 private:
147  vtkVRControlsHelper(const vtkVRControlsHelper&) = delete;
148  void operator=(const vtkVRControlsHelper&) = delete;
149 };
150 
151 VTK_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
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
Definition: vtkRenderer.h:172
An actor that displays text.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:160
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:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ enabled
Definition: vtkX3D.h:259
@ string
Definition: vtkX3D.h:490
int vtkTypeBool
Definition: vtkABI.h:64
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:15