Salome HOME
Merge branch 'BR_v14_rc' into BR_quadtree
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_RecognizeContoursOp.cxx
index a3166c19372857cd137d367de2755f49384b8678..9eb098fed541c823c562d616f07f6189ff9ddcc2 100644 (file)
@@ -24,7 +24,7 @@
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
 #include "HYDROGUI_OCCSelector.h"
-#include "HYDROGUI_ZLayers.h" //@MZN
+#include "HYDROGUI_ZLayers.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_GeomTool.h>
@@ -53,6 +53,7 @@
 #include <gp_GTrsf.hxx>
 
 #include <QDialog>
+#include <QDir>
 #include <QTemporaryFile>
 
 /**
@@ -79,6 +80,12 @@ void HYDROGUI_RecognizeContoursOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
   
+  // Set preview view manager
+  if ( !getPreviewManager() ) {
+    setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( 
+                       module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+  }
+
   if ( !isApplyAndClose() ) {
     return;
   }
@@ -93,7 +100,7 @@ void HYDROGUI_RecognizeContoursOp::startOperation()
 
   // Create temporary graphics file
   QImage aQImage = myImage->Image();
-  myTmpImageFile = new QTemporaryFile( anImageName );
+  myTmpImageFile = new QTemporaryFile( QDir::tempPath() + QDir::separator() + anImageName );
   if ( !myTmpImageFile->open() || 
        !aQImage.save( myTmpImageFile->fileName(), "PNG", 100 ) ) {
     abort();
@@ -135,10 +142,10 @@ void HYDROGUI_RecognizeContoursOp::startOperation()
       // update the object browser
       module()->getApp()->updateObjectBrowser( true );
 
-      // select the picture
-      SUIT_DataOwnerPtrList aList( true );
-      aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aGeomPictureEntry ) ) );
-      selectionMgr()->setSelected(aList );
+      // browse the published GEOM picture
+      QStringList anEntries;
+      anEntries << aGeomPictureEntry;
+      browseObjects( anEntries );
 
       // Add GEOM picture object entry to the list of temporary geom objects
       myTmpGeomObjects << aGeomPictureEntry;
@@ -334,11 +341,6 @@ void HYDROGUI_RecognizeContoursOp::updateRecognizedPolylines()
     Handle(AIS_InteractiveContext) aCtx = NULL;
 
     // Display preview
-    if ( !getPreviewManager() ) {
-      setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( 
-                          module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
-    }
-
     OCCViewer_ViewManager* aViewManager = getPreviewManager();
     if ( aViewManager ) {
       if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
@@ -357,7 +359,7 @@ void HYDROGUI_RecognizeContoursOp::updateRecognizedPolylines()
                      aTrsf.m21(), -aTrsf.m22(), aTrsf.m23(),
                      aTrsf.m31() + aRect.width() * 0.5, aTrsf.m32 () - aRect.height() * 0.5, aTrsf.m33() );
 
-    /* @MZN
+    /*
     QTransform aTrsf = myImage->Trsf();
     gp_Mat aMat( aTrsf.m11(), aTrsf.m21(), 0, 
                  aTrsf.m12(), -aTrsf.m22(), 0,