]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug of Group Definition p.2
authorisn <isn@opencascade.com>
Wed, 21 Nov 2018 17:35:16 +0000 (20:35 +0300)
committerisn <isn@opencascade.com>
Wed, 21 Nov 2018 18:04:24 +0000 (21:04 +0300)
src/HYDROData/HYDROData_ShapesTool.cxx
src/HYDROData/HYDROData_SplitToZonesTool.cxx
src/HYDROData/HYDROData_SplitToZonesTool.h
src/HYDRO_tests/test_HYDROData_CalcCase.cxx

index 51867ce64d9ac94b8467968458b9c6ea31e1d992..d8779030ed3e56ad0c92910ffcd7dcea5a65739b 100644 (file)
@@ -192,6 +192,6 @@ void HYDROData_ShapesTool::DumpSequenceOfShapes( std::ostream&
   for ( int i = 1, n = theShapes.Length(); i <= n; ++i )
   {
     const TopoDS_Shape& aShape = theShapes.Value( i );
-    theStream << "Shape " << i << " : " << 0 /*aShape.TShape()*/ << "\n";
+    theStream << "Shape " << i << " : " << aShape.TShape().get() << "\n";
   }
 }
index 94d57ea7b5647713be2d65eae0fb0b370f2707fe..29d93734b0a3d17d046ebc57e392f482348e164f 100644 (file)
@@ -644,6 +644,19 @@ HYDROData_SplitToZonesTool::SplitDataList
     }
   }
 
+
+#ifdef DEB_SPLIT_TO_ZONES
+  BRep_Builder B;
+  TopoDS_Compound cmp2;
+  B.MakeCompound(cmp2);
+  HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape dIt(aDM2);
+  for(int i =1;dIt.More();dIt.Next(),i++)
+  {
+    const TopoDS_Shape& aKey = dIt.Key();
+    B.Add(cmp2, aKey);
+  }
+#endif
+
   AddInternalEdges(aDM2, InterPolys, &OutNE);
   NCollection_DataMap<TopoDS_Shape, Handle(HYDROData_PolylineXY), TopTools_ShapeMapHasher>::Iterator spit(OutNE);
   for (;spit.More();spit.Next())
@@ -740,15 +753,29 @@ void HYDROData_SplitToZonesTool::AddInternalEdges(HYDROData_DataMapOfShapeListOf
 
   HYDROData_DataMapOfShapeListOfShape newDM;
   TopTools_IndexedDataMapOfShapeShape OutNE1;
+
+  BRep_Builder BB;
+  TopoDS_Compound cmpDM;
+  BB.MakeCompound(cmpDM);
+  TopTools_ListOfShape out;
+
+  for (int i = 1; i <= DM.Extent();i++)
+  {
+    const TopoDS_Shape& K = DM.FindKey(i);
+    BB.Add(cmpDM, K);
+  }
+
+  TopTools_IndexedDataMapOfShapeListOfShape OInSH2MSH;
+  CutByEdges(cmpDM, Wires, out, true, &OutNE1, &OInSH2MSH);
+
   for (int i = 1; i <= DM.Extent();i++)
   {
     const TopoDS_Shape& K = DM.FindKey(i);
-    const TopTools_ListOfShape& V = DM.FindFromIndex(i);
-    TopTools_ListOfShape out;
-    if (K.ShapeType() == TopAbs_FACE)
+    const TopTools_ListOfShape& V = DM.FindFromIndex(i);  
+    TopTools_ListOfShape modifSh = OInSH2MSH.FindFromKey(K);
+    if (!modifSh.IsEmpty())
     {
-      CutByEdges(K, Wires, out, &OutNE1, NULL);
-      TopTools_ListIteratorOfListOfShape it(out);
+      TopTools_ListIteratorOfListOfShape it(modifSh);
       for (;it.More(); it.Next())
       {
         const TopoDS_Shape& NF = it.Value();
@@ -757,9 +784,11 @@ void HYDROData_SplitToZonesTool::AddInternalEdges(HYDROData_DataMapOfShapeListOf
       }
     }
     else
-      newDM.Add(K, V); // ignore edges, wires...
+      newDM.Add(K, V); //was not modified by bop (CutByEdges)
   }
 
+
+
   for (int i = 1; i <= OutNE1.Extent(); i++)
     OutNE->Bind(OutNE1.FindKey(i), W2P(OutNE1.FindFromIndex(i)));
 
@@ -785,7 +814,7 @@ void HYDROData_SplitToZonesTool::CutFaceByEdges(const TopoDS_Face& in,
   }
 
   TopTools_IndexedDataMapOfShapeShape OutNE1;
-  CutByEdges(in, Wires, out, &OutNE1, OutOrSh2M);
+  CutByEdges(in, Wires, out, false, &OutNE1, OutOrSh2M);
 
   for (int i = 1; i <= OutNE1.Extent(); i++)
     OutNE->Bind(OutNE1.FindKey(i), W2P(OutNE1.FindFromIndex(i)));
@@ -794,6 +823,7 @@ void HYDROData_SplitToZonesTool::CutFaceByEdges(const TopoDS_Face& in,
 
 int HYDROData_SplitToZonesTool::CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW,
                                            TopTools_ListOfShape& outShs, 
+                                           bool OutShapeAsRes,
                                            TopTools_IndexedDataMapOfShapeShape* OutNE, 
                                            TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH)
 {
@@ -818,9 +848,17 @@ int HYDROData_SplitToZonesTool::CutByEdges(const TopoDS_Shape& InSh, const TopTo
   if (anAlgo.HasErrors())
     return -1;
 
-  outShs = anAlgo.Modified( InSh );
-  if (outShs.IsEmpty())
-    outShs.Append(InSh);
+  if (!OutShapeAsRes)
+  {
+    outShs = anAlgo.Modified( InSh );
+    if (outShs.IsEmpty())
+      outShs.Append(InSh);
+  }
+  else
+  {
+    TopoDS_Shape Res = anAlgo.Shape();
+    outShs.Append(Res);
+  }
 
   if (OutNE)
   {
index 665f35a038d2874a3ebee8b47d6201700d0353f3..b4e092eb87402a0704d875eba352d34f29ab248c 100644 (file)
@@ -107,6 +107,7 @@ public:
 
   static int CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW,
                         TopTools_ListOfShape& outShs,
+                        bool OutShapeAsRes,
                         TopTools_IndexedDataMapOfShapeShape* OutNE2OE,
                         TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH);
 
index 2719ca7bffd38b864983cbf634434f204e38ef83..1ea686c7ea3e792d7d855e4365709d4a3762661a 100644 (file)
@@ -50,7 +50,7 @@ void test_HYDROData_CalcCase::test_add_int_wires()
 
     TopTools_ListOfShape OutSh;
     TopTools_IndexedDataMapOfShapeShape ls;
-    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
+    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, false, &ls, NULL);
 
     CPPUNIT_ASSERT_EQUAL(2, OutSh.Extent());
     TopoDS_Compound cmp;
@@ -74,7 +74,7 @@ void test_HYDROData_CalcCase::test_add_int_wires()
 
     TopTools_ListOfShape OutSh;
     TopTools_IndexedDataMapOfShapeShape ls;
-    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
+    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, false, &ls, NULL);
     CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
     TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_2" );
     //CPPUNIT_ASSERT_IMAGES
@@ -93,7 +93,7 @@ void test_HYDROData_CalcCase::test_add_int_wires()
 
     TopTools_ListOfShape OutSh;
     TopTools_IndexedDataMapOfShapeShape ls;
-    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL);
+    HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, false, &ls, NULL);
     CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent());
     TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3", 1, 1 );
     CPPUNIT_ASSERT_IMAGES