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 =========================================================================*/
32 #ifndef vtkSliderRepresentation3D_h
33 #define vtkSliderRepresentation3D_h
34 
35 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
36 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
37 #include "vtkInteractionWidgetsModule.h" // For export macro
39 
40 class vtkActor;
41 class vtkPolyDataMapper;
42 class vtkSphereSource;
43 class vtkCellPicker;
44 class vtkProperty;
45 class vtkCylinderSource;
46 class vtkVectorText;
47 class vtkAssembly;
48 class vtkTransform;
50 class vtkMatrix4x4;
51 
52 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
53 {
54 public:
59 
61 
65  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
77  vtkCoordinate* GetPoint1Coordinate();
78  void SetPoint1InWorldCoordinates(double x, double y, double z);
80 
82 
90  vtkCoordinate* GetPoint2Coordinate();
91  void SetPoint2InWorldCoordinates(double x, double y, double z);
93 
95 
99  void SetTitleText(const char*) override;
100  const char* GetTitleText() override;
102 
104 
108  vtkSetClampMacro(SliderShape, int, SphereShape, CylinderShape);
109  vtkGetMacro(SliderShape, int);
110  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
111  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
113 
115 
120  vtkSetMacro(Rotation, double);
121  vtkGetMacro(Rotation, double);
123 
125 
129  vtkGetObjectMacro(SliderProperty, vtkProperty);
131 
133 
136  vtkGetObjectMacro(TubeProperty, vtkProperty);
137  vtkGetObjectMacro(CapProperty, vtkProperty);
139 
141 
145  vtkGetObjectMacro(SelectedProperty, vtkProperty);
147 
149 
152  void PlaceWidget(double bounds[6]) override;
153  void BuildRepresentation() override;
154  void StartWidgetInteraction(double eventPos[2]) override;
155  void WidgetInteraction(double newEventPos[2]) override;
156  void Highlight(int) override;
158 
160 
163  double* GetBounds() VTK_SIZEHINT(6) override;
164  void GetActors(vtkPropCollection*) override;
165  void ReleaseGraphicsResources(vtkWindow*) override;
166  int RenderOpaqueGeometry(vtkViewport*) override;
167  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
168  vtkTypeBool HasTranslucentPolygonalGeometry() override;
170 
174  vtkMTimeType GetMTime() override;
175 
176  /*
177  * Register internal Pickers within PickingManager
178  */
179  void RegisterPickers() override;
180 
181 protected:
183  ~vtkSliderRepresentation3D() override;
184 
185  // Positioning the widget
186  vtkCoordinate* Point1Coordinate;
187  vtkCoordinate* Point2Coordinate;
188  double Length;
189 
190  // These are the slider end points taking into account the thickness
191  // of the slider
192  double SP1[3];
193  double SP2[3];
194 
195  // More ivars controlling the appearance of the widget
196  double Rotation;
197  int SliderShape;
198 
199  // Do the picking
200  vtkCellPicker* Picker;
201 
202  // Determine the parameter t along the slider
203  virtual double ComputePickPosition(double eventPos[2]);
204 
205  // The widget consists of several actors, all grouped
206  // together using an assembly. This makes it easier to
207  // perform the final transformation into
208  vtkAssembly* WidgetAssembly;
209 
210  // Cylinder used by other objects
211  vtkCylinderSource* CylinderSource;
213 
214  // The tube
215  vtkPolyDataMapper* TubeMapper;
216  vtkActor* TubeActor;
217  vtkProperty* TubeProperty;
218 
219  // The slider
220  vtkSphereSource* SliderSource;
221  vtkPolyDataMapper* SliderMapper;
222  vtkActor* SliderActor;
223  vtkProperty* SliderProperty;
224  vtkProperty* SelectedProperty;
225 
226  // The left cap
227  vtkPolyDataMapper* LeftCapMapper;
228  vtkActor* LeftCapActor;
229  vtkProperty* CapProperty;
230 
231  // The right cap
232  vtkPolyDataMapper* RightCapMapper;
233  vtkActor* RightCapActor;
234 
235  // The text. There is an extra transform used to rotate
236  // both the title and label
237  vtkVectorText* LabelText;
238  vtkPolyDataMapper* LabelMapper;
239  vtkActor* LabelActor;
240 
241  vtkVectorText* TitleText;
242  vtkPolyDataMapper* TitleMapper;
243  vtkActor* TitleActor;
244 
245  // Transform used during slider motion
246  vtkMatrix4x4* Matrix;
248 
249  // Manage the state of the widget
251  {
253  CylinderShape
254  };
255 #if !defined(VTK_LEGACY_REMOVE)
256  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
258 #endif
259 
260 private:
262  void operator=(const vtkSliderRepresentation3D&) = delete;
263 };
264 
265 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
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:287
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
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:60
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:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
create a polygonal sphere centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:39
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:79
abstract class defines the representation for a vtkSliderWidget
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:72
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:72
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:47