// general sub-labels
/// where the reference to the current feature label is located (or no attribute if null feature)
static const int TAG_CURRENT_FEATURE = 1; ///< reference to the current feature
-/// integer, index of the transaction + GUID for auto recomutation blocking
+/// integer, index of the transaction + GUID for auto recomputation blocking
static const int TAG_CURRENT_TRANSACTION = 2;
static const int TAG_SELECTION_FEATURE = 3; ///< integer, tag of the selection feature label
static const int TAG_NODES_STATE = 4; ///< array, tag of the Object Browser nodes states
aSession->setCheckTransactions(false);
if (myObjs)
delete myObjs;
- myObjs = new Model_Objects(myDoc->Main()); // synchronisation is inside
+ myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
myObjs->setOwner(theThis);
// update the current features status
setCurrentFeature(currentFeature(false), false);
aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId());
}
- } else { // open failed, but new documnet was created to work with it: inform the model
+ } else { // open failed, but new document was created to work with it: inform the model
aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
}
return !isError;
aSub->close(theForever);
}
- // close for thid document needs no transaction in this document
+ // close for this document needs no transaction in this document
std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
- // close all only if it is really asked, otherwise it can be undoed/redoed
+ // close all only if it is really asked, otherwise it can be undone/redone
if (theForever) {
// flush everything to avoid messages with bad objects
delete myObjs;
aSumOfTransaction += myTransactions.rbegin()->myOCAFNum;
myTransactions.pop_back();
}
- // the latest transaction is the start of lower-level operation which startes the nested
+ // the latest transaction is the start of lower-level operation which starts the nested
myTransactions.rbegin()->myOCAFNum += aSumOfTransaction;
myNestedNum.pop_back();
}
return false;
}
-/// Returns true if the last transaction is actually empty: modification to te same values
+/// Returns true if the last transaction is actually empty: modification to the same values
/// were performed only
static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) {
Handle(TDF_Delta) aDelta;
// do it before flashes to enable and recompute nesting features correctly
if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) {
// if all nested operations are closed, make current the higher level objects (to perform
- // it in the python scripts correctly): sketch become current after creation ofsub-elements
+ // it in the python scripts correctly): sketch become current after creation of sub-elements
FeaturePtr aCurrent = currentFeature(false);
CompositeFeaturePtr aMain, aNext = ModelAPI_Tools::compositeOwner(aCurrent);
while(aNext.get()) {
// transaction may be empty if this document was created during this transaction (create part)
if (!myTransactions.empty() && myDoc->CommitCommand()) {
- // if commit is successfull, just increment counters
+ // if commit is successful, just increment counters
if (isEmptyTransaction(myDoc)) { // erase this transaction
myDoc->Undo();
myDoc->ClearRedos();
// nothing inside in all documents, so remove this transaction from the transactions list
undoInternal(true, false);
}
- // on finish clear redos in any case (issue 446) and for all subs (issue 408)
+ // on finish clear redo in any case (issue 446) and for all subs (issue 408)
myDoc->ClearRedos();
myRedos.clear();
for (aSubIter = aSubs.begin(); aSubIter != aSubs.end(); aSubIter++) {
if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) {
anExcludedInt.Add(anAttr.Value()->Label());
// named shape evolution is changed in history update => skip them,
- // they are not the features arguents
+ // they are not the features arguments
continue;
}
if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) {
bool Model_Document::isModified()
{
- // is modified if at least one operation was commited and not undoed
+ // is modified if at least one operation was committed and not undone
return myTransactions.size() != myTransactionSave || isOperation();
}
(myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) &&
myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */)
return true;
- // check other subs contains operation that can be undoed
+ // check other subs contains operation that can be undone
const std::set<int> aSubs = subDocuments();
std::set<int>::iterator aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
{
if (!myRedos.empty())
return true;
- // check other subs contains operation that can be redoed
+ // check other subs contains operation that can be redone
const std::set<int> aSubs = subDocuments();
std::set<int>::iterator aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
void Model_Document::removeFeature(FeaturePtr theFeature)
{
myObjs->removeFeature(theFeature);
+ // fix for #2723: send signal that part is updated
+ if (!isRoot()) {
+ std::shared_ptr<Model_Document> aRoot =
+ std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument());
+ std::list<ResultPtr> allParts;
+ aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts);
+ std::list<ResultPtr>::iterator aParts = allParts.begin();
+ for(; aParts != allParts.end(); aParts++) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aParts);
+ if (aPart->partDoc().get() == this) {
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(aRoot->feature(aPart), anEvent);
+ break;
+ }
+ }
+ }
}
// recursive function to check if theSub is a child of theMain composite feature
aRefLab.ForgetAttribute(TDF_Reference::GetID());
}
// make all features after this feature disabled in reversed order
- // (to remove results without deps)
+ // (to remove results without dependencies)
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
bool aPassed = false; // flag that the current object is already passed in cycle
//if (!isCurrentParameter)
aDisabledFlag = false;
} else if (isCurrentParameter) {
- // if paramater is active, all other features become enabled (issue 1307)
+ // if parameter is active, all other features become enabled (issue 1307)
aDisabledFlag = false;
}
ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
aWasChanged = true;
}
- // update for everyone the concealment flag immideately: on edit feature in the midle of history
+ // update for everyone concealment flag immediately: on edit feature in the middle of history
if (aWasChanged) {
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(anIter, aResults);
if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->updateConcealmentFlag();
}
- // update the concealment status for disply in isConcealed of ResultBody
+ // update the concealment status for display in isConcealed of ResultBody
for(aRes = aResults.begin(); aRes != aResults.end(); aRes++) {
if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
(*aRes)->isConcealed();
if (aPrev.get()) {
FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev);
// without cycle (issue 1555): otherwise extrusion fuse
- // will be enabled and displayed whaen inside sketch
+ // will be enabled and displayed when inside sketch
if (aComp.get())
aPrev = aComp;
}
std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
if (aFind != myNamingNames.end()) { // to avoid duplicate-labels
- // to keep correct order inspite of history line management
+ // to keep correct order in spite of history line management
std::list<TDF_Label>::iterator anAddAfterThis = aFind->second.end();
FeaturePtr anAddedFeature = featureByLab(theLabel);
std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
return *aLabIter;
}
}
- return *(aFind->second.rbegin()); // no more variannts, so, return the last
+ return *(aFind->second.rbegin()); // no more variants, so, return the last
}
// not found exact name, try to find by sub-components
std::string::size_type aSlash = theName.rfind('/');
Model_Document* aRoot =
std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument()).get();
if (aRoot == this)
- return; // don't need to synchronise root with root
+ return; // don't need to synchronize root with root
std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
- while(myRedos.size() > aRoot->myRedos.size()) { // remove redos in this
+ while(myRedos.size() > aRoot->myRedos.size()) { // remove redo in this
aSession->setCheckTransactions(false);
redo();
aSession->setCheckTransactions(true);
}
/* this case can not be reproduced in any known case for the current moment, so, just comment
- while(myRedos.size() < aRoot->myRedos.size()) { // add more redos in this
+ while(myRedos.size() < aRoot->myRedos.size()) { // add more redo in this
undoInternal(false, true);
}*/
}
if (!aBodyData.get() || !aBodyData->isValid())
return FeaturePtr();
- TopoDS_Shape anOldShape; // old shape in the pair oldshape->theShape in the named shape
+ TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape
TopoDS_Shape aShapeContainer; // old shape of the shape that contains aShape as sub-element
Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;
TDF_Label aBodyLab = aBodyData->label();
- // use childs and this label (the lowest priority)
+ // use child and this label (the lowest priority)
TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), Standard_True);
bool aUseThis = !aNSIter.More();
while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {
if (!myUpdateBlocked) { // process all modified features, even if preview is blocked
bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments
myIsPreviewBlocked = false;
- // iterate everything and add efatures in state "MustBeUpdated" into modified
+ // iterate everything and add features in state "MustBeUpdated" into modified
std::list<std::shared_ptr<ModelAPI_Document> > allDocs =
ModelAPI_Session::get()->allOpenedDocuments();
std::list<std::shared_ptr<ModelAPI_Document> >::iterator aDoc = allDocs.begin();
if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
myIsParamUpdated = true;
}
- // on undo/redo, abort do not update persisten features
+ // on undo/redo, abort do not update persistent features
FeaturePtr anUpdated = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
if (anUpdated.get()) {
if (addModified(anUpdated, FeaturePtr()))
}
myIsFinish = false;
}
- // processed features must be only on finish, so clear anyway (to avoid reimport on load)
+ // processed features must be only on finish, so clear anyway (to avoid re-import on load)
myProcessOnFinish.clear();
// #2156: current must be sketch, left after the macro execution
}
}
-// collects all the feautres this feature depends on: reasons
+// collects all the features this feature depends on: reasons
static void allReasons(FeaturePtr theFeature, std::set<FeaturePtr>& theReasons) {
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > > aDeps;
theFeature->data()->referencesToObjects(aDeps);
theFeature->data()->execState(ModelAPI_StateDone);
// this checking must be after the composite feature sub-elements processing:
- // composite feature status may depend on it's subelements
+ // composite feature status may depend on it's sub-elements
if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) &&
theFeature->getKind() != "Part") {
// don't disable Part because it will make disabled all the features