From 8fda1d226475596c5a4b33058a5815fe62f0a83e Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 31 Jul 2013 11:36:46 +0200 Subject: [PATCH] Fixed drawing of polygon segments (eg. microwave extension traces). --- pcbnew/pcb_painter.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 0ef0e33500..42da3ef3dd 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -605,13 +605,11 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment ) { - COLOR4D strokeColor = getLayerColor( aSegment->GetLayer(), 0, - aSegment->ViewIsHighlighted() ); - std::deque pointsList; + COLOR4D color = getLayerColor( aSegment->GetLayer(), 0, aSegment->ViewIsHighlighted() ); m_gal->SetIsFill( false ); m_gal->SetIsStroke( true ); - m_gal->SetStrokeColor( strokeColor ); + m_gal->SetStrokeColor( color ); m_gal->SetLineWidth( aSegment->GetWidth() ); switch( aSegment->GetShape() ) @@ -636,10 +634,29 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment ) break; case S_POLYGON: + { + std::deque pointsList; + + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); + m_gal->SetFillColor( color ); + + m_gal->Save(); + m_gal->Translate( VECTOR2D( aSegment->GetPosition() ) ); + + MODULE* module = aSegment->GetParentModule(); + if( module ) + { + m_gal->Rotate( -module->GetOrientation() * M_PI / 1800.0 ); + } + std::copy( aSegment->GetPolyPoints().begin(), aSegment->GetPolyPoints().end(), std::back_inserter( pointsList ) ); m_gal->DrawPolygon( pointsList ); + + m_gal->Restore(); break; + } case S_CURVE: m_gal->DrawCurve( VECTOR2D( aSegment->GetStart() ),