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 #include <ModelAPI_AttributeSelectionList.h>
12 //--------------------------------------------------------------------------------------
14 //--------------------------------------------------------------------------------------
15 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
16 const std::shared_ptr<GeomAPI_Shape>& theSubShape)
17 : myVariantType(VT_ResultSubShapePair)
18 , myResultSubShapePair(theContext, theSubShape)
22 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
23 const std::string& theSubShapeName)
24 : myVariantType(VT_TypeSubShapeNamePair)
25 , myTypeSubShapeNamePair(theType, theSubShapeName)
29 ModelHighAPI_Selection::~ModelHighAPI_Selection()
33 //--------------------------------------------------------------------------------------
34 void ModelHighAPI_Selection::fillAttribute(
35 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const
37 switch(myVariantType) {
38 case VT_ResultSubShapePair: theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second); return;
39 case VT_TypeSubShapeNamePair: theAttribute->selectSubShape(myTypeSubShapeNamePair.first, myTypeSubShapeNamePair.second); return;
43 //--------------------------------------------------------------------------------------
44 void ModelHighAPI_Selection::appendToList(
45 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const
47 switch(myVariantType) {
48 case VT_ResultSubShapePair: theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second); return;
49 case VT_TypeSubShapeNamePair:
50 // Note: the reverse order (first - type, second - sub-shape name)
51 theAttribute->append(myTypeSubShapeNamePair.second, myTypeSubShapeNamePair.first);
56 //==================================================================================================
57 ModelHighAPI_Selection::VariantType ModelHighAPI_Selection::variantType() const
62 //==================================================================================================
63 ResultSubShapePair ModelHighAPI_Selection::resultSubShapePair() const
65 return myResultSubShapePair;
68 //==================================================================================================
69 TypeSubShapeNamePair ModelHighAPI_Selection::typeSubShapeNamePair() const
71 return myTypeSubShapeNamePair;