2011-09-20 15:07:52 +00:00
|
|
|
/**
|
|
|
|
* @file plot_rtn.cpp
|
|
|
|
* @brief Common plot routines.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <plot_common.h>
|
|
|
|
#include <base_struct.h>
|
|
|
|
#include <drawtxt.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
#include <macros.h>
|
|
|
|
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_edge_mod.h>
|
|
|
|
#include <class_pcb_text.h>
|
|
|
|
#include <class_zone.h>
|
|
|
|
#include <class_drawsegment.h>
|
|
|
|
#include <class_mire.h>
|
|
|
|
#include <class_dimension.h>
|
|
|
|
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbplot.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
static void Plot_Edges_Modules( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
|
|
|
BOARD* pcb, int aLayerMask, EDA_DRAW_MODE_T trace_mode );
|
|
|
|
|
|
|
|
static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte, EDA_DRAW_MODE_T 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
|
|
|
*/
|
2012-04-05 18:27:56 +00:00
|
|
|
void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* aPlotter, int aLayerMask, EDA_DRAW_MODE_T trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
bool trace_val, trace_ref;
|
|
|
|
TEXTE_MODULE* pt_texte;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot edge layer and graphic items
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
for( EDA_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( item->Type() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, plot_opts, (DRAWSEGMENT*) item, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextePcb( aPlotter, plot_opts, (TEXTE_PCB*) item, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDimension( aPlotter, plot_opts, (DIMENSION*) item, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotPcbTarget( aPlotter, plot_opts, (PCB_TARGET*) item, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T:
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-09-20 15:07:52 +00:00
|
|
|
DisplayError( this, wxT( "PlotSilkScreen() error: unexpected Type()" ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot footprint outlines :
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_Edges_Modules( aPlotter, plot_opts, m_Pcb, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot pads (creates pads outlines, for pads on silkscreen layers)
|
2011-09-07 19:41:04 +00:00
|
|
|
int layersmask_plotpads = aLayerMask;
|
2010-09-24 16:36:20 +00:00
|
|
|
// Calculate the mask layers of allowed layers for pads
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !plot_opts.m_PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
|
2010-11-12 18:38:48 +00:00
|
|
|
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-09-24 16:36:20 +00:00
|
|
|
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
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
// See if the pad is on this layer
|
|
|
|
if( (pad->GetLayerMask() & 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
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( pad->GetShape() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_CIRCLE:
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->flash_pad_circle( shape_pos, pad->GetSize().x, LINE );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_OVAL:
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->flash_pad_oval( shape_pos, pad->GetSize(), pad->GetOrientation(), LINE );
|
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:
|
2012-02-19 04:02:19 +00:00
|
|
|
{
|
|
|
|
wxPoint coord[4];
|
|
|
|
pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->flash_pad_trapez( shape_pos, coord, pad->GetOrientation(), LINE );
|
2012-02-19 04:02:19 +00:00
|
|
|
}
|
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:
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->flash_pad_rect( shape_pos, pad->GetSize(), pad->GetOrientation(), LINE );
|
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
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot footprints fields (ref, value ...)
|
2012-04-05 18:27:56 +00:00
|
|
|
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
// see if we want to plot VALUE and REF fields
|
2012-04-05 18:27:56 +00:00
|
|
|
trace_val = plot_opts.m_PlotValue;
|
|
|
|
trace_ref = plot_opts.m_PlotReference;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27: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." ),
|
2012-04-05 18:27:56 +00:00
|
|
|
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
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
|
|
|
|
trace_ref = false;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !text->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
|
2011-09-07 19:41:04 +00:00
|
|
|
trace_ref = false;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27: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." ),
|
2012-04-05 18:27:56 +00:00
|
|
|
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
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
if( ( (1 << textLayer) & aLayerMask ) == 0 )
|
|
|
|
trace_val = false;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !text->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
|
2011-09-07 19:41:04 +00:00
|
|
|
trace_val = false;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot text fields, if allowed
|
2007-12-11 20:28:13 +00:00
|
|
|
if( trace_ref )
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextModule( aPlotter, module->m_Reference, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( trace_val )
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextModule( aPlotter, module->m_Value, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +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
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
if( pt_texte->Type() != PCB_MODULE_TEXT_T )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !plot_opts.m_PlotTextOther )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !pt_texte->IsVisible() && !plot_opts.m_PlotInvisibleTexts )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
|
|
|
textLayer = pt_texte->GetLayer();
|
2011-09-07 19:41:04 +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 \"module text\" text of %s." ),
|
2012-04-05 18:27:56 +00:00
|
|
|
textLayer, GetChars( module->GetReference() ),
|
2009-11-20 14:55:20 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
if( !( ( 1 << textLayer ) & aLayerMask ) )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextModule( aPlotter, pt_texte, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2012-02-19 04:02:19 +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 );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
|
|
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
2008-10-07 12:10:24 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotFilledAreas( aPlotter, plot_opts, 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() )
|
|
|
|
{
|
2011-09-07 19:41:04 +00:00
|
|
|
if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 )
|
2009-05-01 16:46:56 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->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
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte, EDA_DRAW_MODE_T 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
|
|
|
|
2012-02-19 04:02:19 +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
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
thickness = pt_texte->m_Thickness;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-01-03 17:14:17 +00:00
|
|
|
if( trace_mode == LINE )
|
2009-06-28 16:50:42 +00:00
|
|
|
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;
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->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
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
void PlotDimension( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, DIMENSION* aDim, int aLayerMask,
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_DRAW_MODE_T trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +00:00
|
|
|
if( (GetLayerMask( aDim->GetLayer() ) & aLayerMask) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
DRAWSEGMENT draw;
|
|
|
|
|
2012-01-03 17:14:17 +00:00
|
|
|
draw.SetWidth( (trace_mode==LINE) ? -1 : aDim->GetWidth() );
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetLayer( aDim->GetLayer() );
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextePcb( aPlotter, aPlotOpts, &aDim->m_Text, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_crossBarOx, aDim->m_crossBarOy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_crossBarFx, aDim->m_crossBarFy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_featureLineGOx, aDim->m_featureLineGOy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_featureLineGFx, aDim->m_featureLineGFy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_featureLineDOx, aDim->m_featureLineDOy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_featureLineDFx, aDim->m_featureLineDFy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_arrowD1Ox, aDim->m_arrowD1Oy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_arrowD1Fx, aDim->m_arrowD1Fy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_arrowD2Ox, aDim->m_arrowD2Oy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_arrowD2Fx, aDim->m_arrowD2Fy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_arrowG1Ox, aDim->m_arrowG1Oy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_arrowG1Fx, aDim->m_arrowG1Fy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2011-12-14 04:29:25 +00:00
|
|
|
|
|
|
|
draw.SetStart( wxPoint( aDim->m_arrowG2Ox, aDim->m_arrowG2Oy ));
|
|
|
|
draw.SetEnd( wxPoint( aDim->m_arrowG2Fx, aDim->m_arrowG2Fy ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
void PlotPcbTarget( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, PCB_TARGET* aMire, int aLayerMask,
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_DRAW_MODE_T trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +00:00
|
|
|
int dx1, dx2, dy1, dy2, radius;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
if( (GetLayerMask( aMire->GetLayer() ) & aLayerMask) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
DRAWSEGMENT draw;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetShape( S_CIRCLE );
|
2012-01-03 17:14:17 +00:00
|
|
|
draw.SetWidth( ( trace_mode == LINE ) ? -1 : aMire->GetWidth() );
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetLayer( aMire->GetLayer() );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetStart( aMire->GetPosition() );
|
|
|
|
draw.SetEnd( wxPoint( draw.GetStart().x + ( aMire->GetSize() / 4 ), draw.GetStart().y ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetShape( S_SEGMENT );
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
radius = aMire->GetSize() / 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
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
if( aMire->GetShape() ) // 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
|
|
|
}
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
wxPoint mirePos( aMire->GetPosition() );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ));
|
|
|
|
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ));
|
|
|
|
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ));
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot footprints graphic items (outlines)
|
2012-04-05 18:27:56 +00:00
|
|
|
void Plot_Edges_Modules( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, BOARD* aPcb, int aLayerMask, EDA_DRAW_MODE_T trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-04-05 18:27:56 +00:00
|
|
|
for( MODULE* module = aPcb->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
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
if( edge->Type() != PCB_MODULE_EDGE_T )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( ( GetLayerMask( edge->GetLayer() ) & aLayerMask ) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_1_EdgeModule( aPlotter, aPlotOpts, edge, trace_mode, aLayerMask );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
//* Plot a graphic item (outline) relative to a footprint
|
2012-04-05 18:27:56 +00:00
|
|
|
void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
|
|
|
EDGE_MODULE* aEdge, EDA_DRAW_MODE_T trace_mode, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +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
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
if( aEdge->Type() != PCB_MODULE_EDGE_T )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
type_trace = aEdge->GetShape();
|
|
|
|
thickness = aEdge->GetWidth();
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
wxPoint pos( aEdge->GetStart() );
|
|
|
|
wxPoint end( aEdge->GetEnd() );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
switch( type_trace )
|
|
|
|
{
|
|
|
|
case S_SEGMENT:
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_segment( pos, end, thickness, trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
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 ) );
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_circle( pos, radius * 2, thickness, trace_mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2011-12-14 04:29:25 +00:00
|
|
|
{
|
|
|
|
radius = (int) hypot( (double) ( end.x - pos.x ),
|
|
|
|
(double) ( end.y - pos.y ) );
|
|
|
|
|
|
|
|
double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
|
|
|
|
|
|
|
double endAngle = startAngle + aEdge->GetAngle();
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if ( ( aPlotOpts.GetPlotFormat() == PLOT_FORMAT_DXF ) &&
|
2012-02-19 04:02:19 +00:00
|
|
|
( masque_layer & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_arc( pos,
|
2012-02-01 11:42:18 +00:00
|
|
|
-startAngle,
|
|
|
|
-endAngle,
|
|
|
|
radius,
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
|
|
|
else
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_arc( pos,
|
2011-12-14 04:29:25 +00:00
|
|
|
-endAngle,
|
|
|
|
-startAngle,
|
|
|
|
radius,
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_POLYGON:
|
2011-12-14 04:29:25 +00:00
|
|
|
{
|
|
|
|
const std::vector<wxPoint>& polyPoints = aEdge->GetPolyPoints();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
if( polyPoints.size() <= 1 ) // Malformed polygon
|
|
|
|
break;
|
2011-04-20 08:13:21 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
// We must compute true coordinates from m_PolyList
|
|
|
|
// which are relative to module position, orientation 0
|
|
|
|
MODULE* module = aEdge->GetParentModule();
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
std::vector< wxPoint > cornerList;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
cornerList.reserve( polyPoints.size() );
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
for( unsigned ii = 0; ii < polyPoints.size(); ii++ )
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +00:00
|
|
|
wxPoint corner = polyPoints[ii];
|
|
|
|
|
|
|
|
if( module )
|
|
|
|
{
|
|
|
|
RotatePoint( &corner, module->GetOrientation() );
|
|
|
|
corner += module->GetPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
cornerList.push_back( corner );
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->PlotPoly( cornerList, FILLED_SHAPE, thickness );
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2011-12-14 04:29:25 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot a PCB Text, i;e. a text found on a copper or technical layer
|
2012-04-05 18:27:56 +00:00
|
|
|
void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PCB* pt_texte, int aLayerMask,
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_DRAW_MODE_T 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;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( ( GetLayerMask( pt_texte->GetLayer() ) & aLayerMask ) == 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;
|
2012-01-03 17:14:17 +00:00
|
|
|
thickness = ( trace_mode==LINE ) ? -1 : pt_texte->m_Thickness;
|
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 );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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 );
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->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;
|
|
|
|
}
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
delete list;
|
2009-05-12 12:12:34 +00:00
|
|
|
}
|
|
|
|
else
|
2011-09-07 19:41:04 +00:00
|
|
|
{
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->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 );
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
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
|
|
|
*/
|
2012-04-05 18:27:56 +00:00
|
|
|
void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone, EDA_DRAW_MODE_T trace_mode )
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
unsigned imax = aZone->m_FilledPolysList.size();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
if( imax == 0 ) // Nothing to draw
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We need a buffer to store corners coordinates:
|
2011-04-20 08:13:21 +00:00
|
|
|
static std::vector< wxPoint > cornerList;
|
|
|
|
cornerList.clear();
|
2009-03-18 15:38:16 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2011-04-20 08:13:21 +00:00
|
|
|
for( unsigned ic = 0; ic < imax; ic++ )
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
|
|
|
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
2011-04-20 08:13:21 +00:00
|
|
|
cornerList.push_back( wxPoint( corner->x, corner->y) );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
if( corner->end_contour ) // Plot the current filled area outline
|
|
|
|
{
|
|
|
|
// First, close the outline
|
2011-04-20 08:13:21 +00:00
|
|
|
if( cornerList[0] != cornerList[cornerList.size() - 1] )
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
2011-04-20 08:13:21 +00:00
|
|
|
cornerList.push_back( cornerList[0] );
|
2009-03-18 15:38:16 +00:00
|
|
|
}
|
|
|
|
|
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
|
2011-09-07 19:41:04 +00:00
|
|
|
{ // (if != 0: using segments )
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->PlotPoly( cornerList, FILLED_SHAPE );
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
2009-11-20 14:55:20 +00:00
|
|
|
else // We are using areas filled by
|
2011-09-07 19:41:04 +00:00
|
|
|
{ // segments: plot them )
|
|
|
|
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;
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_segment( start,
|
2009-11-20 14:55:20 +00:00
|
|
|
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 )
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->PlotPoly( cornerList, NO_FILL, aZone->m_ZoneMinThickness );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( aZone->m_ZoneMinThickness > 0 )
|
|
|
|
{
|
2011-04-20 08:13:21 +00:00
|
|
|
for( unsigned jj = 1; jj<cornerList.size(); jj++ )
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_segment( cornerList[jj -1], cornerList[jj],
|
2012-01-03 17:14:17 +00:00
|
|
|
( trace_mode == LINE ) ? -1 : aZone->m_ZoneMinThickness,
|
2011-09-07 19:41:04 +00:00
|
|
|
trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->set_current_line_width( -1 );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-04-20 08:13:21 +00:00
|
|
|
cornerList.clear();
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
|
2007-12-11 20:28:13 +00:00
|
|
|
*/
|
2012-04-05 18:27:56 +00:00
|
|
|
void PlotDrawSegment( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, DRAWSEGMENT* aSeg, int aLayerMask,
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_DRAW_MODE_T trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
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
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
if( (GetLayerMask( aSeg->GetLayer() ) & aLayerMask) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
|
|
|
|
2012-01-03 17:14:17 +00:00
|
|
|
if( trace_mode == LINE )
|
2012-04-05 18:27:56 +00:00
|
|
|
thickness = aPlotOpts.m_PlotLineWidth;
|
2009-06-28 16:50:42 +00:00
|
|
|
else
|
2011-12-14 04:29:25 +00:00
|
|
|
thickness = aSeg->GetWidth();
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
wxPoint start( aSeg->GetStart() );
|
|
|
|
wxPoint end( aSeg->GetEnd() );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->set_current_line_width( thickness );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
switch( aSeg->GetShape() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case S_CIRCLE:
|
2011-09-07 19:41:04 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - start.x ),
|
|
|
|
(double) ( end.y - start.y ) );
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_circle( start, radius * 2, thickness, trace_mode );
|
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 S_ARC:
|
2011-09-07 19:41:04 +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 );
|
2011-12-14 04:29:25 +00:00
|
|
|
EndAngle = StAngle + aSeg->GetAngle();
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->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:
|
2011-12-14 04:29:25 +00:00
|
|
|
{
|
|
|
|
const std::vector<wxPoint>& bezierPoints = aSeg->GetBezierPoints();
|
|
|
|
|
|
|
|
for( unsigned i = 1; i < bezierPoints.size(); i++ )
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_segment( bezierPoints[i - 1],
|
2011-12-14 04:29:25 +00:00
|
|
|
bezierPoints[i],
|
|
|
|
thickness,
|
|
|
|
trace_mode );
|
|
|
|
}
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->thick_segment( start, end, thickness, trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
void PCB_BASE_FRAME::Plot_Layer( PLOTTER* aPlotter, int Layer, EDA_DRAW_MODE_T trace_mode )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
|
|
|
|
|
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.
|
2011-12-06 08:35:13 +00:00
|
|
|
int layer_mask = GetLayerMask( Layer );
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( !plot_opts.m_ExcludeEdgeLayer )
|
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:
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_Standard_Layer( aPlotter, layer_mask, true, trace_mode,
|
|
|
|
plot_opts.m_SkipNPTH_Pads );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
// Adding drill marks, if required and if the plotter is able to plot them:
|
2012-04-05 18:27:56 +00:00
|
|
|
if( plot_opts.m_DrillShapeOpt != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
|
2009-08-29 10:20:48 +00:00
|
|
|
{
|
2012-04-05 18:27:56 +00:00
|
|
|
if( aPlotter->GetPlotterType() == PLOT_FORMAT_POST )
|
|
|
|
PlotDrillMark( aPlotter, trace_mode,
|
|
|
|
plot_opts.m_DrillShapeOpt ==
|
2010-12-11 18:40:39 +00:00
|
|
|
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE );
|
2009-08-29 10:20:48 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +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:
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_Standard_Layer( aPlotter, layer_mask,
|
|
|
|
plot_opts.m_PlotViaOnMaskLayer, trace_mode );
|
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 SOLDERPASTE_N_BACK:
|
|
|
|
case SOLDERPASTE_N_FRONT:
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_Standard_Layer( aPlotter, layer_mask, false, trace_mode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
2011-11-30 22:06:27 +00:00
|
|
|
case SILKSCREEN_N_FRONT:
|
|
|
|
case SILKSCREEN_N_BACK:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotSilkScreen( aPlotter, layer_mask, trace_mode );
|
2010-12-06 22:18:39 +00:00
|
|
|
|
2010-12-06 22:05:12 +00:00
|
|
|
// Gerber: Subtract soldermask from silkscreen if enabled
|
2012-04-05 18:27:56 +00:00
|
|
|
if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER
|
|
|
|
&& plot_opts.GetSubtractMaskFromSilk() )
|
2010-12-06 22:05:12 +00:00
|
|
|
{
|
|
|
|
if( Layer == SILKSCREEN_N_FRONT )
|
|
|
|
{
|
2011-12-06 08:35:13 +00:00
|
|
|
layer_mask = GetLayerMask( SOLDERMASK_N_FRONT );
|
2010-12-06 22:05:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-06 08:35:13 +00:00
|
|
|
layer_mask = GetLayerMask( SOLDERMASK_N_BACK );
|
2010-12-06 22:05:12 +00:00
|
|
|
}
|
2010-12-06 22:18:39 +00:00
|
|
|
|
2010-12-06 22:05:12 +00:00
|
|
|
// Set layer polarity to negative
|
2012-04-05 18:27:56 +00:00
|
|
|
aPlotter->SetLayerPolarity( false );
|
|
|
|
Plot_Standard_Layer( aPlotter, layer_mask,
|
|
|
|
plot_opts.m_PlotViaOnMaskLayer,
|
2010-12-06 22:05:12 +00:00
|
|
|
trace_mode );
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
2011-11-30 22:06:27 +00:00
|
|
|
|
|
|
|
default:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotSilkScreen( aPlotter, layer_mask, trace_mode );
|
2011-11-30 22:06:27 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
|
2012-03-24 14:25:30 +00:00
|
|
|
/* Plot a copper layer or mask.
|
|
|
|
* Silk screen layers are not plotted here.
|
2009-06-28 16:50:42 +00:00
|
|
|
*/
|
2012-01-03 17:14:17 +00:00
|
|
|
void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|
|
|
int aLayerMask,
|
|
|
|
bool aPlotVia,
|
|
|
|
EDA_DRAW_MODE_T aPlotMode,
|
|
|
|
bool aSkipNPTH_Pads )
|
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
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
|
|
|
|
|
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() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDrawSegment( aPlotter, plot_opts, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotTextePcb( aPlotter, plot_opts, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotDimension( aPlotter, plot_opts, (DIMENSION*) item, aLayerMask, aPlotMode );
|
2009-06-29 05:30:08 +00:00
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotPcbTarget( aPlotter, plot_opts, (PCB_TARGET*) item, aLayerMask, aPlotMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T:
|
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:
|
2011-08-19 13:08:24 +00:00
|
|
|
wxMessageBox( 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Draw footprint shapes without pads (pads will plotted later)
|
2012-04-05 18:27:56 +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() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-12-06 08:35:13 +00:00
|
|
|
if( aLayerMask & GetLayerMask( item->GetLayer() ) )
|
2012-04-05 18:27:56 +00:00
|
|
|
Plot_1_EdgeModule( aPlotter, plot_opts, (EDGE_MODULE*) item, aPlotMode, aLayerMask );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot footprint pads
|
2012-04-05 18:27:56 +00:00
|
|
|
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-04-05 18:27:56 +00:00
|
|
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
if( (pad->GetLayerMask() & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
wxPoint shape_pos = pad->ReturnShapePos();
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
pos = shape_pos;
|
2012-04-05 18:27:56 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
wxSize margin;
|
2012-01-07 06:02:38 +00:00
|
|
|
double width_adj = 0;
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
if( aLayerMask & ALL_CU_LAYERS )
|
|
|
|
{
|
|
|
|
width_adj = aPlotter->get_plot_width_adj();
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
size.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj;
|
|
|
|
size.y = pad->GetSize().y + ( 2 * margin.y ) + width_adj;
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Don't draw a null size item :
|
2009-06-28 16:50:42 +00:00
|
|
|
if( size.x <= 0 || size.y <= 0 )
|
|
|
|
continue;
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( pad->GetShape() )
|
2009-06-29 05:30:08 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case PAD_CIRCLE:
|
2011-08-19 13:08:24 +00:00
|
|
|
if( aSkipNPTH_Pads &&
|
2012-02-19 04:02:19 +00:00
|
|
|
(pad->GetSize() == pad->GetDrillSize()) &&
|
|
|
|
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
|
2011-08-19 13:08:24 +00:00
|
|
|
break;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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:
|
2011-08-19 13:08:24 +00:00
|
|
|
if( aSkipNPTH_Pads &&
|
2012-02-19 04:02:19 +00:00
|
|
|
(pad->GetSize() == pad->GetDrillSize()) &&
|
|
|
|
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
|
2011-08-19 13:08:24 +00:00
|
|
|
break;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
aPlotter->flash_pad_oval( pos, size, pad->GetOrientation(), 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 );
|
2012-02-19 04:02:19 +00:00
|
|
|
aPlotter->flash_pad_trapez( pos, coord, pad->GetOrientation(), 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:
|
2012-02-19 04:02:19 +00:00
|
|
|
aPlotter->flash_pad_rect( pos, size, pad->GetOrientation(), 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
|
|
|
|
2012-02-19 04:02:19 +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
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
if( track->Type() != PCB_VIA_T )
|
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
|
|
|
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();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
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;
|
2012-01-07 06:02:38 +00:00
|
|
|
double width_adj = 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 ) ) )
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
via_margin = GetBoard()->GetDesignSettings().m_SolderMaskMargin;
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
if( aLayerMask & ALL_CU_LAYERS )
|
|
|
|
{
|
|
|
|
width_adj = aPlotter->get_plot_width_adj();
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
pos = Via->m_Start;
|
2012-01-07 06:02:38 +00:00
|
|
|
size.x = size.y = Via->m_Width + 2 * via_margin + width_adj;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Don't draw a null size item :
|
2009-06-28 16:50:42 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +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
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( track->Type() == PCB_VIA_T )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
size.x = size.y = track->m_Width + aPlotter->get_plot_width_adj();
|
2009-06-28 16:50:42 +00:00
|
|
|
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
|
|
|
|
2012-02-19 04:02:19 +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
|
|
|
|
2011-12-06 08:35:13 +00:00
|
|
|
if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
size.x = size.y = track->m_Width + aPlotter->get_plot_width_adj();
|
2009-06-28 16:50:42 +00:00
|
|
|
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
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Plot filled ares
|
2009-06-28 16:50:42 +00:00
|
|
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
PlotFilledAreas( aPlotter, plot_opts, 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
|
|
|
*/
|
2012-01-03 17:14:17 +00:00
|
|
|
void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
|
|
|
EDA_DRAW_MODE_T aTraceMode,
|
|
|
|
bool aSmallDrillShape )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
wxPoint pos;
|
|
|
|
wxSize diam;
|
|
|
|
MODULE* Module;
|
2012-02-19 04:02:19 +00:00
|
|
|
D_PAD* pad;
|
2009-06-28 16:50:42 +00:00
|
|
|
TRACK* pts;
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
|
|
|
|
|
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() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
if( pts->Type() != PCB_VIA_T )
|
2009-06-28 16:50:42 +00:00
|
|
|
continue;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
pos = pts->m_Start;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
// It is quite possible that the real drill value is less then small drill value.
|
2012-04-05 18:27:56 +00:00
|
|
|
if( plot_opts.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
|
2012-01-07 06:02:38 +00:00
|
|
|
diam.x = diam.y = MIN( SMALL_DRILL, pts->GetDrillValue() );
|
2009-06-28 16:50:42 +00:00
|
|
|
else
|
|
|
|
diam.x = diam.y = pts->GetDrillValue();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-01-07 06:02:38 +00:00
|
|
|
diam.x -= aPlotter->get_plot_width_adj();
|
2012-03-26 21:45:05 +00:00
|
|
|
diam.x = Clamp( 1, diam.x, pts->m_Width - 1 );
|
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
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
for( Module = m_Pcb->m_Modules; Module != NULL; Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
for( pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
if( pad->GetDrillSize().x == 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
|
|
|
// Output hole shapes:
|
2012-02-19 04:02:19 +00:00
|
|
|
pos = pad->GetPosition();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( pad->GetDrillShape() == PAD_OVAL )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
diam = pad->GetDrillSize();
|
2012-01-07 06:02:38 +00:00
|
|
|
diam.x -= aPlotter->get_plot_width_adj();
|
2012-03-26 21:45:05 +00:00
|
|
|
diam.x = Clamp( 1, diam.x, pad->GetSize().x - 1 );
|
2012-01-07 06:02:38 +00:00
|
|
|
diam.y -= aPlotter->get_plot_width_adj();
|
2012-03-26 21:45:05 +00:00
|
|
|
diam.y = Clamp( 1, diam.y, pad->GetSize().y - 1 );
|
2012-02-19 04:02:19 +00:00
|
|
|
aPlotter->flash_pad_oval( pos, diam, pad->GetOrientation(), aTraceMode );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-01-07 06:02:38 +00:00
|
|
|
// It is quite possible that the real pad drill value is less then small drill value.
|
2012-02-19 04:02:19 +00:00
|
|
|
diam.x = aSmallDrillShape ? MIN( SMALL_DRILL, pad->GetDrillSize().x ) : pad->GetDrillSize().x;
|
2012-01-07 06:02:38 +00:00
|
|
|
diam.x -= aPlotter->get_plot_width_adj();
|
2012-03-26 21:45:05 +00:00
|
|
|
diam.x = Clamp( 1, diam.x, pad->GetSize().x - 1 );
|
2009-08-29 10:20:48 +00:00
|
|
|
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
|
|
|
}
|