Salome HOME
Implementation and part of tests of High Level Objects History task for Common, Cut...
[modules/shaper.git] / src / Selector / Selector_Selector.cpp
index 62d1ad0cba9f24cd2f818bc5bd1016adb3affb7d..4ed6caebc3b20468893d176eb0797a28bc0dc536 100644 (file)
@@ -59,9 +59,9 @@ bool Selector_Selector::store(const TopoDS_Shape theContext)
 
 bool Selector_Selector::restore(const TopoDS_Shape theContext)
 {
-  if (myAlgo->restoreByLab(myLab)) {
-    myAlgo->solve(theContext); // to update the selection shape on the label
-    return true;
+  myAlgo = Selector_Algo::restoreByLab(myLab, myBaseDocumentLab);
+  if (myAlgo) {
+    return myAlgo->solve(theContext); // to update the selection shape on the label
   }
   return false;
 }
@@ -83,8 +83,8 @@ TDF_Label Selector_Selector::restoreByName(
   Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming)
 {
   TDF_Label aResult;
-  myAlgo = Selector_Algo::restoreByName(
-    myLab, myBaseDocumentLab, theName, theShapeType, theNameGenerator, aResult);
+  myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, theShapeType,
+    theGeometricalNaming, theNameGenerator, aResult);
   if (myAlgo) {
     return aResult;
   }
@@ -103,31 +103,6 @@ void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext)
     aNewAlgo->solve(theContext);
     delete myAlgo;
     myAlgo = aNewAlgo;
-  } else {
-    // if can not select, select the compound in a custom way
-    TopTools_MapOfShape aMap;
-    TopoDS_ListOfShape aList;
-    for(TopExp_Explorer anExp(theContext, aValue.ShapeType()); anExp.More(); anExp.Next()) {
-      if (aMap.Add(anExp.Current())) {
-        if (myAlgo->sameGeometry(aValue, anExp.Current()))
-          aList.Append(anExp.Current());
-      }
-    }
-    if (aList.Size() > 1) {
-      TopoDS_Builder aBuilder;
-      TopoDS_Compound aCompound;
-      aBuilder.MakeCompound(aCompound);
-      for(TopoDS_ListIteratorOfListOfShape aListIter(aList); aListIter.More(); aListIter.Next()) {
-        aBuilder.Add(aCompound, aListIter.Value());
-      }
-      Selector_Algo* aNewAlgo = Selector_Algo::relesectWithAllGeometry(myAlgo, theContext);
-      if (aNewAlgo) {
-        aNewAlgo->store();
-        aNewAlgo->solve(theContext);
-        delete myAlgo;
-        myAlgo = aNewAlgo;
-      }
-    }
   }
 }