Commit b18eedb4 authored by charras's avatar charras

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

parent 1a9c5320
...@@ -379,7 +379,6 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -379,7 +379,6 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
int DrawMode, int Color ) int DrawMode, int Color )
{ {
int color; int color;
int Width = DRAWJUNCTION_SIZE;
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
...@@ -387,8 +386,8 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -387,8 +386,8 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
GRFilledRect( &panel->m_ClipBox, DC, m_Pos.x - Width + offset.x, m_Pos.y - Width + offset.y, GRFilledCircle( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
m_Pos.x + Width + offset.x, m_Pos.y + Width + offset.y, color, color ); DRAWJUNCTION_SIZE, 0, color, color );
} }
......
...@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion ...@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
# include "config.h" # include "config.h"
(wxT(KICAD_SVN_VERSION)) (wxT(KICAD_SVN_VERSION))
# else # else
(wxT("(20081002-unstable)")) /* main program version */ (wxT("(20081008-unstable)")) /* main program version */
# endif # endif
#endif #endif
; ;
...@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion ...@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion
# include "config.h" # include "config.h"
(wxT(KICAD_ABOUT_VERSION)) (wxT(KICAD_ABOUT_VERSION))
# else # else
(wxT("(20081002-unstable)")) /* svn date & rev (normally overridden) */ (wxT("(20081008-unstable)")) /* svn date & rev (normally overridden) */
# endif # endif
#endif #endif
; ;
......
...@@ -136,7 +136,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -136,7 +136,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
if( ret < 2 ) if( ret < 2 )
return false; return false;
ret = fprintf( aFile, "ZOptions %d\n", m_GridFillValue); ret = fprintf( aFile, "ZOptions %d\n", m_GridFillValue );
if( ret < 1 ) if( ret < 1 )
return false; return false;
...@@ -151,6 +151,21 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -151,6 +151,21 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
return false; 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" ); fprintf( aFile, "$endCZONE_OUTLINE\n" );
return true; return true;
...@@ -292,6 +307,24 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum ) ...@@ -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 if( strnicmp( Line, "$end", 4 ) == 0 ) // end of description
{ {
break; break;
...@@ -455,12 +488,12 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -455,12 +488,12 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
corners_count++; corners_count++;
if( corner->end_contour ) if( corner->end_contour )
{ // Draw the current filled area { // Draw the current filled area
if ( sketch_mode ) if( sketch_mode )
GRClosedPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, GRClosedPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
false, 0, color, color ); false, 0, color, color );
else else
GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
true , 0, color, color ); true, 0, color, color );
corners_count = 0; corners_count = 0;
ii = 0; ii = 0;
} }
...@@ -751,7 +784,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -751,7 +784,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
msg.Printf( wxT( "%d" ), GetNet() ); msg.Printf( wxT( "%d" ), GetNet() );
Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED ); Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );
text_pos += 8; text_pos += 6;
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN ); Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
...@@ -759,15 +792,24 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -759,15 +792,24 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
msg.Printf( wxT( "%d" ), m_Poly->corner.size() ); msg.Printf( wxT( "%d" ), m_Poly->corner.size() );
Affiche_1_Parametre( frame, text_pos, _( "Corners" ), msg, BLUE ); Affiche_1_Parametre( frame, text_pos, _( "Corners" ), msg, BLUE );
text_pos += 8; text_pos += 6;
if ( m_GridFillValue ) if( m_GridFillValue )
msg.Printf( wxT( "%d" ), 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 ); 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() ); msg.Printf( wxT( "%d" ), m_Poly->m_HatchLines.size() );
Affiche_1_Parametre( frame, text_pos, _( "Hatch lines" ), msg, BLUE ); 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 );
}
} }
......
...@@ -1010,13 +1010,6 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) ...@@ -1010,13 +1010,6 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
BestZoom(); BestZoom();
#ifdef PCBNEW #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 // Build connectivity info
Compile_Ratsnest( NULL, TRUE ); Compile_Ratsnest( NULL, TRUE );
#endif #endif
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "protos.h" #include "protos.h"
using namespace std;
/**********************************************************************/ /**********************************************************************/
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
...@@ -111,20 +109,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -111,20 +109,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
/********************************************************************/ /********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */ /* 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() ) for( MODULE* module = m_Modules; module; module = module->Next() )
{ {
bool display = true; bool display = true;
...@@ -188,6 +172,20 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -188,6 +172,20 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
zone->Draw( aPanel, DC, aDrawMode ); 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. // draw the BOARD's markers.
for( unsigned i=0; i < m_markers.size(); ++i ) for( unsigned i=0; i < m_markers.size(); ++i )
......
...@@ -30,7 +30,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -30,7 +30,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
// Local Variables: // Local Variables:
/* how many segments are used to create a polygon from a circle: */ /* how many segments are used to create a polygon from a circle: */
static int s_CircleToSegmentsCount = 32; static int s_CircleToSegmentsCount = 16;
/** function AddClearanceAreasPolygonsToPolysList /** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearence)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment