Salome HOME
Merge branch 'BR_internationalization'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_DFLoader.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_DFLoader.cpp
4 // Created:     23 October 2014
5 // Author:      Sergey Zaritchny
6
7 #include <GeomAlgoAPI_DFLoader.h>
8 #include <TopoDS_Iterator.hxx>
9 #include <TopTools_MapOfShape.hxx>
10 #include <TopExp_Explorer.hxx>
11 #include <TopTools_ListIteratorOfListOfShape.hxx>
12 //=======================================================================
13 //function : refineResult
14 //purpose  :
15 //=======================================================================
16 const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult)
17 {
18   TopoDS_Shape aResult = theResult;
19   const TopAbs_ShapeEnum aShType = theResult.ShapeType();
20   if(aShType == TopAbs_COMPOUND || aShType == TopAbs_SHELL || aShType == TopAbs_WIRE) {
21     Standard_Integer aSubResultsNb = 0;
22     TopoDS_Iterator anIt(theResult);
23     for(; anIt.More(); anIt.Next()) {
24       ++aSubResultsNb;
25     }
26     if(aSubResultsNb == 1) {
27       anIt.Initialize(theResult);
28       if(anIt.More()) {
29         aResult = anIt.Value();
30       }
31     }
32   }
33
34   return aResult;
35 }