VTK: Interaction/Widgets/vtkSliderRepresentation3D.h Source File

| VTK 9.3.1

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
36 #include "vtkSliderRepresentation.h"
37
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkActor;
40 class vtkPolyDataMapper;
41 class vtkSphereSource;
42 class vtkCellPicker;
43 class vtkProperty;
44 class vtkCylinderSource;
45 class vtkVectorText;
46 class vtkAssembly;
47 class vtkTransform;
48 class vtkTransformPolyDataFilter;
49 class vtkMatrix4x4;
50
51 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
52 {
53 public:
57 static vtkSliderRepresentation3D* New();
58
60
63 vtkTypeMacro(vtkSliderRepresentation3D, vtkSliderRepresentation);
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
76 vtkCoordinate* GetPoint1Coordinate();
77 void SetPoint1InWorldCoordinates(double x, double y, double z);
79
81
89 vtkCoordinate* GetPoint2Coordinate();
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
180 protected:
181 vtkSliderRepresentation3D();
182 ~vtkSliderRepresentation3D() override;
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
199 vtkCellPicker* Picker;
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;
211 vtkTransformPolyDataFilter* Cylinder;
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
245 vtkMatrix4x4* Matrix;
246 vtkTransform* Transform;
247
248 // Manage the state of the widget
249 enum SliderShapeType
250 {
251 SphereShape,
252 CylinderShape
253 };
254 #if !defined(VTK_LEGACY_REMOVE)
255 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
256 typedef SliderShapeType _SliderShape;
257 #endif
258
259 private:
260 vtkSliderRepresentation3D(const vtkSliderRepresentation3D&) = delete;
261 void operator=(const vtkSliderRepresentation3D&) = delete;
262 };
263
264 VTK_ABI_NAMESPACE_END
265 #endif
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
vtkAssembly
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:71
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:71
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:78
vtkCylinderSource
generate a polygonal cylinder centered at the origin
Definition: vtkCylinderSource.h:47
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:37
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:66
vtkSliderRepresentation3D
provide the representation for a vtkSliderWidget with a 3D skin
Definition: vtkSliderRepresentation3D.h:52
vtkSliderRepresentation3D::BuildRepresentation
void BuildRepresentation() override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::SetPoint2InWorldCoordinates
void SetPoint2InWorldCoordinates(double x, double y, double z)
Position the second end point of the slider.
vtkSliderRepresentation3D::Highlight
void Highlight(int) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::GetPoint2Coordinate
vtkCoordinate * GetPoint2Coordinate()
Position the second end point of the slider.
vtkSliderRepresentation3D::WidgetInteraction
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::New
static vtkSliderRepresentation3D * New()
Instantiate the class.
vtkSliderRepresentation3D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::GetPoint1Coordinate
vtkCoordinate * GetPoint1Coordinate()
Position the first end point of the slider.
vtkSliderRepresentation3D::GetBounds
double * GetBounds() override
Methods supporting the rendering process.
vtkSliderRepresentation3D::SetSliderShapeToCylinder
void SetSliderShapeToCylinder()
Specify whether to use a sphere or cylinder slider shape.
Definition: vtkSliderRepresentation3D.h:110
vtkSliderRepresentation3D::SliderShapeType
SliderShapeType
Definition: vtkSliderRepresentation3D.h:250
vtkSliderRepresentation3D::SphereShape
@ SphereShape
Definition: vtkSliderRepresentation3D.h:251
vtkSliderRepresentation3D::PlaceWidget
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkSliderWidget.
vtkSliderRepresentation3D::SetTitleText
void SetTitleText(const char *) override
Specify the title text for this widget.
vtkSliderRepresentation3D::GetTitleText
const char * GetTitleText() override
Specify the title text for this widget.
vtkSliderRepresentation3D::SetPoint1InWorldCoordinates
void SetPoint1InWorldCoordinates(double x, double y, double z)
Position the first end point of the slider.
vtkSliderRepresentation3D::SetSliderShapeToSphere
void SetSliderShapeToSphere()
Specify whether to use a sphere or cylinder slider shape.
Definition: vtkSliderRepresentation3D.h:109
vtkSliderRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
vtkSliderRepresentation
abstract class defines the representation for a vtkSliderWidget
Definition: vtkSliderRepresentation.h:42
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:44
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:47
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
vtkVectorText
create polygonal text
Definition: vtkVectorText.h:46
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::Cylinder
@ Cylinder
Definition: vtkX3D.h:85
vtkX3D::Transform
@ Transform
Definition: vtkX3D.h:41
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkCoordinate.h
vtkDeprecation.h
VTK_DEPRECATED_IN_9_2_0
#define VTK_DEPRECATED_IN_9_2_0(reason)
Definition: vtkDeprecation.h:108
vtkSliderRepresentation.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:36