From fcd12395b2df73e2571b782656f2c0fb06c843fe Mon Sep 17 00:00:00 2001 From: szy Date: Mon, 22 Dec 2014 17:09:01 +0300 Subject: [PATCH] Topological name management. Patch#2 --- .../ExchangePlugin_ImportFeature.cpp | 8 ++++---- src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp | 7 ++++--- src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp | 14 ++++++++------ src/FeaturesPlugin/FeaturesPlugin_Placement.cpp | 5 +++-- src/Model/Model_ResultBody.cpp | 5 ++++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index bd789b083..74d4aac01 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -129,13 +129,13 @@ void ExchangePlugin_ImportFeature::loadNamingDS( { //load result theResultBody->store(theGeomShape); - std::string aPrefix = data()->name() + "/"; + int aTag(1); - std::string aNameMS = aPrefix + "Shape"; + std::string aNameMS = "Shape"; theResultBody->loadFirstLevel(theGeomShape, aNameMS, aTag); - std::string aNameDE = aPrefix + "DiscEdges"; + std::string aNameDE = "DiscEdges"; theResultBody->loadDisconnectedEdges(theGeomShape, aNameDE, aTag); - std::string aNameDV = aPrefix + "DiscVertexes"; + std::string aNameDV = "DiscVertexes"; theResultBody->loadDisconnectedVertexes(theGeomShape, aNameDV, aTag); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 580a3163d..779baa1f1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -103,10 +103,11 @@ void FeaturesPlugin_Boolean::LoadNamingDS(GeomAlgoAPI_Boolean* theFeature, GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); theFeature->mapOfShapes(*aSubShapes); - std::string aPrefix = data()->name() + "/"; + // Put in DF modified faces - theResultBody->loadAndOrientModifiedShapes(theFeature->makeShape(), theObject, FACE, _MODIFY_TAG, aPrefix, *aSubShapes); - theResultBody->loadAndOrientModifiedShapes(theFeature->makeShape(), theTool, FACE, _MODIFY_TAG, aPrefix, *aSubShapes); + std::string aModName = "Modified"; + theResultBody->loadAndOrientModifiedShapes(theFeature->makeShape(), theObject, FACE, _MODIFY_TAG, aModName, *aSubShapes); + theResultBody->loadAndOrientModifiedShapes(theFeature->makeShape(), theTool, FACE, _MODIFY_TAG, aModName, *aSubShapes); //Put in DF deleted faces theResultBody->loadDeletedShapes(theFeature->makeShape(), theObject, FACE, _DELETED_TAG); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index b3fd919ee..265ba6576 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -103,29 +103,31 @@ void FeaturesPlugin_Extrusion::LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature, GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); theFeature.mapOfShapes(*aSubShapes); - std::string aPrefix = data()->name() + "/"; - //Insert lateral face : Face from Edge - theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, aPrefix, *aSubShapes); + + //Insert lateral face : Face from Edge + std::string aLatName = "LateralFace"; + theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, aLatName, *aSubShapes); //Insert bottom face + std::string aBotName = "BottomFace"; std::shared_ptr aBottomFace = theFeature.firstShape(); if (!aBottomFace->isNull()) { if (aSubShapes->isBound(aBottomFace)) { aBottomFace = aSubShapes->find(aBottomFace); } - theResultBody->generated(aBottomFace, aPrefix, _FIRST_TAG); + theResultBody->generated(aBottomFace, aBotName, _FIRST_TAG); } //Insert top face + std::string aTopName = "TopFace"; std::shared_ptr aTopFace = theFeature.lastShape(); if (!aTopFace->isNull()) { if (aSubShapes->isBound(aTopFace)) { aTopFace = aSubShapes->find(aTopFace); } - theResultBody->generated(aTopFace, aPrefix, _LAST_TAG); + theResultBody->generated(aTopFace, aTopName, _LAST_TAG); } - } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index c8ff8278b..44ad7523e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -126,8 +126,9 @@ void FeaturesPlugin_Placement::LoadNamingDS( GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); theFeature.mapOfShapes(*aSubShapes); - std::string aPrefix = data()->name() + "/"; + // put modifed faces in DF - theResultBody->loadAndOrientModifiedShapes(theFeature.makeShape(), theSlaveObject, _FACE, _MODIFIEDF_TAG, aPrefix, *aSubShapes); + std::string aModName = "Modified"; + theResultBody->loadAndOrientModifiedShapes(theFeature.makeShape(), theSlaveObject, _FACE, _MODIFIEDF_TAG, aModName, *aSubShapes); } diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 0bfd48103..c958e6239 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -147,7 +148,9 @@ TNaming_Builder* Model_ResultBody::builder(const int theTag) void Model_ResultBody::buildName(const int theTag, const std::string& theName) { - std::string aName = data()->name() + "/" + theName; + std::string aName = data()->name() + "/" + theName; + std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + aDoc->addNamingName(builder(theTag)->NamedShape()->Label(), aName); TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(),aName.c_str()); } void Model_ResultBody::generated( -- 2.39.2