diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index b84471296a..848de03941 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -35,6 +35,7 @@ #include #include #include +#include MODULE::MODULE( BOARD* parent ) : BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ), @@ -1582,6 +1583,14 @@ extern bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_ wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr ); +std::shared_ptr MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +{ + std::shared_ptr shape ( new SHAPE_NULL ); + + return shape; +} + + bool MODULE::BuildPolyCourtyard() { m_poly_courtyard_front.RemoveAllContours(); diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index b9f33393f7..d0680332c1 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -45,6 +45,7 @@ class EDA_3D_CANVAS; class D_PAD; class BOARD; class MSG_PANEL_ITEM; +class SHAPE; namespace KIGFX { class VIEW; @@ -678,6 +679,8 @@ public: */ bool BuildPolyCourtyard(); + virtual std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; + virtual void SwapData( BOARD_ITEM* aImage ) override; struct cmp_drawings diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 19ff5e95de..34b26c323a 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -26,6 +26,8 @@ #include #include #include +#include + #include #include #include @@ -1367,6 +1369,23 @@ unsigned int MODULE_ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) } +std::shared_ptr ZONE_CONTAINER::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +{ + std::shared_ptr shape; + + if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() ) + { + shape.reset( new SHAPE_NULL ); + } + else + { + shape.reset( m_FilledPolysList.at( aLayer ).Clone() ); + } + + return shape; +} + + static struct ZONE_CONTAINER_DESC { ZONE_CONTAINER_DESC() diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 65077e631e..afe36e9751 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -289,6 +289,9 @@ public: void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; } + // @copydoc BOARD_ITEM::GetEffectiveShape + virtual std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; + /** * Function HitTest * tests if a point is near an outline edge or a corner of this zone.