Commit ab1df3f1 authored by charras's avatar charras

more about non copper zones (see changelog)

parent 27cf4ad0
...@@ -5,6 +5,11 @@ Started 2007-June-11 ...@@ -5,6 +5,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Sep-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
more about use polygons in zone fill algos on techinals layers:
plot Ok. holes are handled
2008-Sep-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Sep-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
......
...@@ -83,21 +83,30 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -83,21 +83,30 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( !m_Pcb ) if( !m_Pcb )
return; return;
MODULE* Module = m_Pcb->m_Modules;
ActiveScreen = (PCB_SCREEN*) GetScreen(); ActiveScreen = (PCB_SCREEN*) GetScreen();
if( EraseBg ) if( EraseBg )
DrawPanel->EraseScreen( DC ); DrawPanel->EraseScreen( DC );
DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC );
m_Pcb->Draw( DrawPanel, DC, GR_COPY, wxPoint(0,0) );
if( Module ) MODULE* Module = m_Pcb->m_Modules;
{ if ( Module )
Module->Draw( DrawPanel, DC, GR_COPY );
Module->Display_Infos( this ); Module->Display_Infos( this );
}
Affiche_Status_Box(); Affiche_Status_Box();
DrawPanel->Trace_Curseur( DC ); DrawPanel->Trace_Curseur( DC );
} }
/********************************************************************/
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset )
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
{
if( m_Modules )
{
m_Modules->Draw( aPanel, DC, GR_COPY );
}
}
...@@ -86,6 +86,14 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -86,6 +86,14 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->Trace_Curseur( DC ); DrawPanel->Trace_Curseur( DC );
} }
/********************************************************************/
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset )
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
{
}
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer )
...@@ -104,7 +112,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -104,7 +112,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer ); Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
// Draw filled polygons // Draw filled polygons
#define NBMAX 2000 #define NBMAX 20000
TRACK* track; TRACK* track;
int nbpoints = 0; int nbpoints = 0;
int nbpointsmax = NBMAX; int nbpointsmax = NBMAX;
......
...@@ -438,7 +438,6 @@ public: ...@@ -438,7 +438,6 @@ public:
void Liste_Equipot( wxCommandEvent& event ); void Liste_Equipot( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event ); void Swap_Layers( wxCommandEvent& event );
void Install_Test_DRC_Frame( wxDC* DC ); void Install_Test_DRC_Frame( wxDC* DC );
void Trace_Pcb( wxDC* DC, int mode );
// Handling texts on the board // Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
......
...@@ -1045,6 +1045,8 @@ out: ...@@ -1045,6 +1045,8 @@ out:
return rc; return rc;
} }
/***********************************************************************************************/ /***********************************************************************************************/
void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer) void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer)
/***********************************************************************************************/ /***********************************************************************************************/
......
...@@ -253,11 +253,7 @@ public: ...@@ -253,11 +253,7 @@ public:
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) int aDrawMode, const wxPoint& offset = ZeroOffset );
{
// void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
// goes here.
}
/** /**
...@@ -380,6 +376,7 @@ public: ...@@ -380,6 +376,7 @@ public:
* or net change * or net change
* Must be called after pad netcodes are calculated * Must be called after pad netcodes are calculated
* @return : error count * @return : error count
* For non copper areas, netcode is set to 0
*/ */
int SetAreasNetCodesFromNetNames(void); int SetAreasNetCodesFromNetNames(void);
......
...@@ -368,7 +368,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -368,7 +368,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
/** /**
* Function DrawDrawFilledArea * Function DrawDrawFilledArea
* Draws the filled area for this zone (polygon list .m_FilledPolysList) * Draws the filled areas for this zone (polygon list .m_FilledPolysList)
* @param panel = current Draw Panel * @param panel = current Draw Panel
* @param DC = current Device Context * @param DC = current Device Context
* @param offset = Draw offset (usually wxPoint(0,0)) * @param offset = Draw offset (usually wxPoint(0,0))
...@@ -416,7 +416,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -416,7 +416,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
if( color & HIGHT_LIGHT_FLAG ) if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor; color = ColorRefs[color & MASKCOLOR].m_LightColor;
// draw the filled polygon // We need a buffer to store corners coordinates:
if( CornersBuffer == NULL ) if( CornersBuffer == NULL )
{ {
CornersBufferSize = imax * 4; CornersBufferSize = imax * 4;
...@@ -429,6 +429,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -429,6 +429,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) ); CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
} }
// Draw all filled areas
int corners_count = 0; int corners_count = 0;
for( unsigned ic = 0, ii = 0; ic < imax; ic++ ) for( unsigned ic = 0, ii = 0; ic < imax; ic++ )
{ {
...@@ -437,9 +438,8 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -437,9 +438,8 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
CornersBuffer[ii++] = corner->y + offset.y; CornersBuffer[ii++] = corner->y + offset.y;
corners_count++; corners_count++;
if( corner->end_contour ) if( corner->end_contour )
{ { // Draw the current filled area
GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, true, 0, color, color );
1, 0, color, color );
corners_count = 0; corners_count = 0;
ii = 0; ii = 0;
} }
......
...@@ -125,6 +125,16 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -125,6 +125,16 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
} }
GRForceBlackPen( blackpenstate ); GRForceBlackPen( blackpenstate );
/* Draw areas (i.e. zones) */
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = Pcb->GetArea(ii);
if( ( printmasklayer & (1 << zone->GetLayer()) ) == 0 )
continue;
zone->DrawFilledArea( this, DC, drawmode );
}
if( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 ); m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 );
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
/* Fonctions locales */ /* Fonctions locales */
static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer ); static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer );
static void PlotTextModule( TEXTE_MODULE* pt_texte ); static void PlotTextModule( TEXTE_MODULE* pt_texte );
static void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat);
/**********************************************************/ /**********************************************************/
...@@ -46,27 +47,18 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, ...@@ -46,27 +47,18 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format_plot, masque_layer ); PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format_plot, masque_layer );
// (Following line has been superceded by new commands elsewhere.)
// EDGE_LAYER | masque_layer );
break; break;
case TYPETEXTE: case TYPETEXTE:
PlotTextePcb( (TEXTE_PCB*) PtStruct, format_plot, masque_layer ); PlotTextePcb( (TEXTE_PCB*) PtStruct, format_plot, masque_layer );
// EDGE_LAYER | masque_layer );
break; break;
case TYPECOTATION: case TYPECOTATION:
PlotCotation( (COTATION*) PtStruct, format_plot, masque_layer ); PlotCotation( (COTATION*) PtStruct, format_plot, masque_layer );
// EDGE_LAYER | masque_layer );
break; break;
case TYPEMIRE: case TYPEMIRE:
PlotMirePcb( (MIREPCB*) PtStruct, format_plot, masque_layer ); PlotMirePcb( (MIREPCB*) PtStruct, format_plot, masque_layer );
// EDGE_LAYER | masque_layer );
break; break;
case TYPEMARKER: case TYPEMARKER:
...@@ -303,6 +295,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, ...@@ -303,6 +295,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
} }
} }
/* Plot filled ares */
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( ( (1 << edge_zone->GetLayer()) & masque_layer ) == 0 )
continue;
PlotFilledAreas(edge_zone, format_plot);
}
exit: exit:
; ;
} }
...@@ -704,6 +705,48 @@ void Affiche_erreur( int nb_err ) ...@@ -704,6 +705,48 @@ void Affiche_erreur( int nb_err )
// Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ; // Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ;
} }
/*********************************************************/
void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
/*********************************************************/
/* Plot areas (given by .m_FilledPolysList member) in a zone
*/
{
static int* CornersBuffer = NULL;
static unsigned CornersBufferSize = 0;
unsigned imax = aZone->m_FilledPolysList.size();
if( imax == 0 ) // Nothing to draw
return;
// We need a buffer to store corners coordinates:
if( CornersBuffer == NULL )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
}
if( (imax * 4) > CornersBufferSize )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
}
// Plot all filled areas
int corners_count = 0;
for( unsigned ic = 0, ii = 0; ic < imax; ic++ )
{
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
CornersBuffer[ii++] = corner->x;
CornersBuffer[ii++] = corner->y;
corners_count++;
if( corner->end_contour )
{ // Plot the current filled area
PlotPolygon( aFormat, true, corners_count, CornersBuffer );
corners_count = 0;
ii = 0;
}
}
}
/******************************************************************************/ /******************************************************************************/
void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer ) void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
......
...@@ -41,16 +41,11 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector ); ...@@ -41,16 +41,11 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
bool Read_Config( const wxString& project_name ); bool Read_Config( const wxString& project_name );
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ); bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/***************/
/* TRACEPCB.CPP */
/***************/
void Trace_MirePcb( WinEDA_DrawPanel* panel, wxDC* DC, MIREPCB* MirePcb, int mode_color );
/***************/ /***************/
/* TRPISTE.CPP */ /* TRPISTE.CPP */
/***************/ /***************/
void Trace_Pistes( WinEDA_DrawPanel* panel, BOARD* Pcb, wxDC* DC, int drawmode );
void Trace_Une_Piste( WinEDA_DrawPanel* panel, void Trace_Une_Piste( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
TRACK* pt_start_piste, TRACK* pt_start_piste,
...@@ -282,14 +277,6 @@ void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff ); ...@@ -282,14 +277,6 @@ void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff );
/* Met a jour le membre .state d'une chaine de structures */ /* Met a jour le membre .state d'une chaine de structures */
/*****************/
/* EDITEDGE.CPP : */
/*****************/
void Trace_1_Edge( WinEDA_DrawPanel* panel,
wxDC* DC,
TRACK* start_edge,
int nbpoint,
int mode_color );
/************/ /************/
/* DRC.CPP : */ /* DRC.CPP : */
...@@ -409,11 +396,6 @@ void RemoteCommand( const char* cmdline ); ...@@ -409,11 +396,6 @@ void RemoteCommand( const char* cmdline );
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track ); bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track );
/***************/
/* AUTOPLACE.CPP */
/***************/
int Calcule_Encadrement_EdgeBoard();
/***************/ /***************/
/* AUTOROUT.CPP */ /* AUTOROUT.CPP */
/***************/ /***************/
...@@ -429,10 +411,6 @@ MODULE* ListAndSelectModuleName( COMMAND* Cmd ); ...@@ -429,10 +411,6 @@ MODULE* ListAndSelectModuleName( COMMAND* Cmd );
* Retourne un pointeur sur le module selectionne * Retourne un pointeur sur le module selectionne
* ( ou NULL si pas de selection ) */ * ( ou NULL si pas de selection ) */
/***************/
/* LAY2PLOT.CPP */
/***************/
/*****************/ /*****************/
/* SET_COLOR.CPP */ /* SET_COLOR.CPP */
/*****************/ /*****************/
......
...@@ -87,7 +87,13 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -87,7 +87,13 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, GetScreen(), 0 ); TraceWorkSheet( DC, GetScreen(), 0 );
Trace_Pcb( DC, GR_OR ); m_Pcb->Draw( DrawPanel, DC, GR_OR );
if( g_HightLigt_Status )
DrawHightLight( DC, g_HightLigth_NetCode );
DrawGeneralRatsnest( DC );
GetScreen()->ClrRefreshReq();
Affiche_Status_Box(); Affiche_Status_Box();
...@@ -99,21 +105,13 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -99,21 +105,13 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
} }
/* should make the function below this one: /********************************************************************/
void BOARD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ); int aDrawMode, const wxPoint& offset )
*/ /********************************************************************/
/****************************************************/
void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
/****************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */ /* Redraw the BOARD items but not cursors, axis or grid */
{ {
if( !m_Pcb ) for( MODULE* module = m_Modules; module; module = module->Next() )
return;
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{ {
bool display = true; bool display = true;
int layerMask = ALL_CU_LAYERS; int layerMask = ALL_CU_LAYERS;
...@@ -136,14 +134,14 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) ...@@ -136,14 +134,14 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
} }
if( display ) if( display )
module->Draw( DrawPanel, DC, mode ); module->Draw( aPanel, DC, aDrawMode );
else else
Trace_Pads_Only( DrawPanel, DC, module, 0, 0, layerMask, mode ); Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
} }
// Draw the graphic items // Draw the graphic items
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{ {
if( item->m_Flags & IS_MOVED ) if( item->m_Flags & IS_MOVED )
continue; continue;
...@@ -154,7 +152,7 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) ...@@ -154,7 +152,7 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
case TYPETEXTE: case TYPETEXTE:
case TYPEMIRE: case TYPEMIRE:
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
item->Draw( DrawPanel, DC, mode ); item->Draw( aPanel, DC, aDrawMode );
break; break;
default: default:
...@@ -162,31 +160,40 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) ...@@ -162,31 +160,40 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
} }
} }
Trace_Pistes( DrawPanel, m_Pcb, DC, mode ); /* Draw all tracks and zones. As long as dark colors are used for the tracks,
if( g_HightLigt_Status ) * Then the OR draw mode should show tracks underneath other tracks. But a white
DrawHightLight( DC, g_HightLigth_NetCode ); * track will cover any other color since it has more bits to OR in.
*/
for( TRACK* track = m_Track; track; track = track->Next() )
{
track->Draw( aPanel, DC, aDrawMode );
}
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
{
zone->Draw( aPanel, DC, aDrawMode );
}
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
/* Draw areas (i.e. zones) */
for( int ii = 0; ii < GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii); ZONE_CONTAINER* zone = GetArea(ii);
// Areas must be drawn here only if not moved or dragged, // Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner // because these areas are drawn by ManageCursor() in a specific manner
if ( (edge_zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 ) if ( (zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
{ {
edge_zone->Draw( DrawPanel, DC, mode ); zone->Draw( aPanel, DC, aDrawMode );
edge_zone->DrawFilledArea( DrawPanel, DC, mode ); zone->DrawFilledArea( aPanel, DC, aDrawMode );
} }
} }
// draw the BOARD's markers. // draw the BOARD's markers.
for( unsigned i=0; i<m_Pcb->m_markers.size(); ++i ) for( unsigned i=0; i < m_markers.size(); ++i )
{ {
m_Pcb->m_markers[i]->Draw( DrawPanel, DC, mode ); m_markers[i]->Draw( aPanel, DC, aDrawMode );
} }
DrawGeneralRatsnest( DC );
GetScreen()->ClrRefreshReq();
} }
...@@ -13,26 +13,6 @@ ...@@ -13,26 +13,6 @@
/* variables locales : */ /* variables locales : */
/*********************************************************************************/
void Trace_Pistes( WinEDA_DrawPanel* panel, BOARD* Pcb, wxDC* DC, int drawmode )
/********************************************************************************/
/* Draw all tracks and zones. As long as dark colors are used for the tracks,
* Then the OR draw mode should show tracks underneath other tracks. But a white
* track will cover any other color since it has more bits to OR in.
*/
{
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
{
track->Draw( panel, DC, drawmode );
}
for( SEGZONE* zone = Pcb->m_Zone; zone; zone = zone->Next() )
{
zone->Draw( panel, DC, drawmode );
}
}
/************************************************************************/ /************************************************************************/
void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* Track, void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* Track,
......
...@@ -939,10 +939,11 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose ) ...@@ -939,10 +939,11 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose )
* Function SetAreasNetCodesFromNetNames * Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name * Set the .m_NetCode member of all copper areas, according to the area Net Name
* The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons. * The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons.
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read * However the Netcode is an arbitrary equivalence, it must be set after each netlist read
* or net change * or net change
* Must be called after pad netcodes are calculated * Must be called after pad netcodes are calculated
* @return : error count * @return : error count
* For non copper areas, netcode is set to 0
*/ */
int BOARD::SetAreasNetCodesFromNetNames( void ) int BOARD::SetAreasNetCodesFromNetNames( void )
{ {
...@@ -950,6 +951,12 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) ...@@ -950,6 +951,12 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
for( int ii = 0; ii < GetAreaCount(); ii++ ) for( int ii = 0; ii < GetAreaCount(); ii++ )
{ {
if ( ! GetArea( ii )->IsOnCopperLayer() )
{
GetArea( ii )->SetNet( 0 );
continue;
}
const EQUIPOT* net = FindNet( GetArea( ii )->m_Netname ); const EQUIPOT* net = FindNet( GetArea( ii )->m_Netname );
if( net ) if( net )
{ {
......
...@@ -90,7 +90,7 @@ void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event ) ...@@ -90,7 +90,7 @@ void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event )
} }
for( int layer_number = FIRST_NO_COPPER_LAYER, ii = 0; for( int layer_number = FIRST_NO_COPPER_LAYER, ii = 0;
layer_number < LAST_NO_COPPER_LAYER - 1; layer_number <= LAST_NO_COPPER_LAYER;
layer_number++, ii++ ) layer_number++, ii++ )
{ {
wxString msg; wxString msg;
......
...@@ -288,7 +288,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector< ...@@ -288,7 +288,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
// Fill a kbool engine for this contour, // Fill a kbool engine for this contour,
// and combine it with previous contours // and combine it with previous contours
Bool_Engine* booleng = new Bool_Engine(); Bool_Engine* booleng = new Bool_Engine();
ArmBoolEng( booleng ); ArmBoolEng( booleng, aConvertHoles );
if( m_Kbool_Poly_Engine ) // a previous contour exists. Put it in new engine if( m_Kbool_Poly_Engine ) // a previous contour exists. Put it in new engine
{ {
...@@ -751,15 +751,6 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw ) ...@@ -751,15 +751,6 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
side_style.push_back( style ); side_style.push_back( style );
if( corner.size() > 0 && !corner[corner.size() - 1].end_contour ) if( corner.size() > 0 && !corner[corner.size() - 1].end_contour )
side_style[corner.size() - 1] = style; side_style[corner.size() - 1] = style;
int dl_type;
if( style == CPolyLine::STRAIGHT )
dl_type = DL_LINE;
else if( style == CPolyLine::ARC_CW )
dl_type = DL_ARC_CW;
else if( style == CPolyLine::ARC_CCW )
dl_type = DL_ARC_CCW;
else
wxASSERT( 0 );
if( bDraw ) if( bDraw )
Draw(); Draw();
} }
...@@ -1552,170 +1543,6 @@ void CPolyLine::SetEndContour( int ic, bool end_contour ) ...@@ -1552,170 +1543,6 @@ void CPolyLine::SetEndContour( int ic, bool end_contour )
} }
// Create CPolyLine for a pad
//
CPolyLine* CPolyLine::MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle )
{
CPolyLine* poly = new CPolyLine;
int dx = l / 2;
int dy = w / 2;
if( angle % 180 == 90 )
{
dx = w / 2;
dy = l / 2;
}
if( type == PAD_ROUND )
{
poly->Start( 0, x - dx, y, 0 );
poly->AppendCorner( x, y + dy, ARC_CW, 0 );
poly->AppendCorner( x + dx, y, ARC_CW, 0 );
poly->AppendCorner( x, y - dy, ARC_CW, 0 );
poly->Close( ARC_CW );
}
return poly;
}
// Add cutout for a pad
// Convert arcs to multiple straight lines
// Do NOT draw or undraw
//
void CPolyLine::AddContourForPadClearance( int type,
int x,
int y,
int w,
int l,
int r,
int angle,
int fill_clearance,
int hole_w,
int hole_clearance,
bool bThermal,
int spoke_w )
{
int dx = l / 2;
int dy = w / 2;
if( angle % 180 == 90 )
{
dx = w / 2;
dy = l / 2;
}
int x_clearance = max( fill_clearance, hole_clearance + hole_w / 2 - dx );
int y_clearance = max( fill_clearance, hole_clearance + hole_w / 2 - dy );
dx += x_clearance;
dy += y_clearance;
if( !bThermal )
{
// normal clearance
if( type == PAD_ROUND || (type == PAD_NONE && hole_w > 0) )
{
AppendCorner( x - dx, y, ARC_CW, 0 );
AppendCorner( x, y + dy, ARC_CW, 0 );
AppendCorner( x + dx, y, ARC_CW, 0 );
AppendCorner( x, y - dy, ARC_CW, 0 );
Close( ARC_CW );
}
else if( type == PAD_SQUARE || type == PAD_RECT
|| type == PAD_RRECT || type == PAD_OVAL )
{
AppendCorner( x - dx, y - dy, STRAIGHT, 0 );
AppendCorner( x + dx, y - dy, STRAIGHT, 0 );
AppendCorner( x + dx, y + dy, STRAIGHT, 0 );
AppendCorner( x - dx, y + dy, STRAIGHT, 0 );
Close( STRAIGHT );
}
}
else
{
// thermal relief
if( type == PAD_ROUND || (type == PAD_NONE && hole_w > 0) )
{
// draw 4 "wedges"
double r = max( w / 2 + fill_clearance, hole_w / 2 + hole_clearance );
double start_angle = asin( spoke_w / (2.0 * r) );
double th1, th2, corner_x, corner_y;
th1 = th2 = corner_x = corner_y = 0; // gcc warning fix
for( int i = 0; i<4; i++ )
{
if( i == 0 )
{
corner_x = spoke_w / 2;
corner_y = spoke_w / 2;
th1 = start_angle;
th2 = pi / 2.0 - start_angle;
}
else if( i == 1 )
{
corner_x = -spoke_w / 2;
corner_y = spoke_w / 2;
th1 = pi / 2.0 + start_angle;
th2 = pi - start_angle;
}
else if( i == 2 )
{
corner_x = -spoke_w / 2;
corner_y = -spoke_w / 2;
th1 = -pi + start_angle;
th2 = -pi / 2.0 - start_angle;
}
else if( i == 3 )
{
corner_x = spoke_w / 2;
corner_y = -spoke_w / 2;
th1 = -pi / 2.0 + start_angle;
th2 = -start_angle;
}
AppendCorner( to_int( x + corner_x ), to_int( y + corner_y ), STRAIGHT, 0 );
AppendCorner( to_int( x + r * cos( th1 ) ), to_int( y + r * sin(
th1 ) ), STRAIGHT, 0 );
AppendCorner( to_int( x + r * cos( th2 ) ), to_int( y + r * sin(
th2 ) ), ARC_CCW, 0 );
Close( STRAIGHT );
}
}
else if( type == PAD_SQUARE || type == PAD_RECT
|| type == PAD_RRECT || type == PAD_OVAL )
{
// draw 4 rectangles
int xL = x - dx;
int xR = x - spoke_w / 2;
int yB = y - dy;
int yT = y - spoke_w / 2;
AppendCorner( xL, yB, STRAIGHT, 0 );
AppendCorner( xR, yB, STRAIGHT, 0 );
AppendCorner( xR, yT, STRAIGHT, 0 );
AppendCorner( xL, yT, STRAIGHT, 0 );
Close( STRAIGHT );
xL = x + spoke_w / 2;
xR = x + dx;
AppendCorner( xL, yB, STRAIGHT, 0 );
AppendCorner( xR, yB, STRAIGHT, 0 );
AppendCorner( xR, yT, STRAIGHT, 0 );
AppendCorner( xL, yT, STRAIGHT, 0 );
Close( STRAIGHT );
xL = x - dx;
xR = x - spoke_w / 2;
yB = y + spoke_w / 2;
yT = y + dy;
AppendCorner( xL, yB, STRAIGHT, 0 );
AppendCorner( xR, yB, STRAIGHT, 0 );
AppendCorner( xR, yT, STRAIGHT, 0 );
AppendCorner( xL, yT, STRAIGHT, 0 );
Close( STRAIGHT );
xL = x + spoke_w / 2;
xR = x + dx;
AppendCorner( xL, yB, STRAIGHT, 0 );
AppendCorner( xR, yB, STRAIGHT, 0 );
AppendCorner( xR, yT, STRAIGHT, 0 );
AppendCorner( xL, yT, STRAIGHT, 0 );
Close( STRAIGHT );
}
}
return;
}
void CPolyLine::AppendArc( int xi, int yi, int xf, int yf, int xc, int yc, int num ) void CPolyLine::AppendArc( int xi, int yi, int xf, int yf, int xc, int yc, int num )
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// separated by setting the end_contour flag of the last corner of // separated by setting the end_contour flag of the last corner of
// each contour. // each contour.
// //
// When used for copper areas, the first contour is the outer edge // When used for copper (or technical layers) areas, the first contour is the outer edge
// of the area, subsequent ones are "holes" in the copper. // of the area, subsequent ones are "holes" in the copper.
#ifndef POLYLINE_H #ifndef POLYLINE_H
...@@ -18,9 +18,18 @@ ...@@ -18,9 +18,18 @@
#include <vector> #include <vector>
#include "kbool/include/booleng.h" #include "kbool/include/booleng.h"
#include "freepcbDisplayList.h"
#include "pad_shapes.h" #include "pad_shapes.h"
// inflection modes for DS_LINE and DS_LINE_VERTEX, used in math_for_graphics.cpp
enum
{
IM_NONE = 0,
IM_90_45,
IM_45_90,
IM_90
};
/** Function ArmBoolEng /** Function ArmBoolEng
* Initialise parameters used in kbool * Initialise parameters used in kbool
...@@ -159,19 +168,6 @@ public: ...@@ -159,19 +168,6 @@ public:
void SetSideStyle( int is, int style ); void SetSideStyle( int is, int style );
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa = NULL ); int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa = NULL );
CPolyLine* MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle );
void AddContourForPadClearance( int type,
int x,
int y,
int w,
int l,
int r,
int angle,
int fill_clearance,
int hole_w,
int hole_clearance,
bool bThermal = FALSE,
int spoke_w = 0 );
int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa = NULL, int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa = NULL,
bool bRetainArcs = FALSE ); bool bRetainArcs = FALSE );
......
// DisplayList.h : header file for CDisplayList class
//
#ifndef FP_DISPLAY_LIST_H
#define FP_DISPLAY_LIST_H
// graphics element types
enum
{
DL_NONE = 0,
DL_LINE, // line segment with round end-caps
DL_CIRC, // filled circle
DL_HOLLOW_CIRC, // circle outline
DL_DONUT, // annulus
DL_SQUARE, // filled square
DL_RECT, // filled rectangle
DL_RRECT, // filled rounded rectangle
DL_OVAL, // filled oval
DL_OCTAGON, // filled octagon
DL_HOLE, // hole, shown as circle
DL_HOLLOW_RECT, // rectangle outline
DL_RECT_X, // rectangle outline with X
DL_POINT, // shape to highlight a point
DL_ARC_CW, // arc with clockwise curve
DL_ARC_CCW, // arc with counter-clockwise curve
DL_X // X
};
// inflection modes for DS_LINE and DS_LINE_VERTEX
enum
{
IM_NONE = 0,
IM_90_45,
IM_45_90,
IM_90
};
#endif // #ifndef FP_DISPLAY_LIST_H
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