#include <HYDROData_Zone.h>
+void printPath( const QString& thePrefix, const QPainterPath& thePath )
+{
+ printf( "%s (n=%d) :", qPrintable( thePrefix ), thePath.elementCount() );
+ for( int i = 0, n = thePath.elementCount(); i < n; i++ )
+ {
+ const QPainterPath::Element anElement = thePath.elementAt( i );
+ switch( anElement.type )
+ {
+ case QPainterPath::MoveToElement:
+ printf( " M(%.0f,%.0f)", anElement.x, anElement.y );
+ break;
+ case QPainterPath::LineToElement:
+ printf( " L(%.0f,%.0f)", anElement.x, anElement.y );
+ break;
+ default:
+ break;
+ }
+ }
+ printf( "\n" );
+}
+
HYDROGUI_SplitZonesTool::SplitDataList
-HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneList )
+HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneList,
+ const Handle(HYDROData_Polyline)& thePolylie )
{
SplitDataList anOutputSplitDataList;
const QPainterPath& aPath1 = theData1.Path;
const QPainterPath& aPath2 = theData2.Path;
+ printPath( "aPath1", aPath1 );
+ printPath( "aPath2", aPath2 );
const QStringList& aZoneNames1 = theData1.ZoneNames;
const QStringList& aZoneNames2 = theData2.ZoneNames;
QPainterPath anIntersection = aPath1.intersected( aPath2 );
+ printPath( "anIntersection", anIntersection );
+ anIntersection.closeSubpath();
+ printPath( "anIntersection after closing", anIntersection );
if( anIntersection.isEmpty() )
{
aSplitDataList.append( theData1 );
- aSplitDataList.append( theData2 );
+ //aSplitDataList.append( theData2 );
}
else
{
aSplitDataList.append( SplitData( anIntersection, aZoneNames1 + aZoneNames2 ) );
QPainterPath aPath1Sub = aPath1.subtracted( aPath2 );
+ printPath( "aPath1Sub", aPath1Sub );
if( !aPath1Sub.isEmpty() )
aSplitDataList.append( ExtractSeparateData( SplitData( aPath1Sub, aZoneNames1 ) ) );
QPainterPath aPath2Sub = aPath2.subtracted( aPath1 );
+ printPath( "aPath2Sub", aPath2Sub );
if( !aPath2Sub.isEmpty() )
aSplitDataList.append( ExtractSeparateData( SplitData( aPath2Sub, aZoneNames2 ) ) );
}
const QPainterPath& aPath2 = aPathList.last();
if( aPath1.contains( aPath2 ) || aPath2.contains( aPath1 ) )
{
+ printf( "HOLE CASE!\n" );
aSplitDataList.append( theData );
return aSplitDataList;
}
while( anIter.hasNext() )
{
const QPainterPath& aPath = anIter.next();
+ printPath( "aPath", aPath );
aSplitDataList.append( SplitData( aPath, aBaseZoneNames ) );
}
return aSplitDataList;