]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #18905(tuleap): Restore old plane of sketcher if user cancels plane change
authorvsv <vsv@opencascade.com>
Fri, 27 Mar 2020 12:51:16 +0000 (15:51 +0300)
committervsv <vsv@opencascade.com>
Fri, 27 Mar 2020 12:51:16 +0000 (15:51 +0300)
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h

index 577689a6cca2ca6e5fe8ea304b8f510f773d30f4..099f6800b3ca864548074b3c71021d9eef0b357f 100644 (file)
@@ -332,6 +332,10 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal(
 
 void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs)
 {
+  // Nullify a temporary remembered plane
+  if (myTmpPlane.get())
+    myTmpPlane.reset();
+
   GeomPlanePtr aPlane = plane();
   if (!aPlane.get())
     return;
@@ -613,6 +617,11 @@ void PartSet_WidgetSketchLabel::onShowPanel()
 
 void PartSet_WidgetSketchLabel::deactivate()
 {
+  if (myTmpPlane.get()) {
+    setSketchPlane(myTmpPlane);
+    myTmpPlane.reset();
+  }
+
   ModuleBase_WidgetValidated::deactivate();
   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
@@ -774,6 +783,7 @@ void PartSet_WidgetSketchLabel::onChangePlane()
     }
 
     CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+    myTmpPlane = PartSet_Tools::sketchPlane(aSketch);
     PartSet_Tools::nullifySketchPlane(aSketch);
 
     Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_SketchPlaneFilter);
index ba5c2bb50185909acf9f1e81bb5950cdd459a628..64dbdb81785448db8d9081fae94cf31ae22573bc 100644 (file)
@@ -258,6 +258,8 @@ private:
 
   QDialog* myPartSetMessage;
   QDialog* mySizeMessage;
+
+  GeomPlanePtr myTmpPlane;
 };
 
 #endif