2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file pcbnew/pcbplot.h
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
#ifndef PCBPLOT_H_
|
|
|
|
#define PCBPLOT_H_
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-11-19 14:32:34 +00:00
|
|
|
#include <wx/filename.h>
|
2012-09-24 06:39:59 +00:00
|
|
|
#include <pad_shapes.h>
|
2012-04-05 18:27:56 +00:00
|
|
|
#include <pcb_plot_params.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class PLOTTER;
|
|
|
|
class TEXTE_PCB;
|
|
|
|
class DRAWSEGMENT;
|
|
|
|
class DIMENSION;
|
2012-09-21 08:20:38 +00:00
|
|
|
class MODULE;
|
2011-09-23 13:57:12 +00:00
|
|
|
class EDGE_MODULE;
|
|
|
|
class PCB_TARGET;
|
2012-09-21 08:20:38 +00:00
|
|
|
class TEXTE_MODULE;
|
2011-09-23 13:57:12 +00:00
|
|
|
class ZONE_CONTAINER;
|
2012-09-21 08:20:38 +00:00
|
|
|
class BOARD;
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Shared Config keys for plot and print
|
2009-08-28 18:03:22 +00:00
|
|
|
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
|
|
|
|
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
|
|
|
|
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
|
|
|
|
#define OPTKEY_PRINT_SCALE wxT( "PrintScale" )
|
2009-10-23 07:41:29 +00:00
|
|
|
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
|
|
|
|
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
|
2009-11-20 14:55:20 +00:00
|
|
|
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
|
2010-01-09 20:25:39 +00:00
|
|
|
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
|
2012-09-15 12:13:03 +00:00
|
|
|
#define OPTKEY_PLOT_X_FINESCALE_ADJ wxT( "PlotXFineScaleAdj" )
|
|
|
|
#define OPTKEY_PLOT_Y_FINESCALE_ADJ wxT( "PlotYFineScaleAdj" )
|
|
|
|
#define CONFIG_PS_FINEWIDTH_ADJ wxT( "PSPlotFineWidthAdj" )
|
|
|
|
|
|
|
|
// Define min and max reasonable values for plot/print scale
|
|
|
|
#define PLOT_MIN_SCALE 0.01
|
|
|
|
#define PLOT_MAX_SCALE 100.0
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Conversion unit constants.
|
|
|
|
// Convert pcb dimension of 0.1 mil to PS units of inches.
|
2012-04-05 18:27:56 +00:00
|
|
|
#define SCALE_PS .0001
|
|
|
|
|
2012-09-24 16:03:03 +00:00
|
|
|
// Convert dimension 0.1 mil -> HPGL units (1 HPGL unit = 25 micrometers):
|
2012-04-05 18:27:56 +00:00
|
|
|
#define SCALE_HPGL 0.102041
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-24 16:03:03 +00:00
|
|
|
// Small drill marks (small pad holes) diameter value
|
|
|
|
#define SMALL_DRILL (int)( 0.35 * IU_PER_MM )
|
|
|
|
|
|
|
|
|
2012-09-21 08:20:38 +00:00
|
|
|
// A helper class to plot board items
|
|
|
|
class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS
|
|
|
|
{
|
|
|
|
PLOTTER* m_plotter;
|
|
|
|
BOARD* m_board;
|
|
|
|
int m_layerMask;
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
|
2012-09-21 08:20:38 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
/**
|
|
|
|
* @return a 'width adjustment' for the postscript engine
|
|
|
|
* (useful for controlling toner bleeding during direct transfer)
|
|
|
|
* addded to track width and via/pads size
|
|
|
|
*/
|
|
|
|
int getFineWidthAdj()
|
|
|
|
{
|
|
|
|
if( GetFormat() == PLOT_FORMAT_POST )
|
|
|
|
return GetWidthAdjust();
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2012-09-21 08:20:38 +00:00
|
|
|
// Basic functions to plot a board item
|
|
|
|
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 );
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
/**
|
2012-09-25 07:49:29 +00:00
|
|
|
* Plot a pad.
|
|
|
|
* unlike other items, a pad had not a specific color,
|
|
|
|
* and be drawn as a non filled item although the plot mode is filled
|
|
|
|
* color and plot mode are needed by this function
|
|
|
|
*/
|
|
|
|
void PlotPad( D_PAD* aPad, EDA_COLOR_T aColor, EDA_DRAW_MODE_T aPlotMode );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* plot items like text and graphics,
|
2012-09-24 06:39:59 +00:00
|
|
|
* but not tracks and modules
|
|
|
|
*/
|
|
|
|
void PlotBoardGraphicItems();
|
|
|
|
|
|
|
|
/** Function PlotDrillMarks
|
|
|
|
* Draw a drill mark for pads and vias.
|
|
|
|
* Must be called after all drawings, because it
|
|
|
|
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
|
|
|
|
* FILLED plot mode (for PS and PDF outputs)
|
|
|
|
*/
|
|
|
|
void PlotDrillMarks();
|
|
|
|
|
2012-09-21 08:20:38 +00:00
|
|
|
/**
|
|
|
|
* Function getColor
|
|
|
|
* @return the layer color
|
|
|
|
* @param aLayer = the layer id
|
|
|
|
* 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
|
|
|
|
* so the returned color is LIGHTGRAY when the layer color is WHITE
|
|
|
|
*/
|
|
|
|
EDA_COLOR_T getColor( int aLayer );
|
2012-09-24 06:39:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/** Helper function to plot a single drill mark. It compensate and clamp
|
|
|
|
* the drill mark size depending on the current plot options
|
|
|
|
*/
|
|
|
|
void plotOneDrillMark( PAD_SHAPE_T aDrillShape,
|
2012-11-19 16:19:38 +00:00
|
|
|
const wxPoint& aDrillPos, wxSize aDrillSize,
|
|
|
|
const wxSize& aPadSize,
|
2012-09-24 06:39:59 +00:00
|
|
|
double aOrientation, int aSmallDrill );
|
|
|
|
|
2012-09-21 08:20:38 +00:00
|
|
|
};
|
2008-10-07 12:10:24 +00:00
|
|
|
|
2012-11-19 16:19:38 +00:00
|
|
|
PLOTTER* StartPlotBoard( BOARD* aBoard,
|
|
|
|
PCB_PLOT_PARAMS* aPlotOpts,
|
2012-08-29 16:59:50 +00:00
|
|
|
const wxString& aFullFileName,
|
|
|
|
const wxString& aSheetDesc );
|
|
|
|
|
2012-09-12 11:11:30 +00:00
|
|
|
/**
|
2012-09-24 06:39:59 +00:00
|
|
|
* Function PlotOneBoardLayer
|
|
|
|
* main function to plot one copper or technical layer.
|
|
|
|
* It prepare options and calls the specilized plot function,
|
|
|
|
* according to the layer type
|
2012-09-12 11:11:30 +00:00
|
|
|
* @param aBoard = the board to plot
|
|
|
|
* @param aPlotter = the plotter to use
|
|
|
|
* @param aLayer = the layer id to plot
|
|
|
|
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
|
|
|
|
*/
|
2012-11-19 16:19:38 +00:00
|
|
|
void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, int aLayer,
|
2012-09-24 06:39:59 +00:00
|
|
|
const PCB_PLOT_PARAMS& aPlotOpt );
|
2012-08-29 16:59:50 +00:00
|
|
|
|
|
|
|
/**
|
2012-09-24 06:39:59 +00:00
|
|
|
* Function PlotStandardLayer
|
2012-09-12 11:11:30 +00:00
|
|
|
* plot copper or technical layers.
|
|
|
|
* not used for silk screen layers, because these layers have specific
|
|
|
|
* requirements, mainly for pads
|
|
|
|
* @param aBoard = the board to plot
|
|
|
|
* @param aPlotter = the plotter to use
|
|
|
|
* @param aLayerMask = the mask to define the layers to plot
|
|
|
|
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
|
2012-09-24 06:39:59 +00:00
|
|
|
*
|
|
|
|
* aPlotOpt has 3 important options to controle this plot,
|
|
|
|
* which are set, depending on the layer typpe to plot
|
|
|
|
* SetEnablePlotVia( bool aEnable )
|
|
|
|
* aEnable = true to plot vias, false to skip vias (has meaning
|
|
|
|
* only for solder mask layers).
|
|
|
|
* SetSkipPlotNPTH_Pads( bool aSkip )
|
|
|
|
* aSkip = true to skip NPTH Pads, when the pad size and the pad hole
|
|
|
|
* have the same size. Used in GERBER format only.
|
|
|
|
* SetDrillMarksType( DrillMarksType aVal ) controle the actual hole:
|
|
|
|
* no hole, small hole, actual hole
|
2012-09-12 11:11:30 +00:00
|
|
|
*/
|
2012-11-19 16:19:38 +00:00
|
|
|
void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask,
|
2012-09-24 06:39:59 +00:00
|
|
|
const PCB_PLOT_PARAMS& aPlotOpt );
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2012-09-12 11:11:30 +00:00
|
|
|
/**
|
|
|
|
* Function PlotSilkScreen
|
|
|
|
* plot silkscreen layers which have specific requirements, mainly for pads.
|
|
|
|
* Should not be used for other layers
|
|
|
|
* @param aBoard = the board to plot
|
|
|
|
* @param aPlotter = the plotter to use
|
2012-09-12 17:28:55 +00:00
|
|
|
* @param aLayerMask = the mask to define the layers to plot (silkscreen Front and/or Back)
|
2012-09-12 11:11:30 +00:00
|
|
|
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
|
|
|
|
*/
|
2012-11-19 16:19:38 +00:00
|
|
|
void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask,
|
2012-09-12 11:11:30 +00:00
|
|
|
const PCB_PLOT_PARAMS& aPlotOpt );
|
2012-08-29 16:59:50 +00:00
|
|
|
|
|
|
|
|
2012-11-16 14:13:31 +00:00
|
|
|
/**
|
|
|
|
* Function EnsureOutputDirectory (helper function)
|
|
|
|
* Fix the output directory pathname to absolute and ensure it exists
|
|
|
|
* (Creates it if not exists)
|
|
|
|
* @param aOutputDir = the wxFileName to modify
|
|
|
|
* (contains the absolute or relative to the board path
|
|
|
|
* @param aBoardFilename = the board full filename
|
|
|
|
* @param aMessageBox = a wxMessageBox to show meesage (can be NULL)
|
|
|
|
*/
|
2012-11-19 16:19:38 +00:00
|
|
|
bool EnsureOutputDirectory( wxFileName* aOutputDir,
|
2012-11-16 14:13:31 +00:00
|
|
|
const wxString& aBoardFilename,
|
|
|
|
wxTextCtrl* aMessageBox );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function BuildPlotFileName (helper function)
|
|
|
|
* Complete a plot filename: forces the output directory,
|
|
|
|
* add a suffix to the name and sets the specified extension
|
|
|
|
* the suffix is usually the layer name
|
|
|
|
* replaces not allowed chars in suffix by '_'
|
|
|
|
* @param aFilename = the wxFileName to initialize
|
|
|
|
* Contians the base filename
|
|
|
|
* @param aOutputDir = the path
|
|
|
|
* @param aSuffix = the suffix to add to the base filename
|
|
|
|
* @param aExtension = the file extension
|
|
|
|
*/
|
2012-11-19 16:19:38 +00:00
|
|
|
void BuildPlotFileName( wxFileName* aFilename,
|
2012-11-16 14:13:31 +00:00
|
|
|
const wxString& aOutputDir,
|
|
|
|
const wxString& aSuffix,
|
|
|
|
const wxString& aExtension );
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// PLOTGERB.CPP
|
2009-08-29 10:20:48 +00:00
|
|
|
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
#endif // PCBPLOT_H_
|