X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_BodyBuilder.cpp;h=c8d20dbeee3044eb9e378a575cdf81e5110b781f;hb=2f70266a7065a81d239198cf4ca0f507e46b96ff;hp=bfa8d62fe1a32d7a78b6a20dd77aa45c8e1e4172;hpb=17e8650ef6b7eb406cdeab881802cf9fadc0750e;p=modules%2Fshaper.git diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index bfa8d62fe..c8d20dbee 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -66,9 +66,10 @@ static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) { } else { TDataStd_Integer::Set(theLab, anEvolution); } - + for(TNaming_Iterator anIter(aName); anIter.More(); anIter.Next()) { - aShapePairs.push_back(std::pair + // iterator goes in reversed order relatively to the Builder, to, make the list reversed + aShapePairs.push_front(std::pair (anIter.OldShape(), anIter.NewShape())); } } @@ -235,6 +236,15 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr& theO TDataStd_Name::Set(aSubBuilder.NamedShape()->Label(), aSolidName.c_str()); } } + } else if(!aBuilder.NamedShape()->IsEmpty()) { + Handle(TDataStd_Name) anAttr; + if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { + std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString()); + if(!aName.empty()) { + std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); + aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); + } + } } } } @@ -284,10 +294,9 @@ TNaming_Builder* Model_BodyBuilder::builder(const int theTag) void Model_BodyBuilder::buildName(const int theTag, const std::string& 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()); + //aDoc->addNamingName(builder(theTag)->NamedShape()->Label(), theName); + TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), theName.c_str()); } void Model_BodyBuilder::generated( const std::shared_ptr& theNewShape, const std::string& theName, const int theTag) @@ -316,8 +325,8 @@ void Model_BodyBuilder::generated(const std::shared_ptr& theOldSh TDF_Label aChildLabel = aLabel.FindChild(aTag); TNaming_Builder aBuilder(aChildLabel); aBuilder.Generated(anOldShape, anExp.Current()); - TCollection_AsciiString aChildName = TCollection_AsciiString((data()->name() + "/" + theName + "_").c_str()) + aTag; - aDoc->addNamingName(aChildLabel, aChildName.ToCString()); + TCollection_AsciiString aChildName = TCollection_AsciiString((theName + "_").c_str()) + aTag; + //aDoc->addNamingName(aChildLabel, aChildName.ToCString()); TDataStd_Name::Set(aChildLabel, aChildName.ToCString()); aTag++; } @@ -455,8 +464,7 @@ void Model_BodyBuilder::loadAndOrientGeneratedShapes ( TDF_Label aChildLabel = aLabel.FindChild(aTag); TNaming_Builder aBuilder(aChildLabel); aBuilder.Generated(aRoot, anExp.Current()); - TCollection_AsciiString aChildName = TCollection_AsciiString((data()->name() + "/" + theName + "_").c_str()) + aTag; - aDoc->addNamingName(aChildLabel, aChildName.ToCString()); + TCollection_AsciiString aChildName = TCollection_AsciiString((theName + "_").c_str()) + aTag; TDataStd_Name::Set(aChildLabel, aChildName.ToCString()); aTag++; } @@ -711,23 +719,6 @@ void Model_BodyBuilder::loadDisconnectedEdges( } } - /* TopTools_IndexedDataMapOfShapeListOfShape aDM; - TopExp::MapShapesAndAncestors(aShape, TopAbs_EDGE, TopAbs_FACE, aDM); - for(int i=1; i <= aDM.Extent(); i++) { - if(aDM.FindFromIndex(i).Extent() > 1) continue; - if (BRep_Tool::Degenerated(TopoDS::Edge(aDM.FindKey(i)))) - continue; - builder(theTag)->Generated(aDM.FindKey(i)); - TCollection_AsciiString aStr(theTag); - std::string aName = theName + aStr.ToCString(); - buildName(theTag, aName); - #ifdef DEB_IMPORT - aName += + ".brep"; - BRepTools::Write(aDM.FindKey(i), aName.c_str()); - #endif - theTag++; - } - */ TopTools_MapOfShape anEdgesToDelete; TopExp_Explorer anEx(aShape,TopAbs_EDGE); std::string aName;