From: vsv Date: Thu, 26 May 2016 08:02:07 +0000 (+0300) Subject: Issue #1510: Sort group names according to deletion order X-Git-Tag: V_2.3.1~57 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e74578c9716318b726a0b4c0c9adcf252d44be6d;p=modules%2Fshaper.git Issue #1510: Sort group names according to deletion order --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 3fa9d63a5..d1ccd46ff 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -159,8 +159,21 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); DocumentPtr aDoc = aUpdMsg->document(); - std::set aGroups = aUpdMsg->groups(); - std::set::const_iterator aIt; + std::set aMsgGroups = aUpdMsg->groups(); + + /// Sort groups because RootType deletion has to be done after others + std::string aType = (aDoc == aRootDoc)? aRootType : aSubType; + std::list aGroups; + std::set::const_iterator aSetIt; + for (aSetIt = aMsgGroups.begin(); aSetIt != aMsgGroups.end(); ++aSetIt) { + std::string aGroup = (*aSetIt); + if (aGroup == aType) + aGroups.push_back(aGroup); + else + aGroups.push_front(aGroup); + } + + std::list::const_iterator aIt; for (aIt = aGroups.begin(); aIt != aGroups.end(); ++aIt) { std::string aGroup = (*aIt); if (aDoc == aRootDoc) { // If root objects