← Back to team overview

kicad-developers team mailing list archive

Re: Display issue with blind/buried vias

 

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.

On Tue, 2014-07-22 at 18:11 -0400, Andrew Zonenberg wrote:
> When viewing the board with some layers turned off, it seems logical to
> only draw those vias which cross the layer(s) that are being drawn. As
> of now, for example, layer 1-2 blind vias are drawn when both layers 1
> and 2 are disabled.
> 
> This occurs in both GAL and legacy views.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

-- 
Andrew Zonenberg
PhD student, security group
Computer Science Department
Rensselaer Polytechnic Institute
http://colossus.cs.rpi.edu/~azonenberg/
=== 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-22 23:37:59 +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-22 22:56:28 +0000
@@ -786,6 +786,16 @@
     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
+    bool hit = false;
+    for(LAYER_NUM layer = m_Layer; layer <= m_BottomLayer; layer ++)
+    {
+		if(brd->IsLayerVisible((LAYER_ID)layer) == true)
+			hit = true;
+	}
+	if(!hit)
+		return;
 
     if( DisplayOpt.ContrastModeDisplay )
     {

=== modified file 'pcbnew/pcb_painter.cpp'
--- pcbnew/pcb_painter.cpp	2014-07-21 10:54:58 +0000
+++ pcbnew/pcb_painter.cpp	2014-07-22 23:39:11 +0000
@@ -335,6 +335,19 @@
 {
     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( );
+    bool hit = false;
+    LAYER_ID top, bottom;
+    aVia->LayerPair(&top, &bottom);
+    for(LAYER_NUM layer = top; layer <= bottom; layer ++)
+    {
+		if(brd->IsLayerVisible((LAYER_ID)layer) == true)
+			hit = true;
+	}
+	if(!hit)
+		return;
 
     // Choose drawing settings depending on if we are drawing via's pad or hole
     if( aLayer == ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) )

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References