2007-12-11 20:28:13 +00:00
|
|
|
/*********************************************************/
|
|
|
|
/* Routines de trace: fonction communes aux diff formats */
|
|
|
|
/*********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Fichier PLOT_RTN.CPP*/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "base_struct.h"
|
|
|
|
#include "drawtxt.h"
|
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Fonctions locales */
|
2007-12-11 20:28:13 +00:00
|
|
|
static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer );
|
2008-12-22 21:06:44 +00:00
|
|
|
static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
|
|
|
|
FILE* File, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************************/
|
|
|
|
|
|
|
|
/* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
wxPoint pos, shape_pos;
|
|
|
|
wxSize size;
|
|
|
|
bool trace_val, trace_ref;
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
TEXTE_MODULE* pt_texte;
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
/* Trace du contour du PCB et des Elements du type Drawings Pcb */
|
|
|
|
PtStruct = m_Pcb->m_Drawings;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
switch( PtStruct->Type() )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE:
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotTextePcb( (TEXTE_PCB*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_COTATION:
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotCotation( (COTATION*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MIRE:
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotMirePcb( (MIREPCB*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MARKER:
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DisplayError( this, wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* trace des contours des MODULES : */
|
|
|
|
Plot_Edges_Modules( m_Pcb, format_plot, masque_layer );
|
|
|
|
|
|
|
|
/* Trace des MODULES : PADS */
|
|
|
|
if( PlotPadsOnSilkLayer || Plot_Pads_All_Layers )
|
|
|
|
{
|
2008-03-22 05:55:06 +00:00
|
|
|
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
pt_pad = (D_PAD*) Module->m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
/* Tst si layer OK */
|
|
|
|
if( (pt_pad->m_Masque_Layer & masque_layer) == 0 )
|
|
|
|
{
|
|
|
|
if( !Plot_Pads_All_Layers )
|
|
|
|
continue;
|
|
|
|
}
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
shape_pos = pt_pad->ReturnShapePos();
|
2008-05-05 19:50:59 +00:00
|
|
|
pos = shape_pos;
|
|
|
|
size = pt_pad->m_Size;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
switch( pt_pad->m_PadShape & 0x7F )
|
|
|
|
{
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_CIRCLE:
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
PlotCircle( PLOT_FORMAT_GERBER,
|
|
|
|
g_PlotLine_Width, pos, size.x / 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
trace_1_pastille_RONDE_HPGL( pos, size.x, FILAIRE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
trace_1_pastille_RONDE_POST( pos, size.x, FILAIRE );
|
|
|
|
break;
|
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_OVAL:
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
trace_1_contour_GERBER( pos, size, wxSize( 0, 0 ),
|
|
|
|
g_PlotLine_Width,
|
|
|
|
pt_pad->m_Orient );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
trace_1_pastille_OVALE_HPGL( pos, size,
|
|
|
|
pt_pad->m_Orient, FILAIRE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
trace_1_pastille_OVALE_POST( pos, size,
|
|
|
|
pt_pad->m_Orient, FILAIRE );
|
|
|
|
break;
|
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_TRAPEZOID:
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
wxSize delta;
|
|
|
|
delta = pt_pad->m_DeltaSize;
|
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
trace_1_contour_GERBER( pos, size, delta,
|
|
|
|
g_PlotLine_Width,
|
|
|
|
(int) pt_pad->m_Orient );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
trace_1_pad_TRAPEZE_HPGL( pos, size,
|
|
|
|
delta, (int) pt_pad->m_Orient,
|
|
|
|
FILAIRE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
trace_1_pad_TRAPEZE_POST( pos, size,
|
|
|
|
delta, (int) pt_pad->m_Orient,
|
|
|
|
FILAIRE );
|
|
|
|
break;
|
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-01-05 17:30:56 +00:00
|
|
|
case PAD_RECT:
|
2007-12-11 20:28:13 +00:00
|
|
|
default:
|
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
trace_1_contour_GERBER( pos, size, wxSize( 0, 0 ),
|
|
|
|
g_PlotLine_Width,
|
|
|
|
(int) pt_pad->m_Orient );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
PlotRectangularPad_HPGL( pos, size, pt_pad->m_Orient, FILAIRE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
trace_1_pad_rectangulaire_POST( pos, size,
|
|
|
|
(int) pt_pad->m_Orient, FILAIRE );
|
|
|
|
break;
|
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* Fin Sequence de trace des Pads */
|
|
|
|
|
|
|
|
/* Trace Textes MODULES */
|
2008-03-22 05:55:06 +00:00
|
|
|
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
|
|
|
/* Analyse des autorisations de trace pour les textes VALEUR et REF */
|
|
|
|
trace_val = Sel_Texte_Valeur;
|
|
|
|
trace_ref = Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees
|
|
|
|
|
2009-05-01 16:46:56 +00:00
|
|
|
TEXTE_MODULE* text = Module->m_Reference;
|
2008-02-12 02:44:46 +00:00
|
|
|
unsigned textLayer = text->GetLayer();
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
if( textLayer >= 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
|
|
|
errMsg.Printf(
|
2009-03-18 15:38:16 +00:00
|
|
|
_( "Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text." ),
|
|
|
|
textLayer, Module->GetReference().GetData() );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
|
|
|
goto exit;
|
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( ( (1 << textLayer) & masque_layer ) == 0 )
|
|
|
|
trace_ref = FALSE;
|
|
|
|
|
|
|
|
if( text->m_NoShow && !Sel_Texte_Invisible )
|
|
|
|
trace_ref = FALSE;
|
|
|
|
|
2009-05-01 16:46:56 +00:00
|
|
|
text = Module->m_Value;
|
2007-12-11 20:28:13 +00:00
|
|
|
textLayer = text->GetLayer();
|
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
if( textLayer > 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
|
|
|
errMsg.Printf(
|
2009-03-18 15:38:16 +00:00
|
|
|
_( "Your BOARD has a bad layer number of %u for module\n %s's \"value\" text." ),
|
|
|
|
textLayer, Module->GetReference().GetData() );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
|
|
|
goto exit;
|
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( ( (1 << textLayer) & masque_layer ) == 0 )
|
|
|
|
trace_val = FALSE;
|
|
|
|
|
|
|
|
if( text->m_NoShow && !Sel_Texte_Invisible )
|
|
|
|
trace_val = FALSE;
|
|
|
|
|
|
|
|
/* Trace effectif des textes */
|
|
|
|
if( trace_ref )
|
|
|
|
{
|
2008-12-22 21:06:44 +00:00
|
|
|
PlotTextModule( Module->m_Reference, format_plot );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( trace_val )
|
|
|
|
{
|
2008-12-22 21:06:44 +00:00
|
|
|
PlotTextModule( Module->m_Value, format_plot );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
pt_texte = (TEXTE_MODULE*) Module->m_Drawings.GetFirst();
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; pt_texte != NULL; pt_texte = pt_texte->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( pt_texte->Type() != TYPE_TEXTE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !Sel_Texte_Divers )
|
|
|
|
continue;
|
|
|
|
if( (pt_texte->m_NoShow) && !Sel_Texte_Invisible )
|
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
|
|
|
textLayer = pt_texte->GetLayer();
|
|
|
|
if( textLayer >= 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
|
|
|
errMsg.Printf(
|
2009-03-18 15:38:16 +00:00
|
|
|
_(
|
|
|
|
"Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s." ),
|
|
|
|
textLayer, Module->GetReference().GetData(), pt_texte->m_Text.GetData() );
|
2008-02-12 02:44:46 +00:00
|
|
|
DisplayError( this, errMsg );
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
if( !( (1 << textLayer) & masque_layer ) )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
PlotTextModule( pt_texte, format_plot );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/* Plot filled ares */
|
|
|
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
|
|
|
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
|
2008-10-07 12:10:24 +00:00
|
|
|
continue;
|
2009-03-18 15:38:16 +00:00
|
|
|
PlotFilledAreas( edge_zone, format_plot );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
2009-05-01 16:46:56 +00:00
|
|
|
// Plot segments used to fill zone areas:
|
|
|
|
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
|
|
|
|
{
|
|
|
|
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
|
|
|
|
continue;
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
SelectD_CODE_For_LineDraw( seg->m_Width );
|
|
|
|
PlotGERBERLine( seg->m_Start, seg->m_End, seg->m_Width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
Plot_Filled_Segment_HPGL( seg->m_Start, seg->m_End, seg->m_Width, FILLED );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
PlotFilledSegmentPS( seg->m_Start, seg->m_End, seg->m_Width );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
exit:
|
|
|
|
;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
/********************************************************************/
|
|
|
|
static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
|
|
|
|
/********************************************************************/
|
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
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
/* calcul des parametres du texte :*/
|
|
|
|
size = pt_texte->m_Size;
|
|
|
|
pos = pt_texte->m_Pos;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
orient = pt_texte->GetDrawRotation();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_texte->m_Width;
|
2009-01-13 19:18:54 +00:00
|
|
|
if( g_Plot_Mode == FILAIRE )
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
if( pt_texte->m_Mirror )
|
2009-03-18 15:38:16 +00:00
|
|
|
size.x = -size.x; // Text is mirrored
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-09 12:42:39 +00:00
|
|
|
switch( format_plot )
|
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
|
|
|
break;
|
2009-02-09 12:42:39 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
break;
|
2008-12-22 21:06:44 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
SetCurrentLineWidthPS( thickness );
|
|
|
|
break;
|
2009-02-09 12:42:39 +00:00
|
|
|
}
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2008-12-29 18:02:54 +00:00
|
|
|
PlotGraphicText( format_plot, pos, BLACK,
|
2009-03-18 15:38:16 +00:00
|
|
|
pt_texte->m_Text,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
2009-05-12 12:12:34 +00:00
|
|
|
thickness, pt_texte->m_Italic, true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotCotation( COTATION* Cotation, int format_plot, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************************************************/
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
DRAWSEGMENT* DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
if( (g_TabOneLayerMask[Cotation->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp = new DRAWSEGMENT( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Width = Cotation->m_Width;
|
|
|
|
DrawTmp->SetLayer( Cotation->GetLayer() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotTextePcb( Cotation->m_Text, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->Barre_ox; DrawTmp->m_Start.y = Cotation->Barre_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->Barre_fx; DrawTmp->m_End.y = Cotation->Barre_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->TraitG_ox; DrawTmp->m_Start.y = Cotation->TraitG_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->TraitG_fx; DrawTmp->m_End.y = Cotation->TraitG_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->TraitD_ox; DrawTmp->m_Start.y = Cotation->TraitD_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->TraitD_fx; DrawTmp->m_End.y = Cotation->TraitD_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->FlecheD1_ox; DrawTmp->m_Start.y = Cotation->FlecheD1_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->FlecheD1_fx; DrawTmp->m_End.y = Cotation->FlecheD1_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->FlecheD2_ox; DrawTmp->m_Start.y = Cotation->FlecheD2_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->FlecheD2_fx; DrawTmp->m_End.y = Cotation->FlecheD2_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->FlecheG1_ox; DrawTmp->m_Start.y = Cotation->FlecheG1_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->FlecheG1_fx; DrawTmp->m_End.y = Cotation->FlecheG1_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Start.x = Cotation->FlecheG2_ox; DrawTmp->m_Start.y = Cotation->FlecheG2_oy;
|
|
|
|
DrawTmp->m_End.x = Cotation->FlecheG2_fx; DrawTmp->m_End.y = Cotation->FlecheG2_fy;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
delete DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotMirePcb( MIREPCB* Mire, int format_plot, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
DRAWSEGMENT* DrawTmp;
|
2008-05-05 19:50:59 +00:00
|
|
|
int dx1, dx2, dy1, dy2, radius;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
if( (g_TabOneLayerMask[Mire->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp = new DRAWSEGMENT( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
DrawTmp->m_Width = Mire->m_Width;
|
|
|
|
DrawTmp->SetLayer( Mire->GetLayer() );
|
|
|
|
|
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y;
|
|
|
|
DrawTmp->m_End.x = DrawTmp->m_Start.x + (Mire->m_Size / 4);
|
|
|
|
DrawTmp->m_End.y = DrawTmp->m_Start.y;
|
|
|
|
DrawTmp->m_Shape = S_CIRCLE;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
|
|
|
|
|
|
|
DrawTmp->m_Shape = S_SEGMENT;
|
|
|
|
/* Trace des 2 traits */
|
2008-05-05 19:50:59 +00:00
|
|
|
radius = Mire->m_Size / 2;
|
2009-03-18 15:38:16 +00:00
|
|
|
dx1 = radius, dy1 = 0; dx2 = 0, dy2 = radius;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( Mire->m_Shape ) /* Forme X */
|
|
|
|
{
|
2008-05-05 19:50:59 +00:00
|
|
|
dx1 = dy1 = (radius * 7) / 5;
|
|
|
|
dx2 = dx1;
|
|
|
|
dy2 = -dy1;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x - dx1; DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
|
|
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx1; DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
|
|
|
|
|
|
|
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2; DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
|
|
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx2; DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
|
|
|
PlotDrawSegment( DrawTmp, format_plot, masque_layer );
|
|
|
|
|
|
|
|
delete DrawTmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* Trace les contours des modules */
|
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
int nb_items; /* Pour affichage activite: nbr modules traites */
|
|
|
|
wxString msg;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
nb_items = 0;
|
2009-02-26 00:37:04 +00:00
|
|
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-02-26 00:37:04 +00:00
|
|
|
EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
|
|
|
|
for( ; edge; edge = edge->Next() )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2009-02-26 00:37:04 +00:00
|
|
|
if( edge->Type() != TYPE_EDGE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
|
|
|
if( (g_TabOneLayerMask[edge->GetLayer()] & masque_layer) == 0 )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
|
|
|
Plot_1_EdgeModule( format_plot, edge );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Affichage du nombre de modules traites */
|
|
|
|
nb_items++;
|
|
|
|
msg.Printf( wxT( "%d" ), nb_items );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************************/
|
|
|
|
/* Trace les contours des modules */
|
|
|
|
{
|
2009-03-18 15:38:16 +00:00
|
|
|
int type_trace; /* forme a tracer (segment, cercle) */
|
|
|
|
int thickness; /* thickness des segments */
|
|
|
|
int radius; /* radius des cercles a tracer */
|
2007-12-11 20:28:13 +00:00
|
|
|
int StAngle, EndAngle;
|
2009-03-18 15:38:16 +00:00
|
|
|
wxPoint pos, end; /* Coord des segments a tracer */
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( PtEdge->Type() != TYPE_EDGE_MODULE )
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
type_trace = PtEdge->m_Shape;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = PtEdge->m_Width;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2009-01-13 19:18:54 +00:00
|
|
|
if( g_Plot_Mode == FILAIRE )
|
2009-02-26 00:37:04 +00:00
|
|
|
{
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
2009-03-18 15:38:16 +00:00
|
|
|
wxLogDebug( wxT( "changing edgemodule thickness to g_PlotLine_Width" ) );
|
2009-02-26 00:37:04 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
pos = PtEdge->m_Start;
|
|
|
|
end = PtEdge->m_End;
|
|
|
|
|
|
|
|
switch( type_trace )
|
|
|
|
{
|
|
|
|
case S_SEGMENT:
|
|
|
|
|
|
|
|
/* segment simple */
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotGERBERLine( pos, end, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2009-05-01 16:46:56 +00:00
|
|
|
Plot_Filled_Segment_HPGL( pos, end, thickness, (GRFillMode) g_Plot_Mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotFilledSegmentPS( pos, end, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break; /* Fin trace segment simple */
|
|
|
|
|
|
|
|
case S_CIRCLE:
|
2009-05-01 16:46:56 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotCircle( format_plot, thickness, pos, radius );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2009-05-01 16:46:56 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
StAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
|
|
|
EndAngle = StAngle + PtEdge->m_Angle;
|
|
|
|
if( StAngle > EndAngle )
|
|
|
|
EXCHG( StAngle, EndAngle );
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotArc( format_plot, pos, StAngle, EndAngle, radius, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_POLYGON:
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
|
|
|
// We must compute true coordinates from m_PolyList
|
|
|
|
// which are relative to module position, orientation 0
|
|
|
|
MODULE* Module = NULL;
|
|
|
|
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
|
|
|
|
Module = (MODULE*) PtEdge->GetParent();
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
int* ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyPoints.size() * sizeof(int) );
|
|
|
|
int* ptr = ptr_base;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
int* source = (int*) &PtEdge->m_PolyPoints[0];
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
for( unsigned ii = 0; ii < PtEdge->m_PolyPoints.size(); ii++ )
|
|
|
|
{
|
|
|
|
int x = *source++;
|
|
|
|
int y = *source++;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
if( Module )
|
|
|
|
{
|
|
|
|
RotatePoint( &x, &y, Module->m_Orient );
|
|
|
|
x += Module->m_Pos.x;
|
|
|
|
y += Module->m_Pos.y;
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
x += PtEdge->m_Start0.x;
|
|
|
|
y += PtEdge->m_Start0.y;
|
|
|
|
|
|
|
|
*ptr++ = x;
|
|
|
|
*ptr++ = y;
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2009-03-18 15:38:16 +00:00
|
|
|
|
|
|
|
PlotFilledPolygon( format_plot, PtEdge->m_PolyPoints.size(), ptr_base );
|
|
|
|
free( ptr_base );
|
|
|
|
}
|
2009-05-01 16:46:56 +00:00
|
|
|
break;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
|
|
|
|
{
|
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;
|
|
|
|
if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* calcul des parametres du texte :*/
|
|
|
|
size = pt_texte->m_Size;
|
|
|
|
pos = pt_texte->m_Pos;
|
|
|
|
orient = pt_texte->m_Orient;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_texte->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-12-20 20:38:39 +00:00
|
|
|
if( pt_texte->m_Mirror )
|
2007-12-11 20:28:13 +00:00
|
|
|
size.x = -size.x;
|
|
|
|
|
2009-02-09 12:42:39 +00:00
|
|
|
switch( format_plot )
|
|
|
|
{
|
2009-02-26 00:37:04 +00:00
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
2009-02-26 00:37:04 +00:00
|
|
|
break;
|
2009-02-09 12:42:39 +00:00
|
|
|
|
2009-02-26 00:37:04 +00:00
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
break;
|
2009-02-09 12:42:39 +00:00
|
|
|
|
2009-02-26 00:37:04 +00:00
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
SetCurrentLineWidthPS( thickness );
|
|
|
|
break;
|
2009-02-09 12:42:39 +00:00
|
|
|
}
|
2007-12-11 20:28:13 +00:00
|
|
|
|
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 );
|
|
|
|
for( unsigned i = 0; i<list->Count(); i++ )
|
|
|
|
{
|
|
|
|
wxString txt = list->Item( i );
|
|
|
|
PlotGraphicText( format_plot, pos, BLACK,
|
|
|
|
txt,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
|
|
|
thickness, pt_texte->m_Italic, true );
|
|
|
|
pos += offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete (list);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
PlotGraphicText( format_plot, pos, BLACK,
|
2009-03-18 15:38:16 +00:00
|
|
|
pt_texte->m_Text,
|
|
|
|
orient, size,
|
|
|
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
2009-05-12 12:12:34 +00:00
|
|
|
thickness, pt_texte->m_Italic, true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/*********************************************************/
|
2009-03-18 15:38:16 +00:00
|
|
|
void PlotFilledAreas( ZONE_CONTAINER* aZone, int aFormat )
|
2008-09-27 19:26:29 +00:00
|
|
|
/*********************************************************/
|
2009-03-18 15:38:16 +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
|
|
|
*/
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
|
|
|
static int* CornersBuffer = NULL;
|
|
|
|
static unsigned CornersBufferSize = 0;
|
2009-03-18 15:38:16 +00:00
|
|
|
unsigned imax = aZone->m_FilledPolysList.size();
|
2008-09-27 19:26:29 +00:00
|
|
|
|
|
|
|
if( imax == 0 ) // Nothing to draw
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We need a buffer to store corners coordinates:
|
2009-03-18 15:38:16 +00:00
|
|
|
|
|
|
|
imax++; // provide room to sore an extra coordinte to close the ploygon
|
2008-09-27 19:26:29 +00:00
|
|
|
if( CornersBuffer == NULL )
|
|
|
|
{
|
|
|
|
CornersBufferSize = imax * 4;
|
2009-05-01 16:46:56 +00:00
|
|
|
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( (imax * 4) > CornersBufferSize )
|
|
|
|
{
|
|
|
|
CornersBufferSize = imax * 4;
|
2009-05-01 16:46:56 +00:00
|
|
|
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
imax--;
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
// Plot all filled areas
|
|
|
|
int corners_count = 0;
|
|
|
|
for( unsigned ic = 0, ii = 0; ic < imax; ic++ )
|
|
|
|
{
|
|
|
|
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
|
|
|
CornersBuffer[ii++] = corner->x;
|
|
|
|
CornersBuffer[ii++] = corner->y;
|
|
|
|
corners_count++;
|
2009-03-18 15:38:16 +00:00
|
|
|
if( corner->end_contour ) // Plot the current filled area outline
|
|
|
|
{
|
|
|
|
// First, close the outline
|
|
|
|
if( CornersBuffer[0] != CornersBuffer[ii - 2] || CornersBuffer[1] !=
|
|
|
|
CornersBuffer[ii - 1] )
|
|
|
|
{
|
|
|
|
CornersBuffer[ii++] = CornersBuffer[0];
|
|
|
|
CornersBuffer[ii] = CornersBuffer[1];
|
|
|
|
corners_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plot the current filled area outline
|
|
|
|
if( aZone->m_FillMode == 0 ) // We are using solid polygons (if != 0: using segments in m_Zone)
|
2008-12-03 10:32:53 +00:00
|
|
|
PlotFilledPolygon( aFormat, corners_count, CornersBuffer );
|
2009-03-18 15:38:16 +00:00
|
|
|
if( aZone->m_ZoneMinThickness > 0 )
|
2008-11-22 20:50:30 +00:00
|
|
|
PlotPolygon( aFormat, corners_count, CornersBuffer, aZone->m_ZoneMinThickness );
|
2008-09-27 19:26:29 +00:00
|
|
|
corners_count = 0;
|
|
|
|
ii = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Trace un element du type DRAWSEGMENT draw appartenant
|
2007-12-11 20:28:13 +00:00
|
|
|
* aux couches specifiees par masque_layer
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
wxPoint start, end;
|
2008-05-05 19:50:59 +00:00
|
|
|
int thickness;
|
|
|
|
int radius = 0, StAngle = 0, EndAngle = 0;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( (g_TabOneLayerMask[pt_segm->GetLayer()] & masque_layer) == 0 )
|
|
|
|
return;
|
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_segm->m_Width;
|
2009-01-13 19:18:54 +00:00
|
|
|
if( g_Plot_Mode == FILAIRE )
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
start = pt_segm->m_Start;
|
|
|
|
end = pt_segm->m_End;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( pt_segm->m_Shape == S_CIRCLE )
|
|
|
|
{
|
2009-05-01 16:46:56 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( pt_segm->m_Shape == S_ARC )
|
|
|
|
{
|
2009-05-01 16:46:56 +00:00
|
|
|
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
|
2007-12-11 20:28:13 +00:00
|
|
|
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
|
|
|
EndAngle = StAngle + pt_segm->m_Angle;
|
|
|
|
if( StAngle > EndAngle )
|
|
|
|
EXCHG( StAngle, EndAngle );
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( Format )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
if( pt_segm->m_Shape == S_CIRCLE )
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotCircle( PLOT_FORMAT_GERBER, thickness, start, radius );
|
2007-12-11 20:28:13 +00:00
|
|
|
else if( pt_segm->m_Shape == S_ARC )
|
|
|
|
PlotArc( PLOT_FORMAT_GERBER, start,
|
2008-05-05 19:50:59 +00:00
|
|
|
StAngle, EndAngle, radius, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
else
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotGERBERLine( start, end, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
if( pt_segm->m_Shape == S_CIRCLE )
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotCircle( PLOT_FORMAT_HPGL, thickness, start, radius );
|
2007-12-11 20:28:13 +00:00
|
|
|
else if( pt_segm->m_Shape == S_ARC )
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotArc( PLOT_FORMAT_HPGL, start, StAngle, EndAngle, radius, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
else
|
2009-05-01 16:46:56 +00:00
|
|
|
Plot_Filled_Segment_HPGL( start, end, thickness, (GRFillMode) g_Plot_Mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
if( pt_segm->m_Shape == S_CIRCLE )
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotCircle( PLOT_FORMAT_POST, thickness, start, radius );
|
2007-12-11 20:28:13 +00:00
|
|
|
else if( pt_segm->m_Shape == S_ARC )
|
|
|
|
PlotArc( PLOT_FORMAT_POST, start,
|
2008-05-05 19:50:59 +00:00
|
|
|
StAngle, EndAngle, radius, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
else
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotFilledSegmentPS( start, end, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2008-05-05 19:50:59 +00:00
|
|
|
void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* routine de trace de 1 cercle de centre cx, cy */
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotCircle_GERBER( centre, radius, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2008-05-05 19:50:59 +00:00
|
|
|
trace_1_pastille_RONDE_HPGL( centre, radius * 2, FILAIRE );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-09-09 16:56:47 +00:00
|
|
|
PlotCirclePS( centre, radius * 2, false, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
2008-11-22 20:50:30 +00:00
|
|
|
void PlotFilledPolygon( int format_plot, int nbpoints, int* coord )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* plot a polygon */
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2008-11-22 20:50:30 +00:00
|
|
|
PlotFilledPolygon_GERBER( nbpoints, coord );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2008-11-22 20:50:30 +00:00
|
|
|
PlotPolyHPGL( nbpoints, coord, true );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-11-22 20:50:30 +00:00
|
|
|
PlotPolyPS( nbpoints, coord, true );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
|
2008-11-22 20:50:30 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
void PlotPolygon( int format_plot, int nbpoints, int* coord, int width )
|
|
|
|
/**********************************************************************/
|
2009-03-18 15:38:16 +00:00
|
|
|
|
|
|
|
/* plot a non filled polygon
|
|
|
|
*/
|
2008-11-22 20:50:30 +00:00
|
|
|
{
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
SelectD_CODE_For_LineDraw( width );
|
2008-11-22 20:50:30 +00:00
|
|
|
PlotPolygon_GERBER( nbpoints, coord, width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2009-03-18 15:38:16 +00:00
|
|
|
{
|
|
|
|
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units,
|
|
|
|
// with plot scale (if Scale is 2, pen diametre is always g_HPGL_Pen_Diam
|
|
|
|
// so apparent pen diam is real pen diam / Scale
|
2009-05-21 17:42:42 +00:00
|
|
|
int pen_diam = wxRound( (g_HPGL_Pen_Diam * U_PCB) / Scale_X ); // Assume Scale_X # Scale_Y
|
2009-03-18 15:38:16 +00:00
|
|
|
wxString msg;
|
|
|
|
if( pen_diam >= width )
|
|
|
|
PlotPolyHPGL( nbpoints, coord, false, width ); // PlotPolyHPGL does not handle width
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxPoint start, end;
|
|
|
|
start.x = *coord++;
|
|
|
|
start.y = *coord++;
|
|
|
|
for( int ii = 1; ii < nbpoints; ii++ )
|
|
|
|
{
|
|
|
|
end.x = *coord++;
|
2009-05-01 16:46:56 +00:00
|
|
|
end.y = *coord++;
|
|
|
|
Plot_Filled_Segment_HPGL( start, end, width, (GRFillMode) g_Plot_Mode );
|
2009-03-18 15:38:16 +00:00
|
|
|
start = end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-01 16:46:56 +00:00
|
|
|
break;
|
2008-11-22 20:50:30 +00:00
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
PlotPolyPS( nbpoints, coord, false, width );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
|
2008-05-05 19:50:59 +00:00
|
|
|
int radius, int thickness )
|
2007-06-05 12:10:51 +00:00
|
|
|
/************************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Polt 1 arc
|
2007-12-11 20:28:13 +00:00
|
|
|
* start, end = angles in 1/10 degree for start and stop point
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
int ii;
|
|
|
|
int ox, oy, fx, fy;
|
2008-05-05 19:50:59 +00:00
|
|
|
int delta; /* increment (en 0.1 degres) angulaire pour trace de cercles */
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2009-01-13 19:18:54 +00:00
|
|
|
if( g_Plot_Mode == FILAIRE )
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
if( IsPostScript( format_plot ) )
|
2007-12-11 20:28:13 +00:00
|
|
|
{
|
2008-08-27 06:30:19 +00:00
|
|
|
PlotArcPS( centre, start_angle, end_angle, radius, false, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// change due to Y axis is negative orientation on screen
|
|
|
|
start_angle = -start_angle;
|
|
|
|
end_angle = -end_angle;
|
|
|
|
EXCHG( start_angle, end_angle );
|
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
/* Correction pour petits cercles par rapport a l'thickness du trait */
|
|
|
|
if( radius < (thickness * 10) )
|
2009-03-18 15:38:16 +00:00
|
|
|
delta = 225; /* 16 segm pour 360 deg */
|
2008-05-05 19:50:59 +00:00
|
|
|
if( radius < (thickness * 5) )
|
2009-03-18 15:38:16 +00:00
|
|
|
delta = 300; /* 12 segm pour 360 deg */
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( start_angle > end_angle )
|
|
|
|
end_angle += 3600;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
|
|
|
ox = radius;
|
|
|
|
oy = 0;
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
RotatePoint( &ox, &oy, start_angle );
|
|
|
|
|
2009-03-18 15:38:16 +00:00
|
|
|
if( format_plot == PLOT_FORMAT_GERBER )
|
|
|
|
SelectD_CODE_For_LineDraw( thickness );
|
2008-12-22 21:06:44 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
delta = 120; /* un cercle sera trace en 3600/delta = 30 segments / cercle*/
|
|
|
|
for( ii = start_angle + delta; ii < end_angle; ii += delta )
|
|
|
|
{
|
2008-05-05 19:50:59 +00:00
|
|
|
fx = radius;
|
|
|
|
fy = 0;
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
RotatePoint( &fx, &fy, ii );
|
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-03-18 15:38:16 +00:00
|
|
|
PlotGERBERLine( wxPoint( centre.x + ox, centre.y + oy ),
|
2008-05-05 19:50:59 +00:00
|
|
|
wxPoint( centre.x + fx, centre.y + fy ), thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2009-05-01 16:46:56 +00:00
|
|
|
Plot_Filled_Segment_HPGL( wxPoint( centre.x + ox, centre.y + oy ),
|
|
|
|
wxPoint( centre.x + fx, centre.y + fy ),
|
|
|
|
thickness, (GRFillMode) g_Plot_Mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
ox = fx;
|
|
|
|
oy = fy;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
fx = radius;
|
|
|
|
fy = 0;
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
RotatePoint( &fx, &fy, end_angle );
|
|
|
|
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
PlotGERBERLine( wxPoint( centre.x + ox, centre.y + oy ),
|
2008-05-05 19:50:59 +00:00
|
|
|
wxPoint( centre.x + fx, centre.y + fy ), thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2009-05-01 16:46:56 +00:00
|
|
|
Plot_Filled_Segment_HPGL( wxPoint( centre.x + ox, centre.y + oy ),
|
|
|
|
wxPoint( centre.x + fx, centre.y + fy ),
|
|
|
|
thickness, (GRFillMode) g_Plot_Mode );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|