Salome HOME
Merge from V6_3_BR 06/06/2011
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Make2DFrom3DOp.cxx
index b11f4bdf76648c6176ee82c5da930a5f0c360f94..afc81d19acf1246e680932d387ba0022c5156fb9 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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.
+// 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.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // File   : SMESHGUI_Make2DFrom3D.cxx
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 #include "SMESH_LogicalFilter.hxx"
 
 // SALOME GUI includes
+#include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_UpdateFlags.h>
 #include <SALOME_ListIO.hxx>
 #include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
 #include <SVTK_ViewModel.h>
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Tools.h>
@@ -337,7 +339,7 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
   return true;
 }
 
-bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
+bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
 {
   SUIT_OverrideCursor wc;
 
@@ -373,6 +375,8 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
                                     tr("SMESH_INFORMATION"),
                                     tr("NB_ADDED").arg( nbAdded ));
       if ( !newMesh->_is_nil() ) {
+        if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
+          theEntryList.append( aSObject->GetID().c_str() );
 #ifdef WITHGENERICOBJ
         newMesh->UnRegister();
 #endif
@@ -403,9 +407,10 @@ bool SMESHGUI_Make2DFrom3DOp::onApply()
     return false;
   }
 
+  QStringList anEntryList;
   bool res = false;
   try {
-    res = compute2DMesh();
+    res = compute2DMesh( anEntryList );
   }
   catch ( const SALOME::SALOME_Exception& S_ex ) {
     SalomeApp_Tools::QtCatchCorbaException( S_ex );
@@ -416,6 +421,9 @@ bool SMESHGUI_Make2DFrom3DOp::onApply()
   if ( res ) {
     SMESHGUI::Modified();
     update( UF_ObjBrowser | UF_Model );
+    if( LightApp_Application* anApp =
+        dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+      anApp->browseObjects( anEntryList, isApplyAndClose() );
     myDlg->setNewMeshName( SMESH::UniqueName( "Mesh_1" ) );
     myDlg->setGroupName( SMESH::UniqueName( "Group" ) );
   }