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=========================================================================*/
29#ifndef vtkSliderRepresentation3D_h
30#define vtkSliderRepresentation3D_h
31
32#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
33#include "vtkInteractionWidgetsModule.h" // For export macro
35
36class vtkActor;
38class vtkSphereSource;
39class vtkCellPicker;
40class vtkProperty;
42class vtkVectorText;
43class vtkAssembly;
44class vtkTransform;
46class vtkMatrix4x4;
47
48class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
49{
50public:
55
57
61 void PrintSelf(ostream& os, vtkIndent indent) override;
63
65
74 void SetPoint1InWorldCoordinates(double x, double y, double z);
76
78
87 void SetPoint2InWorldCoordinates(double x, double y, double z);
89
91
95 void SetTitleText(const char*) override;
96 const char* GetTitleText() override;
98
100
104 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
105 vtkGetMacro(SliderShape, int);
106 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
107 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
109
111
116 vtkSetMacro(Rotation, double);
117 vtkGetMacro(Rotation, double);
119
121
125 vtkGetObjectMacro(SliderProperty, vtkProperty);
127
129
132 vtkGetObjectMacro(TubeProperty, vtkProperty);
133 vtkGetObjectMacro(CapProperty, vtkProperty);
135
137
141 vtkGetObjectMacro(SelectedProperty, vtkProperty);
143
145
148 void PlaceWidget(double bounds[6]) override;
149 void BuildRepresentation() override;
150 void StartWidgetInteraction(double eventPos[2]) override;
151 void WidgetInteraction(double newEventPos[2]) override;
152 void Highlight(int) override;
154
156
159 double* GetBounds() VTK_SIZEHINT(6) override;
160 void GetActors(vtkPropCollection*) override;
161 void ReleaseGraphicsResources(vtkWindow*) override;
162 int RenderOpaqueGeometry(vtkViewport*) override;
163 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
164 vtkTypeBool HasTranslucentPolygonalGeometry() override;
166
170 vtkMTimeType GetMTime() override;
171
172 /*
173 * Register internal Pickers within PickingManager
174 */
175 void RegisterPickers() override;
176
177protected:
180
181 // Positioning the widget
182 vtkCoordinate* Point1Coordinate;
183 vtkCoordinate* Point2Coordinate;
184 double Length;
185
186 // These are the slider end points taking into account the thickness
187 // of the slider
188 double SP1[3];
189 double SP2[3];
190
191 // More ivars controlling the appearance of the widget
192 double Rotation;
193 int SliderShape;
194
195 // Do the picking
197
198 // Determine the parameter t along the slider
199 virtual double ComputePickPosition(double eventPos[2]);
200
201 // The widget consists of several actors, all grouped
202 // together using an assembly. This makes it easier to
203 // perform the final transformation into
204 vtkAssembly* WidgetAssembly;
205
206 // Cylinder used by other objects
207 vtkCylinderSource* CylinderSource;
209
210 // The tube
211 vtkPolyDataMapper* TubeMapper;
212 vtkActor* TubeActor;
213 vtkProperty* TubeProperty;
214
215 // The slider
216 vtkSphereSource* SliderSource;
217 vtkPolyDataMapper* SliderMapper;
218 vtkActor* SliderActor;
219 vtkProperty* SliderProperty;
220 vtkProperty* SelectedProperty;
221
222 // The left cap
223 vtkPolyDataMapper* LeftCapMapper;
224 vtkActor* LeftCapActor;
225 vtkProperty* CapProperty;
226
227 // The right cap
228 vtkPolyDataMapper* RightCapMapper;
229 vtkActor* RightCapActor;
230
231 // The text. There is an extra transform used to rotate
232 // both the title and label
233 vtkVectorText* LabelText;
234 vtkPolyDataMapper* LabelMapper;
235 vtkActor* LabelActor;
236
237 vtkVectorText* TitleText;
238 vtkPolyDataMapper* TitleMapper;
239 vtkActor* TitleActor;
240
241 // Transform used during slider motion
244
245 // Manage the state of the widget
247 {
249 CylinderShape
250 };
251
252private:
254 void operator=(const vtkSliderRepresentation3D&) = delete;
255};
256
257#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:70
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:77
generate a cylinder centered at origin
a simple class to control print indentation
Definition: vtkIndent.h:34
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:62
provide the representation for a vtkSliderWidget with a 3D skin
void BuildRepresentation() override
Methods to interface with the vtkSliderWidget.
void SetPoint2InWorldCoordinates(double x, double y, double z)
Position the second end point of the slider.
vtkCoordinate * GetPoint1Coordinate()
Position the first end point of the slider.
void Highlight(int) override
Methods to interface with the vtkSliderWidget.
const char * GetTitleText() override
Specify the title text for this widget.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkSliderWidget.
double * GetBounds() override
Methods supporting the rendering process.
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkSliderWidget.
void SetSliderShapeToCylinder()
Specify whether to use a sphere or cylinder slider shape.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkSliderWidget.
void SetTitleText(const char *) override
Specify the title text for this widget.
static vtkSliderRepresentation3D * New()
Instantiate the class.
void SetPoint1InWorldCoordinates(double x, double y, double z)
Position the first end point of the slider.
void SetSliderShapeToSphere()
Specify whether to use a sphere or cylinder slider shape.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
vtkCoordinate * GetPoint2Coordinate()
Position the second end point of the slider.
abstract class defines the representation for a vtkSliderWidget
create a polygonal sphere centered at the origin
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
create polygonal text
Definition: vtkVectorText.h:42
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ Cylinder
Definition: vtkX3D.h:91
@ Transform
Definition: vtkX3D.h:47
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)