VTK  9.1.0
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 vtkProperty;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkCellArray;
39 class vtkPoints;
40 class vtkTextActor3D;
41 class vtkTransform;
42 
43 class vtkLineSource;
44 class vtkPolyDataMapper;
45 class vtkRenderer;
46 class vtkCallbackCommand;
47 
48 class VTKRENDERINGVR_EXPORT vtkVRControlsHelper : public vtkProp
49 {
50 public:
52 
55  vtkTypeMacro(vtkVRControlsHelper, vtkProp);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60  {
61  Back = -1,
62  Front = 1
63  };
64 
65  enum DrawSides
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 
117 protected:
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 
139  bool Enabled;
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 
163 private:
164  vtkVRControlsHelper(const vtkVRControlsHelper&) = delete;
165  void operator=(const vtkVRControlsHelper&) = delete;
166 };
167 
168 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:146
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkVRControlsHelper::MoveCallbackCommand
vtkCallbackCommand * MoveCallbackCommand
Definition: vtkVRControlsHelper.h:146
vtkVRControlsHelper::GetRenderer
virtual vtkRenderer * GetRenderer()
vtkVRControlsHelper::LabelVisible
bool LabelVisible
Definition: vtkVRControlsHelper.h:161
vtkVRControlsHelper::SetDevice
void SetDevice(vtkEventDataDevice val)
vtkVRControlsHelper::vtkVRControlsHelper
vtkVRControlsHelper()
vtkVRControlsHelper::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
vtkVRControlsHelper::SetText
void SetText(const std::string &str)
Set Tooltip text (used by TextActor)
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:45
vtkVRControlsHelper::SetTooltipInfo
void SetTooltipInfo(const char *s, int buttonSide, int drawSide, const char *txt)
Definition: vtkVRControlsHelper.h:96
vtkVRControlsHelper::MoveEvent
static void MoveEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkVRControlsHelper::Text
std::string Text
Definition: vtkVRControlsHelper.h:125
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkVRControlsHelper::LineSource
vtkLineSource * LineSource
Definition: vtkVRControlsHelper.h:128
vtkVRControlsHelper::SetEnabled
void SetEnabled(bool enabled)
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkProp.h
vtkVRControlsHelper::Device
vtkEventDataDevice Device
Definition: vtkVRControlsHelper.h:132
vtkVRControlsHelper::ComponentName
std::string ComponentName
Definition: vtkVRControlsHelper.h:135
vtkVRControlsHelper::ButtonSide
int ButtonSide
Definition: vtkVRControlsHelper.h:137
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkVRControlsHelper::ButtonSides
ButtonSides
Definition: vtkVRControlsHelper.h:60
vtkVRControlsHelper::Enabled
bool Enabled
Definition: vtkVRControlsHelper.h:139
vtkVRControlsHelper
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller.
Definition: vtkVRControlsHelper.h:49
vtkVRControlsHelper::BuildRepresentation
void BuildRepresentation()
Methods to interface with the vtkVRPanelWidget.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkVRControlsHelper::DrawSides
DrawSides
Definition: vtkVRControlsHelper.h:66
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkVRControlsHelper::Renderer
vtkWeakPointer< vtkRenderer > Renderer
Definition: vtkVRControlsHelper.h:144
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkVRControlsHelper::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkVRControlsHelper.h:129
vtkEventData.h
vtkNew< vtkTransform >
vtkWeakPointer.h
vtkVRControlsHelper::InitControlPosition
virtual void InitControlPosition()=0
Must be overriden in subclasses to init the member variable ControlPositionLC to position the tooltip...
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:170
vtkX3D::enabled
@ enabled
Definition: vtkX3D.h:265
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkVRControlsHelper::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
vtkVRControlsHelper::SetRenderer
virtual void SetRenderer(vtkRenderer *ren)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
vtkVRControlsHelper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkVRControlsHelper::UpdateRepresentation
void UpdateRepresentation()
Methods to interface with the vtkVRPanelWidget.
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:26
vtkNew.h
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkVRControlsHelper::ObserverTag
unsigned long ObserverTag
Definition: vtkVRControlsHelper.h:147
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:154
vtkVRControlsHelper::DrawSide
int DrawSide
Definition: vtkVRControlsHelper.h:136
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:171
vtkVRControlsHelper::LineActor
vtkActor * LineActor
Definition: vtkVRControlsHelper.h:130
vtkVRControlsHelper::~vtkVRControlsHelper
~vtkVRControlsHelper() override
vtkVRControlsHelper::TextActor
vtkTextActor3D * TextActor
Definition: vtkVRControlsHelper.h:124
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkVRControlsHelper::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
vtkVRControlsHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
vtkVRControlsHelper::TempTransform
vtkNew< vtkTransform > TempTransform
Definition: vtkVRControlsHelper.h:156
vtkVRControlsHelper::NeedUpdate
bool NeedUpdate
Definition: vtkVRControlsHelper.h:160
vtkWeakPointer< vtkRenderer >