From 74ad1562d988c2371e68951a70bce764330ebdc4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 14 Nov 2020 14:14:34 +0000 Subject: [PATCH] Make FP_SHAPE GetEffectiveShape() relative to board, not footprint. --- pcbnew/fp_shape.cpp | 11 +++++++++++ pcbnew/fp_shape.h | 5 +++++ pcbnew/pcb_shape.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pcbnew/fp_shape.cpp b/pcbnew/fp_shape.cpp index e30a73b338..e9e6f49bb4 100644 --- a/pcbnew/fp_shape.cpp +++ b/pcbnew/fp_shape.cpp @@ -106,6 +106,17 @@ void FP_SHAPE::SetDrawCoord() } +std::shared_ptr FP_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +{ + std::vector shapes = MakeEffectiveShapes(); + + for( SHAPE* shape : shapes ) + shape->Move( m_Parent->GetPosition() ); + + return std::make_shared( shapes ); +} + + // see class_edge_mod.h void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { diff --git a/pcbnew/fp_shape.h b/pcbnew/fp_shape.h index 5d86c90462..440e169136 100644 --- a/pcbnew/fp_shape.h +++ b/pcbnew/fp_shape.h @@ -130,6 +130,11 @@ public: */ void SetDrawCoord(); + /** + * Makes a set of SHAPE objects representing the FP_SHAPE. Caller owns the objects. + */ + std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; + void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; wxString GetClass() const override diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index 06cf45aa9d..832339edfc 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -285,7 +285,7 @@ public: * Makes a set of SHAPE objects representing the PCB_SHAPE. Caller owns the objects. */ std::vector MakeEffectiveShapes() const; // fixme: move to shape_compound - virtual std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; + std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;