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 =========================================================================*/
41 #ifndef vtkSliderRepresentation3D_h
42 #define vtkSliderRepresentation3D_h
43 
44 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
45 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
46 #include "vtkInteractionWidgetsModule.h" // For export macro
48 
49 class vtkActor;
50 class vtkPolyDataMapper;
51 class vtkSphereSource;
52 class vtkCellPicker;
53 class vtkProperty;
54 class vtkCylinderSource;
55 class vtkVectorText;
56 class vtkAssembly;
57 class vtkTransform;
59 class vtkMatrix4x4;
60 
61 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
62 {
63 public:
68 
70 
74  void PrintSelf(ostream& os, vtkIndent indent) override;
76 
78 
87  void SetPoint1InWorldCoordinates(double x, double y, double z);
89 
91 
100  void SetPoint2InWorldCoordinates(double x, double y, double z);
102 
104 
108  void SetTitleText(const char*) override;
109  const char* GetTitleText() override;
111 
113 
117  vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
118  vtkGetMacro(SliderShape, int);
119  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
120  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
122 
124 
129  vtkSetMacro(Rotation, double);
130  vtkGetMacro(Rotation, double);
132 
134 
138  vtkGetObjectMacro(SliderProperty, vtkProperty);
140 
142 
145  vtkGetObjectMacro(TubeProperty, vtkProperty);
146  vtkGetObjectMacro(CapProperty, vtkProperty);
148 
150 
154  vtkGetObjectMacro(SelectedProperty, vtkProperty);
156 
158 
161  void PlaceWidget(double bounds[6]) override;
162  void BuildRepresentation() override;
163  void StartWidgetInteraction(double eventPos[2]) override;
164  void WidgetInteraction(double newEventPos[2]) override;
165  void Highlight(int) override;
167 
169 
172  double* GetBounds() VTK_SIZEHINT(6) override;
173  void GetActors(vtkPropCollection*) override;
174  void ReleaseGraphicsResources(vtkWindow*) override;
175  int RenderOpaqueGeometry(vtkViewport*) override;
176  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
177  vtkTypeBool HasTranslucentPolygonalGeometry() override;
179 
183  vtkMTimeType GetMTime() override;
184 
185  /*
186  * Register internal Pickers within PickingManager
187  */
188  void RegisterPickers() override;
189 
190 protected:
193 
194  // Positioning the widget
195  vtkCoordinate* Point1Coordinate;
196  vtkCoordinate* Point2Coordinate;
197  double Length;
198 
199  // These are the slider end points taking into account the thickness
200  // of the slider
201  double SP1[3];
202  double SP2[3];
203 
204  // More ivars controlling the appearance of the widget
205  double Rotation;
206  int SliderShape;
207 
208  // Do the picking
209  vtkCellPicker* Picker;
210 
211  // Determine the parameter t along the slider
212  virtual double ComputePickPosition(double eventPos[2]);
213 
214  // The widget consists of several actors, all grouped
215  // together using an assembly. This makes it easier to
216  // perform the final transformation into
217  vtkAssembly* WidgetAssembly;
218 
219  // Cylinder used by other objects
220  vtkCylinderSource* CylinderSource;
222 
223  // The tube
224  vtkPolyDataMapper* TubeMapper;
225  vtkActor* TubeActor;
226  vtkProperty* TubeProperty;
227 
228  // The slider
229  vtkSphereSource* SliderSource;
230  vtkPolyDataMapper* SliderMapper;
231  vtkActor* SliderActor;
232  vtkProperty* SliderProperty;
233  vtkProperty* SelectedProperty;
234 
235  // The left cap
236  vtkPolyDataMapper* LeftCapMapper;
237  vtkActor* LeftCapActor;
238  vtkProperty* CapProperty;
239 
240  // The right cap
241  vtkPolyDataMapper* RightCapMapper;
242  vtkActor* RightCapActor;
243 
244  // The text. There is an extra transform used to rotate
245  // both the title and label
246  vtkVectorText* LabelText;
247  vtkPolyDataMapper* LabelMapper;
248  vtkActor* LabelActor;
249 
250  vtkVectorText* TitleText;
251  vtkPolyDataMapper* TitleMapper;
252  vtkActor* TitleActor;
253 
254  // Transform used during slider motion
255  vtkMatrix4x4* Matrix;
257 
258  // Manage the state of the widget
260  {
262  CylinderShape
263  };
264 #if !defined(VTK_LEGACY_REMOVE)
265  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
267 #endif
268 
269 private:
271  void operator=(const vtkSliderRepresentation3D&) = delete;
272 };
273 
274 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:61
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:82
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:82
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:89
generate a polygonal cylinder centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:49
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:51
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:77
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.
void Highlight(int) override
Methods to interface with the vtkSliderWidget.
vtkCoordinate * GetPoint2Coordinate()
Position the second end point of the slider.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkSliderWidget.
static vtkSliderRepresentation3D * New()
Instantiate the class.
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkSliderWidget.
vtkCoordinate * GetPoint1Coordinate()
Position the first end point of the slider.
double * GetBounds() override
Methods supporting the rendering process.
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.
const char * GetTitleText() override
Specify the title text for this widget.
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.
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:70
create polygonal text
Definition: vtkVectorText.h:57
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ Cylinder
Definition: vtkX3D.h:91
@ Transform
Definition: vtkX3D.h:47
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)