From: nds Date: Thu, 5 Nov 2015 05:03:59 +0000 (+0300) Subject: An empty feature add/remove for sketch reentrant operation. The widget has not been... X-Git-Tag: V_2.0.0_alfa1~6^2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb91722ca16cc60804778549a8612c838eacbaae;p=modules%2Fshaper.git An empty feature add/remove for sketch reentrant operation. The widget has not been provided for this yet. --- diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index b095ff9c4..a74187148 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -180,16 +180,14 @@ void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePrevio if (!myWorkshop->module()->getFeatureError(aFOperation->feature(), false).isEmpty()) return; - if (aFOperation) { - if (PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) { - if (myRestartingMode != RM_Forbided) { - myRestartingMode = RM_LastFeatureUsed; - startInternalEdit(thePreviousAttributeID); - } - else { - aFOperation->commit(); - } + if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) { + bool isStarted = false; + if (myRestartingMode != RM_Forbided) { + myRestartingMode = RM_LastFeatureUsed; + isStarted = startInternalEdit(thePreviousAttributeID); } + if (!isStarted) + aFOperation->commit(); } } @@ -206,8 +204,7 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA return isDone; myRestartingMode = RM_EmptyFeatureUsed; - startInternalEdit(thePreviousAttributeID); - isDone = true; + isDone = startInternalEdit(thePreviousAttributeID); return isDone; } @@ -267,16 +264,21 @@ bool PartSet_SketcherReetntrantMgr::isActiveMgr() const return anActive; } -void PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) +bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePreviousAttributeID) { + bool isDone = false; ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); - aFOperation->setEditOperation(true); - FeaturePtr anOperationFeature = aFOperation->feature(); - if (anOperationFeature.get() != NULL) { + if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation)) { + aFOperation->setEditOperation(true); + FeaturePtr anOperationFeature = aFOperation->feature(); + + CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch(); + myInternalFeature = aSketch->addFeature(anOperationFeature->getKind()); myIsInternalEditOperation = true; + isDone = true; connect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped())); connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); @@ -300,6 +302,7 @@ void PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePrev } } } + return isDone; } void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit() @@ -311,6 +314,10 @@ void PartSet_SketcherReetntrantMgr::beforeStopInternalEdit() disconnect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped())); } + QObjectPtrList anObjects; + anObjects.append(myInternalFeature); + workshop()->deleteFeatures(anObjects); + PartSet_Module* aModule = module(); ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget(); ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel(); diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReetntrantMgr.h index 2bdeb8617..1f8d2e5fd 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.h @@ -120,7 +120,8 @@ private: /// Sets the focus to the last control of the property panel and activates selection /// of the first widget to can select first value of the next create operation /// \param thePreviousAttributeID an index of the previous attribute to set focus to this widget - void startInternalEdit(const std::string& thePreviousAttributeID); + /// \return true if it is started + bool startInternalEdit(const std::string& thePreviousAttributeID); /// Disconnects this manager from operation signals, deactivate selection of the first control /// in the viewer. @@ -144,6 +145,8 @@ private: RestartingMode myRestartingMode; /// automatical restarting mode flag bool myIsFlagsBlocked; /// true when reset of flags should not be perfromed bool myIsInternalEditOperation; /// true when the 'internal' edit is started + + FeaturePtr myInternalFeature; }; #endif