Salome HOME
refs #525: autocolor of zones in a calculation case.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageOp.cxx
index 72f2ac2dcac15953dfdaa5a200062fc9cef8791a..6a28b63737811f8a6b2001d00188982451c4f65c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -615,7 +615,12 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
 
           aViewPort->addItem( myPreviewPrs );
           aViewPort->fitAll();
-
+          
+          if ( myEditedObject ) {
+            size_t aViewId = (size_t)aViewer;
+            module()->setObjectVisible( aViewId, myEditedObject, true );
+          }
+          
           myPreviewPrs->setIsTransformationPointPreview( true );
         }
         connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
@@ -738,9 +743,13 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
   if( !aViewPort )
     return;
 
+  size_t aViewId = (size_t)myRefViewManager->getViewer();
+
   // Remove the old presentation of the reference image if any
   if( myRefPreviewPrs )
   {
+    module()->setObjectVisible( aViewId, myRefPreviewPrs->getObject(), false );
+
     myRefPreviewPrs->setCaption( QString() );
     aViewPort->removeItem( myRefPreviewPrs );
 
@@ -767,6 +776,8 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
 
     // Add the new reference image presentation to the appropriate view
     aViewPort->addItem( myRefPreviewPrs );
+
+    module()->setObjectVisible( aViewId, anImageObj, true );
   }
 
   aViewPort->fitAll();