From: nds Date: Thu, 26 Feb 2015 15:09:59 +0000 (+0300) Subject: Issue #355 Delete: elements of sketch and constraints X-Git-Tag: V_1.1.0~164 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=22df2f3d52b661c4cffef91085300cffc02dfa65;p=modules%2Fshaper.git Issue #355 Delete: elements of sketch and constraints --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 960c92ffc..a73034a95 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -275,9 +275,11 @@ bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const void PartSet_Module::addViewerItems(QMenu* theMenu) const { - if (!PartSet_SketcherMgr::isSketchOperation(myWorkshop->currentOperation()) && - !isSketchFeatureOperationActive()) + ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + if (!PartSet_SketcherMgr::isSketchOperation(anOperation) && + !PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) return; + ModuleBase_ISelection* aSelection = myWorkshop->selection(); QObjectPtrList aObjects = aSelection->selectedPresentations(); if (aObjects.size() > 0) { @@ -389,24 +391,24 @@ void PartSet_Module::onEnterReleased() void PartSet_Module::onOperationActivatedByPreselection() { - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); - if(aOperation && isSketchFeatureOperationActive()) { + ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) { // Set final definitions if they are necessary //propertyPanelDefined(aOperation); /// Commit sketcher operations automatically - aOperation->commit(); + anOperation->commit(); } } void PartSet_Module::onNoMoreWidgets() { - if (isSketchFeatureOperationActive()) { - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); - if (aOperation) { + ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) { + if (anOperation) { if (myRestartingMode != RM_Forbided) myRestartingMode = RM_LastFeatureUsed; - aOperation->commit(); + anOperation->commit(); } } } @@ -476,19 +478,6 @@ QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* return 0; } -bool PartSet_Module::isSketchFeatureOperationActive() const -{ - bool isCurrentSketchOp = false; - ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); - if (aOperation) { - FeaturePtr aFeature = aOperation->feature(); - std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aFeature); - isCurrentSketchOp = aSPFeature.get() != NULL; - } - return isCurrentSketchOp; -} - void PartSet_Module::createActions() { QAction* aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this); @@ -523,8 +512,9 @@ void PartSet_Module::onAction(bool isChecked) void PartSet_Module::deleteObjects() { - bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(myWorkshop->currentOperation()); - if (!isSketchOp && !isSketchFeatureOperationActive()) + ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation); + if (!isSketchOp && !PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) return; // sketch feature should be skipped, only sub-features can be removed @@ -559,8 +549,11 @@ void PartSet_Module::deleteObjects() } //} } - QString aDescription = tr("Delete"); + /** + // according to #355 feature, it is not necessary to inform about dependencies during + // sketch delete operation + // if (!aRefFeatures.empty()) { QStringList aRefNames; std::set::const_iterator anIt = aRefFeatures.begin(), @@ -584,7 +577,7 @@ void PartSet_Module::deleteObjects() if (aRes != QMessageBox::Yes) return; } - } + }*/ SessionPtr aMgr = ModelAPI_Session::get(); aMgr->startOperation(aDescription.toStdString()); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index e8ad83d7f..07125530f 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -142,14 +142,6 @@ protected slots: /// Breaks sequense of automatically resterted operations void breakOperationSequence(); - /// Check whether the sketch operation is active - /// \return boolean result - bool isSketchOperationActive() const; - - /// Check whether the sketch feature operation is active - /// \return boolean result - bool isSketchFeatureOperationActive() const; - /// Create all actions for context menus. It is called on creation of module /// Put the created actions into an internal map void createActions();