Show lines of zero thickness in GAL
If a line has zero thickness, use the outline thickness to draw it. This avoids having invisible items on the PCB that could still end up in outputs, or "losing" an item by setting thickness to 0. This only affects GAL drawing routines, the PCB data structures are not affected, so any outputs will be the same. Fixes: lp:1501749 * https://bugs.launchpad.net/kicad/+bug/1501749
This commit is contained in:
parent
ec952c9cde
commit
4ffabcc836
|
@ -247,6 +247,18 @@ PCB_PAINTER::PCB_PAINTER( GAL* aGal ) :
|
|||
}
|
||||
|
||||
|
||||
int PCB_PAINTER::getLineThickness( int aActualThickness ) const
|
||||
{
|
||||
// if items have 0 thickness, draw them with the outline
|
||||
// width, otherwise respect the set value (which, no matter
|
||||
// how small will produce something)
|
||||
if( aActualThickness == 0 )
|
||||
return m_pcbSettings.m_outlineWidth;
|
||||
|
||||
return aActualThickness;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
||||
{
|
||||
const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aItem );
|
||||
|
@ -784,7 +796,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
|
|||
if( m_pcbSettings.m_sketchMode[aLayer] )
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); // Outline mode
|
||||
else
|
||||
m_gal->SetLineWidth( aSegment->GetWidth() ); // Filled mode
|
||||
m_gal->SetLineWidth( getLineThickness( aSegment->GetWidth() ) ); // Filled mode
|
||||
|
||||
switch( aSegment->GetShape() )
|
||||
{
|
||||
|
@ -871,7 +883,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
|
|||
else
|
||||
{
|
||||
// Filled mode
|
||||
m_gal->SetLineWidth( aText->GetThickness() );
|
||||
m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) );
|
||||
}
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
@ -899,7 +911,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
|
|||
else
|
||||
{
|
||||
// Filled mode
|
||||
m_gal->SetLineWidth( aText->GetThickness() );
|
||||
m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) );
|
||||
}
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
@ -1021,7 +1033,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
|
|||
m_gal->SetStrokeColor( strokeColor );
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetLineWidth( aDimension->GetWidth() );
|
||||
m_gal->SetLineWidth( getLineThickness( aDimension->GetWidth() ) );
|
||||
|
||||
// Draw an arrow
|
||||
m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_crossBarF ) );
|
||||
|
@ -1050,7 +1062,7 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
|
|||
VECTOR2D position( aTarget->GetPosition() );
|
||||
double size, radius;
|
||||
|
||||
m_gal->SetLineWidth( aTarget->GetWidth() );
|
||||
m_gal->SetLineWidth( getLineThickness( aTarget->GetWidth() ) );
|
||||
m_gal->SetStrokeColor( strokeColor );
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
|
|
|
@ -228,6 +228,15 @@ protected:
|
|||
void draw( const DIMENSION* aDimension, int aLayer );
|
||||
void draw( const PCB_TARGET* aTarget );
|
||||
void draw( const MARKER_PCB* aMarker );
|
||||
|
||||
/**
|
||||
* Function getLineThickness()
|
||||
* Get the thickness to draw for a line (e.g. 0 thickness lines
|
||||
* get a minimum value).
|
||||
* @param aActualThickness line own thickness
|
||||
* @return the thickness to draw
|
||||
*/
|
||||
int getLineThickness( int aActualThickness ) const;
|
||||
};
|
||||
} // namespace KIGFX
|
||||
|
||||
|
|
Loading…
Reference in New Issue