VTK  9.2.6
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=========================================================================*/
32#ifndef vtkSliderRepresentation3D_h
33#define vtkSliderRepresentation3D_h
34
35#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
36#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
37#include "vtkInteractionWidgetsModule.h" // For export macro
39
40class vtkActor;
42class vtkSphereSource;
43class vtkCellPicker;
44class vtkProperty;
46class vtkVectorText;
47class vtkAssembly;
48class vtkTransform;
50class vtkMatrix4x4;
51
52class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
53{
54public:
59
61
65 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
78 void SetPoint1InWorldCoordinates(double x, double y, double z);
80
82
91 void SetPoint2InWorldCoordinates(double x, double y, double z);
93
95
99 void SetTitleText(const char*) override;
100 const char* GetTitleText() override;
102
104
108 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
109 vtkGetMacro(SliderShape, int);
110 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
111 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
113
115
120 vtkSetMacro(Rotation, double);
121 vtkGetMacro(Rotation, double);
123
125
129 vtkGetObjectMacro(SliderProperty, vtkProperty);
131
133
136 vtkGetObjectMacro(TubeProperty, vtkProperty);
137 vtkGetObjectMacro(CapProperty, vtkProperty);
139
141
145 vtkGetObjectMacro(SelectedProperty, vtkProperty);
147
149
152 void PlaceWidget(double bounds[6]) override;
153 void BuildRepresentation() override;
154 void StartWidgetInteraction(double eventPos[2]) override;
155 void WidgetInteraction(double newEventPos[2]) override;
156 void Highlight(int) override;
158
160
163 double* GetBounds() VTK_SIZEHINT(6) override;
164 void GetActors(vtkPropCollection*) override;
165 void ReleaseGraphicsResources(vtkWindow*) override;
166 int RenderOpaqueGeometry(vtkViewport*) override;
167 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
168 vtkTypeBool HasTranslucentPolygonalGeometry() override;
170
174 vtkMTimeType GetMTime() override;
175
176 /*
177 * Register internal Pickers within PickingManager
178 */
179 void RegisterPickers() override;
180
181protected:
184
185 // Positioning the widget
186 vtkCoordinate* Point1Coordinate;
187 vtkCoordinate* Point2Coordinate;
188 double Length;
189
190 // These are the slider end points taking into account the thickness
191 // of the slider
192 double SP1[3];
193 double SP2[3];
194
195 // More ivars controlling the appearance of the widget
196 double Rotation;
197 int SliderShape;
198
199 // Do the picking
201
202 // Determine the parameter t along the slider
203 virtual double ComputePickPosition(double eventPos[2]);
204
205 // The widget consists of several actors, all grouped
206 // together using an assembly. This makes it easier to
207 // perform the final transformation into
208 vtkAssembly* WidgetAssembly;
209
210 // Cylinder used by other objects
211 vtkCylinderSource* CylinderSource;
213
214 // The tube
215 vtkPolyDataMapper* TubeMapper;
216 vtkActor* TubeActor;
217 vtkProperty* TubeProperty;
218
219 // The slider
220 vtkSphereSource* SliderSource;
221 vtkPolyDataMapper* SliderMapper;
222 vtkActor* SliderActor;
223 vtkProperty* SliderProperty;
224 vtkProperty* SelectedProperty;
225
226 // The left cap
227 vtkPolyDataMapper* LeftCapMapper;
228 vtkActor* LeftCapActor;
229 vtkProperty* CapProperty;
230
231 // The right cap
232 vtkPolyDataMapper* RightCapMapper;
233 vtkActor* RightCapActor;
234
235 // The text. There is an extra transform used to rotate
236 // both the title and label
237 vtkVectorText* LabelText;
238 vtkPolyDataMapper* LabelMapper;
239 vtkActor* LabelActor;
240
241 vtkVectorText* TitleText;
242 vtkPolyDataMapper* TitleMapper;
243 vtkActor* TitleActor;
244
245 // Transform used during slider motion
247 vtkTransform* Transform;
248
249 // Manage the state of the widget
251 {
253 CylinderShape
254 };
255#if !defined(VTK_LEGACY_REMOVE)
256 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
258#endif
259
260private:
262 void operator=(const vtkSliderRepresentation3D&) = delete;
263};
264
265#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:73
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:73
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:80
generate a polygonal cylinder centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:68
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:61
create polygonal text
Definition: vtkVectorText.h:48
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)