+
+void Model_ResultBody::cleanCash()
+{
+ myBuilder->cleanCash();
+ for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ aSubIter != mySubs.cend(); ++aSubIter)
+ {
+ const ResultBodyPtr& aSub = *aSubIter;
+ aSub->cleanCash();
+ }
+}
+
+void Model_ResultBody::computeOldForSub(const GeomShapePtr& theSub,
+ const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub)
+{
+ std::list<GeomShapePtr>::const_iterator aRootOlds = theAllOlds.cbegin();
+ for(; aRootOlds != theAllOlds.cend(); aRootOlds++) {
+ ListOfShape aNews;
+ myIsGenerated ? myAlgo->generated(*aRootOlds, aNews) : myAlgo->modified(*aRootOlds, aNews);
+ // MakeShape may return alone old shape if there is no history information for this input
+ if (aNews.size() == 1 && aNews.front()->isEqual(*aRootOlds))
+ aNews.clear();
+ if (aNews.empty()) { // try to iterate to sub-elements (for intersection of solids this is face)
+ std::list<GeomShapePtr> theAllSubOlds;
+ for(GeomAPI_ShapeIterator aSubOld(*aRootOlds); aSubOld.more(); aSubOld.next()) {
+ GeomShapePtr aSub = aSubOld.current();
+ if (aSub.get() && !aSub->isNull())
+ theAllSubOlds.push_back(aSub);
+ }
+ computeOldForSub(theSub, theAllSubOlds, theOldForSub);
+ }
+ for(ListOfShape::iterator aNewIter = aNews.begin(); aNewIter != aNews.end(); aNewIter++) {
+ if (theSub->isSame(*aNewIter)) { // found old that was used for new theSubShape creation
+ theOldForSub.push_back(*aRootOlds);
+ break;
+ }
+ }
+ }
+}