]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1750 Remove sub-shapes edition: can't select sub-shapes in the 3D view,
authornds <nds@opencascade.com>
Mon, 5 Dec 2016 04:27:37 +0000 (07:27 +0300)
committernds <nds@opencascade.com>
Mon, 5 Dec 2016 04:27:37 +0000 (07:27 +0300)
Issue #1820 Selection of two points in sketch

src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/XGUI/XGUI_WorkshopListener.cpp

index 54619b476044b6e0216116e73ced2f04bf7cdcc5..f76d3318cab4f98dc4b5d496c6824537c934d6f4 100755 (executable)
@@ -133,8 +133,8 @@ void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner,
 }
 
 PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule)
-  : QObject(theModule), myModule(theModule), myIsDragging(false), myDragDone(false),
-    myIsMouseOverWindow(false),
+  : QObject(theModule), myModule(theModule), myIsEditLaunching(false), myIsDragging(false),
+    myDragDone(false), myIsMouseOverWindow(false),
     myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true),
     myIsPopupMenuActive(false)
 {
@@ -394,6 +394,8 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
       }
     } else if (isSketchOpe && isEditing) {
       // If selected another object commit current result
+      bool aPrevLaunchingState = myIsEditLaunching;
+      myIsEditLaunching = true;
       aFOperation->commit();
 
       myIsDragging = true;
@@ -404,6 +406,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
       // selected entities, e.g. selection of point(attribute on a line) should edit the point
       restoreSelection();
       launchEditing();
+      myIsEditLaunching = aPrevLaunchingState;
       if (aFeature.get() != NULL) {
         std::shared_ptr<SketchPlugin_Feature> aSPFeature =
                   std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
@@ -1034,7 +1037,19 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
   //}
   /// improvement to deselect automatically all eventual selected objects, when
   // returning to the neutral point of the Sketcher
-  workshop()->selector()->clearSelection();
+  bool isClearSelectionPossible = true;
+  if (myIsEditLaunching) {
+    ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                                                          (theOperation);
+    if (aFOperation) {
+      FeaturePtr aFeature = aFOperation->feature();
+      if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind())) {
+        isClearSelectionPossible = false;
+      }
+    }
+  }
+  if (isClearSelectionPossible)
+    workshop()->selector()->clearSelection();
 }
 
 void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
index b6cf959d351886a44b32f47d9a0bda2a144f7972..2029cc4a4e7bd53a295d7e4edf831471fca576fa 100644 (file)
@@ -369,6 +369,7 @@ private:
   PartSet_Module* myModule;
 
   bool myPreviousDrawModeEnabled; // the previous selection enabled state in the viewer
+  bool myIsEditLaunching;
   bool myIsDragging;
   bool myDragDone;
   bool myIsMouseOverWindow; /// the state that the mouse over the view
index 55bfec3d85754df63afe4cab8a32a06b266336b8..72cf265935f66f6b230d7fc618b95665b8d21805 100755 (executable)
@@ -413,6 +413,28 @@ void XGUI_WorkshopListener::
         aDisplayed = displayObject(anObject);
         if (aDisplayed)
           aDoFitAll = aDoFitAll || neededFitAll(anObject, aNbOfShownObjects);
+
+        // workaround for #1750: sub results should be sent here to be displayed
+        FeaturePtr anObjectFeature = ModelAPI_Feature::feature(anObject);
+        if (anObjectFeature.get() && anObjectFeature->getKind() == "Partition") {
+          XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
+          if (anOperationMgr->hasOperation()) {
+            ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                                                (anOperationMgr->currentOperation());
+            if (aFOperation && aFOperation->isEditOperation() && aFOperation->id() == "Remove_SubShapes") {
+              ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
+              if (aCompsolidResult.get() != NULL) { // display all sub results
+                for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
+                  ObjectPtr aSubObject = aCompsolidResult->subResult(i);
+                  aSubObject->setDisplayed(true);
+                  aDisplayed = displayObject(aSubObject);
+                  if (aDisplayed)
+                    aDoFitAll = aDoFitAll || neededFitAll(aSubObject, aNbOfShownObjects);
+                }
+              }
+            }
+          }
+        }
       } else
         anObject->setDisplayed(false);
     }