]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #1556 : Part rebuilding issue
authormpv <mpv@opencascade.com>
Wed, 15 Jun 2016 18:02:46 +0000 (21:02 +0300)
committermpv <mpv@opencascade.com>
Wed, 15 Jun 2016 18:02:46 +0000 (21:02 +0300)
src/Model/Model_AttributeSelection.cpp
src/Model/Model_Update.cpp
src/SketchPlugin/SketchPlugin_SketchEntity.h

index 7f90352af3df27e5202b2185ba263432ab0cc501..c672ed47effb8b8299b90ef0563f4d561777d219 100644 (file)
@@ -438,18 +438,20 @@ bool Model_AttributeSelection::update()
   if (aSelLab.IsAttribute(kPART_REF_ID)) { // it is reference to the part object
     std::shared_ptr<GeomAPI_Shape> aNoSelection;
     bool aResult = selectPart(aContext, aNoSelection, true);
+    aResult = setInvalidIfFalse(aSelLab, aResult);
     if (aResult) {
       owner()->data()->sendAttributeUpdated(this);
     }
-    return setInvalidIfFalse(aSelLab, aResult);
+    return aResult;
   }
 
   if (aContext->groupName() == ModelAPI_ResultBody::group()) {
     // body: just a named shape, use selection mechanism from OCCT
     TNaming_Selector aSelector(aSelLab);
     bool aResult = aSelector.Solve(scope()) == Standard_True;
+    aResult = setInvalidIfFalse(aSelLab, aResult); // must be before sending of updated attribute (1556)
     owner()->data()->sendAttributeUpdated(this);
-    return setInvalidIfFalse(aSelLab, aResult);
+    return aResult;
   } else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
     // construction: identification by the results indexes, recompute faces and
     // take the face that more close by the indexes
@@ -565,8 +567,9 @@ bool Model_AttributeSelection::update()
             }
           }
           selectConstruction(aContext, aNewSelected);
+          setInvalidIfFalse(aSelLab, true);
           owner()->data()->sendAttributeUpdated(this);
-          return setInvalidIfFalse(aSelLab, true);
+          return true;
         } else { // if the selection is not found, put the empty shape: it's better to have disappeared shape, than the old, the lost one
           TNaming_Builder anEmptyBuilder(selectionLabel());
           return setInvalidIfFalse(aSelLab, false);
@@ -586,8 +589,9 @@ bool Model_AttributeSelection::update()
                 std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
               if (aRes && aRes->shape() && aRes->shape()->isEdge()) { // found!
                 selectConstruction(aContext, aRes->shape());
+                setInvalidIfFalse(aSelLab, true);
                 owner()->data()->sendAttributeUpdated(this);
-                return setInvalidIfFalse(aSelLab, true);
+                return true;
               }
             }
           }
@@ -615,8 +619,9 @@ bool Model_AttributeSelection::update()
                 if (aRes && aRes->shape()) {
                   if (aRes->shape()->isVertex() && aVertexNum == 0) { // found!
                     selectConstruction(aContext, aRes->shape());
+                    setInvalidIfFalse(aSelLab, true);
                     owner()->data()->sendAttributeUpdated(this);
-                    return setInvalidIfFalse(aSelLab, true);
+                    return true;
                   } else if (aRes->shape()->isEdge() && aVertexNum > 0) {
                     const TopoDS_Shape& anEdge = aRes->shape()->impl<TopoDS_Shape>();
                     int aVIndex = 1;
@@ -625,8 +630,9 @@ bool Model_AttributeSelection::update()
                         std::shared_ptr<GeomAPI_Shape> aVertex(new GeomAPI_Shape);
                         aVertex->setImpl(new TopoDS_Shape(aVExp.Current()));
                         selectConstruction(aContext, aVertex);
+                        setInvalidIfFalse(aSelLab, true);
                         owner()->data()->sendAttributeUpdated(this);
-                        return setInvalidIfFalse(aSelLab, true);
+                        return true;
                       }
                       aVIndex++;
                     }
@@ -638,8 +644,9 @@ bool Model_AttributeSelection::update()
       }
     } else { // simple construction element: the selected is that needed
       selectConstruction(aContext, aContext->shape());
+      setInvalidIfFalse(aSelLab, true);
       owner()->data()->sendAttributeUpdated(this);
-      return setInvalidIfFalse(aSelLab, true);
+      return true;
     }
   }
   return setInvalidIfFalse(aSelLab, false); // unknown case
index 9784ceec319fb55b88d0309ce3ece7743ab7fc54..98d68fe1de38628d414990f2e1cdf42a052ac674 100755 (executable)
@@ -442,7 +442,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
   bool isReferencedInvalid = false;
   // check all features this feature depended on (recursive call of updateFeature)
   std::set<FeaturePtr>& aReasons = myModified[theFeature];
-  bool allSubsUsed = aReasons.find(theFeature) == aReasons.end();
+  bool allSubsUsed = aReasons.find(theFeature) != aReasons.end();
   if (allSubsUsed) { // add all subs in aReasons and temporary remove "theFeature" to avoid processing itself
     allReasons(theFeature, aReasons);
     aReasons.erase(theFeature);
@@ -452,7 +452,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
   while(!aReasons.empty()) {
     FeaturePtr aReason = *(aReasons.begin());
 #ifdef DEB_UPDATE
-    cout<<theFeature->name()<<" process next reason "<<aReason->name()<<endl;
+    //cout<<theFeature->name()<<" process next reason "<<aReason->name()<<endl;
 #endif
     if (aReason != theFeature && (aReason)->data()->isValid()) {
       if (processFeature(aReason))
index 8662602b6611c43a92f37997f07ae306c5d53f05..f0fb440204471b617f01cff76094a904d33d5e56 100644 (file)
@@ -86,7 +86,7 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC
   {
     AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID());
     if (aAttr)
-      return aAttr->context().get() != NULL;
+      return aAttr->context().get() != NULL && !aAttr->isInvalid();
     return false;
   }