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