From: mpv Date: Thu, 20 Jul 2017 12:07:53 +0000 (+0300) Subject: Issue #2219: keep the order of remove-shape sub-elements after deselection of some... X-Git-Tag: V_2.7.2RC~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9534ef9781101608348101a8dcc3dd8713405a53;p=modules%2Fshaper.git Issue #2219: keep the order of remove-shape sub-elements after deselection of some of them. --- diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index e091a6e9e..5207a1120 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -237,7 +237,7 @@ bool Model_AttributeSelectionList::isInList(const ResultPtr& theContext, std::list >::iterator aShapes = aContext->second.begin(); for(; aShapes != aContext->second.end(); aShapes++) { if (!theSubShape.get()) { - if (!aShapes->get()) + if (!aShapes->get() || (*aShapes)->isSame(aContext->first->shape())) return true; } else { // we need to call here isSame instead of isEqual to do not check shapes orientation @@ -254,13 +254,13 @@ bool Model_AttributeSelectionList::isInList(const ResultPtr& theContext, if (anAttr.get()) { if (anAttr->context() == theContext) { // contexts are equal, so, check that values are also std::shared_ptr aValue = anAttr->value(); - if (!aValue.get()) { - if (!theSubShape.get()) { // both are null + if (!theSubShape.get()) { + if (!aValue.get() || aValue->isSame(theContext->shape())) { // both are null return true; } } else { // we need to call here isSame instead of isEqual to do not check shapes orientation - if (aValue->isSame(theSubShape)) // shapes are equal + if (theSubShape->isSame(aValue)) // shapes are equal return true; } } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 2d0a1225c..1c5153c06 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -825,11 +825,16 @@ std::map > ModuleBase_WidgetMultiSelector::con } bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject, - const GeomShapePtr& theShape, + GeomShapePtr theShape, const std::map >& theGeomSelection) { bool aFound = false; GeomShapePtr anEmptyShape(new GeomAPI_Shape()); + if (theShape.get()) { // treat shape equal to context as null: 2219, keep order of shapes in list + const ResultPtr aContext = std::dynamic_pointer_cast(theObject); + if (aContext.get() && aContext->shape()->isEqual(theShape)) + theShape.reset(); + } GeomShapePtr aShape = theShape.get() ? theShape : anEmptyShape; if (theGeomSelection.find(theObject) != theGeomSelection.end()) {// found const std::set& aShapes = theGeomSelection.at(theObject); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 1716cc307..2fecf4ed4 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -186,7 +186,7 @@ protected: /// \param theGeomSelection a map built on selection /// \return boolean result static bool findInSelection(const ObjectPtr& theObject, - const GeomShapePtr& theShape, + GeomShapePtr theShape, const std::map >& theGeomSelection); protected: