]> Creatis software - cpPlugins.git/commitdiff
Double click widget integrated with segmentation and deformation filters.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 3 Nov 2015 00:05:15 +0000 (19:05 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 3 Nov 2015 00:05:15 +0000 (19:05 -0500)
lib/cpPlugins/Interface/ParametersQtDialog.cxx
lib/cpPlugins/Interface/ParametersQtDialog.h

index 0891a2b5c09c409c9c5d80381ef5114a27b441cd..3cea961f89ba63806c0e43193ef45e203aed0787 100644 (file)
@@ -6,11 +6,7 @@
 
 #include <cpPlugins/Interface/ParametersListWidget.h>
 
-#include <vtkSmartPointer.h>
-#include <cpExtensions/Interaction/SeedWidget.h>
-#include <vtkPointHandleRepresentation3D.h>
-#include <vtkProperty.h>
-#include <vtkSeedRepresentation.h>
+#include <vtkRenderWindowInteractor.h>
 
 #include <QCheckBox>
 #include <QDialogButtonBox>
@@ -24,8 +20,7 @@ cpPlugins::Interface::ParametersQtDialog::
 ParametersQtDialog( QWidget* parent, Qt::WindowFlags f )
   : QDialog( parent, f ),
     m_Parameters( NULL ),
-    m_IsModal( false ),
-    m_Interactor( NULL )
+    m_IsModal( false )
 {
   this->m_Title = new QLabel( this );
   this->m_Title->setText( "Parameters dialog title" );
@@ -43,9 +38,6 @@ cpPlugins::Interface::ParametersQtDialog::
   delete this->m_Title;
   delete this->m_ToolsLayout;
   delete this->m_MainLayout;
-
-  for( unsigned int i = 0; i < this->m_Widgets.size( ); ++i )
-    this->m_Widgets[ i ]->Delete( );
 }
 
 // -------------------------------------------------------------------------
@@ -65,9 +57,9 @@ getParameters( ) const
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ParametersQtDialog::
-setInteractor( vtkRenderWindowInteractor* interactor )
+addInteractor( vtkRenderWindowInteractor* interactor )
 {
-  this->m_Interactor = interactor;
+  this->m_Interactors.insert( interactor );
 }
 
 // -------------------------------------------------------------------------
@@ -139,26 +131,22 @@ setParameters( Parameters* parameters )
     }
     else if( pt == Parameters::Point || pt == Parameters::Index )
     {
-      if( this->m_Interactor != NULL )
+      auto iIt = this->m_Interactors.begin( );
+      for( ; iIt != this->m_Interactors.end( ); ++iIt )
       {
-        // Create a point 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 );
-
-        cpExtensions::Interaction::SeedWidget* widget =
-          cpExtensions::Interaction::SeedWidget::New( );
-        widget->SetInteractor( this->m_Interactor );
-        widget->SetRepresentation( rep );
-        widget->On( );
-
-        this->m_Widgets.push_back( widget );
-        this->m_IsModal = false;
+        TStyle* style =
+          dynamic_cast< TStyle* >( ( *iIt )->GetInteractorStyle( ) );
+        std::cout << "ACA VOY --> " << style << std::endl;
 
-      } // fi
+      } // rof
+      this->m_IsModal = false;
+
+      /*
+        if( this->m_Interactor != NULL )
+        {
+
+        } // fi
+      */
 
     } // fi
 
index 365ec9ca1edda5eba97419f97a2983dd0aae6f9b..9e9b73a3a5ebf8dbf5fa0fbf7514220409499faf 100644 (file)
@@ -7,15 +7,15 @@
 
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Parameters.h>
+#include <cpExtensions/Interaction/ImageInteractorStyle.h>
 
-#include <vector>
+#include <set>
 
 #include <QDialog>
 #include <QGridLayout>
 #include <QLabel>
 #include <QVBoxLayout>
 
-class vtkAbstractWidget;
 class vtkRenderWindowInteractor;
 
 namespace cpPlugins
@@ -29,13 +29,16 @@ namespace cpPlugins
     {
       Q_OBJECT;
 
+    public:
+      typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
+
     public:
       ParametersQtDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
       virtual ~ParametersQtDialog( );
 
       bool IsModal( ) const;
       Parameters* getParameters( ) const;
-      void setInteractor( vtkRenderWindowInteractor* interactor );
+      void addInteractor( vtkRenderWindowInteractor* interactor );
       bool setParameters( Parameters* parameters );
       void setTitle( const std::string& title );
 
@@ -50,8 +53,7 @@ namespace cpPlugins
       QVBoxLayout* m_ToolsLayout;
       bool m_IsModal;
 
-      vtkRenderWindowInteractor*        m_Interactor;
-      std::vector< vtkAbstractWidget* > m_Widgets;
+      std::set< vtkRenderWindowInteractor* > m_Interactors;
     };
 
   } // ecapseman