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 myIsDisabled = true; // by default it is not initialized and false to be after created
18 setIsConcealed(false);
19 myOwnerData = theOwnerData;
22 void Model_ResultGroup::initAttributes()
24 // append the color attribute. It is empty, the attribute will be filled by a request
25 DataPtr aData = data();
26 aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
29 void Model_ResultGroup::colorConfigInfo(std::string& theSection, std::string& theName,
30 std::string& theDefault)
32 theSection = "Visualization";
33 theName = "result_group_color";
34 theDefault = DEFAULT_COLOR();
37 std::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape()
39 std::shared_ptr<GeomAPI_Shape> aResult;
41 AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list");
43 std::list<std::shared_ptr<GeomAPI_Shape> > aSubs;
44 for(int a = aList->size() - 1; a >= 0; a--) {
45 std::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
46 if (aSelection && !aSelection->isNull()) {
47 aSubs.push_back(aSelection);
51 aResult = GeomAlgoAPI_CompoundBuilder::compound(aSubs);