diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index dc2d589f94..f0544a6fd7 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -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 ); } diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 7c8eeb73a1..573d0cd989 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -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; diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 8ca4daecd8..6581c04839 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -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 ) );