delete myBuilder;
}
-void Model_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate,
- const bool theIsStoreAsGenerated,
- const bool theSplitInSubs)
+bool Model_ResultBody::generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult)
{
- if (theSplitInSubs && mySubs.size()) { // consists of subs
+ bool aResult = false;
+ if (mySubs.size()) { // consists of subs
+ for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ aSubIter != mySubs.cend();
+ ++aSubIter)
+ {
+ const ResultBodyPtr& aSub = *aSubIter;
+ if (aSub->generated(theNewShape, theName, theCheckIsInResult))
+ aResult = true;
+ }
+ } else { // do for this directly
+ if (myBuilder->generated(theNewShape, theName, theCheckIsInResult))
+ aResult = true;
+ }
+ return aResult;
+}
+
+void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
+{
+ if (mySubs.size()) { // consists of subs
+ for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ aSubIter != mySubs.cend();
+ ++aSubIter)
+ {
+ const ResultBodyPtr& aSub = *aSubIter;
+ aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+ }
+ } else { // do for this directly
+ myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+ }
+}
+
+void Model_ResultBody::loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
+{
+ if (/*theSplitInSubs &&*/ mySubs.size()) { // consists of subs
+ // optimization of getting of new shapes for specific sub-result
+ if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore))
+ theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore);
std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
for(; aSubIter != mySubs.cend(); aSubIter++) {
// check that sub-shape was also created as modification of ShapeIn
}
}
}*/
- (*aSubIter)->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
- theIsStoreAsGenerated, theSplitInSubs);
+ (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
} else { // do for this directly
- myBuilder->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
- theIsStoreAsGenerated);
+ myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
}
{
bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
if (aChanged) { // state is changed, so modifications are needed
- myBuilder->evolutionToSelection(theFlag);
updateSubs(shape(), false); // to set disabled/enabled
}
return aChanged;
TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
if (!aDataLab.IsNull()) {
TDataStd_UAttribute::Set(aDataLab, kUpdateConnectedTopology);
+ isConnectedTopology(); // to store this flag in transaction, #2630
}
}
// iterate all sub-solids of compsolid to make sub-results synchronized with them
} else { // just update shape of this result
aSub = mySubs[aSubIndex];
}
- if (!aShape->isEqual(aSub->shape())) {
- aSub->store(aShape, false);
+ GeomShapePtr anOldSubShape = aSub->shape();
+ aSub->store(aShape, false); // store even equal to call "clear": #2814
+ if (!aShape->isEqual(anOldSubShape)) {
aECreator->sendUpdated(aSub, EVENT_DISP);
aECreator->sendUpdated(aSub, EVENT_UPD);
}
}
}
-bool Model_ResultBody::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
- if (myBuilder->isLatestEqual(theShape))
- return true;
- // also check that it is asked for sub-elements
- std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- for(; aSubIter != mySubs.cend(); aSubIter++) {
- if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) {
- return true;
- }
- }
- return false;
-}
-
bool Model_ResultBody::isConnectedTopology()
{
TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();