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 
38 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
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 
54 {
55 public:
58 
60 
62  void PrintSelf(ostream& os, vtkIndent indent);
64 
66 
72  vtkCoordinate *GetPoint1Coordinate();
73  void SetPoint1InWorldCoordinates(double x, double y, double z);
75 
77 
83  vtkCoordinate *GetPoint2Coordinate();
84  void SetPoint2InWorldCoordinates(double x, double y, double z);
86 
88 
90  virtual void SetTitleText(const char*);
91  virtual const char* GetTitleText();
93 
95 
97  vtkSetClampMacro(SliderShape,int,SphereShape,CylinderShape);
98  vtkGetMacro(SliderShape, int);
99  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
100  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
102 
104 
107  vtkSetMacro(Rotation,double);
108  vtkGetMacro(Rotation,double);
110 
112 
114  vtkGetObjectMacro(SliderProperty,vtkProperty);
116 
118 
119  vtkGetObjectMacro(TubeProperty,vtkProperty);
120  vtkGetObjectMacro(CapProperty,vtkProperty);
122 
124 
126  vtkGetObjectMacro(SelectedProperty,vtkProperty);
128 
130 
131  virtual void PlaceWidget(double bounds[6]);
132  virtual void BuildRepresentation();
133  virtual void StartWidgetInteraction(double eventPos[2]);
134  virtual void WidgetInteraction(double newEventPos[2]);
135  virtual void Highlight(int);
137 
139 
140  virtual double *GetBounds();
141  virtual void GetActors(vtkPropCollection*);
142  virtual void ReleaseGraphicsResources(vtkWindow*);
143  virtual int RenderOpaqueGeometry(vtkViewport*);
145  virtual int HasTranslucentPolygonalGeometry();
147 
149  virtual unsigned long GetMTime();
150 
151 protected:
154 
155  // Positioning the widget
158  double Length;
159 
160  // These are the slider end points taking into account the thickness
161  // of the slider
162  double SP1[3];
163  double SP2[3];
164 
165  // More ivars controlling the appearance of the widget
166  double Rotation;
168 
169  // Do the picking
171 
172  // Determine the parameter t along the slider
173  virtual double ComputePickPosition(double eventPos[2]);
174 
175  // The widget consists of several actors, all grouped
176  // together using an assembly. This makes it easier to
177  // perform the final transformation into
179 
180  // Cylinder used by other objects
183 
184  // The tube
188 
189  // The slider
195 
196  // The left cap
200 
201  // The right cap
204 
205  // The text. There is an extra transform used to rotate
206  // both the title and label
210 
214 
215  // Transform used during slider motion
218 
219 //BTX - manage the state of the widget
220  enum _SliderShape {
222  CylinderShape
223  };
224 
225 //ETX
226 
227 
228 private:
229  vtkSliderRepresentation3D(const vtkSliderRepresentation3D&); //Not implemented
230  void operator=(const vtkSliderRepresentation3D&); //Not implemented
231 };
232 
233 #endif