VTK
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 =========================================================================*/
29 #ifndef vtkSliderRepresentation3D_h
30 #define vtkSliderRepresentation3D_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
35 
36 class vtkActor;
37 class vtkPolyDataMapper;
38 class vtkSphereSource;
39 class vtkCellPicker;
40 class vtkProperty;
41 class vtkCylinderSource;
42 class vtkVectorText;
43 class vtkAssembly;
44 class vtkTransform;
46 class vtkMatrix4x4;
47 
48 
49 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
50 {
51 public:
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
64 
66 
74  vtkCoordinate *GetPoint1Coordinate();
75  void SetPoint1InWorldCoordinates(double x, double y, double z);
77 
79 
87  vtkCoordinate *GetPoint2Coordinate();
88  void SetPoint2InWorldCoordinates(double x, double y, double z);
90 
92 
96  void SetTitleText(const char*) VTK_OVERRIDE;
97  const char* GetTitleText() VTK_OVERRIDE;
99 
101 
105  vtkSetClampMacro(SliderShape,int,SphereShape,CylinderShape);
106  vtkGetMacro(SliderShape, int);
107  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
108  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
110 
112 
117  vtkSetMacro(Rotation,double);
118  vtkGetMacro(Rotation,double);
120 
122 
126  vtkGetObjectMacro(SliderProperty,vtkProperty);
128 
130 
133  vtkGetObjectMacro(TubeProperty,vtkProperty);
134  vtkGetObjectMacro(CapProperty,vtkProperty);
136 
138 
142  vtkGetObjectMacro(SelectedProperty,vtkProperty);
144 
146 
149  void PlaceWidget(double bounds[6]) VTK_OVERRIDE;
150  void BuildRepresentation() VTK_OVERRIDE;
151  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
152  void WidgetInteraction(double newEventPos[2]) VTK_OVERRIDE;
153  void Highlight(int) VTK_OVERRIDE;
155 
157 
160  double *GetBounds() VTK_OVERRIDE;
161  void GetActors(vtkPropCollection*) VTK_OVERRIDE;
162  void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
163  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
164  int RenderTranslucentPolygonalGeometry(vtkViewport*) VTK_OVERRIDE;
165  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
167 
171  vtkMTimeType GetMTime() VTK_OVERRIDE;
172 
173 protected:
175  ~vtkSliderRepresentation3D() VTK_OVERRIDE;
176 
177  // Positioning the widget
178  vtkCoordinate *Point1Coordinate;
179  vtkCoordinate *Point2Coordinate;
180  double Length;
181 
182  // These are the slider end points taking into account the thickness
183  // of the slider
184  double SP1[3];
185  double SP2[3];
186 
187  // More ivars controlling the appearance of the widget
188  double Rotation;
189  int SliderShape;
190 
191  // Do the picking
192  vtkCellPicker *Picker;
193 
194  // Register internal Pickers within PickingManager
195  void RegisterPickers() VTK_OVERRIDE;
196 
197  // Determine the parameter t along the slider
198  virtual double ComputePickPosition(double eventPos[2]);
199 
200  // The widget consists of several actors, all grouped
201  // together using an assembly. This makes it easier to
202  // perform the final transformation into
203  vtkAssembly *WidgetAssembly;
204 
205  // Cylinder used by other objects
206  vtkCylinderSource *CylinderSource;
208 
209  // The tube
210  vtkPolyDataMapper *TubeMapper;
211  vtkActor *TubeActor;
212  vtkProperty *TubeProperty;
213 
214  // The slider
215  vtkSphereSource *SliderSource;
216  vtkPolyDataMapper *SliderMapper;
217  vtkActor *SliderActor;
218  vtkProperty *SliderProperty;
219  vtkProperty *SelectedProperty;
220 
221  // The left cap
222  vtkPolyDataMapper *LeftCapMapper;
223  vtkActor *LeftCapActor;
224  vtkProperty *CapProperty;
225 
226  // The right cap
227  vtkPolyDataMapper *RightCapMapper;
228  vtkActor *RightCapActor;
229 
230  // The text. There is an extra transform used to rotate
231  // both the title and label
232  vtkVectorText *LabelText;
233  vtkPolyDataMapper *LabelMapper;
234  vtkActor *LabelActor;
235 
236  vtkVectorText *TitleText;
237  vtkPolyDataMapper *TitleMapper;
238  vtkActor *TitleActor;
239 
240  // Transform used during slider motion
241  vtkMatrix4x4 *Matrix;
243 
244  // Manage the state of the widget
247  CylinderShape
248  };
249 
250 
251 
252 private:
253  vtkSliderRepresentation3D(const vtkSliderRepresentation3D&) VTK_DELETE_FUNCTION;
254  void operator=(const vtkSliderRepresentation3D&) VTK_DELETE_FUNCTION;
255 };
256 
257 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
generate a cylinder centered at origin
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
void SetSliderShapeToCylinder()
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:54
virtual void SetTitleText(const char *)
Specify the label text for this widget.
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
create a polygonal sphere centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:33
provide the representation for a vtkSliderWidget with a 3D skin
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:72
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
abstract class defines the representation for a vtkSliderWidget
create hierarchies of vtkProp3Ds (transformable props)
Definition: vtkAssembly.h:69
map vtkPolyData to graphics primitives
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
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:41
Transform
Definition: ADIOSDefs.h:39