Commit 2e94a708 authored by dickelbeck's avatar dickelbeck
Browse files

zone_container GetBoundingBox() deployment

parent 267d4f2f
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,14 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.




2008-May-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
    Added ZONE_CONTAINER::GetBoundingBox() and used it to clean up
    ZONE_CONTAINER deletion.  There is still a problem dragging a zone container
    edge that I will not get to.


2008-May-1 UPDATE Dick Hollenbeck <dick@softplc.com>
2008-May-1 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+pcbnew
+pcbnew
+27 −0
Original line number Original line Diff line number Diff line
@@ -356,6 +356,33 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
}
}




EDA_Rect ZONE_CONTAINER::GetBoundingBox()
{
    const int PRELOAD = 500000;

    int ymax = -PRELOAD;
    int ymin = PRELOAD;
    int xmin = PRELOAD;
    int xmax = -PRELOAD;

    int count = GetNumCorners();

    for( int i=0; i<count;  ++i )
    {
        wxPoint corner = GetCornerPosition(i);

        ymax = MAX( ymax, corner.y );
        xmax = MAX( xmax, corner.x );
        ymin = MIN( ymin, corner.y );
        xmin = MIN( xmin, corner.x );
    }

    EDA_Rect ret( wxPoint(xmin,ymin), wxSize( xmax-xmin+1, ymax-ymin+1) );

    return ret;
}


/**********************************************************************************************/
/**********************************************************************************************/
void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
/***********************************************************************************************/
/***********************************************************************************************/
+3 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,9 @@ public:
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );




    EDA_Rect GetBoundingBox();


    /**
    /**
     * Function DrawWhileCreateOutline
     * Function DrawWhileCreateOutline
     * Draws the zone outline when ir is created.
     * Draws the zone outline when ir is created.
+5 −5
Original line number Original line Diff line number Diff line
@@ -353,7 +353,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain


    if( zone_container->m_Poly->GetNumCorners() <= 3 )
    if( zone_container->m_Poly->GetNumCorners() <= 3 )
    {
    {
        zone_container->Draw( DrawPanel, DC, GR_XOR );
        DrawPanel->PostDirtyRect( zone_container->GetBoundingBox() );
        Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
        Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
        m_Pcb->Delete( zone_container );
        m_Pcb->Delete( zone_container );
        return;
        return;
@@ -778,8 +778,7 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai
{
{
    int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
    int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );


    if( DC )
    EDA_Rect dirty = zone_container->GetBoundingBox();
        zone_container->Draw( DrawPanel, DC, GR_XOR );


    Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );  // Remove fill segments
    Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );  // Remove fill segments


@@ -789,9 +788,10 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai
    else
    else
    {
    {
        zone_container->m_Poly->RemoveContour( ncont );
        zone_container->m_Poly->RemoveContour( ncont );
        if( DC )
            zone_container->Draw( DrawPanel, DC, GR_OR );
    }
    }

    DrawPanel->PostDirtyRect( dirty );

    GetScreen()->SetModify();
    GetScreen()->SetModify();
}
}