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

This commit is contained in:
charras 2008-10-08 12:36:27 +00:00
parent 1a9c5320dc
commit b18eedb432
6 changed files with 81 additions and 49 deletions

View File

@ -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 );
}

View File

@ -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
;

View File

@ -136,7 +136,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
if( ret < 2 )
return false;
ret = fprintf( aFile, "ZOptions %d\n", m_GridFillValue);
ret = fprintf( aFile, "ZOptions %d\n", m_GridFillValue );
if( ret < 1 )
return false;
@ -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;
@ -455,12 +488,12 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
corners_count++;
if( corner->end_contour )
{ // Draw the current filled area
if ( sketch_mode )
if( sketch_mode )
GRClosedPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
false, 0, color, color );
else
GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
true , 0, color, color );
true, 0, color, color );
corners_count = 0;
ii = 0;
}
@ -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;
if ( m_GridFillValue )
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 );
}
}

View File

@ -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

View File

@ -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 )

View File

@ -30,7 +30,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
// Local Variables:
/* how many segments are used to create a polygon from a circle: */
static int s_CircleToSegmentsCount = 32;
static int s_CircleToSegmentsCount = 16;
/** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence)