]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #355 Delete: elements of sketch and constraints
authornds <natalia.donis@opencascade.com>
Thu, 26 Feb 2015 15:09:59 +0000 (18:09 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 26 Feb 2015 15:09:59 +0000 (18:09 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h

index 960c92ffc8438a90e9c6689c05b4d1b4802ce5d5..a73034a9562d3e25f8e77eb3bba70ca100e8a7cf 100644 (file)
@@ -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<SketchPlugin_Feature> aSPFeature = 
-              std::dynamic_pointer_cast<SketchPlugin_Feature>(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<FeaturePtr>::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());
index e8ad83d7f5f07545a906dd8de34fe80cf01f1221..07125530f9ea00c00383507b4959a2ff9ef43f24 100644 (file)
@@ -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();