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 "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
|
|
#include "grfonte.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Fonctions locales */
|
2007-12-11 20:28:13 +00:00
|
|
|
static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer );
|
|
|
|
static void PlotTextModule( TEXTE_MODULE* pt_texte );
|
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;
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
{
|
|
|
|
switch( PtStruct->Type() )
|
|
|
|
{
|
|
|
|
case TYPEDRAWSEGMENT:
|
|
|
|
PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPETEXTE:
|
|
|
|
PlotTextePcb( (TEXTE_PCB*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPECOTATION:
|
|
|
|
PlotCotation( (COTATION*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPEMIRE:
|
|
|
|
PlotMirePcb( (MIREPCB*) PtStruct, format_plot, masque_layer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPEMARKER:
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
nb_items = 0;
|
|
|
|
Affiche_1_Parametre( this, 56, wxT( "Pads" ), wxEmptyString, GREEN );
|
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;
|
|
|
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
|
|
|
{
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
nb_items++; msg.Printf( wxT( "%d" ), nb_items );
|
|
|
|
Affiche_1_Parametre( this, 56, wxEmptyString, msg, GREEN );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* Fin Sequence de trace des Pads */
|
|
|
|
|
|
|
|
/* Trace Textes MODULES */
|
2008-05-05 19:50:59 +00:00
|
|
|
nb_items = 0;
|
|
|
|
Affiche_1_Parametre( this, 64, wxT( "TxtMod" ), wxEmptyString, LIGHTBLUE );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
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(
|
|
|
|
_("Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text."),
|
|
|
|
textLayer, Module->GetReference().GetData() );
|
|
|
|
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;
|
|
|
|
|
|
|
|
text = Module->m_Value;
|
|
|
|
textLayer = text->GetLayer();
|
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
if( textLayer > 32 )
|
|
|
|
{
|
|
|
|
wxString errMsg;
|
|
|
|
|
|
|
|
errMsg.Printf(
|
|
|
|
_("Your BOARD has a bad layer number of %u for module\n %s's \"value\" text."),
|
|
|
|
textLayer, Module->GetReference().GetData() );
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
PlotTextModule( Module->m_Reference );
|
|
|
|
nb_items++;
|
|
|
|
msg.Printf( wxT( "%d" ), nb_items );
|
|
|
|
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( trace_val )
|
|
|
|
{
|
|
|
|
PlotTextModule( Module->m_Value );
|
|
|
|
nb_items++;
|
|
|
|
msg.Printf( wxT( "%d" ), nb_items );
|
|
|
|
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
|
|
|
|
}
|
|
|
|
|
|
|
|
pt_texte = (TEXTE_MODULE*) Module->m_Drawings;
|
|
|
|
for( ; pt_texte != NULL; pt_texte = (TEXTE_MODULE*) pt_texte->Pnext )
|
|
|
|
{
|
|
|
|
if( pt_texte->Type() != TYPETEXTEMODULE )
|
|
|
|
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(
|
|
|
|
_("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() );
|
|
|
|
DisplayError( this, errMsg );
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !( (1<<textLayer) & masque_layer ) )
|
2007-12-11 20:28:13 +00:00
|
|
|
continue;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
PlotTextModule( pt_texte );
|
|
|
|
nb_items++;
|
|
|
|
msg.Printf( wxT( "%d" ), nb_items );
|
|
|
|
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
|
|
|
|
}
|
|
|
|
}
|
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++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
|
2008-10-07 12:10:24 +00:00
|
|
|
if( ( (1 << edge_zone->GetLayer()) & masque_layer ) == 0 )
|
|
|
|
continue;
|
2008-09-27 19:26:29 +00:00
|
|
|
PlotFilledAreas(edge_zone, format_plot);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
static void PlotTextModule( TEXTE_MODULE* pt_texte )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************/
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
wxSize size;
|
|
|
|
wxPoint pos;
|
2008-05-05 19:50:59 +00:00
|
|
|
int orient, thickness, no_miroir;
|
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
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
no_miroir = pt_texte->m_Miroir & 1;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_texte->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
if( Plot_Mode == FILAIRE )
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
if( no_miroir == 0 )
|
2008-01-17 15:21:36 +00:00
|
|
|
size.x = -size.x; // Text is mirrored
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-08-06 07:46:03 +00:00
|
|
|
Plot_1_texte( g_PlotFormat, pt_texte->m_Text,
|
2008-05-05 19:50:59 +00:00
|
|
|
orient, thickness,
|
2007-12-11 20:28:13 +00:00
|
|
|
pos.x, pos.y, size.x, size.y );
|
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-08-24 10:10:42 +00:00
|
|
|
// (Following command has been superceded by new commands elsewhere.)
|
|
|
|
// masque_layer |= EDGE_LAYER;
|
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-08-24 10:10:42 +00:00
|
|
|
// (Following command has been superceded by new commands elsewhere.)
|
|
|
|
// masque_layer |= EDGE_LAYER;
|
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;
|
|
|
|
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 */
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
int nb_items; /* Pour affichage activite: nbr modules traites */
|
|
|
|
MODULE* Module;
|
|
|
|
EDGE_MODULE* PtEdge;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
nb_items = 0;
|
|
|
|
Module = pcb->m_Modules;
|
|
|
|
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
|
|
|
|
{
|
|
|
|
PtEdge = (EDGE_MODULE*) Module->m_Drawings;
|
|
|
|
for( ; PtEdge != NULL; PtEdge = (EDGE_MODULE*) PtEdge->Pnext )
|
|
|
|
{
|
|
|
|
if( PtEdge->Type() != TYPEEDGEMODULE )
|
|
|
|
continue;
|
|
|
|
if( (g_TabOneLayerMask[PtEdge->GetLayer()] & masque_layer) == 0 )
|
|
|
|
continue;
|
|
|
|
Plot_1_EdgeModule( format_plot, PtEdge );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
int type_trace; /* forme a tracer (segment, cercle) */
|
2008-05-05 19:50:59 +00:00
|
|
|
int thickness; /* thickness des segments */
|
|
|
|
int radius; /* radius des cercles a tracer */
|
2007-12-11 20:28:13 +00:00
|
|
|
int StAngle, EndAngle;
|
|
|
|
wxPoint pos, end; /* Coord des segments a tracer */
|
|
|
|
|
|
|
|
if( PtEdge->Type() != TYPEEDGEMODULE )
|
|
|
|
return;
|
|
|
|
type_trace = PtEdge->m_Shape;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = PtEdge->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
if( Plot_Mode == FILAIRE )
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = g_PlotLine_Width;
|
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:
|
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:
|
2008-05-05 19:50:59 +00:00
|
|
|
trace_1_segment_HPGL( pos.x, pos.y, end.x, end.y, thickness );
|
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:
|
2008-05-05 19:50:59 +00:00
|
|
|
radius = (int) hypot( (double) (end.x - pos.x), (double) (end.y - pos.y) );
|
|
|
|
PlotCircle( format_plot, thickness, pos, radius );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2008-05-05 19:50:59 +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:
|
|
|
|
{
|
|
|
|
// We must compute true coordinates from m_PolyList
|
|
|
|
// which are relative to module position, orientation 0
|
|
|
|
int ii, * source, * ptr, * ptr_base;
|
|
|
|
MODULE* Module = NULL;
|
|
|
|
if( PtEdge->m_Parent && (PtEdge->m_Parent->Type() == TYPEMODULE) )
|
|
|
|
Module = (MODULE*) PtEdge->m_Parent;
|
|
|
|
ptr = ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyCount * sizeof(int) );
|
|
|
|
source = PtEdge->m_PolyList;
|
|
|
|
for( ii = 0; ii < PtEdge->m_PolyCount; ii++ )
|
|
|
|
{
|
2008-05-05 19:50:59 +00:00
|
|
|
int x = *source++;
|
|
|
|
int y = *source++;
|
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
if( Module )
|
|
|
|
{
|
|
|
|
RotatePoint( &x, &y, Module->m_Orient );
|
|
|
|
x += Module->m_Pos.x;
|
|
|
|
y += Module->m_Pos.y;
|
|
|
|
}
|
2008-05-05 19:50:59 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
x += PtEdge->m_Start0.x;
|
|
|
|
y += PtEdge->m_Start0.y;
|
2008-05-05 19:50:59 +00:00
|
|
|
|
|
|
|
*ptr++ = x;
|
|
|
|
*ptr++ = y;
|
2007-12-11 20:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PlotPolygon( format_plot, TRUE, PtEdge->m_PolyCount, ptr_base );
|
|
|
|
free( ptr_base );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
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-05-05 19:50:59 +00:00
|
|
|
int no_miroir, 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;
|
|
|
|
no_miroir = pt_texte->m_Miroir & 1;
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness = pt_texte->m_Width;
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
if( no_miroir == FALSE )
|
|
|
|
size.x = -size.x;
|
|
|
|
|
|
|
|
Plot_1_texte( format_plot, pt_texte->m_Text, orient,
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness, pos.x, pos.y, size.x, size.y );
|
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_texte( int format_plot, const wxString& Text, int angle,
|
2008-05-05 19:50:59 +00:00
|
|
|
int thickness, int cX, int cY, int size_h, int size_v,
|
2007-12-11 20:28:13 +00:00
|
|
|
bool centreX, bool centreY )
|
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
|
|
|
* Trace de 1 texte:
|
|
|
|
* ptr = pointeur sur le texte
|
|
|
|
* angle = angle d'orientation, dependant aussi du mode de trace (miroir..)
|
|
|
|
* cX, cY = position du centre du texte
|
|
|
|
* size_h , size_v = dimensions ( algebriques );
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-11 20:28:13 +00:00
|
|
|
int kk = 0, k1, k2, end;
|
|
|
|
int espacement;
|
|
|
|
char f_cod, plume;
|
|
|
|
const SH_CODE* ptcar;
|
|
|
|
int ox, oy, fx, fy; /* Coord de debut et fin des segments a tracer */
|
|
|
|
int sx, sy; /* coord du debut du caractere courant */
|
|
|
|
int nbcodes = Text.Len();
|
|
|
|
|
2008-05-05 19:50:59 +00:00
|
|
|
espacement = ( (10 * size_h) / 9 ) + ( (size_h >= 0 ) ? thickness : -thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
|
|
|
|
/* calcul de la position du debut du texte */
|
|
|
|
if( centreX )
|
|
|
|
sx = cX - ( (espacement * nbcodes) / 2 ) + (espacement / 9);
|
|
|
|
else
|
|
|
|
sx = cX;
|
|
|
|
if( centreY )
|
|
|
|
sy = cY + (size_v / 2);
|
|
|
|
else
|
|
|
|
sy = cY;
|
|
|
|
|
|
|
|
/* trace du texte */
|
|
|
|
for( ; kk < nbcodes; kk++ )
|
|
|
|
{
|
|
|
|
int code = Text.GetChar( kk ) & 0xFF;
|
|
|
|
ptcar = graphic_fonte_shape[code]; /* ptcar pointe la description
|
|
|
|
* du caractere a dessiner */
|
|
|
|
|
2008-02-12 02:44:46 +00:00
|
|
|
plume = 'U';
|
|
|
|
ox = sx;
|
2008-01-17 15:21:36 +00:00
|
|
|
oy = sy;
|
2008-02-12 02:44:46 +00:00
|
|
|
|
2007-12-11 20:28:13 +00:00
|
|
|
RotatePoint( &ox, &oy, cX, cY, angle );
|
|
|
|
fx = ox; fy = oy;
|
|
|
|
|
|
|
|
for( end = 0; end == 0; ptcar++ )
|
|
|
|
{
|
|
|
|
f_cod = *ptcar;
|
|
|
|
|
|
|
|
/* get code n de la forme selectionnee */
|
|
|
|
switch( f_cod )
|
|
|
|
{
|
|
|
|
case 'X':
|
|
|
|
end = 1; /* fin du caractere */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'U':
|
|
|
|
case 'D':
|
|
|
|
plume = f_cod; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
k1 = f_cod; // Coord X
|
|
|
|
k1 = (k1 * size_v) / 9;
|
|
|
|
ptcar++;
|
|
|
|
k2 = *ptcar; // Coord Y
|
|
|
|
k2 = (k2 * size_h) / 8;
|
|
|
|
|
|
|
|
fx = k2 + sx; fy = -k1 + sy;
|
|
|
|
RotatePoint( &fx, &fy, cX, cY, angle );
|
|
|
|
|
|
|
|
/* Trace du segment */
|
|
|
|
if( plume == 'D' )
|
|
|
|
{
|
|
|
|
switch( format_plot )
|
|
|
|
{
|
|
|
|
case PLOT_FORMAT_GERBER:
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotGERBERLine( wxPoint( ox, oy ), wxPoint( fx, fy ), thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
2008-05-05 19:50:59 +00:00
|
|
|
trace_1_segment_HPGL( ox, oy, fx, fy, thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
2008-05-05 19:50:59 +00:00
|
|
|
PlotFilledSegmentPS( wxPoint( ox, oy ), wxPoint( fx, fy ), thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ox = fx; oy = fy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fin switch decodade matrice de forme */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end boucle for = end trace de 1 caractere */
|
|
|
|
|
|
|
|
sx += espacement;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end trace du texte */
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void Affiche_erreur( int nb_err )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Affiche le nombre d'erreurs commises ( segments traces avec plume trop grosse
|
2007-12-11 20:28:13 +00:00
|
|
|
* ou autres */
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
// sprintf(msg,"%d",nb_err) ;
|
|
|
|
// Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ;
|
|
|
|
}
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/*********************************************************/
|
|
|
|
void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
|
|
|
|
/*********************************************************/
|
|
|
|
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
static int* CornersBuffer = NULL;
|
|
|
|
static unsigned CornersBufferSize = 0;
|
|
|
|
unsigned imax = aZone->m_FilledPolysList.size();
|
|
|
|
|
|
|
|
if( imax == 0 ) // Nothing to draw
|
|
|
|
return;
|
|
|
|
|
|
|
|
// We need a buffer to store corners coordinates:
|
|
|
|
if( CornersBuffer == NULL )
|
|
|
|
{
|
|
|
|
CornersBufferSize = imax * 4;
|
|
|
|
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (imax * 4) > CornersBufferSize )
|
|
|
|
{
|
|
|
|
CornersBufferSize = imax * 4;
|
|
|
|
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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++;
|
|
|
|
if( corner->end_contour )
|
|
|
|
{ // Plot the current filled area
|
|
|
|
PlotPolygon( aFormat, true, corners_count, CornersBuffer );
|
|
|
|
corners_count = 0;
|
|
|
|
ii = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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;
|
2007-12-11 20:28:13 +00:00
|
|
|
if( 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 )
|
|
|
|
{
|
2008-05-05 19:50:59 +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 )
|
|
|
|
{
|
2008-05-05 19:50:59 +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:
|
|
|
|
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
|
2008-05-05 19:50:59 +00:00
|
|
|
trace_1_segment_HPGL( start.x, start.y, end.x, end.y, thickness );
|
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:
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
2007-12-11 20:28:13 +00:00
|
|
|
void PlotPolygon( int format_plot, bool Filled, 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:
|
|
|
|
PlotPolygon_GERBER( nbpoints, coord, Filled );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
PlotPolyHPGL( nbpoints, coord, Filled );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
PlotPolyPS( nbpoints, coord, Filled );
|
|
|
|
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
|
|
|
|
|
|
|
if( 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) )
|
2007-12-11 20:28:13 +00:00
|
|
|
delta = 225; /* 16 segm pour 360 deg */
|
2008-05-05 19:50:59 +00:00
|
|
|
if( radius < (thickness * 5) )
|
2007-12-11 20:28:13 +00:00
|
|
|
delta = 300; /* 12 segm pour 360 deg */
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
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:
|
|
|
|
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:
|
|
|
|
trace_1_segment_HPGL( centre.x + ox,
|
|
|
|
centre.y + oy,
|
|
|
|
centre.x + fx,
|
|
|
|
centre.y + fy,
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness );
|
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:
|
|
|
|
trace_1_segment_HPGL( centre.x + ox,
|
|
|
|
centre.y + oy,
|
|
|
|
centre.x + fx,
|
|
|
|
centre.y + fy,
|
2008-05-05 19:50:59 +00:00
|
|
|
thickness );
|
2007-12-11 20:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|