From: vsv Date: Fri, 9 Oct 2015 08:39:37 +0000 (+0300) Subject: Merge branch 'BR_ADVANCED_CURRENT_FEATURE_MANAGEMENT' of salome:modules/shaper into... X-Git-Tag: V_1.4.0_demo2~10^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8c56aa1d9ce74e35df11472ab3542f6653a5ba51;hp=-c;p=modules%2Fshaper.git Merge branch 'BR_ADVANCED_CURRENT_FEATURE_MANAGEMENT' of salome:modules/shaper into BR_ADVANCED_CURRENT_FEATURE_MANAGEMENT Conflicts: src/ModuleBase/ModuleBase_OperationFeature.cpp --- 8c56aa1d9ce74e35df11472ab3542f6653a5ba51 diff --combined src/ModuleBase/ModuleBase_OperationFeature.cpp index 93c5b6029,647455f46..973885291 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@@ -79,9 -79,6 +79,9 @@@ void ModuleBase_OperationFeature::start if (!aFeature.get() || !isEditOperation()) return; + if (aFeature.get() && isEditOperation()) + aFeature->setStable(false); + myVisualizedObjects.clear(); // store hidden result features std::list aResults = aFeature->results(); @@@ -118,20 -115,11 +118,10 @@@ void ModuleBase_OperationFeature::stopO if (myVisualizedObjects.find(aFeature) != myVisualizedObjects.end()) { aFeature->setDisplayed(false); } - aFeature->setStable(true); if (myVisualizedObjects.size() > 0) Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } - void ModuleBase_OperationFeature::resumeOperation() - { - ModuleBase_Operation::resumeOperation(); - //if (!myIsEditing) - setCurrentFeature(feature()); - //SessionPtr aMgr = ModelAPI_Session::get(); - //DocumentPtr aDoc = aMgr->activeDocument(); - //aDoc->setCurrentFeature(feature(), false); - } - FeaturePtr ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) { if (myParentFeature.get()) { @@@ -160,6 -148,7 +150,6 @@@ void ModuleBase_OperationFeature::setFeature(FeaturePtr theFeature) { myFeature = theFeature; - myFeature->setStable(false); myIsEditing = true; } @@@ -193,6 -182,7 +183,7 @@@ void ModuleBase_OperationFeature::start } ModelAPI_Session::get()->startOperation(anId.toStdString()); + emit beforeStarted(); startOperation(); if (!myIsEditing) { @@@ -206,29 -196,15 +197,15 @@@ return; } } - /// Set current feature and remeber old current feature - if (myIsEditing) { - SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->activeDocument(); - // the parameter of current feature should be false, we should use all feature, not only visible - // in order to correctly save the previous feature of the nested operation, where the - // features can be not visible in the tree. The problem case is Edit sketch entitity(line) - // in the Sketch, created in ExtrusionCut operation. The entity disappears by commit. - // When sketch entity operation started, the sketch should be cashed here as the current. - // Otherwise(the flag is true), the ExtrusionCut is cashed, when commit happens, the sketch - // is disabled, sketch entity is disabled as extrusion cut is created earliest then sketch. - // As a result the sketch disappears from the viewer. However after commit it is displayed back. - myPreviousCurrentFeature = aDoc->currentFeature(false); - aDoc->setCurrentFeature(feature(), false); - } - - startOperation(); + //Already called startOperation(); emit started(); } void ModuleBase_OperationFeature::abort() { + emit beforeAborted(); + // the viewer update should be blocked in order to avoid the features blinking before they are // hidden std::shared_ptr aMsg = std::shared_ptr( @@@ -244,23 -220,10 +221,12 @@@ if (aPropertyPanel) aPropertyPanel->cleanContent(); + myFeature->setStable(true); + - SessionPtr aMgr = ModelAPI_Session::get(); - if (myIsEditing) { - DocumentPtr aDoc = aMgr->activeDocument(); - bool aIsOp = aMgr->isOperation(); - if (!aIsOp) - aMgr->startOperation(); - aDoc->setCurrentFeature(myPreviousCurrentFeature, false);//true); - if (!aIsOp) - aMgr->finishOperation(); - myPreviousCurrentFeature = FeaturePtr(); - } abortOperation(); - stopOperation(); + SessionPtr aMgr = ModelAPI_Session::get(); aMgr->abortOperation(); emit stopped(); // the viewer update should be unblocked in order to avoid the features blinking before they are @@@ -284,30 -247,11 +250,13 @@@ bool ModuleBase_OperationFeature::commi ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel(); if (aPropertyPanel) aPropertyPanel->cleanContent(); + + myFeature->setStable(true); SessionPtr aMgr = ModelAPI_Session::get(); /// Set current feature and remeber old current feature - if (myIsEditing) { - setCurrentFeature(myPreviousCurrentFeature); - /*DocumentPtr aDoc = aMgr->activeDocument(); - bool aIsOp = aMgr->isOperation(); - if (!aIsOp) - aMgr->startOperation(); - aDoc->setCurrentFeature(myPreviousCurrentFeature, true); - if (!aIsOp) - aMgr->finishOperation();*/ - myPreviousCurrentFeature = FeaturePtr(); - } - else { - /*CompositeFeaturePtr aCompositeFeature = ModelAPI_Tools::compositeOwner(feature()); - if (aCompositeFeature.get()) - setCurrentFeature(aCompositeFeature);//myPreviousCurrentFeature); - //else - // setCurrentFeature(feature());*/ - } + emit beforeCommitted(); commitOperation(); aMgr->finishOperation(); @@@ -321,18 -265,6 +270,6 @@@ return false; } - void ModuleBase_OperationFeature::setCurrentFeature(const FeaturePtr& theFeature) - { - SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->activeDocument(); - bool aIsOp = aMgr->isOperation(); - if (!aIsOp) - aMgr->startOperation(); - aDoc->setCurrentFeature(theFeature, false);//true); - if (!aIsOp) - aMgr->finishOperation(); - } - void ModuleBase_OperationFeature::activateByPreselection() { if (myPreSelection.empty()) @@@ -389,6 -321,16 +326,16 @@@ CompositeFeaturePtr ModuleBase_Operatio return myParentFeature; } + void ModuleBase_OperationFeature::setPreviousCurrentFeature(const FeaturePtr& theFeature) + { + myPreviousCurrentFeature = theFeature; + } + + FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature() + { + return myPreviousCurrentFeature; + } + void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelection, ModuleBase_IViewer* theViewer) {