Browse Source

Fixed a bug with invisible vias

If there was a board with no copper layers checked as visible, the
initial GAL cache contained an empty entry for them. In such case,
toggling layers visibility have not changed anything.

The visibility condition check has been moved to ViewGetLOD() method
which serves better the purpose of dynamic visibility checks.

Fixes: lp:1639974
* https://bugs.launchpad.net/kicad/+bug/1639974
pull/3/merge
Maciej Suminski 9 years ago
parent
commit
e53c3afc29
  1. 12
      pcbnew/class_track.cpp
  2. 3
      pcbnew/class_track.h
  3. 5
      pcbnew/pcb_painter.cpp

12
pcbnew/class_track.cpp

@ -1018,6 +1018,18 @@ void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
}
unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
BOARD* board = GetBoard();
// Only draw the via if at least one of the layers it crosses is being displayed
if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any() )
return 0;
return std::numeric_limits<unsigned int>::max();
}
// see class_track.h
void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{

3
pcbnew/class_track.h

@ -434,6 +434,9 @@ public:
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
/// @copydoc VIEW_ITEM::ViewGetLOD()
virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
virtual void Flip( const wxPoint& aCentre ) override;
#if defined (DEBUG)

5
pcbnew/pcb_painter.cpp

@ -393,11 +393,6 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
VECTOR2D center( aVia->GetStart() );
double radius = 0.0;
// Only draw the via if at least one of the layers it crosses is being displayed
BOARD* brd = aVia->GetBoard( );
if( !( brd->GetVisibleLayers() & aVia->GetLayerSet() ).any() )
return;
// Choose drawing settings depending on if we are drawing via's pad or hole
if( aLayer == LAYER_VIAS_HOLES )
radius = aVia->GetDrillValue() / 2.0;

Loading…
Cancel
Save