Pcbnew: some code cleanup in plot functions.
This commit is contained in:
parent
b1c9c54221
commit
eb94e66c9d
|
@ -41,7 +41,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
wxPoint offset;
|
wxPoint offset;
|
||||||
PLOTTER* plotter = NULL;
|
PLOTTER* plotter = NULL;
|
||||||
|
|
||||||
const PCB_PLOT_PARAMS& plot_opts = aPcb->GetPlotOptions();
|
PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
|
||||||
|
|
||||||
LOCALE_IO toggle; // use standard C notation for float numbers
|
LOCALE_IO toggle; // use standard C notation for float numbers
|
||||||
|
|
||||||
|
@ -131,33 +131,26 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
plotter->SetDefaultLineWidth( 10 * IU_PER_DECIMILS );
|
plotter->SetDefaultLineWidth( 10 * IU_PER_DECIMILS );
|
||||||
plotter->StartPlot( aFile );
|
plotter->StartPlot( aFile );
|
||||||
|
|
||||||
// Draw items on edge layer
|
// Draw items on edge layer (not all, only items useful for drill map
|
||||||
|
BRDITEMS_PLOTTER itemplotter( plotter, aPcb, plot_opts );
|
||||||
|
itemplotter.SetLayerMask( EDGE_LAYER );
|
||||||
|
|
||||||
for( EDA_ITEM* PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
for( EDA_ITEM* PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
{
|
{
|
||||||
switch( PtStruct->Type() )
|
switch( PtStruct->Type() )
|
||||||
{
|
{
|
||||||
case PCB_LINE_T:
|
case PCB_LINE_T:
|
||||||
PlotDrawSegment( plotter, plot_opts, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
|
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) PtStruct );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
PlotTextePcb( plotter, plot_opts, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
|
itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_DIMENSION_T:
|
case PCB_DIMENSION_T:
|
||||||
PlotDimension( plotter, plot_opts, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
PlotPcbTarget( plotter, plot_opts, (PCB_TARGET*) PtStruct, EDGE_LAYER, FILLED );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PCB_MARKER_T: // do not draw
|
case PCB_MARKER_T: // do not draw
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( NULL, wxT( "WinEDA_DrillFrame::GenDrillMap() : Unexpected Draw Type" ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,16 @@
|
||||||
|
|
||||||
#include <pcb_plot_params.h>
|
#include <pcb_plot_params.h>
|
||||||
|
|
||||||
|
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
class TEXTE_PCB;
|
class TEXTE_PCB;
|
||||||
class DRAWSEGMENT;
|
class DRAWSEGMENT;
|
||||||
class DIMENSION;
|
class DIMENSION;
|
||||||
|
class MODULE;
|
||||||
class EDGE_MODULE;
|
class EDGE_MODULE;
|
||||||
class PCB_TARGET;
|
class PCB_TARGET;
|
||||||
|
class TEXTE_MODULE;
|
||||||
class ZONE_CONTAINER;
|
class ZONE_CONTAINER;
|
||||||
|
class BOARD;
|
||||||
|
|
||||||
|
|
||||||
// Shared Config keys for plot and print
|
// Shared Config keys for plot and print
|
||||||
|
@ -43,25 +45,44 @@ class ZONE_CONTAINER;
|
||||||
|
|
||||||
// Small drill marks diameter value (in 1/10000 inch)
|
// Small drill marks diameter value (in 1/10000 inch)
|
||||||
#define SMALL_DRILL 150
|
#define SMALL_DRILL 150
|
||||||
|
// A helper class to plot board items
|
||||||
|
class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS
|
||||||
|
{
|
||||||
|
PLOTTER* m_plotter;
|
||||||
|
BOARD* m_board;
|
||||||
|
int m_layerMask;
|
||||||
|
|
||||||
|
public:
|
||||||
|
BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts )
|
||||||
|
: PCB_PLOT_PARAMS( aPlotOpts )
|
||||||
|
{
|
||||||
|
m_plotter = aPlotter;
|
||||||
|
m_board = aBoard;
|
||||||
|
m_layerMask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void PlotTextePcb( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PCB* pt_texte, int masque_layer,
|
// Basic functions to plot a board item
|
||||||
EDA_DRAW_MODE_T trace_mode );
|
void SetLayerMask( int aLayerMask ){ m_layerMask = aLayerMask; }
|
||||||
|
void Plot_Edges_Modules();
|
||||||
|
void Plot_1_EdgeModule( EDGE_MODULE* aEdge );
|
||||||
|
void PlotTextModule( TEXTE_MODULE* aTextMod, EDA_COLOR_T aColor );
|
||||||
|
bool PlotAllTextsModule( MODULE* aModule );
|
||||||
|
void PlotDimension( DIMENSION* Dimension );
|
||||||
|
void PlotPcbTarget( PCB_TARGET* PtMire );
|
||||||
|
void PlotFilledAreas( ZONE_CONTAINER* aZone );
|
||||||
|
void PlotTextePcb( TEXTE_PCB* pt_texte );
|
||||||
|
void PlotDrawSegment( DRAWSEGMENT* PtSegm );
|
||||||
|
|
||||||
void PlotDrawSegment( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, DRAWSEGMENT* PtSegm, int masque_layer,
|
/**
|
||||||
EDA_DRAW_MODE_T trace_mode );
|
* Function getColor
|
||||||
|
* @return the layer color
|
||||||
void PlotDimension( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, DIMENSION* Dimension, int masque_layer,
|
* @param aLayer = the layer id
|
||||||
EDA_DRAW_MODE_T trace_mode );
|
* White color is special: cannot be seen on a white paper
|
||||||
|
* and in B&W mode, is plotted as white but other colors are plotted in BLACK
|
||||||
void PlotPcbTarget( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, PCB_TARGET* PtMire, int masque_layer,
|
* so the returned color is LIGHTGRAY when the layer color is WHITE
|
||||||
EDA_DRAW_MODE_T trace_mode );
|
*/
|
||||||
|
EDA_COLOR_T getColor( int aLayer );
|
||||||
void Plot_1_EdgeModule( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, EDGE_MODULE* PtEdge,
|
};
|
||||||
EDA_DRAW_MODE_T trace_mode, int masque_layer );
|
|
||||||
|
|
||||||
void PlotFilledAreas( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone,
|
|
||||||
EDA_DRAW_MODE_T trace_mode );
|
|
||||||
|
|
||||||
PLOTTER *StartPlotBoard( BOARD *aBoard,
|
PLOTTER *StartPlotBoard( BOARD *aBoard,
|
||||||
PCB_PLOT_PARAMS *aPlotOpts,
|
PCB_PLOT_PARAMS *aPlotOpts,
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
#include <plot_common.h>
|
#include <plot_common.h>
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <drawtxt.h>
|
#include <drawtxt.h>
|
||||||
#include <confirm.h>
|
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <wxBasePcbFrame.h>
|
#include <wxBasePcbFrame.h>
|
||||||
#include <pcbcommon.h>
|
#include <pcbcommon.h>
|
||||||
#include <macros.h>
|
|
||||||
|
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
|
@ -27,79 +25,78 @@
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <pcbplot.h>
|
#include <pcbplot.h>
|
||||||
|
|
||||||
static void Plot_Edges_Modules( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
/* Function getColor
|
||||||
BOARD* pcb, int aLayerMask, EDA_DRAW_MODE_T trace_mode );
|
* return the layer colorfrom the layer id
|
||||||
|
* White color is special: cannot be seen on a white paper
|
||||||
static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte,
|
* and in B&W mode, is plotted as white but other colors are plotted in BLACK
|
||||||
EDA_DRAW_MODE_T trace_mode, EDA_COLOR_T aColor );
|
* so the returned color is LIGHTGRAY when the layer color is WHITE
|
||||||
|
*/
|
||||||
|
EDA_COLOR_T BRDITEMS_PLOTTER::getColor( int aLayer )
|
||||||
static bool PlotAllTextsModule( PLOTTER* aPlotter, BOARD* aBoard,
|
|
||||||
long aLayerMask, MODULE* aModule,
|
|
||||||
const PCB_PLOT_PARAMS& aPlotOpt )
|
|
||||||
{
|
{
|
||||||
TEXTE_MODULE* pt_texte;
|
EDA_COLOR_T color = m_board->GetLayerColor( aLayer );
|
||||||
EDA_DRAW_MODE_T trace_mode = aPlotOpt.GetMode();
|
if (color == WHITE)
|
||||||
|
color = LIGHTGRAY;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
|
||||||
|
{
|
||||||
// see if we want to plot VALUE and REF fields
|
// see if we want to plot VALUE and REF fields
|
||||||
bool trace_val = aPlotOpt.GetPlotValue();
|
bool trace_val = GetPlotValue();
|
||||||
bool trace_ref = aPlotOpt.GetPlotReference();
|
bool trace_ref = GetPlotReference();
|
||||||
|
|
||||||
TEXTE_MODULE* text = aModule->m_Reference;
|
TEXTE_MODULE* textModule = aModule->m_Reference;
|
||||||
unsigned textLayer = text->GetLayer();
|
unsigned textLayer = textModule->GetLayer();
|
||||||
|
|
||||||
if( textLayer >= 32 )
|
if( textLayer >= 32 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
|
if( ( ( 1 << textLayer ) & m_layerMask ) == 0 )
|
||||||
trace_ref = false;
|
trace_ref = false;
|
||||||
|
|
||||||
if( !text->IsVisible() && !aPlotOpt.GetPlotInvisibleText() )
|
if( !textModule->IsVisible() && !GetPlotInvisibleText() )
|
||||||
trace_ref = false;
|
trace_ref = false;
|
||||||
|
|
||||||
text = aModule->m_Value;
|
textModule = aModule->m_Value;
|
||||||
textLayer = text->GetLayer();
|
textLayer = textModule->GetLayer();
|
||||||
|
|
||||||
if( textLayer > 32 )
|
if( textLayer > 32 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( ( (1 << textLayer) & aLayerMask ) == 0 )
|
if( ( (1 << textLayer) & m_layerMask ) == 0 )
|
||||||
trace_val = false;
|
trace_val = false;
|
||||||
|
|
||||||
if( !text->IsVisible() && !aPlotOpt.GetPlotInvisibleText() )
|
if( !textModule->IsVisible() && !GetPlotInvisibleText() )
|
||||||
trace_val = false;
|
trace_val = false;
|
||||||
|
|
||||||
// Plot text fields, if allowed
|
// Plot text fields, if allowed
|
||||||
if( trace_ref )
|
if( trace_ref )
|
||||||
PlotTextModule( aPlotter, aModule->m_Reference,
|
PlotTextModule( aModule->m_Reference, GetReferenceColor() );
|
||||||
trace_mode, aPlotOpt.GetReferenceColor() );
|
|
||||||
|
|
||||||
if( trace_val )
|
if( trace_val )
|
||||||
PlotTextModule( aPlotter, aModule->m_Value,
|
PlotTextModule( aModule->m_Value, GetValueColor() );
|
||||||
trace_mode, aPlotOpt.GetValueColor() );
|
|
||||||
|
|
||||||
for( pt_texte = (TEXTE_MODULE*) aModule->m_Drawings.GetFirst();
|
for( textModule = (TEXTE_MODULE*) aModule->m_Drawings.GetFirst();
|
||||||
pt_texte != NULL; pt_texte = pt_texte->Next() )
|
textModule != NULL; textModule = textModule->Next() )
|
||||||
{
|
{
|
||||||
if( pt_texte->Type() != PCB_MODULE_TEXT_T )
|
if( textModule->Type() != PCB_MODULE_TEXT_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !aPlotOpt.GetPlotOtherText() )
|
if( !GetPlotOtherText() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !pt_texte->IsVisible() && !aPlotOpt.GetPlotInvisibleText() )
|
if( !textModule->IsVisible() && !GetPlotInvisibleText() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
textLayer = pt_texte->GetLayer();
|
textLayer = textModule->GetLayer();
|
||||||
|
|
||||||
if( textLayer >= 32 )
|
if( textLayer >= 32 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !( ( 1 << textLayer ) & aLayerMask ) )
|
if( !( ( 1 << textLayer ) & m_layerMask ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EDA_COLOR_T color = aBoard->GetLayerColor( textLayer );
|
PlotTextModule( textModule, getColor( textLayer ) );
|
||||||
PlotTextModule( aPlotter, pt_texte, trace_mode, color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -110,41 +107,42 @@ static bool PlotAllTextsModule( PLOTTER* aPlotter, BOARD* aBoard,
|
||||||
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
|
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
|
||||||
const PCB_PLOT_PARAMS& aPlotOpt )
|
const PCB_PLOT_PARAMS& aPlotOpt )
|
||||||
{
|
{
|
||||||
EDA_DRAW_MODE_T trace_mode = aPlotOpt.GetMode();
|
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
|
||||||
|
itemplotter.SetLayerMask( aLayerMask );
|
||||||
|
|
||||||
// Plot edge layer and graphic items
|
// Plot edge layer and graphic items
|
||||||
|
|
||||||
for( EDA_ITEM* item = aBoard->m_Drawings; item; item = item->Next() )
|
for( EDA_ITEM* item = aBoard->m_Drawings; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_LINE_T:
|
case PCB_LINE_T:
|
||||||
PlotDrawSegment( aPlotter, aPlotOpt, (DRAWSEGMENT*) item, aLayerMask, trace_mode );
|
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
PlotTextePcb( aPlotter, aPlotOpt, (TEXTE_PCB*) item, aLayerMask, trace_mode );
|
itemplotter.PlotTextePcb( (TEXTE_PCB*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_DIMENSION_T:
|
case PCB_DIMENSION_T:
|
||||||
PlotDimension( aPlotter, aPlotOpt, (DIMENSION*) item, aLayerMask, trace_mode );
|
itemplotter.PlotDimension( (DIMENSION*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
PlotPcbTarget( aPlotter, aPlotOpt, (PCB_TARGET*) item, aLayerMask, trace_mode );
|
itemplotter.PlotPcbTarget( (PCB_TARGET*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_MARKER_T:
|
case PCB_MARKER_T:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( NULL, wxT( "PlotSilkScreen() error: unexpected Type()" ) );
|
wxLogMessage( wxT( "PlotSilkScreen() error: unexpected Type(%d)" ),
|
||||||
|
item->Type() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot footprint outlines :
|
// Plot footprint outlines :
|
||||||
Plot_Edges_Modules( aPlotter, aPlotOpt, aBoard, aLayerMask, trace_mode );
|
itemplotter.Plot_Edges_Modules();
|
||||||
|
|
||||||
// Plot pads (creates pads outlines, for pads on silkscreen layers)
|
// Plot pads (creates pads outlines, for pads on silkscreen layers)
|
||||||
int layersmask_plotpads = aLayerMask;
|
int layersmask_plotpads = aLayerMask;
|
||||||
|
@ -210,7 +208,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
|
||||||
// Plot footprints fields (ref, value ...)
|
// Plot footprints fields (ref, value ...)
|
||||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( ! PlotAllTextsModule( aPlotter, aBoard, aLayerMask, module, aPlotOpt ) )
|
if( ! itemplotter.PlotAllTextsModule( module ) )
|
||||||
{
|
{
|
||||||
wxLogMessage( _( "Your BOARD has a bad layer number for module %s" ),
|
wxLogMessage( _( "Your BOARD has a bad layer number for module %s" ),
|
||||||
GetChars( module->GetReference() ) );
|
GetChars( module->GetReference() ) );
|
||||||
|
@ -225,7 +223,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
|
||||||
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlotFilledAreas( aPlotter, aPlotOpt, edge_zone, trace_mode );
|
itemplotter.PlotFilledAreas( edge_zone );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot segments used to fill zone areas (outdated, but here for old boards
|
// Plot segments used to fill zone areas (outdated, but here for old boards
|
||||||
|
@ -235,19 +233,22 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
|
||||||
if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
aPlotter->ThickSegment( seg->m_Start, seg->m_End, seg->m_Width, trace_mode );
|
aPlotter->ThickSegment( seg->m_Start, seg->m_End, seg->m_Width,
|
||||||
|
itemplotter.GetMode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte,
|
void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte,
|
||||||
EDA_DRAW_MODE_T trace_mode, EDA_COLOR_T aColor )
|
EDA_COLOR_T aColor )
|
||||||
{
|
{
|
||||||
wxSize size;
|
wxSize size;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
int orient, thickness;
|
int orient, thickness;
|
||||||
|
|
||||||
aPlotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY);
|
if( aColor == WHITE )
|
||||||
|
aColor = LIGHTGRAY;
|
||||||
|
m_plotter->SetColor( aColor );
|
||||||
|
|
||||||
// calculate some text parameters :
|
// calculate some text parameters :
|
||||||
size = pt_texte->m_Size;
|
size = pt_texte->m_Size;
|
||||||
|
@ -257,7 +258,7 @@ static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte,
|
||||||
|
|
||||||
thickness = pt_texte->m_Thickness;
|
thickness = pt_texte->m_Thickness;
|
||||||
|
|
||||||
if( trace_mode == LINE )
|
if( GetMode() == LINE )
|
||||||
thickness = -1;
|
thickness = -1;
|
||||||
|
|
||||||
if( pt_texte->m_Mirror )
|
if( pt_texte->m_Mirror )
|
||||||
|
@ -269,7 +270,7 @@ static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte,
|
||||||
// So we set bold flag to true
|
// So we set bold flag to true
|
||||||
bool allow_bold = pt_texte->m_Bold || thickness;
|
bool allow_bold = pt_texte->m_Bold || thickness;
|
||||||
|
|
||||||
aPlotter->Text( pos, aColor,
|
m_plotter->Text( pos, aColor,
|
||||||
pt_texte->m_Text,
|
pt_texte->m_Text,
|
||||||
orient, size,
|
orient, size,
|
||||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||||
|
@ -277,80 +278,76 @@ static void PlotTextModule( PLOTTER* aPlotter, TEXTE_MODULE* pt_texte,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlotDimension( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
|
||||||
DIMENSION* aDim, int aLayerMask,
|
|
||||||
EDA_DRAW_MODE_T trace_mode )
|
|
||||||
{
|
{
|
||||||
if( (GetLayerMask( aDim->GetLayer() ) & aLayerMask) == 0 )
|
if( (GetLayerMask( aDim->GetLayer() ) & m_layerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DRAWSEGMENT draw;
|
DRAWSEGMENT draw;
|
||||||
|
|
||||||
draw.SetWidth( (trace_mode==LINE) ? -1 : aDim->GetWidth() );
|
draw.SetWidth( (GetMode() == LINE) ? -1 : aDim->GetWidth() );
|
||||||
draw.SetLayer( aDim->GetLayer() );
|
draw.SetLayer( aDim->GetLayer() );
|
||||||
|
|
||||||
EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() );
|
EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() );
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
// Set plot color (change WHITE to LIGHTGRAY because
|
||||||
// the white items are not seen on a white paper or screen
|
// the white items are not seen on a white paper or screen
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
||||||
|
|
||||||
PlotTextePcb( aPlotter, aPlotOpts, &aDim->m_Text, aLayerMask, trace_mode );
|
PlotTextePcb( &aDim->m_Text );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_crossBarOx, aDim->m_crossBarOy ));
|
draw.SetStart( wxPoint( aDim->m_crossBarOx, aDim->m_crossBarOy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_crossBarFx, aDim->m_crossBarFy ));
|
draw.SetEnd( wxPoint( aDim->m_crossBarFx, aDim->m_crossBarFy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_featureLineGOx, aDim->m_featureLineGOy ));
|
draw.SetStart( wxPoint( aDim->m_featureLineGOx, aDim->m_featureLineGOy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_featureLineGFx, aDim->m_featureLineGFy ));
|
draw.SetEnd( wxPoint( aDim->m_featureLineGFx, aDim->m_featureLineGFy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_featureLineDOx, aDim->m_featureLineDOy ));
|
draw.SetStart( wxPoint( aDim->m_featureLineDOx, aDim->m_featureLineDOy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_featureLineDFx, aDim->m_featureLineDFy ));
|
draw.SetEnd( wxPoint( aDim->m_featureLineDFx, aDim->m_featureLineDFy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_arrowD1Ox, aDim->m_arrowD1Oy ));
|
draw.SetStart( wxPoint( aDim->m_arrowD1Ox, aDim->m_arrowD1Oy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_arrowD1Fx, aDim->m_arrowD1Fy ));
|
draw.SetEnd( wxPoint( aDim->m_arrowD1Fx, aDim->m_arrowD1Fy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_arrowD2Ox, aDim->m_arrowD2Oy ));
|
draw.SetStart( wxPoint( aDim->m_arrowD2Ox, aDim->m_arrowD2Oy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_arrowD2Fx, aDim->m_arrowD2Fy ));
|
draw.SetEnd( wxPoint( aDim->m_arrowD2Fx, aDim->m_arrowD2Fy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_arrowG1Ox, aDim->m_arrowG1Oy ));
|
draw.SetStart( wxPoint( aDim->m_arrowG1Ox, aDim->m_arrowG1Oy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_arrowG1Fx, aDim->m_arrowG1Fy ));
|
draw.SetEnd( wxPoint( aDim->m_arrowG1Fx, aDim->m_arrowG1Fy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( aDim->m_arrowG2Ox, aDim->m_arrowG2Oy ));
|
draw.SetStart( wxPoint( aDim->m_arrowG2Ox, aDim->m_arrowG2Oy ));
|
||||||
draw.SetEnd( wxPoint( aDim->m_arrowG2Fx, aDim->m_arrowG2Fy ));
|
draw.SetEnd( wxPoint( aDim->m_arrowG2Fx, aDim->m_arrowG2Fy ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlotPcbTarget( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
|
||||||
PCB_TARGET* aMire, int aLayerMask,
|
|
||||||
EDA_DRAW_MODE_T trace_mode )
|
|
||||||
{
|
{
|
||||||
int dx1, dx2, dy1, dy2, radius;
|
int dx1, dx2, dy1, dy2, radius;
|
||||||
|
|
||||||
if( (GetLayerMask( aMire->GetLayer() ) & aLayerMask) == 0 )
|
if( (GetLayerMask( aMire->GetLayer() ) & m_layerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_COLOR_T color = aMire->GetBoard()->GetLayerColor( aMire->GetLayer() );
|
m_plotter->SetColor( getColor( aMire->GetLayer() ) );
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
|
||||||
// the white items are not seen on a white paper or screen
|
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
|
||||||
|
|
||||||
DRAWSEGMENT draw;
|
DRAWSEGMENT draw;
|
||||||
|
|
||||||
draw.SetShape( S_CIRCLE );
|
draw.SetShape( S_CIRCLE );
|
||||||
draw.SetWidth( ( trace_mode == LINE ) ? -1 : aMire->GetWidth() );
|
draw.SetWidth( ( GetMode() == LINE ) ? -1 : aMire->GetWidth() );
|
||||||
draw.SetLayer( aMire->GetLayer() );
|
draw.SetLayer( aMire->GetLayer() );
|
||||||
draw.SetStart( aMire->GetPosition() );
|
draw.SetStart( aMire->GetPosition() );
|
||||||
radius = aMire->GetSize() / 3;
|
radius = aMire->GetSize() / 3;
|
||||||
if( aMire->GetShape() ) // shape X
|
if( aMire->GetShape() ) // shape X
|
||||||
radius = aMire->GetSize() / 2;
|
radius = aMire->GetSize() / 2;
|
||||||
|
|
||||||
|
// Draw the circle
|
||||||
draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ));
|
draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
|
||||||
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetShape( S_SEGMENT );
|
draw.SetShape( S_SEGMENT );
|
||||||
|
|
||||||
|
@ -369,43 +366,39 @@ void PlotPcbTarget( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
|
|
||||||
wxPoint mirePos( aMire->GetPosition() );
|
wxPoint mirePos( aMire->GetPosition() );
|
||||||
|
|
||||||
|
// Draw the X or + shape:
|
||||||
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ));
|
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ));
|
||||||
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ));
|
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ));
|
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ));
|
||||||
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ));
|
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ));
|
||||||
PlotDrawSegment( aPlotter, aPlotOpts, &draw, aLayerMask, trace_mode );
|
PlotDrawSegment( &draw );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Plot footprints graphic items (outlines)
|
// Plot footprints graphic items (outlines)
|
||||||
static void Plot_Edges_Modules( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
void BRDITEMS_PLOTTER::Plot_Edges_Modules()
|
||||||
BOARD* aPcb, int aLayerMask,
|
|
||||||
EDA_DRAW_MODE_T trace_mode )
|
|
||||||
{
|
{
|
||||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
for( EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
|
||||||
edge;
|
edge; edge = edge->Next() )
|
||||||
edge = edge->Next() )
|
|
||||||
{
|
{
|
||||||
if( edge->Type() != PCB_MODULE_EDGE_T )
|
if( edge->Type() != PCB_MODULE_EDGE_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ( GetLayerMask( edge->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( GetLayerMask( edge->GetLayer() ) & m_layerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Plot_1_EdgeModule( aPlotter, aPlotOpts, edge, trace_mode, aLayerMask );
|
Plot_1_EdgeModule( edge );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//* Plot a graphic item (outline) relative to a footprint
|
//* Plot a graphic item (outline) relative to a footprint
|
||||||
void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge )
|
||||||
EDGE_MODULE* aEdge, EDA_DRAW_MODE_T trace_mode,
|
|
||||||
int masque_layer )
|
|
||||||
{
|
{
|
||||||
int type_trace; // Type of item to plot.
|
int type_trace; // Type of item to plot.
|
||||||
int thickness; // Segment thickness.
|
int thickness; // Segment thickness.
|
||||||
|
@ -414,10 +407,7 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
if( aEdge->Type() != PCB_MODULE_EDGE_T )
|
if( aEdge->Type() != PCB_MODULE_EDGE_T )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_COLOR_T color = aEdge->GetBoard( )->GetLayerColor( aEdge->GetLayer() );
|
m_plotter->SetColor( getColor( aEdge->GetLayer() ) );
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
|
||||||
// the white items are not seen on a white paper or screen
|
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
|
||||||
|
|
||||||
type_trace = aEdge->GetShape();
|
type_trace = aEdge->GetShape();
|
||||||
thickness = aEdge->GetWidth();
|
thickness = aEdge->GetWidth();
|
||||||
|
@ -428,13 +418,13 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
switch( type_trace )
|
switch( type_trace )
|
||||||
{
|
{
|
||||||
case S_SEGMENT:
|
case S_SEGMENT:
|
||||||
aPlotter->ThickSegment( pos, end, thickness, trace_mode );
|
m_plotter->ThickSegment( pos, end, thickness, GetMode() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
radius = (int) hypot( (double) ( end.x - pos.x ),
|
radius = (int) hypot( (double) ( end.x - pos.x ),
|
||||||
(double) ( end.y - pos.y ) );
|
(double) ( end.y - pos.y ) );
|
||||||
aPlotter->ThickCircle( pos, radius * 2, thickness, trace_mode );
|
m_plotter->ThickCircle( pos, radius * 2, thickness, GetMode() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
|
@ -446,13 +436,13 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
|
|
||||||
double endAngle = startAngle + aEdge->GetAngle();
|
double endAngle = startAngle + aEdge->GetAngle();
|
||||||
|
|
||||||
if ( ( aPlotOpts.GetFormat() == PLOT_FORMAT_DXF ) &&
|
if ( ( GetFormat() == PLOT_FORMAT_DXF ) &&
|
||||||
( masque_layer & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
|
( m_layerMask & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
|
||||||
aPlotter->ThickArc( pos, -startAngle, -endAngle, radius,
|
m_plotter->ThickArc( pos, -startAngle, -endAngle, radius,
|
||||||
thickness, trace_mode );
|
thickness, GetMode() );
|
||||||
else
|
else
|
||||||
aPlotter->ThickArc( pos, -endAngle, -startAngle, radius,
|
m_plotter->ThickArc( pos, -endAngle, -startAngle, radius,
|
||||||
thickness, trace_mode );
|
thickness, GetMode() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -484,7 +474,7 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
cornerList.push_back( corner );
|
cornerList.push_back( corner );
|
||||||
}
|
}
|
||||||
|
|
||||||
aPlotter->PlotPoly( cornerList, FILLED_SHAPE, thickness );
|
m_plotter->PlotPoly( cornerList, FILLED_SHAPE, thickness );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -492,8 +482,7 @@ void Plot_1_EdgeModule( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
|
|
||||||
|
|
||||||
// Plot a PCB Text, i;e. a text found on a copper or technical layer
|
// Plot a PCB Text, i;e. a text found on a copper or technical layer
|
||||||
void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PCB* pt_texte, int aLayerMask,
|
void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
|
||||||
EDA_DRAW_MODE_T trace_mode )
|
|
||||||
{
|
{
|
||||||
int orient, thickness;
|
int orient, thickness;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
@ -502,18 +491,15 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
|
||||||
if( pt_texte->m_Text.IsEmpty() )
|
if( pt_texte->m_Text.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ( GetLayerMask( pt_texte->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( GetLayerMask( pt_texte->GetLayer() ) & m_layerMask ) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_COLOR_T color = pt_texte->GetBoard( )->GetLayerColor( pt_texte->GetLayer() );
|
m_plotter->SetColor( getColor( pt_texte->GetLayer() ) );
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
|
||||||
// the white items are not seen on a white paper or screen
|
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
|
||||||
|
|
||||||
size = pt_texte->m_Size;
|
size = pt_texte->m_Size;
|
||||||
pos = pt_texte->m_Pos;
|
pos = pt_texte->m_Pos;
|
||||||
orient = pt_texte->m_Orient;
|
orient = pt_texte->m_Orient;
|
||||||
thickness = ( trace_mode==LINE ) ? -1 : pt_texte->m_Thickness;
|
thickness = ( GetMode() == LINE ) ? -1 : pt_texte->m_Thickness;
|
||||||
|
|
||||||
if( pt_texte->m_Mirror )
|
if( pt_texte->m_Mirror )
|
||||||
size.x = -size.x;
|
size.x = -size.x;
|
||||||
|
@ -536,7 +522,7 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
|
||||||
for( unsigned i = 0; i < list->Count(); i++ )
|
for( unsigned i = 0; i < list->Count(); i++ )
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( i );
|
||||||
aPlotter->Text( pos, UNSPECIFIED_COLOR, txt, orient, size,
|
m_plotter->Text( pos, UNSPECIFIED_COLOR, txt, orient, size,
|
||||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||||
thickness, pt_texte->m_Italic, allow_bold );
|
thickness, pt_texte->m_Italic, allow_bold );
|
||||||
pos += offset;
|
pos += offset;
|
||||||
|
@ -546,7 +532,7 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPlotter->Text( pos, UNSPECIFIED_COLOR, pt_texte->m_Text, orient, size,
|
m_plotter->Text( pos, UNSPECIFIED_COLOR, pt_texte->m_Text, orient, size,
|
||||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||||
thickness, pt_texte->m_Italic, allow_bold );
|
thickness, pt_texte->m_Italic, allow_bold );
|
||||||
}
|
}
|
||||||
|
@ -555,7 +541,7 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
|
||||||
|
|
||||||
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
||||||
*/
|
*/
|
||||||
void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone, EDA_DRAW_MODE_T trace_mode )
|
void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
|
||||||
{
|
{
|
||||||
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
|
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
|
||||||
unsigned imax = polysList.size();
|
unsigned imax = polysList.size();
|
||||||
|
@ -567,10 +553,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
|
||||||
static std::vector< wxPoint > cornerList;
|
static std::vector< wxPoint > cornerList;
|
||||||
cornerList.clear();
|
cornerList.clear();
|
||||||
|
|
||||||
EDA_COLOR_T color = aZone->GetBoard( )->GetLayerColor( aZone->GetLayer() );
|
m_plotter->SetColor( getColor( aZone->GetLayer() ) );
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
|
||||||
// the white items are not seen on a white paper or screen
|
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
|
||||||
|
|
||||||
/* Plot all filled areas: filled areas have a filled area and a thick
|
/* 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
|
* outline we must plot the filled area itself ( as a filled polygon
|
||||||
|
@ -592,12 +575,12 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot the current filled area and its outline
|
// Plot the current filled area and its outline
|
||||||
if( trace_mode == FILLED )
|
if( GetMode() == FILLED )
|
||||||
{
|
{
|
||||||
// Plot the current filled area polygon
|
// Plot the current filled area polygon
|
||||||
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
||||||
{ // (if != 0: using segments )
|
{ // (if != 0: using segments )
|
||||||
aPlotter->PlotPoly( cornerList, FILLED_SHAPE );
|
m_plotter->PlotPoly( cornerList, FILLED_SHAPE );
|
||||||
}
|
}
|
||||||
else // We are using areas filled by
|
else // We are using areas filled by
|
||||||
{ // segments: plot them )
|
{ // segments: plot them )
|
||||||
|
@ -605,27 +588,27 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
|
||||||
{
|
{
|
||||||
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
||||||
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
||||||
aPlotter->ThickSegment( start, end,
|
m_plotter->ThickSegment( start, end,
|
||||||
aZone->m_ZoneMinThickness,
|
aZone->m_ZoneMinThickness,
|
||||||
trace_mode );
|
GetMode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot the current filled area outline
|
// Plot the current filled area outline
|
||||||
if( aZone->m_ZoneMinThickness > 0 )
|
if( aZone->m_ZoneMinThickness > 0 )
|
||||||
aPlotter->PlotPoly( cornerList, NO_FILL, aZone->m_ZoneMinThickness );
|
m_plotter->PlotPoly( cornerList, NO_FILL, aZone->m_ZoneMinThickness );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( aZone->m_ZoneMinThickness > 0 )
|
if( aZone->m_ZoneMinThickness > 0 )
|
||||||
{
|
{
|
||||||
for( unsigned jj = 1; jj<cornerList.size(); jj++ )
|
for( unsigned jj = 1; jj<cornerList.size(); jj++ )
|
||||||
aPlotter->ThickSegment( cornerList[jj -1], cornerList[jj],
|
m_plotter->ThickSegment( cornerList[jj -1], cornerList[jj],
|
||||||
( trace_mode == LINE ) ? -1 : aZone->m_ZoneMinThickness,
|
( GetMode() == LINE ) ? -1 : aZone->m_ZoneMinThickness,
|
||||||
trace_mode );
|
GetMode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( -1 );
|
m_plotter->SetCurrentLineWidth( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
cornerList.clear();
|
cornerList.clear();
|
||||||
|
@ -636,40 +619,32 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
|
||||||
|
|
||||||
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
|
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
|
||||||
*/
|
*/
|
||||||
void PlotDrawSegment( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
|
||||||
DRAWSEGMENT* aSeg, int aLayerMask,
|
|
||||||
EDA_DRAW_MODE_T trace_mode )
|
|
||||||
{
|
{
|
||||||
int thickness;
|
int thickness;
|
||||||
int radius = 0, StAngle = 0, EndAngle = 0;
|
int radius = 0, StAngle = 0, EndAngle = 0;
|
||||||
|
|
||||||
if( (GetLayerMask( aSeg->GetLayer() ) & aLayerMask) == 0 )
|
if( (GetLayerMask( aSeg->GetLayer() ) & m_layerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( trace_mode == LINE )
|
if( GetMode() == LINE )
|
||||||
thickness = aPlotOpts.GetLineWidth();
|
thickness = GetLineWidth();
|
||||||
else
|
else
|
||||||
thickness = aSeg->GetWidth();
|
thickness = aSeg->GetWidth();
|
||||||
|
|
||||||
if( aSeg->GetBoard() ) // temporary created segments in plot functions return NULL
|
m_plotter->SetColor( getColor( aSeg->GetLayer() ) );
|
||||||
{
|
|
||||||
EDA_COLOR_T color = aSeg->GetBoard()->GetLayerColor( aSeg->GetLayer() );
|
|
||||||
// Set plot color (change WHITE to LIGHTGRAY because
|
|
||||||
// the white items are not seen on a white paper or screen
|
|
||||||
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint start( aSeg->GetStart() );
|
wxPoint start( aSeg->GetStart() );
|
||||||
wxPoint end( aSeg->GetEnd() );
|
wxPoint end( aSeg->GetEnd() );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( thickness );
|
m_plotter->SetCurrentLineWidth( thickness );
|
||||||
|
|
||||||
switch( aSeg->GetShape() )
|
switch( aSeg->GetShape() )
|
||||||
{
|
{
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
radius = (int) hypot( (double) ( end.x - start.x ),
|
radius = (int) hypot( (double) ( end.x - start.x ),
|
||||||
(double) ( end.y - start.y ) );
|
(double) ( end.y - start.y ) );
|
||||||
aPlotter->ThickCircle( start, radius * 2, thickness, trace_mode );
|
m_plotter->ThickCircle( start, radius * 2, thickness, GetMode() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
|
@ -677,7 +652,7 @@ void PlotDrawSegment( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
(double) ( end.y - start.y ) );
|
(double) ( end.y - start.y ) );
|
||||||
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
||||||
EndAngle = StAngle + aSeg->GetAngle();
|
EndAngle = StAngle + aSeg->GetAngle();
|
||||||
aPlotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, trace_mode );
|
m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetMode() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_CURVE:
|
case S_CURVE:
|
||||||
|
@ -685,15 +660,14 @@ void PlotDrawSegment( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts,
|
||||||
const std::vector<wxPoint>& bezierPoints = aSeg->GetBezierPoints();
|
const std::vector<wxPoint>& bezierPoints = aSeg->GetBezierPoints();
|
||||||
|
|
||||||
for( unsigned i = 1; i < bezierPoints.size(); i++ )
|
for( unsigned i = 1; i < bezierPoints.size(); i++ )
|
||||||
aPlotter->ThickSegment( bezierPoints[i - 1],
|
m_plotter->ThickSegment( bezierPoints[i - 1],
|
||||||
bezierPoints[i],
|
bezierPoints[i],
|
||||||
thickness,
|
thickness, GetMode() );
|
||||||
trace_mode );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
aPlotter->ThickSegment( start, end, thickness, trace_mode );
|
m_plotter->ThickSegment( start, end, thickness, GetMode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,9 +759,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
|
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
|
||||||
bool aPlotVia, bool aSkipNPTH_Pads )
|
bool aPlotVia, bool aSkipNPTH_Pads )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
|
||||||
|
itemplotter.SetLayerMask( aLayerMask );
|
||||||
|
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
EDA_DRAW_MODE_T aPlotMode = aPlotOpt.GetMode();
|
EDA_DRAW_MODE_T aPlotMode = aPlotOpt.GetMode();
|
||||||
|
|
||||||
|
@ -797,26 +774,27 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_LINE_T:
|
case PCB_LINE_T:
|
||||||
PlotDrawSegment( aPlotter, aPlotOpt, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
|
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
PlotTextePcb( aPlotter, aPlotOpt, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
|
itemplotter.PlotTextePcb( (TEXTE_PCB*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_DIMENSION_T:
|
case PCB_DIMENSION_T:
|
||||||
PlotDimension( aPlotter, aPlotOpt, (DIMENSION*) item, aLayerMask, aPlotMode );
|
itemplotter.PlotDimension( (DIMENSION*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
PlotPcbTarget( aPlotter, aPlotOpt, (PCB_TARGET*) item, aLayerMask, aPlotMode );
|
itemplotter.PlotPcbTarget( (PCB_TARGET*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_MARKER_T:
|
case PCB_MARKER_T:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogMessage( wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
|
wxLogMessage( wxT( "Plot_Standard_Layer() error : Unexpected Draw Type %d" ),
|
||||||
|
item->Type() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,7 +805,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
// Plot footprints fields (ref, value ...)
|
// Plot footprints fields (ref, value ...)
|
||||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( ! PlotAllTextsModule( aPlotter, aBoard, aLayerMask, module, aPlotOpt ) )
|
if( ! itemplotter.PlotAllTextsModule( module ) )
|
||||||
{
|
{
|
||||||
wxLogMessage( _( "Your BOARD has a bad layer number for module %s" ),
|
wxLogMessage( _( "Your BOARD has a bad layer number for module %s" ),
|
||||||
GetChars( module->GetReference() ) );
|
GetChars( module->GetReference() ) );
|
||||||
|
@ -844,8 +822,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_MODULE_EDGE_T:
|
case PCB_MODULE_EDGE_T:
|
||||||
Plot_1_EdgeModule( aPlotter, aPlotOpt, (EDGE_MODULE*) item,
|
itemplotter.Plot_1_EdgeModule( (EDGE_MODULE*) item );
|
||||||
aPlotMode, aLayerMask );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1039,12 +1016,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
// Plot filled ares
|
// Plot filled ares
|
||||||
for( int ii = 0; ii < aBoard->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < aBoard->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* edge_zone = aBoard->GetArea( ii );
|
ZONE_CONTAINER* zone = aBoard->GetArea( ii );
|
||||||
|
|
||||||
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( ( 1 << zone->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlotFilledAreas( aPlotter, aPlotOpt, edge_zone, aPlotMode );
|
itemplotter.PlotFilledAreas( zone );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,7 +1331,7 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
|
||||||
}
|
}
|
||||||
|
|
||||||
// error in start_plot( ) or before
|
// error in start_plot( ) or before
|
||||||
DisplayError( NULL, _("Error creating plot file"));
|
wxMessageBox( _("Error creating plot file") );
|
||||||
delete the_plotter;
|
delete the_plotter;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue