Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / Model / Model_ResultGroup.cpp
1 // File:        Model_ResultGroup.cpp
2 // Created:     08 Jul 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include <Model_ResultGroup.h>
6 #include <ModelAPI_AttributeSelectionList.h>
7 #include <GeomAlgoAPI_CompoundBuilder.h>
8
9 Model_ResultGroup::Model_ResultGroup(std::shared_ptr<ModelAPI_Data> theOwnerData)
10 {
11   setIsConcealed(false);
12   myOwnerData = theOwnerData;
13 }
14
15 std::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape() const
16 {
17   std::shared_ptr<GeomAPI_Shape> aResult;
18   if (myOwnerData) {
19     AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list");
20     if (aList) {
21       std::list<std::shared_ptr<GeomAPI_Shape> > aSubs;
22       for(int a = aList->size() - 1; a >= 0; a--) {
23         std::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
24         if (aSelection && !aSelection->isNull()) {
25           aSubs.push_back(aSelection);
26         }
27       }
28       if (!aSubs.empty()) {
29         aResult = GeomAlgoAPI_CompoundBuilder::compound(aSubs);
30       }
31     }
32   }
33   return aResult;
34 }