Fixed oval pads highlighting in mark collisions mode (PNS).

This commit is contained in:
Maciej Suminski 2015-08-10 17:50:10 +02:00
parent 7a51a502b4
commit 65ebfe12c1
3 changed files with 14 additions and 13 deletions

View File

@ -49,17 +49,17 @@ public:
const BOX2I BBox( int aClearance = 0 ) const 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 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 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 ) void SetSeg( const SEG& aSeg )

View File

@ -224,7 +224,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
switch( aPad->GetShape() ) switch( aPad->GetShape() )
{ {
case PAD_OVAL: case PAD_OVAL:
if( sz.x == sz.y ) if( sz.x == sz.y )
solid->SetShape( new SHAPE_CIRCLE( c, sz.x / 2 ) ); solid->SetShape( new SHAPE_CIRCLE( c, sz.x / 2 ) );
@ -251,8 +250,8 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
{ {
wxPoint coords[4]; wxPoint coords[4];
aPad->BuildPadPolygon( coords, wxSize( 0, 0 ), aPad->GetOrientation() ); aPad->BuildPadPolygon( coords, wxSize( 0, 0 ), aPad->GetOrientation() );
SHAPE_CONVEX* shape = new SHAPE_CONVEX(); SHAPE_CONVEX* shape = new SHAPE_CONVEX();
for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ )
{ {
shape->Append( wx_c + coords[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 ) ); int w = aPad->BuildSegmentFromOvalShape( start, end, 0.0, wxSize( 0, 0 ) );
if( start.y == 0 ) if( start.y == 0 )
corner = wxPoint( start.x, -(w / 2) ); corner = wxPoint( start.x, -( w / 2 ) );
else else
corner = wxPoint( w / 2, start.y ); corner = wxPoint( w / 2, start.y );
RotatePoint( &start, aPad->GetOrientation() ); RotatePoint( &start, aPad->GetOrientation() );
RotatePoint( &corner, aPad->GetOrientation() ); RotatePoint( &corner, aPad->GetOrientation() );
shape->Append( wx_c + corner ); shape->Append( wx_c + corner );
@ -305,7 +305,8 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
if( end.y == 0 ) if( end.y == 0 )
corner = wxPoint( end.x, w / 2 ); corner = wxPoint( end.x, w / 2 );
else else
corner = wxPoint( -(w / 2), end.y ); corner = wxPoint( -( w / 2 ), end.y );
RotatePoint( &end, aPad->GetOrientation() ); RotatePoint( &end, aPad->GetOrientation() );
RotatePoint( &corner, aPad->GetOrientation() ); RotatePoint( &corner, aPad->GetOrientation() );
shape->Append( wx_c + corner ); shape->Append( wx_c + corner );

View File

@ -166,15 +166,15 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
if( m_type == PR_SHAPE ) if( m_type == PR_SHAPE )
{ {
if( !m_shape )
return;
aGal->SetLineWidth( m_width ); aGal->SetLineWidth( m_width );
aGal->SetStrokeColor( m_color ); aGal->SetStrokeColor( m_color );
aGal->SetFillColor( m_color ); aGal->SetFillColor( m_color );
aGal->SetIsStroke( m_width ? true : false ); aGal->SetIsStroke( m_width ? true : false );
aGal->SetIsFill( true ); aGal->SetIsFill( true );
if( !m_shape )
return;
switch( m_shape->Type() ) switch( m_shape->Type() )
{ {
case SH_LINE_CHAIN: case SH_LINE_CHAIN:
@ -187,14 +187,14 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
case SH_SEGMENT: case SH_SEGMENT:
{ {
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape; 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 ) if( m_clearance > 0 )
{ {
aGal->SetLayerDepth( ClearanceOverlayDepth ); aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) ); aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetLineWidth( m_width + 2 * m_clearance ); aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B ); aGal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance );
} }
break; break;