mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
0023128: [CEA 1555] FuseCollinearEdgesWithinWire fails on the outline of a square face partitioned
This commit is contained in:
parent
a207750f4a
commit
d7f33d79e4
@ -804,25 +804,73 @@ void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginal
|
|||||||
theWire = TopoDS::Wire(Fixer->Shape());
|
theWire = TopoDS::Wire(Fixer->Shape());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TopoDS_Edge prevEdge;
|
// Get the ordered list of edges.
|
||||||
TopTools_ListOfShape finalList, currChain;
|
TopTools_ListOfShape anEdges;
|
||||||
|
TopTools_ListOfShape aCurVertices;
|
||||||
|
BRepTools_WireExplorer aWExp (theWire);
|
||||||
|
|
||||||
BRepTools_WireExplorer wexp (theWire);
|
for (; aWExp.More(); aWExp.Next()) {
|
||||||
if (wexp.More()) {
|
anEdges.Append(aWExp.Current());
|
||||||
prevEdge = wexp.Current();
|
aCurVertices.Append(aWExp.CurrentVertex());
|
||||||
currChain.Append(prevEdge);
|
|
||||||
wexp.Next();
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (anEdges.IsEmpty()) {
|
||||||
Standard_NullObject::Raise("Empty wire given");
|
Standard_NullObject::Raise("Empty wire given");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; wexp.More(); wexp.Next()) {
|
// Treat the case if the wire is closed and first and last edges are C1.
|
||||||
TopoDS_Edge anEdge = wexp.Current();
|
Standard_Boolean isShift = Standard_False;
|
||||||
TopoDS_Vertex CurVertex = wexp.CurrentVertex();
|
|
||||||
|
if (BRep_Tool::IsClosed(theWire)) {
|
||||||
|
// Wire is closed. Check if there are more than 2 edges in the wire.
|
||||||
|
if (!anEdges.First().IsSame(anEdges.Last())) {
|
||||||
|
isShift = Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isShift) {
|
||||||
|
// Put first edge to the end of the list while the chain break is reached.
|
||||||
|
TopoDS_Shape aFirstEdge = anEdges.First();
|
||||||
|
|
||||||
|
while (isShift) {
|
||||||
|
isShift = Standard_False;
|
||||||
|
|
||||||
|
// Check if the first vertex should be kept
|
||||||
|
if (aMapToRemove.Contains(aCurVertices.First()) || removeAll) {
|
||||||
|
// Check if first and last edges are C1.
|
||||||
|
TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.Last());
|
||||||
|
TopoDS_Edge anEdge2 = TopoDS::Edge(anEdges.First());
|
||||||
|
|
||||||
|
if (AreEdgesC1(anEdge1, anEdge2)) {
|
||||||
|
// Make the first edge last.
|
||||||
|
anEdges.Append(anEdge2);
|
||||||
|
anEdges.RemoveFirst();
|
||||||
|
aCurVertices.Append(aCurVertices.First());
|
||||||
|
aCurVertices.RemoveFirst();
|
||||||
|
|
||||||
|
// Check if we reached the first edge again.
|
||||||
|
// Break the loop in this case.
|
||||||
|
isShift = !aFirstEdge.IsSame(anEdges.First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TopTools_ListOfShape finalList, currChain;
|
||||||
|
TopTools_ListIteratorOfListOfShape anEIter(anEdges);
|
||||||
|
TopTools_ListIteratorOfListOfShape aVIter(aCurVertices);
|
||||||
|
TopoDS_Edge prevEdge = TopoDS::Edge(anEIter.Value());
|
||||||
|
|
||||||
|
currChain.Append(prevEdge);
|
||||||
|
anEIter.Next();
|
||||||
|
aVIter.Next();
|
||||||
|
|
||||||
|
for (; anEIter.More(); anEIter.Next(), aVIter.Next()) {
|
||||||
|
TopoDS_Edge anEdge = TopoDS::Edge(anEIter.Value());
|
||||||
|
const TopoDS_Shape &aCurVertex = aVIter.Value();
|
||||||
|
|
||||||
bool continueChain = false;
|
bool continueChain = false;
|
||||||
if (aMapToRemove.Contains(CurVertex) || removeAll) {
|
if (aMapToRemove.Contains(aCurVertex) || removeAll) {
|
||||||
// if C1 -> continue chain
|
// if C1 -> continue chain
|
||||||
if (AreEdgesC1(prevEdge, anEdge)) {
|
if (AreEdgesC1(prevEdge, anEdge)) {
|
||||||
continueChain = true;
|
continueChain = true;
|
||||||
|
@ -861,11 +861,13 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
|
|||||||
{
|
{
|
||||||
Standard_Boolean Done = Standard_False;
|
Standard_Boolean Done = Standard_False;
|
||||||
Standard_Real NewFpar, NewLpar;
|
Standard_Real NewFpar, NewLpar;
|
||||||
GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
|
Handle(Geom_Geometry) aTrsfGeom = CurveSeq.Last()->Transformed
|
||||||
|
(LocSeq.Last().Location().Transformation());
|
||||||
|
GeomAdaptor_Curve GAprevcurve(Handle(Geom_Curve)::DownCast(aTrsfGeom));
|
||||||
TopoDS_Vertex CurVertex = wexp.CurrentVertex();
|
TopoDS_Vertex CurVertex = wexp.CurrentVertex();
|
||||||
TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
|
TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
|
||||||
TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
|
TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
|
||||||
if (aCurve == CurveSeq.Last())
|
if (aCurve == CurveSeq.Last() && aLoc.IsEqual(LocSeq.Last().Location()))
|
||||||
{
|
{
|
||||||
NewFpar = fpar;
|
NewFpar = fpar;
|
||||||
NewLpar = lpar;
|
NewLpar = lpar;
|
||||||
|
Loading…
Reference in New Issue
Block a user