VTK
dox/Interaction/Widgets/vtk3DWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtk3DWidget.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00058 #ifndef __vtk3DWidget_h
00059 #define __vtk3DWidget_h
00060 
00061 #include "vtkInteractionWidgetsModule.h" // For export macro
00062 #include "vtkInteractorObserver.h"
00063 
00064 class vtk3DWidgetConnection;
00065 class vtkAlgorithmOutput;
00066 class vtkDataSet;
00067 class vtkProp3D;
00068 
00069 class VTKINTERACTIONWIDGETS_EXPORT vtk3DWidget : public vtkInteractorObserver
00070 {
00071 public:
00072   vtkTypeMacro(vtk3DWidget,vtkInteractorObserver);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076 
00083   virtual void PlaceWidget(double bounds[6]) = 0;
00084   virtual void PlaceWidget();
00085   virtual void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
00086                            double zmin, double zmax);
00088 
00090 
00093   virtual void SetProp3D(vtkProp3D*);
00094   vtkGetObjectMacro(Prop3D,vtkProp3D);
00096 
00098 
00101   virtual void SetInputData(vtkDataSet*);
00102   virtual void SetInputConnection(vtkAlgorithmOutput*);
00103   virtual vtkDataSet *GetInput();
00105 
00107 
00113   vtkSetClampMacro(PlaceFactor,double,0.01,VTK_DOUBLE_MAX);
00114   vtkGetMacro(PlaceFactor,double);
00116 
00118 
00122   vtkSetClampMacro(HandleSize,double,0.001,0.5);
00123   vtkGetMacro(HandleSize,double);
00125 
00126 protected:
00127   vtk3DWidget();
00128   ~vtk3DWidget();
00129 
00130   // Used to position and scale the widget initially
00131   vtkProp3D *Prop3D;
00132 
00133   vtk3DWidgetConnection *ConnectionHolder;
00134 
00135   //has the widget ever been placed
00136   double PlaceFactor;
00137   int Placed;
00138   void AdjustBounds(double bounds[6], double newBounds[6], double center[3]);
00139 
00140   //control the size of handles (if there are any)
00141   double InitialBounds[6];
00142   double InitialLength;
00143   double HandleSize;
00144   double SizeHandles(double factor);
00145   virtual void SizeHandles() {}//subclass in turn invokes parent's SizeHandles()
00146 
00147   //used to track the depth of the last pick; also interacts with handle sizing
00148   int   ValidPick;
00149   double LastPickPosition[3];
00150 
00151   void UpdateInput();
00152 
00153 private:
00154   vtk3DWidget(const vtk3DWidget&);  // Not implemented.
00155   void operator=(const vtk3DWidget&);  // Not implemented.
00156 
00157 };
00158 
00159 #endif