VTK  9.1.0
vtkSliderRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSliderRepresentation3D.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 =========================================================================*/
58 #ifndef vtkSliderRepresentation3D_h
59 #define vtkSliderRepresentation3D_h
60 
61 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
62 #include "vtkInteractionWidgetsModule.h" // For export macro
64 
65 class vtkActor;
66 class vtkPolyDataMapper;
67 class vtkSphereSource;
68 class vtkCellPicker;
69 class vtkProperty;
70 class vtkCylinderSource;
71 class vtkVectorText;
72 class vtkAssembly;
73 class vtkTransform;
75 class vtkMatrix4x4;
76 
77 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
78 {
79 public:
84 
86 
90  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
94 
103  void SetPoint1InWorldCoordinates(double x, double y, double z);
105 
107 
116  void SetPoint2InWorldCoordinates(double x, double y, double z);
118 
120 
124  void SetTitleText(const char*) override;
125  const char* GetTitleText() override;
127 
129 
133  vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
134  vtkGetMacro(SliderShape, int);
135  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
136  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
138 
140 
145  vtkSetMacro(Rotation, double);
146  vtkGetMacro(Rotation, double);
148 
150 
154  vtkGetObjectMacro(SliderProperty, vtkProperty);
156 
158 
161  vtkGetObjectMacro(TubeProperty, vtkProperty);
162  vtkGetObjectMacro(CapProperty, vtkProperty);
164 
166 
170  vtkGetObjectMacro(SelectedProperty, vtkProperty);
172 
174 
177  void PlaceWidget(double bounds[6]) override;
178  void BuildRepresentation() override;
179  void StartWidgetInteraction(double eventPos[2]) override;
180  void WidgetInteraction(double newEventPos[2]) override;
181  void Highlight(int) override;
183 
185 
188  double* GetBounds() VTK_SIZEHINT(6) override;
189  void GetActors(vtkPropCollection*) override;
190  void ReleaseGraphicsResources(vtkWindow*) override;
191  int RenderOpaqueGeometry(vtkViewport*) override;
192  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
193  vtkTypeBool HasTranslucentPolygonalGeometry() override;
195 
199  vtkMTimeType GetMTime() override;
200 
201  /*
202  * Register internal Pickers within PickingManager
203  */
204  void RegisterPickers() override;
205 
206 protected:
209 
210  // Positioning the widget
211  vtkCoordinate* Point1Coordinate;
212  vtkCoordinate* Point2Coordinate;
213  double Length;
214 
215  // These are the slider end points taking into account the thickness
216  // of the slider
217  double SP1[3];
218  double SP2[3];
219 
220  // More ivars controlling the appearance of the widget
221  double Rotation;
222  int SliderShape;
223 
224  // Do the picking
225  vtkCellPicker* Picker;
226 
227  // Determine the parameter t along the slider
228  virtual double ComputePickPosition(double eventPos[2]);
229 
230  // The widget consists of several actors, all grouped
231  // together using an assembly. This makes it easier to
232  // perform the final transformation into
233  vtkAssembly* WidgetAssembly;
234 
235  // Cylinder used by other objects
236  vtkCylinderSource* CylinderSource;
238 
239  // The tube
240  vtkPolyDataMapper* TubeMapper;
241  vtkActor* TubeActor;
242  vtkProperty* TubeProperty;
243 
244  // The slider
245  vtkSphereSource* SliderSource;
246  vtkPolyDataMapper* SliderMapper;
247  vtkActor* SliderActor;
248  vtkProperty* SliderProperty;
249  vtkProperty* SelectedProperty;
250 
251  // The left cap
252  vtkPolyDataMapper* LeftCapMapper;
253  vtkActor* LeftCapActor;
254  vtkProperty* CapProperty;
255 
256  // The right cap
257  vtkPolyDataMapper* RightCapMapper;
258  vtkActor* RightCapActor;
259 
260  // The text. There is an extra transform used to rotate
261  // both the title and label
262  vtkVectorText* LabelText;
263  vtkPolyDataMapper* LabelMapper;
264  vtkActor* LabelActor;
265 
266  vtkVectorText* TitleText;
267  vtkPolyDataMapper* TitleMapper;
268  vtkActor* TitleActor;
269 
270  // Transform used during slider motion
271  vtkMatrix4x4* Matrix;
273 
274  // Manage the state of the widget
276  {
278  CylinderShape
279  };
280 
281 private:
283  void operator=(const vtkSliderRepresentation3D&) = delete;
284 };
285 
286 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:146
vtkSliderRepresentation3D
provide the representation for a vtkSliderWidget with a 3D skin
Definition: vtkSliderRepresentation3D.h:78
vtkSliderRepresentation3D::GetTitleText
const char * GetTitleText() override
Specify the title text for this widget.
vtkSliderRepresentation3D::Highlight
void Highlight(int) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::GetBounds
double * GetBounds() override
Methods supporting the rendering process.
vtkSliderRepresentation3D::GetPoint1Coordinate
vtkCoordinate * GetPoint1Coordinate()
Position the first end point of the slider.
vtkSliderRepresentation3D::_SliderShape
_SliderShape
Definition: vtkSliderRepresentation3D.h:276
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkVectorText
create polygonal text
Definition: vtkVectorText.h:151
vtkX3D::Transform
@ Transform
Definition: vtkX3D.h:47
vtkSliderRepresentation3D::BuildRepresentation
void BuildRepresentation() override
Methods to interface with the vtkSliderWidget.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkSliderRepresentation3D::SetSliderShapeToSphere
void SetSliderShapeToSphere()
Specify whether to use a sphere or cylinder slider shape.
Definition: vtkSliderRepresentation3D.h:135
vtkSliderRepresentation3D::New
static vtkSliderRepresentation3D * New()
Instantiate the class.
vtkSliderRepresentation3D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::PlaceWidget
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkSliderWidget.
vtkX3D::Cylinder
@ Cylinder
Definition: vtkX3D.h:91
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkSliderRepresentation3D::SphereShape
@ SphereShape
Definition: vtkSliderRepresentation3D.h:277
vtkSliderRepresentation3D::GetPoint2Coordinate
vtkCoordinate * GetPoint2Coordinate()
Position the second end point of the slider.
vtkSliderRepresentation3D::SetPoint1InWorldCoordinates
void SetPoint1InWorldCoordinates(double x, double y, double z)
Position the first end point of the slider.
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:149
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
vtkSliderRepresentation3D::SetPoint2InWorldCoordinates
void SetPoint2InWorldCoordinates(double x, double y, double z)
Position the second end point of the slider.
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:186
vtkCylinderSource
generate a cylinder centered at origin
Definition: vtkCylinderSource.h:146
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:155
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkCoordinate.h
vtkSliderRepresentation.h
vtkSliderRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:171
vtkSliderRepresentation3D::SetSliderShapeToCylinder
void SetSliderShapeToCylinder()
Specify whether to use a sphere or cylinder slider shape.
Definition: vtkSliderRepresentation3D.h:136
vtkSliderRepresentation3D::SetTitleText
void SetTitleText(const char *) override
Specify the title text for this widget.
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:85
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:96
vtkSliderRepresentation3D::WidgetInteraction
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkSliderWidget.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkSliderRepresentation
abstract class defines the representation for a vtkSliderWidget
Definition: vtkSliderRepresentation.h:61
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
vtkAssembly
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:109