← Back to team overview

kicad-developers team mailing list archive

Re: Display issue with blind/buried vias

 

On 07/22/2014 06:43 PM, Andrew Zonenberg wrote:
> Proposed fix attached.
> 
> With this patch, vias are displayed if
> a) via display is turned on, and
> b) at least one of the layers the via crosses is displayed.

Hi Andrew,

Thanks for the idea and the patch.  The patch has tabs in it and trailing whitespace.
So its best not to fight your text editor in this way.  The human will always forget.
Simply change your editor's settings instead.


I'd also like not expose the "for loops", but rather use VIA::GetLayerSet() which has
capabilities for caching in the future and hides information in general.


Please try the attached patch instead, and notice any formatting differences.


Dick


=== modified file 'pcbnew/class_pcb_layer_widget.cpp'
--- pcbnew/class_pcb_layer_widget.cpp	2014-07-20 17:41:12 +0000
+++ pcbnew/class_pcb_layer_widget.cpp	2014-07-23 14:21:05 +0000
@@ -413,6 +413,7 @@
     {
         KIGFX::VIEW* view = galCanvas->GetView();
         view->SetLayerVisible( aLayer, isVisible );
+        view->RecacheAllItems( true );
     }
 
     if( isFinal )

=== modified file 'pcbnew/class_track.cpp'
--- pcbnew/class_track.cpp	2014-06-30 05:46:18 +0000
+++ pcbnew/class_track.cpp	2014-07-23 14:28:15 +0000
@@ -393,17 +393,12 @@
 
     // VIA_BLIND_BURIED or VIA_MICRVIA:
 
-    LAYER_ID bottom_layer, top_layer;
-
-    // LayerPair() knows how layers are stored
-    LayerPair( &top_layer, &bottom_layer );
-
     LSET layermask;
 
-    wxASSERT( top_layer <= bottom_layer );
+    wxASSERT( m_Layer <= m_BottomLayer );
 
     // LAYER_IDs are numbered from front to back, this is top to bottom.
-    for( LAYER_NUM id = top_layer;  id <= bottom_layer;  ++id )
+    for( LAYER_NUM id = m_Layer;  id <= m_BottomLayer;  ++id )
     {
         layermask.set( id );
     }
@@ -780,13 +775,17 @@
 
     GRSetDrawMode( aDC, aDrawMode );
 
-    BOARD * brd =  GetBoard( );
-    EDA_COLOR_T color = brd->GetVisibleElementColor(VIAS_VISIBLE + GetViaType());
+    BOARD * brd =  GetBoard();
+    EDA_COLOR_T color = brd->GetVisibleElementColor( VIAS_VISIBLE + GetViaType() );
 
     if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + GetViaType()) ) == false
         && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
         return;
 
+    // Only draw the via if at least one of the layers it crosses is being displayed
+    if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
+        return;
+
     if( DisplayOpt.ContrastModeDisplay )
     {
         if( !IsOnLayer( curr_layer ) )

=== modified file 'pcbnew/pcb_painter.cpp'
--- pcbnew/pcb_painter.cpp	2014-07-21 10:54:58 +0000
+++ pcbnew/pcb_painter.cpp	2014-07-23 14:27:48 +0000
@@ -336,6 +336,11 @@
     VECTOR2D center( aVia->GetStart() );
     double   radius;
 
+    // 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 == ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) )
     {


Follow ups

References