From: ouv Date: Wed, 4 Sep 2013 11:42:04 +0000 (+0000) Subject: HYDRO feature 2: Images composing (T 1.3). X-Git-Tag: BR_hydro_v_0_1~76 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0006900f9b7798b199a295169d0d798ecaad6340;p=modules%2Fhydro.git HYDRO feature 2: Images composing (T 1.3). Taking into account the background color. --- diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx index 6cee6e26..145db26b 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx @@ -122,3 +122,20 @@ bool HYDROGUI_TwoImagesDlg::getSelectedImages( QString& theName1, theName2 = myImage2->GetName(); return !theName1.isEmpty() && !theName2.isEmpty(); } + +void HYDROGUI_TwoImagesDlg::setColor( const QColor& theColor ) +{ + if( theColor.alpha() == 0 ) // transparent + myTransparent->setChecked( true ); + else + myColor->setChecked( true ); + myColorBox->setColor( theColor ); +} + +QColor HYDROGUI_TwoImagesDlg::getColor() const +{ + QColor aColor( 255, 255, 255, 0 ); // transparent + if( myColor->isChecked() ) + aColor = myColorBox->color(); + return aColor; +} diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h index a1f5d526..c3c14d82 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h +++ b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h @@ -49,6 +49,9 @@ public: bool getSelectedImages( QString& theName1, QString& theName2 ) const; + void setColor( const QColor& theColor ); + QColor getColor() const; + private: QLineEdit* myImageName; HYDROGUI_ObjSelector* myImage1; diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx index 8754c305..74deaf71 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx @@ -112,6 +112,14 @@ void HYDROGUI_TwoImagesOp::startOperation() aSelectedName2 = anImage2->GetName(); } aPanel->setSelectedImages( aSelectedName1, aSelectedName2 ); + + HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory(); + if( ImageComposer_Operator* anOperator = aFactory->Operator( myEditedObject ) ) + { + QColor aColor; + anOperator->getArgs( aColor ); + aPanel->setColor( aColor ); + } } } @@ -175,6 +183,13 @@ bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags, aResult->SetName( anImageName ); aResult->AppendReference( anImage1 ); aResult->AppendReference( anImage2 ); + + if( ImageComposer_Operator* anOperator = aFactory->Operator( aResult ) ) + { + anOperator->setArgs( aPanel->getColor() ); + aResult->SetArgs( anOperator->getBinArgs() ); + } + aFactory->UpdateImage( doc(), aResult ); if( !myIsEdit ) @@ -183,7 +198,6 @@ bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags, module()->setObjectVisible( aViewId, anImage1, false ); module()->setObjectVisible( aViewId, anImage2, false ); module()->setObjectVisible( aViewId, aResult, true ); - } theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced;