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
20 #ifndef vtkSliderRepresentation3D_h
21 #define vtkSliderRepresentation3D_h
22 
23 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
24 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
25 #include "vtkInteractionWidgetsModule.h" // For export macro
26 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkActor;
31 class vtkPolyDataMapper;
32 class vtkSphereSource;
33 class vtkCellPicker;
34 class vtkProperty;
35 class vtkCylinderSource;
36 class vtkVectorText;
37 class vtkAssembly;
38 class vtkTransform;
40 class vtkMatrix4x4;
41 
42 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
43 {
44 public:
49 
51 
55  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
59 
67  vtkCoordinate* GetPoint1Coordinate();
68  void SetPoint1InWorldCoordinates(double x, double y, double z);
70 
72 
80  vtkCoordinate* GetPoint2Coordinate();
81  void SetPoint2InWorldCoordinates(double x, double y, double z);
83 
85 
89  void SetTitleText(const char*) override;
90  const char* GetTitleText() override;
92 
94 
98  vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
99  vtkGetMacro(SliderShape, int);
100  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
101  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
103 
105 
110  vtkSetMacro(Rotation, double);
111  vtkGetMacro(Rotation, double);
113 
115 
119  vtkGetObjectMacro(SliderProperty, vtkProperty);
121 
123 
126  vtkGetObjectMacro(TubeProperty, vtkProperty);
127  vtkGetObjectMacro(CapProperty, vtkProperty);
129 
131 
135  vtkGetObjectMacro(SelectedProperty, vtkProperty);
137 
139 
142  void PlaceWidget(double bounds[6]) override;
143  void BuildRepresentation() override;
144  void StartWidgetInteraction(double eventPos[2]) override;
145  void WidgetInteraction(double newEventPos[2]) override;
146  void Highlight(int) override;
148 
150 
153  double* GetBounds() VTK_SIZEHINT(6) override;
154  void GetActors(vtkPropCollection* propCollection) override;
155  void ReleaseGraphicsResources(vtkWindow* window) override;
156  int RenderOpaqueGeometry(vtkViewport* viewport) override;
157  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
158  vtkTypeBool HasTranslucentPolygonalGeometry() override;
160 
164  vtkMTimeType GetMTime() override;
165 
166  /*
167  * Register internal Pickers within PickingManager
168  */
169  void RegisterPickers() override;
170 
171 protected:
173  ~vtkSliderRepresentation3D() override;
174 
175  // Positioning the widget
176  vtkCoordinate* Point1Coordinate;
177  vtkCoordinate* Point2Coordinate;
178  double Length;
179 
180  // These are the slider end points taking into account the thickness
181  // of the slider
182  double SP1[3];
183  double SP2[3];
184 
185  // More ivars controlling the appearance of the widget
186  double Rotation;
187  int SliderShape;
188 
189  // Do the picking
190  vtkCellPicker* Picker;
191 
192  // Determine the parameter t along the slider
193  virtual double ComputePickPosition(double eventPos[2]);
194 
195  // The widget consists of several actors, all grouped
196  // together using an assembly. This makes it easier to
197  // perform the final transformation into
198  vtkAssembly* WidgetAssembly;
199 
200  // Cylinder used by other objects
201  vtkCylinderSource* CylinderSource;
203 
204  // The tube
205  vtkPolyDataMapper* TubeMapper;
206  vtkActor* TubeActor;
207  vtkProperty* TubeProperty;
208 
209  // The slider
210  vtkSphereSource* SliderSource;
211  vtkPolyDataMapper* SliderMapper;
212  vtkActor* SliderActor;
213  vtkProperty* SliderProperty;
214  vtkProperty* SelectedProperty;
215 
216  // The left cap
217  vtkPolyDataMapper* LeftCapMapper;
218  vtkActor* LeftCapActor;
219  vtkProperty* CapProperty;
220 
221  // The right cap
222  vtkPolyDataMapper* RightCapMapper;
223  vtkActor* RightCapActor;
224 
225  // The text. There is an extra transform used to rotate
226  // both the title and label
227  vtkVectorText* LabelText;
228  vtkPolyDataMapper* LabelMapper;
229  vtkActor* LabelActor;
230 
231  vtkVectorText* TitleText;
232  vtkPolyDataMapper* TitleMapper;
233  vtkActor* TitleActor;
234 
235  // Transform used during slider motion
236  vtkMatrix4x4* Matrix;
238 
239  // Manage the state of the widget
241  {
243  CylinderShape
244  };
245 #if !defined(VTK_LEGACY_REMOVE)
246  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
248 #endif
249 
250 private:
252  void operator=(const vtkSliderRepresentation3D&) = delete;
253 };
254 
255 VTK_ABI_NAMESPACE_END
256 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:30
virtual void PlaceWidget(double vtkNotUsed(bounds)[6])
The following is a suggested API for widget representations.
generate a polygonal cylinder centered at the origin
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual void StartWidgetInteraction(double eventPos[2])
void SetSliderShapeToCylinder()
Specify whether to use a sphere or cylinder slider shape.
#define VTK_DEPRECATED_IN_9_2_0(reason)
void SetSliderShapeToSphere()
Specify whether to use a sphere or cylinder slider shape.
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:49
virtual void SetTitleText(const char *)
Specify the label text for this widget.
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
create a polygonal sphere centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:28
provide the representation for a vtkSliderWidget with a 3D skin
virtual void WidgetInteraction(double newEventPos[2])
#define VTK_SIZEHINT(...)
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:68
abstract class defines the representation for a vtkSliderWidget
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:61
map vtkPolyData to graphics primitives
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:61
virtual void Highlight(int vtkNotUsed(highlightOn))
virtual const char * GetTitleText()
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
create polygonal text
Definition: vtkVectorText.h:36