X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_FeatureValidator.cpp;h=b3b1b821687f13ebdadaed93bc9ed4772fde4f02;hb=6268ce56824c1df106da799af34f4575f247061a;hp=6e609dd5d706cfcb0a6c76729b8a9126f646ae76;hpb=35a88fdd724349275bbff32b9596a44e7cd422e2;p=modules%2Fshaper.git diff --git a/src/Model/Model_FeatureValidator.cpp b/src/Model/Model_FeatureValidator.cpp index 6e609dd5d..b3b1b8216 100644 --- a/src/Model/Model_FeatureValidator.cpp +++ b/src/Model/Model_FeatureValidator.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Model_FeatureValidator.cpp // Created: 8 Jul 2014 // Author: Vitaly SMETANNIKOV @@ -15,8 +17,10 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr& th const std::list& theArguments) const { std::shared_ptr aData = theFeature->data(); - if (!aData) - return false; + // "Action" features has no data, but still valid. e.g "Remove Part" + if (!aData) { + return theFeature->isAction(); + } if (!aData->isValid()) return false; const std::string kAllTypes = ""; @@ -24,10 +28,10 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr& th std::list::iterator it = aLtAttributes.begin(); for (; it != aLtAttributes.end(); it++) { AttributePtr anAttr = aData->attribute(*it); - if (!anAttr->isInitialized()) { + if (!anAttr->isInitialized()) { // attribute is not initialized std::map >::const_iterator aFeatureFind = myNotObligatory.find(theFeature->getKind()); - if (aFeatureFind == myNotObligatory.end() || + if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling aFeatureFind->second.find(*it) == aFeatureFind->second.end()) { return false; } @@ -41,3 +45,9 @@ void Model_FeatureValidator::registerNotObligatory(std::string theFeature, std:: std::set& anAttrs = myNotObligatory[theFeature]; anAttrs.insert(theAttribute); } + +bool Model_FeatureValidator::isNotObligatory(std::string theFeature, std::string theAttribute) +{ + std::set& anAttrs = myNotObligatory[theFeature]; + return anAttrs.find(theAttribute) != anAttrs.end(); +}