示例#1
0
// Flip the basic shapes, in custom pads
void D_PAD::FlipPrimitives()
{
    // Flip custom shapes
    for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
    {
        PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];

        MIRROR( primitive.m_Start.y, 0 );
        MIRROR( primitive.m_End.y, 0 );
        primitive.m_ArcAngle = -primitive.m_ArcAngle;

        switch( primitive.m_Shape )
        {
        case S_POLYGON:         // polygon
            for( unsigned jj = 0; jj < primitive.m_Poly.size(); jj++ )
                MIRROR( primitive.m_Poly[jj].y, 0 );
            break;

        default:
            break;
        }
    }

    // Flip local coordinates in merged Polygon
    for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
    {
        SHAPE_LINE_CHAIN& poly = m_customShapeAsPolygon.Outline( cnt );

        for( int ii = 0; ii < poly.PointCount(); ++ii )
            MIRROR( poly.Point( ii ).y, 0 );
    }
}
void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
{
    // Used in modedit, to transform the footprint
    // the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true
    // the position is mirrored, but the text itself is not mirrored
    if( aMirrorAroundXAxis )
        MIRROR( m_Pos.y, aCentre.y );
    else
        MIRROR( m_Pos.x, aCentre.x );

    NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient );
    SetLocalCoord();
}
void TEXTE_MODULE::Flip( const wxPoint& aCentre )
{
    // flipping the footprint is relative to the X axis
    MIRROR( m_Pos.y, aCentre.y );
    NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient );
    SetLayer( FlipLayer( GetLayer() ) );
    m_Mirror = IsBackLayer( GetLayer() );
    SetLocalCoord();
}
const EDA_RECT SCH_FIELD::GetBoundingBox() const
{
    SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
    int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();

    // We must pass the effective text thickness to GetTextBox
    // when calculating the bounding box
    linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );

    // Calculate the text bounding box:
    EDA_RECT rect;

    if( m_id == REFERENCE )     // multi units have one letter or more added to reference
    {
        SCH_FIELD text( *this );    // Make a local copy to change text
                                    // because GetBoundingBox() is const
        text.SetText( GetFullyQualifiedText() );
        rect = text.GetTextBox( -1, linewidth );
    }
    else
        rect = GetTextBox( -1, linewidth );

    // Calculate the bounding box position relative to the component:
    wxPoint origin = parentComponent->GetPosition();
    wxPoint pos = GetTextPos() - origin;
    wxPoint begin = rect.GetOrigin() - origin;
    wxPoint end = rect.GetEnd() - origin;
    RotatePoint( &begin, pos, GetTextAngle() );
    RotatePoint( &end, pos, GetTextAngle() );

    // Due to the Y axis direction, we must mirror the bounding box,
    // relative to the text position:
    MIRROR( begin.y, pos.y );
    MIRROR( end.y,   pos.y );

    // Now, apply the component transform (mirror/rot)
    begin = parentComponent->GetTransform().TransformCoordinate( begin );
    end = parentComponent->GetTransform().TransformCoordinate( end );
    rect.SetOrigin( begin);
    rect.SetEnd( end);
    rect.Move( origin );
    rect.Normalize();
    return rect;
}
示例#5
0
void SCH_SHEET::MirrorX( int aXaxis_position )
{
    MIRROR( m_pos.y, aXaxis_position );
    m_pos.y -= m_size.y;

    for( SCH_SHEET_PIN& sheetPin : m_pins )
    {
        sheetPin.MirrorX( aXaxis_position );
    }
}
示例#6
0
void SCH_SHEET::MirrorY( int aYaxis_position )
{
    MIRROR( m_pos.x, aYaxis_position );
    m_pos.x -= m_size.x;

    for( SCH_SHEET_PIN& label : m_pins )
    {
        label.MirrorY( aYaxis_position );
    }
}
void D_PAD::Flip( const wxPoint& aCentre )
{
    int y = GetPosition().y;
    MIRROR( y, aCentre.y );  // invert about x axis.
    SetY( y );

    MIRROR( m_Pos0.y, 0 );
    MIRROR( m_Offset.y, 0 );
    MIRROR( m_DeltaSize.y, 0 );

    SetOrientation( -GetOrientation() );

    // flip pads layers
    // PADS items are currently on all copper layers, or
    // currently, only on Front or Back layers.
    // So the copper layers count is not taken in account
    SetLayerSet( FlipLayerMask( m_layerMask ) );

    // m_boundingRadius = -1;  the shape has not been changed
}
void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
{
    for( unsigned ic = 0; ic < m_Poly->m_CornersList.GetCornersCount(); ic++ )
    {
        int py = mirror_ref.y - m_Poly->m_CornersList.GetY( ic );
        m_Poly->m_CornersList.SetY( ic, py + mirror_ref.y );
    }

    m_Poly->Hatch();

    for( SHAPE_POLY_SET::ITERATOR ic = m_FilledPolysList.Iterate(); ic; ++ic )
    {
        int py = mirror_ref.y - ic->y;
        ic->y = py + mirror_ref.y;
    }

    for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
    {
        MIRROR( m_FillSegmList[ic].m_Start.y, mirror_ref.y );
        MIRROR( m_FillSegmList[ic].m_End.y,   mirror_ref.y );
    }
}
示例#9
0
void EDGE_MODULE::Flip( const wxPoint& aCentre )
{
    wxPoint pt;

    switch( GetShape() )
    {
    case S_ARC:
        SetAngle( -GetAngle() );
        //Fall through
    default:
    case S_SEGMENT:
        pt = GetStart();
        MIRROR( pt.y, aCentre.y );
        SetStart( pt );

        pt = GetEnd();
        MIRROR( pt.y, aCentre.y );
        SetEnd( pt );

        MIRROR( m_Start0.y, 0 );
        MIRROR( m_End0.y, 0 );
        break;

    case S_POLYGON:
        // polygon corners coordinates are always relative to the
        // footprint position, orientation 0
        for( auto iter = m_Poly.Iterate(); iter; iter++ )
        {
            MIRROR( iter->y, 0 );
        }
	break;
    }

    // DRAWSEGMENT items are not usually on copper layers, but
    // it can happen in microwave apps.
    // However, currently, only on Front or Back layers.
    // So the copper layers count is not taken in account
    SetLayer( FlipLayer( GetLayer() ) );
}
示例#10
0
void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
{
    for( unsigned ic = 0; ic < m_Poly->m_CornersList.GetCornersCount(); ic++ )
    {
        int py = mirror_ref.y - m_Poly->m_CornersList.GetY( ic );
        m_Poly->m_CornersList.SetY( ic, py + mirror_ref.y );
    }

    m_Poly->Hatch();

    /* mirror filled areas: */
    for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
    {
        int py = mirror_ref.y - m_FilledPolysList.GetY( ic );
        m_FilledPolysList.SetY( ic, py + mirror_ref.y );
    }

    for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
    {
        MIRROR( m_FillSegmList[ic].m_Start.y, mirror_ref.y );
        MIRROR( m_FillSegmList[ic].m_End.y,   mirror_ref.y );
    }
}
示例#11
0
void SCH_HIERLABEL::MirrorX( int aXaxis_position )
{
    switch( GetOrientation() )
    {
    case 1:             /* vertical text */
        SetOrientation( 3 );
        break;

    case 3:        /* invert vertical text*/
        SetOrientation( 1 );
        break;
    }

    MIRROR( m_Pos.y, aXaxis_position );
}
示例#12
0
void MODULE::Flip( const wxPoint& aCentre )
{
    // Move module to its final position:
    wxPoint finalPos = m_Pos;
    MIRROR( finalPos.y, aCentre.y );     /// Mirror the Y position
    SetPosition( finalPos );

    // Flip layer
    SetLayer( FlipLayer( GetLayer() ) );

    // Reverse mirror orientation.
    m_Orient = -m_Orient;
    NORMALIZE_ANGLE_POS( m_Orient );

    // Mirror pads to other side of board about the x axis, i.e. vertically.
    for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
        pad->Flip( m_Pos );

    // Mirror reference and value.
    m_Reference->Flip( m_Pos );
    m_Value->Flip( m_Pos );

    // Reverse mirror module graphics and texts.
    for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
    {
        switch( item->Type() )
        {
        case PCB_MODULE_EDGE_T:
            ( (EDGE_MODULE*) item )->Flip( m_Pos );
            break;

        case PCB_MODULE_TEXT_T:
            static_cast<TEXTE_MODULE*>( item )->Flip( m_Pos );
            break;

        default:
            wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
            break;
        }
    }

    CalculateBoundingBox();
}
示例#13
0
void SCH_HIERLABEL::MirrorY( int aYaxis_position )
{
    /* The hierarchical label is NOT really mirrored for an horizontal label, the schematic
     * orientation is changed.  For a vertical label, the schematic orientation is not changed
     * and the label is moved to a suitable position.
     */

    switch( GetOrientation() )
    {
    case 0:             /* horizontal text */
        SetOrientation( 2 );
        break;

    case 2:             /* invert horizontal text*/
        SetOrientation( 0 );
        break;
    }

    MIRROR( m_Pos.x, aYaxis_position );
}
示例#14
0
void SCH_TEXT::MirrorY( int aYaxis_position )
{
    // Text is NOT really mirrored; it is moved to a suitable horizontal position
    switch( GetOrientation() )
    {
    case 0: // horizontal text
        SetOrientation( 2 );
        break;

    case 2: // invert horizontal text
        SetOrientation( 0 );
        break;

    case 1: // Vert Orientation UP
    case 3: // Vert Orientation BOTTOM
    default:
        break;
    }

    MIRROR( m_Pos.x, aYaxis_position );
}
示例#15
0
void SCH_LABEL::MirrorX( int aXaxis_position )
{
    // Text is NOT really mirrored; it is moved to a suitable position
    switch( GetOrientation() )
    {
    case 1: // Vert Orientation UP
        SetOrientation( 3 );
        break;

    case 3: // Vert Orientation BOTTOM
        SetOrientation( 1 );
        break;

    case 0: // horizontal text
    case 2: // invert horizontal text
    default:
        break;
    }

    MIRROR( m_Pos.y, aXaxis_position );
}
void EDGE_MODULE::Mirror( wxPoint aCentre, bool aMirrorAroundXAxis )
{
    // Mirror an edge of the footprint. the layer is not modified
    // This is a footprint shape modification.
    switch( GetShape() )
    {
    case S_ARC:
        SetAngle( -GetAngle() );
        //Fall through
    default:
    case S_SEGMENT:
        if( aMirrorAroundXAxis )
        {
            MIRROR( m_Start0.y, aCentre.y );
            MIRROR( m_End0.y, aCentre.y );
        }
        else
        {
            MIRROR( m_Start0.x, aCentre.x );
            MIRROR( m_End0.x, aCentre.x );
        }
            break;

    case S_POLYGON:
        // polygon corners coordinates are always relative to the
        // footprint position, orientation 0
        for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
        {
            if( aMirrorAroundXAxis )
                MIRROR( m_PolyPoints[ii].y, aCentre.y );
            else
                MIRROR( m_PolyPoints[ii].x, aCentre.x );
        }
    }

    SetDrawCoord();
}
示例#17
0
void SCH_JUNCTION::MirrorX( int aXaxis_position )
{
    MIRROR( m_pos.y, aXaxis_position );
}
示例#18
0
void SCH_BUS_ENTRY_BASE::MirrorY( int aYaxis_position )
{
    MIRROR( m_pos.x, aYaxis_position );
    m_size.x = -m_size.x;
}
示例#19
0
void SCH_BUS_ENTRY_BASE::MirrorX( int aXaxis_position )
{
    MIRROR( m_pos.y, aXaxis_position );
    m_size.y = -m_size.y;
}
示例#20
0
void SCH_NO_CONNECT::MirrorY( int aYaxis_position )
{
    MIRROR( m_pos.x, aYaxis_position );
}
示例#21
0
void SCH_NO_CONNECT::MirrorX( int aXaxis_position )
{
    MIRROR( m_pos.y, aXaxis_position );
}
/*
 * Mirror image relative to a vertical Y axis
 */
void SCH_BITMAP::MirrorY( int aYaxis_position )
{
    MIRROR( m_pos.x, aYaxis_position );
    m_image->Mirror( false );
}
/*
 * Mirror image relative to a horizontal X axis )
 */
void SCH_BITMAP::MirrorX( int aXaxis_position )
{
    MIRROR( m_pos.y, aXaxis_position );
    m_image->Mirror( true );
}
示例#24
0
void SCH_JUNCTION::MirrorY( int aYaxis_position )
{
    MIRROR( m_pos.x, aYaxis_position );
}