}
}
+
+#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())
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();
}
}
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)));
}
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)));
int HYDROData_SplitToZonesTool::CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW,
TopTools_ListOfShape& outShs,
+ bool OutShapeAsRes,
TopTools_IndexedDataMapOfShapeShape* OutNE,
TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH)
{
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)
{
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;
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
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