Implement GetEffectiveShape for groups.

Fixes https://gitlab.com/kicad/code/kicad/issues/12940
This commit is contained in:
Jeff Young 2022-11-18 21:04:54 +00:00
parent 38fd1c9985
commit 11dddefd05
4 changed files with 23 additions and 6 deletions

View File

@ -157,6 +157,10 @@ public:
///< @copydoc EDA_ITEM::GetBoundingBox
const BOX2I GetBoundingBox() const override;
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
///< @copydoc EDA_ITEM::Visit
INSPECT_RESULT Visit( INSPECTOR aInspector, void* aTestData,
const std::vector<KICAD_T>& aScanTypes ) override;

View File

@ -750,8 +750,9 @@ public:
*/
void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }

View File

@ -23,6 +23,7 @@
*/
#include <bitmaps.h>
#include <eda_draw_frame.h>
#include <geometry/shape_compound.h>
#include <board.h>
#include <board_item.h>
#include <footprint.h>
@ -248,6 +249,17 @@ const BOX2I PCB_GROUP::GetBoundingBox() const
}
std::shared_ptr<SHAPE> PCB_GROUP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
for( BOARD_ITEM* item : m_items )
shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
return shape;
}
INSPECT_RESULT PCB_GROUP::Visit( INSPECTOR aInspector, void* aTestData,
const std::vector<KICAD_T>& aScanTypes )
{

View File

@ -152,8 +152,8 @@ public:
bool ignoreLineWidth = false ) const override;
// @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
/**
* Function IsPointOnEnds
@ -334,8 +334,8 @@ public:
}
// @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
/**
* Function GetLength