]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
bos #20145: [CEA] Sketch's plane become visible again when unticking display of const...
authorvsv <vsv@opencascade.com>
Mon, 5 Oct 2020 17:16:03 +0000 (20:16 +0300)
committervsv <vsv@opencascade.com>
Mon, 5 Oct 2020 17:16:03 +0000 (20:16 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_PreviewSketchPlane.cpp
src/PartSet/PartSet_PreviewSketchPlane.h
src/PartSet/PartSet_WidgetSketchLabel.cpp

index 30d34b9937138fa17b2edf63e5f064afeefca294..e5acf1798210063a3db398136b2b5ff3eb5dd0f6 100644 (file)
@@ -1656,7 +1656,7 @@ void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& 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);
     }
   }
index 72018bd0f21b6a0002c71e8871b2c68aeda8627e..13c3ab8f163030f4c87843cdbad66eff72879dab 100644 (file)
@@ -71,6 +71,13 @@ void PartSet_PreviewSketchPlane::displaySketchPlane(ModuleBase_IWorkshop* theWor
 }
 
 
+void PartSet_PreviewSketchPlane::clearPlanePreview()
+{
+  myPlane = std::shared_ptr<GeomAPI_AISObject>();
+  myShape = std::shared_ptr<GeomAPI_Shape>();
+}
+
+
 void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& theSketch,
                                                    ModuleBase_IWorkshop* theWorkshop)
 {
index c255aca421067563fccfbe02f43e3b51e746a290..0f32c3b0f4e64b2bebc45e4a24903e38af592165 100644 (file)
@@ -74,12 +74,22 @@ public:
   void setSizeOfView(double theSizeOfView, bool isUseSizeOfView,
     const std::shared_ptr<GeomAPI_Pnt>& theCentralPoint = std::shared_ptr<GeomAPI_Pnt>());
 
+  /// 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<GeomAPI_AISObject> createPreviewPlane();
index 2f41d3ed99f6c57230f040a92e241ff46ef4b89d..87c535a543d80ac764d185676fee0bdf7be421a7 100644 (file)
@@ -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