// STL includes
#include <vector>
#include <algorithm>
+#include <set>
using namespace std;
myTypeGroup->setButton(0);
updateButtons();
+ //myName->setText(GetDefaultName(tr("SMESH_GROUP")));
}
//=================================================================================
}
}
+//=================================================================================
+// function : GetDefaultName()
+// purpose : Get the Group Name if Create new Group
+//=================================================================================
+QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
+{
+ QString aName = "";
+
+ // collect all object names of SMESH component
+ SalomeApp_Study* appStudy =
+ dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if ( !appStudy ) return aName;
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ std::set<std::string> aSet;
+ _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH"));
+ if (aMeshCompo) {
+ _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo));
+ _PTR(SObject) obj;
+ for (it->InitEx(true); it->More(); it->Next()) {
+ obj = it->Value();
+ aSet.insert(obj->GetName());
+ }
+ }
+
+ // build a unique name
+ int aNumber = 0;
+ bool isUnique = false;
+ while (!isUnique) {
+ aName = theOperation + "_" + QString::number(++aNumber);
+ isUnique = (aSet.count(aName.latin1()) == 0);
+ }
+
+ return aName;
+}
+
+
//=================================================================================
// function : Init()
// purpose :
myName->setText(theGroup->GetName());
myName->home(false);
+ myOldName = myName->text();
myColorSpinBox->setValue( theGroup->GetColorNumber() );
aShapeName = aGroupShapeSO->GetName().c_str();
}
myGeomGroupLine->setText( aShapeName );
+ myName->setText("Group On " + aShapeName);
+ cout << aShapeName << endl;
}
}
}
{
if (myGrpTypeId != id) {
myWGStack->raiseWidget( id );
+ if (id == 0)
+ myName->setText(myOldName);
onSelectGeomGroup(id == 1);
}
myGrpTypeId = id;
}
myCurrentLineEdit->setText(aString);
+ myOldName = myName->text();
+ myName->setText(aString);
myCurrentLineEdit->home(false);
updateButtons();