]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
HYDRO feature 2: Images composing (T 1.3).
authorouv <ouv@opencascade.com>
Wed, 4 Sep 2013 11:42:04 +0000 (11:42 +0000)
committerouv <ouv@opencascade.com>
Wed, 4 Sep 2013 11:42:04 +0000 (11:42 +0000)
Taking into account the background color.

src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
src/HYDROGUI/HYDROGUI_TwoImagesDlg.h
src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx

index 6cee6e2609ab1f02f2f8d8ca993bc50c072b2783..145db26b49c28aff3a077a5aa9e9597692d58cdf 100644 (file)
@@ -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;
+}
index a1f5d5268881ab03697c279086232e12a2684e68..c3c14d82b0aa6ff44f08fecdcf0569905314cc59 100644 (file)
@@ -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;
index 8754c3056ada10f71c61c64a767d5459b85ca2e3..74deaf716f1e178ad6f5c9d3fbd6803096467413 100644 (file)
@@ -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;