Browse Source

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

pull/16/head
Tomasz Wlostowski 5 years ago
parent
commit
2c1bd645b2
  1. 9
      pcbnew/class_module.cpp
  2. 3
      pcbnew/class_module.h
  3. 19
      pcbnew/class_zone.cpp
  4. 3
      pcbnew/class_zone.h

9
pcbnew/class_module.cpp

@ -35,6 +35,7 @@
#include <class_edge_mod.h>
#include <class_module.h>
#include <view/view.h>
#include <geometry/shape_null.h>
MODULE::MODULE( BOARD* parent ) :
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 );
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
std::shared_ptr<SHAPE> shape ( new SHAPE_NULL );
return shape;
}
bool MODULE::BuildPolyCourtyard()
{
m_poly_courtyard_front.RemoveAllContours();

3
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<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
virtual void SwapData( BOARD_ITEM* aImage ) override;
struct cmp_drawings

19
pcbnew/class_zone.cpp

@ -26,6 +26,8 @@
#include <bitmaps.h>
#include <fctsys.h>
#include <geometry/geometry_utils.h>
#include <geometry/shape_null.h>
#include <pcb_base_frame.h>
#include <pcb_screen.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
{
ZONE_CONTAINER_DESC()

3
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<SHAPE> 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.

Loading…
Cancel
Save