X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultConstruction.cpp;h=272cb7338a24527bc298cd3b8807e42d9544fce8;hb=8ca1067287eaaad921a6e08e7d10b875778f8457;hp=6dc346aa0d27bdc5a8dd6da55b90db06609b2467;hpb=d3721fe136cb494c4998fce055de7ac390fc3f12;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 6dc346aa0..272cb7338 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -55,7 +55,6 @@ Standard_GUID kIS_INFINITE("dea8cc5a-53f2-49c1-94e8-a947bed20a9f"); // identifier of the result not in history Standard_GUID kIS_IN_HISTORY("a9aec01c-805e-44d1-b5d2-a63f06522f8a"); - void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName, std::string& theDefault) { @@ -67,8 +66,7 @@ void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::str void Model_ResultConstruction::setShape(std::shared_ptr theShape) { if (myShape != theShape) { - if (!isInfinite()) - storeShape(theShape); + storeShape(theShape); if (!theShape.get() || !theShape->isEqual(myShape)) { static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent); @@ -238,7 +236,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap std::shared_ptr aMyDoc = std::dynamic_pointer_cast(document()); const TopoDS_Shape& aShape = theShape->impl(); - if (aShape.ShapeType() == TopAbs_VERTEX) { + if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) { aShapeLab.ForgetAllAttributes(); // clear all previously stored TNaming_Builder aBuilder(aShapeLab); aBuilder.Generated(aShape); @@ -255,15 +253,6 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap TNaming_Builder aBuilder(aSubLab); aBuilder.Generated(anExp.Current()); std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex"); - // check this name is already used - ResultPtr aThisRes; - do { - static std::string anEmpty; - static bool aUnique; - aThisRes = aMyDoc->findByName(aVertexName, anEmpty, aUnique); - if (aThisRes.get() && aThisRes.get() != this) - aVertexName += "x"; - } while(aThisRes.get() && aThisRes.get() != this); TDataStd_Name::Set(aSubLab, aVertexName.c_str()); aMyDoc->addNamingName(aSubLab, aVertexName); } @@ -406,7 +395,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap std::stringstream aName; aName<<"Face"; TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE); - TNaming_Builder* anEdgesBuilder = 0; + TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0; for(TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); anIter.Next()) { int anIndex = anIter.Value(); int aModIndex = anIndex > 0 ? anIndex : -anIndex; @@ -429,20 +418,43 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap } anEdgesBuilder->Modify(anEdgeIndices.Find(aModIndex), aPutEdges.Current()); } + // put also modified vertices, otherwise vertex of original edge has no history + if (anEdgeIndices.IsBound(aModIndex)) { + TopExp_Explorer aVExpOld(anEdgeIndices.Find(aModIndex), TopAbs_VERTEX); + TopExp_Explorer aVExpNew(aPutEdges.Current(), TopAbs_VERTEX); + for(; aVExpNew.More() && aVExpOld.More(); aVExpNew.Next(), aVExpOld.Next()) { + if (!aVExpOld.Current().IsSame(aVExpNew.Current())) { + if (!aVerticesBuilder) { + TDF_Label aVertLabel = aLab.FindChild(2); + aVerticesBuilder = new TNaming_Builder(aVertLabel); + std::ostringstream aSubName; + // tag is needed for Test1922 to distinguish sub-edges of different faces + aSubName<<"SubVertex_"<Modify(aVExpOld.Current(), aVExpNew.Current()); + + } + } + } aPutEdges.Next(); } + if (anEdgesBuilder) + delete anEdgesBuilder; + if (aVerticesBuilder) + delete aVerticesBuilder; TDataStd_Name::Set(aLab, TCollection_ExtendedString(aName.str().c_str())); aMyDoc->addNamingName(aLab, aName.str()); // put also wires to sub-labels to correctly select them instead of collection by edges - int aWireTag = 2; // first tag is for SubEdge-s + int aWireTag = 3; // first tag is for SubEdge-s, second - for vertices for(TopExp_Explorer aWires(aFaceToPut, TopAbs_WIRE); aWires.More(); aWires.Next()) { TDF_Label aWireLab = aLab.FindChild(aWireTag); TNaming_Builder aWireBuilder(aWireLab); aWireBuilder.Generated(aWires.Current()); std::ostringstream aWireName; aWireName< 2) - aWireName<<"_"< 3) + aWireName<<"_"<addNamingName(aWireLab, aWireName.str()); aWireTag++;