From aef665b1e26aad539902c894a3fcebd3f6b58d67 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 29 Jan 2022 18:19:22 +0100 Subject: [PATCH] PCB_TARGET: add missing TransformShapeWithClearanceToPolygon() method. Fixes #10653 https://gitlab.com/kicad/code/kicad/issues/10653 --- pcbnew/pcb_target.cpp | 35 ++++++++++++++++++++++++++++++++++- pcbnew/pcb_target.h | 19 ++++++++++++++++++- pcbnew/zone_filler.cpp | 1 + 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/pcbnew/pcb_target.cpp b/pcbnew/pcb_target.cpp index a3515fdc25..d22e76d0b7 100644 --- a/pcbnew/pcb_target.cpp +++ b/pcbnew/pcb_target.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,6 +35,7 @@ #include #include #include +#include PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) : BOARD_ITEM( aParent, PCB_TARGET_T ) @@ -159,6 +160,38 @@ void PCB_TARGET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorSetWidth( GetWidth() ); + item->Move( GetPosition() ); + item->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearanceValue, + aError, aErrorLoc, ignoreLineWidth ); + } +} + + static struct PCB_TARGET_DESC { PCB_TARGET_DESC() diff --git a/pcbnew/pcb_target.h b/pcbnew/pcb_target.h index 02f5bdd5d0..8481e0289e 100644 --- a/pcbnew/pcb_target.h +++ b/pcbnew/pcb_target.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -96,6 +96,23 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; + /** + * Convert the shape to a closed polygon. + * + * Used in filling zones calculations. Circles and arcs are approximated by segments. + * + * @param aCornerBuffer is a buffer to store the polygon. + * @param aClearanceValue is the clearance around the pad. + * @param aError is the maximum deviation from a true arc. + * @param aErrorLoc whether any approximation error shoule be placed inside or outside + * @param ignoreLineWidth is used for edge cut items where the line width is only + * for visualization + */ + void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + PCB_LAYER_ID aLayer, int aClearanceValue, + int aError, ERROR_LOC aErrorLoc, + bool ignoreLineWidth = false ) const override; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } #endif diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 141c406379..8cc8a4dee9 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -561,6 +561,7 @@ void ZONE_FILLER::addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap, case PCB_SHAPE_T: case PCB_TEXT_T: case PCB_FP_SHAPE_T: + case PCB_TARGET_T: aItem->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE, aIgnoreLineWidth ); break;