]> Creatis software - cpPlugins.git/commitdiff
More widgets added
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 16 Oct 2015 22:17:56 +0000 (17:17 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 16 Oct 2015 22:17:56 +0000 (17:17 -0500)
20 files changed:
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
appli/examples/CMakeLists.txt
appli/examples/example_BaseInteractorStyle.cxx
appli/examples/example_HandleWidget.cxx [new file with mode: 0644]
appli/examples/example_SeedWidget.cxx [new file with mode: 0644]
lib/cpExtensions/CMakeLists.txt
lib/cpExtensions/Interaction/BaseInteractorStyle.cxx [moved from lib/cpExtensions/Visualization/BaseInteractorStyle.cxx with 62% similarity]
lib/cpExtensions/Interaction/BaseInteractorStyle.h [moved from lib/cpExtensions/Visualization/BaseInteractorStyle.h with 75% similarity]
lib/cpExtensions/Interaction/ImageInteractorStyle.cxx [moved from lib/cpExtensions/Visualization/ImageInteractorStyle.cxx with 61% similarity]
lib/cpExtensions/Interaction/ImageInteractorStyle.h [moved from lib/cpExtensions/Visualization/ImageInteractorStyle.h with 71% similarity]
lib/cpExtensions/Interaction/SeedWidget.cxx [new file with mode: 0644]
lib/cpExtensions/Interaction/SeedWidget.h [new file with mode: 0644]
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpExtensions/Visualization/ImageSliceActors.h
lib/cpExtensions/Visualization/MPRActors.cxx
lib/cpExtensions/Visualization/MPRActors.h
lib/cpExtensions/Visualization/MPRObjects.cxx
lib/cpExtensions/Visualization/MPRObjects.h
lib/cpPlugins/Interface/BaseMPRWindow.h

index 58276cb7433b6b7027347130614d0e8ee7c057d2..ca29aaacf20080d69902a447d4f814567f3dad30 100644 (file)
@@ -18,9 +18,6 @@ ImageMPR( QWidget* parent )
 {
   this->m_UI->setupUi( this );
 
-  // Associate callbacks
-  this->m_UI->MPR->AddCursorCommand( Self::_CursorCommand, this );
-
   // Connect actions
   ImageMPR_ConnectAction( OpenImage );
   ImageMPR_ConnectAction( OpenSegmentation );
@@ -182,48 +179,46 @@ _execPlugin( )
 }
 
 // -------------------------------------------------------------------------
-void ImageMPR::
-_CursorCommand( double* pos, int axis, void* data )
-{
-  Self* app = reinterpret_cast< Self* >( data );
-  if( app == NULL )
-    return;
-  if( !( app->m_Flooding ) )
-    return;
-
-  cpPlugins::Interface::ProcessObject::Pointer filter =
-    app->m_UI->MPR->CreateFilter(
-      "cpPlugins::BasicFilters::FloodFillImageFilter"
-      );
-  if( filter.IsNull( ) )
-    return;
-
-  cpPlugins::Interface::Parameters* params = filter->GetParameters( );
-  params->SetPoint( "Seed", 3, pos );
-  params->SetReal( "Window", app->m_UI->MPR->GetWindow( ) );
-  params->SetReal( "Level", app->m_UI->MPR->GetLevel( ) );
-  params->SetUint( "InsideValue", 1 );
-  params->SetUint( "OutsideValue", 0 );
-  filter->SetInput( "Input", app->m_UI->MPR->GetImage( app->m_ImageLoaded ) );
-  app->m_UI->MPR->Block( );
-  std::string err = filter->Update( );
-  cpPlugins::Interface::BaseMPRWindow::TImage::Pointer image = filter->GetOutput< cpPlugins::Interface::BaseMPRWindow::TImage >( "Output" );
-  filter->DisconnectOutputs( );
-  app->m_UI->MPR->AddImage( "Segmentation", image );
-  app->m_UI->MPR->Unblock( );
-
-
-
-  /* TODO
-     std::cout
-     << "CursorCommand ==> "
-     << pos[ 0 ] << " "
-     << pos[ 1 ] << " "
-    << pos[ 2 ] << " : "
-    << axis << " "
-    << data << std::endl;
-  */
-}
+/* TODO
+   void ImageMPR::
+   _CursorCommand( double* pos, int axis, void* data )
+   {
+   Self* app = reinterpret_cast< Self* >( data );
+   if( app == NULL )
+   return;
+   if( !( app->m_Flooding ) )
+   return;
+
+   cpPlugins::Interface::ProcessObject::Pointer filter =
+   app->m_UI->MPR->CreateFilter(
+   "cpPlugins::BasicFilters::FloodFillImageFilter"
+   );
+   if( filter.IsNull( ) )
+   return;
+
+   cpPlugins::Interface::Parameters* params = filter->GetParameters( );
+   params->SetPoint( "Seed", 3, pos );
+   params->SetReal( "Window", app->m_UI->MPR->GetWindow( ) );
+   params->SetReal( "Level", app->m_UI->MPR->GetLevel( ) );
+   params->SetUint( "InsideValue", 1 );
+   params->SetUint( "OutsideValue", 0 );
+   filter->SetInput( "Input", app->m_UI->MPR->GetImage( app->m_ImageLoaded ) );
+   app->m_UI->MPR->Block( );
+   std::string err = filter->Update( );
+   cpPlugins::Interface::BaseMPRWindow::TImage::Pointer image = filter->GetOutput< cpPlugins::Interface::BaseMPRWindow::TImage >( "Output" );
+   filter->DisconnectOutputs( );
+   app->m_UI->MPR->AddImage( "Segmentation", image );
+   app->m_UI->MPR->Unblock( );
+
+   std::cout
+   << "CursorCommand ==> "
+   << pos[ 0 ] << " "
+   << pos[ 1 ] << " "
+   << pos[ 2 ] << " : "
+   << axis << " "
+   << data << std::endl;
+   }
+*/
 
 /*
 #include "MementoState.h"
index a89d0f9ed2c80bf625b05889eefa73fc97f718f4..dabf4507cd0ef40964c8f843e1876f09add3ca8e 100644 (file)
@@ -123,10 +123,6 @@ public:
   typedef QMainWindow Superclass;
 
   typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
-  typedef TMPRObjects::TCursorCommand     TCursorCommand;
-  typedef TMPRObjects::TMouseCommand      TMouseCommand;
-  typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
-  typedef TMPRObjects::TKeyCommand        TKeyCommand;
 
   // Plugins types
   /*
@@ -166,10 +162,6 @@ private slots:
 
   void _execPlugin( );
 
-protected:
-  // Callbacks
-  static void _CursorCommand( double* pos, int axis, void* data );
-
 private:
   Ui::ImageMPR* m_UI;
 
index 25b7d3c766e7e1b9e166d9c160847302fdf0975c..e12dfa53d429cdc22313510d7920a6b3c5ffce86 100644 (file)
@@ -29,6 +29,8 @@ SET(
   #example_ReadWriteImage
   #example_MPR
   example_View2DImage
+  example_HandleWidget
+  example_SeedWidget
   ##example_MarchingCubes
   ##example_OtsuFilter
   ##example_RGBImageToHSVChannels
index a8515d274f06035337cde916925d5bf9418aa3b8..75366b7057bf639440d6a69ee66700766a3732f4 100644 (file)
@@ -4,22 +4,22 @@
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkRenderWindowInteractor.h>
-#include <cpExtensions/Visualization/BaseInteractorStyle.h>
+#include <cpExtensions/Interaction/BaseInteractorStyle.h>
 
 // -------------------------------------------------------------------------
 #define example_BaseInteractorStyle_Macro( x )  \
-  virtual void On##x( )                         \
+  virtual void On##x( )                                 \
   { std::cout << "On" << #x << "( )" << std::endl; }
 
 // -------------------------------------------------------------------------
 class example_BaseInteractorStyle
-  : public cpExtensions::Visualization::BaseInteractorStyle
+  : public cpExtensions::Interaction::BaseInteractorStyle
 {
 public:
   typedef example_BaseInteractorStyle Self;
   vtkTypeMacro(
     example_BaseInteractorStyle,
-    cpExtensions::Visualization::BaseInteractorStyle
+    cpExtensions::Interaction::BaseInteractorStyle
     );
 
 public:
@@ -59,7 +59,7 @@ protected:
   virtual ~example_BaseInteractorStyle( )
     { }
 
-  virtual bool _PickPosition( double pos[ 3 ] )
+  virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] )
     {
       return( true ); // Just testing...
     }
diff --git a/appli/examples/example_HandleWidget.cxx b/appli/examples/example_HandleWidget.cxx
new file mode 100644 (file)
index 0000000..193091c
--- /dev/null
@@ -0,0 +1,130 @@
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <vtkHandleWidget.h>
+#include <vtkImageActorPointPlacer.h>
+#include <vtkPointHandleRepresentation3D.h>
+#include <vtkProperty.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Image.h>
+
+#include <cpExtensions/Visualization/ImageSliceActors.h>
+
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface     TInterface;
+typedef cpPlugins::Interface::ProcessObject TProcessObject;
+typedef cpPlugins::Interface::DataObject    TDataObject;
+typedef cpPlugins::Interface::Image         TImage;
+typedef cpPlugins::Interface::Parameters    TParameters;
+typedef TInterface::TClasses                TClasses;
+
+typedef cpExtensions::Visualization::ImageSliceActors TSliceActors;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " plugins_file input_image"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create interface
+  TInterface plugins;
+  if( !plugins.Load( argv[ 1 ] ) )
+  {
+    std::cerr << "Failed to load plugins." << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create objects
+  TProcessObject::Pointer reader;
+  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  if( reader.IsNull( ) )
+  {
+    std::cerr
+      << "No suitable reader found in plugins." << std::endl
+      << "Reader: " << reader.GetPointer( ) << std::endl
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Configure reader
+  TParameters* reader_params = reader->GetParameters( );
+  for( int i = 2; i < argc; ++i )
+    reader_params->AddToStringList( "FileNames", argv[ i ] );
+
+  // Execute pipeline
+  std::string err = reader->Update( );
+  if( err != "" )
+  {
+    std::cerr << "ERROR: " << err << std::endl;
+    return( 1 );
+
+  } // fi
+  TImage* image = reader->GetOutput< TImage >( "Output" );
+
+  // Configure visualization objects
+  vtkSmartPointer< vtkRenderer > renderer =
+    vtkSmartPointer< vtkRenderer >::New( );
+  renderer->SetBackground( 0.1, 0.3, 0.5 );
+
+  vtkSmartPointer< vtkRenderWindow > window =
+    vtkSmartPointer< vtkRenderWindow >::New( );
+  window->AddRenderer( renderer );
+  window->SetSize( 600, 600 );
+
+  // Set up the interaction
+  vtkSmartPointer< vtkRenderWindowInteractor > interactor =
+    vtkSmartPointer< vtkRenderWindowInteractor >::New( );
+  window->SetInteractor( interactor );
+
+  // Create slice actors
+  vtkSmartPointer< TSliceActors > image_actors =
+    vtkSmartPointer< TSliceActors >::New( );
+  image_actors->AddInputData( image->GetVTK< vtkImageData >( ), 2 );
+  image_actors->PushActorsInto( window );
+
+  vtkSmartPointer< vtkImageActorPointPlacer > placer =
+    vtkSmartPointer< vtkImageActorPointPlacer >::New( );
+  placer->SetImageActor( image_actors->GetImageActor( 0 ) );
+
+  double bnds[ 6 ];
+  image_actors->GetImageActor( 0 )->GetDisplayBounds( bnds );
+  double pos[] = { bnds[ 0 ], bnds[ 2 ], bnds[ 4 ] };
+
+  vtkSmartPointer< vtkPointHandleRepresentation3D > rep =
+    vtkSmartPointer< vtkPointHandleRepresentation3D >::New( );
+  rep->SetDisplayPosition( pos );
+  rep->GetProperty( )->SetColor( 1, 0, 0 );
+  rep->ActiveRepresentationOff( );
+  rep->SetPointPlacer( placer );
+
+  vtkSmartPointer< vtkHandleWidget > handleWidget =
+    vtkSmartPointer< vtkHandleWidget >::New( );
+  handleWidget->SetInteractor( interactor );
+  handleWidget->SetRepresentation( rep );
+
+  // Begin interaction
+  interactor->Initialize( );
+  renderer->ResetCamera( );
+  window->Render( );
+  handleWidget->On( );
+  interactor->Start( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/appli/examples/example_SeedWidget.cxx b/appli/examples/example_SeedWidget.cxx
new file mode 100644 (file)
index 0000000..beac518
--- /dev/null
@@ -0,0 +1,123 @@
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <vtkPointHandleRepresentation3D.h>
+#include <vtkProperty.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkSeedRepresentation.h>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Image.h>
+
+#include <cpExtensions/Visualization/ImageSliceActors.h>
+#include <cpExtensions/Interaction/SeedWidget.h>
+
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface     TInterface;
+typedef cpPlugins::Interface::ProcessObject TProcessObject;
+typedef cpPlugins::Interface::DataObject    TDataObject;
+typedef cpPlugins::Interface::Image         TImage;
+typedef cpPlugins::Interface::Parameters    TParameters;
+typedef TInterface::TClasses                TClasses;
+
+typedef cpExtensions::Visualization::ImageSliceActors TSliceActors;
+typedef cpExtensions::Interaction::SeedWidget         TSeedWidget;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " plugins_file input_image"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create interface
+  TInterface plugins;
+  if( !plugins.Load( argv[ 1 ] ) )
+  {
+    std::cerr << "Failed to load plugins." << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Create objects
+  TProcessObject::Pointer reader;
+  reader = plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
+  if( reader.IsNull( ) )
+  {
+    std::cerr
+      << "No suitable reader found in plugins." << std::endl
+      << "Reader: " << reader.GetPointer( ) << std::endl
+      << std::endl;
+    return( 1 );
+
+  } // fi
+
+  // Configure reader
+  TParameters* reader_params = reader->GetParameters( );
+  for( int i = 2; i < argc; ++i )
+    reader_params->AddToStringList( "FileNames", argv[ i ] );
+
+  // Execute pipeline
+  std::string err = reader->Update( );
+  if( err != "" )
+  {
+    std::cerr << "ERROR: " << err << std::endl;
+    return( 1 );
+
+  } // fi
+  TImage* image = reader->GetOutput< TImage >( "Output" );
+
+  // Configure visualization objects
+  vtkSmartPointer< vtkRenderer > renderer =
+    vtkSmartPointer< vtkRenderer >::New( );
+  renderer->SetBackground( 0.1, 0.3, 0.5 );
+
+  vtkSmartPointer< vtkRenderWindow > window =
+    vtkSmartPointer< vtkRenderWindow >::New( );
+  window->AddRenderer( renderer );
+  window->SetSize( 600, 600 );
+
+  // Set up the interaction
+  vtkSmartPointer< vtkRenderWindowInteractor > interactor =
+    vtkSmartPointer< vtkRenderWindowInteractor >::New( );
+  window->SetInteractor( interactor );
+
+  // Create slice actors
+  vtkSmartPointer< TSliceActors > image_actors =
+    vtkSmartPointer< TSliceActors >::New( );
+  image_actors->AddInputData( image->GetVTK< vtkImageData >( ), 2 );
+  image_actors->PushActorsInto( window );
+
+  // Create the widget and its representation
+  vtkSmartPointer< vtkPointHandleRepresentation3D > handle =
+    vtkSmartPointer< vtkPointHandleRepresentation3D >::New( );
+  handle->GetProperty( )->SetColor( 1, 0, 0 );
+  vtkSmartPointer< vtkSeedRepresentation > rep =
+    vtkSmartPointer< vtkSeedRepresentation >::New( );
+  rep->SetHandleRepresentation( handle );
+
+  vtkSmartPointer< TSeedWidget > widget =
+    vtkSmartPointer< TSeedWidget >::New( );
+  widget->SetInteractor( interactor );
+  widget->SetRepresentation( rep );
+
+  // Begin interaction
+  renderer->ResetCamera( );
+  window->Render( );
+  widget->On( );
+  interactor->Start( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
index d977c4692616bcdaf6d12bd8c07bd4488f1f1863..fd4cab7970a9e2caf0c51e7b262b9e5a5477060d 100644 (file)
@@ -23,6 +23,7 @@ SET(
   DataStructures
   Algorithms
   IO
+  Interaction
   Visualization
   )
 FOREACH(dir ${lib_DIRECTORIES})
similarity index 62%
rename from lib/cpExtensions/Visualization/BaseInteractorStyle.cxx
rename to lib/cpExtensions/Interaction/BaseInteractorStyle.cxx
index b5641012bc42e43a2fc1b239c601e734056f580e..a384eb0df57c71021b320f60e938a946bed85f74 100644 (file)
@@ -1,4 +1,4 @@
-#include <cpExtensions/Visualization/BaseInteractorStyle.h>
+#include <cpExtensions/Interaction/BaseInteractorStyle.h>
 
 #include <cmath>
 
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
-long cpExtensions::Visualization::BaseInteractorStyle::_TMouseButtonEvent::
-MaxDoubleClick = 200; // ms
+long cpExtensions::Interaction::BaseInteractorStyle::_TMouseButtonEvent::
+MaxDoubleClick = 350; // ms
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
+SetSetDoubleClickDelay( long delay )
+{
+  Self::_TMouseButtonEvent::MaxDoubleClick = delay;
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddMouseMoveCommand( TMouseCommand command, void* data )
 {
-  this->m_MouseMoveCommands.push_back(
-    std::pair< TMouseCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_MouseMoveCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddMouseClickCommand( TMouseCommand command, void* data )
 {
-  this->m_MouseClickCommands.push_back(
-    std::pair< TMouseCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_MouseClickCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddMouseDoubleClickCommand( TMouseCommand command, void* data )
 {
-  this->m_MouseDoubleClickCommands.push_back(
-    std::pair< TMouseCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_MouseDoubleClickCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddMouseWheelCommand( TMouseWheelCommand command, void* data )
 {
-  this->m_MouseWheelCommands.push_back(
-    std::pair< TMouseWheelCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_MouseWheelCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddKeyCommand( TKeyCommand command, void* data )
 {
-  this->m_KeyCommands.push_back(
-    std::pair< TKeyCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_KeyCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddExposeCommand( TVoidCommand command, void* data )
 {
-  this->m_ExposeCommands.push_back(
-    std::pair< TVoidCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_ExposeCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddConfigureCommand( TVoidCommand command, void* data )
 {
-  this->m_ConfigureCommands.push_back(
-    std::pair< TVoidCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_ConfigureCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddEnterCommand( TVoidCommand command, void* data )
 {
-  this->m_EnterCommands.push_back(
-    std::pair< TVoidCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_EnterCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 AddLeaveCommand( TVoidCommand command, void* data )
 {
-  this->m_LeaveCommands.push_back(
-    std::pair< TVoidCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_LeaveCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveMouseMoveCommand( TMouseCommand command )
+{
+  auto i = this->m_MouseMoveCommands.find( command );
+  if( i != this->m_MouseMoveCommands.end( ) )
+  {
+    this->m_MouseMoveCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveMouseClickCommand( TMouseCommand command )
+{
+  auto i = this->m_MouseClickCommands.find( command );
+  if( i != this->m_MouseClickCommands.end( ) )
+  {
+    this->m_MouseClickCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveMouseDoubleClickCommand( TMouseCommand command )
+{
+  auto i = this->m_MouseDoubleClickCommands.find( command );
+  if( i != this->m_MouseDoubleClickCommands.end( ) )
+  {
+    this->m_MouseDoubleClickCommands.erase( i );
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveMouseWheelCommand( TMouseWheelCommand command )
+{
+  auto i = this->m_MouseWheelCommands.find( command );
+  if( i != this->m_MouseWheelCommands.end( ) )
+  {
+    this->m_MouseWheelCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveKeyCommand( TKeyCommand command )
+{
+  auto i = this->m_KeyCommands.find( command );
+  if( i != this->m_KeyCommands.end( ) )
+  {
+    this->m_KeyCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveExposeCommand( TVoidCommand command )
+{
+  auto i = this->m_ExposeCommands.find( command );
+  if( i != this->m_ExposeCommands.end( ) )
+  {
+    this->m_ExposeCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveConfigureCommand( TVoidCommand command )
+{
+  auto i = this->m_ConfigureCommands.find( command );
+  if( i != this->m_ConfigureCommands.end( ) )
+  {
+    this->m_ConfigureCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveEnterCommand( TVoidCommand command )
+{
+  auto i = this->m_EnterCommands.find( command );
+  if( i != this->m_EnterCommands.end( ) )
+  {
+    this->m_EnterCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+RemoveLeaveCommand( TVoidCommand command )
+{
+  auto i = this->m_LeaveCommands.find( command );
+  if( i != this->m_LeaveCommands.end( ) )
+  {
+    this->m_LeaveCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
 DelegateTDxEvent( unsigned long event, void* calldata )
 {
   // TODO
@@ -111,7 +253,7 @@ DelegateTDxEvent( unsigned long event, void* calldata )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMouseMove( )
 {
   // Get current position on the associated actors
@@ -153,19 +295,19 @@ OnMouseMove( )
   } // fi
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible specialized events
-  for( unsigned int i = 0; i < this->m_MouseMoveCommands.size( ); ++i )
-    this->m_MouseMoveCommands[ i ].first(
-      this->m_MouseMoveCommands[ i ].second, button, pos, alt, ctr, sft
-      );
+  auto i = this->m_MouseMoveCommands.begin( );
+  for( ; i != this->m_MouseMoveCommands.end( ); ++i )
+    i->first( i->second, button, idx, pos, alt, ctr, sft );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMouseWheelForward( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -173,9 +315,10 @@ OnMouseWheelForward( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseWheelCommands.size( ); ++i )
-    this->m_MouseWheelCommands[ i ].first(
-      this->m_MouseWheelCommands[ i ].second, 1,
+  auto i = this->m_MouseWheelCommands.begin( );
+  for( ; i != this->m_MouseWheelCommands.end( ); ++i )
+    i->first(
+      i->second, 1,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -183,7 +326,7 @@ OnMouseWheelForward( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMouseWheelBackward( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -191,9 +334,10 @@ OnMouseWheelBackward( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseWheelCommands.size( ); ++i )
-    this->m_MouseWheelCommands[ i ].first(
-      this->m_MouseWheelCommands[ i ].second, -1,
+  auto i = this->m_MouseWheelCommands.begin( );
+  for( ; i != this->m_MouseWheelCommands.end( ); ++i )
+    i->first(
+      i->second, -1,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -201,21 +345,21 @@ OnMouseWheelBackward( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnLeftButtonDown( )
 {
   this->m_ActiveButton = Self::ButtonID_Left;
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnLeftButtonUp( )
 {
   this->m_ActiveButton = Self::ButtonID_None;
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMiddleButtonDown( )
 {
   this->m_ActiveButton = Self::ButtonID_Middle;
@@ -235,7 +379,7 @@ OnMiddleButtonDown( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMiddleButtonUp( )
 {
   this->m_ActiveButton = Self::ButtonID_None;
@@ -261,7 +405,7 @@ OnMiddleButtonUp( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnRightButtonDown( )
 {
   this->m_ActiveButton = Self::ButtonID_Right;
@@ -281,7 +425,7 @@ OnRightButtonDown( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnRightButtonUp( )
 {
   this->m_ActiveButton = Self::ButtonID_None;
@@ -307,7 +451,7 @@ OnRightButtonUp( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnLeftClick( )
 {
   // Get current position on the associated actors
@@ -316,16 +460,18 @@ OnLeftClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseClickCommands[ i ].first(
-      this->m_MouseClickCommands[ i ].second,
+  auto i = this->m_MouseClickCommands.begin( );
+  for( ; i != this->m_MouseClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Left,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -333,7 +479,7 @@ OnLeftClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnLeftDoubleClick( )
 {
   // Get current position on the associated actors
@@ -342,16 +488,18 @@ OnLeftDoubleClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseDoubleClickCommands[ i ].first(
-      this->m_MouseDoubleClickCommands[ i ].second,
+  auto i = this->m_MouseDoubleClickCommands.begin( );
+  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Left,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -359,7 +507,7 @@ OnLeftDoubleClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMiddleClick( )
 {
   // Get current position on the associated actors
@@ -368,16 +516,18 @@ OnMiddleClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseClickCommands[ i ].first(
-      this->m_MouseClickCommands[ i ].second,
+  auto i = this->m_MouseClickCommands.begin( );
+  for( ; i != this->m_MouseClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Middle,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -385,7 +535,7 @@ OnMiddleClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnMiddleDoubleClick( )
 {
   // Get current position on the associated actors
@@ -394,16 +544,18 @@ OnMiddleDoubleClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseDoubleClickCommands[ i ].first(
-      this->m_MouseDoubleClickCommands[ i ].second,
+  auto i = this->m_MouseDoubleClickCommands.begin( );
+  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Middle,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -411,7 +563,7 @@ OnMiddleDoubleClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnRightClick( )
 {
   // Get current position on the associated actors
@@ -420,16 +572,18 @@ OnRightClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseClickCommands[ i ].first(
-      this->m_MouseClickCommands[ i ].second,
+  auto i = this->m_MouseClickCommands.begin( );
+  for( ; i != this->m_MouseClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Right,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -437,7 +591,7 @@ OnRightClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnRightDoubleClick( )
 {
   // Get current position on the associated actors
@@ -446,16 +600,18 @@ OnRightDoubleClick( )
     return;
 
   // Get mouse pointer position
-  double pos[ 3 ];
-  if( !( this->_PickPosition( pos ) ) )
+  static int idx[ 2 ];
+  static double pos[ 3 ];
+  if( !( this->_PickPosition( idx, pos ) ) )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_MouseClickCommands.size( ); ++i )
-    this->m_MouseDoubleClickCommands[ i ].first(
-      this->m_MouseDoubleClickCommands[ i ].second,
+  auto i = this->m_MouseDoubleClickCommands.begin( );
+  for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
+    i->first(
+      i->second,
       Self::ButtonID_Right,
-      pos,
+      idx, pos,
       rwi->GetAltKey( ) == 1,
       rwi->GetControlKey( ) == 1,
       rwi->GetShiftKey( ) == 1
@@ -463,7 +619,7 @@ OnRightDoubleClick( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnChar( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -471,39 +627,37 @@ OnChar( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_KeyCommands.size( ); ++i )
-    this->m_KeyCommands[ i ].first(
-      this->m_KeyCommands[ i ].second,
-      rwi->GetKeyCode( )
-      );
+  auto i = this->m_KeyCommands.begin( );
+  for( ; i != this->m_KeyCommands.end( ); ++i )
+    i->first( i->second, rwi->GetKeyCode( ) );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnKeyDown( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnKeyUp( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnKeyPress( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnKeyRelease( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnExpose( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -511,12 +665,13 @@ OnExpose( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_ExposeCommands.size( ); ++i )
-    this->m_ExposeCommands[ i ].first( this->m_ExposeCommands[ i ].second );
+  auto i = this->m_ExposeCommands.begin( );
+  for( ; i != this->m_ExposeCommands.end( ); ++i )
+    i->first( i->second );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnConfigure( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -524,14 +679,13 @@ OnConfigure( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_ConfigureCommands.size( ); ++i )
-    this->m_ConfigureCommands[ i ].first(
-      this->m_ConfigureCommands[ i ].second
-      );
+  auto i = this->m_ConfigureCommands.begin( );
+  for( ; i != this->m_ConfigureCommands.end( ); ++i )
+    i->first( i->second );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnEnter( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -539,12 +693,13 @@ OnEnter( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_EnterCommands.size( ); ++i )
-    this->m_EnterCommands[ i ].first( this->m_EnterCommands[ i ].second );
+  auto i = this->m_EnterCommands.begin( );
+  for( ; i != this->m_EnterCommands.end( ); ++i )
+    i->first( i->second );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 OnLeave( )
 {
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
@@ -552,12 +707,13 @@ OnLeave( )
     return;
 
   // Invoke possible events
-  for( unsigned int i = 0; i < this->m_LeaveCommands.size( ); ++i )
-    this->m_LeaveCommands[ i ].first( this->m_LeaveCommands[ i ].second );
+  auto i = this->m_LeaveCommands.begin( );
+  for( ; i != this->m_LeaveCommands.end( ); ++i )
+    i->first( i->second );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 Dolly( )
 {
   if( this->CurrentRenderer == NULL )
@@ -571,7 +727,7 @@ Dolly( )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 Pan( )
 {
   if( this->CurrentRenderer == NULL )
@@ -627,7 +783,7 @@ Pan( )
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::BaseInteractorStyle::
+cpExtensions::Interaction::BaseInteractorStyle::
 BaseInteractorStyle( )
   : Superclass( ),
     m_MotionFactor( double( 10 ) )
@@ -641,13 +797,13 @@ BaseInteractorStyle( )
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::BaseInteractorStyle::
+cpExtensions::Interaction::BaseInteractorStyle::
 ~BaseInteractorStyle( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 _Dolly( double factor )
 {
   if( this->CurrentRenderer == NULL )
@@ -668,7 +824,7 @@ _Dolly( double factor )
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::BaseInteractorStyle::
+void cpExtensions::Interaction::BaseInteractorStyle::
 _ProcessEvents(
   vtkObject* object,
   unsigned long event,
similarity index 75%
rename from lib/cpExtensions/Visualization/BaseInteractorStyle.h
rename to lib/cpExtensions/Interaction/BaseInteractorStyle.h
index c02dbc7ee701e9e3e1fe957483a59ddc284c2337..1501f00297b4b48c06b78236d448d556def73cd9 100644 (file)
@@ -1,11 +1,12 @@
-#ifndef __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
-#define __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
+#ifndef __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
+#define __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
 
 #include <cpExtensions/cpExtensions_Export.h>
 
 #include <chrono>
+#include <map>
 #include <utility>
-#include <vector>
+
 #include <vtkInteractorStyle.h>
 
 /* =========================================================================
@@ -22,7 +23,7 @@
 
 namespace cpExtensions
 {
-  namespace Visualization
+  namespace Interaction
   {
     /**
      */
@@ -42,12 +43,16 @@ namespace cpExtensions
       };
 
       // Callbacks types
-      typedef void ( *TMouseCommand )( void*, const ButtonID&, double*, bool, bool, bool );
+      typedef void ( *TMouseCommand )(
+        void*, const ButtonID&, int*, double*, bool, bool, bool
+        );
       typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
       typedef void ( *TKeyCommand )( void*, const char& );
       typedef void ( *TVoidCommand )( void* );
 
     public:
+      static void SetSetDoubleClickDelay( long delay );
+
       // Associate callbacks for each event
       void AddMouseMoveCommand( TMouseCommand command, void* data );
       void AddMouseClickCommand( TMouseCommand command, void* data );
@@ -59,6 +64,16 @@ namespace cpExtensions
       void AddEnterCommand( TVoidCommand command, void* data );
       void AddLeaveCommand( TVoidCommand command, void* data );
 
+      void RemoveMouseMoveCommand( TMouseCommand command );
+      void RemoveMouseClickCommand( TMouseCommand command );
+      void RemoveMouseDoubleClickCommand( TMouseCommand command );
+      void RemoveMouseWheelCommand( TMouseWheelCommand command );
+      void RemoveKeyCommand( TKeyCommand command );
+      void RemoveExposeCommand( TVoidCommand command );
+      void RemoveConfigureCommand( TVoidCommand command );
+      void RemoveEnterCommand( TVoidCommand command );
+      void RemoveLeaveCommand( TVoidCommand command );
+
       void DelegateTDxEvent( unsigned long event, void* calldata );
 
       // Possible mouse motion events
@@ -68,7 +83,9 @@ namespace cpExtensions
 
       // Possible mouse click-related events
       inline ButtonID GetButtonID( ) const
-        { return( this->m_ActiveButton ); }
+      {
+        return( this->m_ActiveButton );
+      }
 
       virtual void OnLeftButtonDown( );
       virtual void OnLeftButtonUp( );
@@ -107,7 +124,7 @@ namespace cpExtensions
       virtual void _Dolly( double factor );
 
       // Extension interface
-      virtual bool _PickPosition( double pos[ 3 ] ) = 0;
+      virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] ) = 0;
 
       // Main event callback
       static void _ProcessEvents(
@@ -126,15 +143,15 @@ namespace cpExtensions
       double m_MotionFactor;
 
       // Callbacks
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseMoveCommands;
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseClickCommands;
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseDoubleClickCommands;
-      std::vector< std::pair< TMouseWheelCommand, void* > > m_MouseWheelCommands;
-      std::vector< std::pair< TKeyCommand, void* > >        m_KeyCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_ExposeCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_ConfigureCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_EnterCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_LeaveCommands;
+      std::map< TMouseCommand, void* >      m_MouseMoveCommands;
+      std::map< TMouseCommand, void* >      m_MouseClickCommands;
+      std::map< TMouseCommand, void* >      m_MouseDoubleClickCommands;
+      std::map< TMouseWheelCommand, void* > m_MouseWheelCommands;
+      std::map< TKeyCommand, void* >        m_KeyCommands;
+      std::map< TVoidCommand, void* >       m_ExposeCommands;
+      std::map< TVoidCommand, void* >       m_ConfigureCommands;
+      std::map< TVoidCommand, void* >       m_EnterCommands;
+      std::map< TVoidCommand, void* >       m_LeaveCommands;
 
       /**
        * Button events
@@ -183,13 +200,13 @@ namespace cpExtensions
       _TMouseButtonEvent m_LeftButtonEvent;
       _TMouseButtonEvent m_MiddleButtonEvent;
       _TMouseButtonEvent m_RightButtonEvent;
-      ButtonID         m_ActiveButton;
+      ButtonID           m_ActiveButton;
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#endif // __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
+#endif // __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
 
 // eof - $RCSfile$
similarity index 61%
rename from lib/cpExtensions/Visualization/ImageInteractorStyle.cxx
rename to lib/cpExtensions/Interaction/ImageInteractorStyle.cxx
index 9ed180ad93a42e45229d5508e5e5e4490b0a0e15..d0a313760b8bac6e1c8096b8eed35f85a8b78dda 100644 (file)
@@ -1,18 +1,18 @@
-#include <cpExtensions/Visualization/ImageInteractorStyle.h>
+#include <cpExtensions/Interaction/ImageInteractorStyle.h>
 
 #include <vtkImageActor.h>
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
-Self* cpExtensions::Visualization::ImageInteractorStyle::
+cpExtensions::Interaction::ImageInteractorStyle::
+Self* cpExtensions::Interaction::ImageInteractorStyle::
 New( )
 {
   return( new Self );
 }
 
 // -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageInteractorStyle::
+void cpExtensions::Interaction::ImageInteractorStyle::
 AssociateImageActor( vtkImageActor* actor )
 {
   if( actor != NULL )
@@ -24,7 +24,7 @@ AssociateImageActor( vtkImageActor* actor )
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
+cpExtensions::Interaction::ImageInteractorStyle::
 ImageInteractorStyle( )
   : Superclass( )
 {
@@ -33,27 +33,29 @@ ImageInteractorStyle( )
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageInteractorStyle::
+cpExtensions::Interaction::ImageInteractorStyle::
 ~ImageInteractorStyle( )
 {
 }
 
 // -------------------------------------------------------------------------
-bool cpExtensions::Visualization::ImageInteractorStyle::
-_PickPosition( double pos[ 3 ] )
+bool cpExtensions::Interaction::ImageInteractorStyle::
+_PickPosition( int idx[ 2 ], double pos[ 3 ] )
 {
-  static const double _0 = double( 0 );
   vtkRenderWindowInteractor* rwi = this->GetInteractor( );
   if( rwi == NULL )
     return( false );
 
   // Find the renderer where the event has been raised
-  double x = double( rwi->GetEventPosition( )[ 0 ] );
-  double y = double( rwi->GetEventPosition( )[ 1 ] );
-  this->FindPokedRenderer( x, y );
+  idx[ 0 ] = rwi->GetEventPosition( )[ 0 ];
+  idx[ 1 ] = rwi->GetEventPosition( )[ 1 ];
+  this->FindPokedRenderer( double( idx[ 0 ] ), double( idx[ 1 ] ) );
 
   // Pick a 3D position
-  int r = this->m_PropPicker->Pick( x, y, _0, this->CurrentRenderer );
+  int r = this->m_PropPicker->Pick(
+    double( idx[ 0 ] ), double( idx[ 1 ] ), double( 0 ),
+    this->CurrentRenderer
+    );
   if( r == 0 )
     return( false );
   this->m_PropPicker->GetPickPosition( pos );
similarity index 71%
rename from lib/cpExtensions/Visualization/ImageInteractorStyle.h
rename to lib/cpExtensions/Interaction/ImageInteractorStyle.h
index 9048926cb8822f8ead5a697f51f9396a3ba18de7..78bf7da38a9952962cc891e0dd8c75d3b91444b7 100644 (file)
@@ -1,7 +1,7 @@
-#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
-#define __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
+#ifndef __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
+#define __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
 
-#include <cpExtensions/Visualization/BaseInteractorStyle.h>
+#include <cpExtensions/Interaction/BaseInteractorStyle.h>
 
 #include <vector>
 
@@ -13,7 +13,7 @@ class vtkImageActor;
 
 namespace cpExtensions
 {
-  namespace Visualization
+  namespace Interaction
   {
     /**
      */
@@ -34,7 +34,7 @@ namespace cpExtensions
       ImageInteractorStyle( );
       virtual ~ImageInteractorStyle( );
 
-      virtual bool _PickPosition( double pos[ 3 ] );
+      virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] );
 
     private:
       // Purposely not implemented
@@ -49,6 +49,6 @@ namespace cpExtensions
 
 } // ecapseman
 
-#endif // __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
+#endif // __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
 
 // eof - $RCSfile$
diff --git a/lib/cpExtensions/Interaction/SeedWidget.cxx b/lib/cpExtensions/Interaction/SeedWidget.cxx
new file mode 100644 (file)
index 0000000..3460532
--- /dev/null
@@ -0,0 +1,86 @@
+#include <cpExtensions/Interaction/SeedWidget.h>
+
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkSeedRepresentation.h>
+#include <vtkWidgetEventTranslator.h>
+#include <vtkWidgetRepresentation.h>
+
+// -------------------------------------------------------------------------
+cpExtensions::Interaction::SeedWidget::
+Self* cpExtensions::Interaction::SeedWidget::
+New( )
+{
+  return( new Self );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::SeedWidget::
+SetInteractor( vtkRenderWindowInteractor* rwi )
+{
+  this->Superclass::SetInteractor( rwi );
+  TBaseStyle* s = dynamic_cast< TBaseStyle*>( rwi->GetInteractorStyle( ) );
+  if( s != NULL )
+  {
+    s->AddMouseClickCommand( Self::_Click, this );
+    s->AddMouseDoubleClickCommand( Self::_DoubleClick, this );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Interaction::SeedWidget::
+SeedWidget( )
+  : Superclass( )
+{
+  // Remove default translations
+  vtkWidgetEventTranslator* t = this->GetEventTranslator( );
+  t->RemoveTranslation( vtkCommand::LeftButtonPressEvent );
+  t->RemoveTranslation( vtkCommand::MiddleButtonPressEvent );
+  t->RemoveTranslation( vtkCommand::RightButtonPressEvent );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Interaction::SeedWidget::
+~SeedWidget( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::SeedWidget::
+_Click(
+  void* data, const TBaseStyle::ButtonID& button,
+  int* idx, double* pos, bool alt, bool ctr, bool sft
+  )
+{
+  SeedWidget* self = reinterpret_cast< SeedWidget* >( data );
+  if( self->WidgetState == vtkSeedWidget::MovingSeed )
+    return;
+
+  int st = self->WidgetRep->ComputeInteractionState( idx[ 0 ], idx[ 1 ] );
+  if( st == vtkSeedRepresentation::NearSeed )
+  {
+    self->WidgetState = vtkSeedWidget::MovingSeed;
+
+    // Invoke an event on ourself for the handles
+    self->InvokeEvent( vtkCommand::LeftButtonPressEvent, NULL );
+    self->Superclass::StartInteraction( );
+    self->InvokeEvent( vtkCommand::StartInteractionEvent, NULL );
+    self->EventCallbackCommand->SetAbortFlag( 1 );
+    self->Render( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::SeedWidget::
+_DoubleClick(
+  void* data, const TBaseStyle::ButtonID& button,
+  int* idx, double* pos, bool alt, bool ctr, bool sft
+  )
+{
+  Self::AddPointAction( reinterpret_cast< vtkAbstractWidget* >( data ) );
+}
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Interaction/SeedWidget.h b/lib/cpExtensions/Interaction/SeedWidget.h
new file mode 100644 (file)
index 0000000..526ac7e
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef __CPEXTENSIONS__INTERACTION__SEEDWIDGET__H__
+#define __CPEXTENSIONS__INTERACTION__SEEDWIDGET__H__
+
+#include <cpExtensions/cpExtensions_Export.h>
+#include <cpExtensions/Interaction/BaseInteractorStyle.h>
+#include <vtkSeedWidget.h>
+
+namespace cpExtensions
+{
+  namespace Interaction
+  {
+    /**
+     */
+    class cpExtensions_EXPORT SeedWidget
+      : public vtkSeedWidget
+    {
+    public:
+      typedef SeedWidget Self;
+      vtkTypeMacro( SeedWidget, vtkSeedWidget );
+
+      typedef cpExtensions::Interaction::BaseInteractorStyle TBaseStyle;
+      typedef TBaseStyle::TMouseCommand TMouseCommand;
+
+    public:
+      static Self* New( );
+
+      virtual void SetInteractor( vtkRenderWindowInteractor* rwi );
+
+    protected:
+      SeedWidget( );
+      virtual ~SeedWidget( );
+
+      static void _Click(
+        void* data, const TBaseStyle::ButtonID& button,
+        int* idx, double* pos, bool alt, bool ctr, bool sft
+        );
+      static void _DoubleClick(
+        void* data, const TBaseStyle::ButtonID& button,
+        int* idx, double* pos, bool alt, bool ctr, bool sft
+        );
+
+    private:
+      // Purposely not implemented
+      SeedWidget( const Self& );
+      Self& operator=( const Self& );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __CPEXTENSIONS__INTERACTION__SEEDWIDGET__H__
+
+// eof - $RCSfile$
index 5892fe14b90ec4b9028a90efaa075e86b87a7fbb..17dc4c45035be5b973135d00e93a81f6266d6ac6 100644 (file)
@@ -29,22 +29,77 @@ New( )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-AddSlicesCommand( TCursorCommand command, void* data )
+AddSlicesCommand( TSlicesCommand command, void* data )
 {
-  this->m_SlicesCommands.push_back(
-    std::pair< TCursorCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_SlicesCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-AddSeedCommand( TCursorCommand command, void* data )
+AddWindowLevelCommand( TWindowLevelCommand command, void* data )
 {
-  this->m_SeedCommands.push_back(
-    std::pair< TCursorCommand, void* >( command, data )
-    );
-  this->Modified( );
+  if( command != NULL )
+  {
+    this->m_WindowLevelCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AddRenderCommand( TVoidCommand command, void* data )
+{
+  if( command != NULL )
+  {
+    this->m_RenderCommands[ command ] = data;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+RemoveSlicesCommand( TSlicesCommand command )
+{
+  auto i = this->m_SlicesCommands.find( command );
+  if( i != this->m_SlicesCommands.end( ) )
+  {
+    this->m_SlicesCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+RemoveWindowLevelCommand( TWindowLevelCommand command )
+{
+  auto i = this->m_WindowLevelCommands.find( command );
+  if( i != this->m_WindowLevelCommands.end( ) )
+  {
+    this->m_WindowLevelCommands.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+RemoveRenderCommand( TVoidCommand command )
+{
+  auto i = this->m_RenderCommands.find( command );
+  if( i != this->m_RenderCommands.end( ) )
+  {
+    this->m_RenderCommands.erase( i );
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -126,8 +181,6 @@ Clear( )
   this->m_ImageMaps.clear( );
   this->m_SliceMappers.clear( );
   this->m_ImageActors.clear( );
-  this->m_AssociatedSlices.clear( );
-  this->m_AssociatedActors.clear( );
 
   // Reconfigure unique objects
   this->m_Cursor        = vtkSmartPointer< vtkPolyData >::New( );
@@ -211,14 +264,6 @@ Clear( )
   this->AddItem( this->m_PlaneActor );
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AssociateSlice( Self* other )
-{
-  this->m_AssociatedSlices.push_back( other );
-  this->Modified( );
-}
-
 // -------------------------------------------------------------------------
 vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
 GetStyle( )
@@ -375,21 +420,6 @@ GetPlaneFunction( ) const
   return( this->m_PlaneFunction );
 }
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddActor( vtkAlgorithm* algorithm, vtkActor* actor )
-{
-  this->m_AssociatedActors.push_back( TAssociatedActor( algorithm, actor ) );
-  this->AddItem( actor );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddActor( vtkActor* actor )
-{
-  this->AddActor( NULL, actor );
-}
-
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 SetInterpolate( bool v )
@@ -808,26 +838,38 @@ SetSliceNumber( const int& slice )
   if( nImages == 0 )
     return;
 
+  // Compute plane properties
+  int axis = this->m_SliceMappers[ 0 ]->GetOrientation( );
+  vtkAlgorithm* algo = this->m_SliceMappers[ 0 ]->GetInputAlgorithm( );
+  vtkInformation* info = algo->GetOutputInformation( 0 );
+  int ext[ 6 ];
+  double ori[ 3 ], spac[ 3 ], pos[ 3 ];
+  info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext );
+  info->Get( vtkDataObject::ORIGIN( ), ori );
+  info->Get( vtkDataObject::SPACING( ), spac );
+  this->m_SliceMappers[ 0 ]->GetSlicePlane( )->GetOrigin( pos );
+
+  // Update display extent
+  int d_ext[ 6 ] =
+    {
+      ext[ 0 ], ext[ 1 ],
+      ext[ 2 ], ext[ 3 ],
+      ext[ 4 ], ext[ 5 ]
+    };
+  d_ext[ axis << 1 ] = slice;
+  d_ext[ ( axis << 1 ) + 1 ] = slice;
+
   // Change visualization extent
   for( unsigned int i = 0; i < nImages; ++i )
   {
     this->m_SliceMappers[ i ]->SetSliceNumber( slice );
+    this->m_ImageActors[ i ]->SetDisplayExtent( d_ext );
     this->m_SliceMappers[ i ]->Modified( );
     this->m_ImageActors[ i ]->Modified( );
     this->m_SliceMappers[ i ]->Update( );
 
   } // rof
 
-  // Compute plane
-  vtkAlgorithm* algo = this->m_SliceMappers[ 0 ]->GetInputAlgorithm( );
-  vtkInformation* info = algo->GetOutputInformation( 0 );
-  int ext[ 6 ];
-  double ori[ 3 ], spac[ 3 ], pos[ 3 ];
-  info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext );
-  info->Get( vtkDataObject::ORIGIN( ), ori );
-  info->Get( vtkDataObject::SPACING( ), spac );
-  this->m_SliceMappers[ 0 ]->GetSlicePlane( )->GetOrigin( pos );
-
   // Prevent obscuring voxels by offsetting the plane geometry
   double xbnds[ ] =
     {
@@ -871,7 +913,6 @@ SetSliceNumber( const int& slice )
   this->m_PlaneFunction->SetOrigin( pos );
 
   // Configure visualization and implicit plane orientation
-  int axis = this->m_SliceMappers[ 0 ]->GetOrientation( );
   this->m_PlaneActor->GetProperty( )->SetRepresentationToWireframe( );
   this->m_PlaneActor->GetProperty( )->SetLineWidth( 2 );
   vtkPoints* plane_points = this->m_Plane->GetPoints( );
@@ -908,37 +949,8 @@ SetSliceNumber( const int& slice )
   this->m_PlaneMapper->Modified( );
   this->m_PlaneActor->Modified( );
 
-  // Prepare other actors to update
-  /* TODO
-     for( unsigned int i = 0; i < this->OtherActors.size( ); ++i )
-     {
-     if( this->OtherActors[ i ].first.GetPointer( ) != NULL )
-     {
-     this->OtherActors[ i ].first->Modified( );
-     this->OtherActors[ i ].first->Update( );
-
-     } // fi
-
-     if( this->OtherActors[ i ].second.GetPointer( ) != NULL )
-     {
-     this->OtherActors[ i ].second->GetMapper( )->Modified( );
-     this->OtherActors[ i ].second->Modified( );
-
-     } // fi
-
-     } // rof
-
-     if( this->m_UpdateCommand != NULL )
-     this->m_UpdateCommand( this->m_UpdateData );
-  */
-
   // Update text
   this->UpdateText( );
-
-  // Associated slices
-  for( unsigned int i = 0; i < this->m_AssociatedSlices.size( ); ++i )
-    if( this->m_AssociatedSlices[ i ]->GetAxis( ) == this->GetAxis( ) )
-      this->m_AssociatedSlices[ i ]->SetSliceNumber( slice );
 }
 
 // -------------------------------------------------------------------------
@@ -1068,6 +1080,36 @@ UpdateText( const double& w, const double& l )
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+Render( )
+{
+  vtkInteractorStyle* style = this->GetStyle( );
+  if( style == NULL )
+    return;
+  vtkRenderWindowInteractor* rwi = style->GetInteractor( );
+  if( rwi != NULL )
+    rwi->Render( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+ResetCamera( )
+{
+  vtkInteractorStyle* style = this->GetStyle( );
+  if( style == NULL )
+    return;
+  vtkRenderWindowInteractor* rwi = style->GetInteractor( );
+  if( rwi == NULL )
+    return;
+  vtkRenderWindow* rw = rwi->GetRenderWindow( );
+  if( rw == NULL )
+    return;
+  vtkRenderer* renderer = rw->GetRenderers( )->GetFirstRenderer( );
+  if( renderer != NULL )
+    renderer->ResetCamera( );
+}
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::ImageSliceActors::
 ImageSliceActors( )
@@ -1089,12 +1131,9 @@ void cpExtensions::Visualization::ImageSliceActors::
 _ConfigureStyle( )
 {
   // Connect this view with a controller
-  this->m_Style = vtkSmartPointer< ImageInteractorStyle >::New( );
+  this->m_Style = vtkSmartPointer< TStyle >::New( );
   this->m_Style->AddMouseMoveCommand( Self::_MouseMoveCommand, this );
   this->m_Style->AddMouseClickCommand( Self::_MouseClickCommand, this );
-  this->m_Style->AddMouseDoubleClickCommand(
-    Self::_MouseDoubleClickCommand, this
-    );
   this->m_Style->AddMouseWheelCommand( Self::_MouseWheelCommand, this );
   this->m_Style->AddKeyCommand( Self::_KeyCommand, this );
 }
@@ -1174,8 +1213,7 @@ _ConfigureNewInput( int axis )
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 _MouseMoveCommand(
-  void* data,
-  const ImageInteractorStyle::ButtonID& btn, double* pos,
+  void* data, const TStyle::ButtonID& btn, int* idx, double* pos,
   bool alt, bool ctr, bool sft
   )
 {
@@ -1183,32 +1221,33 @@ _MouseMoveCommand(
   if( actors == NULL )
     return;
 
-  if( btn == ImageInteractorStyle::ButtonID_None )
+  if( btn == TStyle::ButtonID_None )
   {
+    // Just show the pixel information
     actors->SetCursor( pos );
     actors->UpdateText( pos );
-    actors->GetStyle( )->GetInteractor( )->Render( );
-  }
-  else if( btn == ImageInteractorStyle::ButtonID_Left )
-  {
-    unsigned int nC = actors->m_SlicesCommands.size( );
-    if( !alt && ctr && !sft && nC > 0 )
-    {
-      for( unsigned int i = 0; i < nC; ++i )
-        actors->m_SlicesCommands[ i ].first(
-          pos, actors->GetAxis( ), actors->m_SlicesCommands[ i ].second
-          );
-      actors->GetStyle( )->GetInteractor( )->Render( );
-
-    } // fi
+    actors->Render( );
   }
-  else if( btn == ImageInteractorStyle::ButtonID_Middle )
+  else if( btn == TStyle::ButtonID_Left )
   {
+    /* TODO
+       unsigned int nC = actors->m_SlicesCommands.size( );
+       if( !alt && ctr && !sft && nC > 0 )
+       {
+       for( unsigned int i = 0; i < nC; ++i )
+       actors->m_SlicesCommands[ i ].first(
+       pos, actors->GetAxis( ), actors->m_SlicesCommands[ i ].second
+       );
+       actors->Render( );
+
+       } // fi
+    */
   }
-  else if( btn == ImageInteractorStyle::ButtonID_Right )
+  else if( btn == TStyle::ButtonID_Right )
   {
     if( !alt && !ctr && sft )
     {
+      // Change image window level
       double bounds[ 6 ];
       actors->m_SliceMappers[ 0 ]->GetBounds( bounds );
 
@@ -1222,12 +1261,16 @@ _MouseMoveCommand(
 
       dx *= actors->m_StartWindowLevel[ 0 ];
       dy *= actors->m_StartWindowLevel[ 1 ];
-      actors->SetWindowLevel(
-        actors->m_StartWindowLevel[ 0 ] + dx,
-        actors->m_StartWindowLevel[ 1 ] + dy
-        );
-      actors->GetStyle( )->GetInteractor( )->Render( );
-
+      dx += actors->m_StartWindowLevel[ 0 ];
+      dy += actors->m_StartWindowLevel[ 1 ];
+      actors->SetWindowLevel( dx, dy );
+      actors->Render( );
+
+      // Associate objects
+      auto i = actors->m_WindowLevelCommands.begin( );
+      for( ; i != actors->m_WindowLevelCommands.end( ); ++i )
+        i->first( dx, dy, i->second );
+      
     } // fi
 
   } // fi
@@ -1236,8 +1279,7 @@ _MouseMoveCommand(
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 _MouseClickCommand(
-  void* data,
-  const ImageInteractorStyle::ButtonID& btn, double* pos,
+  void* data, const TStyle::ButtonID& btn, int* idx, double* pos,
   bool alt, bool ctr, bool sft
   )
 {
@@ -1254,9 +1296,8 @@ _MouseClickCommand(
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-_MouseDoubleClickCommand(
-  void* data,
-  const ImageInteractorStyle::ButtonID& btn, double* pos,
+_MouseWheelCommand(
+  void* data, const int& dir,
   bool alt, bool ctr, bool sft
   )
 {
@@ -1264,55 +1305,59 @@ _MouseDoubleClickCommand(
   if( actors == NULL )
     return;
 
-  if( btn == ImageInteractorStyle::ButtonID_Left )
+  if( !alt && !ctr )
   {
-    unsigned int nC = actors->m_SeedCommands.size( );
-    if( !alt && ctr && !sft && nC > 0 )
-    {
-      for( unsigned int i = 0; i < nC; ++i )
-        actors->m_SeedCommands[ i ].first(
-          pos, actors->GetAxis( ), actors->m_SeedCommands[ i ].second
-          );
-      actors->GetStyle( )->GetInteractor( )->Render( );
+    int slice = actors->GetSliceNumber( ) + ( dir * ( ( sft )? 10: 1 ) );
+    if( slice < actors->GetSliceNumberMinValue( ) )
+      slice = actors->GetSliceNumberMinValue( );
+    if( slice > actors->GetSliceNumberMaxValue( ) )
+      slice = actors->GetSliceNumberMaxValue( );
+    actors->SetSliceNumber( slice );
+    actors->Render( );
+
+    // Associate objects
+    auto i = actors->m_RenderCommands.begin( );
+    for( ; i != actors->m_RenderCommands.end( ); ++i )
+      i->first( i->second );
 
-    } // fi
-  }
-  else if( btn == ImageInteractorStyle::ButtonID_Middle )
-  {
-  }
-  else if( btn == ImageInteractorStyle::ButtonID_Right )
-  {
   } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
-_MouseWheelCommand(
-  void* data,
-  const int& dir, bool alt, bool ctr, bool sft
-  )
+_KeyCommand( void* data, const char& key )
 {
   ImageSliceActors* actors = reinterpret_cast< ImageSliceActors* >( data );
   if( actors == NULL )
     return;
 
-  if( !alt && !ctr && !sft )
+  switch( key )
   {
-    actors->SetSliceNumber( actors->GetSliceNumber( ) + dir );
-    actors->GetStyle( )->GetInteractor( )->Render( );
-  }
-  else if( !alt && !ctr && sft )
+  case 'r': case 'R':
   {
-    actors->SetSliceNumber( actors->GetSliceNumber( ) + ( dir * 10 ) );
-    actors->GetStyle( )->GetInteractor( )->Render( );
+    actors->ResetCamera( );
+    actors->Render( );
 
-  } // fi
-}
+    // Associate objects
+    auto i = actors->m_RenderCommands.begin( );
+    for( ; i != actors->m_RenderCommands.end( ); ++i )
+      i->first( i->second );
+  }
+  break;
+  case 'w': case 'W':
+  {
+    actors->ResetWindowLevel( );
+    actors->Render( );
 
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-_KeyCommand( void* data, const char& key )
-{
+    // Associate objects
+    auto i = actors->m_RenderCommands.begin( );
+    for( ; i != actors->m_RenderCommands.end( ); ++i )
+      i->first( i->second );
+  }
+  break;
+  default:
+    break;
+  } // hctiws
 }
 
 // eof - $RCSfile$
index 96d4550c52039613aaf8b96109d6afce535e75a8..6c7d40547deac4957c3a3de3a3e46f9d26ff6826 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <cpExtensions/cpExtensions_Export.h>
 
+#include <map>
 #include <utility>
-#include <vector>
 
 #include <vtkSmartPointer.h>
 #include <vtkActor.h>
@@ -17,7 +17,7 @@
 #include <vtkPropCollection.h>
 #include <vtkTextActor.h>
 
-#include <cpExtensions/Visualization/ImageInteractorStyle.h>
+#include <cpExtensions/Interaction/ImageInteractorStyle.h>
 
 // -------------------------------------------------------------------------
 class vtkAlgorithmOutput;
@@ -37,11 +37,14 @@ namespace cpExtensions
     public:
       typedef ImageSliceActors Self;
 
-      typedef void ( *TCursorCommand )( double*, int, void* );
-      typedef BaseInteractorStyle::TMouseCommand      TMouseCommand;
-      typedef BaseInteractorStyle::TMouseWheelCommand TMouseWheelCommand;
-      typedef BaseInteractorStyle::TKeyCommand        TKeyCommand;
-      typedef BaseInteractorStyle::TVoidCommand       TVoidCommand;
+      typedef cpExtensions::Interaction::BaseInteractorStyle  TBaseStyle;
+      typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
+      typedef void ( *TSlicesCommand )( double*, int, void* );
+      typedef void ( *TWindowLevelCommand )( double, double, void* );
+      typedef TBaseStyle::TMouseCommand      TMouseCommand;
+      typedef TBaseStyle::TMouseWheelCommand TMouseWheelCommand;
+      typedef TBaseStyle::TKeyCommand        TKeyCommand;
+      typedef TBaseStyle::TVoidCommand       TVoidCommand;
 
     public:
       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
@@ -50,15 +53,18 @@ namespace cpExtensions
       // Creation
       static ImageSliceActors* New( );
 
-      void AddSlicesCommand( TCursorCommand command, void* data );
-      void AddSeedCommand( TCursorCommand command, void* data );
+      void AddSlicesCommand( TSlicesCommand command, void* data );
+      void AddWindowLevelCommand( TWindowLevelCommand command, void* data );
+      void AddRenderCommand( TVoidCommand command, void* data );
+
+      void RemoveSlicesCommand( TSlicesCommand command );
+      void RemoveWindowLevelCommand( TWindowLevelCommand command );
+      void RemoveRenderCommand( TVoidCommand command );
 
       void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
       void AddInputData( vtkImageData* data, int axis = 2 );
       void Clear( );
 
-      void AssociateSlice( Self* other );
-
       vtkInteractorStyle* GetStyle( );
       const vtkInteractorStyle* GetStyle( ) const;
 
@@ -74,9 +80,6 @@ namespace cpExtensions
       vtkPlane* GetPlaneFunction( );
       const vtkPlane* GetPlaneFunction( ) const;
 
-      void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
-      void AddActor( vtkActor* actor );
-
       void SetInterpolate( bool v );
       void InterpolateOn( );
       void InterpolateOff( );
@@ -116,6 +119,9 @@ namespace cpExtensions
       void UpdateText( double pos[ 3 ] );
       void UpdateText( const double& w, const double& l );
 
+      void Render( );
+      void ResetCamera( );
+
     protected:
       ImageSliceActors( );
       virtual ~ImageSliceActors( );
@@ -127,17 +133,14 @@ namespace cpExtensions
       // Events
       static void _MouseMoveCommand(
         void* data,
-        const BaseInteractorStyle::ButtonID& btn, double* pos,
+        const TBaseStyle::ButtonID& btn,
+        int* idx, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseClickCommand(
         void* data,
-        const BaseInteractorStyle::ButtonID& btn, double* pos,
-        bool alt, bool ctr, bool sft
-        );
-      static void _MouseDoubleClickCommand(
-        void* data,
-        const BaseInteractorStyle::ButtonID& btn, double* pos,
+        const TBaseStyle::ButtonID& btn,
+        int* idx, double* pos,
         bool alt, bool ctr, bool sft
         );
       static void _MouseWheelCommand(
@@ -155,7 +158,7 @@ namespace cpExtensions
       Self& operator=( const Self& );
 
     protected:
-      vtkSmartPointer< ImageInteractorStyle > m_Style;
+      vtkSmartPointer< TStyle > m_Style;
 
       // Multiple actors
       std::vector< vtkSmartPointer< vtkImageMapToColors > > m_ImageMaps;
@@ -167,17 +170,10 @@ namespace cpExtensions
       double m_MinWindow, m_MaxWindow;
       double m_MinLevel, m_MaxLevel;
 
-      // Other associated slices
-      std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
-
       // Associated commands
-      std::vector< std::pair< TCursorCommand, void* > > m_SlicesCommands;
-      std::vector< std::pair< TCursorCommand, void* > > m_SeedCommands;
-
-      // Other associated actors
-      typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
-      typedef std::vector< TAssociatedActor >       TAssociatedActors;
-      TAssociatedActors m_AssociatedActors;
+      std::map< TSlicesCommand, void* >      m_SlicesCommands;
+      std::map< TWindowLevelCommand, void* > m_WindowLevelCommands;
+      std::map< TVoidCommand, void* >        m_RenderCommands;
 
       // Unique objects
       vtkSmartPointer< vtkPolyData >       m_Cursor;
index f755e455eac540902d650b5e40bc65d6471c11b3..cff7a8015fa3f0b2010a73a475d187c1eb708044 100644 (file)
@@ -321,6 +321,20 @@ SetLookupTableAsColor( unsigned int i, double r, double g, double b )
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetWindow( )
+{
+  return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetLevel( )
+{
+  return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
+}
+
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 GetSliceNumberMinValue( const int& axis ) const
@@ -405,9 +419,16 @@ MPRActors( )
     for( unsigned int j = 0; j < 3; ++j )
       this->Slices[ i ][ j ] = vtkSmartPointer< ImageSliceActors >::New( );
 
-  this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
-  this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
-  this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
+  /*
+    this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
+    this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
+    this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
+  */
+  /*
+    this->Slices[ 0 ][ 0 ]->AddSlicesCommand( TSlicesCommand command, void* data );
+    AddWindowLevelCommand( TWindowLevelCommand command, void* data );
+    AddRenderCommand
+  */
 
   /* TODO
      this->Slices[ 0 ][ 0 ]->SetSlicesCommand( Self::_SetSlices, this );
@@ -501,15 +522,29 @@ _Update( unsigned int i )
 
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::MPRActors::
-_SetSlices( double* pos, int axis, void* data )
+_SlicesCommand( double* pos, int axis, void* data )
 {
-  MPRActors* actors = reinterpret_cast< MPRActors* >( data );
-  if( actors == NULL )
+  /*
+    MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+    if( actors == NULL )
     return;
-  for( unsigned int j = 0; j < 3; ++j )
+    for( unsigned int j = 0; j < 3; ++j )
     if( actors->Slices[ 0 ][ j ]->GetAxis( ) != axis )
-      actors->Slices[ 0 ][ j ]->SetSlice( pos );
-  actors->Modified( );
+    actors->Slices[ 0 ][ j ]->SetSlice( pos );
+    actors->Modified( );
+  */
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+_WindowLevelCommand( double window, double level, void* data )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+_RenderCommand( void* data )
+{
 }
 
 // eof - $RCSfile$
index 24967800a36e80ab093e91bdb64913e2c2f1807a..f4283f48d408c5ce252a502470a5db3a99b6b0ce 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
 #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
 
-#include <vector>
-
 #include <cpExtensions/cpExtensions_Export.h>
 #include <cpExtensions/Visualization/ImageSliceActors.h>
 
@@ -18,10 +16,14 @@ namespace cpExtensions
     public:
       typedef MPRActors Self;
 
-      typedef ImageSliceActors::TCursorCommand     TCursorCommand;
-      typedef ImageSliceActors::TMouseCommand      TMouseCommand;
-      typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
-      typedef ImageSliceActors::TKeyCommand        TKeyCommand;
+      typedef ImageSliceActors::TBaseStyle          TBaseStyle;
+      typedef ImageSliceActors::TStyle              TStyle;
+      typedef ImageSliceActors::TSlicesCommand      TSlicesCommand;
+      typedef ImageSliceActors::TWindowLevelCommand TWindowLevelCommand;
+      typedef ImageSliceActors::TMouseCommand       TMouseCommand;
+      typedef ImageSliceActors::TMouseWheelCommand  TMouseWheelCommand;
+      typedef ImageSliceActors::TKeyCommand         TKeyCommand;
+      typedef ImageSliceActors::TVoidCommand        TVoidCommand;
 
     public:
       vtkTypeMacro( MPRActors, vtkPropCollection );
@@ -30,13 +32,6 @@ namespace cpExtensions
       // Creation
       static MPRActors* New( );
 
-      void AddCursorCommand( TCursorCommand command, void* data )
-      {
-        this->Slices[ 0 ][ 0 ]->AddSlicesCommand( command, data );
-        this->Slices[ 0 ][ 1 ]->AddSlicesCommand( command, data );
-        this->Slices[ 0 ][ 2 ]->AddSlicesCommand( command, data );
-      }
-
       ImageSliceActors* GetSliceActors( const int& i ) const;
 
       int AddInputConnection( vtkAlgorithmOutput* aout );
@@ -61,14 +56,8 @@ namespace cpExtensions
         unsigned int i, double r, double g, double b
         );
 
-      double GetWindow( )
-      {
-        return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
-      }
-      double GetLevel( )
-      {
-        return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
-      }
+      double GetWindow( );
+      double GetLevel( );
 
       // Slice access
       int GetSliceNumberMinValue( const int& axis ) const;
@@ -85,7 +74,9 @@ namespace cpExtensions
       vtkImageData* _Image( unsigned int i ) const;
       void _Update( unsigned int i );
 
-      static void _SetSlices( double* pos, int axis, void* data );
+      static void _SlicesCommand( double* pos, int axis, void* data );
+      static void _WindowLevelCommand( double window, double level, void* data );
+      static void _RenderCommand( void* data );
 
     private:
       // Purposely not implemented
@@ -95,13 +86,6 @@ namespace cpExtensions
     protected:
       vtkSmartPointer< vtkActor >         ImageOutlineActor;
       vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
-
-      std::vector< TCursorCommand >     CursorCommands;
-      std::vector< TMouseCommand >      MouseCommands;
-      std::vector< TMouseCommand >      MouseClickCommands;
-      std::vector< TMouseCommand >      MouseDoubleClickCommands;
-      std::vector< TMouseWheelCommand > MouseWheelCommands;
-      std::vector< TKeyCommand >        KeyCommands;
     };
 
   } // ecapseman
index cfee04e58f8f794f1bf45e42306133d2038187c0..2a50c62a9fb1f68307b9d9f106620422761c1bec 100644 (file)
@@ -175,28 +175,42 @@ Get3DRenderer( ) const
 }
 
 // -------------------------------------------------------------------------
-cpExtensions::Visualization::MPRObjects::
-TMPRActors* cpExtensions::Visualization::MPRObjects::
+cpExtensions::Visualization::
+MPRActors* cpExtensions::Visualization::MPRObjects::
 GetMPRActors( )
 {
   return( this->m_MPRActors );
 }
 
 // -------------------------------------------------------------------------
-const cpExtensions::Visualization::MPRObjects::
-TMPRActors* cpExtensions::Visualization::MPRObjects::
+const cpExtensions::Visualization::
+MPRActors* cpExtensions::Visualization::MPRObjects::
 GetMPRActors( ) const
 {
   return( this->m_MPRActors );
 }
 
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetWindow( ) const
+{
+  return( this->m_MPRActors->GetWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetLevel( ) const
+{
+  return( this->m_MPRActors->GetLevel( ) );
+}
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::MPRObjects::
 MPRObjects( )
   : vtkObject( )
 {
   // Prepare actors
-  this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
+  this->m_MPRActors = vtkSmartPointer< MPRActors >::New( );
 }
 
 // -------------------------------------------------------------------------
index 1920bb71a952352efee6717cc3782e5e1e051aee..71741ef17a9b3f7f38dfa7fee3fe4a509212cbd9 100644 (file)
@@ -19,12 +19,15 @@ namespace cpExtensions
     {
     public:
       typedef MPRObjects Self;
-      typedef cpExtensions::Visualization::MPRActors TMPRActors;
 
-      typedef TMPRActors::TCursorCommand     TCursorCommand;
-      typedef TMPRActors::TMouseCommand      TMouseCommand;
-      typedef TMPRActors::TMouseWheelCommand TMouseWheelCommand;
-      typedef TMPRActors::TKeyCommand        TKeyCommand;
+      typedef MPRActors::TBaseStyle          TBaseStyle;
+      typedef MPRActors::TStyle              TStyle;
+      typedef MPRActors::TSlicesCommand      TSlicesCommand;
+      typedef MPRActors::TWindowLevelCommand TWindowLevelCommand;
+      typedef MPRActors::TMouseCommand       TMouseCommand;
+      typedef MPRActors::TMouseWheelCommand  TMouseWheelCommand;
+      typedef MPRActors::TKeyCommand         TKeyCommand;
+      typedef MPRActors::TVoidCommand        TVoidCommand;
 
     public:
       vtkTypeMacro( MPRObjects, vtkObject );
@@ -33,11 +36,6 @@ namespace cpExtensions
       // Creation
       static MPRObjects* New( );
 
-      void AddCursorCommand( TCursorCommand command, void* data )
-      {
-        this->m_MPRActors->AddCursorCommand( command, data );
-      }
-
       void SetRenderWindows(
         vtkRenderWindow* wx, vtkRenderWindow* wy,
         vtkRenderWindow* wz, vtkRenderWindow* w3D
@@ -58,17 +56,11 @@ namespace cpExtensions
       const vtkRenderer* GetZRenderer( ) const;
       const vtkRenderer* Get3DRenderer( ) const;
 
-      TMPRActors* GetMPRActors( );
-      const TMPRActors* GetMPRActors( ) const;
+      MPRActors* GetMPRActors( );
+      const MPRActors* GetMPRActors( ) const;
 
-      double GetWindow( ) const
-      {
-        return( this->m_MPRActors->GetWindow( ) );
-      }
-      double GetLevel( ) const
-      {
-        return( this->m_MPRActors->GetLevel( ) );
-      }
+      double GetWindow( ) const;
+      double GetLevel( ) const;
 
     protected:
       MPRObjects( );
@@ -84,15 +76,8 @@ namespace cpExtensions
       vtkSmartPointer< vtkRenderWindow > m_Windows[ 4 ];
 
       // Internal pipelines
-      vtkSmartPointer< TMPRActors >  m_MPRActors;
+      vtkSmartPointer< MPRActors >   m_MPRActors;
       vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
-
-      std::vector< TCursorCommand >     CursorCommands;
-      std::vector< TMouseCommand >      MouseCommands;
-      std::vector< TMouseCommand >      MouseClickCommands;
-      std::vector< TMouseCommand >      MouseDoubleClickCommands;
-      std::vector< TMouseWheelCommand > MouseWheelCommands;
-      std::vector< TKeyCommand >        KeyCommands;
     };
 
   } // ecapseman
index 9507d6f2a713310984d675d7de3ea6e1c5e9f0eb..6799abe614c66e47b2b9b5c9e95060efa0d3a3bb 100644 (file)
@@ -42,10 +42,15 @@ namespace cpPlugins
       typedef cpPlugins::Interface::Mesh          TMesh;
 
       typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
-      typedef TMPRObjects::TCursorCommand     TCursorCommand;
-      typedef TMPRObjects::TMouseCommand      TMouseCommand;
-      typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
-      typedef TMPRObjects::TKeyCommand        TKeyCommand;
+
+      typedef TMPRObjects::TBaseStyle          TBaseStyle;
+      typedef TMPRObjects::TStyle              TStyle;
+      typedef TMPRObjects::TSlicesCommand      TSlicesCommand;
+      typedef TMPRObjects::TWindowLevelCommand TWindowLevelCommand;
+      typedef TMPRObjects::TMouseCommand       TMouseCommand;
+      typedef TMPRObjects::TMouseWheelCommand  TMouseWheelCommand;
+      typedef TMPRObjects::TKeyCommand         TKeyCommand;
+      typedef TMPRObjects::TVoidCommand        TVoidCommand;
 
       typedef std::map< std::string, TImage::Pointer >          TImages;
       typedef std::map< std::string, TMesh::Pointer >           TMeshes;
@@ -56,11 +61,6 @@ namespace cpPlugins
       explicit BaseMPRWindow( QWidget* parent = 0 );
       virtual ~BaseMPRWindow( );
 
-      void AddCursorCommand( TCursorCommand command, void* data )
-      {
-        this->m_MPRObjects->AddCursorCommand( command, data );
-      }
-
       void DialogLoadPlugins( );
       void AssociatePluginsToMenu(
         QMenu* menu, QObject* obj, const char* slot