Salome HOME
Manage concurrent hypotheses sets properly
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_HypothesesUtils.cxx
index 2c5d1828c0d7b0081216aa87557eab4dcc60d56c..7898e44e42a28a105c4ca812cfbf1e1726a8a04d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  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
@@ -224,18 +224,17 @@ namespace SMESH
             for( ;it1 != aXmlHandler->myHypothesesMap.end(); it1++)
               myHypothesesMap.insert( it1.key(), it1.value() );
             
-            
             it1 = aXmlHandler->myAlgorithmsMap.begin();
             for( ;it1 != aXmlHandler->myAlgorithmsMap.end(); it1++)
               myAlgorithmsMap.insert( it1.key(), it1.value() );
             
-            QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
+            QList<HypothesesSet*>::iterator it;
             for ( it = aXmlHandler->myListOfHypothesesSets.begin(); 
                   it != aXmlHandler->myListOfHypothesesSets.end();
                   ++it )
             {
               (*it)->setIsCustom( i == 0 );
-              myListOfHypothesesSets.insert( pos, *it );
+              myListOfHypothesesSets.append( *it );
             }
           }
           else {
@@ -316,6 +315,7 @@ namespace SMESH
         aSetNameList.append( mangledHypoSetName( aSet ));
       }
     }
+    aSetNameList.removeDuplicates();
     aSetNameList.sort();
 
     //  reverse order of aSetNameList
@@ -612,23 +612,21 @@ namespace SMESH
     return res < SMESH::HYP_UNKNOWN_FATAL;
   }
 
-  bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
+  bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject)               MorSM,
                                           SMESH::SMESH_Hypothesis_ptr anHyp)
   {
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeIOR_var anIOR;
     int res = SMESH::HYP_UNKNOWN_FATAL;
     SUIT_OverrideCursor wc;
 
     if (MorSM) {
       try {
         GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
-        SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
-        SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-        
+        SMESH::SMESH_Mesh_var aMesh        = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+        SMESH::SMESH_subMesh_var aSubMesh  = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
         if (!aSubMesh->_is_nil())
           aMesh = aSubMesh->GetFather();
-        
+
         if (!aMesh->_is_nil()) {    
           if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
             res = aMesh->RemoveHypothesis(aShapeObject, anHyp);