From a0060086b0440eff85942b5a62a5d33961545a7f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 31 Oct 2020 21:00:40 +0000 Subject: [PATCH] Simplify shape building logic. Fixes https://gitlab.com/kicad/code/kicad/issues/6244 --- pcbnew/class_dimension.cpp | 25 ++++++++----------------- pcbnew/class_dimension.h | 6 ------ 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 8da80269ae..c4d85a085f 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -371,25 +371,16 @@ void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector DIMENSION::MakeEffectiveShapes() const -{ - std::vector effectiveShapes; - - std::shared_ptr ets = Text().GetEffectiveTextShape(); - - for( const SHAPE* shape : ets->Shapes() ) - effectiveShapes.emplace_back( shape->Clone() ); - - for( const std::shared_ptr& shape : GetShapes() ) - effectiveShapes.emplace_back( shape->Clone() ); - - return effectiveShapes; -} - - std::shared_ptr DIMENSION::GetEffectiveShape( PCB_LAYER_ID aLayer ) const { - return std::make_shared( MakeEffectiveShapes() ); + std::shared_ptr effectiveShape = std::make_shared(); + + effectiveShape->AddShape( Text().GetEffectiveTextShape()->Clone() ); + + for( const std::shared_ptr& shape : GetShapes() ) + effectiveShape->AddShape( shape->Clone() ); + + return effectiveShape; } diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index ea3f7311f6..1a9838d689 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -224,12 +224,6 @@ public: */ const std::vector>& GetShapes() const { return m_shapes; } - /** - * @return create a caller-owned list of *all* shapes (including any text). - * Used for collision calculations (DRC, PNS, etc.). - */ - std::vector MakeEffectiveShapes() const; - // BOARD_ITEM overrides void Move( const wxPoint& offset ) override;