Fix for drawing polygons.

This commit is contained in:
Maciej Suminski 2013-04-17 13:59:46 +02:00
parent e799d7a06c
commit 9af45c05bb
1 changed files with 3 additions and 12 deletions

View File

@ -486,7 +486,6 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aContainer )
COLOR4D fillColor = getLayerColor( aContainer->GetLayer(), aContainer->GetNet() ); COLOR4D fillColor = getLayerColor( aContainer->GetLayer(), aContainer->GetNet() );
std::vector<CPolyPt>::iterator polyIterator; std::vector<CPolyPt>::iterator polyIterator;
std::deque<VECTOR2D> corners; std::deque<VECTOR2D> corners;
VECTOR2D startPoint;
int fillMode = aContainer->GetFillMode(); int fillMode = aContainer->GetFillMode();
m_gal->SetFillColor( fillColor ); m_gal->SetFillColor( fillColor );
@ -501,23 +500,15 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aContainer )
if( fillMode == 0 ) if( fillMode == 0 )
{ {
startPoint = VECTOR2D( polyPoints.front() );
for( polyIterator = polyPoints.begin(); polyIterator != polyPoints.end(); polyIterator++ ) for( polyIterator = polyPoints.begin(); polyIterator != polyPoints.end(); polyIterator++ )
{ {
// Find out all of polygons and then draw them // Find out all of polygons and then draw them
if( !polyIterator->end_contour )
{
corners.push_back( VECTOR2D( *polyIterator ) ); corners.push_back( VECTOR2D( *polyIterator ) );
}
else if( polyIterator->end_contour )
{ {
m_gal->DrawPolygon( corners ); m_gal->DrawPolygon( corners );
// Closing point for polyline
corners.push_back( VECTOR2D( startPoint ) );
m_gal->DrawPolyline( corners ); m_gal->DrawPolyline( corners );
startPoint = VECTOR2D( *( polyIterator + 1 ) );
corners.clear(); corners.clear();
} }
} }