Salome HOME
lost icon for dummy3d
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_RecognizeContoursOp.cxx
index 2bee9b76568d36e848f24979752ee160d8290baf..20220731762f8d1c9c7587a5d1be40a6ef3108e5 100644 (file)
@@ -21,7 +21,7 @@
 #include "HYDROGUI_RecognizeContoursDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Shape.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_UpdateFlags.h"
 #include "HYDROGUI_OCCSelector.h"
 #include "HYDROGUI_ZLayers.h"
@@ -53,6 +53,7 @@
 #include <gp_GTrsf.hxx>
 
 #include <QDialog>
+#include <QDir>
 #include <QTemporaryFile>
 
 /**
@@ -99,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();
@@ -141,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;
@@ -227,7 +228,7 @@ bool HYDROGUI_RecognizeContoursOp::processApply( int& theUpdateFlags,
 
     if( !aPolylineObj.IsNull() ) {
       aPolylineObj->SetName( aName );
-      aPolylineObj->ImportShape( aShape );
+      aPolylineObj->ImportShape( aShape, false, NULL );
       aPolylineObj->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
 
       aPolylineObj->Update();
@@ -378,7 +379,7 @@ void HYDROGUI_RecognizeContoursOp::updateRecognizedPolylines()
       TopoDS_Shape aSubShape = aSubShapes.Value( i );
 
       // Transform the sub-shape
-      aPolylineObj->ImportShape( aSubShape );
+      aPolylineObj->ImportShape( aSubShape, false, NULL );
       aPolylineObj->Transform( aTrsf );
 
       /*
@@ -442,7 +443,7 @@ void HYDROGUI_RecognizeContoursOp::onSelectionChanged( const QStringList& theSel
   if ( !aCtx.IsNull() ) {
     foreach ( QString aName, myPolylineShapes.keys() ) {
       Handle(AIS_InteractiveObject) anObject = 
-        myPolylineShapes.value(aName)->getAISObject();
+        myPolylineShapes.value(aName)->getAISObjects()[0];
 
       bool isSelected = theSelectedNames.contains( aName );
       if ( ( isSelected && !aCtx->IsSelected( anObject) ) ||
@@ -467,9 +468,9 @@ void HYDROGUI_RecognizeContoursOp::onViewerSelectionChanged()
     return;
   }
 
-  Handle(AIS_InteractiveContext) aCtx = NULL;
 
   OCCViewer_ViewManager* aViewManager = getPreviewManager();
+  Handle(AIS_InteractiveContext) aCtx = NULL;
   if ( aViewManager ) {
     if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
       aCtx = aViewer->getAISContext();
@@ -480,7 +481,7 @@ void HYDROGUI_RecognizeContoursOp::onViewerSelectionChanged()
     QStringList aSelectedNames;
 
     foreach ( QString aName, myPolylineShapes.keys() ) {
-      bool isSelected = aCtx->IsSelected( myPolylineShapes.value(aName)->getAISObject() );
+      bool isSelected = aCtx->IsSelected( myPolylineShapes.value(aName)->getAISObjects()[0] );
       if ( isSelected ) {
         aSelectedNames << aName;
       }
@@ -513,4 +514,4 @@ void HYDROGUI_RecognizeContoursOp::cleanup()
     // update the object browser
     module()->getApp()->updateObjectBrowser( true );
   }
-}
\ No newline at end of file
+}