// Preparation.
// Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
SplitDataList anInputSplitDataList;
- //TCollection_AsciiString aNam("Faces_");
+#ifdef DEB_SPLIT_TO_ZONES
+ TCollection_AsciiString aNam("Faces_");
+#endif
for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
{
Handle(HYDROData_Object) aGeomObj =
TopoDS_Shape aShape = aGeomObj->GetTopShape();
if ( aShape.IsNull() )
continue;
- //TCollection_AsciiString aName = aNam + anIndex + ".brep";
- //BRepTools::Write(aShape, aName.ToCString());
-
+#ifdef DEB_SPLIT_TO_ZONES
+ TCollection_AsciiString aName = aNam + anIndex + ".brep";
+ BRepTools::Write(aShape, aName.ToCString());
+#endif
if ( aShape.ShapeType() == TopAbs_COMPOUND ) {
// Create split data for each face contained in the compound
TopExp_Explorer anExp( aShape, TopAbs_FACE );
aDM3.Bind(aSh, anInputGroupList.at(i).ObjectNames);
}
}
+
// Step 1. Prepare Partition structures.
TopoDS_Shape aResult;
BOPCol_ListOfShape aLS;
// Step 3. Collect history
//HYDROData_DataMapOfShapeListOfShape aDM1;
BOPCol_ListIteratorOfListOfShape anIt(aLS);
+#ifdef DEB_SPLIT_TO_ZONES
TCollection_AsciiString aNamM ("EdgM_");
TCollection_AsciiString aNamG ("EdgG_");
+#endif
for (int i =1;anIt.More();anIt.Next(),i++) {
Standard_Boolean foundF(Standard_False);
const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value());
TopTools_ListOfShape aList;
TopTools_ListIteratorOfListOfShape it(aListOfNew);
for(;it.More();it.Next())
- aList.Append(it.Value());
- /*
- // Bug in History: partition should give only modified entities! => temporary solution is used
- const TopTools_ListOfShape& aListOfGen = splitTool.Generated(anIt.Value());
- if(!aListOfGen.IsEmpty()) {
- foundF = Standard_True;
- it.Initialize(aListOfGen);
- for(;it.More();it.Next())
- aList.Append(it.Value());
- }*/
+ aList.Append(it.Value());
if(!foundF) // face is not modified
aList.Append (anIt.Value());
aDM1.Bind(anIt.Value(), aList);
it.Initialize(aListM);
for(int k=1;it.More();it.Next(),k++) {
aList.Append(it.Value());
+#ifdef DEB_SPLIT_TO_ZONES
//aName = aNamM + i + j +k +".brep";
//BRepTools::Write(it.Value(),aName.ToCString());
+#endif
}
- /* const TopTools_ListOfShape& aListG = splitTool.Generated(exp.Current());
- if(!aListG.IsEmpty()) {
- foundE = Standard_True;
- it.Initialize(aListG);
- for(int k=1;it.More();it.Next(),k++) {
- aList.Append(it.Value());
- //aName = aNamG + i + j +k +".brep";
- //BRepTools::Write(it.Value(),aName.ToCString());
- }
- }*/
//cout << "NB_EDGE = " << aList.Extent() <<endl;
if(!foundE) {
aList.Append (exp.Current());
//cout << "Modified: " << aListOfNew.Extent() <<endl;
if(!aListOfNew.IsEmpty()) {
aDM4.Bind(aFace, aListOfNew);
+#ifdef DEB_SPLIT_TO_ZONES
//TCollection_AsciiString aName = aNam + i + ".brep";
//BRepTools::Write(aListOfNew.Last(), aName.ToCString());
+#endif
}
else {
- if(!mkCom.IsDeleted(aFace)) {
- const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);
- if(!aListOfGen.IsEmpty()) {
- aDM4.Bind(aFace, aListOfGen);
- //TCollection_AsciiString aName = aNam + i + "g.brep";
- //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
- }
- else {
+ if(!mkCom.IsDeleted(aFace)) {
+ const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);
+ if(!aListOfGen.IsEmpty()) {
+ aDM4.Bind(aFace, aListOfGen);
+#ifdef DEB_SPLIT_TO_ZONES
+ //TCollection_AsciiString aName = aNam + i + "g.brep";
+ //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
+#endif
+ }
+ else {
TopTools_ListOfShape aList;
aList.Append(aFace);
aDM4.Bind(aFace, aList); //the same face - not modified
- }
- }
+ }
+ }
}
TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
for (int j =1;exp2.More();exp2.Next(),j++) {
//cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
// phase 2 (from tool)
#ifdef DEB_SPLIT_TO_ZONES
- TCollection_AsciiString aNam("BEd_");
+ TCollection_AsciiString aNam("BndEd_");
#endif
TopExp_Explorer expt (limFace, TopAbs_EDGE);
for(int i =1;expt.More();expt.Next(),i++) {
}
}
} else {
- HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
- //DM4 contains Old - New after common op. DM1: old - new after Split op.
- for(;aMIt.More();aMIt.Next()) {
- const TopoDS_Shape& aKey = aMIt.Key();
- TopTools_ListOfShape aList;
- aList.Append(aKey);
- const TopTools_ListOfShape& aListOfNew = aMIt.Value();
- TopTools_ListIteratorOfListOfShape it(aListOfNew);
- for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
- if(!aDM4.IsBound(it.Value())) // bi - is deleted
- continue; // go to the next bi
- else {
- //cout <<"DM4_Key: TShape = " <<it.Value().TShape() <<endl;
- const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
- TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
- for(;it4.More();it4.Next()) {
- //cout <<"DM4_Value: TShape = " <<it4.Value().TShape() <<endl;
- if(!aDM2.IsBound(it4.Value()))
- aDM2.Bind(it4.Value(), aList);
- else {
- TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
- aList.Prepend(aKey);
+ HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
+ //DM4 contains Old - New after common op. DM1: old - new after Split op.
+ for(;aMIt.More();aMIt.Next()) {
+ const TopoDS_Shape& aKey = aMIt.Key();
+ TopTools_ListOfShape aList;
+ aList.Append(aKey);
+ const TopTools_ListOfShape& aListOfNew = aMIt.Value();
+ TopTools_ListIteratorOfListOfShape it(aListOfNew);
+ for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
+ if(!aDM4.IsBound(it.Value())) // bi - is deleted
+ continue; // go to the next bi
+ else {
+ const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
+ TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
+ for(;it4.More();it4.Next()) {
+ if(!aDM2.IsBound(it4.Value()))
+ aDM2.Bind(it4.Value(), aList);
+ else {
+ TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
+ aList.Prepend(aKey);
+ }
}
- }
+ }
}
}
- }//###
}
} else {
hasLimits = Standard_False;
cout << "New# = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aDestSplitData.ObjectNames.size() <<endl;
#endif
}
-
+
return anOutputSplitDataList;
}