pcbnew: initial support for GetEffectiveShape() for zones and modules

This commit is contained in:
Tomasz Wlostowski 2020-08-27 00:04:16 +02:00
parent 09d0aff3d6
commit 2c1bd645b2
4 changed files with 34 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_module.h> #include <class_module.h>
#include <view/view.h> #include <view/view.h>
#include <geometry/shape_null.h>
MODULE::MODULE( BOARD* parent ) : MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ), BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ),
@ -1582,6 +1583,14 @@ extern bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_
wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr ); wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr );
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
std::shared_ptr<SHAPE> shape ( new SHAPE_NULL );
return shape;
}
bool MODULE::BuildPolyCourtyard() bool MODULE::BuildPolyCourtyard()
{ {
m_poly_courtyard_front.RemoveAllContours(); m_poly_courtyard_front.RemoveAllContours();

View File

@ -45,6 +45,7 @@ class EDA_3D_CANVAS;
class D_PAD; class D_PAD;
class BOARD; class BOARD;
class MSG_PANEL_ITEM; class MSG_PANEL_ITEM;
class SHAPE;
namespace KIGFX { namespace KIGFX {
class VIEW; class VIEW;
@ -678,6 +679,8 @@ public:
*/ */
bool BuildPolyCourtyard(); bool BuildPolyCourtyard();
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
virtual void SwapData( BOARD_ITEM* aImage ) override; virtual void SwapData( BOARD_ITEM* aImage ) override;
struct cmp_drawings struct cmp_drawings

View File

@ -26,6 +26,8 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <fctsys.h> #include <fctsys.h>
#include <geometry/geometry_utils.h> #include <geometry/geometry_utils.h>
#include <geometry/shape_null.h>
#include <pcb_base_frame.h> #include <pcb_base_frame.h>
#include <pcb_screen.h> #include <pcb_screen.h>
#include <class_board.h> #include <class_board.h>
@ -1367,6 +1369,23 @@ unsigned int MODULE_ZONE_CONTAINER::ViewGetLOD( int aLayer, KIGFX::VIEW* aView )
} }
std::shared_ptr<SHAPE> ZONE_CONTAINER::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
std::shared_ptr<SHAPE> 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 static struct ZONE_CONTAINER_DESC
{ {
ZONE_CONTAINER_DESC() ZONE_CONTAINER_DESC()

View File

@ -289,6 +289,9 @@ public:
void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; } void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; }
// @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
/** /**
* Function HitTest * Function HitTest
* tests if a point is near an outline edge or a corner of this zone. * tests if a point is near an outline edge or a corner of this zone.