#include <cpPlugins/Interface/ParametersListWidget.h>
+#include <vtkCommand.h>
#include <vtkRenderWindowInteractor.h>
#include <QCheckBox>
#include <QLineEdit>
#include <QWidget>
+// -------------------------------------------------------------------------
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Plugins.h>
+#include <cpPlugins/Interface/BaseApplication.h>
+
+class SingleSeedCommand
+ : public vtkCommand
+{
+public:
+ static SingleSeedCommand* New( )
+ { return( new SingleSeedCommand ); }
+ virtual void Execute( vtkObject* caller, unsigned long eid, void* data )
+ {
+ // Get seed, avoiding segfaults!!!
+ if( eid != vtkCommand::PlacePointEvent || this->Dialog == NULL )
+ return;
+ vtkSeedWidget* widget = dynamic_cast< vtkSeedWidget* >( caller );
+ if( widget == NULL )
+ return;
+ vtkSeedRepresentation* rep = widget->GetSeedRepresentation( );
+ if( rep == NULL )
+ return;
+ if( rep->GetNumberOfSeeds( ) == 0 )
+ return;
+ double seed[ 3 ];
+ rep->GetSeedWorldPosition( 0, seed );
+
+ // Delete all seeds (remember that this command is just for one seed)
+ while( rep->GetNumberOfSeeds( ) > 0 )
+ widget->DeleteSeed( 0 );
+
+ if( this->Dialog->getParameters( )->HasIndex( this->Name ) )
+ {
+ }
+ else if( this->Dialog->getParameters( )->HasPoint( this->Name ) )
+ {
+ this->Dialog->getParameters( )->SetPoint( this->Name, 3, seed );
+ this->Dialog->syncParameters( );
+ auto filter = this->Dialog->getParameters( )->GetProcessObject( );
+ if( filter != NULL )
+ {
+ auto plugins = filter->GetPlugins( );
+ if( plugins != NULL )
+ {
+ auto app = plugins->GetApplication( );
+ if( app != NULL )
+ app->UpdateActualFilter( );
+
+ } // fi
+
+ } // fi
+
+ } // fi
+ }
+protected:
+ SingleSeedCommand( )
+ : vtkCommand( ),
+ Dialog( NULL )
+ {
+ }
+ virtual ~SingleSeedCommand( )
+ {
+ }
+
+public:
+ cpPlugins::Interface::ParametersQtDialog* Dialog;
+ std::string Name;
+};
+
// -------------------------------------------------------------------------
cpPlugins::Interface::ParametersQtDialog::
ParametersQtDialog( QWidget* parent, Qt::WindowFlags f )
this->m_Interactors.insert( interactor );
}
+// -------------------------------------------------------------------------
+cpPlugins::Interface::ParametersQtDialog::
+TInteractors& cpPlugins::Interface::ParametersQtDialog::
+getInteractors( )
+{
+ return( this->m_Interactors );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::ParametersQtDialog::
+TInteractors& cpPlugins::Interface::ParametersQtDialog::
+getInteractors( ) const
+{
+ return( this->m_Interactors );
+}
+
// -------------------------------------------------------------------------
bool cpPlugins::Interface::ParametersQtDialog::
setParameters( Parameters* parameters )
}
else if( pt == Parameters::Point || pt == Parameters::Index )
{
+ vtkSmartPointer< SingleSeedCommand > command =
+ vtkSmartPointer< SingleSeedCommand >::New( );
+ command->Dialog = this;
+ command->Name = *nIt;
+
auto iIt = this->m_Interactors.begin( );
for( ; iIt != this->m_Interactors.end( ); ++iIt )
{
TStyle* style =
dynamic_cast< TStyle* >( ( *iIt )->GetInteractorStyle( ) );
- std::cout << "ACA VOY --> " << style << std::endl;
-
- } // rof
- this->m_IsModal = false;
-
- /*
- if( this->m_Interactor != NULL )
+ if( style != NULL )
{
+ style->SeedWidgetOn( );
+ style->SetSeedWidgetCommand( command );
} // fi
- */
+
+ } // rof
+ this->m_IsModal = false;
} // fi