this->m_Workspace = ws;\r
this->m_Graph = TGraph::New( );\r
\r
- /* TODO\r
- QGraphicsScene* scene = this->scene( );\r
- // Add vertices and keep track of ports\r
- std::map< std::string, std::map< std::string, QNEPort* > >\r
- in_ports, out_ports;\r
- auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( );\r
- auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( );\r
- for( ; vIt != vIt_end; ++vIt )\r
- {\r
- this->_createBlock( dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ) );\r
+ // Create blocks\r
+ auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( );\r
+ auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( );\r
+ for( ; vIt != vIt_end; ++vIt )\r
+ {\r
+ this->_CreateBlock(\r
+ dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ),\r
+ QPointF( )\r
+ );\r
\r
- } // rof\r
- */\r
+ } // rof\r
\r
// Add edges\r
- /* TODO\r
- auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( );\r
- auto rIt_end = this->m_Workspace->GetGraph( )->EndEdgesRows( );\r
- for( ; rIt != rIt_end; ++rIt )\r
- {\r
- auto cIt = rIt->second.begin( );\r
- for( ; cIt != rIt->second.end( ); ++cIt )\r
- {\r
- auto eIt = cIt->second.begin( );\r
- for( ; eIt != cIt->second.end( ); ++eIt )\r
- {\r
- QNEPort* p1 = out_ports[ rIt->first ][ eIt->first ];\r
- QNEPort* p2 = in_ports[ cIt->first ][ eIt->second ];\r
- if( p1 != NULL && p2 != NULL )\r
- {\r
- QNEConnection* conn = new QNEConnection( 0, scene );\r
- conn->setPort1( p1 );\r
- conn->setPort2( p2 );\r
- this->m_Graph->AddConnection( rIt->first, cIt->first, conn );\r
+ auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( );\r
+ auto rIt_end = this->m_Workspace->GetGraph( )->EndEdgesRows( );\r
+ for( ; rIt != rIt_end; ++rIt )\r
+ {\r
+ if( !this->m_Graph->HasVertexIndex( rIt->first ) )\r
+ continue;\r
+ QNEBlock* orig = this->m_Graph->GetVertex( rIt->first );\r
+ if( orig == NULL )\r
+ continue;\r
+ QVector< QNEOutputPort* >& oPorts = orig->outputPorts( );\r
+\r
+ auto cIt = rIt->second.begin( );\r
+ for( ; cIt != rIt->second.end( ); ++cIt )\r
+ {\r
+ if( !this->m_Graph->HasVertexIndex( cIt->first ) )\r
+ continue;\r
+ QNEBlock* dest = this->m_Graph->GetVertex( cIt->first );\r
+ if( dest == NULL )\r
+ continue;\r
+ QVector< QNEInputPort* >& iPorts = dest->inputPorts( );\r
+\r
+ auto eIt = cIt->second.begin( );\r
+ for( ; eIt != cIt->second.end( ); ++eIt )\r
+ {\r
+ QNEOutputPort* op = NULL;\r
+ auto opIt = oPorts.begin( );\r
+ for( ; opIt != oPorts.end( ) && op == NULL; ++opIt )\r
+ if( ( *opIt )->name( ).toStdString( ) == eIt->first )\r
+ op = *opIt;\r
\r
- } // fi\r
+ QNEInputPort* ip = NULL;\r
+ auto ipIt = iPorts.begin( );\r
+ for( ; ipIt != iPorts.end( ) && ip == NULL; ++ipIt )\r
+ if( ( *ipIt )->name( ).toStdString( ) == eIt->second )\r
+ ip = *ipIt;\r
\r
- } // rof\r
+ if( op == NULL || ip == NULL )\r
+ continue;\r
\r
- } // rof\r
+ QNEConnection* conn = new QNEConnection( 0, this->m_Scene );\r
+ conn->setPort1( op );\r
+ conn->setPort2( ip );\r
+ conn->updatePosFromPorts( );\r
+ conn->updatePath( );\r
+ this->m_Graph->AddConnection( rIt->first, cIt->first, conn );\r
\r
- } // rof\r
- */\r
+ } // rof\r
+\r
+ } // rof\r
+\r
+ } // rof\r
}\r
\r
// -------------------------------------------------------------------------\r
if( err == "" )
{
this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace );
+ this->_UpdateLoadedPlugins( );
}
else
{
TIndex idx; idx[ 0 ] = 1; idx[ 1 ] = 2; idx[ 2 ] = 3;
TPoint pnt; pnt[ 0 ] = 3.1; pnt[ 1 ] = 2.2; pnt[ 2 ] = 1.3;
- parameters->ConfigureAsString( "StringParam", "String_Value" );
- parameters->ConfigureAsBool( "BoolParam", false );
- parameters->ConfigureAsInt( "IntParam", -314 );
- parameters->ConfigureAsUint( "UintParam", 314 );
- parameters->ConfigureAsReal( "RealParam", 3.14 );
- parameters->ConfigureAsIndex( "IndexParam", 3, idx );
- parameters->ConfigureAsPoint( "PointParam", 3, pnt );
+ parameters->ConfigureAsString( "StringParam" );
+ parameters->ConfigureAsBool( "BoolParam" );
+ parameters->ConfigureAsInt( "IntParam" );
+ parameters->ConfigureAsUint( "UintParam" );
+ parameters->ConfigureAsReal( "RealParam" );
+ parameters->ConfigureAsIndex( "IndexParam" );
+ parameters->ConfigureAsPoint( "PointParam" );
parameters->ConfigureAsStringList( "StringListParam" );
parameters->ConfigureAsBoolList( "BoolListParam" );
parameters->ConfigureAsIntList( "IntListParam" );
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::Parameters::
-ConfigureAsString( const TString& name, const TString& v )
-{
- this->m_Parameters[ name ] =
- TParameter( Self::String, TValues( v, v ) );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Parameters_Configure( Y ) \
- void cpPlugins::Interface::Parameters:: \
- ConfigureAs##Y( const TString& name, const T##Y& v ) \
- { \
- std::stringstream str; \
- str << v; \
- std::string s = str.str( ); \
- this->m_Parameters[ name ] = \
- TParameter( Self::Y, TValues( s, s ) ); \
- this->Modified( ); \
+#define cpPlugins_Parameters_Configure( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ ConfigureAs##Y( const TString& name ) \
+ { \
+ this->m_Parameters[ name ] = TParameter( Self::Y, "" ); \
+ this->Modified( ); \
}
+cpPlugins_Parameters_Configure( String );
cpPlugins_Parameters_Configure( Bool );
cpPlugins_Parameters_Configure( Int );
cpPlugins_Parameters_Configure( Uint );
cpPlugins_Parameters_Configure( Real );
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Parameters_List_Configure( Y ) \
- void cpPlugins::Interface::Parameters:: \
- ConfigureAs##Y##List( const TString& name ) \
- { \
- this->m_Parameters[ name ] = \
- TParameter( Self::Y##List, TValues( "", "" ) ); \
- this->Modified( ); \
- }
-
-cpPlugins_Parameters_List_Configure( String );
-cpPlugins_Parameters_List_Configure( Bool );
-cpPlugins_Parameters_List_Configure( Int );
-cpPlugins_Parameters_List_Configure( Uint );
-cpPlugins_Parameters_List_Configure( Real );
-cpPlugins_Parameters_List_Configure( Index );
-cpPlugins_Parameters_List_Configure( Point );
-cpPlugins_Parameters_List_Configure( Vector );
+cpPlugins_Parameters_Configure( Index );
+cpPlugins_Parameters_Configure( Point );
+cpPlugins_Parameters_Configure( Vector );
+cpPlugins_Parameters_Configure( StringList );
+cpPlugins_Parameters_Configure( BoolList );
+cpPlugins_Parameters_Configure( IntList );
+cpPlugins_Parameters_Configure( UintList );
+cpPlugins_Parameters_Configure( RealList );
+cpPlugins_Parameters_Configure( IndexList );
+cpPlugins_Parameters_Configure( PointList );
+cpPlugins_Parameters_Configure( VectorList );
+cpPlugins_Parameters_Configure( Choices );
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
str_choices << choices[ 0 ];
for( unsigned int i = 1; i < choices.size( ); ++i )
str_choices << "#" << choices[ i ];
+ str_choices << "@";
this->m_Parameters[ name ] =
- TParameter( Self::Choices, TValues( str_choices.str( ), "" ) );
+ TParameter( Self::Choices, str_choices.str( ) );
this->Modified( );
}
if( i != this->m_Parameters.end( ) )
{
if( i->second.first == Self::String || !force )
- return( i->second.second.second );
+ return( i->second.second );
} // fi
return( "" );
if( i != this->m_Parameters.end( ) )
{
if( i->second.first == Self::Bool )
- return( std::atoi( i->second.second.second.c_str( ) ) == 1 );
+ return( std::atoi( i->second.second.c_str( ) ) == 1 );
} // fi
return( false );
if( i != this->m_Parameters.end( ) )
{
if( i->second.first == Self::Int )
- return( TInt( std::atoi( i->second.second.second.c_str( ) ) ) );
+ return( TInt( std::atoi( i->second.second.c_str( ) ) ) );
} // fi
return( TInt( 0 ) );
if( i != this->m_Parameters.end( ) )
{
if( i->second.first == Self::Uint )
- return( TUint( std::atoi( i->second.second.second.c_str( ) ) ) );
+ return( TUint( std::atoi( i->second.second.c_str( ) ) ) );
} // fi
return( TUint( 0 ) );
{
if( i->second.first == Self::Real )
{
- std::istringstream tok_str( i->second.second.second );
+ std::istringstream tok_str( i->second.second );
float v;
tok_str >> v;
return( TReal( v ) );
if( i->second.first != Self::StringList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
while( std::getline( str, token, '#' ) )
lst.push_back( token );
if( i->second.first != Self::BoolList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
while( std::getline( str, token, '#' ) )
lst.push_back( std::atoi( token.c_str( ) ) == 1 );
if( i->second.first != Self::IntList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
while( std::getline( str, token, '#' ) )
lst.push_back( TInt( std::atoi( token.c_str( ) ) ) );
if( i->second.first != Self::UintList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
while( std::getline( str, token, '#' ) )
lst.push_back( TUint( std::atoi( token.c_str( ) ) ) );
if( i->second.first != Self::RealList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
while( std::getline( str, token, '#' ) )
{
if( i->second.first != Self::Choices )
return;
- std::istringstream str( i->second.second.first );
+ std::istringstream str_choices( i->second.second );
+ std::string real_choices;
+ std::getline( str_choices, real_choices, '@' );
+ std::istringstream str( real_choices );
std::string token;
while( std::getline( str, token, '#' ) )
choices.push_back( token );
return( "" );
if( i->second.first != Self::Choices )
return( "" );
- return( i->second.second.second );
+
+ std::istringstream str_choices( i->second.second );
+ std::string real_choice;
+ std::getline( str_choices, real_choice, '@' );
+ std::getline( str_choices, real_choice, '@' );
+ return( real_choice );
}
// -------------------------------------------------------------------------
return;
if( i->second.first != Self::String && force )
return;
- i->second.second.second = v;
+ i->second.second = v;
this->Modified( );
}
return; \
std::stringstream str; \
str << v; \
- i->second.second.second = str.str( ); \
+ i->second.second = str.str( ); \
this->Modified( ); \
}
if( i->second.first != Self::Y##List ) \
return; \
std::stringstream str; \
- if( i->second.second.second == "" ) \
+ if( i->second.second == "" ) \
str << v; \
else \
str << "#" << v; \
- i->second.second.second += str.str( ); \
+ i->second.second += str.str( ); \
this->Modified( ); \
}
return; \
if( i->second.first != Self::Y##List ) \
return; \
- i->second.second.second = ""; \
+ i->second.second = ""; \
this->Modified( ); \
}
return( false );
if( i->second.first != Self::Choices )
return( false );
- if( i->second.second.first.find( choice ) != std::string::npos )
+
+ std::vector< TString > c;
+ this->GetChoices( c, name );
+ if( std::find( c.begin( ), c.end( ), choice ) != c.end( ) )
{
- i->second.second.second = choice;
- this->Modified( );
+ std::istringstream str_choices( i->second.second );
+ std::string choices;
+ std::getline( str_choices, choices, '@' );
+ std::stringstream new_choices;
+ new_choices << choices << "@" << choice;
+ i->second.second = new_choices.str( );
return( true );
}
else
os << indent
<< i->first << ": ("
<< i->second.first << " | "
- << i->second.second.first << " | "
- << i->second.second.second << ")"
+ << i->second.second << ")"
<< std::endl;
}
typedef double TReal;
typedef std::string TString;
- // NOTE: std::pair< default, value >
- typedef std::pair< TString, TString > TValues;
- typedef std::pair< Self::Type, TValues > TParameter;
+ typedef std::pair< Self::Type, TString > TParameter;
typedef std::map< TString, TParameter > TParameters;
public:
// Parameters container configuration
void Clear( );
- void ConfigureAsString( const TString& name, const TString& v );
- void ConfigureAsBool( const TString& name, const TBool& v );
- void ConfigureAsInt( const TString& name, const TInt& v );
- void ConfigureAsUint( const TString& name, const TUint& v );
- void ConfigureAsReal( const TString& name, const TReal& v );
-
- template< class I >
- inline void ConfigureAsIndex(
- const TString& name, const TUint& dim, const I& v
- );
- template< class P >
- inline void ConfigureAsPoint(
- const TString& name, const TUint& dim, const P& v
- );
- template< class V >
- inline void ConfigureAsVector(
- const TString& name, const TUint& dim, const V& v
- );
-
+ void ConfigureAsString( const TString& name );
+ void ConfigureAsBool( const TString& name );
+ void ConfigureAsInt( const TString& name );
+ void ConfigureAsUint( const TString& name );
+ void ConfigureAsReal( const TString& name );
+ void ConfigureAsIndex( const TString& name );
+ void ConfigureAsPoint( const TString& name );
+ void ConfigureAsVector( const TString& name );
void ConfigureAsStringList( const TString& name );
void ConfigureAsBoolList( const TString& name );
void ConfigureAsIntList( const TString& name );
void ConfigureAsIndexList( const TString& name );
void ConfigureAsPointList( const TString& name );
void ConfigureAsVectorList( const TString& name );
+ void ConfigureAsChoices( const TString& name );
void ConfigureAsChoices(
const TString& name, const std::vector< TString >& choices
);
#ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
#define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
-// -------------------------------------------------------------------------
-template< class I >
-void cpPlugins::Interface::Parameters::
-ConfigureAsIndex( const TString& name, const TUint& dim, const I& v )
-{
- std::stringstream str;
- str << v[ 0 ];
- for( unsigned int d = 1; d < dim; ++d )
- str << ";" << v[ d ];
- std::string s = str.str( );
- this->m_Parameters[ name ] =
- TParameter( Self::Index, TValues( s, s ) );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class P >
-void cpPlugins::Interface::Parameters::
-ConfigureAsPoint( const TString& name, const TUint& dim, const P& v )
-{
- std::stringstream str;
- str << v[ 0 ];
- for( unsigned int d = 1; d < dim; ++d )
- str << ";" << v[ d ];
- std::string s = str.str( );
- this->m_Parameters[ name ] =
- TParameter( Self::Point, TValues( s, s ) );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class V >
-void cpPlugins::Interface::Parameters::
-ConfigureAsVector( const TString& name, const TUint& dim, const V& v )
-{
- std::stringstream str;
- str << v[ 0 ];
- for( unsigned int d = 1; d < dim; ++d )
- str << ";" << v[ d ];
- std::string s = str.str( );
- this->m_Parameters[ name ] =
- TParameter( Self::Vector, TValues( s, s ) );
- this->Modified( );
-}
-
// -------------------------------------------------------------------------
template< class I >
I cpPlugins::Interface::Parameters::
{
if( i->second.first == Self::Index )
{
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, ';' ) && d < dim )
{
if( i->second.first == Self::Point )
{
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, ';' ) && d < dim )
{
if( i->second.first == Self::Vector )
{
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, ';' ) && d < dim )
if( i->second.first == Self::IndexList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, '#' ) )
if( i->second.first == Self::PointList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, '#' ) )
if( i->second.first == Self::VectorList )
return;
- std::istringstream str( i->second.second.second );
+ std::istringstream str( i->second.second );
std::string token;
unsigned int d = 0;
while( std::getline( str, token, '#' ) )
str << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second = str.str( );
+ i->second.second = str.str( );
this->Modified( );
}
str << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second = str.str( );
+ i->second.second = str.str( );
this->Modified( );
}
str << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second = str.str( );
+ i->second.second = str.str( );
this->Modified( );
}
return;
std::stringstream str;
- if( i->second.second.second == "" )
+ if( i->second.second == "" )
str << v[ 0 ];
else
str << "#" << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second += str.str( );
+ i->second.second += str.str( );
this->Modified( );
}
return;
std::stringstream str;
- if( i->second.second.second == "" )
+ if( i->second.second == "" )
str << v[ 0 ];
else
str << "#" << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second += str.str( );
+ i->second.second += str.str( );
this->Modified( );
}
return;
std::stringstream str;
- if( i->second.second.second == "" )
+ if( i->second.second == "" )
str << v[ 0 ];
else
str << "#" << v[ 0 ];
for( unsigned int d = 1; d < dim; ++d )
str << ";" << v[ d ];
- i->second.second.second += str.str( );
+ i->second.second += str.str( );
this->Modified( );
}
{
// Read parameters
TParameters* parameters = this->GetParameters( name_value );
+ parameters->Clear( );
+
TiXmlElement* param = filter->FirstChildElement( "parameter" );
while( param != NULL )
{
const char* value = param->Attribute( "value" );
if( value != NULL )
{
- std::istringstream value_str( value );
if( param_type_str == "String" )
- parameters->SetString( param_name, value );
+ parameters->ConfigureAsString( param_name );
else if( param_type_str == "Bool" )
- parameters->SetBool( param_name, value[ 0 ] != '0' );
+ parameters->ConfigureAsBool( param_name );
else if( param_type_str == "Int" )
- {
- TParameters::TInt v;
- value_str >> v;
- parameters->SetInt( param_name, v );
- }
+ parameters->ConfigureAsInt( param_name );
else if( param_type_str == "Uint" )
- {
- TParameters::TUint v;
- value_str >> v;
- parameters->SetUint( param_name, v );
- }
+ parameters->ConfigureAsUint( param_name );
else if( param_type_str == "Real" )
- {
- TParameters::TReal v;
- value_str >> v;
- parameters->SetReal( param_name, v );
- }
- /* TODO
- else if( param_type_str == "Index" )
- else if( param_type_str == "Point" )
- else if( param_type_str == "Vector" )
- */
- }
- else
- {
- if( param_type_str == "StringList" )
- {
- TiXmlElement* item = param->FirstChildElement( "item" );
- while( item != NULL )
- {
- value = item->Attribute( "value" );
- if( value != NULL )
- parameters->AddToStringList( param_name, value );
- item = item->NextSiblingElement( "item" );
-
- } // elihw
- }
+ parameters->ConfigureAsReal( param_name );
+ else if( param_type_str == "Index" )
+ parameters->ConfigureAsIndex( param_name );
+ else if( param_type_str == "Point" )
+ parameters->ConfigureAsPoint( param_name );
+ else if( param_type_str == "Vector" )
+ parameters->ConfigureAsVector( param_name );
+ else if( param_type_str == "StringList" )
+ parameters->ConfigureAsStringList( param_name );
else if( param_type_str == "BoolList" )
- {
- TiXmlElement* item = param->FirstChildElement( "item" );
- while( item != NULL )
- {
- value = item->Attribute( "value" );
- if( value != NULL )
- parameters->AddToBoolList( param_name, value[ 0 ] != '0' );
- item = item->NextSiblingElement( "item" );
-
- } // elihw
- }
+ parameters->ConfigureAsBoolList( param_name );
else if( param_type_str == "IntList" )
- {
- TiXmlElement* item = param->FirstChildElement( "item" );
- while( item != NULL )
- {
- value = item->Attribute( "value" );
- if( value != NULL )
- {
- std::istringstream value_str( value );
- TParameters::TInt v;
- value_str >> v;
- parameters->AddToIntList( param_name, v );
-
- } // fi
- item = item->NextSiblingElement( "item" );
-
- } // elihw
- }
+ parameters->ConfigureAsIntList( param_name );
else if( param_type_str == "UintList" )
- {
- TiXmlElement* item = param->FirstChildElement( "item" );
- while( item != NULL )
- {
- value = item->Attribute( "value" );
- if( value != NULL )
- {
- std::istringstream value_str( value );
- TParameters::TUint v;
- value_str >> v;
- parameters->AddToUintList( param_name, v );
-
- } // fi
- item = item->NextSiblingElement( "item" );
-
- } // elihw
- }
+ parameters->ConfigureAsUintList( param_name );
else if( param_type_str == "RealList" )
- {
- TiXmlElement* item = param->FirstChildElement( "item" );
- while( item != NULL )
- {
- value = item->Attribute( "value" );
- if( value != NULL )
- {
- std::istringstream value_str( value );
- TParameters::TReal v;
- value_str >> v;
- parameters->AddToRealList( param_name, v );
+ parameters->ConfigureAsRealList( param_name );
+ else if( param_type_str == "IndexList" )
+ parameters->ConfigureAsIndexList( param_name );
+ else if( param_type_str == "PointList" )
+ parameters->ConfigureAsPointList( param_name );
+ else if( param_type_str == "VectorList" )
+ parameters->ConfigureAsVectorList( param_name );
+ else if( param_type_str == "Choices" )
+ parameters->ConfigureAsChoices( param_name );
+ parameters->SetString( param_name, value, false );
- } // fi
- item = item->NextSiblingElement( "item" );
-
- } // elihw
- }
- /* TODO
- else if( param_type_str == "IndexList" )
- else if( param_type_str == "PointList" )
- else if( param_type_str == "VectorList" )
- else if( param_type_str == "Choices" );
- */
} // fi
} // fi
} // elihw
- // Read filters
+ // Read connections
TiXmlElement* connection = root->FirstChildElement( "connection" );
while( connection != NULL )
{
{
TiXmlElement* p = new TiXmlElement( "parameter" );
p->SetAttribute( "name", nIt->c_str( ) );
- //const char* param_type = param->Attribute( "type" );
if( params->HasString( *nIt ) )
p->SetAttribute( "type", "String" );
else if( params->HasBool( *nIt ) )
p->SetAttribute( "type", "VectorList" );
else if( params->HasChoices( *nIt ) )
p->SetAttribute( "type", "Choices" );
- p->SetAttribute( "value", params->GetString( *nIt, false ).c_str( ) );
+ p->SetAttribute(
+ "value", params->GetString( *nIt, false ).c_str( )
+ );
e->LinkEndChild( p );
} // rof
}
else if( data != NULL )
{
+ // TODO
} // fi
} // rof
+ // Save connections
+ auto mIt = this->m_Graph->BeginEdgesRows( );
+ for( ; mIt != this->m_Graph->EndEdgesRows( ); ++mIt )
+ {
+ auto rIt = mIt->second.begin( );
+ for( ; rIt != mIt->second.end( ); ++rIt )
+ {
+ auto eIt = rIt->second.begin( );
+ for( ; eIt != rIt->second.end( ); ++eIt )
+ {
+ TiXmlElement* conn = new TiXmlElement( "connection" );
+ TiXmlElement* orig = new TiXmlElement( "origin" );
+ TiXmlElement* dest = new TiXmlElement( "destination" );
+ orig->SetAttribute( "filter", mIt->first.c_str( ) );
+ orig->SetAttribute( "name", eIt->first.c_str( ) );
+ dest->SetAttribute( "filter", rIt->first.c_str( ) );
+ dest->SetAttribute( "name", eIt->second.c_str( ) );
+
+ conn->LinkEndChild( orig );
+ conn->LinkEndChild( dest );
+ root->LinkEndChild( conn );
+
+ } // rof
+
+ } // rof
+
+ } // rof
+
// Physical write and return
doc->LinkEndChild( root );
doc->SaveFile( fname.c_str( ) );
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsUint( "Radius", 2 );
+ this->m_Parameters->ConfigureAsUint( "Radius" );
+ this->m_Parameters->SetUint( "Radius", 2 );
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsReal( "LowerThresholdValue", 0 );
- this->m_Parameters->ConfigureAsReal( "UpperThresholdValue", 10000 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 1 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 );
+ this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" );
+ this->m_Parameters->ConfigureAsReal( "UpperThresholdValue" );
+ this->m_Parameters->ConfigureAsUint( "InsideValue" );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue" );
+
+ this->m_Parameters->SetReal( "LowerThresholdValue", 0 );
+ this->m_Parameters->SetReal( "UpperThresholdValue", 10000 );
+ this->m_Parameters->SetUint( "InsideValue", 1 );
+ this->m_Parameters->SetUint( "OutsideValue", 0 );
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- double seed[ 3 ] = { double( 0 ) };
- this->m_Parameters->ConfigureAsPoint( "Seed0", 3, seed );
- this->m_Parameters->ConfigureAsPoint( "Seed1", 3, seed );
- this->m_Parameters->ConfigureAsReal( "Window", 0 );
- this->m_Parameters->ConfigureAsReal( "Level", 0 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 255 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 );
+ this->m_Parameters->ConfigureAsPoint( "Seed0" );
+ this->m_Parameters->ConfigureAsPoint( "Seed1" );
+ this->m_Parameters->ConfigureAsReal( "Window" );
+ this->m_Parameters->ConfigureAsReal( "Level" );
+ this->m_Parameters->ConfigureAsUint( "InsideValue" );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue" );
+
+ this->m_Parameters->SetReal( "Window", 0 );
+ this->m_Parameters->SetReal( "Level", 0 );
+ this->m_Parameters->SetUint( "InsideValue", 255 );
+ this->m_Parameters->SetUint( "OutsideValue", 0 );
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsUint( "Axis", 0 );
- this->m_Parameters->ConfigureAsInt( "Slice", 0 );
+ this->m_Parameters->ConfigureAsUint( "Axis" );
+ this->m_Parameters->ConfigureAsInt( "Slice" );
+
+ this->m_Parameters->SetUint( "Axis", 0 );
+ this->m_Parameters->SetInt( "Slice", 0 );
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- double seed[ 3 ] = { double( 0 ) };
- this->m_Parameters->ConfigureAsPoint( "Seed", 3, seed );
- this->m_Parameters->ConfigureAsReal( "Window", 0 );
- this->m_Parameters->ConfigureAsReal( "Level", 0 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 0 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 255 );
+ this->m_Parameters->ConfigureAsPoint( "Seed" );
+ this->m_Parameters->ConfigureAsReal( "Window" );
+ this->m_Parameters->ConfigureAsReal( "Level" );
+ this->m_Parameters->ConfigureAsUint( "InsideValue" );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue" );
+
+ this->m_Parameters->SetReal( "Window", 0 );
+ this->m_Parameters->SetReal( "Level", 0 );
+ this->m_Parameters->SetUint( "InsideValue", 0 );
+ this->m_Parameters->SetUint( "OutsideValue", 255 );
}
// -------------------------------------------------------------------------
this->_MakeOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" );
this->_MakeOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" );
- itk::Point< double, 3 > center;
- itk::Vector< double, 3 > normal;
-
- center.Fill( double( 0 ) );
- normal.Fill( double( 0 ) );
- normal[ 0 ] = double( 1 );
-
- this->m_Parameters->ConfigureAsPoint( "PlaneCenter", 3, center );
- this->m_Parameters->ConfigureAsVector( "PlaneNormal", 3, normal );
+ this->m_Parameters->ConfigureAsPoint( "PlaneCenter" );
+ this->m_Parameters->ConfigureAsVector( "PlaneNormal" );
}
// -------------------------------------------------------------------------
this->_AddInput("Input");
this->_MakeOutput< cpPlugins::Interface::Image >("Output");
- this->m_Parameters->ConfigureAsReal("Radius", 20);
+ this->m_Parameters->ConfigureAsReal("Radius");
//this->m_Parameters->ConfigureAsPoint("Point", 3, 3);
- this->m_Parameters->ConfigureAsReal("X", 30);
- this->m_Parameters->ConfigureAsReal("Y", 30);
- this->m_Parameters->ConfigureAsReal("Z", 30);
-
-
+ this->m_Parameters->ConfigureAsReal("X");
+ this->m_Parameters->ConfigureAsReal("Y");
+ this->m_Parameters->ConfigureAsReal("Z");
+
+ this->m_Parameters->SetReal("Radius", 20);
+ //this->m_Parameters->SetPoint("Point", 3, 3);
+ this->m_Parameters->SetReal("X", 30);
+ this->m_Parameters->SetReal("Y", 30);
+ this->m_Parameters->SetReal("Z", 30);
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsUint( "Radius", 3 );
+ this->m_Parameters->ConfigureAsUint( "Radius" );
+ this->m_Parameters->SetUint( "Radius", 3 );
}
// -------------------------------------------------------------------------
this->_AddInput( "Input" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 255 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 );
+ this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
+ this->m_Parameters->ConfigureAsUint( "InsideValue" );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue" );
+
+ this->m_Parameters->SetUint( "NumberOfHistogramBins", 100 );
+ this->m_Parameters->SetUint( "InsideValue", 255 );
+ this->m_Parameters->SetUint( "OutsideValue", 0 );
}
// -------------------------------------------------------------------------
{
this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
- double point[ 3 ] = { double( 0 ) };
- this->m_Parameters->ConfigureAsPoint( "Center", 3, point );
- this->m_Parameters->ConfigureAsReal( "Radius", 1 );
- this->m_Parameters->ConfigureAsUint( "PhiResolution", 8 );
- this->m_Parameters->ConfigureAsUint( "ThetaResolution", 8 );
+ this->m_Parameters->ConfigureAsPoint( "Center" );
+ this->m_Parameters->ConfigureAsReal( "Radius" );
+ this->m_Parameters->ConfigureAsUint( "PhiResolution" );
+ this->m_Parameters->ConfigureAsUint( "ThetaResolution" );
+
+ this->m_Parameters->SetReal( "Radius", 1 );
+ this->m_Parameters->SetUint( "PhiResolution", 8 );
+ this->m_Parameters->SetUint( "ThetaResolution", 8 );
}
// -------------------------------------------------------------------------
public:
itkNewMacro( Self );
itkTypeMacro( DicomSeriesReader, ImageReader );
- cpPlugins_Id_Macro(
- cpPlugins::IO::DicomSeriesReader, "DicomSeriesReader"
- );
+ cpPlugins_Id_Macro( cpPlugins::IO::DicomSeriesReader, "IO" );
public:
virtual DialogResult ExecConfigurationDialog( QWidget* parent );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsStringList( "FileNames" );
- this->m_Parameters->ConfigureAsBool( "VectorType", false );
+ this->m_Parameters->ConfigureAsBool( "VectorType" );
+ this->m_Parameters->SetBool( "VectorType", false );
}
// -------------------------------------------------------------------------
public:
itkNewMacro( Self );
itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource );
- cpPlugins_Id_Macro(
- cpPlugins::IO::ImageReader, "ImageReader"
- );
+ cpPlugins_Id_Macro( cpPlugins::IO::ImageReader, "IO" );
public:
virtual DialogResult ExecConfigurationDialog( QWidget* parent );
: Superclass( )
{
this->_AddInput( "Input" );
-
- this->m_Parameters->ConfigureAsString( "FileName", "" );
+ this->m_Parameters->ConfigureAsString( "FileName" );
}
// -------------------------------------------------------------------------
public:
itkNewMacro( Self );
itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink );
- cpPlugins_Id_Macro(
- cpPlugins::IO::ImageWriter, "ImageWriter"
- );
+ cpPlugins_Id_Macro( cpPlugins::IO::ImageWriter, "IO" );
public:
virtual DialogResult ExecConfigurationDialog( QWidget* parent );
std::vector< TParameters::TString > valid_types;
valid_types.push_back( "float" );
valid_types.push_back( "double" );
- this->m_Parameters->ConfigureAsString( "FileName", "" );
+ this->m_Parameters->ConfigureAsString( "FileName" );
this->m_Parameters->ConfigureAsChoices( "PixelType", valid_types );
- this->m_Parameters->ConfigureAsUint( "Dimension", 3 );
+ this->m_Parameters->ConfigureAsUint( "Dimension" );
+
+ this->m_Parameters->SetUint( "Dimension", 3 );
}
// -------------------------------------------------------------------------
public:
itkNewMacro( Self );
itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource );
- cpPlugins_Id_Macro(
- cpPlugins::IO::MeshReader, "MeshReader"
- );
+ cpPlugins_Id_Macro( cpPlugins::IO::MeshReader, "IO" );
public:
virtual DialogResult ExecConfigurationDialog( QWidget* parent );
: Superclass( )
{
this->_AddInput( "Input" );
-
- this->m_Parameters->ConfigureAsString( "FileName", "" );
+ this->m_Parameters->ConfigureAsString( "FileName" );
}
// -------------------------------------------------------------------------
public:
itkNewMacro( Self );
itkTypeMacro( MeshWriter, cpPluginsInterfaceMeshSink );
- cpPlugins_Id_Macro(
- cpPlugins::IO::MeshWriter, "MeshWriter"
- );
+ cpPlugins_Id_Macro( cpPlugins::IO::MeshWriter, "IO" );
public:
virtual DialogResult ExecConfigurationDialog( QWidget* parent );