Commit 2ae221d9 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix Bug #899373

parent a37fdd97
...@@ -620,7 +620,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, ...@@ -620,7 +620,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb,
if( aEndType == START ) if( aEndType == START )
{ {
// We must not have a pad, which is a always terminal point for a track // We must not have a pad, which is a always terminal point for a track
if( aPcb->GetPadFast( aTrackRef->m_Start, g_TabOneLayerMask[aTrackRef->GetLayer()] ) ) if( aPcb->GetPadFast( aTrackRef->m_Start, aTrackRef->ReturnMaskLayer() ) )
return NULL; return NULL;
/* change the common point coordinate of pt_segm to use the other point /* change the common point coordinate of pt_segm to use the other point
...@@ -639,7 +639,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, ...@@ -639,7 +639,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb,
else // aEndType == END else // aEndType == END
{ {
// We must not have a pad, which is a always terminal point for a track // We must not have a pad, which is a always terminal point for a track
if( aPcb->GetPadFast( aTrackRef->m_End, g_TabOneLayerMask[aTrackRef->GetLayer()] ) ) if( aPcb->GetPadFast( aTrackRef->m_End, aTrackRef->ReturnMaskLayer() ) )
return NULL; return NULL;
/* change the common point coordinate of pt_segm to use the other point /* change the common point coordinate of pt_segm to use the other point
......
...@@ -78,6 +78,7 @@ static bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* ...@@ -78,6 +78,7 @@ static bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar*
* ElementArc [X Y Width Height StartAngle DeltaAngle Thickness] * ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
* ElementArc (X Y Width Height StartAngle DeltaAngle Thickness) * ElementArc (X Y Width Height StartAngle DeltaAngle Thickness)
* (rotation in clockwise) * (rotation in clockwise)
* ( Note: Pad is a SMD Pad in Pcbnew, and Pin is a through hole Pad in Pcbnew )
* Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags] * Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags]
* Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags) * Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags)
* Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags) * Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags)
...@@ -333,7 +334,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -333,7 +334,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
if( params[0].CmpNoCase( wxT( "Pad" ) ) == 0 ) // Pad with no hole (smd pad) if( params[0].CmpNoCase( wxT( "Pad" ) ) == 0 ) // Pad with no hole (smd pad)
{ // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags] { // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags]
Pad = new D_PAD( this ); Pad = new D_PAD( this );
Pad->m_PadShape = PAD_RECT; Pad->m_PadShape = PAD_RECT;
Pad->m_layerMask = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT; Pad->m_layerMask = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT;
// Set shape from flags // Set shape from flags
...@@ -369,12 +370,26 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -369,12 +370,26 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
{ {
Pad->SetPadName( params[10] ); Pad->SetPadName( params[10] );
} }
// Calculate the Pad parameters.
// In Pcb the shape is a segment
// ibuf[0], ibuf[1] is the start point of the segment
// ibuf[2], ibuf[3] is the end point of the segment
// and me must convert the segment to an oval ( or rectangular) pad
// Pad pos = middle of the segment
// Pad Orientation = angle of the segment
// Pad size = lenght and thickness of the segment
wxPoint delta;
delta.x = ibuf[2] - ibuf[0];
delta.y = ibuf[3] - ibuf[1];
double angle = atan2( (double)delta.y, (double)delta.x );
// Negate angle (due to Y reversed axis) and convert it to internal units
angle = - angle * 1800.0 / M_PI;
Pad->SetOrientation( wxRound( angle ) );
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2; Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2; Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
Pad->m_Size.x = ibuf[4] + abs( ibuf[0] - ibuf[2] ); Pad->m_Size.x = wxRound( hypot( (double)delta.x, (double)delta.y ) );
Pad->m_Size.y = ibuf[4] + abs( ibuf[1] - ibuf[3] ); Pad->m_Size.y = ibuf[4];
Pad->m_Pos.x += m_Pos.x; Pad->m_Pos += m_Pos;
Pad->m_Pos.y += m_Pos.y;
if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) ) if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment