#include "HYDROData_SplitToZonesTool.h"
-#include "HYDROData_Object.h"
+#include "HYDROData_PolylineXY.h"
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
}
HYDROData_SplitToZonesTool::SplitDataList
-HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList )
+HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList,
+ const Handle(HYDROData_PolylineXY)& thePolyline )
{
SplitDataList anOutputSplitDataList;
{
Handle(HYDROData_Object) aGeomObj =
Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) );
- if( !aGeomObj.IsNull() )
- {
- SplitData aSplitData( aGeomObj->GetTopShape(), aGeomObj->GetName() );
+ if( aGeomObj.IsNull() )
+ continue;
+
+ TopoDS_Shape aShape = aGeomObj->GetTopShape();
+ if ( aShape.IsNull() )
+ continue;
+
+ if ( aShape.ShapeType() == TopAbs_COMPOUND ) {
+ // Create split data for each face contained in the compound
+ TopExp_Explorer anExp( aShape, TopAbs_FACE );
+ for ( ; anExp.More(); anExp.Next() ) {
+ TopoDS_Face aFace = TopoDS::Face( anExp.Current() );
+ if ( !aFace.IsNull() ) {
+ SplitData aSplitData( aFace, aGeomObj->GetName() );
+ anInputSplitDataList.append( aSplitData );
+ }
+ }
+ } else {
+ SplitData aSplitData( aShape, aGeomObj->GetName() );
anInputSplitDataList.append( aSplitData );
}
}
}
// Step 2. Take into account the boundary polyline.
- /*
if( !thePolyline.IsNull() )
{
- TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetTopShape() );
+ TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetShape() );
if( !aWire.IsNull() )
{
BRepBuilderAPI_MakeFace aMakeFace( aWire, Standard_True );
}
}
}
- */
// Step 3. Extract the separate regions.
SplitDataList anExtractedSplitDataList;