From 57ddb5fa8e5c65bbafaa03e167e20cf2099be379 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 4 Apr 2016 15:16:39 +0300 Subject: [PATCH] Issue #1343. Improvement of Extrusion and Revolution operations: Bug correction: Create Sketch, Extrusion on the sketch, Save/Open -> crash. --- src/ModuleBase/CMakeLists.txt | 2 + src/ModuleBase/ModuleBase_Tools.cpp | 22 +++++ src/ModuleBase/ModuleBase_Tools.h | 8 ++ .../ModuleBase_WidgetMultiSelector.cpp | 61 +----------- .../ModuleBase_WidgetMultiSelector.h | 20 ---- src/ModuleBase/ModuleBase_WidgetSelector.cpp | 12 +-- src/ModuleBase/ModuleBase_WidgetSelector.h | 7 -- .../ModuleBase_WidgetSelectorStore.cpp | 95 +++++++++++++++++++ .../ModuleBase_WidgetSelectorStore.h | 63 ++++++++++++ .../ModuleBase_WidgetShapeSelector.cpp | 53 +---------- .../ModuleBase_WidgetShapeSelector.h | 23 ----- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 14 ++- src/ModuleBase/ModuleBase_WidgetValidated.h | 4 + src/PartSet/PartSet_WidgetMultiSelector.h | 2 +- 14 files changed, 215 insertions(+), 171 deletions(-) create mode 100755 src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp create mode 100755 src/ModuleBase/ModuleBase_WidgetSelectorStore.h diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index 23c589611..c7b2e215c 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -53,6 +53,7 @@ SET(PROJECT_HEADERS ModuleBase_WidgetLineEdit.h ModuleBase_WidgetMultiSelector.h ModuleBase_WidgetSelector.h + ModuleBase_WidgetSelectorStore.h ModuleBase_WidgetShapeSelector.h ModuleBase_WidgetSwitch.h ModuleBase_WidgetToolbox.h @@ -108,6 +109,7 @@ SET(PROJECT_SOURCES ModuleBase_WidgetLineEdit.cpp ModuleBase_WidgetMultiSelector.cpp ModuleBase_WidgetSelector.cpp + ModuleBase_WidgetSelectorStore.cpp ModuleBase_WidgetShapeSelector.cpp ModuleBase_WidgetSwitch.cpp ModuleBase_WidgetToolbox.cpp diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 1bc60c1ed..250cff9ff 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -490,6 +490,28 @@ void setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject, } } +GeomShapePtr getShape(const AttributePtr& theAttribute, ModuleBase_IWorkshop* theWorkshop) +{ + GeomShapePtr aShape; + if (!theAttribute.get()) + return aShape; + + std::string aType = theAttribute->attributeType(); + if (aType == ModelAPI_AttributeReference::typeId()) { + } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + if (aRefAttr.get() && !aRefAttr->isObject()) { + AttributePtr anAttribute = aRefAttr->attr(); + aShape = theWorkshop->module()->findShape(anAttribute); + } + } else if (aType == ModelAPI_AttributeSelection::typeId()) { + AttributeSelectionPtr aSelectAttr = std::dynamic_pointer_cast + (theAttribute); + aShape = aSelectAttr->value(); + } + return aShape; +} + } // namespace ModuleBase_Tools diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 594c5ed28..b4687584f 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -191,6 +191,14 @@ MODULEBASE_EXPORT void setObject(const AttributePtr& theAttribute, const ObjectP const std::shared_ptr& theShape, ModuleBase_IWorkshop* theWorkshop, const bool theTemporarily = false); + +/// Returns the shape of the attribute. If the attribute is AttributeRefAttrPtr, the shape is found +/// using current module of the given workshop. +/// \param theAttribute an attribute where the shape is set +/// \param theWorkshop to find a shape for the given attribute +MODULEBASE_EXPORT std::shared_ptr getShape(const AttributePtr& theAttribute, + ModuleBase_IWorkshop* theWorkshop); + } #endif diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index e0a84bc97..157eb4f9a 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -86,8 +86,7 @@ protected: ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData) -: ModuleBase_WidgetSelector(theParent, theWorkshop, theData), - mySelectionCount(0) +: ModuleBase_WidgetSelector(theParent, theWorkshop, theData) { QGridLayout* aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); @@ -215,62 +214,6 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom() return true; } -//******************************************************************** -void ModuleBase_WidgetMultiSelector::storeAttributeValue() -{ - ModuleBase_WidgetValidated::storeAttributeValue(); - - DataPtr aData = myFeature->data(); - AttributePtr anAttribute = aData->attribute(attributeID()); - std::string aType = anAttribute->attributeType(); - if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); - mySelectionType = aSelectionListAttr->selectionType(); - mySelectionCount = aSelectionListAttr->size(); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { - AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); - mySelectionCount = aRefListAttr->size(); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); - mySelectionCount = aRefAttrListAttr->size(); - } -} - -//******************************************************************** -void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool theValid) -{ - ModuleBase_WidgetValidated::restoreAttributeValue(theValid); - - DataPtr aData = myFeature->data(); - AttributePtr anAttribute = aData->attribute(attributeID()); - std::string aType = anAttribute->attributeType(); - if (aType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID()); - aSelectionListAttr->setSelectionType(mySelectionType); - - // restore selection in the attribute. Indeed there is only one stored object - int aCountAppened = aSelectionListAttr->size() - mySelectionCount; - for (int i = 0; i < aCountAppened; i++) - aSelectionListAttr->removeLast(); - } - else if (aType == ModelAPI_AttributeRefList::typeId()) { - AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); - // restore objects in the attribute. Indeed there is only one stored object - int aCountAppened = aRefListAttr->size() - mySelectionCount; - for (int i = 0; i < aCountAppened; i++) - aRefListAttr->removeLast(); - } - else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { - AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); - // restore objects in the attribute. Indeed there is only one stored object - int aCountAppened = aRefAttrListAttr->size() - mySelectionCount; - for (int i = 0; i < aCountAppened; i++) - aRefAttrListAttr->removeLast(); - } -} - //******************************************************************** bool ModuleBase_WidgetMultiSelector::setSelection(QList& theValues, const bool theToValidate) @@ -624,7 +567,7 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::setattribute(i); if (anAttribute.get()) { - GeomShapePtr aGeomShape = myWorkshop->module()->findShape(anAttribute); + GeomShapePtr aGeomShape = ModuleBase_Tools::getShape(anAttribute, myWorkshop); theValues.append(ModuleBase_ViewerPrs(anObject, aGeomShape, NULL)); } } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 5dd0d1702..42e789bfd 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -109,11 +109,6 @@ protected: virtual bool restoreValueCustom(); - /// 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 - virtual void storeAttributeValue(); - /// Set the focus on the last item in the list virtual void updateFocus(); @@ -124,12 +119,6 @@ protected: /// \return a list of shapes virtual QIntList getShapeTypes() 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 - /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const bool theValid); - /// Set current shape type for selection void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType); @@ -190,15 +179,6 @@ protected: QAction* myCopyAction; QAction* myDeleteAction; - /// backup parameters of the model attribute. The class processes three types of attribute: - /// Reference, RefAttr and Selection. Depending on the attribute type, only the attribute parameter - /// values are reserved in the backup - /// Variable of selection type - std::string mySelectionType; - - /// Variable of GeomSelection - int mySelectionCount; // number of elements in the attribute selection list when store - /// A flag to store use_choice parameter state bool myIsUseChoice; }; diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index 5443629a8..28f94ae02 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -140,15 +140,6 @@ bool ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate) return activateFilters(toActivate); } -//******************************************************************** -void ModuleBase_WidgetSelector::setObject(ObjectPtr theObject, - GeomShapePtr theShape) -{ - DataPtr aData = myFeature->data(); - ModuleBase_Tools::setObject(aData->attribute(attributeID()), theObject, theShape, - myWorkshop, myIsInValidate); -} - //******************************************************************** void ModuleBase_WidgetSelector::activateCustom() { @@ -184,7 +175,8 @@ bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrs& t GeomShapePtr aShape; getGeomSelection(thePrs, anObject, aShape); - setObject(anObject, aShape); + AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); + ModuleBase_Tools::setObject(anAttribute, anObject, aShape, myWorkshop, false); return true; } diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.h b/src/ModuleBase/ModuleBase_WidgetSelector.h index 2099b0e99..a470aa875 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetSelector.h @@ -85,13 +85,6 @@ protected: // NDS: has body is temporary virtual void updateSelectionName() {}; - /// Store the values to the model attribute of the widget. It casts this attribute to - /// the specific type and set the given values - /// \param theSelectedObject an object - /// \param theShape a selected shape, which is used in the selection attribute - /// \return true if it is succeed - void setObject(ObjectPtr theSelectedObject, GeomShapePtr theShape); - /// The methiod called when widget is activated virtual void activateCustom(); diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp new file mode 100755 index 000000000..2bf5195ca --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp @@ -0,0 +1,95 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModuleBase_WidgetSelectorStore.cpp +// Created: 2 June 2014 +// Author: Vitaly Smetannikov + +#include +#include +#include + +#include +#include +#include +#include + +ModuleBase_WidgetSelectorStore::ModuleBase_WidgetSelectorStore() +: myIsObject(false), mySelectionType(""), mySelectionCount(0) +{ +} + +void ModuleBase_WidgetSelectorStore::storeAttributeValue(const AttributePtr& theAttribute, + ModuleBase_IWorkshop* theWorkshop) +{ + if (!theAttribute.get()) + return; + + std::string aType = theAttribute->attributeType(); + if (aType == ModelAPI_AttributeSelectionList::typeId()) { + AttributeSelectionListPtr aSelectionListAttr = + std::dynamic_pointer_cast(theAttribute); + mySelectionType = aSelectionListAttr->selectionType(); + mySelectionCount = aSelectionListAttr->size(); + } + else if (aType == ModelAPI_AttributeRefList::typeId()) { + AttributeRefListPtr aRefListAttr = + std::dynamic_pointer_cast(theAttribute); + mySelectionCount = aRefListAttr->size(); + } + else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + std::dynamic_pointer_cast(theAttribute); + mySelectionCount = aRefAttrListAttr->size(); + } + else { + myObject = ModuleBase_Tools::getObject(theAttribute); + myShape = ModuleBase_Tools::getShape(theAttribute, theWorkshop); + myRefAttribute = AttributePtr(); + myIsObject = false; + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + if (aRefAttr) { + myIsObject = aRefAttr->isObject(); + myRefAttribute = aRefAttr->attr(); + } + } +} + +//******************************************************************** +void ModuleBase_WidgetSelectorStore::restoreAttributeValue(const AttributePtr& theAttribute, + ModuleBase_IWorkshop* theWorkshop) +{ + std::string aType = theAttribute->attributeType(); + if (aType == ModelAPI_AttributeSelectionList::typeId()) { + AttributeSelectionListPtr aSelectionListAttr = + std::dynamic_pointer_cast(theAttribute); + aSelectionListAttr->setSelectionType(mySelectionType); + // restore selection in the attribute. Indeed there is only one stored object + int aCountAppened = aSelectionListAttr->size() - mySelectionCount; + for (int i = 0; i < aCountAppened; i++) + aSelectionListAttr->removeLast(); + } + else if (aType == ModelAPI_AttributeRefList::typeId()) { + AttributeRefListPtr aRefListAttr = + std::dynamic_pointer_cast(theAttribute); + // restore objects in the attribute. Indeed there is only one stored object + int aCountAppened = aRefListAttr->size() - mySelectionCount; + for (int i = 0; i < aCountAppened; i++) + aRefListAttr->removeLast(); + } + else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { + AttributeRefAttrListPtr aRefAttrListAttr = + std::dynamic_pointer_cast(theAttribute); + // restore objects in the attribute. Indeed there is only one stored object + int aCountAppened = aRefAttrListAttr->size() - mySelectionCount; + for (int i = 0; i < aCountAppened; i++) + aRefAttrListAttr->removeLast(); + } + else { + ModuleBase_Tools::setObject(theAttribute, myObject, myShape, theWorkshop, true); + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + if (aRefAttr) { + if (!myIsObject) + aRefAttr->setAttr(myRefAttribute); + } + } +} diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.h b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h new file mode 100755 index 000000000..a3584e301 --- /dev/null +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h @@ -0,0 +1,63 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: ModuleBase_WidgetSelectorStore.h +// Created: 2 June 2014 +// Author: Vitaly Smetannikov + +#ifndef ModuleBase_WidgetSelectorStore_H +#define ModuleBase_WidgetSelectorStore_H + +#include "ModuleBase.h" + +#include +#include +#include + +class ModuleBase_IWorkshop; + +/** +* \ingroup GUI + Provides for an attribute backup of values. It is possible to store/ restore the attribute values. +*/ +class MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore +{ + public: + + /// Constructor + ModuleBase_WidgetSelectorStore(); + /// Destructor + virtual ~ModuleBase_WidgetSelectorStore() {} + + /// Creates a backup of the current values of the attribute + /// \param theAttribute a model attribute which parameters are to be stored + /// \param theWorkshop a current workshop + void storeAttributeValue(const AttributePtr& theAttribute, + ModuleBase_IWorkshop* theWorkshop); + + /// Creates a backup of the current values of the attribute + /// \param theAttribute a model attribute which parameters are to be restored + /// \param theWorkshop a current workshop + void restoreAttributeValue(const AttributePtr& theAttribute, + ModuleBase_IWorkshop* theWorkshop); + +private: + /// backup parameters of the model attribute. The class processes three types of attribute: + /// Reference, RefAttr and Selection. Depending on the attribute type, only the attribute parameter + /// values are reserved in the backup + /// An attribute object + ObjectPtr myObject; + /// An attribute shape + GeomShapePtr myShape; + /// A reference of the attribute + AttributePtr myRefAttribute; + /// A boolean value whether refAttr uses reference of object + bool myIsObject; + + /// Variable of selection type + std::string mySelectionType; + /// Variable of GeomSelection + int mySelectionCount; // number of elements in the attribute selection list when store + +}; + +#endif diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index b4b708367..1bcedc636 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -184,22 +184,10 @@ GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const { GeomShapePtr aShape; DataPtr aData = myFeature->data(); - if (!aData->isValid()) - return aShape; - - std::string aType = aData->attribute(attributeID())->attributeType(); - if (aType == ModelAPI_AttributeReference::typeId()) { - } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); - if (aRefAttr.get() && !aRefAttr->isObject()) { - AttributePtr anAttribute = aRefAttr->attr(); - aShape = myWorkshop->module()->findShape(anAttribute); - } - } else if (aType == ModelAPI_AttributeSelection::typeId()) { - AttributeSelectionPtr aSelectAttr = aData->selection(attributeID()); - aShape = aSelectAttr->value(); + if (aData->isValid()) { + AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); + aShape = ModuleBase_Tools::getShape(anAttribute, myWorkshop); } - return aShape; } @@ -234,38 +222,3 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() } } } - -//******************************************************************** -void ModuleBase_WidgetShapeSelector::storeAttributeValue() -{ - ModuleBase_WidgetValidated::storeAttributeValue(); - - DataPtr aData = myFeature->data(); - AttributePtr anAttribute = myFeature->attribute(attributeID()); - - myObject = ModuleBase_Tools::getObject(anAttribute); - myShape = getShape(); - myRefAttribute = AttributePtr(); - myIsObject = false; - AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); - if (aRefAttr) { - myIsObject = aRefAttr->isObject(); - myRefAttribute = aRefAttr->attr(); - } -} - -//******************************************************************** -void ModuleBase_WidgetShapeSelector::restoreAttributeValue(bool theValid) -{ - ModuleBase_WidgetValidated::restoreAttributeValue(theValid); - - DataPtr aData = myFeature->data(); - AttributePtr anAttribute = myFeature->attribute(attributeID()); - - setObject(myObject, myShape); - AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); - if (aRefAttr) { - if (!myIsObject) - aRefAttr->setAttr(myRefAttribute); - } -} diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index ec1fe5f49..ca7f636ec 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -88,17 +88,6 @@ Q_OBJECT virtual bool restoreValueCustom(); - /// 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 - virtual void storeAttributeValue(); - - /// 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 - /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const bool theValid); - /// Computes and updates name of selected object in the widget virtual void updateSelectionName(); @@ -128,18 +117,6 @@ Q_OBJECT /// List of accepting shapes types QStringList myShapeTypes; - - /// backup parameters of the model attribute. The class processes three types of attribute: - /// Reference, RefAttr and Selection. Depending on the attribute type, only the attribute parameter - /// values are reserved in the backup - /// An attribute object - ObjectPtr myObject; - /// An attribute shape - GeomShapePtr myShape; - /// A reference of the attribute - AttributePtr myRefAttribute; - /// A boolean value whether refAttr uses reference of object - bool myIsObject; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index a5a639132..fd41a85f5 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -26,12 +27,14 @@ ModuleBase_WidgetValidated::ModuleBase_WidgetValidated(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData) : ModuleBase_ModelWidget(theParent, theData), - myWorkshop(theWorkshop), myIsInValidate(false) + myWorkshop(theWorkshop) { + myAttributeStore = new ModuleBase_WidgetSelectorStore(); } ModuleBase_WidgetValidated::~ModuleBase_WidgetValidated() { + delete myAttributeStore; } //******************************************************************** @@ -54,12 +57,21 @@ void ModuleBase_WidgetValidated::clearValidatedCash() void ModuleBase_WidgetValidated::storeAttributeValue() { myIsInValidate = true; + DataPtr aData = myFeature->data(); + AttributePtr anAttribute = myFeature->attribute(attributeID()); + + myAttributeStore->storeAttributeValue(anAttribute, myWorkshop); } //******************************************************************** void ModuleBase_WidgetValidated::restoreAttributeValue(const bool theValid) { myIsInValidate = false; + + DataPtr aData = myFeature->data(); + AttributePtr anAttribute = myFeature->attribute(attributeID()); + + myAttributeStore->restoreAttributeValue(anAttribute, myWorkshop); } //******************************************************************** diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index 0d31b0add..5f8aae3b7 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -22,6 +22,7 @@ class QWidget; class ModuleBase_IWorkshop; class ModuleBase_ISelection; +class ModuleBase_WidgetSelectorStore; class ModelAPI_Validator; class Config_WidgetAPI; class Handle_SelectMgr_EntityOwner; @@ -137,6 +138,9 @@ private: ObjectPtr myPresentedObject; /// back up of the filtered object QList myValidPrs; /// cash of valid selection presentations QList myInvalidPrs; /// cash of invalid selection presentations + + /// store to backup parameters of the model + ModuleBase_WidgetSelectorStore* myAttributeStore; }; #endif /* MODULEBASE_WIDGETVALIDATED_H_ */ diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index 2f94057a7..a69a78992 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.h +++ b/src/PartSet/PartSet_WidgetMultiSelector.h @@ -55,7 +55,7 @@ protected: /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theValid a boolean flag, if restore happens for valid parameters - void restoreAttributeValue(const bool theValid); + virtual void restoreAttributeValue(const bool theValid); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection -- 2.30.2