From 796f3219d07fe25ba08bf49124d16173665b43b7 Mon Sep 17 00:00:00 2001 From: John Beard Date: Fri, 24 Feb 2017 20:26:25 +0800 Subject: [PATCH] Draw zone hatching in GAL This just uses the same hatch lines that are built into the zone as legacy. They are always drawn, even when there is a fill, as if the fill doesn't reach the corners, the hatches can be seen. Fixes: lp:1487043 * https://bugs.launchpad.net/kicad/+bug/1487043 --- pcbnew/pcb_painter.cpp | 6 ++++++ pcbnew/tools/drawing_tool.cpp | 1 + pcbnew/tools/point_editor.cpp | 2 ++ pcbnew/zones_by_polygon.cpp | 8 +++++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 24fa470f1a..b0b170a8c0 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -966,6 +966,12 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone ) m_gal->DrawPolyline( corners ); corners.clear(); } + + for( unsigned ic = 0; ic < polygon->m_HatchLines.size(); ic++ ) + { + auto& hatchLine = polygon->m_HatchLines[ic]; + m_gal->DrawLine( hatchLine.m_Start, hatchLine.m_End ); + } } // Draw the filling diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index fea754ecdc..5bb24a429c 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1440,6 +1440,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode ) zone->Outline()->CloseLastContour(); zone->Outline()->RemoveNullSegments(); + zone->Outline()->Hatch(); if( !aKeepout ) static_cast( m_frame )->Fill_Zone( zone.get() ); diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 7e91c76263..b62e305281 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -469,6 +469,8 @@ void POINT_EDITOR::updateItem() const outline->SetY( i, point.y ); } + outline->Hatch(); + break; } diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index a29fd80986..4f8332c8ac 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -854,7 +855,6 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, zone->DrawWhileCreateOutline( aPanel, aDC ); } - void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) { ZONE_EDIT_T edited; @@ -914,6 +914,11 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) { ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii ); edge_zone->Draw( m_canvas, DC, GR_XOR ); + + if( IsGalCanvasActive() ) + { + GetGalCanvas()->GetView()->Update( edge_zone ); + } } zoneInfo.ExportSetting( *aZone ); @@ -929,6 +934,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) // Redraw the real new zone outlines GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, UNDEFINED_LAYER ); + UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); commit.Stage( s_PickedList ); commit.Push( _( "Modify zone properties" ) );