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 =========================================================================*/
35 #ifndef vtkSliderRepresentation3D_h
36 #define vtkSliderRepresentation3D_h
37 
38 #include "vtkInteractionWidgetsModule.h" // For export macro
40 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
41 
42 class vtkActor;
43 class vtkPolyDataMapper;
44 class vtkSphereSource;
45 class vtkCellPicker;
46 class vtkProperty;
47 class vtkCylinderSource;
48 class vtkVectorText;
49 class vtkAssembly;
50 class vtkTransform;
52 class vtkMatrix4x4;
53 
54 
55 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderRepresentation3D : public vtkSliderRepresentation
56 {
57 public:
62 
64 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
80  vtkCoordinate *GetPoint1Coordinate();
81  void SetPoint1InWorldCoordinates(double x, double y, double z);
83 
85 
93  vtkCoordinate *GetPoint2Coordinate();
94  void SetPoint2InWorldCoordinates(double x, double y, double z);
96 
98 
102  void SetTitleText(const char*) override;
103  const char* GetTitleText() override;
105 
107 
111  vtkSetClampMacro(SliderShape,int,SphereShape,CylinderShape);
112  vtkGetMacro(SliderShape, int);
113  void SetSliderShapeToSphere() { this->SetSliderShape(SphereShape); }
114  void SetSliderShapeToCylinder() { this->SetSliderShape(CylinderShape); }
116 
118 
123  vtkSetMacro(Rotation,double);
124  vtkGetMacro(Rotation,double);
126 
128 
132  vtkGetObjectMacro(SliderProperty,vtkProperty);
134 
136 
139  vtkGetObjectMacro(TubeProperty,vtkProperty);
140  vtkGetObjectMacro(CapProperty,vtkProperty);
142 
144 
148  vtkGetObjectMacro(SelectedProperty,vtkProperty);
150 
152 
155  void PlaceWidget(double bounds[6]) override;
156  void BuildRepresentation() override;
157  void StartWidgetInteraction(double eventPos[2]) override;
158  void WidgetInteraction(double newEventPos[2]) override;
159  void Highlight(int) override;
161 
163 
166  double *GetBounds() override;
167  void GetActors(vtkPropCollection*) override;
168  void ReleaseGraphicsResources(vtkWindow*) override;
169  int RenderOpaqueGeometry(vtkViewport*) override;
171  int HasTranslucentPolygonalGeometry() override;
173 
177  vtkMTimeType GetMTime() override;
178 
179 protected:
181  ~vtkSliderRepresentation3D() override;
182 
183  // Positioning the widget
186  double Length;
187 
188  // These are the slider end points taking into account the thickness
189  // of the slider
190  double SP1[3];
191  double SP2[3];
192 
193  // More ivars controlling the appearance of the widget
194  double Rotation;
196 
197  // Do the picking
199 
200  // Register internal Pickers within PickingManager
201  void RegisterPickers() override;
202 
203  // Determine the parameter t along the slider
204  virtual double ComputePickPosition(double eventPos[2]);
205 
206  // The widget consists of several actors, all grouped
207  // together using an assembly. This makes it easier to
208  // perform the final transformation into
210 
211  // Cylinder used by other objects
214 
215  // The tube
219 
220  // The slider
226 
227  // The left cap
231 
232  // The right cap
235 
236  // The text. There is an extra transform used to rotate
237  // both the title and label
241 
245 
246  // Transform used during slider motion
249 
250  // Manage the state of the widget
253  CylinderShape
254  };
255 
256 
257 
258 private:
260  void operator=(const vtkSliderRepresentation3D&) = delete;
261 };
262 
263 #endif
vtkTransformPolyDataFilter * Cylinder
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
generate a cylinder centered at origin
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:65
virtual void StartWidgetInteraction(double eventPos[2])
void SetSliderShapeToCylinder()
Specify whether to use a sphere or cylinder slider shape.
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
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
int HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
provide the representation for a vtkSliderWidget with a 3D skin
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual vtkMTimeType GetMTime()
Return this object's modified time.
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:78
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:75
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:69
virtual void Highlight(int vtkNotUsed(highlightOn))
virtual const char * GetTitleText()
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
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