From 05f2946d10abc949bdcd879b77db79f6cc930612 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 27 Feb 2015 17:47:10 +0300 Subject: [PATCH] Debug of the case-validation --- src/Config/Config_FeatureReader.cpp | 4 ++-- src/ConstructionPlugin/axis_widget.xml | 2 +- src/Model/Model_Update.cpp | 6 ++++-- src/Model/Model_Validator.h | 1 - src/ModelAPI/ModelAPI_Validator.h | 4 ++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 05091fb2f..dea07dfc7 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -85,7 +85,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode) Events_Loop::loop()->send(aMessage); } // container pages, like "case" or "box" - } else if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) { + } else if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) { storeAttribute(theNode, _ID); // save case:caseId (or box:boxId) } } @@ -95,7 +95,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode) void Config_FeatureReader::cleanup(xmlNodePtr theNode) { - if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) { + if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) { // cleanup id of cases when leave case node cleanupAttribute(theNode, _ID); } diff --git a/src/ConstructionPlugin/axis_widget.xml b/src/ConstructionPlugin/axis_widget.xml index 5b5540166..7173f114c 100644 --- a/src/ConstructionPlugin/axis_widget.xml +++ b/src/ConstructionPlugin/axis_widget.xml @@ -20,7 +20,7 @@ - aSel = std::dynamic_pointer_cast(*aRefsIter); if (!aSel->update()) { // this must be done on execution since it may be long operation - if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel))) + if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)) && + aFactory->isCase(theFeature, theFeature->data()->id(aSel))) aState = ModelAPI_StateInvalidArgument; } } @@ -270,7 +271,8 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) if (aSelAttr) { if (!aSelAttr->update()) { if (!aFactory->isNotObligatory( - theFeature->getKind(), theFeature->data()->id(aSel))) + theFeature->getKind(), theFeature->data()->id(aSel)) && + aFactory->isCase(theFeature, theFeature->data()->id(aSel))) aState = ModelAPI_StateInvalidArgument; } } diff --git a/src/Model/Model_Validator.h b/src/Model/Model_Validator.h index b3324c458..0bd242ad2 100644 --- a/src/Model/Model_Validator.h +++ b/src/Model/Model_Validator.h @@ -9,7 +9,6 @@ #include #include -#include #include #include diff --git a/src/ModelAPI/ModelAPI_Validator.h b/src/ModelAPI/ModelAPI_Validator.h index 42662b10d..926ae886c 100644 --- a/src/ModelAPI/ModelAPI_Validator.h +++ b/src/ModelAPI/ModelAPI_Validator.h @@ -8,6 +8,7 @@ #define ModelAPI_Validator_H_ #include +#include #include #include @@ -99,6 +100,9 @@ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory virtual void registerCase(std::string theFeature, std::string theAttribute, std::string theSwitchId, std::string theCaseId) = 0; + /// Returns true if the attribute must be checked (the case is selected) + virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0; + protected: /// Get instance from Session ModelAPI_ValidatorsFactory() -- 2.39.2