From: dbv Date: Mon, 6 Feb 2017 13:34:01 +0000 (+0300) Subject: Issue #2021 X-Git-Tag: V_2.7.0~290 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd3f2b2e26eb0e39263cf0abefd2c463a0491aed;p=modules%2Fshaper.git Issue #2021 Added flag to Model_BodyBuilder::loadAndOrientModifiedShapes to store modified shapes as generated. It is used to avoid problem when one shapes produce several shapes and they can be distinguished by neighborhoods. --- diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 38d349bd7..2e5c4ba6c 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -348,7 +348,8 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, - const bool theIsStoreSeparate) + const bool theIsStoreSeparate, + const bool theIsStoreAsGenerated) { int anIndex = 1; int aTag = theTag; @@ -377,7 +378,13 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( GeomShapePtr aGeomNewShape(new GeomAPI_Shape()); aGeomNewShape->setImpl(new TopoDS_Shape(aNewShape)); if(!aRoot.IsSame(aNewShape) && aResultShape->isSubShape(aGeomNewShape)) { - builder(aTag)->Modify(aRoot,aNewShape); + if(theIsStoreAsGenerated) { + // Here we store shapes as generated, to avoid problem when one parent shape produce + // several child shapes. In this case naming could not determine which shape to select. + builder(aTag)->Generated(aRoot,aNewShape); + } else { + builder(aTag)->Modify(aRoot,aNewShape); + } if(isBuilt) { if(theIsStoreSeparate) { aStream.str(std::string()); diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index 6f2f868eb..7d805f4c3 100755 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -87,7 +87,8 @@ public: const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, - const bool theIsStoreSeparate = false); + const bool theIsStoreSeparate = false, + const bool theIsStoreAsGenerated = false); /// load and orient generated shapes MODEL_EXPORT virtual void loadAndOrientGeneratedShapes ( GeomAlgoAPI_MakeShape* theMS, diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index d3216d15e..8ebe2fe91 100755 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -83,7 +83,8 @@ public: const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, - const bool theIsStoreSeparate = false) = 0; + const bool theIsStoreSeparate = false, + const bool theIsStoreAsGenerated = false) = 0; /// load and orient generated shapes virtual void loadAndOrientGeneratedShapes ( GeomAlgoAPI_MakeShape* theMS, diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index e5f023f11..947dc9bd5 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -117,10 +117,12 @@ void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS, void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape, const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, - const bool theIsStoreSeparate) + const bool theIsStoreSeparate, + const bool theIsStoreAsGenerated) { myBuilder->loadAndOrientModifiedShapes( - theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate); + theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate, + theIsStoreAsGenerated); } void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS, diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 8b90e4427..ac3e5d3fa 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -113,7 +113,8 @@ public: MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape, const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, - const bool theIsStoreSeparate = false); + const bool theIsStoreSeparate = false, + const bool theIsStoreAsGenerated = false); /// load and orient generated shapes MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr theShapeIn, const int theKindOfShape,