VTK  9.2.6
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 
69  void BuildRepresentation();
70  void UpdateRepresentation();
72 
74 
77  void ReleaseGraphicsResources(vtkWindow*) override;
78  int RenderOpaqueGeometry(vtkViewport*) override;
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 
106  void SetDevice(vtkEventDataDevice val);
107 
108  virtual void SetRenderer(vtkRenderer* ren);
109  virtual vtkRenderer* GetRenderer();
110 
111 protected:
113  ~vtkVRControlsHelper() override;
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkEventDataDevice Device
abstract specification for Viewports
Definition: vtkViewport.h:55
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:224
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:288
abstract specification for renderers
Definition: vtkRenderer.h:72
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWeakPointer< vtkRenderer > Renderer
void SetTooltipInfo(const char *s, int buttonSide, int drawSide, const char *txt)
int vtkTypeBool
Definition: vtkABI.h:69
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:309
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
supports function callbacks
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTextActor3D * TextActor
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:25
An actor that displays text.
vtkLineSource * LineSource
create a line defined by two end points
Definition: vtkLineSource.h:63
map vtkPolyData to graphics primitives
vtkNew< vtkTransform > TempTransform
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:225
vtkCallbackCommand * MoveCallbackCommand
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller...
vtkPolyDataMapper * LineMapper