X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FExtensions%2FVisualization%2FImageInteractorStyle.h;h=7ff6dbd6f5fdc0647cc396738da5ce0f3897c764;hb=9015cf98c60cf4ab304a639990004ee783a8bec0;hp=f2909e20924c33aaf0658250d8040c66fb797364;hpb=2e68bf3e3a3433d77adbc67cebc17fd5cb0111f6;p=cpPlugins.git diff --git a/lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h b/lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h index f2909e2..7ff6dbd 100644 --- a/lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h +++ b/lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h @@ -8,13 +8,18 @@ #include #include -/* TODO - #include - #include - #include - #include - class vtkImageData; -*/ +#include + +// ------------------------------------------------------------------------- +#define cpPlugins_ImageInteractorStyle_ObserverMacro( e ) \ + inline unsigned long Add##e##Observer( vtkCommand* observer ) \ + { return( this->AddObserver( Self::e##Event, observer ) ); } \ + inline void Remove##e##Observer( unsigned long tag ) \ + { this->RemoveObserver( tag ); } \ + inline void Remove##e##Observer( vtkCommand* observer ) \ + { this->RemoveObserver( observer ); } \ + inline void Remove##e##Observers( ) \ + { this->RemoveObservers( Self::e##Event ); } namespace cpPlugins { @@ -27,7 +32,7 @@ namespace cpPlugins /** */ - class ImageInteractorStyle + class cpPlugins_Extensions_EXPORT ImageInteractorStyle : public vtkInteractorStyleImage { public: @@ -42,6 +47,10 @@ namespace cpPlugins public: vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage ); + cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick ); + cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor ); + cpPlugins_ImageInteractorStyle_ObserverMacro( Radius ); + public: static Self* New( ); @@ -57,11 +66,6 @@ namespace cpPlugins vtkRenderWindowInteractor* interactor, const int& axis ); - unsigned long AddDoubleClickObserver( vtkCommand* observer ); - void RemoveDoubleClickObserver( unsigned long tag ); - void RemoveDoubleClickObserver( vtkCommand* observer ); - void RemoveDoubleClickObservers( ); - // Description: // Event bindings controlling the effects of pressing mouse buttons // or moving the mouse. @@ -103,6 +107,8 @@ namespace cpPlugins // New events virtual void StartCursorMoving( ); virtual void EndCursorMoving( ); + virtual void StartRadiusMoving( ); + virtual void EndRadiusMoving( ); protected: ImageInteractorStyle( ); @@ -111,6 +117,7 @@ namespace cpPlugins void _RenderAssociateInteractors( ); bool _PickPosition( double pos[ 3 ] ); void _UpdateCursor( ); + void _UpdateRadius( ); private: // Purposely not implemented @@ -129,8 +136,17 @@ namespace cpPlugins std::vector< vtkRenderWindowInteractor* > AssociatedInteractors; bool CursorMoving; + double Cursor[ 3 ]; + + bool RadiusMoving; + double Radius[ 3 ]; + vtkSmartPointer< vtkPolyData > Circle; + vtkSmartPointer< vtkPolyDataMapper > CircleMapper; + vtkSmartPointer< vtkActor > CircleActor; public: + static const int CursorEvent; + static const int RadiusEvent; static const int DoubleClickEvent; };