#include #include #include #include // ------------------------------------------------------------------------- cpBaseQtApplication::ActorLUTImageProperties:: ActorLUTImageProperties( QWidget* parent ) : cpBaseQtApplication::ActorProperties( parent ), m_UI( new Ui::ActorLUTImageProperties ) { this->m_UI->setupUi( this ); } // ------------------------------------------------------------------------- cpBaseQtApplication::ActorLUTImageProperties:: ~ActorLUTImageProperties( ) { delete this->m_UI; } // ------------------------------------------------------------------------- bool cpBaseQtApplication::ActorLUTImageProperties:: addActor( vtkProp* obj ) { typedef cpExtensions::Visualization::LUTImageActor _TActor; auto actor = dynamic_cast< _TActor* >( obj ); if( actor != NULL ) { this->m_Actors.insert( obj ); if( this->m_Actors.size( ) == 1 ) this->_updateWidgets( ); return( true ); } else return( false ); } // ------------------------------------------------------------------------- void cpBaseQtApplication::ActorLUTImageProperties:: _updateWidgets( ) { typedef cpExtensions::Visualization::LUTImageActor _TActor; auto actor = dynamic_cast< _TActor* >( this->m_Actors.begin( )->GetPointer( ) ); if( actor == NULL ) return; // TODO: std::cout << actor << std::endl; // Get properties /* TODO auto mapp = actor->GetMapper( ); auto prop = actor->GetProperty( ); double rgb[ 3 ]; prop->GetColor( rgb ); rgb[ 0 ] *= double( 255 ); rgb[ 1 ] *= double( 255 ); rgb[ 2 ] *= double( 255 ); double op = prop->GetOpacity( ); double lw = prop->GetLineWidth( ); double ps = prop->GetPointSize( ); bool sv = ( mapp->GetScalarVisibility( ) == 1 ); int rep = prop->GetRepresentation( ); // Set widget values auto palette = this->m_UI->Color->palette( ); palette.setColor( QPalette::Button, QColor( rgb[ 0 ], rgb[ 1 ], rgb[ 2 ] ) ); this->m_UI->Color->setAutoFillBackground( true ); this->m_UI->Color->setPalette( palette ); op *= double( this->m_UI->Opacity->maximum( ) ); this->m_UI->Opacity->setValue( int( op ) ); this->m_UI->LineWidth->setValue( int( lw ) ); this->m_UI->PointSize->setValue( int( ps ) ); this->m_UI->ScalarVisibility->setChecked( sv ); if( rep == VTK_POINTS ) this->m_UI->Representation->setCurrentIndex( 0 ); else if( rep == VTK_WIREFRAME ) this->m_UI->Representation->setCurrentIndex( 1 ); else if( rep == VTK_SURFACE ) this->m_UI->Representation->setCurrentIndex( 2 ); // Connect stuff this->connect( this->m_UI->ScalarVisibility, SIGNAL( stateChanged( int ) ), this, SLOT( _ScalarVisibility( int ) ) ); this->connect( this->m_UI->Color, SIGNAL( clicked( ) ), this, SLOT( _Color( ) ) ); this->connect( this->m_UI->Opacity, SIGNAL( valueChanged( int ) ), this, SLOT( _Opacity( int ) ) ); this->connect( this->m_UI->LineWidth, SIGNAL( valueChanged( int ) ), this, SLOT( _LineWidth( int ) ) ); this->connect( this->m_UI->PointSize, SIGNAL( valueChanged( int ) ), this, SLOT( _PointSize( int ) ) ); this->connect( this->m_UI->Representation, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _Representation( int ) ) ); */ } // ------------------------------------------------------------------------- void cpBaseQtApplication::ActorLUTImageProperties:: _Color( ) { /* TODO if( this->m_Actors.size( ) == 0 ) return; QPalette pal = this->m_UI->Color->palette( ); QColor color = QColorDialog::getColor( pal.color( QPalette::Button ), this, "Select Color", QColorDialog::DontUseNativeDialog ); if( color.isValid( ) ) { pal.setColor( QPalette::Button, color ); this->m_UI->Color->setAutoFillBackground( true ); this->m_UI->Color->setPalette( pal ); this->m_UI->Color->update( ); this->_ScalarVisibility( 0 ); } // fi */ } // ------------------------------------------------------------------------- void cpBaseQtApplication::ActorLUTImageProperties:: _Opacity( int v ) { /* double op = double( v ) / double( this->m_UI->Opacity->maximum( ) ); auto aIt = this->m_Actors.begin( ); for( ; aIt != this->m_Actors.end( ); ++aIt ) { auto ma = dynamic_cast< vtkActor* >( aIt->GetPointer( ) ); ma->GetProperty( )->SetOpacity( op ); ma->Modified( ); } // rof this->_render( ); */ } // eof - $RCSfile$