+
+//==================================================================================================
+void ModelHighAPI_Selection::setName(const std::string& theName)
+{
+ if (myVariantType == VT_ResultSubShapePair) {
+ std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
+ if(!aResult.get()) {
+ return;
+ }
+ aResult->data()->setName(theName);
+ }
+}
+
+std::string ModelHighAPI_Selection::name() const
+{
+ if (myVariantType == VT_ResultSubShapePair) {
+ std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
+ if (aResult.get())
+ return aResult->data()->name();
+ }
+ return std::string();
+}
+
+void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue)
+{
+ if (myVariantType != VT_ResultSubShapePair || !myResultSubShapePair.first.get())
+ return;
+
+ AttributeIntArrayPtr aColor =
+ myResultSubShapePair.first->data()->intArray(ModelAPI_Result::COLOR_ID());
+ aColor->setSize(3);
+ aColor->setValue(0, theRed);
+ aColor->setValue(1, theGreen);
+ aColor->setValue(2, theBlue);
+}
+
+void ModelHighAPI_Selection::setDeflection(double theValue)
+{
+ if (myVariantType != VT_ResultSubShapePair)
+ return;
+
+ AttributeDoublePtr aDeflectionAttr =
+ myResultSubShapePair.first->data()->real(ModelAPI_Result::DEFLECTION_ID());
+
+ aDeflectionAttr->setValue(theValue);
+}
+
+void ModelHighAPI_Selection::setTransparency(double theValue)
+{
+ if (myVariantType != VT_ResultSubShapePair)
+ return;
+
+ AttributeDoublePtr aTransparencyAttr =
+ myResultSubShapePair.first->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
+
+ aTransparencyAttr->setValue(theValue);
+}
+
+int ModelHighAPI_Selection::numberOfSubs() const
+{
+ if (myVariantType != VT_ResultSubShapePair)
+ return 0;
+
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myResultSubShapePair.first);
+ if (!aBody.get())
+ return 0;
+
+ return aBody->numberOfSubs();
+}
+
+ModelHighAPI_Selection ModelHighAPI_Selection::subResult(int theIndex) const
+{
+ if (myVariantType != VT_ResultSubShapePair)
+ return ModelHighAPI_Selection();
+
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myResultSubShapePair.first);
+ if (!aBody)
+ return ModelHighAPI_Selection();
+ if (theIndex >= aBody->numberOfSubs())
+ return ModelHighAPI_Selection();
+
+ ResultBodyPtr aResult = aBody->subResult(theIndex);
+ return ModelHighAPI_Selection(aResult, aResult->shape());
+}