1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_ResultGroup.cpp
4 // Created: 08 Jul 2014
5 // Author: Mikhail PONIKAROV
7 #include <Model_ResultGroup.h>
8 #include <ModelAPI_AttributeSelectionList.h>
9 #include <ModelAPI_AttributeIntArray.h>
11 #include <GeomAlgoAPI_CompoundBuilder.h>
13 #include <Config_PropManager.h>
15 Model_ResultGroup::Model_ResultGroup(std::shared_ptr<ModelAPI_Data> theOwnerData)
17 myOwnerData = theOwnerData;
20 void Model_ResultGroup::initAttributes()
22 // append the color attribute. It is empty, the attribute will be filled by a request
23 DataPtr aData = data();
24 aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
27 void Model_ResultGroup::colorConfigInfo(std::string& theSection, std::string& theName,
28 std::string& theDefault)
30 theSection = "Visualization";
31 theName = "result_group_color";
32 theDefault = DEFAULT_COLOR();
35 std::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape()
37 std::shared_ptr<GeomAPI_Shape> aResult;
39 AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list");
41 std::list<std::shared_ptr<GeomAPI_Shape> > aSubs;
42 for(int a = aList->size() - 1; a >= 0; a--) {
43 std::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
44 if (aSelection && !aSelection->isNull()) {
45 aSubs.push_back(aSelection);
49 aResult = GeomAlgoAPI_CompoundBuilder::compound(aSubs);