From 9622cf8ff1bf6a1f25e152212636cf3f60467414 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 9 Sep 2025 09:43:50 +0200 Subject: [PATCH] SCH_BITMAP, SCH_TABLE: add missing HitTest(SHAPE_LINE_CHAIN& aPoly, ...) Fixes https://gitlab.com/kicad/code/kicad/-/issues/21669 --- eeschema/sch_bitmap.cpp | 7 +++++++ eeschema/sch_bitmap.h | 1 + eeschema/sch_table.cpp | 7 +++++++ eeschema/sch_table.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 08f013d892..2d362ee793 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -159,6 +159,13 @@ bool SCH_BITMAP::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) c } +bool SCH_BITMAP::HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const +{ + return KIGEOM::BoxHitTest( aPoly, GetBoundingBox(), aContained ); +} + + + void SCH_BITMAP::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) { diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 7c7d0440f7..596b554a87 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -100,6 +100,7 @@ public: bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override; + bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override; void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override; diff --git a/eeschema/sch_table.cpp b/eeschema/sch_table.cpp index a461c3564b..41a4e33484 100644 --- a/eeschema/sch_table.cpp +++ b/eeschema/sch_table.cpp @@ -33,6 +33,7 @@ #include #include #include +#include SCH_TABLE::SCH_TABLE( int aLineWidth ) : @@ -327,6 +328,12 @@ bool SCH_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co } +bool SCH_TABLE::HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const +{ + return KIGEOM::BoxHitTest( aPoly, GetBoundingBox(), aContained ); +} + + void SCH_TABLE::DrawBorders( const std::function& aCallback ) const { diff --git a/eeschema/sch_table.h b/eeschema/sch_table.h index d854bca224..2822a5e9c2 100644 --- a/eeschema/sch_table.h +++ b/eeschema/sch_table.h @@ -214,8 +214,8 @@ public: std::vector ViewGetLayers() const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; - bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override; + bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override; void DrawBorders( const std::function& aCallback ) const;