Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[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;
19   if (theResult.ShapeType() == TopAbs_COMPOUND) {
20     Standard_Integer nbSubResults = 0;
21     TopoDS_Iterator itr(theResult);
22     for (; itr.More(); itr.Next()) nbSubResults++;
23     if (nbSubResults == 1) {
24       itr.Initialize(theResult);
25       if (itr.More()) aResult = itr.Value();
26     } else {
27       /// MPV: store compound anyway: it may be Boolean operation that produces two solids from one
28       aResult = theResult;
29     }
30   }
31   return aResult;
32 }