- BOPCol_ListIteratorOfListOfShape anIt(aLS);
- //TCollection_AsciiString aNamM ("EdgM_");
- //TCollection_AsciiString aNamG ("EdgG_");
- for (int i =1;anIt.More();anIt.Next(),i++) {
- Standard_Boolean foundF(Standard_False);
- const TopTools_ListOfShape& aListOfNew = /*aBuilder->*/sTool.Modified(anIt.Value());
- if(!aListOfNew.IsEmpty())
- foundF = Standard_True;
- 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 = /*aBuilder->*/sTool.Generated(anIt.Value());
- if(!aListOfGen.IsEmpty())
- foundF = Standard_True;
- it.Initialize(aListOfGen);
- for(;it.More();it.Next())
- aList.Append(it.Value());
- if(!foundF) // face is not modified
- aList.Append (anIt.Value());
- aDM1.Bind(anIt.Value(), aList);
- //TCollection_AsciiString aName;
- if(!anInputGroupList.isEmpty() ) { // 1
- aList.Clear();
- TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
- for (int j =1;exp.More();exp.Next(),j++) {
- Standard_Boolean foundE(Standard_False);
- const TopTools_ListOfShape& aListM = /*aBuilder->*/sTool.Modified(exp.Current());
- //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
- if(aListM.Extent()) foundE = Standard_True;
- it.Initialize(aListM);
- for(int k=1;it.More();it.Next(),k++) {
- aList.Append(it.Value());
- //aName = aNamM + i + j +k +".brep";
- //BRepTools::Write(it.Value(),aName.ToCString());
- }
- const TopTools_ListOfShape& aListG = /*aBuilder->*/sTool.Generated(exp.Current());
- if(aListG.Extent()) 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());
- //aName = aNamG + i + j +".brep";
- //BRepTools::Write(exp.Current(),aName.ToCString());
- //}
- aDM1.Bind(exp.Current(), aList);
- }
- }
+ if(anInputSplitDataList.size() > 1) {
+ HYDROData_Transform splitTool;
+ const Standard_Integer anErr = SplitFaces(aCmp, splitTool);
+ if(anErr)
+ return anOutputSplitDataList;
+ aResult = splitTool.Shape();
+ if (aResult.IsNull())
+ return anOutputSplitDataList;
+ BRepCheck_Analyzer aCheck (aResult);
+ if(!aCheck.IsValid()) {
+ #ifdef DEB_SPLIT_TO_ZONES
+ cout << "result is not valid" <<endl;
+ BRepTools::Write(aResult, "SplitFacesNV.brep");
+ #endif
+ return anOutputSplitDataList;
+ }
+ #ifdef DEB_SPLIT_TO_ZONES
+ BRepTools::Write(aResult, "SplitFacesV.brep");
+ #endif
+
+ // 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());
+ if(!aListOfNew.IsEmpty())
+ foundF = Standard_True;
+
+ 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());
+ ********************************************************************* */
+ if(!foundF) // face is not modified
+ aList.Append (anIt.Value());
+ aDM1.Add(anIt.Value(), aList);
+ #ifdef DEB_SPLIT_TO_ZONES
+ TCollection_AsciiString aName;
+ #endif
+ if(!anInputGroupList.isEmpty() ) { // 1
+ TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
+ for (int j =1;exp.More();exp.Next(),j++) {
+ aList.Clear();
+ Standard_Boolean foundE(Standard_False);
+ const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current());
+ //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
+ if(aListM.Extent()) foundE = Standard_True;
+ 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.Extent()) foundE = Standard_True;
+ //it.Initialize(aListG);
+ //for(int k=1;it.More();it.Next(),k++)
+ //aList.Append(it.Value());
+ //cout << "NB_EDGE = " << aList.Extent() <<endl;
+ ************************************************************************** */
+ if(!foundE) {
+ aList.Append (exp.Current());
+ #ifdef DEB_SPLIT_TO_ZONES
+ aName = aNamG + i + j +".brep";
+ BRepTools::Write(exp.Current(),aName.ToCString());
+ cout << aName.ToCString()<< " = " << exp.Current().TShape() <<endl;
+ #endif
+ }
+ aDM1.Add(exp.Current(), aList);
+ }
+ }
+ }
+ } else {
+ aResult = anInputSplitDataList.at(0).Shape; // get single input shape