Hybrid/vtkPointWidget.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Hybrid/vtkPointWidget.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkPointWidget.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00090 #ifndef __vtkPointWidget_h
    00091 #define __vtkPointWidget_h
    00092
    00093 #include "vtk3DWidget.h"
    00094 #include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
    00095
    00096 class vtkActor;
    00097 class vtkPolyDataMapper;
    00098 class vtkCellPicker;
    00099 class vtkPolyData;
    00100 class vtkProperty;
    00101
    00102 class VTK_HYBRID_EXPORT vtkPointWidget : public vtk3DWidget
    00103 {
    00104 public:
    00106   static vtkPointWidget *New();
    00107
    00108   vtkTypeRevisionMacro(vtkPointWidget,vtk3DWidget);
    00109   void PrintSelf(ostream& os, vtkIndent indent);
    00110
    00112
    00113   virtual void SetEnabled(int);
    00114   virtual void PlaceWidget(float bounds[6]);
    00115   void PlaceWidget()
    00116     {this->Superclass::PlaceWidget();}
    00117   void PlaceWidget(float xmin, float xmax, float ymin, float ymax,
    00118                    float zmin, float zmax)
    00119     {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
    00121
    00124   void GetPolyData(vtkPolyData *pd);
    00125
    00127
    00130   void SetPosition(float x, float y, float z)
    00131     {this->Cursor3D->SetFocalPoint(x,y,z);}
    00132   void SetPosition(float x[3])
    00133     {this->SetPosition(x[0],x[1],x[2]);}
    00134   float* GetPosition()
    00135     {return this->Cursor3D->GetFocalPoint();}
    00136   void GetPosition(float xyz[3])
    00137     {this->Cursor3D->GetFocalPoint(xyz);}
    00139
    00141
    00142   void SetOutline(int o)
    00143     {this->Cursor3D->SetOutline(o);}
    00144   int GetOutline()
    00145     {return this->Cursor3D->GetOutline();}
    00146   void OutlineOn()
    00147     {this->Cursor3D->OutlineOn();}
    00148   void OutlineOff()
    00149     {this->Cursor3D->OutlineOff();}
    00151
    00153
    00154   void SetXShadows(int o)
    00155     {this->Cursor3D->SetXShadows(o);}
    00156   int GetXShadows()
    00157     {return this->Cursor3D->GetXShadows();}
    00158   void XShadowsOn()
    00159     {this->Cursor3D->XShadowsOn();}
    00160   void XShadowsOff()
    00161     {this->Cursor3D->XShadowsOff();}
    00163
    00165
    00166   void SetYShadows(int o)
    00167     {this->Cursor3D->SetYShadows(o);}
    00168   int GetYShadows()
    00169     {return this->Cursor3D->GetYShadows();}
    00170   void YShadowsOn()
    00171     {this->Cursor3D->YShadowsOn();}
    00172   void YShadowsOff()
    00173     {this->Cursor3D->YShadowsOff();}
    00175
    00177
    00178   void SetZShadows(int o)
    00179     {this->Cursor3D->SetZShadows(o);}
    00180   int GetZShadows()
    00181     {return this->Cursor3D->GetZShadows();}
    00182   void ZShadowsOn()
    00183     {this->Cursor3D->ZShadowsOn();}
    00184   void ZShadowsOff()
    00185     {this->Cursor3D->ZShadowsOff();}
    00187
    00189
    00192   void SetTranslationMode(int mode)
    00193     { this->Cursor3D->SetTranslationMode(mode); this->Cursor3D->Update(); }
    00194   int GetTranslationMode()
    00195     { return this->Cursor3D->GetTranslationMode(); }
    00196   void TranslationModeOn()
    00197     { this->SetTranslationMode(1); }
    00198   void TranslationModeOff()
    00199     { this->SetTranslationMode(0); }
    00201
    00203
    00204   void AllOn()
    00205     {
    00206       this->OutlineOn();
    00207       this->XShadowsOn();
    00208       this->YShadowsOn();
    00209       this->ZShadowsOn();
    00210     }
    00211   void AllOff()
    00212     {
    00213       this->OutlineOff();
    00214       this->XShadowsOff();
    00215       this->YShadowsOff();
    00216       this->ZShadowsOff();
    00217     }
    00219
    00221
    00223   vtkGetObjectMacro(Property,vtkProperty);
    00224   vtkGetObjectMacro(SelectedProperty,vtkProperty);
    00226
    00228
    00232   vtkSetClampMacro(HotSpotSize,float,0.0,1.0);
    00233   vtkGetMacro(HotSpotSize,float);
    00235
    00236 protected:
    00237   vtkPointWidget();
    00238   ~vtkPointWidget();
    00239
    00240 //BTX - manage the state of the widget
    00241   friend class vtkLineWidget;
    00242
    00243   int State;
    00244   enum WidgetState
    00245   {
    00246     Start=0,
    00247     Moving,
    00248     Scaling,
    00249     Translating,
    00250     Outside
    00251   };
    00252 //ETX
    00253
    00254   // Handles the events
    00255   static void ProcessEvents(vtkObject* object,
    00256                             unsigned long event,
    00257                             void* clientdata,
    00258                             void* calldata);
    00259
    00260   // ProcessEvents() dispatches to these methods.
    00261   void OnMouseMove();
    00262   void OnLeftButtonDown();
    00263   void OnLeftButtonUp();
    00264   void OnMiddleButtonDown();
    00265   void OnMiddleButtonUp();
    00266   void OnRightButtonDown();
    00267   void OnRightButtonUp();
    00268
    00269   // the cursor3D
    00270   vtkActor          *Actor;
    00271   vtkPolyDataMapper *Mapper;
    00272   vtkCursor3D       *Cursor3D;
    00273   void Highlight(int highlight);
    00274
    00275   // Do the picking
    00276   vtkCellPicker *CursorPicker;
    00277
    00278   // Methods to manipulate the cursor
    00279   int ConstraintAxis;
    00280   void Translate(double *p1, double *p2);
    00281   void Scale(double *p1, double *p2, int X, int Y);
    00282   void MoveFocus(double *p1, double *p2);
    00283   int TranslationMode;
    00284
    00285   // Properties used to control the appearance of selected objects and
    00286   // the manipulator in general.
    00287   vtkProperty *Property;
    00288   vtkProperty *SelectedProperty;
    00289   void CreateDefaultProperties();
    00290
    00291   // The size of the hot spot.
    00292   float HotSpotSize;
    00293   int DetermineConstraintAxis(int constraint, double *x);
    00294   int WaitingForMotion;
    00295   int WaitCount;
    00296
    00297 private:
    00298   vtkPointWidget(const vtkPointWidget&);  //Not implemented
    00299   void operator=(const vtkPointWidget&);  //Not implemented
    00300 };
    00301
    00302 #endif