More about copper zones filled without grid (by polygons) - work still in progress
This commit is contained in:
parent
1a9c5320dc
commit
b18eedb432
|
@ -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&
|
||||||
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
|
||||||
# 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
|
||||||
# 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
|
||||||
;
|
;
|
||||||
|
|
|
@ -84,8 +84,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
|
|
||||||
// Save the outline main info
|
// Save the outline main info
|
||||||
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n",
|
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n",
|
||||||
m_TimeStamp, m_NetCode,
|
m_TimeStamp, m_NetCode,
|
||||||
CONV_TO_UTF8( m_Netname ) );
|
CONV_TO_UTF8( m_Netname ) );
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -145,12 +145,27 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
for( item_pos = 0; item_pos < corners_count; item_pos++ )
|
for( item_pos = 0; item_pos < corners_count; item_pos++ )
|
||||||
{
|
{
|
||||||
ret = fprintf( aFile, "ZCorner %d %d %d\n",
|
ret = fprintf( aFile, "ZCorner %d %d %d\n",
|
||||||
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
|
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
|
||||||
m_Poly->corner[item_pos].end_contour );
|
m_Poly->corner[item_pos].end_contour );
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
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;
|
||||||
|
@ -255,7 +270,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
|
||||||
{
|
{
|
||||||
int gridsize = 50;
|
int gridsize = 50;
|
||||||
text = Line + 8;
|
text = Line + 8;
|
||||||
ret = sscanf( text, "%d", &gridsize );
|
ret = sscanf( text, "%d", &gridsize );
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -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;
|
||||||
|
@ -392,7 +425,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
|
||||||
{
|
{
|
||||||
static int* CornersBuffer = NULL;
|
static int* CornersBuffer = NULL;
|
||||||
static unsigned CornersBufferSize = 0;
|
static unsigned CornersBufferSize = 0;
|
||||||
bool sketch_mode = false; // true to show areas outlines only (test and debug purposes)
|
bool sketch_mode = false; // true to show areas outlines only (test and debug purposes)
|
||||||
|
|
||||||
if( DC == NULL )
|
if( DC == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -655,11 +688,11 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
||||||
|
|
||||||
/* test the dist between segment and ref point */
|
/* test the dist between segment and ref point */
|
||||||
dist = (int) GetPointToLineSegmentDistance( refPos.x,
|
dist = (int) GetPointToLineSegmentDistance( refPos.x,
|
||||||
refPos.y,
|
refPos.y,
|
||||||
m_Poly->corner[item_pos].x,
|
m_Poly->corner[item_pos].x,
|
||||||
m_Poly->corner[item_pos].y,
|
m_Poly->corner[item_pos].y,
|
||||||
m_Poly->corner[end_segm].x,
|
m_Poly->corner[end_segm].x,
|
||||||
m_Poly->corner[end_segm].y );
|
m_Poly->corner[end_segm].y );
|
||||||
if( dist <= min_dist )
|
if( dist <= min_dist )
|
||||||
{
|
{
|
||||||
m_CornerSelection = item_pos;
|
m_CornerSelection = item_pos;
|
||||||
|
@ -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 )
|
||||||
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 )
|
||||||
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 @@
|
||||||
|
|
||||||
#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,
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/* 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,
|
||||||
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,
|
||||||
|
|
||||||
// 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)
|
||||||
|
|
Loading…
Reference in New Issue