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.

From master branch
This commit is contained in:
jean-pierre charras 2020-04-10 15:57:02 +02:00
parent d6312c7b92
commit 263efb41e8
3 changed files with 11 additions and 12 deletions

View File

@ -226,14 +226,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 );
@ -374,13 +374,10 @@ void D_CODE::ConvertShapeToPolygon()
m_Polygon.Append( VECTOR2I( currpos ) );
}
m_Polygon.Append( VECTOR2I( initialpos ) ); // close outline
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, VECTOR2I( 0, 0 ) );
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
}

View File

@ -680,6 +680,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;
@ -719,7 +720,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 =
@ -729,7 +730,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 );
@ -740,13 +741,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

@ -383,7 +383,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 )
);