From: vsv Date: Mon, 5 Oct 2020 17:16:03 +0000 (+0300) Subject: bos #20145: [CEA] Sketch's plane become visible again when unticking display of const... X-Git-Tag: V9_6_0a2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d816b8052e799c31f98cad7d9203198ef42d93b3;p=modules%2Fshaper.git bos #20145: [CEA] Sketch's plane become visible again when unticking display of constraints --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 30d34b993..e5acf1798 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1656,7 +1656,7 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); if (aSketch.get()) { ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); - if (PartSet_SketcherMgr::isSketchOperation(anOperation)) + if (PartSet_SketcherMgr::isSketchOperation(anOperation) && mySketchMgr->previewSketchPlane()->isDisplayed()) mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); } } diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 72018bd0f..13c3ab8f1 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -71,6 +71,13 @@ void PartSet_PreviewSketchPlane::displaySketchPlane(ModuleBase_IWorkshop* theWor } +void PartSet_PreviewSketchPlane::clearPlanePreview() +{ + myPlane = std::shared_ptr(); + myShape = std::shared_ptr(); +} + + void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop) { diff --git a/src/PartSet/PartSet_PreviewSketchPlane.h b/src/PartSet/PartSet_PreviewSketchPlane.h index c255aca42..0f32c3b0f 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.h +++ b/src/PartSet/PartSet_PreviewSketchPlane.h @@ -74,12 +74,22 @@ public: void setSizeOfView(double theSizeOfView, bool isUseSizeOfView, const std::shared_ptr& theCentralPoint = std::shared_ptr()); + /// Returns True if the plane preview is already created bool isPlaneCreated() const { return myPlane.get(); } + /// Returns current state of the plane preview visibility + bool isDisplayed() const { return myPreviewIsDisplayed; } + + /// Displays preview planes + /// \param theWorkshop the application workshop void displaySketchPlane(ModuleBase_IWorkshop* theWorkshop); + /// Nullyfies current plane preview object. + /// Important: Before call of this function the plane has to be erased from viewer + void clearPlanePreview(); + private: /// Create a square face by parameters std::shared_ptr createPreviewPlane(); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 2f41d3ed9..87c535a54 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -365,6 +365,8 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs aModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, isSetSizeOfView); if (myViewVisible->isChecked()) aModule->sketchMgr()->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); + else + aModule->sketchMgr()->previewSketchPlane()->clearPlanePreview(); } // 2. if the planes were displayed, change the view projection