]> OCCT Git - occt-copy.git/commitdiff
0031828: BRepFeat_SplitShape history improvement CR31828_740
authorjgv <jgv@opencascade.com>
Tue, 13 Oct 2020 00:17:48 +0000 (03:17 +0300)
committerjgv <jgv@opencascade.com>
Tue, 13 Oct 2020 00:17:48 +0000 (03:17 +0300)
Treatment of input embedded edges has been added to method Modified.

src/LocOpe/LocOpe_SplitShape.cxx
src/LocOpe/LocOpe_Spliter.cxx
src/LocOpe/LocOpe_WiresOnShape.cxx
src/LocOpe/LocOpe_WiresOnShape.hxx
src/LocOpe/LocOpe_WiresOnShape.lxx

index 4d292c935198eb527ec716c98db8fe7095752e5b..f3a98169123a9f3c98c5bab99ef88b40c0eff4af 100644 (file)
@@ -1225,12 +1225,20 @@ const TopTools_ListOfShape& LocOpe_SplitShape::DescendantShapes
     Rebuild(myShape);
     myDone = Standard_True;
   }
+  
 #ifdef OCCT_DEBUG
   if (!myDblE.IsEmpty()) {
     std::cout << "Le shape comporte des faces invalides" << std::endl;
   }
 #endif
-  return myMap(S);
+  
+  if (myMap.IsBound(S))
+    return myMap(S);
+  else
+  {
+    static TopTools_ListOfShape anEmptyList;
+    return anEmptyList;
+  }
 }
 
 
index 6852f8b1873bbc3c2fb660e68c07c9d926aa08e0..3839a24ae88736be777d20629c45d5acc9d2c4a0 100644 (file)
@@ -116,6 +116,14 @@ void LocOpe_Spliter::Perform(const Handle(LocOpe_WiresOnShape)& PW)
     }
   }
 
+  const TopTools_IndexedDataMapOfShapeListOfShape& Splits = PW->Splits();
+  for (Standard_Integer i = 1; i <= Splits.Extent(); i++)
+  {
+    const TopoDS_Shape& anEdge = Splits.FindKey(i);
+    const TopTools_ListOfShape& aListEdges = Splits(i);
+    myMap.Bind (anEdge, aListEdges);
+  }
+
   theSubs.Build(myShape);
   TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itdesc(myMap);
   if (theSubs.IsCopied(myShape)) {
@@ -201,7 +209,9 @@ void LocOpe_Spliter::Perform(const Handle(LocOpe_WiresOnShape)& PW)
   for (itdesc.Reset(); itdesc.More(); itdesc.Next()) {
     const TopoDS_Shape& sori = itdesc.Key();
     const TopoDS_Shape& scib = itdesc.Value().First();
-    myMap(sori) = theCFace.DescendantShapes(scib);
+    const TopTools_ListOfShape& aShapeList = theCFace.DescendantShapes(scib);
+    if (!aShapeList.IsEmpty())
+      myMap(sori) = aShapeList;
   }
 
   const TopTools_ListOfShape& lres = myMap(myShape);
index 3bbfc98b7a920f62ce3d6c2726cd1f1455949c3f..ffa5fc1ad915044a2f8b76c1f7bf530e5d8503aa 100644 (file)
@@ -124,6 +124,8 @@ void LocOpe_WiresOnShape::Init(const TopoDS_Shape& S)
    myDone = Standard_False;
    myMap.Clear();
    myMapEF.Clear();
+   myFacesWithSection.Clear();
+   mySplits.Clear();
 }
 
 //=======================================================================
@@ -240,7 +242,6 @@ void LocOpe_WiresOnShape::BindAll()
     myMap.Bind(ite.Key(),ite.Value());
   }
 
-  TopTools_IndexedDataMapOfShapeListOfShape Splits;
   Standard_Integer Ind;
   TopTools_MapOfShape anOverlappedEdges;
   for (Ind = 1; Ind <= myMapEF.Extent(); Ind++)
@@ -257,21 +258,21 @@ void LocOpe_WiresOnShape::BindAll()
     if (myCheckInterior)
     {
       Standard_Boolean isOverlapped = Standard_False;
-      FindInternalIntersections(edg, fac, Splits, isOverlapped);
+      FindInternalIntersections(edg, fac, mySplits, isOverlapped);
       if(isOverlapped)
         anOverlappedEdges.Add(edg);
     }
   }
 
-  for (Ind = 1; Ind <= Splits.Extent(); Ind++)
+  for (Ind = 1; Ind <= mySplits.Extent(); Ind++)
   {
-    TopoDS_Shape anEdge = Splits.FindKey(Ind);
+    TopoDS_Shape anEdge = mySplits.FindKey(Ind);
     if(anOverlappedEdges.Contains(anEdge))
       continue;
     TopoDS_Shape aFace  = myMapEF.FindFromKey(anEdge);
     //Remove "anEdge" from "myMapEF"
     myMapEF.RemoveKey(anEdge);
-    TopTools_ListIteratorOfListOfShape itl(Splits(Ind));
+    TopTools_ListIteratorOfListOfShape itl(mySplits(Ind));
     for (; itl.More(); itl.Next())
       myMapEF.Add(itl.Value(), aFace);
   }
index 144cb7a8fb55d5a8357ff7565069354b88dfec9b..008e4fa2d1f8d51048e90af55647351c4a8f1950 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <TopoDS_Shape.hxx>
 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <Standard_Boolean.hxx>
 #include <TopTools_DataMapOfShapeShape.hxx>
@@ -109,8 +110,9 @@ public:
   //! tells is the face to be split by section or not
     Standard_Boolean IsFaceWithSection (const TopoDS_Shape& aFace) const;
 
-
-
+  //! returns the map of edges embedded into the faces and their splits
+  Standard_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& Splits();
+  
 
   DEFINE_STANDARD_RTTIEXT(LocOpe_WiresOnShape,Standard_Transient)
 
@@ -125,6 +127,7 @@ private:
   TopoDS_Shape myShape;
   TopTools_IndexedDataMapOfShapeShape myMapEF;
   TopTools_MapOfShape myFacesWithSection;
+  TopTools_IndexedDataMapOfShapeListOfShape mySplits;
   Standard_Boolean myCheckInterior;
   TopTools_DataMapOfShapeShape myMap;
   Standard_Boolean myDone;
index a21acfc0d7790373d4b0cd8a1615b5858cba46c7..97326c51651160b5e8a9e5ca98c0d6db686ef103 100644 (file)
@@ -43,3 +43,13 @@ inline Standard_Boolean LocOpe_WiresOnShape::IsFaceWithSection(const TopoDS_Shap
 {
   return (myFacesWithSection.Contains(aFace));
 }
+
+//=======================================================================
+//function : Splits
+//purpose  : 
+//=======================================================================
+
+inline const TopTools_IndexedDataMapOfShapeListOfShape& LocOpe_WiresOnShape::Splits()
+{
+  return mySplits;
+}