-// 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
std::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_Session::get()->activeDocument();
myFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
}
- if (myFeature) { // TODO: generate an error if feature was not created
- setIsModified(true);
- // Model update should call "execute" of a feature.
- //myFeature->execute();
- // Init default values
- /*QList<ModuleBase_ModelWidget*> aWidgets = getDescription()->modelWidgets();
- QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
- for (; anIt != aLast; anIt++) {
- (*anIt)->storeValue(aFeature);
- }*/
- }
-
- //if (theFlushMessage) {
- // Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
- // Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
- //}
return myFeature;
}
std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anIt);
for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFoundObject; i++) {
- ObjectPtr anObject = aCurSelList->object(i);
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
- if (aFeature.get()) {
- aFoundObject = anObjectFeature == aFeature;
+ ObjectPtr aCurObj = aCurSelList->object(i);
+ FeaturePtr aCurFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(aCurObj);
+ if (aCurFeat.get()) {
+ aFoundObject = anObjectFeature == aCurFeat;
}
}
}
#ifdef DEBUG_OPERATION_START
qDebug("ModuleBase_OperationFeature::start -- begin");
#endif
- setIsModified(false);
QString anId = getDescription()->operationId();
if (myIsEditing) {
anId = anId.append(EditSuffix());
}
}
else {
- bool isSet = false;
// 1. apply the selection to controls
for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
aWgt = (*aWIt);
if (!aWgt->canAcceptFocus())
continue;
aPropertyPanel->setPreselectionWidget(aWgt);
- if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true)) {
- isSet = false;
+ if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true))
break;
- } else {
- isSet = true;
+ else
aFilledWgt = aWgt;
- }
}
}
aPropertyPanel->setPreselectionWidget(NULL);