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 =========================================================================*/
61 #ifndef vtkSliderRepresentation3D_h
62 #define vtkSliderRepresentation3D_h
63 
64 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
65 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
66 #include "vtkInteractionWidgetsModule.h" // For export macro
68 
69 class vtkActor;
70 class vtkPolyDataMapper;
71 class vtkSphereSource;
72 class vtkCellPicker;
73 class vtkProperty;
74 class vtkCylinderSource;
75 class vtkVectorText;
76 class vtkAssembly;
77 class vtkTransform;
79 class vtkMatrix4x4;
80 
81 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
82 {
83 public:
88 
90 
94  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
98 
107  void SetPoint1InWorldCoordinates(double x, double y, double z);
109 
111 
120  void SetPoint2InWorldCoordinates(double x, double y, double z);
122 
124 
128  void SetTitleText(const char*) override;
129  const char* GetTitleText() override;
131 
133 
137  vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
138  vtkGetMacro(SliderShape, int);
139  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
140  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
142 
144 
149  vtkSetMacro(Rotation, double);
150  vtkGetMacro(Rotation, double);
152 
154 
158  vtkGetObjectMacro(SliderProperty, vtkProperty);
160 
162 
165  vtkGetObjectMacro(TubeProperty, vtkProperty);
166  vtkGetObjectMacro(CapProperty, vtkProperty);
168 
170 
174  vtkGetObjectMacro(SelectedProperty, vtkProperty);
176 
178 
181  void PlaceWidget(double bounds[6]) override;
182  void BuildRepresentation() override;
183  void StartWidgetInteraction(double eventPos[2]) override;
184  void WidgetInteraction(double newEventPos[2]) override;
185  void Highlight(int) override;
187 
189 
192  double* GetBounds() VTK_SIZEHINT(6) override;
193  void GetActors(vtkPropCollection*) override;
194  void ReleaseGraphicsResources(vtkWindow*) override;
195  int RenderOpaqueGeometry(vtkViewport*) override;
196  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
197  vtkTypeBool HasTranslucentPolygonalGeometry() override;
199 
203  vtkMTimeType GetMTime() override;
204 
205  /*
206  * Register internal Pickers within PickingManager
207  */
208  void RegisterPickers() override;
209 
210 protected:
213 
214  // Positioning the widget
215  vtkCoordinate* Point1Coordinate;
216  vtkCoordinate* Point2Coordinate;
217  double Length;
218 
219  // These are the slider end points taking into account the thickness
220  // of the slider
221  double SP1[3];
222  double SP2[3];
223 
224  // More ivars controlling the appearance of the widget
225  double Rotation;
226  int SliderShape;
227 
228  // Do the picking
229  vtkCellPicker* Picker;
230 
231  // Determine the parameter t along the slider
232  virtual double ComputePickPosition(double eventPos[2]);
233 
234  // The widget consists of several actors, all grouped
235  // together using an assembly. This makes it easier to
236  // perform the final transformation into
237  vtkAssembly* WidgetAssembly;
238 
239  // Cylinder used by other objects
240  vtkCylinderSource* CylinderSource;
242 
243  // The tube
244  vtkPolyDataMapper* TubeMapper;
245  vtkActor* TubeActor;
246  vtkProperty* TubeProperty;
247 
248  // The slider
249  vtkSphereSource* SliderSource;
250  vtkPolyDataMapper* SliderMapper;
251  vtkActor* SliderActor;
252  vtkProperty* SliderProperty;
253  vtkProperty* SelectedProperty;
254 
255  // The left cap
256  vtkPolyDataMapper* LeftCapMapper;
257  vtkActor* LeftCapActor;
258  vtkProperty* CapProperty;
259 
260  // The right cap
261  vtkPolyDataMapper* RightCapMapper;
262  vtkActor* RightCapActor;
263 
264  // The text. There is an extra transform used to rotate
265  // both the title and label
266  vtkVectorText* LabelText;
267  vtkPolyDataMapper* LabelMapper;
268  vtkActor* LabelActor;
269 
270  vtkVectorText* TitleText;
271  vtkPolyDataMapper* TitleMapper;
272  vtkActor* TitleActor;
273 
274  // Transform used during slider motion
275  vtkMatrix4x4* Matrix;
277 
278  // Manage the state of the widget
280  {
282  CylinderShape
283  };
284 #if !defined(VTK_LEGACY_REMOVE)
285  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
287 #endif
288 
289 private:
291  void operator=(const vtkSliderRepresentation3D&) = delete;
292 };
293 
294 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:112
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:119
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
map vtkPolyData to graphics primitives
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:177
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:170
create polygonal text
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ 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(...)