From: dbv Date: Fri, 25 Dec 2015 09:17:51 +0000 (+0300) Subject: Bug #1179: rotation after translation is wrong X-Git-Tag: V_2.1.0~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a628ff915ace4164081af3576805d418bcd7c983;p=modules%2Fshaper.git Bug #1179: rotation after translation is wrong --- diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 3e99827d8..b44a26517 100755 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -213,18 +213,24 @@ AISObjectPtr SketchPlugin_MultiRotation::getAISObject(AISObjectPtr thePrevious) void SketchPlugin_MultiRotation::erase() { + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + // Set copy attribute to false on all copied features. + AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); AttributeRefListPtr aRefListOfRotated = std::dynamic_pointer_cast( data()->attribute(SketchPlugin_Constraint::ENTITY_B())); - if(aRefListOfRotated.get()) { - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - - std::list aTargetList = aRefListOfRotated->list(); - for(std::list::const_iterator aTargetIt = aTargetList.cbegin(); aTargetIt != aTargetList.cend(); aTargetIt++) { - if((*aTargetIt).get()) { - ResultPtr aRes = std::dynamic_pointer_cast(*aTargetIt); + if(aRefListOfShapes.get() && aRefListOfRotated.get()) { + for(int anIndex = 0; anIndex < aRefListOfRotated->size(); anIndex++) { + ObjectPtr anObject = aRefListOfRotated->object(anIndex); + if(aRefListOfShapes->isInList(anObject)) { + // Don't modify attribute of original features, just skip. + continue; + } + if(anObject.get()) { + ResultPtr aRes = std::dynamic_pointer_cast(anObject); if(aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); if(aFeature.get()) { diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp index 95cf7d50e..0b43bf38a 100755 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp @@ -200,18 +200,24 @@ AISObjectPtr SketchPlugin_MultiTranslation::getAISObject(AISObjectPtr thePreviou void SketchPlugin_MultiTranslation::erase() { + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + // Set copy attribute to false on all copied features. + AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( + data()->attribute(SketchPlugin_Constraint::ENTITY_A())); AttributeRefListPtr aRefListOfTranslated = std::dynamic_pointer_cast( data()->attribute(SketchPlugin_Constraint::ENTITY_B())); - if(aRefListOfTranslated.get()) { - static Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - - std::list aTargetList = aRefListOfTranslated->list(); - for(std::list::const_iterator aTargetIt = aTargetList.cbegin(); aTargetIt != aTargetList.cend(); aTargetIt++) { - if((*aTargetIt).get()) { - ResultPtr aRes = std::dynamic_pointer_cast(*aTargetIt); + if(aRefListOfShapes.get() && aRefListOfTranslated.get()) { + for(int anIndex = 0; anIndex < aRefListOfTranslated->size(); anIndex++) { + ObjectPtr anObject = aRefListOfTranslated->object(anIndex); + if(aRefListOfShapes->isInList(anObject)) { + // Don't modify attribute of original features, just skip. + continue; + } + if(anObject.get()) { + ResultPtr aRes = std::dynamic_pointer_cast(anObject); if(aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); if(aFeature.get()) {