diff --git a/include/geometry/shape_segment.h b/include/geometry/shape_segment.h index 94e9c5a93a..217368e72f 100644 --- a/include/geometry/shape_segment.h +++ b/include/geometry/shape_segment.h @@ -49,17 +49,17 @@ public: const BOX2I BBox( int aClearance = 0 ) const { - return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + (m_width + 1) / 2 ); + return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + ( m_width + 1 ) / 2 ); } bool Collide( const SEG& aSeg, int aClearance = 0 ) const { - return m_seg.Distance( aSeg ) < (m_width + 1) / 2 + aClearance; + return m_seg.Distance( aSeg ) < ( m_width + 1 ) / 2 + aClearance; } bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const { - return m_seg.Distance( aP ) <= (m_width + 1) / 2 + aClearance; + return m_seg.Distance( aP ) <= ( m_width + 1 ) / 2 + aClearance; } void SetSeg( const SEG& aSeg ) diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 3b3fa6ff1a..d72fd61234 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -224,7 +224,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) switch( aPad->GetShape() ) { - case PAD_OVAL: if( sz.x == sz.y ) solid->SetShape( new SHAPE_CIRCLE( c, sz.x / 2 ) ); @@ -251,8 +250,8 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) { wxPoint coords[4]; aPad->BuildPadPolygon( coords, wxSize( 0, 0 ), aPad->GetOrientation() ); - SHAPE_CONVEX* shape = new SHAPE_CONVEX(); + for( int ii = 0; ii < 4; ii++ ) { shape->Append( wx_c + coords[ii] ); @@ -288,9 +287,10 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) int w = aPad->BuildSegmentFromOvalShape( start, end, 0.0, wxSize( 0, 0 ) ); if( start.y == 0 ) - corner = wxPoint( start.x, -(w / 2) ); + corner = wxPoint( start.x, -( w / 2 ) ); else corner = wxPoint( w / 2, start.y ); + RotatePoint( &start, aPad->GetOrientation() ); RotatePoint( &corner, aPad->GetOrientation() ); shape->Append( wx_c + corner ); @@ -305,7 +305,8 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) if( end.y == 0 ) corner = wxPoint( end.x, w / 2 ); else - corner = wxPoint( -(w / 2), end.y ); + corner = wxPoint( -( w / 2 ), end.y ); + RotatePoint( &end, aPad->GetOrientation() ); RotatePoint( &corner, aPad->GetOrientation() ); shape->Append( wx_c + corner ); diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index 27993ab8ed..c6fda53fbd 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -166,15 +166,15 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const if( m_type == PR_SHAPE ) { + if( !m_shape ) + return; + aGal->SetLineWidth( m_width ); aGal->SetStrokeColor( m_color ); aGal->SetFillColor( m_color ); aGal->SetIsStroke( m_width ? true : false ); aGal->SetIsFill( true ); - if( !m_shape ) - return; - switch( m_shape->Type() ) { case SH_LINE_CHAIN: @@ -187,14 +187,14 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const case SH_SEGMENT: { const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape; - aGal->DrawLine( s->GetSeg().A, s->GetSeg().B ); + aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() ); if( m_clearance > 0 ) { aGal->SetLayerDepth( ClearanceOverlayDepth ); aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) ); - aGal->SetLineWidth( m_width + 2 * m_clearance ); - aGal->DrawLine( s->GetSeg().A, s->GetSeg().B ); + aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) ); + aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance ); } break;