synchronizeBackRefsForObject(aFound->second, aFeature);
}
// also for results
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
- for(; aRes != aResults.cend(); aRes++) {
- aFound = allRefs.find(*aRes);
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
+ std::list<ResultPtr>::iterator aRIter = aResults.begin();
+ for(; aRIter != aResults.cend(); aRIter++) {
+ aFound = allRefs.find(*aRIter);
if (aFound == allRefs.end()) { // not found => erase all back references
- synchronizeBackRefsForObject(anEmpty, *aRes);
+ synchronizeBackRefsForObject(anEmpty, *aRIter);
} else {
- synchronizeBackRefsForObject(aFound->second, *aRes);
+ synchronizeBackRefsForObject(aFound->second, *aRIter);
}
}
}
{
// make updated and redisplay all results
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
- for (; aRIter != aResults.cend(); aRIter++) {
+
+ std::list<ResultPtr> allResults;
+ ModelAPI_Tools::allResults(theFeature, allResults);
+ std::list<ResultPtr>::iterator aRIter = allResults.begin();
+ for (; aRIter != allResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
if (!aRes->isDisabled()) {// update state only for enabled results (Placement Result Part may make the original Part Result as invalid)
aRes->data()->execState(theState);
aRes->data()->setUpdateID(theFeature->data()->updateID());
}
ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
- // iterate sub-bodies of compsolid
- ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
- if (aComp.get()) {
- int aNumSub = aComp->numberOfSubs();
- for(int a = 0; a < aNumSub; a++) {
- ResultPtr aSub = aComp->subResult(a);
- if (!aSub->isDisabled()) {// update state only for enabled results (Placement Result Part may make the original Part Result as invalid)
- aSub->data()->execState(theState);
- if (theState == ModelAPI_StateDone) // feature become "done", so execution changed results
- myUpdated[aSub] = myModification;
- }
- if (theFeature->data()->updateID() > aSub->data()->updateID()) {
- aSub->data()->setUpdateID(theFeature->data()->updateID());
- }
- ModelAPI_EventCreator::get()->sendUpdated(aSub, EVENT_DISP);
- }
- }
}
// to redisplay "presentable" feature (for ex. distance constraint)
ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
// for the modification IDs compare results: modification ID of feature means only that attributes
// of this feature were updated, but if results are obsolete relatively to the referenced results,
// the feature must be updated
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(theFeature, aResults);
+ std::list<ResultPtr>::iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
if (!aRes->isDisabled()) {
return true;
if (anRIter->second < anAIter->second)
return true;
- // iterate sub-bodies of compsolid
- ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
- if (aComp.get()) {
- int aNumSub = aComp->numberOfSubs();
- for(int a = 0; a < aNumSub; a++) {
- ResultPtr aSub = aComp->subResult(a);
- if (!aSub->isDisabled()) {// update state only for enabled results (Placement Result Part may make the original Part Result as invalid)
- std::map<std::shared_ptr<ModelAPI_Object>, int >::iterator anSIter = myUpdated.find(aSub);
- if (anSIter == myUpdated.end()) // not updated at all
- return true;
- if (anSIter->second < anAIter->second)
- return true;
- }
- }
- }
}
}
// also check a feature: some have no parameters,
return aCompSolid.get() && aCompSolid->numberOfSubs() > 0;
}
+void allResults(const FeaturePtr& theFeature, std::list<ResultPtr>& theResults)
+{
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ for (; aRIter != aResults.cend(); aRIter++) {
+ theResults.push_back(*aRIter);
+ // iterate sub-bodies of compsolid
+ ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
+ if (aComp.get()) {
+ int aNumSub = aComp->numberOfSubs();
+ for(int a = 0; a < aNumSub; a++) {
+ theResults.push_back(aComp->subResult(a));
+ }
+ }
+ }
+}
+
} // namespace ModelAPI_Tools
+