]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Optimization of the neighbors selection in the issue #19071 : Selecting edges to...
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 7 May 2020 07:26:30 +0000 (10:26 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 7 May 2020 07:26:30 +0000 (10:26 +0300)
src/Model/Model_Update.cpp
src/Selector/Selector_FilterByNeighbors.cpp

index 052468c7845d62c84ebfaae62300e2ae508063fd..d006d437417db45d9e2dfdb85bc24050ab7e33c4 100644 (file)
@@ -911,6 +911,8 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
   for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
     std::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
       std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
+    // #19071 : avoid sending of update event in cycle
+    bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true);
     for(int a = aSel->size() - 1; a >= 0; a--) {
       std::shared_ptr<ModelAPI_AttributeSelection> aSelAttr =
         std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aSel->value(a));
@@ -935,6 +937,8 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
         }
       }
     }
+    if (!aWasBlocked)
+      theFeature->data()->blockSendAttributeUpdated(false);
   }
 
   if (aState != ModelAPI_StateDone)
index c0db2d66d50220239e1d3304b300a818fee035fa..e492ab8d315205697eab94112c7f5eb66eed8dbd 100644 (file)
@@ -194,7 +194,9 @@ bool Selector_FilterByNeighbors::select(
   myContext = theContextLab;
   // searching by neighbors
   std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
-  for(int aLevel = 1; true; aLevel++) {
+  // # 19071 : moving through all levels may be too long, in practice there are no more than 2 or 3
+  // levels real cases, so, make it "5" as maximum possible
+  for(int aLevel = 1; aLevel < 5; aLevel++) {
     TopTools_MapOfShape aNewNB;
     findNeighbors(theContext, theValue, aLevel, aNewNB);
     if (aNewNB.Extent() == 0) { // there are no neighbors of the given level, stop iteration