pcbnew: implement SHAPE_COMPOUND-based GetEffectiveShape()
This commit is contained in:
parent
7dbd8ef802
commit
832a8c5bf7
|
@ -41,7 +41,7 @@ class BOARD;
|
|||
class BOARD_ITEM_CONTAINER;
|
||||
class SHAPE_POLY_SET;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
class SHAPE;
|
||||
|
||||
/**
|
||||
* Enum STROKE_T
|
||||
|
@ -156,6 +156,8 @@ public:
|
|||
*/
|
||||
static wxPoint ZeroOffset;
|
||||
|
||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
||||
|
||||
BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_Parent; }
|
||||
|
||||
/**
|
||||
|
|
|
@ -150,6 +150,15 @@ bool BOARD_ITEM::ptr_cmp::operator() ( const BOARD_ITEM* a, const BOARD_ITEM* b
|
|||
return a->m_Uuid < b->m_Uuid;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> BOARD_ITEM::GetEffectiveShape( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
std::shared_ptr<SHAPE> shape;
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
static struct BOARD_ITEM_DESC
|
||||
{
|
||||
BOARD_ITEM_DESC()
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <geometry/shape_simple.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
|
@ -1120,6 +1121,12 @@ std::vector<SHAPE*> DRAWSEGMENT::MakeEffectiveShapes()
|
|||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> DRAWSEGMENT::GetEffectiveShape( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
return std::shared_ptr<SHAPE>( new SHAPE_COMPOUND( MakeEffectiveShapes() ) );
|
||||
}
|
||||
|
||||
|
||||
const std::vector<wxPoint> DRAWSEGMENT::BuildPolyPointsList() const
|
||||
{
|
||||
std::vector<wxPoint> rv;
|
||||
|
|
|
@ -244,7 +244,8 @@ public:
|
|||
/**
|
||||
* Makes a set of SHAPE objects representing the DRAWSEGMENT. Caller owns the objects.
|
||||
*/
|
||||
std::vector<SHAPE*> MakeEffectiveShapes();
|
||||
std::vector<SHAPE*> MakeEffectiveShapes(); // fixme: move to shape_compound
|
||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <geometry/shape_segment.h>
|
||||
#include <geometry/shape_simple.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
#include <pcbnew.h>
|
||||
#include <view/view.h>
|
||||
#include <class_board.h>
|
||||
|
@ -75,9 +76,9 @@ D_PAD::D_PAD( MODULE* parent ) :
|
|||
m_LocalSolderPasteMargin = 0;
|
||||
m_LocalSolderPasteMarginRatio = 0.0;
|
||||
// Parameters for round rect only:
|
||||
m_roundedCornerScale = 0.25; // from IPC-7351C standard
|
||||
m_roundedCornerScale = 0.25; // from IPC-7351C standard
|
||||
// Parameters for chamfered rect only:
|
||||
m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
|
||||
m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
|
||||
m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
|
||||
|
||||
m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
|
||||
|
@ -221,6 +222,20 @@ const std::shared_ptr<SHAPE_POLY_SET>& D_PAD::GetEffectivePolygon() const
|
|||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> D_PAD::GetEffectiveShape( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
std::shared_ptr<SHAPE_COMPOUND> shape( new SHAPE_COMPOUND );
|
||||
|
||||
if( m_shapesDirty )
|
||||
BuildEffectiveShapes();
|
||||
|
||||
for( auto s : m_effectiveShapes )
|
||||
shape->AddShape( s->Clone() ); // fixme: use COMPOUND everywhere
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
const SHAPE_SEGMENT* D_PAD::GetEffectiveHoleShape() const
|
||||
{
|
||||
if( m_shapesDirty )
|
||||
|
|
|
@ -392,6 +392,7 @@ public:
|
|||
* multiple outlines and/or holes).
|
||||
*/
|
||||
const std::vector<std::shared_ptr<SHAPE>>& GetEffectiveShapes() const;
|
||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) override;
|
||||
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue