X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_ValidatorTransform.cpp;h=03a55a611aecd70abc07ba903f0b6ee0a6467245;hb=ea593bc59e7e9461f6c4e2afd3f24d621edb1011;hp=23d0c1b6873431a38401fef41d876ae4283516d8;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp old mode 100755 new mode 100644 index 23d0c1b68..03a55a611 --- a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp @@ -1,4 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include "FeaturesPlugin_ValidatorTransform.h" @@ -7,7 +24,6 @@ #include "ModelAPI_AttributeSelectionList.h" #include "ModelAPI_ResultPart.h" #include "ModelAPI_ResultBody.h" -#include "ModelAPI_ResultCompSolid.h" #include "ModelAPI_Session.h" bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute, @@ -17,9 +33,11 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute bool aValid = true; std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelectionList::typeId()) { +// LCOV_EXCL_START theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; +// LCOV_EXCL_STOP } std::shared_ptr aCurSelList = @@ -33,12 +51,26 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute for(int i = 0; i < aCurSelList->size() && aValid; i++) { std::shared_ptr aSelAttribute = aCurSelList->value(i); ResultPtr aResult = aSelAttribute->context(); + if (!aResult) { + // this could be a whole feature selected + FeaturePtr aFeature = aSelAttribute->contextFeature(); + if (aFeature.get() && aFeature->results().size() > 0) { + if (aFeature->firstResult()->groupName() != ModelAPI_ResultBody::group()) { + anErrorGroupName = aFeature->firstResult()->groupName(); + aValid = false; + break; + } + continue; + } + theError = "Invalid selection."; + return false; + } if (isPartSetDocument) // PartSet document: Result Part is valid aValid = aResult->groupName() == ModelAPI_ResultPart::group(); else { // Part document: Result CompSolid is valid aValid = aResult->groupName() == ModelAPI_ResultBody::group(); if (aValid) { - ResultCompSolidPtr aComp = std::dynamic_pointer_cast(aResult); + ResultBodyPtr aComp = std::dynamic_pointer_cast(aResult); aValid = aComp.get() != NULL; } }