VTK
vtk3DWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtk3DWidget.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 =========================================================================*/
56 #ifndef vtk3DWidget_h
57 #define vtk3DWidget_h
58 
59 #include "vtkInteractionWidgetsModule.h" // For export macro
60 #include "vtkInteractorObserver.h"
61 
62 class vtk3DWidgetConnection;
63 class vtkAlgorithmOutput;
64 class vtkDataSet;
65 class vtkProp3D;
66 
67 class VTKINTERACTIONWIDGETS_EXPORT vtk3DWidget : public vtkInteractorObserver
68 {
69 public:
71  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
72 
74 
83  virtual void PlaceWidget(double bounds[6]) = 0;
84  virtual void PlaceWidget();
85  virtual void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
86  double zmin, double zmax);
88 
90 
95  virtual void SetProp3D(vtkProp3D*);
96  vtkGetObjectMacro(Prop3D,vtkProp3D);
98 
100 
105  virtual void SetInputData(vtkDataSet*);
106  virtual void SetInputConnection(vtkAlgorithmOutput*);
107  virtual vtkDataSet *GetInput();
109 
111 
118  vtkSetClampMacro(PlaceFactor,double,0.01,VTK_DOUBLE_MAX);
119  vtkGetMacro(PlaceFactor,double);
121 
123 
129  vtkSetClampMacro(HandleSize,double,0.001,0.5);
130  vtkGetMacro(HandleSize,double);
132 
133 protected:
134  vtk3DWidget();
135  ~vtk3DWidget() VTK_OVERRIDE;
136 
137  // Used to position and scale the widget initially
138  vtkProp3D *Prop3D;
139 
140  vtk3DWidgetConnection *ConnectionHolder;
141 
142  //has the widget ever been placed
143  double PlaceFactor;
144  int Placed;
145  void AdjustBounds(double bounds[6], double newBounds[6], double center[3]);
146 
147  //control the size of handles (if there are any)
148  double InitialBounds[6];
149  double InitialLength;
150  double HandleSize;
151  double SizeHandles(double factor);
152  virtual void SizeHandles() {}//subclass in turn invokes parent's SizeHandles()
153 
154  //used to track the depth of the last pick; also interacts with handle sizing
156  double LastPickPosition[3];
157 
158  void UpdateInput();
159 
160 private:
161  vtk3DWidget(const vtk3DWidget&) VTK_DELETE_FUNCTION;
162  void operator=(const vtk3DWidget&) VTK_DELETE_FUNCTION;
163 
164 };
165 
166 #endif
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Proxy object to connect input/output ports.
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
a simple class to control print indentation
Definition: vtkIndent.h:39
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:67