2009-11-20 14:55:20 +00:00
|
|
|
/*************************/
|
|
|
|
/* Common plot routines. */
|
|
|
|
/*************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "base_struct.h"
|
|
|
|
#include "drawtxt.h"
|
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "trigo.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode );
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Creates the plot for silkscreen layers
|
2009-11-20 14:55:20 +00:00
|
|
|
*/
|
|
|
|
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|
|
|
int masque_layer,
|
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
bool trace_val, trace_ref;
|
|
|
|
TEXTE_MODULE* pt_texte;
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot edge layer and graphic items */
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2010-09-13 11:51:09 +00:00
|
|
|
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
switch( PtStruct->Type() )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
2010-09-13 11:51:09 +00:00
|
|
|
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2010-09-13 11:51:09 +00:00
|
|
|
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
2010-09-13 11:51:09 +00:00
|
|
|
PlotDimension( plotter, (DIMENSION*) PtStruct, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MIRE:
|
2010-09-13 11:51:09 +00:00
|
|
|
PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
case TYPE_MARKER_PCB:
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-09-13 11:51:09 +00:00
|
|
|
DisplayError( this, wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot footprint outlines : */
|
2009-06-29 05:30:08 +00:00
|
|
|
Plot_Edges_Modules( plotter, m_Pcb, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */
|
2010-10-03 15:39:06 +00:00
|
|
|
int layersmask_plotpads = masque_layer;
|
2010-09-24 16:36:20 +00:00
|
|
|
// Calculate the mask layers of allowed layers for pads
|
|
|
|
if( !g_pcb_plot_options.PlotPadsOnSilkLayer )
|
|
|
|
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK || SILKSCREEN_LAYER_FRONT);
|
|
|
|
if( layersmask_plotpads )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2010-09-13 11:51:09 +00:00
|
|
|
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2010-09-13 11:51:09 +00:00
|
|
|
for( D_PAD * pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2010-01-18 15:11:35 +00:00
|
|
|
/* See if the pad is on this layer */
|
2010-09-24 16:36:20 +00:00
|
|
|
if( (pad->m_Masque_Layer & layersmask_plotpads) == 0 )
|
2010-01-18 15:11:35 +00:00
|
|
|
continue;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2010-09-13 11:51:09 +00:00
|
|
|
wxPoint shape_pos = pad->ReturnShapePos();
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2010-09-13 11:51:09 +00:00
|
|
|
switch( pad->m_PadShape & 0x7F )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_CIRCLE:
|
2010-09-13 11:51:09 +00:00
|
|
|
plotter->flash_pad_circle( shape_pos, pad->m_Size.x, FILAIRE );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_OVAL:
|
2010-09-13 11:51:09 +00:00
|
|
|
plotter->flash_pad_oval( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
case PAD_TRAPEZOID:
|
|
|
|
{
|
2010-09-13 11:51:09 +00:00
|
|
|
wxPoint coord[4];
|
|
|
|
pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
|
|
|
|
plotter->flash_pad_trapez( shape_pos, coord, pad->m_Orient, FILAIRE );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_RECT:
|
2007-12-11 20:28:13 +00:00
|
|
|
default:
|
2010-09-13 11:51:09 +00:00
|
|
|
plotter->flash_pad_rect( shape_pos, pad->m_Size, pad->m_Orient, FILAIRE );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-11-04 19:08:08 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot footprints fields (ref, value ...) */
|
2009-06-29 05:30:08 +00:00
|
|
|
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-11-04 19:08:08 +00:00
|
|
|
/* see if we want to plot VALUE and REF fields */
|
2009-06-28 16:50:42 +00:00
|
|
|
trace_val = g_pcb_plot_options.Sel_Texte_Valeur;
|
2009-11-04 19:08:08 +00:00
|
|
|
trace_ref = g_pcb_plot_options.Sel_Texte_Reference;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-05-01 16:46:56 +00:00
|
|
|
TEXTE_MODULE* text = Module->m_Reference;
|
2008-02-12 02:44:46 +00:00
|
|
|
unsigned textLayer = text->GetLayer();
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
if( textLayer >= 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
|
|
|
|
module\n %s's \"reference\" text." ),
|
|
|
|
textLayer, GetChars( Module->GetReference() ) );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
2009-06-28 16:50:42 +00:00
|
|
|
return;
|
2008-02-12 02:44:46 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
if( ( ( 1 << textLayer ) & masque_layer ) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
trace_ref = FALSE;
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
|
2007-12-11 20:28:13 +00:00
|
|
|
trace_ref = FALSE;
|
|
|
|
|
2009-05-01 16:46:56 +00:00
|
|
|
text = Module->m_Value;
|
2007-12-11 20:28:13 +00:00
|
|
|
textLayer = text->GetLayer();
|
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
if( textLayer > 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
|
|
|
|
module\n %s's \"value\" text." ),
|
|
|
|
textLayer, GetChars( Module->GetReference() ) );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
2009-06-28 16:50:42 +00:00
|
|
|
return;
|
2008-02-12 02:44:46 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( ( (1 << textLayer) & masque_layer ) == 0 )
|
|
|
|
trace_val = FALSE;
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
|
2007-12-11 20:28:13 +00:00
|
|
|
trace_val = FALSE;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot text fields, if allowed */
|
2007-12-11 20:28:13 +00:00
|
|
|
if( trace_ref )
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotTextModule( plotter, Module->m_Reference, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( trace_val )
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotTextModule( plotter, Module->m_Value, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
for( pt_texte = (TEXTE_MODULE*) Module->m_Drawings.GetFirst();
|
2009-11-20 14:55:20 +00:00
|
|
|
pt_texte != NULL;
|
|
|
|
pt_texte = pt_texte->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( pt_texte->Type() != TYPE_TEXTE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( !g_pcb_plot_options.Sel_Texte_Divers )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-11-20 14:55:20 +00:00
|
|
|
if( (pt_texte->m_NoShow)
|
|
|
|
&& !g_pcb_plot_options.Sel_Texte_Invisible )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
|
|
|
textLayer = pt_texte->GetLayer();
|
|
|
|
if( textLayer >= 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
errMsg.Printf( _( "Your BOARD has a bad layer number of %u \
|
|
|
|
for module\n %s's \"module text\" text of %s." ),
|
|
|
|
textLayer, GetChars( Module->GetReference() ),
|
|
|
|
GetChars( pt_texte->m_Text ) );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
2009-06-28 16:50:42 +00:00
|
|
|
return;
|
2008-02-12 02:44:46 +00:00
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
if( !( ( 1 << textLayer ) & masque_layer ) )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotTextModule( plotter, pt_texte, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot filled areas */
|
2008-09-27 19:26:29 +00:00
|
|
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
|
|
|
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
|
2008-10-07 12:10:24 +00:00
|
|
|
continue;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotFilledAreas( plotter, edge_zone, trace_mode );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
// Plot segments used to fill zone areas (outdated, but here for old boards
|
|
|
|
// compatibility):
|
2009-05-01 16:46:56 +00:00
|
|
|
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
|
|
|
|
{
|
|
|
|
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
|
|
|
|
continue;
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->thick_segment( seg->m_Start, seg->m_End, seg->m_Width,
|
|
|
|
trace_mode );
|
2009-05-01 16:46:56 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
wxSize size;
|
|
|
|
wxPoint pos;
|
2008-12-22 21:06:44 +00:00
|
|
|
int orient, thickness;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* calculate some text parameters :*/
|
2007-12-11 20:28:13 +00:00
|
|
|
size = pt_texte->m_Size;
|
|
|
|
pos = pt_texte->m_Pos;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
orient = pt_texte->GetDrawRotation();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_texte->m_Width;
|
2009-06-28 16:50:42 +00:00
|
|
|
if( trace_mode == FILAIRE )
|
|
|
|
thickness = -1;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
if( pt_texte->m_Mirror )
|
2009-11-20 14:55:20 +00:00
|
|
|
NEGATE( size.x ); // Text is mirrored
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-22 17:47:10 +00:00
|
|
|
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
|
|
|
|
// but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
|
|
|
|
// (like bold text) and we manage the thickness.
|
|
|
|
// So we set bold flag to true
|
|
|
|
bool allow_bold = pt_texte->m_Bold || thickness;
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, BLACK,
|
2009-06-29 05:30:08 +00:00
|
|
|
pt_texte->m_Text,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
2010-04-22 17:47:10 +00:00
|
|
|
thickness, pt_texte->m_Italic, allow_bold );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
DRAWSEGMENT* DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
if( (g_TabOneLayerMask[Dimension->GetLayer()] & masque_layer) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp = new DRAWSEGMENT( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Dimension->m_Width;
|
|
|
|
DrawTmp->SetLayer( Dimension->GetLayer() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
PlotTextePcb( plotter, Dimension->m_Text, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->Barre_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->Barre_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->Barre_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->Barre_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->TraitG_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->TraitG_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->TraitG_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->TraitG_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->TraitD_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->TraitD_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->TraitD_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->TraitD_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->FlecheD1_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->FlecheD1_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->FlecheD1_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->FlecheD1_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->FlecheD2_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->FlecheD2_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->FlecheD2_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->FlecheD2_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->FlecheG1_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->FlecheG1_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->FlecheG1_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->FlecheG1_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DrawTmp->m_Start.x = Dimension->FlecheG2_ox;
|
|
|
|
DrawTmp->m_Start.y = Dimension->FlecheG2_oy;
|
|
|
|
DrawTmp->m_End.x = Dimension->FlecheG2_fx;
|
|
|
|
DrawTmp->m_End.y = Dimension->FlecheG2_fy;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
delete DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
DRAWSEGMENT* DrawTmp;
|
2008-05-05 19:50:59 +00:00
|
|
|
int dx1, dx2, dy1, dy2, radius;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
if( (g_TabOneLayerMask[Mire->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp = new DRAWSEGMENT( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
DrawTmp->m_Width = ( trace_mode == FILAIRE ) ? -1 : Mire->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->SetLayer( Mire->GetLayer() );
|
|
|
|
|
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y;
|
2009-11-20 14:55:20 +00:00
|
|
|
DrawTmp->m_End.x = DrawTmp->m_Start.x + ( Mire->m_Size / 4 );
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_End.y = DrawTmp->m_Start.y;
|
|
|
|
DrawTmp->m_Shape = S_CIRCLE;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
DrawTmp->m_Shape = S_SEGMENT;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
radius = Mire->m_Size / 2;
|
2009-11-20 14:55:20 +00:00
|
|
|
dx1 = radius;
|
|
|
|
dy1 = 0;
|
|
|
|
dx2 = 0;
|
|
|
|
dy2 = radius;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
if( Mire->m_Shape ) /* Shape X */
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
dx1 = dy1 = ( radius * 7 ) / 5;
|
2008-05-05 19:50:59 +00:00
|
|
|
dx2 = dx1;
|
|
|
|
dy2 = -dy1;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x - dx1;
|
|
|
|
DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
|
|
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx1;
|
|
|
|
DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2;
|
|
|
|
DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
|
|
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx2;
|
|
|
|
DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
delete DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot footprints graphic items (outlines) */
|
2009-08-29 10:20:48 +00:00
|
|
|
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
|
2009-11-20 14:55:20 +00:00
|
|
|
edge;
|
|
|
|
edge = edge->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-02-26 00:37:04 +00:00
|
|
|
if( edge->Type() != TYPE_EDGE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
if( ( g_TabOneLayerMask[edge->GetLayer()] & masque_layer ) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
Plot_1_EdgeModule( plotter, edge, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot a graphic item (outline) relative to a footprint */
|
2009-08-29 10:20:48 +00:00
|
|
|
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
int type_trace; /* Type of item to plot. */
|
|
|
|
int thickness; /* Segment thickness. */
|
|
|
|
int radius; /* Circle radius. */
|
2007-12-11 20:28:13 +00:00
|
|
|
int StAngle, EndAngle;
|
2009-11-20 14:55:20 +00:00
|
|
|
wxPoint pos, end;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( PtEdge->Type() != TYPE_EDGE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
type_trace = PtEdge->m_Shape;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = PtEdge->m_Width;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
pos = PtEdge->m_Start;
|
|
|
|
end = PtEdge->m_End;
|
|
|
|
|
|
|
|
switch( type_trace )
|
|
|
|
{
|
|
|
|
case S_SEGMENT:
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->thick_segment( pos, end, thickness, trace_mode );
|
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
case S_CIRCLE:
|
2009-11-20 14:55:20 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - pos.x ),
|
|
|
|
(double) ( end.y - pos.y ) );
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->thick_circle( pos, radius * 2, thickness, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2009-11-20 14:55:20 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - pos.x ),
|
|
|
|
(double) ( end.y - pos.y ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
StAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
|
|
|
EndAngle = StAngle + PtEdge->m_Angle;
|
2009-11-20 14:55:20 +00:00
|
|
|
plotter->thick_arc( pos,
|
|
|
|
-EndAngle,
|
|
|
|
-StAngle,
|
|
|
|
radius,
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_POLYGON:
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
|
|
|
// We must compute true coordinates from m_PolyList
|
|
|
|
// which are relative to module position, orientation 0
|
|
|
|
MODULE* Module = NULL;
|
|
|
|
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
|
|
|
|
Module = (MODULE*) PtEdge->GetParent();
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
int* ptr_base =
|
|
|
|
(int*) MyMalloc( 2 * PtEdge->m_PolyPoints.size() * sizeof(int) );
|
2009-03-18 15:38:16 +00:00
|
|
|
int* ptr = ptr_base;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
int* source = (int*) &PtEdge->m_PolyPoints[0];
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
for( unsigned ii = 0; ii < PtEdge->m_PolyPoints.size(); ii++ )
|
|
|
|
{
|
|
|
|
int x = *source++;
|
|
|
|
int y = *source++;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
if( Module )
|
|
|
|
{
|
|
|
|
RotatePoint( &x, &y, Module->m_Orient );
|
|
|
|
x += Module->m_Pos.x;
|
|
|
|
y += Module->m_Pos.y;
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
x += PtEdge->m_Start0.x;
|
|
|
|
y += PtEdge->m_Start0.y;
|
|
|
|
|
|
|
|
*ptr++ = x;
|
|
|
|
*ptr++ = y;
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2010-06-10 18:43:12 +00:00
|
|
|
plotter->poly( PtEdge->m_PolyPoints.size(), ptr_base, FILLED_SHAPE,
|
2009-11-20 14:55:20 +00:00
|
|
|
thickness );
|
2009-03-18 15:38:16 +00:00
|
|
|
free( ptr_base );
|
|
|
|
}
|
2009-05-01 16:46:56 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
2009-08-29 10:20:48 +00:00
|
|
|
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-20 20:38:39 +00:00
|
|
|
int orient, thickness;
|
2007-12-11 20:28:13 +00:00
|
|
|
wxPoint pos;
|
|
|
|
wxSize size;
|
|
|
|
|
|
|
|
if( pt_texte->m_Text.IsEmpty() )
|
|
|
|
return;
|
2009-11-20 14:55:20 +00:00
|
|
|
if( ( g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer ) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
size = pt_texte->m_Size;
|
|
|
|
pos = pt_texte->m_Pos;
|
2007-12-11 20:28:13 +00:00
|
|
|
orient = pt_texte->m_Orient;
|
2009-11-20 14:55:20 +00:00
|
|
|
thickness = ( trace_mode==FILAIRE ) ? -1 : pt_texte->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-12-20 20:38:39 +00:00
|
|
|
if( pt_texte->m_Mirror )
|
2007-12-11 20:28:13 +00:00
|
|
|
size.x = -size.x;
|
|
|
|
|
2010-04-22 17:47:10 +00:00
|
|
|
// Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
|
|
|
|
// but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
|
|
|
|
// (like bold text) and we manage the thickness.
|
|
|
|
// So we set bold flag to true
|
|
|
|
bool allow_bold = pt_texte->m_Bold || thickness;
|
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
if( pt_texte->m_MultilineAllowed )
|
|
|
|
{
|
|
|
|
wxArrayString* list = wxStringSplit( pt_texte->m_Text, '\n' );
|
|
|
|
wxPoint offset;
|
|
|
|
|
|
|
|
offset.y = pt_texte->GetInterline();
|
|
|
|
|
|
|
|
RotatePoint( &offset, orient );
|
2009-11-20 14:55:20 +00:00
|
|
|
for( unsigned i = 0; i < list->Count(); i++ )
|
2009-05-12 12:12:34 +00:00
|
|
|
{
|
|
|
|
wxString txt = list->Item( i );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, BLACK,
|
2009-06-29 05:30:08 +00:00
|
|
|
txt,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
2010-04-22 17:47:10 +00:00
|
|
|
thickness, pt_texte->m_Italic, allow_bold );
|
2009-05-12 12:12:34 +00:00
|
|
|
pos += offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete (list);
|
|
|
|
}
|
|
|
|
else
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->text( pos, BLACK,
|
2009-06-29 05:30:08 +00:00
|
|
|
pt_texte->m_Text,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
2010-04-22 17:47:10 +00:00
|
|
|
thickness, pt_texte->m_Italic, allow_bold );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
2009-03-18 15:38:16 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
|
|
|
GRTraceMode trace_mode )
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
|
|
|
static int* CornersBuffer = NULL;
|
|
|
|
static unsigned CornersBufferSize = 0;
|
2009-03-18 15:38:16 +00:00
|
|
|
unsigned imax = aZone->m_FilledPolysList.size();
|
2008-09-27 19:26:29 +00:00
|
|
|
|
|
|
|
if( imax == 0 ) // Nothing to draw
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We need a buffer to store corners coordinates:
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
imax++; // provide room to sore an extra coordinate to close the polygon
|
2008-09-27 19:26:29 +00:00
|
|
|
if( CornersBuffer == NULL )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
CornersBufferSize = imax * 2;
|
2009-05-01 16:46:56 +00:00
|
|
|
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( (imax * 4) > CornersBufferSize )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
CornersBufferSize = imax * 2;
|
2009-11-20 14:55:20 +00:00
|
|
|
CornersBuffer = (int*) realloc( CornersBuffer,
|
|
|
|
CornersBufferSize * sizeof(int) );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
imax--;
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot all filled areas: filled areas have a filled area and a thick
|
|
|
|
* outline we must plot the filled area itself ( as a filled polygon
|
|
|
|
* OR a set of segments ) and plot the thick outline itself
|
2009-08-31 17:50:09 +00:00
|
|
|
*
|
|
|
|
* in non filled mode the outline is plotted, but not the filling items
|
|
|
|
*/
|
2008-09-27 19:26:29 +00:00
|
|
|
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++;
|
2009-03-18 15:38:16 +00:00
|
|
|
if( corner->end_contour ) // Plot the current filled area outline
|
|
|
|
{
|
|
|
|
// First, close the outline
|
2009-06-29 05:30:08 +00:00
|
|
|
if( CornersBuffer[0] != CornersBuffer[ii - 2]
|
|
|
|
|| CornersBuffer[1] != CornersBuffer[ii - 1] )
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
|
|
|
CornersBuffer[ii++] = CornersBuffer[0];
|
|
|
|
CornersBuffer[ii] = CornersBuffer[1];
|
|
|
|
corners_count++;
|
|
|
|
}
|
|
|
|
|
2009-08-31 17:50:09 +00:00
|
|
|
// Plot the current filled area and its outline
|
2009-06-29 05:30:08 +00:00
|
|
|
if( trace_mode == FILLED )
|
|
|
|
{
|
2009-08-31 17:50:09 +00:00
|
|
|
// Plot the current filled area polygon
|
2009-11-20 14:55:20 +00:00
|
|
|
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
|
|
|
// (if != 0: using segments )
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->poly( corners_count, CornersBuffer, FILLED_SHAPE );
|
2009-11-20 14:55:20 +00:00
|
|
|
else // We are using areas filled by
|
|
|
|
// segments: plot hem )
|
2009-08-31 17:50:09 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
for( unsigned iseg = 0;
|
|
|
|
iseg < aZone->m_FillSegmList.size();
|
|
|
|
iseg++ )
|
2009-08-31 17:50:09 +00:00
|
|
|
{
|
|
|
|
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
2009-10-14 18:14:58 +00:00
|
|
|
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
2009-11-20 14:55:20 +00:00
|
|
|
plotter->thick_segment( start,
|
|
|
|
end,
|
|
|
|
aZone->m_ZoneMinThickness,
|
|
|
|
trace_mode );
|
2009-08-31 17:50:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plot the current filled area outline
|
2009-06-29 05:30:08 +00:00
|
|
|
if( aZone->m_ZoneMinThickness > 0 )
|
|
|
|
plotter->poly( corners_count, CornersBuffer, NO_FILL,
|
|
|
|
aZone->m_ZoneMinThickness );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( aZone->m_ZoneMinThickness > 0 )
|
|
|
|
{
|
|
|
|
for( int ii = 1; ii<corners_count; ii++ )
|
|
|
|
plotter->thick_segment(
|
|
|
|
wxPoint( CornersBuffer[ii * 2 - 2],
|
|
|
|
CornersBuffer[ii * 2 - 1] ),
|
|
|
|
wxPoint( CornersBuffer[ii * 2],
|
|
|
|
CornersBuffer[ii * 2 + 1] ),
|
2009-11-20 14:55:20 +00:00
|
|
|
( trace_mode == FILAIRE ) ? -1 : aZone->m_ZoneMinThickness,
|
2009-06-29 05:30:08 +00:00
|
|
|
trace_mode );
|
|
|
|
}
|
|
|
|
plotter->set_current_line_width( -1 );
|
|
|
|
}
|
2008-09-27 19:26:29 +00:00
|
|
|
corners_count = 0;
|
|
|
|
ii = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
|
|
|
/* Plot items type DRAWSEGMENT on layers allowed by masque_layer
|
2007-12-11 20:28:13 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
wxPoint start, end;
|
2008-05-05 19:50:59 +00:00
|
|
|
int thickness;
|
|
|
|
int radius = 0, StAngle = 0, EndAngle = 0;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( (g_TabOneLayerMask[pt_segm->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( trace_mode == FILAIRE )
|
|
|
|
thickness = g_pcb_plot_options.PlotLine_Width;
|
|
|
|
else
|
2009-06-29 05:30:08 +00:00
|
|
|
thickness = pt_segm->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
start = pt_segm->m_Start;
|
|
|
|
end = pt_segm->m_End;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->set_current_line_width( thickness );
|
|
|
|
switch( pt_segm->m_Shape )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case S_CIRCLE:
|
2009-11-20 14:55:20 +00:00
|
|
|
radius =
|
|
|
|
(int) hypot( (double) ( end.x - start.x ),
|
|
|
|
(double) ( end.y - start.y ) );
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->thick_circle( start, radius * 2, thickness, trace_mode );
|
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
case S_ARC:
|
2009-11-20 14:55:20 +00:00
|
|
|
radius =
|
|
|
|
(int) hypot( (double) ( end.x - start.x ),
|
|
|
|
(double) ( end.y - start.y ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
|
|
|
EndAngle = StAngle + pt_segm->m_Angle;
|
2009-11-20 14:55:20 +00:00
|
|
|
plotter->thick_arc( start,
|
|
|
|
-EndAngle,
|
|
|
|
-StAngle,
|
|
|
|
radius,
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
case S_CURVE:
|
|
|
|
for( unsigned i = 1; i < pt_segm->m_BezierPoints.size(); i++ )
|
|
|
|
plotter->thick_segment( pt_segm->m_BezierPoints[i - 1],
|
2009-11-20 14:55:20 +00:00
|
|
|
pt_segm->m_BezierPoints[i],
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
plotter->thick_segment( start, end, thickness, trace_mode );
|
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
GRTraceMode trace_mode )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
// Specify that the contents of the "Edges Pcb" layer are to be plotted
|
|
|
|
// in addition to the contents of the currently specified layer.
|
|
|
|
int layer_mask = g_TabOneLayerMask[Layer];
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( !g_pcb_plot_options.Exclude_Edges_Pcb )
|
2009-06-29 05:30:08 +00:00
|
|
|
layer_mask |= EDGE_LAYER;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
switch( Layer )
|
2009-06-29 05:30:08 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case FIRST_COPPER_LAYER:
|
|
|
|
case LAYER_N_2:
|
|
|
|
case LAYER_N_3:
|
|
|
|
case LAYER_N_4:
|
|
|
|
case LAYER_N_5:
|
|
|
|
case LAYER_N_6:
|
|
|
|
case LAYER_N_7:
|
|
|
|
case LAYER_N_8:
|
|
|
|
case LAYER_N_9:
|
|
|
|
case LAYER_N_10:
|
|
|
|
case LAYER_N_11:
|
|
|
|
case LAYER_N_12:
|
|
|
|
case LAYER_N_13:
|
|
|
|
case LAYER_N_14:
|
|
|
|
case LAYER_N_15:
|
|
|
|
case LAST_COPPER_LAYER:
|
2009-11-04 19:08:08 +00:00
|
|
|
Plot_Standard_Layer( plotter, layer_mask, true, trace_mode );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
// Adding drill marks, if required and if the plotter is able to plot
|
|
|
|
// them:
|
|
|
|
if( g_pcb_plot_options.DrillShapeOpt !=
|
|
|
|
PCB_Plot_Options::NO_DRILL_SHAPE )
|
2009-08-29 10:20:48 +00:00
|
|
|
{
|
|
|
|
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
|
2009-11-20 14:55:20 +00:00
|
|
|
PlotDrillMark( plotter,
|
|
|
|
trace_mode,
|
|
|
|
g_pcb_plot_options.DrillShapeOpt ==
|
|
|
|
PCB_Plot_Options::SMALL_DRILL_SHAPE );
|
2009-08-29 10:20:48 +00:00
|
|
|
}
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERMASK_N_BACK:
|
|
|
|
case SOLDERMASK_N_FRONT:
|
2009-06-29 05:30:08 +00:00
|
|
|
Plot_Standard_Layer( plotter, layer_mask,
|
|
|
|
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode );
|
|
|
|
break;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERPASTE_N_BACK:
|
|
|
|
case SOLDERPASTE_N_FRONT:
|
2009-11-04 19:08:08 +00:00
|
|
|
Plot_Standard_Layer( plotter, layer_mask, false, trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
default:
|
|
|
|
Plot_Serigraphie( plotter, layer_mask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Plot a copper layer or mask in HPGL format.
|
|
|
|
* HPGL unit = 0.98 mils (1 mil = 1.02041 unit HPGL).
|
2009-06-28 16:50:42 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|
|
|
int aLayerMask,
|
|
|
|
bool aPlotVia,
|
|
|
|
GRTraceMode aPlotMode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
wxPoint pos;
|
|
|
|
wxSize size;
|
|
|
|
wxString msg;
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
// Plot pcb draw items.
|
2009-06-29 05:30:08 +00:00
|
|
|
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case TYPE_DRAWSEGMENT:
|
2009-11-20 14:55:20 +00:00
|
|
|
PlotDrawSegment( aPlotter,
|
|
|
|
(DRAWSEGMENT*) item,
|
|
|
|
aLayerMask,
|
|
|
|
aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
case TYPE_TEXTE:
|
2009-11-04 19:08:08 +00:00
|
|
|
PlotTextePcb( aPlotter, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
|
|
|
PlotDimension( aPlotter, (DIMENSION*) item, aLayerMask, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
case TYPE_MIRE:
|
2009-11-04 19:08:08 +00:00
|
|
|
PlotMirePcb( aPlotter, (MIREPCB*) item, aLayerMask, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
case TYPE_MARKER_PCB:
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
default:
|
|
|
|
DisplayError( this,
|
2009-11-20 14:55:20 +00:00
|
|
|
wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw footprint shapes without pads (pads will plotted later) */
|
2009-06-29 05:30:08 +00:00
|
|
|
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case TYPE_EDGE_MODULE:
|
2009-11-04 19:08:08 +00:00
|
|
|
if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
|
2009-11-20 14:55:20 +00:00
|
|
|
Plot_1_EdgeModule( aPlotter,
|
|
|
|
(EDGE_MODULE*) item,
|
|
|
|
aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
default:
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Plot footprint pads */
|
2009-06-29 05:30:08 +00:00
|
|
|
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
wxPoint shape_pos;
|
2009-11-04 19:08:08 +00:00
|
|
|
if( (pad->m_Masque_Layer & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
shape_pos = pad->ReturnShapePos();
|
|
|
|
pos = shape_pos;
|
2009-11-04 19:08:08 +00:00
|
|
|
wxSize margin;
|
2009-11-20 14:55:20 +00:00
|
|
|
switch( aLayerMask &
|
2009-12-21 18:51:37 +00:00
|
|
|
( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
|
|
|
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) )
|
2009-11-04 19:08:08 +00:00
|
|
|
{
|
2009-12-21 18:51:37 +00:00
|
|
|
case SOLDERMASK_LAYER_FRONT:
|
|
|
|
case SOLDERMASK_LAYER_BACK:
|
2009-11-20 14:55:20 +00:00
|
|
|
margin.x = margin.y = pad->GetSolderMaskMargin();
|
|
|
|
break;
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2009-12-21 18:51:37 +00:00
|
|
|
case SOLDERPASTE_LAYER_FRONT:
|
|
|
|
case SOLDERPASTE_LAYER_BACK:
|
2009-11-20 14:55:20 +00:00
|
|
|
margin = pad->GetSolderPasteMargin();
|
|
|
|
break;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
default:
|
2009-11-04 19:08:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
size.x = pad->m_Size.x + ( 2 * margin.x );
|
|
|
|
size.y = pad->m_Size.y + ( 2 * margin.y );
|
2009-06-28 16:50:42 +00:00
|
|
|
|
|
|
|
/* Don't draw a null size item : */
|
|
|
|
if( size.x <= 0 || size.y <= 0 )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch( pad->m_PadShape )
|
2009-06-29 05:30:08 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case PAD_CIRCLE:
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
case PAD_OVAL:
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->flash_pad_oval( pos, size, pad->m_Orient, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_TRAPEZOID:
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
2010-09-13 11:51:09 +00:00
|
|
|
wxPoint coord[4];
|
|
|
|
pad->BuildPadPolygon( coord, margin, 0 );
|
|
|
|
aPlotter->flash_pad_trapez( pos, coord, pad->m_Orient, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
case PAD_RECT:
|
|
|
|
default:
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->flash_pad_rect( pos, size, pad->m_Orient, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Plot vias : */
|
2009-11-04 19:08:08 +00:00
|
|
|
if( aPlotVia )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
if( track->Type() != TYPE_VIA )
|
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
SEGVIA* Via = (SEGVIA*) track;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// vias are not plotted if not on selected layer, but if layer
|
2009-12-21 18:51:37 +00:00
|
|
|
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
|
2009-11-04 19:08:08 +00:00
|
|
|
// if they are on an external copper layer
|
2009-06-28 16:50:42 +00:00
|
|
|
int via_mask_layer = Via->ReturnMaskLayer();
|
2009-12-21 13:05:11 +00:00
|
|
|
if( via_mask_layer & LAYER_BACK )
|
2009-12-21 18:51:37 +00:00
|
|
|
via_mask_layer |= SOLDERMASK_LAYER_BACK;
|
2009-12-21 13:05:11 +00:00
|
|
|
if( via_mask_layer & LAYER_FRONT )
|
2009-12-21 18:51:37 +00:00
|
|
|
via_mask_layer |= SOLDERMASK_LAYER_FRONT;
|
2009-11-20 14:55:20 +00:00
|
|
|
if( ( via_mask_layer & aLayerMask ) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
int via_margin = 0;
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
// If the current layer is a solder mask, use the global mask
|
|
|
|
// clearance for vias
|
2009-12-21 18:51:37 +00:00
|
|
|
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
|
2010-01-31 20:01:46 +00:00
|
|
|
via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin;
|
2009-06-28 16:50:42 +00:00
|
|
|
pos = Via->m_Start;
|
2009-11-04 19:08:08 +00:00
|
|
|
size.x = size.y = Via->m_Width + 2 * via_margin;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Don't draw a null size item : */
|
|
|
|
if( size.x <= 0 )
|
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Plot tracks (not vias) : */
|
2009-06-29 05:30:08 +00:00
|
|
|
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
wxPoint end;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( track->Type() == TYPE_VIA )
|
|
|
|
continue;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
size.x = size.y = track->m_Width;
|
|
|
|
pos = track->m_Start;
|
|
|
|
end = track->m_End;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->thick_segment( pos, end, size.x, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2008-12-22 21:06:44 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Plot zones (outdated, for old boards compatibility): */
|
2009-06-29 05:30:08 +00:00
|
|
|
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
wxPoint end;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
size.x = size.y = track->m_Width;
|
|
|
|
pos = track->m_Start;
|
|
|
|
end = track->m_End;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
aPlotter->thick_segment( pos, end, size.x, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Plot filled ares */
|
|
|
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
2009-11-04 19:08:08 +00:00
|
|
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2009-11-04 19:08:08 +00:00
|
|
|
PlotFilledAreas( aPlotter, edge_zone, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function PlotDrillMark
|
2009-08-29 10:20:48 +00:00
|
|
|
* Draw a drill mark for pads and vias.
|
2009-06-28 16:50:42 +00:00
|
|
|
* Must be called after all drawings, because it
|
2009-11-20 14:55:20 +00:00
|
|
|
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
|
|
|
|
* FILLED plot mode
|
2009-08-29 10:20:48 +00:00
|
|
|
* @param aPlotter = the PLOTTER
|
|
|
|
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
|
2009-11-20 14:55:20 +00:00
|
|
|
* @param aSmallDrillShape = true to plot a small drill shape, false to plot
|
|
|
|
* the actual drill shape
|
2009-06-28 16:50:42 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
|
|
|
|
GRTraceMode aTraceMode,
|
|
|
|
bool aSmallDrillShape )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
wxPoint pos;
|
|
|
|
wxSize diam;
|
|
|
|
MODULE* Module;
|
|
|
|
D_PAD* PtPad;
|
|
|
|
TRACK* pts;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
if( aTraceMode == FILLED )
|
2009-06-29 05:30:08 +00:00
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
aPlotter->set_color( WHITE );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() )
|
|
|
|
{
|
|
|
|
if( pts->Type() != TYPE_VIA )
|
|
|
|
continue;
|
|
|
|
pos = pts->m_Start;
|
2009-11-20 14:55:20 +00:00
|
|
|
if( g_pcb_plot_options.DrillShapeOpt ==
|
|
|
|
PCB_Plot_Options::SMALL_DRILL_SHAPE )
|
2009-06-28 16:50:42 +00:00
|
|
|
diam.x = diam.y = SMALL_DRILL;
|
|
|
|
else
|
|
|
|
diam.x = diam.y = pts->GetDrillValue();
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
for( Module = m_Pcb->m_Modules;
|
2009-11-20 14:55:20 +00:00
|
|
|
Module != NULL;
|
|
|
|
Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
for( PtPad = Module->m_Pads;
|
2009-11-20 14:55:20 +00:00
|
|
|
PtPad != NULL;
|
|
|
|
PtPad = PtPad->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
if( PtPad->m_Drill.x == 0 )
|
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
// Output hole shapes:
|
|
|
|
pos = PtPad->m_Pos;
|
|
|
|
if( PtPad->m_DrillShape == PAD_OVAL )
|
|
|
|
{
|
|
|
|
diam = PtPad->m_Drill;
|
2009-11-20 14:55:20 +00:00
|
|
|
aPlotter->flash_pad_oval( pos,
|
|
|
|
diam,
|
|
|
|
PtPad->m_Orient,
|
|
|
|
aTraceMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
diam.x = aSmallDrillShape ? SMALL_DRILL : PtPad->m_Drill.x;
|
|
|
|
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
if( aTraceMode == FILLED )
|
2009-06-29 05:30:08 +00:00
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
aPlotter->set_color( BLACK );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|