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
29#ifndef vtkSliderRepresentation3D_h
30#define vtkSliderRepresentation3D_h
31
32#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
33#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
34#include "vtkInteractionWidgetsModule.h" // For export macro
35#include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
37
38VTK_ABI_NAMESPACE_BEGIN
39class vtkActor;
41class vtkSphereSource;
42class vtkCellPicker;
43class vtkProperty;
45class vtkVectorText;
46class vtkAssembly;
47class vtkTransform;
49class vtkMatrix4x4;
50
51class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
52{
53public:
58
60
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
77 void SetPoint1InWorldCoordinates(double x, double y, double z);
79
81
90 void SetPoint2InWorldCoordinates(double x, double y, double z);
92
94
98 void SetTitleText(const char*) override;
99 const char* GetTitleText() override;
101
103
107 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
108 vtkGetMacro(SliderShape, int);
109 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
110 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
112
114
119 vtkSetMacro(Rotation, double);
120 vtkGetMacro(Rotation, double);
122
124
128 vtkGetObjectMacro(SliderProperty, vtkProperty);
130
132
135 vtkGetObjectMacro(TubeProperty, vtkProperty);
136 vtkGetObjectMacro(CapProperty, vtkProperty);
138
140
144 vtkGetObjectMacro(SelectedProperty, vtkProperty);
146
148
151 void PlaceWidget(double bounds[6]) override;
152 void BuildRepresentation() override;
153 void StartWidgetInteraction(double eventPos[2]) override;
154 void WidgetInteraction(double newEventPos[2]) override;
155 void Highlight(int) override;
157
159
162 double* GetBounds() VTK_SIZEHINT(6) override;
163 void GetActors(vtkPropCollection* propCollection) override;
164 void ReleaseGraphicsResources(vtkWindow* window) override;
165 int RenderOpaqueGeometry(vtkViewport* viewport) override;
166 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
167 vtkTypeBool HasTranslucentPolygonalGeometry() override;
169
173 vtkMTimeType GetMTime() override;
174
175 /*
176 * Register internal Pickers within PickingManager
177 */
178 void RegisterPickers() override;
179
180protected:
183
184 // Positioning the widget
185 vtkCoordinate* Point1Coordinate;
186 vtkCoordinate* Point2Coordinate;
187 double Length;
188
189 // These are the slider end points taking into account the thickness
190 // of the slider
191 double SP1[3];
192 double SP2[3];
193
194 // More ivars controlling the appearance of the widget
195 double Rotation;
196 int SliderShape;
197
198 // Do the picking
200
201 // Determine the parameter t along the slider
202 virtual double ComputePickPosition(double eventPos[2]);
203
204 // The widget consists of several actors, all grouped
205 // together using an assembly. This makes it easier to
206 // perform the final transformation into
207 vtkAssembly* WidgetAssembly;
208
209 // Cylinder used by other objects
210 vtkCylinderSource* CylinderSource;
212
213 // The tube
214 vtkPolyDataMapper* TubeMapper;
215 vtkActor* TubeActor;
216 vtkProperty* TubeProperty;
217
218 // The slider
219 vtkSphereSource* SliderSource;
220 vtkPolyDataMapper* SliderMapper;
221 vtkActor* SliderActor;
222 vtkProperty* SliderProperty;
223 vtkProperty* SelectedProperty;
224
225 // The left cap
226 vtkPolyDataMapper* LeftCapMapper;
227 vtkActor* LeftCapActor;
228 vtkProperty* CapProperty;
229
230 // The right cap
231 vtkPolyDataMapper* RightCapMapper;
232 vtkActor* RightCapActor;
233
234 // The text. There is an extra transform used to rotate
235 // both the title and label
236 vtkVectorText* LabelText;
237 vtkPolyDataMapper* LabelMapper;
238 vtkActor* LabelActor;
239
240 vtkVectorText* TitleText;
241 vtkPolyDataMapper* TitleMapper;
242 vtkActor* TitleActor;
243
244 // Transform used during slider motion
246 vtkTransform* Transform;
247
248 // Manage the state of the widget
250 {
252 CylinderShape
253 };
254#if !defined(VTK_LEGACY_REMOVE)
255 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
257#endif
258
259private:
261 void operator=(const vtkSliderRepresentation3D&) = delete;
262};
263
264VTK_ABI_NAMESPACE_END
265#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:50
create hierarchies of vtkProp3Ds (transformable props)
Definition vtkAssembly.h:71
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:38
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:66
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:54
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)