]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultGroup.cpp
Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[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
10 #include <GeomAlgoAPI_CompoundBuilder.h>
11
12 #include <Config_PropManager.h>
13
14 Model_ResultGroup::Model_ResultGroup(std::shared_ptr<ModelAPI_Data> theOwnerData)
15 {
16   myOwnerData = theOwnerData;
17 }
18
19 void Model_ResultGroup::colorConfigInfo(std::string& theSection, std::string& theName,
20                                        std::string& theDefault)
21 {
22   theSection = "Visualization";
23   theName = "result_group_color";
24   theDefault = DEFAULT_COLOR();
25 }
26
27 std::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape()
28 {
29   std::shared_ptr<GeomAPI_Shape> aResult;
30   if (myOwnerData) {
31     AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list");
32     if (aList) {
33       std::list<std::shared_ptr<GeomAPI_Shape> > aSubs;
34       for(int a = aList->size() - 1; a >= 0; a--) {
35         std::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
36         if (aSelection && !aSelection->isNull()) {
37           aSubs.push_back(aSelection);
38         }
39       }
40       if (!aSubs.empty()) {
41         aResult = GeomAlgoAPI_CompoundBuilder::compound(aSubs);
42       }
43     }
44   }
45   return aResult;
46 }