Gerbview: fix incorrect rendering of oval vertical standard aperture with hole.

Fix also incorrect display of dcode size in toolbal: was Y size  X size.
Now is X size Y size, as expected.
This commit is contained in:
jean-pierre charras 2020-04-10 15:57:02 +02:00
parent 962aa73e12
commit 9e656fe5eb
3 changed files with 10 additions and 11 deletions

View File

@ -224,14 +224,14 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
int delta = (m_Size.x - m_Size.y) / 2;
start.x -= delta;
end.x += delta;
radius = m_Size.y;
radius = m_Size.y; // Width in fact
}
else // horizontal oval
else // vertical oval
{
int delta = (m_Size.y - m_Size.x) / 2;
start.y -= delta;
end.y += delta;
radius = m_Size.x;
radius = m_Size.x; // Width in fact
}
start = aParent->GetABPosition( start );
@ -375,10 +375,7 @@ void D_CODE::ConvertShapeToPolygon()
m_Polygon.Append( VECTOR2I( initialpos ) ); // close outline
if( m_Size.y > m_Size.x ) // vertical oval, rotate polygon.
{
for( auto it = m_Polygon.Iterate( 0 ); it; ++it )
it->Rotate( -M_PI / 2 );
}
m_Polygon.Rotate( -M_PI / 2 );
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
}

View File

@ -687,6 +687,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
aText += 2; // skip "C," for example
// First parameter is the size X:
dcode->m_Size.x = KiROUND( ReadDouble( aText ) * conv_scale );
dcode->m_Size.y = dcode->m_Size.x;
@ -726,7 +727,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
while( *aText == ' ' )
aText++;
if( *aText == 'X' )
if( *aText == 'X' ) // Second parameter: size Y
{
aText++;
dcode->m_Size.y =
@ -736,7 +737,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
while( *aText == ' ' )
aText++;
if( *aText == 'X' )
if( *aText == 'X' ) // third parameter: drill size (or drill size X)
{
aText++;
dcode->m_Drill.x = KiROUND( ReadDouble( aText ) * conv_scale );
@ -747,13 +748,14 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
while( *aText == ' ' )
aText++;
if( *aText == 'X' )
if( *aText == 'X' ) // fourth parameter: drill size Y
{
aText++;
dcode->m_Drill.y =
KiROUND( ReadDouble( aText ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
}
dcode->m_Defined = true;
break;

View File

@ -289,7 +289,7 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
msg.Printf( "tool %d [%.3fx%.3f %s] %s",
dcode->m_Num_Dcode,
dcode->m_Size.y / scale, dcode->m_Size.x / scale,
dcode->m_Size.x / scale, dcode->m_Size.y / scale,
units,
D_CODE::ShowApertureType( dcode->m_Shape )
);