#include #include #include #include #include #include #include #include #include #include /* #include #include #include #include #include #include #include #include #include */ // ------------------------------------------------------------------------- cpBaseQtApplication::ActorPropertiesQDialog:: ActorPropertiesQDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f ), m_MainWidget( NULL ) { this->m_Title = new QLabel( this ); this->m_Title->setText( "Visualization properties" ); this->m_MainLayout = new QGridLayout( this ); this->m_ToolsLayout = new QVBoxLayout( ); this->m_ToolsLayout->addWidget( this->m_Title ); this->m_MainLayout->addLayout( this->m_ToolsLayout, 0, 0, 1, 1 ); } // ------------------------------------------------------------------------- cpBaseQtApplication::ActorPropertiesQDialog:: ~ActorPropertiesQDialog( ) { } // ------------------------------------------------------------------------- void cpBaseQtApplication::ActorPropertiesQDialog:: setProps( const TProps& props ) { if( this->m_MainWidget == NULL ) { std::map< std::string, std::set< vtkProp* > > all_props; for( auto coll = props.begin( ); coll != props.end( ); ++coll ) { ( *coll )->InitTraversal( ); while( auto p = ( *coll )->GetNextProp( ) ) all_props[ p->GetClassName( ) ].insert( p ); } // rof std::stringstream title; title << "Parameters for an object of class"; auto wl_actors = all_props.find( "WindowLevelImageActor" ); auto lt_actors = all_props.find( "LUTImageActor" ); auto actors = all_props.end( ); if( wl_actors != all_props.end( ) ) { title << "\"Image\""; this->m_MainWidget = new cpBaseQtApplication::ActorImageProperties( this ); actors = wl_actors; } else if( lt_actors != all_props.end( ) ) { title << "\"LUT Image\""; this->m_MainWidget = new cpBaseQtApplication::ActorLUTImageProperties( this ); actors = lt_actors; } else { if( all_props.size( ) == 1 ) { auto mesh = dynamic_cast< vtkActor* >( *( all_props.begin( )->second.begin( ) ) ); if( mesh != NULL ) { title << "\"Mesh\""; this->m_MainWidget = new cpBaseQtApplication::ActorPolyDataProperties( this ); actors = all_props.begin( ); } // fi } // fi } // fi if( actors != all_props.end( ) ) { this->m_Title->setText( title.str( ).c_str( ) ); this->m_ToolsLayout->addWidget( this->m_MainWidget ); this->m_Buttons = new QDialogButtonBox( QDialogButtonBox::Ok ); this->connect( this->m_Buttons, SIGNAL( accepted( ) ), this, SLOT( accept( ) ) ); this->connect( this->m_Buttons, SIGNAL( rejected( ) ), this, SLOT( reject( ) ) ); this->m_ToolsLayout->addWidget( this->m_Buttons ); for( auto a = actors->second.begin( ); a != actors->second.end( ); ++a ) this->m_MainWidget->addActor( *a ); } // fi } // fi } // ------------------------------------------------------------------------- bool cpBaseQtApplication::ActorPropertiesQDialog:: addRenderWindow( vtkRenderWindow* win ) { if( this->m_MainWidget != NULL && win != NULL ) return( this->m_MainWidget->addRenderWindow( win ) ); else return( false ); } // eof - $RCSfile$