Fix via printing.

LAYER_VIAS needs to get set for them to print at all, and GetLOD
needs too look at the view layer visibiilties, not the board layer
visibilities.

Also implements a more pad-like strategy for printing blind/buried
vias when printing one layer per page (where the top/bottom arcs
don't make sense).

Fixes https://gitlab.com/kicad/code/kicad/issues/1938

(cherry picked from commit dce42612d3)
This commit is contained in:
Jeff Young 2020-04-20 17:00:00 +01:00
parent faace3090c
commit e5da7a4606
4 changed files with 28 additions and 17 deletions

View File

@ -1034,12 +1034,16 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( IsNetnameLayer( aLayer ) )
return m_Width == 0 ? HIDE : ( Millimeter2iu( 10 ) / m_Width );
LSET visibleLayers;
BOARD* board = GetBoard();
for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
{
if( aView->IsLayerVisible( i ) )
visibleLayers.set( i );
}
// Only draw the via if at least one of the layers it crosses is being displayed
if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any()
&& aView->IsLayerVisible( LAYER_VIAS ) )
if( ( visibleLayers & GetLayerSet() ).any() && aView->IsLayerVisible( LAYER_VIAS ) )
{
switch( m_ViaType )
{

View File

@ -539,7 +539,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
break;
}
if( aVia->GetViaType() == VIA_BLIND_BURIED )
if( aVia->GetViaType() == VIA_BLIND_BURIED && !m_pcbSettings.GetDrawIndividualViaLayers() )
{
// Buried vias are drawn in a special way to indicate the top and bottom layers
PCB_LAYER_ID layerTop, layerBottom;

View File

@ -162,6 +162,9 @@ public:
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }
bool GetDrawIndividualViaLayers() const { return m_drawIndividualViaLayers; }
void SetDrawIndividualViaLayers( bool aFlag ) { m_drawIndividualViaLayers = aFlag; }
protected:
///> Flag determining if items on a given layer should be drawn as an outline or a filled item
bool m_sketchMode[GAL_LAYER_ID_END];
@ -190,6 +193,8 @@ protected:
///> Flag determining if zones should have outlines drawn
bool m_zoneOutlines;
bool m_drawIndividualViaLayers = false;
///> Maximum font size for netnames (and other dynamically shown strings)
static const double MAX_FONT_SIZE;

View File

@ -67,18 +67,18 @@ PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS&
bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
{
// Store the layerset, as it is going to be modified below and the original settings are needed
// Store the layerset, as it is going to be modified below and the original settings are
// needed.
LSET lset = m_settings.m_layerSet;
int pageCount = lset.count();
wxString layer;
PCB_LAYER_ID extractLayer;
// compute layer mask from page number if we want one page per layer
if( m_pcbnewSettings.m_pagination == 0 ) // One page per layer
if( m_pcbnewSettings.m_pagination == PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE )
{
// This sequence is TBD, call a different
// sequencer if needed, such as Seq(). Could not find documentation on
// page order.
// This sequence is TBD, call a different sequencer if needed, such as Seq().
// Could not find documentation on page order.
LSEQ seq = lset.UIOrder();
// aPage starts at 1, not 0
@ -133,8 +133,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView
if( ( aLayerSet & LSET::AllCuMask() ).any() ) // Items visible on any copper layer
{
// Enable items on copper layers, but do not draw holes
for( auto item : { LAYER_PADS_TH, LAYER_VIA_MICROVIA,
LAYER_VIA_BBLIND, LAYER_VIA_THROUGH } )
for( GAL_LAYER_ID item : { LAYER_PADS_TH, LAYER_VIAS } )
{
aView->SetLayerVisible( item, true );
}
@ -142,21 +141,21 @@ void PCBNEW_PRINTOUT::setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView
if( m_pcbnewSettings.m_drillMarks != PCBNEW_PRINTOUT_SETTINGS::NO_DRILL_SHAPE )
{
// Enable hole layers to draw drill marks
for( auto holeLayer : { LAYER_PADS_PLATEDHOLES,
LAYER_NON_PLATEDHOLES, LAYER_VIAS_HOLES })
for( GAL_LAYER_ID holeLayer : { LAYER_PADS_PLATEDHOLES, LAYER_NON_PLATEDHOLES,
LAYER_VIAS_HOLES } )
{
aView->SetLayerVisible( holeLayer, true );
aView->SetTopLayer( holeLayer, true );
}
}
}
// Keep certain items always enabled/disabled and just rely on the layer visibility
const int alwaysEnabled[] = {
LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_BK, LAYER_MOD_FR, LAYER_MOD_BK,
LAYER_MOD_VALUES, LAYER_MOD_REFERENCES, LAYER_TRACKS
LAYER_MOD_VALUES, LAYER_MOD_REFERENCES, LAYER_TRACKS,
LAYER_VIA_MICROVIA, LAYER_VIA_BBLIND, LAYER_VIA_THROUGH
};
for( int item : alwaysEnabled )
@ -168,7 +167,7 @@ void PCBNEW_PRINTOUT::setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPain
{
BOARD_PRINTOUT::setupPainter( aPainter );
auto painter = static_cast<KIGFX::PCB_PRINT_PAINTER*>( aPainter.get() );
KIGFX::PCB_PRINT_PAINTER* painter = static_cast<KIGFX::PCB_PRINT_PAINTER*>( aPainter.get() );
switch( m_pcbnewSettings.m_drillMarks )
{
@ -185,6 +184,9 @@ void PCBNEW_PRINTOUT::setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPain
break;
}
painter->GetSettings()->SetDrawIndividualViaLayers(
m_pcbnewSettings.m_pagination == PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE );
painter->GetSettings()->SetLayerColor( LAYER_PADS_PLATEDHOLES, COLOR4D::WHITE );
painter->GetSettings()->SetLayerColor( LAYER_NON_PLATEDHOLES, COLOR4D::WHITE );
painter->GetSettings()->SetLayerColor( LAYER_VIAS_HOLES, COLOR4D::WHITE );