X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomValidators%2FGeomValidators_DifferentShapes.cpp;h=58f6892dfe705d0f5215562c3075abe4f26a2d1f;hb=d5d78920316491975a67f76578982b401cdfe71d;hp=985f7acf061df9d556354343f239a7d42f1bd584;hpb=096c601a5a758d3084c77d6c32d15416efcd473a;p=modules%2Fshaper.git diff --git a/src/GeomValidators/GeomValidators_DifferentShapes.cpp b/src/GeomValidators/GeomValidators_DifferentShapes.cpp index 985f7acf0..58f6892df 100644 --- a/src/GeomValidators/GeomValidators_DifferentShapes.cpp +++ b/src/GeomValidators/GeomValidators_DifferentShapes.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 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 @@ -12,10 +12,9 @@ // // 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "GeomValidators_DifferentShapes.h" @@ -94,11 +93,13 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list std::dynamic_pointer_cast(theCurrentAttribute); GeomShapePtr aShape = aSelectionAttribute->value(); + ResultPtr aResultContext = aSelectionAttribute->context(); if (!aShape.get()) { - ResultPtr aResult = aSelectionAttribute->context(); - if (aResult.get()) - aShape = aResult->shape(); + if (aResultContext.get()) + aShape = aResultContext->shape(); } + // whole feature selection + FeaturePtr aFeature = aSelectionAttribute->contextFeature(); std::string aCurrentAttributeId = theCurrentAttribute->id(); if (theAttributes.size() > 0 && aShape.get() != NULL) { @@ -112,14 +113,31 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list // the shape of the attribute should be not the same if (aSelectionAttribute.get() != NULL) { GeomShapePtr anAttrShape = aSelectionAttribute->value(); + ResultPtr aResult = aSelectionAttribute->context(); if (!anAttrShape.get()) { - ResultPtr aResult = aSelectionAttribute->context(); if (aResult.get()) anAttrShape = aResult->shape(); } if (aShape->isEqual(anAttrShape)) { return false; } + if (aFeature.get()) { + if (aResult.get()) { // check result is in feature + if (aResult->document()->feature(aResult) == aFeature) + return false; + } + else { // check selection of the same features + if (aFeature == aSelectionAttribute->contextFeature()) + return false; + } + } + else { + if (!aResult.get() && aResultContext.get()) { + FeaturePtr aSelectedFeature = aSelectionAttribute->contextFeature(); + if (aResultContext->document()->feature(aResultContext) == aSelectedFeature) + return false; + } + } } } } @@ -152,5 +170,7 @@ bool GeomValidators_DifferentShapes::isAttrShapesEqual(const AttributePtr& theAt } GeomShapePtr aOtherTypedShape = GeomAPI_Tools::getTypedShape(anOtherShape); + if (!aTypedShape.get()) + return !aTypedShape.get() && !aOtherTypedShape.get(); return aTypedShape->isEqual(aOtherTypedShape); -} \ No newline at end of file +}