VTK  9.3.20240424
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
49#ifndef vtkSliderRepresentation3D_h
50#define vtkSliderRepresentation3D_h
51
52#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
53#include "vtkInteractionWidgetsModule.h" // For export macro
55
56VTK_ABI_NAMESPACE_BEGIN
57class vtkActor;
59class vtkSphereSource;
60class vtkCellPicker;
61class vtkProperty;
63class vtkVectorText;
64class vtkAssembly;
65class vtkTransform;
67class vtkMatrix4x4;
68
69class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
70{
71public:
76
78
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
86
95 void SetPoint1InWorldCoordinates(double x, double y, double z);
97
99
108 void SetPoint2InWorldCoordinates(double x, double y, double z);
110
112
116 void SetTitleText(const char*) override;
117 const char* GetTitleText() override;
119
121
125 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
126 vtkGetMacro(SliderShape, int);
127 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
128 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
130
132
137 vtkSetMacro(Rotation, double);
138 vtkGetMacro(Rotation, double);
140
142
146 vtkGetObjectMacro(SliderProperty, vtkProperty);
148
150
153 vtkGetObjectMacro(TubeProperty, vtkProperty);
154 vtkGetObjectMacro(CapProperty, vtkProperty);
156
158
162 vtkGetObjectMacro(SelectedProperty, vtkProperty);
164
166
169 void PlaceWidget(double bounds[6]) override;
170 void BuildRepresentation() override;
171 void StartWidgetInteraction(double eventPos[2]) override;
172 void WidgetInteraction(double newEventPos[2]) override;
173 void Highlight(int) override;
175
177
180 double* GetBounds() VTK_SIZEHINT(6) override;
181 void GetActors(vtkPropCollection* propCollection) override;
182 void ReleaseGraphicsResources(vtkWindow* window) override;
183 int RenderOpaqueGeometry(vtkViewport* viewport) override;
184 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
185 vtkTypeBool HasTranslucentPolygonalGeometry() override;
187
191 vtkMTimeType GetMTime() override;
192
193 /*
194 * Register internal Pickers within PickingManager
195 */
196 void RegisterPickers() override;
197
198protected:
201
202 // Positioning the widget
203 vtkCoordinate* Point1Coordinate;
204 vtkCoordinate* Point2Coordinate;
205 double Length;
206
207 // These are the slider end points taking into account the thickness
208 // of the slider
209 double SP1[3];
210 double SP2[3];
211
212 // More ivars controlling the appearance of the widget
213 double Rotation;
214 int SliderShape;
215
216 // Do the picking
218
219 // Determine the parameter t along the slider
220 virtual double ComputePickPosition(double eventPos[2]);
221
222 // The widget consists of several actors, all grouped
223 // together using an assembly. This makes it easier to
224 // perform the final transformation into
225 vtkAssembly* WidgetAssembly;
226
227 // Cylinder used by other objects
228 vtkCylinderSource* CylinderSource;
230
231 // The tube
232 vtkPolyDataMapper* TubeMapper;
233 vtkActor* TubeActor;
234 vtkProperty* TubeProperty;
235
236 // The slider
237 vtkSphereSource* SliderSource;
238 vtkPolyDataMapper* SliderMapper;
239 vtkActor* SliderActor;
240 vtkProperty* SliderProperty;
241 vtkProperty* SelectedProperty;
242
243 // The left cap
244 vtkPolyDataMapper* LeftCapMapper;
245 vtkActor* LeftCapActor;
246 vtkProperty* CapProperty;
247
248 // The right cap
249 vtkPolyDataMapper* RightCapMapper;
250 vtkActor* RightCapActor;
251
252 // The text. There is an extra transform used to rotate
253 // both the title and label
254 vtkVectorText* LabelText;
255 vtkPolyDataMapper* LabelMapper;
256 vtkActor* LabelActor;
257
258 vtkVectorText* TitleText;
259 vtkPolyDataMapper* TitleMapper;
260 vtkActor* TitleActor;
261
262 // Transform used during slider motion
264 vtkTransform* Transform;
265
266 // Manage the state of the widget
268 {
270 CylinderShape
271 };
272
273private:
275 void operator=(const vtkSliderRepresentation3D&) = delete;
276};
277
278VTK_ABI_NAMESPACE_END
279#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
create hierarchies of vtkProp3Ds (transformable props)
Definition vtkAssembly.h:91
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:108
represent and manipulate 4x4 transformation matrices
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
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:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)