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:
parent
d6312c7b92
commit
263efb41e8
|
@ -226,14 +226,14 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
|
||||||
int delta = (m_Size.x - m_Size.y) / 2;
|
int delta = (m_Size.x - m_Size.y) / 2;
|
||||||
start.x -= delta;
|
start.x -= delta;
|
||||||
end.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;
|
int delta = (m_Size.y - m_Size.x) / 2;
|
||||||
start.y -= delta;
|
start.y -= delta;
|
||||||
end.y += delta;
|
end.y += delta;
|
||||||
radius = m_Size.x;
|
radius = m_Size.x; // Width in fact
|
||||||
}
|
}
|
||||||
|
|
||||||
start = aParent->GetABPosition( start );
|
start = aParent->GetABPosition( start );
|
||||||
|
@ -374,13 +374,10 @@ void D_CODE::ConvertShapeToPolygon()
|
||||||
m_Polygon.Append( VECTOR2I( currpos ) );
|
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.
|
if( m_Size.y > m_Size.x ) // vertical oval, rotate polygon.
|
||||||
{
|
m_Polygon.Rotate( -M_PI / 2, VECTOR2I( 0, 0 ) );
|
||||||
for( auto it = m_Polygon.Iterate( 0 ); it; ++it )
|
|
||||||
it->Rotate( -M_PI / 2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
|
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,6 +680,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
|
||||||
|
|
||||||
aText += 2; // skip "C," for example
|
aText += 2; // skip "C," for example
|
||||||
|
|
||||||
|
// First parameter is the size X:
|
||||||
dcode->m_Size.x = KiROUND( ReadDouble( aText ) * conv_scale );
|
dcode->m_Size.x = KiROUND( ReadDouble( aText ) * conv_scale );
|
||||||
dcode->m_Size.y = dcode->m_Size.x;
|
dcode->m_Size.y = dcode->m_Size.x;
|
||||||
|
|
||||||
|
@ -719,7 +720,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
|
||||||
while( *aText == ' ' )
|
while( *aText == ' ' )
|
||||||
aText++;
|
aText++;
|
||||||
|
|
||||||
if( *aText == 'X' )
|
if( *aText == 'X' ) // Second parameter: size Y
|
||||||
{
|
{
|
||||||
aText++;
|
aText++;
|
||||||
dcode->m_Size.y =
|
dcode->m_Size.y =
|
||||||
|
@ -729,7 +730,7 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
|
||||||
while( *aText == ' ' )
|
while( *aText == ' ' )
|
||||||
aText++;
|
aText++;
|
||||||
|
|
||||||
if( *aText == 'X' )
|
if( *aText == 'X' ) // third parameter: drill size (or drill size X)
|
||||||
{
|
{
|
||||||
aText++;
|
aText++;
|
||||||
dcode->m_Drill.x = KiROUND( ReadDouble( aText ) * conv_scale );
|
dcode->m_Drill.x = KiROUND( ReadDouble( aText ) * conv_scale );
|
||||||
|
@ -740,13 +741,14 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
|
||||||
while( *aText == ' ' )
|
while( *aText == ' ' )
|
||||||
aText++;
|
aText++;
|
||||||
|
|
||||||
if( *aText == 'X' )
|
if( *aText == 'X' ) // fourth parameter: drill size Y
|
||||||
{
|
{
|
||||||
aText++;
|
aText++;
|
||||||
dcode->m_Drill.y =
|
dcode->m_Drill.y =
|
||||||
KiROUND( ReadDouble( aText ) * conv_scale );
|
KiROUND( ReadDouble( aText ) * conv_scale );
|
||||||
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
|
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcode->m_Defined = true;
|
dcode->m_Defined = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
|
||||||
|
|
||||||
msg.Printf( "tool %d [%.3fx%.3f %s] %s",
|
msg.Printf( "tool %d [%.3fx%.3f %s] %s",
|
||||||
dcode->m_Num_Dcode,
|
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,
|
units,
|
||||||
D_CODE::ShowApertureType( dcode->m_Shape )
|
D_CODE::ShowApertureType( dcode->m_Shape )
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue