+
+//=================================================================================
+// function : restoreSubShapes
+// purpose : virtual method to restore tree of argument's sub-shapes under
+// the resulting shape. Redefined from GEOMBase_Helper class.
+//=================================================================================
+void GenerationGUI_PipeDlg::restoreSubShapes
+ (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject)
+{
+ QCheckBox *aGenGroupCheck = NULL;
+ QLineEdit *aPrefixEdit = NULL;
+
+ switch (getConstructorId()) {
+ case 0 :
+ case 1 :
+ aGenGroupCheck = myGenGroupCheckGP;
+ aPrefixEdit = myPrefixEditGP;
+ break;
+ case 2 :
+ aGenGroupCheck = myGenGroupCheckGMP;
+ aPrefixEdit = myPrefixEditGMP;
+ break;
+ default:
+ break;
+ }
+
+ if (aGenGroupCheck == NULL || !aGenGroupCheck->isChecked()) {
+ return;
+ }
+
+ // get Object from SObject
+ GEOM::GEOM_Object_var aFather = GEOM::GEOM_Object::_narrow
+ (theSObject->GetObject());
+
+ if (CORBA::is_nil(aFather)) {
+ return;
+ }
+
+ ObjectMap::const_iterator anIter =
+ myGroupObjectsMap.find(aFather->GetEntry());
+ QString aPrefix = aPrefixEdit->text();
+ bool hasPrefix = !aPrefix.isEmpty();
+
+ if (anIter != myGroupObjectsMap.end()) {
+ QList<GEOM::GeomObjPtr>::const_iterator it = anIter->second.begin();
+
+ for (; it != anIter->second.end(); it++) {
+ // Compose the name
+ QString aName;
+
+ if (hasPrefix) {
+ aName = aPrefix + "_";
+ }
+
+ aName += tr((*it)->GetName());
+ getGeomEngine()->AddInStudy(theStudy, (*it).get(),
+ aName.toStdString().c_str(), aFather);
+ }
+ }
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> GenerationGUI_PipeDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myBaseObjects);
+ res << myPath << myVec;
+ for (int i = 0; i < myLocations.count(); i++)
+ res << myLocations[i];
+ return res;
+}
+
+//=================================================================================
+// function : GenGroupClicked
+// purpose : Slot to treat checking "Generate groups" check box.
+//=================================================================================
+void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked)
+{
+ resetGenGroup((QCheckBox *)sender(), isChecked, false);
+}
+
+//=================================================================================
+// function : StepByStepClicked
+// purpose : Slot to treat checking "Step-by-step generation" check box.
+//=================================================================================
+void GenerationGUI_PipeDlg::StepByStepClicked(bool isChecked)
+{
+ GroupMakePoints->CheckBox1->setEnabled(!isChecked);
+ GroupMakePoints->CheckBox2->setEnabled(!isChecked);
+}
+
+//=================================================================================
+// function : updateGenGroup
+// purpose : Update "Generate groups" widgets depending on the path.
+//=================================================================================
+void GenerationGUI_PipeDlg::updateGenGroup()
+{
+ bool isEnable = true;
+
+ if (myPath) {
+ // Check if the path is closed.
+ TopoDS_Shape aShapePath;
+
+ if (GEOMBase::GetShape(myPath.get(), aShapePath)) {
+ isEnable = GEOMUtils::IsOpenPath(aShapePath);
+ }
+ }
+
+ QCheckBox *aGenGroupCheck = NULL;
+
+ switch (getConstructorId()) {
+ case 0 :
+ case 1 :
+ aGenGroupCheck = myGenGroupCheckGP;
+ break;
+ case 2 :
+ aGenGroupCheck = myGenGroupCheckGMP;
+ break;
+ default:
+ break;
+ }
+
+ if (aGenGroupCheck != NULL) {
+ const bool isChecked = aGenGroupCheck->isChecked();
+
+ aGenGroupCheck->setEnabled(isEnable);
+ resetGenGroup(aGenGroupCheck, isEnable && isChecked, false);
+ }
+}
+
+//=================================================================================
+// function : resetGenGroup
+// purpose : Resets data of "Generate groups" widgets.
+//=================================================================================
+void GenerationGUI_PipeDlg::resetGenGroup(QCheckBox *theGenGroup,
+ const bool isChecked,
+ const bool isClearPrefix)
+{
+ QLabel *aPrefixLbl = NULL;
+ QLineEdit *aPrefixEdit = NULL;
+
+ if (theGenGroup == myGenGroupCheckGP) {
+ aPrefixLbl = myPrefixLblGP;
+ aPrefixEdit = myPrefixEditGP;
+ } else if (theGenGroup == myGenGroupCheckGMP) {
+ aPrefixLbl = myPrefixLblGMP;
+ aPrefixEdit = myPrefixEditGMP;
+ }
+
+ if (aPrefixLbl != NULL) {
+ aPrefixLbl->setEnabled(isChecked);
+ aPrefixEdit->setEnabled(isChecked);
+
+ if (isClearPrefix) {
+ aPrefixEdit->setText("");
+ }
+ }
+}
+
+//=================================================================================
+// function : addGroups
+// purpose : Add result groups to the list of groups.
+//=================================================================================
+void GenerationGUI_PipeDlg::addGroups(GEOM::ListOfGO_var &theResult)
+{
+ const int aNbObj = theResult->length();
+
+ if (aNbObj > 0) {
+ if (!theResult[0]->_is_nil()) {
+ QString anEntry = theResult[0]->GetEntry();
+ int i;
+
+ for (i = 1; i < aNbObj; ++i) {
+ if (!theResult[i]->_is_nil()) {
+ myGroupObjectsMap[anEntry].append(GEOM::GeomObjPtr(theResult[i]));
+ }
+ }
+ }
+ }
+}