for (; aSubIter != aSubs.end(); aSubIter++)
subDoc(*aSubIter)->abortOperation();
// references may be changed because they are set in attributes on the fly
- myObjs->synchronizeFeatures(aDeltaLabels, true, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
}
bool Model_Document::isOperation() const
}
// after undo of all sub-documents to avoid updates on not-modified data (issue 370)
if (theSynchronize) {
- myObjs->synchronizeFeatures(aDeltaLabels, true, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
// update the current features status
setCurrentFeature(currentFeature(false), false);
}
subDoc(*aSubIter)->redo();
// after redo of all sub-documents to avoid updates on not-modified data (issue 370)
- myObjs->synchronizeFeatures(aDeltaLabels, true, isRoot());
+ myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
// update the current features status
setCurrentFeature(currentFeature(false), false);
}
void Model_Document::moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis)
{
+ bool aCurrentUp = theMoved == currentFeature(false);
+ if (aCurrentUp) {
+ setCurrentFeatureUp();
+ }
+
myObjs->moveFeature(theMoved, theAfterThis);
- if (theAfterThis == currentFeature(true))
+ if (aCurrentUp) { // make the moved feature enabled or disabled due to the real status
+ setCurrentFeature(currentFeature(false), false);
+ } else if (theAfterThis == currentFeature(false)) {
+ // must be after move to make enabled all features which are before theMoved
setCurrentFeature(theMoved, true);
+ }
}
void Model_Document::updateHistory(const std::shared_ptr<ModelAPI_Object> theObject)
}
}
- if (theVisible) { // make features below which are not in history also enabled: sketch subs
+ if (theVisible && !theCurrent.get()) { // needed to avoid disabling of PartSet initial constructions
FeaturePtr aNext =
theCurrent.get() ? myObjs->nextFeature(theCurrent) : myObjs->firstFeature();
for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent)) {
}
// make all features after this feature disabled in reversed order (to remove results without deps)
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
- static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
bool aPassed = false; // flag that the current object is already passed in cycle
FeaturePtr anIter = myObjs->lastFeature();
FeaturePtr aCurrent = currentFeature(false);
if (aCurrent.get()) { // if not, do nothing because null is the upper
FeaturePtr aPrev = myObjs->nextFeature(aCurrent, true);
+ // make the higher level composite as current (sketch becomes disabled if line is enabled)
+ if (aPrev.get()) {
+ for(FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev); aComp.get();
+ aComp = ModelAPI_Tools::compositeOwner(aPrev))
+ aPrev = aComp;
+ }
// do not flush: it is called only on remove, it will be flushed in the end of transaction
setCurrentFeature(aPrev, false);
}
if (aShape.IsNull())
return FeaturePtr();
+ // for comsolids and compounds all the naming is located in the main object, so, try to use
+ // it first
+ ResultCompSolidPtr aMain = ModelAPI_Tools::compSolidOwner(theResult);
+ if (aMain.get()) {
+ FeaturePtr aMainRes = producedByFeature(aMain, theShape);
+ if (aMainRes)
+ return aMainRes;
+ }
+
std::shared_ptr<Model_Data> aBodyData = std::dynamic_pointer_cast<Model_Data>(theResult->data());
if (!aBodyData.get() || !aBodyData->isValid())
return FeaturePtr();
Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;
TDF_Label aBodyLab = aBodyData->label();
// use childs and this label (the lowest priority)
- bool aUseThis = false;
TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), Standard_True);
+ bool aUseThis = !aNSIter.More();
while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {
Handle(TNaming_NamedShape) aNS;
if (aUseThis) {
}
return aResult;
}
+
+bool Model_Document::isLater(FeaturePtr theLater, FeaturePtr theCurrent) const
+{
+ return myObjs->isLater(theLater, theCurrent);
+}