From 5a206530deb58b542463a7367618d21e8e5aa783 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 21 Jan 2016 14:05:09 +0300 Subject: [PATCH] ModuleBase_WidgetShapeSelector correction to process AttrRefAtt like MultiSelector do. Remove this processing on PartSet level as ModelAPI is a common interface. --- .../ModuleBase_WidgetShapeSelector.cpp | 12 +++++++++--- src/PartSet/PartSet_WidgetShapeSelector.cpp | 18 ------------------ src/PartSet/PartSet_WidgetShapeSelector.h | 7 ------- 3 files changed, 9 insertions(+), 28 deletions(-) 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 -- 2.39.2