mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028226: Incorrect history support in ShapeUpgrade_UnifySameDomain algorithm
- The methods "Modified" and "IsDeleted" have been added for history support in "ShapeUpgrade_UnifySameDomain" class. - The new Draw commands "unifysamedommod" and "unifysamedomisdel" have been added. - Adoption of other algorithms using this one to its new behavior. Removing code duplication Correcting regressions Correcting remarks
This commit is contained in:
parent
f1191d3099
commit
20aa0d3fdd
@ -1228,3 +1228,7 @@ The following Grid management methods within class V3d_Viewer do not implicitly
|
|||||||
* The classes *BOPDS_PassKey* and *BOPDS_PassKeyBoolean* are too excessive and not used any more in Boolean Operations. To replace them the new *BOPDS_Pair* class has been implemented. Thus:
|
* The classes *BOPDS_PassKey* and *BOPDS_PassKeyBoolean* are too excessive and not used any more in Boolean Operations. To replace them the new *BOPDS_Pair* class has been implemented. Thus:
|
||||||
- The method *BOPDS_DS::Interferences()* now returns the *BOPDS_MapOfPair*;
|
- The method *BOPDS_DS::Interferences()* now returns the *BOPDS_MapOfPair*;
|
||||||
- The method *BOPDS_Iterator::Value()* takes now only two parameters - the indices of interfering sub-shapes.
|
- The method *BOPDS_Iterator::Value()* takes now only two parameters - the indices of interfering sub-shapes.
|
||||||
|
|
||||||
|
@subsection upgrade_720_UnifySameDomain_history History changes in ShapeUpgrade_UnifySameDomain algorithm
|
||||||
|
|
||||||
|
* The result of Generated and Modified methods in ShapeUpgrade_UnifySameDomain class is now returned list of shape instead only one shape.
|
||||||
|
@ -667,9 +667,18 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
aNb = aMG.Extent();
|
aNb = aMG.Extent();
|
||||||
for (i = 1; i <= aNb; ++i) {
|
for (i = 1; i <= aNb; ++i) {
|
||||||
const TopoDS_Shape& aSS = aMG(i);
|
const TopoDS_Shape& aSS = aMG(i);
|
||||||
const TopoDS_Shape& aSGen = anUnify.Generated(aSS);
|
const TopTools_ListOfShape& aLSGen = anUnify.Generated(aSS);
|
||||||
if (!aSGen.IsNull() && !aSS.IsSame(aSGen)) {
|
TopTools_ListIteratorOfListOfShape aIt(aLSGen);
|
||||||
myMapGenerated.Bind(aSS, aSGen);
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aShape = aIt.Value();
|
||||||
|
if (!aShape.IsNull() && !aSS.IsSame(aShape))
|
||||||
|
myMapGenerated.Bind(aSS, aShape);
|
||||||
|
}
|
||||||
|
const TopTools_ListOfShape& aLSMod = anUnify.Modified(aSS);
|
||||||
|
for (aIt.Init(aLSMod); aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aShape = aIt.Value();
|
||||||
|
if (!aShape.IsNull() && !aSS.IsSame(aShape))
|
||||||
|
myMapGenerated.Bind(aSS, aShape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,6 +257,41 @@ BRepOffsetAPI_MiddlePath::BRepOffsetAPI_MiddlePath(const TopoDS_Shape& aShape,
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetUnifiedWire
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
static TopoDS_Wire GetUnifiedWire(const TopoDS_Wire& theWire,
|
||||||
|
ShapeUpgrade_UnifySameDomain& theUnifier)
|
||||||
|
{
|
||||||
|
BRepLib_MakeWire aWMaker;
|
||||||
|
BRepTools_WireExplorer wexp(theWire);
|
||||||
|
TopTools_MapOfShape aGeneratedEdges;
|
||||||
|
for (; wexp.More(); wexp.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Shape anEdge = wexp.Current();
|
||||||
|
const TopTools_ListOfShape& aLSG = theUnifier.Generated(anEdge);
|
||||||
|
// take care of processing the result of Generated() before getting Modified()
|
||||||
|
Standard_Boolean isEmpty = aLSG.IsEmpty();
|
||||||
|
if (!isEmpty) {
|
||||||
|
TopTools_ListIteratorOfListOfShape anIt(aLSG);
|
||||||
|
for (; anIt.More(); anIt.Next()) {
|
||||||
|
const TopoDS_Shape& aShape = anIt.Value();
|
||||||
|
//wire shouldn't contain duplicated generated edges
|
||||||
|
if (aGeneratedEdges.Add(aShape))
|
||||||
|
aWMaker.Add(TopoDS::Edge(aShape));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const TopTools_ListOfShape& aLSM = theUnifier.Modified(anEdge);
|
||||||
|
if (!aLSM.IsEmpty())
|
||||||
|
aWMaker.Add(aLSM);
|
||||||
|
else if (isEmpty)
|
||||||
|
// no change, put original edge
|
||||||
|
aWMaker.Add(TopoDS::Edge(anEdge));
|
||||||
|
}
|
||||||
|
return aWMaker.Wire();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepOffsetAPI_MiddlePath
|
//function : BRepOffsetAPI_MiddlePath
|
||||||
//purpose : Constructor
|
//purpose : Constructor
|
||||||
@ -287,28 +322,8 @@ BRepOffsetAPI_MiddlePath::BRepOffsetAPI_MiddlePath(const TopoDS_Shape& aShape,
|
|||||||
else
|
else
|
||||||
anEndWire = TopoDS::Wire(EndShape);
|
anEndWire = TopoDS::Wire(EndShape);
|
||||||
|
|
||||||
BRepLib_MakeWire MWstart;
|
myStartWire = GetUnifiedWire(aStartWire, Unifier);
|
||||||
//TopTools_MapOfShape MapEdges;
|
myEndWire = GetUnifiedWire(anEndWire, Unifier);
|
||||||
BRepTools_WireExplorer wexp(aStartWire);
|
|
||||||
for (; wexp.More(); wexp.Next())
|
|
||||||
{
|
|
||||||
TopoDS_Shape anEdge = wexp.Current();
|
|
||||||
TopoDS_Shape NewEdge = Unifier.Generated(anEdge);
|
|
||||||
if (!NewEdge.IsNull())
|
|
||||||
MWstart.Add(TopoDS::Edge(NewEdge));
|
|
||||||
}
|
|
||||||
myStartWire = MWstart.Wire();
|
|
||||||
|
|
||||||
BRepLib_MakeWire MWend;
|
|
||||||
//MapEdges.Clear();
|
|
||||||
for (wexp.Init(anEndWire); wexp.More(); wexp.Next())
|
|
||||||
{
|
|
||||||
TopoDS_Shape anEdge = wexp.Current();
|
|
||||||
TopoDS_Shape NewEdge = Unifier.Generated(anEdge);
|
|
||||||
if (!NewEdge.IsNull())
|
|
||||||
MWend.Add(TopoDS::Edge(NewEdge));
|
|
||||||
}
|
|
||||||
myEndWire = MWend.Wire();
|
|
||||||
|
|
||||||
myClosedSection = myStartWire.Closed();
|
myClosedSection = myStartWire.Closed();
|
||||||
myClosedRing = myStartWire.IsSame(myEndWire);
|
myClosedRing = myStartWire.IsSame(myEndWire);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
//pdn,gka 10.06.99 S4189: command DT_ShapeConvertRev added
|
//pdn,gka 10.06.99 S4189: command DT_ShapeConvertRev added
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRepBuilderAPI.hxx>
|
#include <BRepBuilderAPI.hxx>
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
@ -1358,30 +1359,97 @@ static Standard_Integer unifysamedom(Draw_Interpretor& di, Standard_Integer n, c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer unifysamedomgen (Draw_Interpretor& di,
|
Standard_Integer unifysamedomgen(Draw_Interpretor& di,
|
||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n!=3) {
|
if (n != 3) {
|
||||||
di << "use unifysamedomgen newshape oldshape";
|
di << "use unifysamedomgen newshape oldshape\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
aShape=DBRep::Get(a[2]);
|
aShape = DBRep::Get(a[2]);
|
||||||
if (aShape.IsNull()) {
|
if (aShape.IsNull()) {
|
||||||
di<<" null shape is not allowed here\n";
|
di << "Null shape is not allowed here\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TopoDS_Shape ResShape = Unifier().Generated(aShape);
|
|
||||||
if (ResShape.IsNull()) {
|
const TopTools_ListOfShape& aLS = Unifier().Generated(aShape);
|
||||||
di << " null shape\n";
|
|
||||||
|
if (aLS.Extent() > 1) {
|
||||||
|
BRep_Builder aBB;
|
||||||
|
TopoDS_Compound aRes;
|
||||||
|
aBB.MakeCompound(aRes);
|
||||||
|
TopTools_ListIteratorOfListOfShape aIt(aLS);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aShape = aIt.Value();
|
||||||
|
aBB.Add(aRes, aShape);
|
||||||
|
}
|
||||||
|
DBRep::Set(a[1], aRes);
|
||||||
|
}
|
||||||
|
else if (aLS.Extent() == 1) {
|
||||||
|
DBRep::Set(a[1], aLS.First());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DBRep::Set(a[1], ResShape);
|
di << "No shapes were generated from the shape\n";
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Standard_Integer unifysamedommod(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
|
{
|
||||||
|
if (n != 3) {
|
||||||
|
di << "use unifysamedommod newshape oldshape\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
TopoDS_Shape aShape;
|
||||||
|
aShape = DBRep::Get(a[2]);
|
||||||
|
if (aShape.IsNull()) {
|
||||||
|
di << "Null shape is not allowed here\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TopTools_ListOfShape& aLS = Unifier().Modified(aShape);
|
||||||
|
|
||||||
|
if (aLS.Extent() > 1) {
|
||||||
|
BRep_Builder aBB;
|
||||||
|
TopoDS_Compound aRes;
|
||||||
|
aBB.MakeCompound(aRes);
|
||||||
|
TopTools_ListIteratorOfListOfShape aIt(aLS);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aShape = aIt.Value();
|
||||||
|
aBB.Add(aRes, aShape);
|
||||||
|
}
|
||||||
|
DBRep::Set(a[1], aRes);
|
||||||
|
}
|
||||||
|
else if (aLS.Extent() == 1) {
|
||||||
|
DBRep::Set(a[1], aLS.First());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
di << "The shape has not been modified\n";
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer unifysamedomisdel(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
|
{
|
||||||
|
if (n < 2) {
|
||||||
|
di << "Use: unifysamedomisdel shape\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
TopoDS_Shape aShape = DBRep::Get(a[1]);
|
||||||
|
if (aShape.IsNull()) {
|
||||||
|
di << "Null shape is not allowed here\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Standard_Boolean IsDeleted = Unifier().IsDeleted(aShape);
|
||||||
|
di << "The shape has" << (IsDeleted ? " " : " not ") << "been deleted" << "\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static Standard_Integer copytranslate(Draw_Interpretor& di,
|
static Standard_Integer copytranslate(Draw_Interpretor& di,
|
||||||
Standard_Integer argc,
|
Standard_Integer argc,
|
||||||
@ -1588,10 +1656,19 @@ Standard_Integer reshape(Draw_Interpretor& di,
|
|||||||
theCommands.Add ("unifysamedom",
|
theCommands.Add ("unifysamedom",
|
||||||
"unifysamedom result shape [s1 s2 ...] [-f] [-e] [+b] [+i] [-t val] [-a val]", __FILE__,unifysamedom,g);
|
"unifysamedom result shape [s1 s2 ...] [-f] [-e] [+b] [+i] [-t val] [-a val]", __FILE__,unifysamedom,g);
|
||||||
|
|
||||||
theCommands.Add ("unifysamedomgen",
|
theCommands.Add("unifysamedomgen",
|
||||||
"unifysamedomgen newshape oldshape : get new shape generated "
|
"unifysamedomgen newshape oldshape : get new shape generated "
|
||||||
"by unifysamedom command from the old one",
|
"by unifysamedom command from the old one",
|
||||||
__FILE__,unifysamedomgen,g);
|
__FILE__, unifysamedomgen, g);
|
||||||
|
|
||||||
|
theCommands.Add("unifysamedommod",
|
||||||
|
"unifysamedommod newshape oldshape : get new shape modified "
|
||||||
|
"by unifysamedom command from the old one",
|
||||||
|
__FILE__, unifysamedommod, g);
|
||||||
|
|
||||||
|
theCommands.Add("unifysamedomisdel",
|
||||||
|
"unifysamedomisdel shape : shape is deleted ",
|
||||||
|
__FILE__, unifysamedomisdel, g);
|
||||||
|
|
||||||
theCommands.Add ("copytranslate","result shape dx dy dz",__FILE__,copytranslate,g);
|
theCommands.Add ("copytranslate","result shape dx dy dz",__FILE__,copytranslate,g);
|
||||||
|
|
||||||
|
@ -1080,8 +1080,9 @@ static Standard_Boolean MergeSeq (TopTools_SequenceOfShape& SeqEdges,
|
|||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Boolean ConcatBSplines,
|
const Standard_Boolean ConcatBSplines,
|
||||||
Handle(ShapeBuild_ReShape)& theContext,
|
Handle(ShapeBuild_ReShape)& theContext,
|
||||||
TopTools_DataMapOfShapeShape& theOldShapes,
|
TopTools_DataMapOfShapeShape& theOldToGeneratedShapes,
|
||||||
const TopTools_MapOfShape& nonMergVert,
|
const TopTools_MapOfShape& nonMergVert,
|
||||||
|
TopTools_MapOfShape& RemovedShapes,
|
||||||
const TopTools_DataMapOfShapeShape& NewEdges2OldEdges)
|
const TopTools_DataMapOfShapeShape& NewEdges2OldEdges)
|
||||||
{
|
{
|
||||||
NCollection_Sequence<SubSequenceOfEdges> SeqOfSubsSeqOfEdges;
|
NCollection_Sequence<SubSequenceOfEdges> SeqOfSubsSeqOfEdges;
|
||||||
@ -1091,15 +1092,27 @@ static Standard_Boolean MergeSeq (TopTools_SequenceOfShape& SeqEdges,
|
|||||||
{
|
{
|
||||||
if (SeqOfSubsSeqOfEdges(i).UnionEdges.IsNull())
|
if (SeqOfSubsSeqOfEdges(i).UnionEdges.IsNull())
|
||||||
continue;
|
continue;
|
||||||
theContext->Replace(SeqOfSubsSeqOfEdges(i).SeqsEdges(1), SeqOfSubsSeqOfEdges(i).UnionEdges);
|
ShapeAnalysis_Edge sae;
|
||||||
for (Standard_Integer j = 2; j <= SeqOfSubsSeqOfEdges(i).SeqsEdges.Length(); j++)
|
TopoDS_Vertex VF = sae.FirstVertex(SeqOfSubsSeqOfEdges(i).UnionEdges);
|
||||||
|
TopoDS_Vertex VL = sae.LastVertex(SeqOfSubsSeqOfEdges(i).UnionEdges);
|
||||||
|
for (Standard_Integer j = 1; j <= SeqOfSubsSeqOfEdges(i).SeqsEdges.Length(); j++)
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& anOldEdge = SeqOfSubsSeqOfEdges(i).SeqsEdges(j);
|
const TopoDS_Shape& anOldEdge = SeqOfSubsSeqOfEdges(i).SeqsEdges(j);
|
||||||
const TopoDS_Shape* pOrigEdge = NewEdges2OldEdges.Seek(anOldEdge);
|
const TopoDS_Shape* pOrigEdge = NewEdges2OldEdges.Seek(anOldEdge);
|
||||||
if (!pOrigEdge)
|
if (!pOrigEdge)
|
||||||
pOrigEdge = &anOldEdge;
|
pOrigEdge = &anOldEdge;
|
||||||
theOldShapes.Bind(*pOrigEdge, SeqOfSubsSeqOfEdges(i).UnionEdges);
|
theOldToGeneratedShapes.Bind(*pOrigEdge, SeqOfSubsSeqOfEdges(i).UnionEdges);
|
||||||
theContext->Remove(SeqOfSubsSeqOfEdges(i).SeqsEdges(j));
|
if (j == 1)
|
||||||
|
theContext->Replace(anOldEdge, SeqOfSubsSeqOfEdges(i).UnionEdges);
|
||||||
|
else
|
||||||
|
theContext->Remove(anOldEdge);
|
||||||
|
TopoDS_Vertex V[2];
|
||||||
|
TopExp::Vertices(TopoDS::Edge(anOldEdge), V[0], V[1]);
|
||||||
|
for (int k = 0; k < 2; k++)
|
||||||
|
{
|
||||||
|
if (!V[k].IsEqual(VF) && !V[k].IsEqual(VL))
|
||||||
|
RemovedShapes.Add(V[k]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
@ -1194,8 +1207,9 @@ void ShapeUpgrade_UnifySameDomain::Initialize(const TopoDS_Shape& aShape,
|
|||||||
myConcatBSplines = ConcatBSplines;
|
myConcatBSplines = ConcatBSplines;
|
||||||
|
|
||||||
myContext->Clear();
|
myContext->Clear();
|
||||||
myOldShapes.Clear();
|
myOldToGeneratedShapes.Clear();
|
||||||
myKeepShapes.Clear();
|
myKeepShapes.Clear();
|
||||||
|
myRemovedShapes.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1516,6 +1530,28 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
Standard_Integer nbWires = 0;
|
Standard_Integer nbWires = 0;
|
||||||
|
|
||||||
TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape anOldEdges;
|
||||||
|
for (int j = 1; j <= faces.Length(); j++) {
|
||||||
|
TopExp::MapShapes(faces(j), TopAbs_EDGE, anOldEdges);
|
||||||
|
}
|
||||||
|
TopTools_IndexedMapOfShape aMapEdgesAndVertexes;
|
||||||
|
for (int j = 1; j <= edges.Length(); j++) {
|
||||||
|
TopExp::MapShapes(edges(j), aMapEdgesAndVertexes);
|
||||||
|
}
|
||||||
|
for (int j = 1; j <= anOldEdges.Extent(); j++) {
|
||||||
|
const TopoDS_Edge& anEdge = TopoDS::Edge(anOldEdges(j));
|
||||||
|
if (!aMapEdgesAndVertexes.Contains(anEdge)) {
|
||||||
|
myRemovedShapes.Add(anEdge);
|
||||||
|
TopoDS_Vertex V[2];
|
||||||
|
TopExp::Vertices(anEdge, V[0], V[1]);
|
||||||
|
for (int k = 0; k < 2; k++) {
|
||||||
|
if (!aMapEdgesAndVertexes.Contains(V[k]))
|
||||||
|
myRemovedShapes.Add(V[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// connecting wires
|
// connecting wires
|
||||||
while (edges.Length()>0) {
|
while (edges.Length()>0) {
|
||||||
|
|
||||||
@ -1575,6 +1611,7 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
if(BRep_Tool::Degenerated(E)) {
|
if(BRep_Tool::Degenerated(E)) {
|
||||||
sewd->Remove(j);
|
sewd->Remove(j);
|
||||||
isDegRemoved = Standard_True;
|
isDegRemoved = Standard_True;
|
||||||
|
myRemovedShapes.Add(E);
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1752,10 +1789,11 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove the remaining faces
|
// remove the remaining faces
|
||||||
for(i = 2; i <= faces.Length(); i++)
|
for(i = 1; i <= faces.Length(); i++)
|
||||||
{
|
{
|
||||||
myOldShapes.Bind(faces(i), theResult);
|
myOldToGeneratedShapes.Bind(faces(i), theResult);
|
||||||
myContext->Remove(faces(i));
|
if (i > 1)
|
||||||
|
myContext->Remove(faces(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end processing each face
|
} // end processing each face
|
||||||
@ -1837,7 +1875,6 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
|
|
||||||
TopTools_MapOfShape SharedVert;
|
TopTools_MapOfShape SharedVert;
|
||||||
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape anOldEdges;
|
TopTools_IndexedMapOfShape anOldEdges;
|
||||||
TopExp::MapShapes(myInitShape, TopAbs_EDGE, anOldEdges);
|
TopExp::MapShapes(myInitShape, TopAbs_EDGE, anOldEdges);
|
||||||
|
|
||||||
@ -1860,7 +1897,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
SharedVert.Clear();
|
SharedVert.Clear();
|
||||||
CheckSharedVertices(SeqEdges, aMapEdgesVertex, myKeepShapes, SharedVert);
|
CheckSharedVertices(SeqEdges, aMapEdgesVertex, myKeepShapes, SharedVert);
|
||||||
MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext,
|
MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext,
|
||||||
myOldShapes, SharedVert, NewEdges2OldEdges);
|
myOldToGeneratedShapes, SharedVert,
|
||||||
|
myRemovedShapes, NewEdges2OldEdges);
|
||||||
}
|
}
|
||||||
|
|
||||||
TopTools_DataMapOfShapeShape oldFaces2NewFaces;
|
TopTools_DataMapOfShapeShape oldFaces2NewFaces;
|
||||||
@ -1921,7 +1959,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
//if (!SharedVert.IsEmpty())
|
//if (!SharedVert.IsEmpty())
|
||||||
// continue;
|
// continue;
|
||||||
if ( MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext,
|
if ( MergeSeq(SeqEdges, Tol, myConcatBSplines, myContext,
|
||||||
myOldShapes, SharedVert, NewEdges2OldEdges) )
|
myOldToGeneratedShapes, SharedVert,
|
||||||
|
myRemovedShapes, NewEdges2OldEdges))
|
||||||
{
|
{
|
||||||
//for history
|
//for history
|
||||||
/*
|
/*
|
||||||
@ -1952,7 +1991,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
|||||||
SharedVert.Clear();
|
SharedVert.Clear();
|
||||||
CheckSharedVertices(aNonSharedEdges, aMapEdgesVertex, myKeepShapes, SharedVert);
|
CheckSharedVertices(aNonSharedEdges, aMapEdgesVertex, myKeepShapes, SharedVert);
|
||||||
if ( MergeSeq(aNonSharedEdges, Tol, myConcatBSplines, myContext,
|
if ( MergeSeq(aNonSharedEdges, Tol, myConcatBSplines, myContext,
|
||||||
myOldShapes, SharedVert, NewEdges2OldEdges) )
|
myOldToGeneratedShapes, SharedVert,
|
||||||
|
myRemovedShapes, NewEdges2OldEdges))
|
||||||
{
|
{
|
||||||
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
|
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
|
||||||
if ( !ChangedFaces.Contains(tmpF) )
|
if ( !ChangedFaces.Contains(tmpF) )
|
||||||
@ -2081,12 +2121,44 @@ const TopoDS_Shape& ShapeUpgrade_UnifySameDomain::Shape() const
|
|||||||
//function : Generated
|
//function : Generated
|
||||||
//purpose : returns the new shape from the old one
|
//purpose : returns the new shape from the old one
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TopoDS_Shape ShapeUpgrade_UnifySameDomain::Generated(const TopoDS_Shape& aShape) const
|
const TopTools_ListOfShape& ShapeUpgrade_UnifySameDomain::Generated(const TopoDS_Shape& aShape)
|
||||||
{
|
{
|
||||||
TopoDS_Shape aNewShape = myContext->Apply(aShape);
|
const TopoDS_Shape* aNewShape;
|
||||||
|
myHistShapes.Clear();
|
||||||
if (aNewShape.IsNull())
|
aNewShape = myOldToGeneratedShapes.Seek(aShape);
|
||||||
aNewShape = myContext->Apply(myOldShapes(aShape));
|
if (aNewShape) {
|
||||||
|
if (myContext->IsRecorded(*aNewShape))
|
||||||
return aNewShape;
|
myHistShapes.Append(myContext->Apply(*aNewShape));
|
||||||
|
else
|
||||||
|
myHistShapes.Append(*aNewShape);
|
||||||
|
}
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Modified
|
||||||
|
//purpose : returns the new modified shape from the old one shape
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& ShapeUpgrade_UnifySameDomain::Modified(const TopoDS_Shape& aShape)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aNewShape;
|
||||||
|
Standard_Integer aModifiedStatus;
|
||||||
|
myHistShapes.Clear();
|
||||||
|
if (!myOldToGeneratedShapes.Seek(aShape) &&
|
||||||
|
!myRemovedShapes.Contains(aShape) &&
|
||||||
|
myContext->IsRecorded(aShape)){
|
||||||
|
aModifiedStatus = myContext->Status(aShape, aNewShape, Standard_True);
|
||||||
|
if (aModifiedStatus > 0)
|
||||||
|
myHistShapes.Append(aNewShape);
|
||||||
|
}
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsDeleted
|
||||||
|
//purpose : returns true if the shape has been deleted.
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean ShapeUpgrade_UnifySameDomain::IsDeleted(const TopoDS_Shape& aShape)
|
||||||
|
{
|
||||||
|
return myRemovedShapes.Contains(aShape);
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,21 @@ public:
|
|||||||
//! Gives the resulting shape
|
//! Gives the resulting shape
|
||||||
Standard_EXPORT const TopoDS_Shape& Shape() const;
|
Standard_EXPORT const TopoDS_Shape& Shape() const;
|
||||||
|
|
||||||
//! Gets new common shape from the old one
|
//! Returns list of new common shapes from the old one shape.
|
||||||
Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& aShape) const;
|
//! After successful common operation based on <aShape> list
|
||||||
|
//! will contain new generated shape.
|
||||||
|
//! In other cases it will return an empty list
|
||||||
|
Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& aShape);
|
||||||
|
|
||||||
|
//! Returns list of new modified shapes.
|
||||||
|
//! After successful modifying <aShape> without geometry changes list
|
||||||
|
//! will contain new modified shape.
|
||||||
|
//! In other cases it will return an empty list
|
||||||
|
Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& aShape);
|
||||||
|
|
||||||
|
//! Returns true if the <aShape> has been deleted. The
|
||||||
|
//! result shape of the operation does not contain even trace of <aShape>.
|
||||||
|
Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& aShape);
|
||||||
|
|
||||||
//! this method makes if possible a common face from each
|
//! this method makes if possible a common face from each
|
||||||
//! group of faces lying on coincident surfaces
|
//! group of faces lying on coincident surfaces
|
||||||
@ -133,7 +146,9 @@ private:
|
|||||||
Standard_Boolean myAllowInternal;
|
Standard_Boolean myAllowInternal;
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
Handle(ShapeBuild_ReShape) myContext;
|
Handle(ShapeBuild_ReShape) myContext;
|
||||||
TopTools_DataMapOfShapeShape myOldShapes;
|
TopTools_DataMapOfShapeShape myOldToGeneratedShapes;
|
||||||
|
TopTools_ListOfShape myHistShapes;
|
||||||
|
TopTools_MapOfShape myRemovedShapes;
|
||||||
TopTools_MapOfShape myKeepShapes;
|
TopTools_MapOfShape myKeepShapes;
|
||||||
|
|
||||||
|
|
||||||
|
109
tests/heal/unify_same_domain/A4
Normal file
109
tests/heal/unify_same_domain/A4
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
puts "=========="
|
||||||
|
puts "OCC28226"
|
||||||
|
puts "=========="
|
||||||
|
puts ""
|
||||||
|
#####################################################################
|
||||||
|
# Incorrect history support in ShapeUpgrade_UnifySameDomain algorithm
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug28228_face.brep] a
|
||||||
|
|
||||||
|
explode a f
|
||||||
|
explode a_1 v
|
||||||
|
explode a e
|
||||||
|
|
||||||
|
unifysamedom result a a_3 a_1_3 a_1_4
|
||||||
|
|
||||||
|
set bug_info [unifysamedomgen res a_9]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "No shapes were generated from the shape"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomgen does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomgen res a_10]
|
||||||
|
if {$bug_info != ""} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomgen does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomgen res a_11]
|
||||||
|
if {$bug_info != ""} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomgen does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomgen res a_3]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "No shapes were generated from the shape"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomgen does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedommod res a_1]
|
||||||
|
if {$bug_info != ""} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedommod does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedommod res a_3]
|
||||||
|
if {$bug_info != ""} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedommod does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedommod res a_10]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been modified"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedommod does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedommod res a_11]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been modified"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedommod does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_3]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_9]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_1_8]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_1_9]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_10]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_11]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
unifysamedom result2 a a_3 a_1_3 a_1_4 -e
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_1_8]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has not been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
||||||
|
|
||||||
|
set bug_info [unifysamedomisdel a_1_9]
|
||||||
|
set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
|
||||||
|
if {$bug_info != "The shape has been deleted"} {
|
||||||
|
puts "ERROR: OCC28226 is reproduced. Command unifysamedomisdel does not work correctly."
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user