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 =========================================================================*/
34 #ifndef __vtkSliderRepresentation3D_h
35 #define __vtkSliderRepresentation3D_h
36 
37 #include "vtkInteractionWidgetsModule.h" // For export macro
39 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
40 
41 class vtkActor;
42 class vtkPolyDataMapper;
43 class vtkSphereSource;
44 class vtkCellPicker;
45 class vtkProperty;
46 class vtkCylinderSource;
47 class vtkVectorText;
48 class vtkAssembly;
49 class vtkTransform;
51 class vtkMatrix4x4;
52 
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
55 {
56 public:
59 
61 
63  void PrintSelf(ostream& os, vtkIndent indent);
65 
67 
73  vtkCoordinate *GetPoint1Coordinate();
74  void SetPoint1InWorldCoordinates(double x, double y, double z);
76 
78 
84  vtkCoordinate *GetPoint2Coordinate();
85  void SetPoint2InWorldCoordinates(double x, double y, double z);
87 
89 
91  virtual void SetTitleText(const char*);
92  virtual const char* GetTitleText();
94 
96 
98  vtkSetClampMacro(SliderShape,int,SphereShape,CylinderShape);
99  vtkGetMacro(SliderShape, int);
100  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
101  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
103 
105 
108  vtkSetMacro(Rotation,double);
109  vtkGetMacro(Rotation,double);
111 
113 
115  vtkGetObjectMacro(SliderProperty,vtkProperty);
117 
119 
120  vtkGetObjectMacro(TubeProperty,vtkProperty);
121  vtkGetObjectMacro(CapProperty,vtkProperty);
123 
125 
127  vtkGetObjectMacro(SelectedProperty,vtkProperty);
129 
131 
132  virtual void PlaceWidget(double bounds[6]);
133  virtual void BuildRepresentation();
134  virtual void StartWidgetInteraction(double eventPos[2]);
135  virtual void WidgetInteraction(double newEventPos[2]);
136  virtual void Highlight(int);
138 
140 
141  virtual double *GetBounds();
142  virtual void GetActors(vtkPropCollection*);
143  virtual void ReleaseGraphicsResources(vtkWindow*);
144  virtual int RenderOpaqueGeometry(vtkViewport*);
146  virtual int HasTranslucentPolygonalGeometry();
148 
150  virtual unsigned long GetMTime();
151 
152 protected:
155 
156  // Positioning the widget
159  double Length;
160 
161  // These are the slider end points taking into account the thickness
162  // of the slider
163  double SP1[3];
164  double SP2[3];
165 
166  // More ivars controlling the appearance of the widget
167  double Rotation;
169 
170  // Do the picking
172 
173  // Determine the parameter t along the slider
174  virtual double ComputePickPosition(double eventPos[2]);
175 
176  // The widget consists of several actors, all grouped
177  // together using an assembly. This makes it easier to
178  // perform the final transformation into
180 
181  // Cylinder used by other objects
184 
185  // The tube
189 
190  // The slider
196 
197  // The left cap
201 
202  // The right cap
205 
206  // The text. There is an extra transform used to rotate
207  // both the title and label
211 
215 
216  // Transform used during slider motion
219 
220 //BTX - manage the state of the widget
223  CylinderShape
224  };
225 
226 //ETX
227 
228 
229 private:
230  vtkSliderRepresentation3D(const vtkSliderRepresentation3D&); //Not implemented
231  void operator=(const vtkSliderRepresentation3D&); //Not implemented
232 };
233 
234 #endif