\r
this->m_Width = this->m_HorzMargin;\r
this->m_Height = this->m_VertMargin;\r
+\r
+ // Configure names\r
+ this->setNamePort( this->m_Filter->GetName( ) );\r
+ this->_setTypePort( this->m_Filter->GetClassName( ) );\r
+\r
+ // Add input ports\r
+ std::set< std::string > inputs;\r
+ this->m_Filter->GetInputsNames( inputs );\r
+ for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt )\r
+ this->addInputPort( iIt->c_str( ) );\r
+\r
+ // Add output ports\r
+ std::set< std::string > outputs;\r
+ this->m_Filter->GetOutputsNames( outputs );\r
+ for( auto oIt = outputs.begin( ); oIt != outputs.end( ); ++oIt )\r
+ this->addOutputPort( oIt->c_str( ) );\r
}\r
\r
// -------------------------------------------------------------------------\r
}\r
\r
// -------------------------------------------------------------------------\r
-void PipelineEditor::QNEBlock::\r
-setTypePort( const QString& txt )\r
-{\r
- if( this->m_TypePort == NULL )\r
- this->m_TypePort = new QNETypePort( this );\r
- this->m_TypePort->setName( txt );\r
- this->_configPort( this->m_TypePort );\r
-}\r
-\r
-// -------------------------------------------------------------------------\r
-void PipelineEditor::QNEBlock::\r
+PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::\r
addInputPort( const QString& txt )\r
{\r
QNEInputPort* ip = new QNEInputPort( this );\r
ip->setName( txt );\r
- this->m_InputPorts.push_back( ip );\r
+ this->m_InputPorts[ txt.toStdString( ) ] = ip;\r
this->_configPort( ip );\r
+ return( ip );\r
}\r
\r
// -------------------------------------------------------------------------\r
-void PipelineEditor::QNEBlock::\r
+PipelineEditor::QNEOutputPort* PipelineEditor::QNEBlock::\r
addOutputPort( const QString& txt )\r
{\r
QNEOutputPort* op = new QNEOutputPort( this );\r
op->setName( txt );\r
- this->m_OutputPorts.push_back( op );\r
+ this->m_OutputPorts[ txt.toStdString( ) ] = op;\r
this->_configPort( op );\r
+ return( op );\r
}\r
\r
// -------------------------------------------------------------------------\r
-QVector< PipelineEditor::QNEPort* > PipelineEditor::QNEBlock::\r
-ports( )\r
+PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::\r
+inputPort( const QString& txt )\r
{\r
- QVector< QNEPort* > res;\r
- foreach( QGraphicsItem* i, this->childItems( ) )\r
- {\r
- QNEPort* p = dynamic_cast< QNEPort* >( i );\r
- if( p != NULL )\r
- res.append( p );\r
-\r
- } // rof\r
- return( res );\r
+ auto i = this->m_InputPorts.find( txt.toStdString( ) );\r
+ if( i != this->m_InputPorts.end( ) )\r
+ return( i->second );\r
+ else\r
+ return( NULL );\r
}\r
\r
// -------------------------------------------------------------------------\r
-PipelineEditor::QNEBlock* PipelineEditor::QNEBlock::\r
-clone( )\r
+PipelineEditor::QNEOutputPort* PipelineEditor::QNEBlock::\r
+outputPort( const QString& txt )\r
{\r
- QNEBlock* b = new QNEBlock( this->m_Filter, 0, this->scene( ) );\r
- foreach( QGraphicsItem* i, this->childItems( ) )\r
- {\r
- QNENamePort* np = dynamic_cast< QNENamePort* >( i );\r
- if( np != NULL )\r
- b->setNamePort( np->name( ) );\r
-\r
- QNETypePort* tp = dynamic_cast< QNETypePort* >( i );\r
- if( tp != NULL )\r
- b->setTypePort( tp->name( ) );\r
+ auto o = this->m_OutputPorts.find( txt.toStdString( ) );\r
+ if( o != this->m_OutputPorts.end( ) )\r
+ return( o->second );\r
+ else\r
+ return( NULL );\r
+}\r
\r
- QNEInputPort* ip = dynamic_cast< QNEInputPort* >( i );\r
- if( ip != NULL )\r
- b->addInputPort( ip->name( ) );\r
+// -------------------------------------------------------------------------\r
+const PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::\r
+inputPort( const QString& txt ) const\r
+{\r
+ auto i = this->m_InputPorts.find( txt.toStdString( ) );\r
+ if( i != this->m_InputPorts.end( ) )\r
+ return( i->second );\r
+ else\r
+ return( NULL );\r
+}\r
\r
- QNEOutputPort* op = dynamic_cast< QNEOutputPort* >( i );\r
- if( op != NULL )\r
- b->addOutputPort( op->name( ) );\r
+// -------------------------------------------------------------------------\r
+const PipelineEditor::QNEOutputPort* PipelineEditor::QNEBlock::\r
+outputPort( const QString& txt ) const\r
+{\r
+ auto o = this->m_OutputPorts.find( txt.toStdString( ) );\r
+ if( o != this->m_OutputPorts.end( ) )\r
+ return( o->second );\r
+ else\r
+ return( NULL );\r
+}\r
\r
- } // rof\r
- return( b );\r
+// -------------------------------------------------------------------------\r
+const QString& PipelineEditor::QNEBlock::\r
+namePort( ) const\r
+{\r
+ return( this->m_NamePort->name( ) );\r
}\r
\r
// -------------------------------------------------------------------------\r
return( value );\r
}\r
\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEBlock::\r
+_setTypePort( const QString& txt )\r
+{\r
+ if( this->m_TypePort == NULL )\r
+ this->m_TypePort = new QNETypePort( this );\r
+ this->m_TypePort->setName( txt );\r
+ this->_configPort( this->m_TypePort );\r
+}\r
+\r
// -------------------------------------------------------------------------\r
void PipelineEditor::QNEBlock::\r
_configPort( QNEPort* port )\r
} // rof\r
}\r
\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEBlock::\r
+mouseReleaseEvent( QGraphicsSceneMouseEvent* evt )\r
+{\r
+ if( this->m_Filter.IsNotNull( ) )\r
+ this->m_Filter->SetViewCoords(\r
+ this->scenePos( ).x( ), this->scenePos( ).y( )\r
+ );\r
+ this->Superclass::mouseReleaseEvent( evt );\r
+}\r
+\r
// eof - $RCSfile$\r