From: nds Date: Thu, 21 Jan 2016 11:05:09 +0000 (+0300) Subject: ModuleBase_WidgetShapeSelector correction to process AttrRefAtt like MultiSelector... X-Git-Tag: V_2.2.0~189 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a206530deb58b542463a7367618d21e8e5aa783;p=modules%2Fshaper.git ModuleBase_WidgetShapeSelector correction to process AttrRefAtt like MultiSelector do. Remove this processing on PartSet level as ModelAPI is a common interface. --- diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 1047536e9..27b99ab85 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -208,9 +208,15 @@ GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const if (!aData->isValid()) return aShape; - AttributeSelectionPtr aSelect = aData->selection(attributeID()); - if (aSelect) - aShape = aSelect->value(); + std::string aType = aData->attribute(attributeID())->attributeType(); + if (aType == ModelAPI_AttributeReference::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { + AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); + aShape = myWorkshop->module()->findShape(aRefAttr); + } else if (aType == ModelAPI_AttributeSelection::typeId()) { + AttributeSelectionPtr aSelectAttr = aData->selection(attributeID()); + aShape = aSelectAttr->value(); + } return aShape; } diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 79e32272d..064a29efb 100755 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -13,20 +13,15 @@ #include #include -#include #include #include -#include - #include #include #include #include #include -#include -#include PartSet_WidgetShapeSelector::PartSet_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, @@ -76,19 +71,6 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrs& t } } -//******************************************************************** -GeomShapePtr PartSet_WidgetShapeSelector::getShape() const -{ - // an empty shape by default - DataPtr aData = myFeature->data(); - AttributePtr anAttribute = aData->attribute(attributeID()); - GeomShapePtr aShape = PartSet_Tools::findShapeBy2DPoint(anAttribute, myWorkshop); - - if (!aShape.get()) - aShape = ModuleBase_WidgetShapeSelector::getShape(); - return aShape; -} - //******************************************************************** void PartSet_WidgetShapeSelector::restoreAttributeValue(const bool theValid) { diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index f6b836e2e..0f9a88218 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -56,13 +56,6 @@ protected: ObjectPtr& theObject, GeomShapePtr& theShape); - /// Get the shape from the attribute if the attribute contain a shape - /// It processes the ref attr type of attributes. It obtains the referenced attribute, - /// results of the attribute feature. And it founds a vertes in the owners of the results - /// If the vertex is found, it creates a geom shape on it. - /// \return a shape - virtual GeomShapePtr getShape() const; - /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute