-// 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
//
// 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<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Selector_Container.h>
// restore sub-selectors
bool aSubResult = true;
for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
- Selector_Algo* aSubSel = restoreByLab(aSub.Value());
+ Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
if (!append(aSubSel, false)) {
break; // some empty label left in the end
}
for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
size_t anEndPos = theName.find(']', aStart + 1);
if (anEndPos != std::string::npos) {
+ // there could be sub-intersections, so, [[...]] case; searching for other open-bracket
+ size_t aNextStart = theName.find('[', aStart + 1);
+ while(aNextStart != std::string::npos && aNextStart < anEndPos) {
+ anEndPos = theName.find(']', anEndPos + 1);
+ if (anEndPos == std::string::npos) {
+ return TDF_Label(); // invalid parentheses
+ }
+ aNextStart = theName.find('[', aNextStart + 1);
+ }
+ if (anEndPos == std::string::npos)
+ return TDF_Label(); // invalid parentheses
std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
switch (myShapeType) {
}
TDF_Label aSubContext;
Selector_Algo* aSubSel =
- Selector_Algo::restoreByName(
- label(), baseDocument(), aSubStr, aSubShapeType, theNameGenerator, aSubContext);
+ Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType,
+ geometricalNaming(), theNameGenerator, aSubContext);
if (!append(aSubSel))
return TDF_Label();
}
} else
return TDF_Label(); // invalid parentheses
+ aStart = anEndPos; // for recursive parenthesis set start on the current end
}
return aContext;
}