VTK  9.3.0
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
25#include "vtkInteractionWidgetsModule.h" // For export macro
26#include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkActor;
32class vtkSphereSource;
33class vtkCellPicker;
34class vtkProperty;
36class vtkVectorText;
37class vtkAssembly;
38class vtkTransform;
40class vtkMatrix4x4;
41
42class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
43{
44public:
49
51
55 void PrintSelf(ostream& os, vtkIndent indent) override;
57
59
68 void SetPoint1InWorldCoordinates(double x, double y, double z);
70
72
81 void SetPoint2InWorldCoordinates(double x, double y, double z);
83
85
89 void SetTitleText(const char*) override;
90 const char* GetTitleText() override;
92
94
98 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
99 vtkGetMacro(SliderShape, int);
100 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
101 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
103
105
110 vtkSetMacro(Rotation, double);
111 vtkGetMacro(Rotation, double);
113
115
119 vtkGetObjectMacro(SliderProperty, vtkProperty);
121
123
126 vtkGetObjectMacro(TubeProperty, vtkProperty);
127 vtkGetObjectMacro(CapProperty, vtkProperty);
129
131
135 vtkGetObjectMacro(SelectedProperty, vtkProperty);
137
139
142 void PlaceWidget(double bounds[6]) override;
143 void BuildRepresentation() override;
144 void StartWidgetInteraction(double eventPos[2]) override;
145 void WidgetInteraction(double newEventPos[2]) override;
146 void Highlight(int) override;
148
150
153 double* GetBounds() VTK_SIZEHINT(6) override;
154 void GetActors(vtkPropCollection* propCollection) override;
155 void ReleaseGraphicsResources(vtkWindow* window) override;
156 int RenderOpaqueGeometry(vtkViewport* viewport) override;
157 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
158 vtkTypeBool HasTranslucentPolygonalGeometry() override;
160
164 vtkMTimeType GetMTime() override;
165
166 /*
167 * Register internal Pickers within PickingManager
168 */
169 void RegisterPickers() override;
170
171protected:
174
175 // Positioning the widget
176 vtkCoordinate* Point1Coordinate;
177 vtkCoordinate* Point2Coordinate;
178 double Length;
179
180 // These are the slider end points taking into account the thickness
181 // of the slider
182 double SP1[3];
183 double SP2[3];
184
185 // More ivars controlling the appearance of the widget
186 double Rotation;
187 int SliderShape;
188
189 // Do the picking
191
192 // Determine the parameter t along the slider
193 virtual double ComputePickPosition(double eventPos[2]);
194
195 // The widget consists of several actors, all grouped
196 // together using an assembly. This makes it easier to
197 // perform the final transformation into
198 vtkAssembly* WidgetAssembly;
199
200 // Cylinder used by other objects
201 vtkCylinderSource* CylinderSource;
203
204 // The tube
205 vtkPolyDataMapper* TubeMapper;
206 vtkActor* TubeActor;
207 vtkProperty* TubeProperty;
208
209 // The slider
210 vtkSphereSource* SliderSource;
211 vtkPolyDataMapper* SliderMapper;
212 vtkActor* SliderActor;
213 vtkProperty* SliderProperty;
214 vtkProperty* SelectedProperty;
215
216 // The left cap
217 vtkPolyDataMapper* LeftCapMapper;
218 vtkActor* LeftCapActor;
219 vtkProperty* CapProperty;
220
221 // The right cap
222 vtkPolyDataMapper* RightCapMapper;
223 vtkActor* RightCapActor;
224
225 // The text. There is an extra transform used to rotate
226 // both the title and label
227 vtkVectorText* LabelText;
228 vtkPolyDataMapper* LabelMapper;
229 vtkActor* LabelActor;
230
231 vtkVectorText* TitleText;
232 vtkPolyDataMapper* TitleMapper;
233 vtkActor* TitleActor;
234
235 // Transform used during slider motion
237 vtkTransform* Transform;
238
239 // Manage the state of the widget
241 {
243 CylinderShape
244 };
245#if !defined(VTK_LEGACY_REMOVE)
246 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
248#endif
249
250private:
252 void operator=(const vtkSliderRepresentation3D&) = delete;
253};
254
255VTK_ABI_NAMESPACE_END
256#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
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:57
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:45
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)