2009-01-19 19:08:42 +00:00
|
|
|
/**
|
|
|
|
* Common plot library \n
|
|
|
|
* Plot settings, postscript plotting, gerber plotting.
|
|
|
|
*
|
|
|
|
* @file plot_common.h
|
|
|
|
*/
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2009-01-19 19:08:42 +00:00
|
|
|
#ifndef __INCLUDE__PLOT_COMMON_H__
|
|
|
|
#define __INCLUDE__PLOT_COMMON_H__ 1
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
/**
|
|
|
|
* Enum PlotFormat
|
|
|
|
* must be kept in order of the radio buttons in the plot panel/window.
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
enum
|
|
|
|
PlotFormat
|
|
|
|
{
|
2008-03-22 05:55:06 +00:00
|
|
|
PLOT_FORMAT_HPGL,
|
|
|
|
PLOT_FORMAT_GERBER,
|
2008-08-06 07:46:03 +00:00
|
|
|
PLOT_FORMAT_POST
|
2008-03-22 05:55:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static inline bool IsPostScript( int aFormat )
|
|
|
|
{
|
2009-01-19 19:08:42 +00:00
|
|
|
return aFormat == PLOT_FORMAT_POST;
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-20 13:28:34 +00:00
|
|
|
const int PLOT_MIROIR = 1;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
// Variables used in Common plot functions
|
|
|
|
extern wxPoint g_Plot_LastPenPosition;
|
|
|
|
extern wxPoint g_Plot_PlotOffset;
|
|
|
|
extern FILE* g_Plot_PlotOutputFile;
|
|
|
|
extern double g_Plot_XScale, g_Plot_YScale;
|
|
|
|
extern int g_Plot_DefaultPenWidth, g_Plot_CurrentPenWidth;
|
|
|
|
extern int g_Plot_PlotOrientOptions, g_Plot_PenState;
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
/*******************************/
|
2008-08-11 11:45:29 +00:00
|
|
|
/* common_plot_functions.cpp */
|
2007-05-28 18:09:49 +00:00
|
|
|
/*******************************/
|
2008-12-22 21:06:44 +00:00
|
|
|
void SetPlotScale( double aXScale, double aYScale ); // Set the plot scale for the current plotting)
|
|
|
|
void Setg_Plot_PlotOffset( wxPoint offset ); // Set the plot offset for the current plotting)
|
|
|
|
void InitPlotParametresGERBER( wxPoint offset, double aXScale, double aYScale );
|
2009-01-08 10:11:39 +00:00
|
|
|
// void PlotWorkSheet( int format_plot, BASE_SCREEN* screen ); now a member of WinEDA_DrawFrame
|
2008-03-22 05:55:06 +00:00
|
|
|
void UserToDeviceCoordinate( wxPoint& pos );
|
|
|
|
|
|
|
|
// modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace
|
|
|
|
void UserToDeviceSize( wxSize& size );
|
|
|
|
|
|
|
|
// modifie les dimension size.x et size.y pour le trace selon l'echelle
|
|
|
|
void ForcePenReinit();
|
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
// set the flag g_Plot_CurrentPenWidth to -1 in order
|
2008-03-22 05:55:06 +00:00
|
|
|
// to force a pen width redefinition for the next draw command
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*******************************/
|
|
|
|
/* common_plotPS_functions.cpp */
|
|
|
|
/*******************************/
|
2008-03-22 05:55:06 +00:00
|
|
|
void SetCurrentLineWidthPS( int width );
|
|
|
|
void InitPlotParametresPS( wxPoint offset,
|
|
|
|
Ki_PageDescr* sheet,
|
2008-12-22 21:06:44 +00:00
|
|
|
double aXScale,
|
|
|
|
double aYScale,
|
2008-03-22 05:55:06 +00:00
|
|
|
int orient = 0 );
|
|
|
|
void SetDefaultLineWidthPS( int width );
|
2008-08-05 16:06:45 +00:00
|
|
|
void PlotRectPS( wxPoint p1, wxPoint p2, bool fill, int width = -1 );
|
|
|
|
void PlotCirclePS( wxPoint pos, int diametre, bool fill, int width = -1 );
|
|
|
|
void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fill, int width = -1 );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
// Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree
|
2008-08-05 16:06:45 +00:00
|
|
|
void PlotPolyPS( int nb_segm, int* coord, bool fill, int width = -1 );
|
2008-03-22 05:55:06 +00:00
|
|
|
void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width );
|
|
|
|
void LineTo_PS( wxPoint pos, int plume );
|
|
|
|
void PrintHeaderPS( FILE* file,
|
|
|
|
const wxString& Creator,
|
|
|
|
const wxString& FileName,
|
|
|
|
int PageCount,
|
|
|
|
int BBox[4],
|
|
|
|
int PaperOrientation );
|
|
|
|
bool CloseFilePS( FILE* plot_file );
|
|
|
|
void SetColorMapPS( int color );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*********************************/
|
|
|
|
/* common_plotHPGL_functions.cpp */
|
|
|
|
/*********************************/
|
2009-01-19 19:08:42 +00:00
|
|
|
void InitPlotParametresHPGL( wxPoint offset,
|
|
|
|
double aXScale,
|
|
|
|
double aYScale,
|
|
|
|
int orient = 0 );
|
|
|
|
bool PrintHeaderHPGL( FILE* plot_file,
|
|
|
|
int pen_speed,
|
|
|
|
int pen_num );
|
2008-03-22 05:55:06 +00:00
|
|
|
bool CloseFileHPGL( FILE* plot_file );
|
2009-01-19 19:08:42 +00:00
|
|
|
void PlotCircleHPGL( wxPoint centre,
|
|
|
|
int diameter,
|
|
|
|
bool fill,
|
|
|
|
int width = -1 );
|
|
|
|
void PlotRectHPGL( wxPoint t1,
|
|
|
|
wxPoint t2,
|
|
|
|
bool fill,
|
|
|
|
int width = -1 );
|
|
|
|
|
|
|
|
void PlotArcHPGL( wxPoint centre,
|
|
|
|
int StAngle,
|
|
|
|
int EndAngle,
|
|
|
|
int rayon,
|
|
|
|
bool fill,
|
|
|
|
int width = -1 );
|
|
|
|
|
|
|
|
|
|
|
|
void PlotPolyHPGL( int nb,
|
|
|
|
int* coord,
|
|
|
|
bool fill,
|
|
|
|
int width = -1 );
|
|
|
|
void Move_Plume_HPGL( wxPoint pos,
|
|
|
|
int plume );
|
2008-03-22 05:55:06 +00:00
|
|
|
void Plume_HPGL( int plume );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
/*********************************/
|
|
|
|
/* common_plotGERBER_functions.cpp */
|
|
|
|
/*********************************/
|
2009-01-19 19:08:42 +00:00
|
|
|
/** Function InitPlotParametresGERBER
|
|
|
|
* Set the plot offset for the current plotting
|
|
|
|
* @param aOffset = plot offset
|
|
|
|
* @param aXScale,aYScale = coordinate scale (scale coefficient for coordinates)
|
2008-12-22 21:06:44 +00:00
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void InitPlotParametresGERBER( wxPoint aOffset,
|
|
|
|
double aXScale,
|
|
|
|
double aYScale );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function Write_Header_GERBER
|
|
|
|
* Write GERBER header to file
|
|
|
|
* initialize global variable g_Plot_PlotOutputFile
|
|
|
|
* @param aTitle: the name of creator (comment)
|
|
|
|
* @param aFile: an opened file to write to
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void Write_Header_GERBER( const wxString aTitle,
|
|
|
|
FILE* aFile );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function LineTo_GERBER
|
|
|
|
* if aCommand = 'U' initialise the starting point of a line
|
|
|
|
* if aCommand = 'D' draw a line from the starting point, or last point to aPos
|
|
|
|
* @param aPos = end of the current line.
|
|
|
|
* @param aCommand = 'U' or 'D' or 'Z' (Pen up , no moving )
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void LineTo_GERBER( wxPoint aPos,
|
|
|
|
int aCommand );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function PlotGERBERLine
|
|
|
|
* Plot a line
|
2009-01-19 19:08:42 +00:00
|
|
|
* @param aStartPos = starting point of the line
|
|
|
|
* @param aEndPos = ending point of the line
|
2008-12-22 21:06:44 +00:00
|
|
|
* @param aThickness = line thickness
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void PlotGERBERLine( wxPoint aStartPos,
|
|
|
|
wxPoint aEndPos,
|
|
|
|
int aThickness );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function PlotCircle_GERBER
|
|
|
|
* writes a non filled circle to output file
|
|
|
|
* Plot one circle as segments (6 to 16 depending on its radius
|
|
|
|
* @param aCentre = centre coordintes
|
|
|
|
* @param aRadius = radius of the circle
|
2009-01-19 19:08:42 +00:00
|
|
|
* @param aWidth = line width (noc currently used, D_CODEs must be selected before)
|
2008-12-22 21:06:44 +00:00
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void PlotCircle_GERBER( wxPoint aCentre,
|
|
|
|
int aRadius,
|
|
|
|
int aWidth );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function PlotPolygon_GERBER
|
|
|
|
* writes a closed polyline (not a filled polygon) to output file
|
|
|
|
* @param aCornersCount = numer of corners
|
|
|
|
* @param aCoord = buffer of corners coordinates
|
|
|
|
* @param aWidth = line width (noc currently used, D_CODEs must be selected before)
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void PlotPolygon_GERBER( int aCornersCount,
|
|
|
|
int* aCoord,
|
|
|
|
int aWidth );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
|
|
|
/** Function PlotFilledPolygon_GERBER
|
|
|
|
* writes a filled polyline to output file
|
|
|
|
* @param aCornersCount = numer of corners
|
|
|
|
* @param aCoord = buffer of corners coordinates
|
|
|
|
*/
|
2009-01-19 19:08:42 +00:00
|
|
|
void PlotFilledPolygon_GERBER( int aCornersCount,
|
|
|
|
int* aCoord );
|
|
|
|
|
|
|
|
#endif /* __INCLUDE__PLOT_COMMON_H__ */
|
2008-12-22 21:06:44 +00:00
|
|
|
|