const Handle(HYDROData_PolylineXY)& thePolyline )
{
SplitDataList anOutputSplitDataList;
-
+ if(theObjectList.IsEmpty()) return anOutputSplitDataList;
// Preparation.
// Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
SplitDataList anInputSplitDataList;
}
}
}
-
- // If is only one shape is given we do not process the intersection
- // algorithm but just return the unpacked input data
- if ( theObjectList.Length() == 1 )
- {
- anOutputSplitDataList << anInputSplitDataList << anInputGroupList;
+ // If only one shape is given we don't split it
+ // algorithm just returns the unpacked input data
+ if(theObjectList.Size() == 1) {
+ anOutputSplitDataList.append(anInputSplitDataList);
+ if(!theGroupsList.IsEmpty() )
+ anOutputSplitDataList.append(anInputGroupList);
return anOutputSplitDataList;
}
-
+
HYDROData_DataMapOfShapeListOfString aDM3;
if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names
QStringList aListOfNames;
aList.Append(it.Value());
// Bug in History: partition should give only modified entities! => temporary solution is used
const TopTools_ListOfShape& aListOfGen = aBuilder->Generated(anIt.Value());
- it.Initialize(aListOfGen);
- for(;it.More();it.Next())
- aList.Append(it.Value());
+ it.Initialize(aListOfGen);
+ for(;it.More();it.Next())
+ aList.Append(it.Value());
- aDM1.Bind(anIt.Value(), aList);
- //TCollection_AsciiString aName;
- if(!anInputGroupList.isEmpty()) { /* 1 */
+ aDM1.Bind(anIt.Value(), aList);
+ //TCollection_AsciiString aName;
+ if(!anInputGroupList.isEmpty() ) {
aList.Clear();
- TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
- for (int j =1;exp.More();exp.Next(),j++) {
- const TopTools_ListOfShape& aListM = aBuilder->Modified(exp.Current());
- //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
- 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->Generated(exp.Current());
- 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;
- aDM1.Bind(exp.Current(), aList);
- }
- }
+ TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
+ for (int j =1;exp.More();exp.Next(),j++) {
+ const TopTools_ListOfShape& aListM = aBuilder->Modified(exp.Current());
+ //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
+ 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->Generated(exp.Current());
+ 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;
+ aDM1.Bind(exp.Current(), aList);
+ }
+ }
}
// aDM2: NewShape ==> ListOfOldShapes
QStringList aListOfNames; // names processing
const TopTools_ListOfShape& aListOfOld = aMIt.Value();
TopTools_ListIteratorOfListOfShape it(aListOfOld);
- for(;it.More();it.Next()) {
- const TopoDS_Shape& aSh = it.Value(); //old
- if(aDM3.IsBound(aSh)) {
- const QStringList& ObjectNames = aDM3.Find(aSh);
- aListOfNames.append(ObjectNames);
- }
- }
-/*
- if(aKey.ShapeType() == TopAbs_EDGE) {
- QString aStr("EDGE_Of_Face_");
- aStr = aStr.append(TCollection_AsciiString(i).ToCString());
- const QStringList& ObjectNames = QStringList( aStr);
- cout << "EDGE ==> " << ObjectNames.size() <<" " << aStr.toStdString()<<endl;
- aListOfNames.append(ObjectNames);
- }*/
- aDestSplitData.ObjectNames = aListOfNames;
- anOutputSplitDataList.append(aDestSplitData);
+ for(;it.More();it.Next()) {
+ const TopoDS_Shape& aSh = it.Value(); //old
+ if(aDM3.IsBound(aSh)) {
+ const QStringList& ObjectNames = aDM3.Find(aSh);
+ aListOfNames.append(ObjectNames);
+ }
+ }
+
+ aDestSplitData.ObjectNames = aListOfNames;
+ anOutputSplitDataList.append(aDestSplitData);
}
//cout << "anOutputSplitDataList = " <<anOutputSplitDataList.size() <<endl;
return anOutputSplitDataList;
- /*
- SplitDataListIterator anInputIter( anInputSplitDataList );
- while( anInputIter.hasNext() )
- {
- const SplitData& anInputSplitData = anInputIter.next();
- if( anOutputSplitDataList.isEmpty() )
- anOutputSplitDataList.append( anInputSplitData );
- else
- {
- SplitDataList aSplitDataList;
-
- SplitDataList aSrcSplitDataList;
- aSrcSplitDataList.append( anInputSplitData );
-
- SplitDataList aDestSplitDataList = anOutputSplitDataList;
- anOutputSplitDataList.clear();
-
- while( !aDestSplitDataList.isEmpty() )
- {
- SplitData aSrcSplitData = aSrcSplitDataList.last();
-
- SplitData aDestSplitData = aDestSplitDataList.first();
- aDestSplitDataList.pop_front();
-
- SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
- if( SplitTwoData( aSrcSplitData, aDestSplitData,
- aData1Subtracted, aData2Subtracted, aDataIntersected ) )
- anOutputSplitDataList.append( aDataIntersected );
- anOutputSplitDataList.append( aData2Subtracted );
- aSrcSplitDataList.append( aData1Subtracted );
- }
-
- if( !aSrcSplitDataList.isEmpty() )
- anOutputSplitDataList.append( aSrcSplitDataList.last() );
- }
- }
-
- // Step 2. Take into account the boundary polyline.
- if( !thePolyline.IsNull() )
- {
- TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetShape() );
- if( !aWire.IsNull() )
- {
- BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
- aMakeFace.Build();
- if( aMakeFace.IsDone() )
- {
- SplitData aBoundarySplitData( SplitData::Data_Zone, aMakeFace.Face(), "" );
-
- SplitDataList aCutSplitDataList;
- SplitDataListIterator anOutputIter( anOutputSplitDataList );
- while( anOutputIter.hasNext() )
- {
- const SplitData& anOutputSplitData = anOutputIter.next();
-
- SplitData aData1Subtracted, aData2Subtracted, aDataIntersected;
- if( SplitTwoData( anOutputSplitData, aBoundarySplitData,
- aData1Subtracted, aData2Subtracted, aDataIntersected ) )
- aCutSplitDataList.append( aDataIntersected );
- }
- anOutputSplitDataList = aCutSplitDataList;
- }
- }
- }
-
+/*
// Step 3. Extract the separate regions.
SplitDataList anExtractedSplitDataList;
SplitDataListIterator anOutputIter( anOutputSplitDataList );