From: mpv Date: Thu, 6 Nov 2014 14:45:59 +0000 (+0300) Subject: Re-Execute the sketch sub-elements after all entities update: after solve space is... X-Git-Tag: V_0.5~28^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=da0b7a6cf86f60b7c3d33e4ecf0a128285414b3a;p=modules%2Fshaper.git Re-Execute the sketch sub-elements after all entities update: after solve space is recomputed, the edges must be updated all, independently on the creation order --- diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 7209c8aef..b6a4a9553 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -159,6 +159,7 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) if (myUpdated.find(theFeature) != myUpdated.end()) return myUpdated[theFeature]; // check all features this feature depended on (recursive call of updateFeature) + ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); bool aMustbeUpdated = myInitial.find(theFeature) != myInitial.end(); if (theFeature) { // only real feature contains references to other objects if (theFeature->data()->mustBeUpdated()) aMustbeUpdated = true; @@ -172,6 +173,12 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) if (updateFeature(aComposite->subFeature(a))) aMustbeUpdated = true; } + if (aMustbeUpdated) { + for(int a = 0; a < aSubsNum; a++) { + if (aComposite->subFeature(a) && aFactory->validate(aComposite->subFeature(a))) + aComposite->subFeature(a)->execute(); + } + } } // check all references: if referenced objects are updated, this object also must be updated std::list > > aRefs; @@ -192,7 +199,6 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) if (aMustbeUpdated) { if (boost::dynamic_pointer_cast(theFeature->document())->executeFeatures() || !theFeature->isPersistentResult()) { - ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); if (aFactory->validate(theFeature)) { if (isAutomatic || (myJustCreatedOrUpdated.find(theFeature) != myJustCreatedOrUpdated.end()) || !theFeature->isPersistentResult() /* execute quick, not persistent results */) @@ -254,32 +260,31 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) return aMustbeUpdated; } -bool Model_Update::updateObject(boost::shared_ptr theObject) +bool Model_Update::updateObject(boost::shared_ptr theObject, const bool theCyclic) { if (myUpdated.find(theObject) != myUpdated.end()) return myUpdated[theObject]; // already processed - return myInitial.find(theObject) != myInitial.end(); - /* remove algorithm for update of all features by dependencies tree - if (!theObject) - return false; - FeaturePtr aFeature = boost::dynamic_pointer_cast(theObject); - if (aFeature) { // for feature just call update Feature - return updateFeature(aFeature); - } - // check general object, possible just a result - if (myUpdated.find(theObject) != myUpdated.end()) - return myUpdated[theObject]; // already processed - // check the feature of this object must be executed - ResultPtr aResult = boost::dynamic_pointer_cast(theObject); - if (aResult) { - FeaturePtr aResFeature = aResult->document()->feature(aResult); - if (aResFeature) { - return updateFeature(aResFeature); + /* + if (theCyclic) { // algorithm for update of all features by dependencies tree + if (!theObject) + return false; + FeaturePtr aFeature = boost::dynamic_pointer_cast(theObject); + if (aFeature) { // for feature just call update Feature + return updateFeature(aFeature); + } + // check general object, possible just a result + if (myUpdated.find(theObject) != myUpdated.end()) + return myUpdated[theObject]; // already processed + // check the feature of this object must be executed + ResultPtr aResult = boost::dynamic_pointer_cast(theObject); + if (aResult) { + FeaturePtr aResFeature = aResult->document()->feature(aResult); + if (aResFeature) { + return updateFeature(aResFeature); + } } } - if (myInitial.find(theObject) != myInitial.end()) - return true; - return false; // nothing is known */ + return myInitial.find(theObject) != myInitial.end(); } diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index a29d67d8d..ab4e4c8ff 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -46,7 +46,7 @@ class Model_Update : public Events_Listener /// Recoursively checks and updates the object (result or feature) if needed (calls updateFeature) /// Returns true if object was updated. - bool updateObject(boost::shared_ptr theObject); + bool updateObject(boost::shared_ptr theObject, const bool theCyclic = true); /// Sends the redisplay events for feature and results, updates the updated status void redisplayWithResults(boost::shared_ptr theFeature); };