Add comments. Gerbview: in legacy mode, do not display D_Code id text when it is too small to be readable.
This commit is contained in:
parent
cabc92bd48
commit
e14a1656db
|
@ -430,10 +430,18 @@ void GBR_LAYOUT::DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
width /= 2;
|
width /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGraphicText( aPanel->GetClipBox(), aDC, pos, aDrawColor, Line,
|
// Avoid to draw text, if it is too small (size in pixel < 5 pixels)
|
||||||
orient, wxSize( width, width ),
|
// to be readable:
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
int size_pixel = aDC->LogicalToDeviceXRel( width );
|
||||||
0, false, false );
|
const int threshold = 5;
|
||||||
|
|
||||||
|
if( size_pixel >= threshold )
|
||||||
|
{
|
||||||
|
DrawGraphicText( aPanel->GetClipBox(), aDC, pos, aDrawColor, Line,
|
||||||
|
orient, wxSize( width, width ),
|
||||||
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
|
0, false, false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,9 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
case GBR_SPOT_MACRO:
|
case GBR_SPOT_MACRO:
|
||||||
{
|
{
|
||||||
|
// Update the shape drawings and the bounding box coordiantes:
|
||||||
code->GetMacro()->GetApertureMacroShape( this, m_Start );
|
code->GetMacro()->GetApertureMacroShape( this, m_Start );
|
||||||
|
// now the bounding box is valid:
|
||||||
bbox = code->GetMacro()->GetBoundingBox();
|
bbox = code->GetMacro()->GetBoundingBox();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -781,7 +783,10 @@ const BOX2I GERBER_DRAW_ITEM::ViewBBox() const
|
||||||
|
|
||||||
unsigned int GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
unsigned int GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
{
|
{
|
||||||
// DCodes will be shown only if zoom is appropriate
|
// DCodes will be shown only if zoom is appropriate:
|
||||||
|
// Returns the level of detail of the item.
|
||||||
|
// A level of detail (LOD) is the minimal VIEW scale that
|
||||||
|
// is sufficient for an item to be shown on a given layer.
|
||||||
if( IsDCodeLayer( aLayer ) )
|
if( IsDCodeLayer( aLayer ) )
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -800,7 +805,10 @@ unsigned int GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) cons
|
||||||
size = m_Size.x;
|
size = m_Size.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( 100000000 / ( size + 1 ) );
|
// the level of details is chosen experimentally, to show
|
||||||
|
// only a readable text:
|
||||||
|
const int level = Millimeter2iu( 1000 );
|
||||||
|
return ( level / ( size + 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other layers are shown without any conditions
|
// Other layers are shown without any conditions
|
||||||
|
|
|
@ -128,8 +128,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ViewGetLOD()
|
* Function ViewGetLOD()
|
||||||
* Returns the level of detail of the item. A level of detail is the minimal VIEW scale that
|
* Returns the level of detail (LOD) of the item.
|
||||||
|
* A level of detail is the minimal VIEW scale that
|
||||||
* is sufficient for an item to be shown on a given layer.
|
* is sufficient for an item to be shown on a given layer.
|
||||||
|
* @param aLayer: current drawing layer
|
||||||
|
* @param aView: pointer to the VIEW device we are drawing on
|
||||||
|
* @return the level of detail. 0 always show the item, because the
|
||||||
|
* actual zoom level (or VIEW scale) is always > 0
|
||||||
*/
|
*/
|
||||||
virtual unsigned int ViewGetLOD( int aLayer, VIEW* aView ) const
|
virtual unsigned int ViewGetLOD( int aLayer, VIEW* aView ) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue