bool D_PAD::AddPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList )
{
    for( const auto& prim : aPrimitivesList )
        m_basicShapes.push_back( prim );

    return MergePrimitivesAsPolygon();
}
Esempio n. 2
0
void D_PAD::ImportSettingsFromMaster( const D_PAD& aMasterPad )
{
    SetShape( aMasterPad.GetShape() );
    SetLayerSet( aMasterPad.GetLayerSet() );
    SetAttribute( aMasterPad.GetAttribute() );

    // The pad orientation, for historical reasons is the
    // pad rotation + parent rotation.
    // So we have to manage this parent rotation
    double pad_rot = aMasterPad.GetOrientation();

    if( aMasterPad.GetParent() )
        pad_rot -= aMasterPad.GetParent()->GetOrientation();

    if( GetParent() )
        pad_rot += GetParent()->GetOrientation();

    SetOrientation( pad_rot );

    SetSize( aMasterPad.GetSize() );
    SetDelta( wxSize( 0, 0 ) );
    SetOffset( aMasterPad.GetOffset() );
    SetDrillSize( aMasterPad.GetDrillSize() );
    SetDrillShape( aMasterPad.GetDrillShape() );
    SetRoundRectRadiusRatio( aMasterPad.GetRoundRectRadiusRatio() );

    switch( aMasterPad.GetShape() )
    {
    case PAD_SHAPE_TRAPEZOID:
        SetDelta( aMasterPad.GetDelta() );
        break;

    case PAD_SHAPE_CIRCLE:
        // ensure size.y == size.x
        SetSize( wxSize( GetSize().x, GetSize().x ) );
        break;

    default:
        ;
    }

    switch( aMasterPad.GetAttribute() )
    {
    case PAD_ATTRIB_SMD:
    case PAD_ATTRIB_CONN:
        // These pads do not have hole (they are expected to be only on one
        // external copper layer)
        SetDrillSize( wxSize( 0, 0 ) );
        break;

    default:
        ;
    }

    // Add or remove custom pad shapes:
    SetPrimitives( aMasterPad.GetPrimitives() );
    SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
    MergePrimitivesAsPolygon();
}
void D_PAD::AddPrimitive( const std::vector<wxPoint>& aPoly, int aThickness )
{
    PAD_CS_PRIMITIVE shape( S_POLYGON );
    shape.m_Poly = aPoly;
    shape.m_Thickness = aThickness;
    m_basicShapes.push_back( shape );

    MergePrimitivesAsPolygon();
}
void D_PAD::AddPrimitive( wxPoint aCenter, int aRadius, int aThickness )
{
    PAD_CS_PRIMITIVE shape( S_CIRCLE );
    shape.m_Start = aCenter;
    shape.m_Radius = aRadius;
    shape.m_Thickness = aThickness;
    m_basicShapes.push_back( shape );

    MergePrimitivesAsPolygon();
}
void D_PAD::AddPrimitive( wxPoint aStart, wxPoint aEnd, int aThickness )
{
    PAD_CS_PRIMITIVE shape( S_SEGMENT );
    shape.m_Start = aStart;
    shape.m_End = aEnd;
    shape.m_Thickness = aThickness;
    m_basicShapes.push_back( shape );

    MergePrimitivesAsPolygon();
}
void D_PAD::AddPrimitive( wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness )
{
    PAD_CS_PRIMITIVE shape( S_ARC );
    shape.m_Start = aCenter;
    shape.m_End = aStart;
    shape.m_ArcAngle = aArcAngle;
    shape.m_Thickness = aThickness;
    m_basicShapes.push_back( shape );

    MergePrimitivesAsPolygon();
}
bool D_PAD::SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList )
{
    // clear old list
    m_basicShapes.clear();

    // Import to the basic shape list
    if( aPrimitivesList.size() )
        m_basicShapes = aPrimitivesList;

    // Only one polygon is expected (pad area = only one copper area)
    return MergePrimitivesAsPolygon();
}
void D_PAD::AddPrimitive( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2, int aThickness )
{
    PAD_CS_PRIMITIVE shape( S_CURVE );
    shape.m_Start = aStart;
    shape.m_End = aEnd;
    shape.m_Ctrl1 = aCtrl1;
    shape.m_Ctrl2 = aCtrl2;
    shape.m_Thickness = aThickness;
    m_basicShapes.push_back( shape );

    MergePrimitivesAsPolygon();
}