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() VTK_SIZEHINT(6) override;
167  void GetActors(vtkPropCollection*) override;
168  void ReleaseGraphicsResources(vtkWindow*) override;
169  int RenderOpaqueGeometry(vtkViewport*) override;
173 
177  vtkMTimeType GetMTime() override;
178 
179  /*
180  * Register internal Pickers within PickingManager
181  */
182  void RegisterPickers() override;
183 
184 protected:
186  ~vtkSliderRepresentation3D() override;
187 
188  // Positioning the widget
191  double Length;
192 
193  // These are the slider end points taking into account the thickness
194  // of the slider
195  double SP1[3];
196  double SP2[3];
197 
198  // More ivars controlling the appearance of the widget
199  double Rotation;
201 
202  // Do the picking
204 
205  // Determine the parameter t along the slider
206  virtual double ComputePickPosition(double eventPos[2]);
207 
208  // The widget consists of several actors, all grouped
209  // together using an assembly. This makes it easier to
210  // perform the final transformation into
212 
213  // Cylinder used by other objects
216 
217  // The tube
221 
222  // The slider
228 
229  // The left cap
233 
234  // The right cap
237 
238  // The text. There is an extra transform used to rotate
239  // both the title and label
243 
247 
248  // Transform used during slider motion
251 
252  // Manage the state of the widget
255  CylinderShape
256  };
257 
258 
259 
260 private:
262  void operator=(const vtkSliderRepresentation3D&) = delete;
263 };
264 
265 #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:302
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:66
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
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
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
#define VTK_SIZEHINT(...)
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:81
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.
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
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