]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' into CEA_2020_Lot1
authorcgenraul <clarisse.genrault@cea.fr>
Mon, 12 Oct 2020 08:04:15 +0000 (10:04 +0200)
committercgenraul <clarisse.genrault@cea.fr>
Mon, 12 Oct 2020 08:04:15 +0000 (10:04 +0200)
src/FeaturesPlugin/plugin-Features.xml
src/Model/Model_Update.cpp
src/ModuleBase/ModuleBase_PagedContainer.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_PreviewSketchPlane.cpp
src/PartSet/PartSet_PreviewSketchPlane.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp

index ba80beedda3367cc8fef29f58ce5dc4bcafa7734..08c08b775d79c7aaf9fa5ea31cc8103dbe6f65bf 100644 (file)
         <source path="chamfer_widget.xml"/>
       </feature>
       <feature id="FusionFaces" title="Fuse Faces" tooltip="Performs fusion of connected faces"
-               icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="FeaturesPlugin/fusionFacesFeature.html">
+               icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="fuseFeatureFaces.html">
         <source path="fusion_faces_widget.xml"/>
       </feature>
       <feature id="Defeaturing" title="Defeaturing" tooltip="Perform removing faces from solid"
index a0dfe058af820cd8a7ddb1221d1bd5994bfbc962..9127a9915cab6da6e7d1306a10cfc62007505ade 100644 (file)
@@ -190,13 +190,14 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) {
 #endif
   }
   // clear processed and fill modified recursively
+  std::set<FeaturePtr> aRefSet;
   const std::set<std::shared_ptr<ModelAPI_Attribute> >& aRefs = theFeature->data()->refsToMe();
   std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.cbegin();
   for(; aRefIter != aRefs.cend(); aRefIter++) {
     if ((*aRefIter)->isArgument()) {
       FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIter)->owner());
       if (aReferenced.get()) {
-        addModified(aReferenced, theFeature);
+        aRefSet.insert(aReferenced);
       }
     }
   }
@@ -211,19 +212,21 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) {
       if ((*aRIter)->isArgument()) {
         FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRIter)->owner());
         if (aReferenced.get()) {
-          addModified(aReferenced, theFeature);
+          aRefSet.insert(aReferenced);
         }
       }
     }
   }
-
   // also add part feature that contains this feature to the modified
   if (theFeature->document()->kind() != "PartSet") {
     FeaturePtr aPart = ModelAPI_Tools::findPartFeature(
       ModelAPI_Session::get()->moduleDocument(), theFeature->document());
     if (aPart.get())
-      addModified(aPart, theFeature);
+      aRefSet.insert(aPart);
   }
+  for(std::set<FeaturePtr>::iterator aRef = aRefSet.begin(); aRef != aRefSet.end(); aRef++)
+    addModified(*aRef, theFeature);
+
   return true;
 }
 
index d96a7c70a8cdf6693424e4f96ebfdc552c2fd59e..2b0117acf866d4d3e7803a017ab1d00f77e8cfcd 100644 (file)
@@ -105,14 +105,15 @@ bool ModuleBase_PagedContainer::restoreValueCustom()
   if (aStringAttr->isInitialized()) {
     if (myIsEditing)
       aCaseId = QString::fromStdString(aStringAttr->value());
-    else
+    else {
       aCaseId = QString::fromStdString(aDefVal.empty() ? aStringAttr->value() : aDefVal);
-    if (!aStringAttr->isInitialized())
-      storeValueCustom();
+    }
     int idx = myCaseIds.indexOf(aCaseId);
     if (idx == -1)
       idx = currentPageIndex();
     setCurrentPageIndex(idx);
+    if (aStringAttr->value() != aCaseId.toStdString())
+      storeValueCustom();
   }
   else {
     // It is added because if user edits the feature created from Python
index 30d34b9937138fa17b2edf63e5f064afeefca294..c6a6197c32ea0b6acd1827407f4f8c86f95fbfce 100644 (file)
@@ -1656,7 +1656,8 @@ 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 1b515d32b1f50bc35c7f4c6bf93a93d053ebf0d6..ecc6f36d80c3d01aa8d1fbc79d9030deb63c8721 100644 (file)
@@ -1096,6 +1096,8 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
   myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFOperation->feature());
   double aSizeOfView = 0;
   std::shared_ptr<GeomAPI_Pnt> aCentralPoint;
+  // Reset size of view from previous launches
+  mySketchPlane->setSizeOfView(aSizeOfView, false, aCentralPoint);
   if (aFOperation->isEditOperation() &&
       mySketchPlane->getDefaultSizeOfView(myCurrentSketch, aSizeOfView, aCentralPoint)) {
     mySketchPlane->setSizeOfView(aSizeOfView, true, aCentralPoint);
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