← Back to team overview

kicad-developers team mailing list archive

[PATCH] Draw zone hatching in GAL

 

Hi,

Here's a patch to draw the zone hatching in GAL.

The hatching is already contained within the ZONE_CONTAINER objects,
so this patch just regenerates the hatching at opportune times, and
renders it when the zone is drawn.

Cheers,

John
From 9c9a512d0490c9b7776c4f54b625cd42acfbe070 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
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 ++
 3 files changed, 9 insertions(+)

diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 24fa470f1..b0b170a8c 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 fea754ecd..5bb24a429 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<PCB_EDIT_FRAME*>( m_frame )->Fill_Zone( zone.get() );
diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp
index 7e91c7626..b62e30528 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;
     }
 
-- 
2.11.0


Follow ups