VTK
dox/Interaction/Widgets/vtkContourWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkContourWidget.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 =========================================================================*/
00128 #ifndef __vtkContourWidget_h
00129 #define __vtkContourWidget_h
00130 
00131 #include "vtkInteractionWidgetsModule.h" // For export macro
00132 #include "vtkAbstractWidget.h"
00133 
00134 class vtkContourRepresentation;
00135 class vtkPolyData;
00136 class vtkIdList;
00137 
00138 class VTKINTERACTIONWIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
00139 {
00140 public:
00142   static vtkContourWidget *New();
00143 
00145 
00146   vtkTypeMacro(vtkContourWidget,vtkAbstractWidget);
00147   void PrintSelf(ostream& os, vtkIndent indent);
00149 
00153   virtual void SetEnabled(int);
00154 
00156 
00159   void SetRepresentation(vtkContourRepresentation *r)
00160     {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
00162 
00164 
00165   vtkContourRepresentation *GetContourRepresentation()
00166     {return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);}
00168 
00170   void CreateDefaultRepresentation();
00171 
00173   void CloseLoop();
00174 
00176 
00177   vtkSetMacro(WidgetState,int);
00179 
00181 
00182   vtkGetMacro(WidgetState,int);
00184 
00186 
00189   void SetAllowNodePicking(int );
00190   vtkGetMacro( AllowNodePicking, int );
00191   vtkBooleanMacro( AllowNodePicking, int );
00193 
00195 
00200   vtkSetMacro( FollowCursor, int );
00201   vtkGetMacro( FollowCursor, int );
00202   vtkBooleanMacro( FollowCursor, int );
00204 
00206 
00214   vtkSetMacro( ContinuousDraw, int );
00215   vtkGetMacro( ContinuousDraw, int );
00216   vtkBooleanMacro( ContinuousDraw, int );
00218 
00220 
00225   virtual void Initialize( vtkPolyData * poly, int state = 1, vtkIdList *idList = NULL );
00226   virtual void Initialize()
00227     {this->Initialize(NULL);}
00229 
00230   // The state of the widget
00231   //BTX
00232   enum {Start,Define,Manipulate};
00233   //ETX
00234 
00235 protected:
00236   vtkContourWidget();
00237   ~vtkContourWidget();
00238 
00239   int WidgetState;
00240   int CurrentHandle;
00241   int AllowNodePicking;
00242   int FollowCursor;
00243   int ContinuousDraw;
00244   int ContinuousActive;
00245 
00246   // Callback interface to capture events when
00247   // placing the widget.
00248   static void SelectAction(vtkAbstractWidget*);
00249   static void AddFinalPointAction(vtkAbstractWidget*);
00250   static void MoveAction(vtkAbstractWidget*);
00251   static void EndSelectAction(vtkAbstractWidget*);
00252   static void DeleteAction(vtkAbstractWidget*);
00253   static void TranslateContourAction(vtkAbstractWidget*);
00254   static void ScaleContourAction(vtkAbstractWidget*);
00255   static void ResetAction(vtkAbstractWidget*);
00256 
00257   // Internal helper methods
00258   void SelectNode();
00259   void AddNode();
00260 
00261 private:
00262   vtkContourWidget(const vtkContourWidget&);  //Not implemented
00263   void operator=(const vtkContourWidget&);  //Not implemented
00264 };
00265 
00266 #endif