Simplify shape building logic.

Fixes https://gitlab.com/kicad/code/kicad/issues/6244
This commit is contained in:
Jeff Young 2020-10-31 21:00:40 +00:00
parent fbcbed5543
commit a0060086b0
2 changed files with 8 additions and 23 deletions

View File

@ -371,25 +371,16 @@ void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
std::vector<SHAPE*> DIMENSION::MakeEffectiveShapes() const
{
std::vector<SHAPE*> effectiveShapes;
std::shared_ptr<SHAPE_COMPOUND> ets = Text().GetEffectiveTextShape();
for( const SHAPE* shape : ets->Shapes() )
effectiveShapes.emplace_back( shape->Clone() );
for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
effectiveShapes.emplace_back( shape->Clone() );
return effectiveShapes;
}
std::shared_ptr<SHAPE> DIMENSION::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
return std::make_shared<SHAPE_COMPOUND>( MakeEffectiveShapes() );
std::shared_ptr<SHAPE_COMPOUND> effectiveShape = std::make_shared<SHAPE_COMPOUND>();
effectiveShape->AddShape( Text().GetEffectiveTextShape()->Clone() );
for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
effectiveShape->AddShape( shape->Clone() );
return effectiveShape;
}

View File

@ -224,12 +224,6 @@ public:
*/
const std::vector<std::shared_ptr<SHAPE>>& 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<SHAPE*> MakeEffectiveShapes() const;
// BOARD_ITEM overrides
void Move( const wxPoint& offset ) override;