VTK  9.4.20251203
vtkSliderRepresentation3D.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
20#ifndef vtkSliderRepresentation3D_h
21#define vtkSliderRepresentation3D_h
22
23#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
24#include "vtkInteractionWidgetsModule.h" // For export macro
26
27VTK_ABI_NAMESPACE_BEGIN
28class vtkActor;
30class vtkSphereSource;
31class vtkCellPicker;
32class vtkProperty;
34class vtkVectorText;
35class vtkAssembly;
36class vtkTransform;
38class vtkMatrix4x4;
39
40class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
41{
42public:
47
49
53 void PrintSelf(ostream& os, vtkIndent indent) override;
55
57
66 void SetPoint1InWorldCoordinates(double x, double y, double z);
68
70
79 void SetPoint2InWorldCoordinates(double x, double y, double z);
81
83
87 void SetTitleText(const char*) override;
88 const char* GetTitleText() override;
90
92
96 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
97 vtkGetMacro(SliderShape, int);
98 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
99 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
101
103
108 vtkSetMacro(Rotation, double);
109 vtkGetMacro(Rotation, double);
111
113
117 vtkGetObjectMacro(SliderProperty, vtkProperty);
119
121
124 vtkGetObjectMacro(TubeProperty, vtkProperty);
125 vtkGetObjectMacro(CapProperty, vtkProperty);
127
129
133 vtkGetObjectMacro(SelectedProperty, vtkProperty);
135
137
140 void PlaceWidget(double bounds[6]) override;
141 void BuildRepresentation() override;
142 void StartWidgetInteraction(double eventPos[2]) override;
143 void WidgetInteraction(double newEventPos[2]) override;
144 void Highlight(int) override;
146
148
151 double* GetBounds() VTK_SIZEHINT(6) override;
152 void GetActors(vtkPropCollection* propCollection) override;
153 void ReleaseGraphicsResources(vtkWindow* window) override;
154 int RenderOpaqueGeometry(vtkViewport* viewport) override;
155 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
156 vtkTypeBool HasTranslucentPolygonalGeometry() override;
158
162 vtkMTimeType GetMTime() override;
163
164 /*
165 * Register internal Pickers within PickingManager
166 */
167 void RegisterPickers() override;
168
169protected:
172
173 // Positioning the widget
174 vtkCoordinate* Point1Coordinate;
175 vtkCoordinate* Point2Coordinate;
176 double Length;
177
178 // These are the slider end points taking into account the thickness
179 // of the slider
180 double SP1[3];
181 double SP2[3];
182
183 // More ivars controlling the appearance of the widget
184 double Rotation;
185 int SliderShape;
186
187 // Do the picking
189
190 // Determine the parameter t along the slider
191 virtual double ComputePickPosition(double eventPos[2]);
192
193 // The widget consists of several actors, all grouped
194 // together using an assembly. This makes it easier to
195 // perform the final transformation into
196 vtkAssembly* WidgetAssembly;
197
198 // Cylinder used by other objects
199 vtkCylinderSource* CylinderSource;
201
202 // The tube
203 vtkPolyDataMapper* TubeMapper;
204 vtkActor* TubeActor;
205 vtkProperty* TubeProperty;
206
207 // The slider
208 vtkSphereSource* SliderSource;
209 vtkPolyDataMapper* SliderMapper;
210 vtkActor* SliderActor;
211 vtkProperty* SliderProperty;
212 vtkProperty* SelectedProperty;
213
214 // The left cap
215 vtkPolyDataMapper* LeftCapMapper;
216 vtkActor* LeftCapActor;
217 vtkProperty* CapProperty;
218
219 // The right cap
220 vtkPolyDataMapper* RightCapMapper;
221 vtkActor* RightCapActor;
222
223 // The text. There is an extra transform used to rotate
224 // both the title and label
225 vtkVectorText* LabelText;
226 vtkPolyDataMapper* LabelMapper;
227 vtkActor* LabelActor;
228
229 vtkVectorText* TitleText;
230 vtkPolyDataMapper* TitleMapper;
231 vtkActor* TitleActor;
232
233 // Transform used during slider motion
235 vtkTransform* Transform;
236
237 // Manage the state of the widget
239 {
241 CylinderShape
242 };
243
244private:
246 void operator=(const vtkSliderRepresentation3D&) = delete;
247};
248
249VTK_ABI_NAMESPACE_END
250#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
create hierarchies of vtkProp3Ds (transformable props)
Definition vtkAssembly.h:62
ray-cast cell picker for all kinds of Prop3Ds
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
generate a polygonal cylinder centered at the origin
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate 4x4 transformation matrices
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:60
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
create polygonal text
abstract specification for Viewports
Definition vtkViewport.h:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)