-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 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
myContext = theContextLab;
// searching by neighbors
std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
- for(int aLevel = 1; true; aLevel++) {
+ // # 19071 : moving through all levels may be too long, in practice there are no more than 2 or 3
+ // levels real cases, so, make it "5" as maximum possible
+ for(int aLevel = 1; aLevel < 5; aLevel++) {
TopTools_MapOfShape aNewNB;
findNeighbors(theContext, theValue, aLevel, aNewNB);
if (aNewNB.Extent() == 0) { // there are no neighbors of the given level, stop iteration
myNBLevel.push_back(anArray->Value(anIndex));
}
// restore sub-selectors
- bool aSubResult = true;
for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
if (!append(aSubSel, false)) {
// some selector fails, try to use rest selectors, myNBLevel becomes negative: unused
if (myNBLevel.size() > list().size()) {
std::list<int>::iterator aListIter = myNBLevel.begin();
- for(int a = 0; a < list().size(); a++)
+ for(size_t a = 0; a < list().size(); a++)
aListIter++;
*aListIter = -*aListIter;
list().push_back(NULL);
myShapeType = theShapeType;
TDF_Label aContext;
std::wstring aLastLevel; // last level string (after '(' ) to check the context name 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) {
+ for (size_t aStart = 0; aStart != std::wstring::npos;
+ aStart = theName.find(L'(', aStart + 1)) {
+ size_t anEndPos = theName.find(L')', aStart + 1);
+ if (anEndPos != std::wstring::npos) {
std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
TDF_Label aSubContext;
Selector_Algo* aSubSel =
// searching for the level index
std::wstring aLevel;
- for (anEndPos++; anEndPos != std::string::npos &&
- theName[anEndPos] != '(' && theName[anEndPos] != 0;
+ for (anEndPos++; anEndPos != std::wstring::npos &&
+ theName[anEndPos] != L'(' && theName[anEndPos] != 0;
anEndPos++) {
aLevel += theName[anEndPos];
}
aLastLevel = aLevel;
- if (aLevel.empty() || aLevel[0] == '_')
+ if (aLevel.empty() || aLevel[0] == L'_')
myNBLevel.push_back(1); // by default it is 1
else {
int aNum = std::stoi(aLevel.c_str());
}
if (!aLastLevel.empty()) { // get the context
size_t aLinePos = aLastLevel.find(L"_");
- if (aLinePos != std::string::npos) {
+ if (aLinePos != std::wstring::npos) {
std::wstring aContextName = aLastLevel.substr(aLinePos + 1);
if (!aContextName.empty()) {
TDF_Label aThisContext, aValue;