Gerbview: fix incorrect initialization of WorldUnitLength.

Fix incorrect min zoom level to show D Code texts.
This commit is contained in:
jean-pierre charras 2018-11-20 10:22:45 +01:00
parent c016861962
commit 73b52f2e23
5 changed files with 9 additions and 3 deletions

View File

@ -46,6 +46,8 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
SetLookAtPoint( VECTOR2D( 0, 0 ) );
SetZoomFactor( 1.0 );
SetRotation( 0.0 );
// this value for SetWorldUnitLength is only suitable for Pcbnew.
// Other editors/viewer must call SetWorldUnitLength with their internal units
SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
// wxDC::GetPPI() reports 96 DPI, but somehow this value
// is the closest match to the legacy renderer

View File

@ -958,7 +958,7 @@ unsigned int GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) cons
// the level of details is chosen experimentally, to show
// only a readable text:
const int level = Millimeter2iu( 500 );
const int level = Millimeter2iu( 4 );
return ( level / ( size + 1 ) );
}

View File

@ -39,6 +39,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
{
m_view = new KIGFX::VIEW( true );
m_view->SetGAL( m_gal );
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
m_painter.reset( new KIGFX::GERBVIEW_PAINTER( m_gal ) );
m_view->SetPainter( m_painter.get() );
@ -116,6 +117,9 @@ bool GERBVIEW_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
{
bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
setDefaultLayerDeps();
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
return rv;
}

View File

@ -214,7 +214,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
m_gal->SetIsFill( false );
m_gal->SetStrokeColor( color );
m_gal->SetFillColor( COLOR4D( 0, 0, 0, 0 ) );
m_gal->SetLineWidth( 2 );
m_gal->SetLineWidth( textSize/10 );
m_gal->SetFontBold( false );
m_gal->SetFontItalic( false );
m_gal->SetTextMirrored( false );

View File

@ -107,7 +107,7 @@ void GERBVIEW_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aVi
void GERBVIEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
{
BOARD_PRINTOUT::setupGal( aGal );
aGal->SetWorldUnitLength( 10e-9 /* 10 nm */ / 0.0254 /* 1 inch in meters */ );
aGal->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
}