Salome HOME
Base implementation of dumping study document in to Python script (Feature #14).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageOp.cxx
index d2da0a5c9da2f5534300dc5e8469d0142b62c9ab..52ea65d9c32263bb5033fef06b230f79b6709471 100644 (file)
@@ -304,7 +304,7 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
   closePreview();
 
   if( !myIsEdit )
-    anImageObj->SetVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), true );
+    module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), anImageObj, true );
 
   if( myIsEdit )
     if( HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory() )
@@ -394,10 +394,17 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
   if( !aViewPort )
     return;
 
-  aViewPort->removeItem( myRefPreviewPrs );
+  if( myPreviewPrs )
+    myPreviewPrs->setCaption( QString() );
+
+  if( myRefPreviewPrs )
+  {
+    myRefPreviewPrs->setCaption( QString() );
+    aViewPort->removeItem( myRefPreviewPrs );
 
-  delete myRefPreviewPrs;
-  myRefPreviewPrs = 0;
+    delete myRefPreviewPrs;
+    myRefPreviewPrs = 0;
+  }
 
   QImage anImage;
   Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast(
@@ -416,8 +423,11 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
     // vertically shift the reference prs relatively to the main prs
     if( myPreviewPrs )
     {
+      myPreviewPrs->setCaption( tr( "IMPORTED_IMAGE" ) );
+
       QImage anImage = myPreviewPrs->getImage();
-      myRefPreviewPrs->moveBy( 0, anImage.height() + 20 );
+      myRefPreviewPrs->moveBy( 0, anImage.height() + 60 );
+      myRefPreviewPrs->setCaption( tr( "REFERENCE_IMAGE" ) );
     }
 
     aViewPort->addItem( myRefPreviewPrs );