std::list<std::shared_ptr<GeomAPI_Shape> >::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
if (anAttr.get()) {
if (anAttr->context() == theContext) { // contexts are equal, so, check that values are also
std::shared_ptr<GeomAPI_Shape> 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;
}
}
}
bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject,
- const GeomShapePtr& theShape,
+ GeomShapePtr theShape,
const std::map<ObjectPtr, std::set<GeomShapePtr> >& 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<ModelAPI_Result>(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<GeomShapePtr>& aShapes = theGeomSelection.at(theObject);
/// \param theGeomSelection a map built on selection
/// \return boolean result
static bool findInSelection(const ObjectPtr& theObject,
- const GeomShapePtr& theShape,
+ GeomShapePtr theShape,
const std::map<ObjectPtr, std::set<GeomShapePtr> >& theGeomSelection);
protected: