VTK  9.1.0
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=========================================================================*/
38#ifndef vtkSliderRepresentation3D_h
39#define vtkSliderRepresentation3D_h
40
41#include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
42#include "vtkInteractionWidgetsModule.h" // For export macro
44
45class vtkActor;
47class vtkSphereSource;
48class vtkCellPicker;
49class vtkProperty;
51class vtkVectorText;
52class vtkAssembly;
53class vtkTransform;
55class vtkMatrix4x4;
56
57class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
58{
59public:
64
66
70 void PrintSelf(ostream& os, vtkIndent indent) override;
72
74
83 void SetPoint1InWorldCoordinates(double x, double y, double z);
85
87
96 void SetPoint2InWorldCoordinates(double x, double y, double z);
98
100
104 void SetTitleText(const char*) override;
105 const char* GetTitleText() override;
107
109
113 vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
114 vtkGetMacro(SliderShape, int);
115 void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
116 void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
118
120
125 vtkSetMacro(Rotation, double);
126 vtkGetMacro(Rotation, double);
128
130
134 vtkGetObjectMacro(SliderProperty, vtkProperty);
136
138
141 vtkGetObjectMacro(TubeProperty, vtkProperty);
142 vtkGetObjectMacro(CapProperty, vtkProperty);
144
146
150 vtkGetObjectMacro(SelectedProperty, vtkProperty);
152
154
157 void PlaceWidget(double bounds[6]) override;
158 void BuildRepresentation() override;
159 void StartWidgetInteraction(double eventPos[2]) override;
160 void WidgetInteraction(double newEventPos[2]) override;
161 void Highlight(int) override;
163
165
168 double* GetBounds() VTK_SIZEHINT(6) override;
169 void GetActors(vtkPropCollection*) override;
170 void ReleaseGraphicsResources(vtkWindow*) override;
171 int RenderOpaqueGeometry(vtkViewport*) override;
172 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
173 vtkTypeBool HasTranslucentPolygonalGeometry() override;
175
179 vtkMTimeType GetMTime() override;
180
181 /*
182 * Register internal Pickers within PickingManager
183 */
184 void RegisterPickers() override;
185
186protected:
189
190 // Positioning the widget
191 vtkCoordinate* Point1Coordinate;
192 vtkCoordinate* Point2Coordinate;
193 double Length;
194
195 // These are the slider end points taking into account the thickness
196 // of the slider
197 double SP1[3];
198 double SP2[3];
199
200 // More ivars controlling the appearance of the widget
201 double Rotation;
202 int SliderShape;
203
204 // Do the picking
206
207 // Determine the parameter t along the slider
208 virtual double ComputePickPosition(double eventPos[2]);
209
210 // The widget consists of several actors, all grouped
211 // together using an assembly. This makes it easier to
212 // perform the final transformation into
213 vtkAssembly* WidgetAssembly;
214
215 // Cylinder used by other objects
216 vtkCylinderSource* CylinderSource;
218
219 // The tube
220 vtkPolyDataMapper* TubeMapper;
221 vtkActor* TubeActor;
222 vtkProperty* TubeProperty;
223
224 // The slider
225 vtkSphereSource* SliderSource;
226 vtkPolyDataMapper* SliderMapper;
227 vtkActor* SliderActor;
228 vtkProperty* SliderProperty;
229 vtkProperty* SelectedProperty;
230
231 // The left cap
232 vtkPolyDataMapper* LeftCapMapper;
233 vtkActor* LeftCapActor;
234 vtkProperty* CapProperty;
235
236 // The right cap
237 vtkPolyDataMapper* RightCapMapper;
238 vtkActor* RightCapActor;
239
240 // The text. There is an extra transform used to rotate
241 // both the title and label
242 vtkVectorText* LabelText;
243 vtkPolyDataMapper* LabelMapper;
244 vtkActor* LabelActor;
245
246 vtkVectorText* TitleText;
247 vtkPolyDataMapper* TitleMapper;
248 vtkActor* TitleActor;
249
250 // Transform used during slider motion
253
254 // Manage the state of the widget
256 {
258 CylinderShape
259 };
260
261private:
263 void operator=(const vtkSliderRepresentation3D&) = delete;
264};
265
266#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:55
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:79
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:76
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:86
generate a cylinder centered at origin
a simple class to control print indentation
Definition: vtkIndent.h:43
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:45
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:71
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:64
create polygonal text
Definition: vtkVectorText.h:51
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ Cylinder
Definition: vtkX3D.h:91
@ Transform
Definition: vtkX3D.h:47
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)