From ca03465754f3815ede43f8686305fe39b6703a9c Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 5 Apr 2016 12:26:01 +0300 Subject: [PATCH] Issue #1343. Improvement of Extrusion and Revolution operations: sketch creator setSelection in two ways(Sketch or Selection list), so the validators should be checked in the same manner, in two ways(call validator for Sektch after(if invalid) validator for Selection list). --- src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 4 +- .../FeaturesPlugin_Validators.cpp | 26 +++++++++ .../FeaturesPlugin_Validators.h | 15 ++++++ src/FeaturesPlugin/extrusion_widget.xml | 3 +- src/ModuleBase/ModuleBase_WidgetSelector.cpp | 2 +- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 53 +++++++++++-------- src/ModuleBase/ModuleBase_WidgetValidated.h | 35 ++++++++---- src/PartSet/PartSet_WidgetMultiSelector.cpp | 5 +- src/PartSet/PartSet_WidgetMultiSelector.h | 2 +- src/PartSet/PartSet_WidgetShapeSelector.cpp | 5 +- src/PartSet/PartSet_WidgetShapeSelector.h | 2 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 34 ++++++++++-- src/PartSet/PartSet_WidgetSketchCreator.h | 14 ++++- src/PartSet/PartSet_WidgetSketchLabel.cpp | 14 ++--- src/PartSet/PartSet_WidgetSketchLabel.h | 10 ++-- 15 files changed, 169 insertions(+), 55 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index 1de58f332..b5f0d6944 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -36,8 +36,10 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); aFactory->registerValidator("FeaturesPlugin_ValidatorTransform", new FeaturesPlugin_ValidatorTransform); - aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher", + aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncherE", new FeaturesPlugin_ValidatorCompositeLauncher); + aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher", + new FeaturesPlugin_ValidatorCompositeLauncher_); aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration", new FeaturesPlugin_ValidatorBaseForGeneration); aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations", diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 0c0e893ba..1470d0353 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -10,7 +10,9 @@ #include #include #include +#include +#include #include //================================================================================================= @@ -174,6 +176,30 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theAttribute, const std::list& theArguments, std::string& theError) const +{ + if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { + theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + return false; + } + + bool aValid = true; + GeomValidators_FeatureKind* aValidator = new GeomValidators_FeatureKind(); + // check whether the selection is on the sketch + bool aFeatureKindValid = aValidator->isValid(theAttribute, theArguments, theError); + if (!aFeatureKindValid) { + // check if selection has Face selected + GeomValidators_ShapeType* aShapeType = new GeomValidators_ShapeType(); + std::list anArguments; + anArguments.push_back("face"); + aValid = aShapeType->isValid(theAttribute, anArguments, theError); + } + return aValid; +} + +//================================================================================================= +bool FeaturesPlugin_ValidatorCompositeLauncher_::isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const { FeaturesPlugin_ValidatorBaseForGeneration aBaseValidator; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index e02b2ee63..87bd3228d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -64,6 +64,21 @@ public: std::string& theError) const; }; +/// \class FeaturesPlugin_ValidatorCompositeLauncher +/// \ingroup Validators +/// \brief A validator for selection at composite feature start +class FeaturesPlugin_ValidatorCompositeLauncher_: public ModelAPI_AttributeValidator +{ +public: + //! Returns true if attribute has selection type listed in the parameter arguments. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; +}; + /// \class FeaturesPlugin_ValidatorCanBeEmpty /// \ingroup Validators /// \brief A validator for extrusion direction attribute and bounding planes for extrusion and diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index ccf8af3af..350cac022 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -8,12 +8,13 @@ 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices.Extrusion will be filled by it." shape_types="faces objects"> + - + storeAttributeValue(attributeToValidate(), myWorkshop); + myAttributeStore->storeAttributeValue(theAttribute, myWorkshop); } //******************************************************************** -void ModuleBase_WidgetValidated::restoreAttributeValue(const bool theValid) +void ModuleBase_WidgetValidated::restoreAttributeValue(const AttributePtr& theAttribute, + const bool theValid) { myIsInValidate = false; - myAttributeStore->restoreAttributeValue(attributeToValidate(), myWorkshop); + myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop); } //******************************************************************** @@ -118,7 +119,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrs& th } //******************************************************************** -AttributePtr ModuleBase_WidgetValidated::attributeToValidate() const +AttributePtr ModuleBase_WidgetValidated::attribute() const { return myFeature->attribute(attributeID()); } @@ -130,30 +131,37 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& th if (getValidState(theValue, aValid)) { return aValid; } - aValid = isValidSelectionCustom(theValue); - if (!aValid) { - storeValidState(theValue, aValid); - return aValid; - } + if (aValid) + aValid = isValidSelectionForAttribute(theValue, attribute()); + + storeValidState(theValue, aValid); + return aValid; +} + +//******************************************************************** +bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_ViewerPrs& theValue, + const AttributePtr& theAttribute) +{ + bool aValid = false; // stores the current values of the widget attribute bool isFlushesActived, isAttributeSetInitializedBlocked; - blockAttribute(true, isFlushesActived, isAttributeSetInitializedBlocked); + blockAttribute(theAttribute, true, isFlushesActived, isAttributeSetInitializedBlocked); - storeAttributeValue(); + storeAttributeValue(theAttribute); // saves the owner value to the widget attribute aValid = setSelectionCustom(theValue); if (aValid) // checks the attribute validity - aValid = isValidAttribute(); + aValid = isValidAttribute(theAttribute); // restores the current values of the widget attribute - restoreAttributeValue(aValid); + restoreAttributeValue(theAttribute, aValid); - blockAttribute(false, isFlushesActived, isAttributeSetInitializedBlocked); + blockAttribute(theAttribute, false, isFlushesActived, isAttributeSetInitializedBlocked); // In particular case the results are deleted and called as redisplayed inside of this // highlight-selection, to they must be flushed as soon as possible. // Example: selection of group-vertices subshapes with shift pressend on body. Without @@ -164,7 +172,6 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& th Events_Loop::loop()->flush(aDeletedEvent); Events_Loop::loop()->flush(aRedispEvent); - storeValidState(theValue, aValid); return aValid; } @@ -175,13 +182,12 @@ bool ModuleBase_WidgetValidated::isValidSelectionCustom(const ModuleBase_ViewerP } //******************************************************************** -bool ModuleBase_WidgetValidated::isValidAttribute() const +bool ModuleBase_WidgetValidated::isValidAttribute(const AttributePtr& theAttribute) const { SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - AttributePtr anAttribute = attributeToValidate(); std::string aValidatorID, anError; - return aFactory->validate(anAttribute, aValidatorID, anError); + return aFactory->validate(theAttribute, aValidatorID, anError); } bool ModuleBase_WidgetValidated::isFilterActivated() const @@ -212,23 +218,24 @@ bool ModuleBase_WidgetValidated::activateFilters(const bool toActivate) } //******************************************************************** -void ModuleBase_WidgetValidated::blockAttribute(const bool& theToBlock, bool& isFlushesActived, +void ModuleBase_WidgetValidated::blockAttribute(const AttributePtr& theAttribute, + const bool& theToBlock, + bool& isFlushesActived, bool& isAttributeSetInitializedBlocked) { Events_Loop* aLoop = Events_Loop::loop(); DataPtr aData = myFeature->data(); - AttributePtr anAttribute = attributeToValidate(); if (theToBlock) { // blocks the flush signals to avoid the temporary objects visualization in the viewer // they should not be shown in order to do not lose highlight by erasing them isFlushesActived = aLoop->activateFlushes(false); aData->blockSendAttributeUpdated(true); - isAttributeSetInitializedBlocked = anAttribute->blockSetInitialized(true); + isAttributeSetInitializedBlocked = theAttribute->blockSetInitialized(true); } else { aData->blockSendAttributeUpdated(false); - anAttribute->blockSetInitialized(isAttributeSetInitializedBlocked); + theAttribute->blockSetInitialized(isAttributeSetInitializedBlocked); aLoop->activateFlushes(isFlushesActived); } } diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index ef503aacc..32f47d34e 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -45,10 +45,13 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg const Config_WidgetAPI* theData); virtual ~ModuleBase_WidgetValidated(); - /// Checks all widget validator if the owner is valid + /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, + /// next, the attribute's validating. It trying on the give selection to current attribute by + /// setting the value inside and calling validators. After this, the previous attribute value is + /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - bool isValidSelection(const ModuleBase_ViewerPrs& theValue); + virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue); //! Returns data object by AIS ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; @@ -62,21 +65,31 @@ protected: /// \return a boolean value bool isValidInFilters(const ModuleBase_ViewerPrs& thePrs); + /// Checks all attribute validators returns valid. It tries on the given selection + /// to current attribute by setting the value inside and calling validators. After this, + /// the previous attribute value is restored.The valid/invalid value is cashed. + /// \param theValue a selected presentation in the view + /// \return a boolean value + bool isValidSelectionForAttribute(const ModuleBase_ViewerPrs& theValue, + const AttributePtr& theAttribute); + /// Retunrs attribute, which should be validated. In default implementation, /// this is an attribute of ID /// \return an attribute - virtual AttributePtr attributeToValidate() const; + virtual AttributePtr attribute() 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 - virtual void storeAttributeValue(); + /// \param theAttribute an attribute to be stored + virtual void storeAttributeValue(const AttributePtr& theAttribute); /// 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 theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const bool theValid); + virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view @@ -98,23 +111,26 @@ protected: bool activateFilters(const bool toActivate); /// Block the model flush of update and intialization of attribute + /// \param theAttribute an attribute of blocking /// \param theToBlock flag whether the model is blocked or unblocked /// \param isActive out value if model is blocked, in value if model is unblocked /// to be used to restore flush state when unblocked /// \param isAttributeSetInitializedBlocked out value if model is blocked /// in value if model is unblocked to be used to restore previous state when unblocked - virtual void blockAttribute(const bool& theToBlock, bool& isFlushesActived, - bool& isAttributeSetInitializedBlocked); + virtual void blockAttribute(const AttributePtr& theAttribute, const bool& theToBlock, + bool& isFlushesActived, bool& isAttributeSetInitializedBlocked); private: /// Checks the current attibute in all attribute validators - // \return true if all validators return that the attribute is valid - bool isValidAttribute() const; + /// \param theAttribute an attribute to be validated + /// \return true if all validators return that the attribute is valid + bool isValidAttribute(const AttributePtr& theAttribute) const; /// Returns true if the workshop validator filter has been already activated /// \return boolean value bool isFilterActivated() const; +protected: /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored /// \param theValue a viewer presentation /// \param theValid a valid state @@ -125,6 +141,7 @@ private: /// \param theValid a valid state void storeValidState(const ModuleBase_ViewerPrs& theValue, const bool theValid); +private: /// Applies AIS context filters to the parameter list. The not approved presentations are /// removed from the parameters. /// \param theValues a list of presentations. diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index bfa7a8d30..380c7da3b 100755 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -54,9 +54,10 @@ bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_Viewer } //******************************************************************** -void PartSet_WidgetMultiSelector::restoreAttributeValue(const bool theValid) +void PartSet_WidgetMultiSelector::restoreAttributeValue(const AttributePtr& theAttribute, + const bool theValid) { - ModuleBase_WidgetMultiSelector::restoreAttributeValue(theValid); + ModuleBase_WidgetMultiSelector::restoreAttributeValue(theAttribute, theValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); } diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index a69a78992..150f4c6fd 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 - virtual void restoreAttributeValue(const bool theValid); + virtual void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 84d5644b5..499951c4a 100755 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -89,9 +89,10 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrs& t } //******************************************************************** -void PartSet_WidgetShapeSelector::restoreAttributeValue(const bool theValid) +void PartSet_WidgetShapeSelector::restoreAttributeValue(const AttributePtr& theAttribute, + const bool theValid) { - ModuleBase_WidgetShapeSelector::restoreAttributeValue(theValid); + ModuleBase_WidgetShapeSelector::restoreAttributeValue(theAttribute, theValid); myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); } diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index ddbc8ba43..cb5a425ad 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -63,7 +63,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); + void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid); protected: /// A reference to external objects manager diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 1379e1cdc..c6a0ebb08 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -51,7 +51,7 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent, PartSet_Module* theModule, const Config_WidgetAPI* theData) : ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData), - myModule(theModule) + myModule(theModule), myIsCustomAttribute(false) { myAttributeListID = theData->getProperty("attribute_list_id"); @@ -114,9 +114,34 @@ bool PartSet_WidgetSketchCreator::storeValueCustom() const return true; } -AttributePtr PartSet_WidgetSketchCreator::attributeToValidate() const +AttributePtr PartSet_WidgetSketchCreator::attribute() const { - return myFeature->attribute(myAttributeListID); + AttributePtr anAttribute; + if (myIsCustomAttribute) + anAttribute = myFeature->attribute(myAttributeListID); + else + anAttribute = ModuleBase_WidgetSelector::attribute(); + + return anAttribute; +} + +//******************************************************************** +bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrs& theValue) +{ + bool aValid = false; + if (getValidState(theValue, aValid)) { + return aValid; + } + // check selection to create new sketh (XML current attribute) + aValid = isValidSelectionForAttribute(theValue, attribute()); + if (!aValid) { + // check selection to fill list attribute (myAttributeListID) + myIsCustomAttribute = true; + aValid = isValidSelectionForAttribute(theValue, attribute()); + myIsCustomAttribute = false; + } + storeValidState(theValue, aValid); + return aValid; } void PartSet_WidgetSketchCreator::activateSelectionControl() @@ -253,7 +278,7 @@ bool PartSet_WidgetSketchCreator::setSelection(QList& theV { bool aDone = false; if (!startSketchOperation(theValues)) { - ModuleBase_WidgetSelector::setSelection(theValues, theToValidate); + myIsCustomAttribute = true; QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); bool aProcessed = false; for (; anIt != aLast; anIt++) { @@ -261,6 +286,7 @@ bool PartSet_WidgetSketchCreator::setSelection(QList& theV if (!theToValidate || isValidInFilters(aValue)) aProcessed = setSelectionCustom(aValue) || aProcessed; } + myIsCustomAttribute = true; aDone = aProcessed; if (aProcessed) { emit valuesChanged(); diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index d11c92e60..8ccb24b25 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -62,6 +62,14 @@ public: /// Editing mode depends on mode of current operation. This value is defined by it. virtual void setEditingMode(bool isEditing); + /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, + /// next, the attribute's validating. It trying on the give selection to current attribute by + /// setting the value inside and calling validators. After this, the previous attribute value is + /// restored.The valid/invalid value is cashed. + /// \param theValue a selected presentation in the view + /// \return a boolean value + virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue); + /// Check if the current and the parent operations are a composite. If the parent operation contains /// attribute selection list, the method returns false if it is invalid in this attibute validator /// \param theWorkshop a current workshop @@ -78,7 +86,7 @@ protected: /// Retunrs attribute, which should be validated. In default implementation, /// this is an attribute of ID /// \return an attribute - virtual AttributePtr attributeToValidate() const; + virtual AttributePtr attribute() const; /// Sets the selection control visible and set the current widget as active in property panel /// It leads to connect to onSelectionChanged slot @@ -120,6 +128,10 @@ private: PartSet_Module* myModule; + /// Flag if the attribute() should return the attribute list ID or XML attribute + /// to store selection and check validation + bool myIsCustomAttribute; + /// Label of the widget QLabel* myLabel; diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 6f746483e..50d0308ec 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -187,10 +187,11 @@ void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) emit showConstraintToggled(aState, theOn); } -void PartSet_WidgetSketchLabel::blockAttribute(const bool& theToBlock, bool& isFlushesActived, +void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute, + const bool& theToBlock, bool& isFlushesActived, bool& isAttributeSetInitializedBlocked) { - ModuleBase_WidgetValidated::blockAttribute(theToBlock, isFlushesActived, + ModuleBase_WidgetValidated::blockAttribute(theAttribute, theToBlock, isFlushesActived, isAttributeSetInitializedBlocked); // We do not restore the previous state of isAttributeSetInitializedBlocked for each of // attributes. It it is necessary, these states should be append to the method attributes @@ -318,14 +319,15 @@ void PartSet_WidgetSketchLabel::enableFocusProcessing() myStackWidget->installEventFilter(this); } -void PartSet_WidgetSketchLabel::storeAttributeValue() +void PartSet_WidgetSketchLabel::storeAttributeValue(const AttributePtr& theAttribute) { - ModuleBase_WidgetValidated::storeAttributeValue(); + ModuleBase_WidgetValidated::storeAttributeValue(theAttribute); } -void PartSet_WidgetSketchLabel::restoreAttributeValue(const bool theValid) +void PartSet_WidgetSketchLabel::restoreAttributeValue(const AttributePtr& theAttribute, + const bool theValid) { - ModuleBase_WidgetValidated::restoreAttributeValue(theValid); + ModuleBase_WidgetValidated::restoreAttributeValue(theAttribute, theValid); // it is not necessary to save the previous plane value because the plane is chosen once DataPtr aData = feature()->data(); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index 4e8ccd1b1..e962135ef 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -91,13 +91,16 @@ protected: /// 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(); + /// \param theAttribute an attribute to be stored + virtual void storeAttributeValue(const AttributePtr& theAttribute); /// 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 theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const bool theValid); + virtual void restoreAttributeValue(const AttributePtr& theAttribute, + const bool theValid); /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner @@ -126,7 +129,8 @@ protected: /// to be used to restore flush state when unblocked /// \param isAttributeSetInitializedBlocked out value if model is blocked /// in value if model is unblocked to be used to restore previous state when unblocked - virtual void blockAttribute(const bool& theToBlock, bool& isFlushesActived, + virtual void blockAttribute(const AttributePtr& theAttribute, const bool& theToBlock, + bool& isFlushesActived, bool& isAttributeSetInitializedBlocked); /// Set the given wrapped value to the current widget -- 2.39.2