Commit b18eedb4 authored by charras's avatar charras
Browse files

More about copper zones filled without grid (by polygons) - work still in progress

parent 1a9c5320
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -379,7 +379,6 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
                               int DrawMode, int Color )
{
    int color;
    int Width = DRAWJUNCTION_SIZE;

    if( Color >= 0 )
        color = Color;
@@ -387,8 +386,8 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
        color = ReturnLayerColor( m_Layer );
    GRSetDrawMode( DC, DrawMode );

    GRFilledRect( &panel->m_ClipBox, DC, m_Pos.x - Width + offset.x, m_Pos.y - Width + offset.y,
        m_Pos.x + Width + offset.x, m_Pos.y + Width + offset.y, color, color );
    GRFilledCircle( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
       DRAWJUNCTION_SIZE, 0, color, color );
}


+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
#    include "config.h"
     (wxT(KICAD_SVN_VERSION))
#  else
     (wxT("(20081002-unstable)")) /* main program version */
     (wxT("(20081008-unstable)")) /* main program version */
#  endif
#endif
;
@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion
#    include "config.h"
     (wxT(KICAD_ABOUT_VERSION))
#  else
     (wxT("(20081002-unstable)")) /* svn date & rev (normally overridden) */
     (wxT("(20081008-unstable)")) /* svn date & rev (normally overridden) */
#  endif
#endif
;
+62 −20
Original line number Diff line number Diff line
@@ -151,6 +151,21 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
            return false;
    }

    // Save the PolysList
    if( m_FilledPolysList.size() )
    {
        fprintf( aFile, "$POLYSCORNERS\n" );
        for( item_pos = 0; item_pos < m_FilledPolysList.size(); item_pos++ )
        {
            const CPolyPt* corner = &m_FilledPolysList[item_pos];
            ret = fprintf( aFile, "%d %d %d\n", corner->x, corner->y, corner->end_contour );
            if( ret < 3 )
                return false;
        }

        fprintf( aFile, "$endPOLYSCORNERS\n" );
    }

    fprintf( aFile, "$endCZONE_OUTLINE\n" );

    return true;
@@ -292,6 +307,24 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
                }
            }
        }


        if( strnicmp( Line, "$POLYSCORNERS", 13 ) == 0  )  // Read the PolysList (polygons used for fill areas in the zone)
        {
            while( GetLine( aFile, Line, aLineNum, sizeof(Line) - 1 ) != NULL )
            {
                if( strnicmp( Line, "$endPOLYSCORNERS", 4 ) == 0  )
                    break;
                CPolyPt corner;
                int     itmp;
                ret = sscanf( Line, "%d %d %d", &corner.x, &corner.y, &itmp );
                if( ret < 3 )
                    return false;
                corner.end_contour = itmp ? true : false;
                m_FilledPolysList.push_back( corner );
            }
        }

        if( strnicmp( Line, "$end", 4 ) == 0 )    // end of description
        {
            break;
@@ -751,7 +784,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
    msg.Printf( wxT( "%d" ), GetNet() );
    Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );

    text_pos += 8;
    text_pos += 6;
    msg = board->GetLayerName( m_Layer );
    Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );

@@ -759,15 +792,24 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
    msg.Printf( wxT( "%d" ), m_Poly->corner.size() );
    Affiche_1_Parametre( frame, text_pos, _( "Corners" ), msg, BLUE );

    text_pos += 8;
    text_pos += 6;
    if( m_GridFillValue )
        msg.Printf( wxT( "%d" ), m_GridFillValue );
    else msg = _("No Grid");
    else
        msg = _( "No Grid" );
    Affiche_1_Parametre( frame, text_pos, _( "Fill Grid" ), msg, BROWN );

    text_pos += 8;
    // Useful for statistics :
    text_pos += 9;
    msg.Printf( wxT( "%d" ), m_Poly->m_HatchLines.size() );
    Affiche_1_Parametre( frame, text_pos, _( "Hatch lines" ), msg, BLUE );

    if( m_FilledPolysList.size() )
    {
        text_pos += 9;
        msg.Printf( wxT( "%d" ), m_FilledPolysList.size() );
        Affiche_1_Parametre( frame, text_pos, _( "Corners in DrawList" ), msg, BLUE );
    }
}


+0 −7
Original line number Diff line number Diff line
@@ -1010,13 +1010,6 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
    BestZoom();

#ifdef PCBNEW
    if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
    {
        // Build filled areas
        for( unsigned ia = 0; ia < m_Pcb->m_ZoneDescriptorList.size(); ia++ )
            m_Pcb->m_ZoneDescriptorList[ia]->BuildFilledPolysListData( m_Pcb );
    }

    // Build connectivity info
    Compile_Ratsnest( NULL, TRUE );
#endif
+14 −16
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@

#include "protos.h"

using namespace std;


/**********************************************************************/
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
@@ -111,20 +109,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
{
    /* Draw areas (i.e. zones) */
    for( int ii = 0; ii < GetAreaCount(); ii++ )
    {
        ZONE_CONTAINER* zone = GetArea(ii);

        // Areas must be drawn here only if not moved or dragged,
        // because these areas are drawn by ManageCursor() in a specific manner
        if ( (zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
        {
            zone->Draw( aPanel, DC, aDrawMode );
            zone->DrawFilledArea( aPanel, DC, aDrawMode );
        }
    }

    for( MODULE* module = m_Modules;  module;  module = module->Next() )
    {
        bool display = true;
@@ -188,6 +172,20 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
        zone->Draw( aPanel, DC, aDrawMode );
    }

    /* Draw areas (i.e. zones) */
    for( int ii = 0; ii < GetAreaCount(); ii++ )
    {
        ZONE_CONTAINER* zone = GetArea(ii);

        // Areas must be drawn here only if not moved or dragged,
        // because these areas are drawn by ManageCursor() in a specific manner
        if ( (zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
        {
            zone->Draw( aPanel, DC, aDrawMode );
            zone->DrawFilledArea( aPanel, DC, aDrawMode );
        }
    }


    // draw the BOARD's markers.
    for( unsigned i=0; i < m_markers.size();  ++i )
Loading