1 // Name : ModelHighAPI_Selection.cpp
5 // 06/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Selection.h"
10 #include <ModelAPI_AttributeSelection.h>
11 //--------------------------------------------------------------------------------------
13 //--------------------------------------------------------------------------------------
14 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
15 const std::shared_ptr<GeomAPI_Shape>& theSubShape)
16 : myValue(ResultSubShapePair(theContext, theSubShape))
20 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
21 const std::string& theSubShapeName)
22 : myValue(TypeSubShapeNamePair(theType, theSubShapeName))
26 ModelHighAPI_Selection::~ModelHighAPI_Selection()
30 //--------------------------------------------------------------------------------------
31 struct fill_visitor : boost::static_visitor<void>
33 mutable std::shared_ptr<ModelAPI_AttributeSelection> myAttribute;
35 fill_visitor(std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
36 : myAttribute(theAttribute) {}
38 void operator()(const ResultSubShapePair & thePair) const { myAttribute->setValue(thePair.first, thePair.second); }
39 void operator()(const TypeSubShapeNamePair & thePair) const { myAttribute->selectSubShape(thePair.first, thePair.second); }
42 void ModelHighAPI_Selection::fillAttribute(
43 std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const
45 boost::apply_visitor(fill_visitor(theAttribute), myValue);