]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #355 Delete: elements of sketch and constraints
authornds <natalia.donis@opencascade.com>
Mon, 19 Jan 2015 12:25:49 +0000 (15:25 +0300)
committersbh <sergey.belash@opencascade.com>
Fri, 30 Jan 2015 08:26:57 +0000 (11:26 +0300)
Delete action on multi-selection.

src/Model/Model_Document.cpp
src/PartSet/PartSet_Module.cpp

index 38ba4adf161b54135e7b033ce1ce9e987ea15b84..c923ee4cad78d53dfacebda4f7b09fea0cb6999f 100644 (file)
@@ -593,12 +593,6 @@ void Model_Document::refsToFeature(FeaturePtr theFeature,
         if (aFeature.get() != NULL)
           theRefs.insert(aFeature);
       }
-
-      if (!aRefs.empty()) {
-        FeaturePtr aFeature = ModelAPI_Feature::feature(aResult);
-        if (aFeature.get() != NULL)
-          theRefs.insert(aFeature);
-      }
     }
   }
   // the dependencies can be in the feature itself
index 6755bc6e5d7c0e5a6b0a1f99a0e85f65e5f800e4..3a51f9ab1fd2f6c63fee3de5f5835c93fff4d004 100644 (file)
@@ -213,21 +213,21 @@ bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
 
 void PartSet_Module::addViewerItems(QMenu* theMenu) const
 {
-  if (isSketchOperationActive() || isSketchFeatureOperationActive()) {
-    ModuleBase_ISelection* aSelection = myWorkshop->selection();
-    QObjectPtrList aObjects = aSelection->selectedPresentations();
-    if (aObjects.size() > 0) {
-      bool hasFeature = false;
-      foreach(ObjectPtr aObject, aObjects)
-      {
-        FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
-        if (aFeature.get() != NULL) {
-          hasFeature = true;
-        }
+  if (!isSketchOperationActive() && !isSketchFeatureOperationActive())
+    return;
+  ModuleBase_ISelection* aSelection = myWorkshop->selection();
+  QObjectPtrList aObjects = aSelection->selectedPresentations();
+  if (aObjects.size() > 0) {
+    bool hasFeature = false;
+    foreach(ObjectPtr aObject, aObjects)
+    {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
+      if (aFeature.get() != NULL) {
+        hasFeature = true;
       }
-      if (hasFeature)
-        theMenu->addAction(action("DELETE_PARTSET_CMD"));
     }
+    if (hasFeature)
+      theMenu->addAction(action("DELETE_PARTSET_CMD"));
   }
 }
 
@@ -472,19 +472,18 @@ void PartSet_Module::onAction(bool isChecked)
 
 void PartSet_Module::deleteObjects()
 {
-  if (isSketchOperationActive() || isSketchFeatureOperationActive())
+  bool isSketchOp = isSketchOperationActive();
+  if (!isSketchOp && !isSketchFeatureOperationActive())
     return;
 
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
   XGUI_Workshop* aWorkshop = aConnector->workshop();
 
   XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
-  if(anOpMgr->canAbortOperation()) {
+  if (!isSketchOp && anOpMgr->canAbortOperation()) {
     ModuleBase_Operation* aCurrentOp = anOpMgr->currentOperation();
     if (aCurrentOp) {
-      bool isSketchOp = aCurrentOp->id().toStdString() == SketchPlugin_Sketch::ID();
-      if (!isSketchOp)
-        aCurrentOp->abort();
+      aCurrentOp->abort();
     }
   }
   // sketch feature should be skipped, only sub-features can be removed