if( this->m_Workspace == ws )
return;
this->m_Workspace = ws;
- QGraphicsScene* scene = this->scene( );
-
- // Create graph
this->m_Graph = TGraph::New( );
+ /* TODO
+ QGraphicsScene* scene = this->scene( );
// Add vertices and keep track of ports
std::map< std::string, std::map< std::string, QNEPort* > >
in_ports, out_ports;
for( ; vIt != vIt_end; ++vIt )
{
this->_createBlock( dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ) );
-#error ACA VOY
- // Add block
- QNEBlock* b = new QNEBlock( 0, scene );
- b->addPort( vIt->second->GetName( ), 0, QNEPort::NamePort );
- b->addPort( vIt->second->GetClassName( ).c_str( ), 0, QNEPort::TypePort );
-
- // Get filter
- if( f == NULL )
- continue;
-
- // Add input ports
- std::set< std::string > inputs;
- f->GetInputsNames( inputs );
- for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt )
- in_ports[ vIt->first ][ *iIt ] = b->addInputPort( iIt->c_str( ) );
-
- // Add output ports
- std::set< std::string > outputs;
- f->GetOutputsNames( outputs );
- for( auto oIt = outputs.begin( ); oIt != outputs.end( ); ++oIt )
- out_ports[ vIt->first ][ *oIt ] = b->addOutputPort( oIt->c_str( ) );
-
- // Keep a trace of this visual graph
- this->m_Graph->InsertVertex( vIt->first, b );
} // rof
+ */
// Add edges
/* TODO
void PipelineEditor::QNodesEditorCanvas::
dropEvent( QDropEvent* event )
{
+ std::cout << event << " " << this->m_Workspace << std::endl;
if( this->m_Workspace == NULL )
return;
const QMimeData* mime = event->mimeData( );
for( auto iIt = items.begin( ); iIt != items.end( ); ++iIt )
{
std::string filter = ( *iIt )->text( 0 ).toStdString( );
- std::string name = filter;
+ std::string name = "filtro"; //filter;
if( this->m_Workspace->GetFilter( name ) != NULL )
name += std::string( "_" );
+ std::cout << name << std::endl;
if( this->m_Workspace->CreateFilter( filter, name ) )
{
- } // fi
+ auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( );
+ auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( );
+ for( ; vIt != vIt_end; ++vIt )
+ {
+ std::cout << "NAME: " << vIt->first << " " << vIt->second.GetPointer( ) << std::endl;
+ vIt->second->Print( std::cout );
+ }
+
+
+ std::cout << "ok" << std::endl;
+ this->_createBlock( this->m_Workspace->GetFilter( name ) );
+ }
+ else
+ std::cout << "no" << std::endl;
} // rof
}
void PipelineEditor::QNodesEditorCanvas::
_createBlock( TFilter* f )
{
+ std::cout << "ptr: " << f << std::endl;
+
if( f == NULL )
return;
bool cpPlugins::Interface::Workspace::
CreateFilter( const std::string& filter, const std::string& name )
{
+ std::cout << "wNAME: " << filter << " " << name << std::endl;
+
+ for(
+ auto i = this->m_Graph->BeginVertices( );
+ i != this->m_Graph->EndVertices( );
+ ++i
+ )
+ std::cout << "wOBJ: " << i->first << std::endl;
+
+
// Get or create new filter from name
if( !( this->m_Graph->HasVertexIndex( name ) ) )
{
+ std::cout << "wok" << std::endl;
+
TFilter::Pointer f = this->m_Interface.CreateObject( filter );
if( f.IsNotNull( ) )
{
f->SetName( name );
TObject::Pointer o = f.GetPointer( );
+ o->Print( std::cout );
this->m_Graph->InsertVertex( name, o );
return( true );
}
return( false );
}
else
+ {
+ std::cout << "wno" << std::endl;
return( true );
+ }
}
// -------------------------------------------------------------------------