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,
if( aEndType == START )
{
// 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;
/* change the common point coordinate of pt_segm to use the other point
......@@ -639,7 +639,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb,
else // aEndType == END
{
// 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;
/* 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*
* ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
* ElementArc (X Y Width Height StartAngle DeltaAngle Thickness)
* (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" NFlags)
* Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags)
......@@ -369,12 +370,26 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
{
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.y = (ibuf[1] + ibuf[3]) / 2;
Pad->m_Size.x = ibuf[4] + abs( ibuf[0] - ibuf[2] );
Pad->m_Size.y = ibuf[4] + abs( ibuf[1] - ibuf[3] );
Pad->m_Pos.x += m_Pos.x;
Pad->m_Pos.y += m_Pos.y;
Pad->m_Size.x = wxRound( hypot( (double)delta.x, (double)delta.y ) );
Pad->m_Size.y = ibuf[4];
Pad->m_Pos += m_Pos;
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