39 changed files with 2357 additions and 2300 deletions
-
20CHANGELOG.txt
-
56common/gr_basic.cpp
-
3gerbview/CMakeLists.txt
-
251gerbview/block.cpp
-
190gerbview/class_GERBER.cpp
-
426gerbview/class_gerber_draw_item.cpp
-
183gerbview/class_gerber_draw_item.h
-
581gerbview/dcode.cpp
-
278gerbview/dcode.h
-
74gerbview/deltrack.cpp
-
2gerbview/dummy_functions.cpp
-
28gerbview/edit.cpp
-
55gerbview/export_to_pcbnew.cpp
-
27gerbview/gerber_test_files/aperture-circle-flash-with_hole.gbr
-
27gerbview/gerber_test_files/aperture-obround-flash-with_hole.gbr
-
27gerbview/gerber_test_files/test-aperture-polygon-flash.gbr
-
27gerbview/gerber_test_files/test-aperture-rectangle-flash-with_hole.gbr
-
184gerbview/gerberframe.cpp
-
232gerbview/gerbview.h
-
2gerbview/gerbview_config.h
-
2gerbview/gerbview_id.h
-
4gerbview/hotkeys.cpp
-
2gerbview/hotkeys.h
-
33gerbview/initpcb.cpp
-
37gerbview/lay2plot.cpp
-
442gerbview/locate.cpp
-
21gerbview/onrightclick.cpp
-
16gerbview/options.cpp
-
11gerbview/protos.h
-
12gerbview/readgerb.cpp
-
948gerbview/rs274d.cpp
-
2gerbview/rs274x.cpp
-
108gerbview/toolbars_gerber.cpp
-
303gerbview/tracepcb.cpp
-
11gerbview/wxGerberFrame.h
-
5include/base_struct.h
-
11include/class_board_item.h
-
10include/gr_basic.h
-
6pcbnew/class_board_item.cpp
@ -0,0 +1,190 @@ |
|||||
|
/** @file class_GERBER.cpp
|
||||
|
* a GERBER class handle for a given layer info about used D_CODES and how the layer is drawn |
||||
|
*/ |
||||
|
|
||||
|
/*
|
||||
|
* This program source code file is part of KICAD, a free EDA CAD application. |
||||
|
* |
||||
|
* Copyright (C) 1992-2010 <Jean-Pierre Charras> |
||||
|
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors. |
||||
|
* |
||||
|
* This program is free software; you can redistribute it and/or |
||||
|
* modify it under the terms of the GNU General Public License |
||||
|
* as published by the Free Software Foundation; either version 2 |
||||
|
* of the License, or (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program; if not, you may find one here: |
||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
|
* or you may write to the Free Software Foundation, Inc., |
||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
||||
|
*/ |
||||
|
|
||||
|
#include "fctsys.h"
|
||||
|
#include "common.h"
|
||||
|
#include "class_drawpanel.h"
|
||||
|
#include "confirm.h"
|
||||
|
#include "macros.h"
|
||||
|
|
||||
|
#include "gerbview.h"
|
||||
|
|
||||
|
/* Format Gerber: NOTES:
|
||||
|
* Tools and D_CODES |
||||
|
* tool number (identification of shapes) |
||||
|
* 1 to 999 |
||||
|
* |
||||
|
* D_CODES: |
||||
|
* D01 ... D9 = action codes: |
||||
|
* D01 = activating light (lower pen) when di ¿½ placement |
||||
|
* D02 = light extinction (lift pen) when di ¿½ placement |
||||
|
* D03 Flash |
||||
|
* D09 = VAPE Flash |
||||
|
* D10 ... = Indentification Tool (Opening) |
||||
|
* |
||||
|
* For tools: |
||||
|
* DCode min = D10 |
||||
|
* DCode max = 999 |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
GERBER::GERBER( int aLayer ) |
||||
|
{ |
||||
|
m_Layer = aLayer; // Layer Number
|
||||
|
|
||||
|
m_Selected_Tool = FIRST_DCODE; |
||||
|
|
||||
|
ResetDefaultValues(); |
||||
|
|
||||
|
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ ) |
||||
|
m_Aperture_List[ii] = 0; |
||||
|
|
||||
|
m_Pcb = 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
GERBER::~GERBER() |
||||
|
{ |
||||
|
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ ) |
||||
|
{ |
||||
|
delete m_Aperture_List[ii]; |
||||
|
|
||||
|
// m_Aperture_List[ii] = NULL;
|
||||
|
} |
||||
|
|
||||
|
delete m_Pcb; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
D_CODE* GERBER::GetDCODE( int aDCODE, bool create ) |
||||
|
{ |
||||
|
unsigned ndx = aDCODE - FIRST_DCODE; |
||||
|
|
||||
|
if( ndx < (unsigned) DIM( m_Aperture_List ) ) |
||||
|
{ |
||||
|
// lazily create the D_CODE if it does not exist.
|
||||
|
if( create ) |
||||
|
{ |
||||
|
if( m_Aperture_List[ndx] == NULL ) |
||||
|
m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE ); |
||||
|
} |
||||
|
|
||||
|
return m_Aperture_List[ndx]; |
||||
|
} |
||||
|
return NULL; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
APERTURE_MACRO* GERBER::FindApertureMacro( const APERTURE_MACRO& aLookup ) |
||||
|
{ |
||||
|
APERTURE_MACRO_SET::iterator iter = m_aperture_macros.find( aLookup ); |
||||
|
|
||||
|
if( iter != m_aperture_macros.end() ) |
||||
|
{ |
||||
|
APERTURE_MACRO* pam = (APERTURE_MACRO*) &(*iter); |
||||
|
return pam; |
||||
|
} |
||||
|
|
||||
|
return NULL; // not found
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
void GERBER::ResetDefaultValues() |
||||
|
{ |
||||
|
m_FileName.Empty(); |
||||
|
m_Name = wxT( "no name" ); // Layer name
|
||||
|
m_LayerNegative = FALSE; // TRUE = Negative Layer
|
||||
|
m_ImageNegative = FALSE; // TRUE = Negative image
|
||||
|
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
|
||||
|
m_Relative = FALSE; // FALSE = absolute Coord, RUE =
|
||||
|
// relative Coord
|
||||
|
m_NoTrailingZeros = FALSE; // True: trailing zeros deleted
|
||||
|
m_MirorA = FALSE; // True: miror / axe A (X)
|
||||
|
m_MirorB = FALSE; // True: miror / axe B (Y)
|
||||
|
m_Has_DCode = FALSE; // TRUE = DCodes in file (FALSE = no
|
||||
|
// DCode->
|
||||
|
// separate DCode file
|
||||
|
|
||||
|
m_Offset.x = m_Offset.y = 0; // Coord Offset
|
||||
|
|
||||
|
m_FmtScale.x = m_FmtScale.y = g_Default_GERBER_Format % 10; |
||||
|
m_FmtLen.x = m_FmtLen.y = m_FmtScale.x + (g_Default_GERBER_Format / 10); |
||||
|
|
||||
|
m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X and Y) this
|
||||
|
// layer
|
||||
|
m_Rotation = 0; |
||||
|
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
|
||||
|
m_360Arc_enbl = FALSE; // 360 deg circular
|
||||
|
// interpolation disable
|
||||
|
m_Current_Tool = 0; // Current Tool (Dcode)
|
||||
|
// number selected
|
||||
|
m_CommandState = 0; // gives tate of the
|
||||
|
// stacking order analysis
|
||||
|
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
|
||||
|
// for plot
|
||||
|
m_PreviousPos.x = m_PreviousPos.y = 0; // old current specified
|
||||
|
// coord for plot
|
||||
|
m_IJPos.x = m_IJPos.y = 0; // current centre coord for
|
||||
|
// plot arcs & circles
|
||||
|
m_Current_File = NULL; // File to read
|
||||
|
m_FilesPtr = 0; |
||||
|
m_Transform[0][0] = m_Transform[1][1] = 1; |
||||
|
m_Transform[0][1] = m_Transform[1][0] = 0; // Rotation/mirror = Normal
|
||||
|
m_PolygonFillMode = FALSE; |
||||
|
m_PolygonFillModeState = 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
int GERBER::ReturnUsedDcodeNumber() |
||||
|
{ |
||||
|
int count = 0; |
||||
|
|
||||
|
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ ) |
||||
|
{ |
||||
|
if( m_Aperture_List[ii] ) |
||||
|
if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined ) |
||||
|
++count; |
||||
|
} |
||||
|
|
||||
|
return count; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void GERBER::InitToolTable() |
||||
|
{ |
||||
|
for( int count = 0; count < TOOLS_MAX_COUNT; count++ ) |
||||
|
{ |
||||
|
if( m_Aperture_List[count] == NULL ) |
||||
|
continue; |
||||
|
|
||||
|
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE; |
||||
|
m_Aperture_List[count]->Clear_D_CODE_Data(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,426 @@ |
|||||
|
/*************************************
|
||||
|
* file class_gerber_draw_item.cpp |
||||
|
*************************************/ |
||||
|
|
||||
|
/*
|
||||
|
* This program source code file is part of KICAD, a free EDA CAD application. |
||||
|
* |
||||
|
* Copyright (C) 1992-2010 <Jean-Pierre Charras> |
||||
|
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors. |
||||
|
* |
||||
|
* This program is free software; you can redistribute it and/or |
||||
|
* modify it under the terms of the GNU General Public License |
||||
|
* as published by the Free Software Foundation; either version 2 |
||||
|
* of the License, or (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program; if not, you may find one here: |
||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
|
* or you may write to the Free Software Foundation, Inc., |
||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
||||
|
*/ |
||||
|
|
||||
|
#include "fctsys.h"
|
||||
|
#include "polygons_defs.h"
|
||||
|
#include "gr_basic.h"
|
||||
|
#include "common.h"
|
||||
|
#include "trigo.h"
|
||||
|
#include "class_drawpanel.h"
|
||||
|
#include "drawtxt.h"
|
||||
|
|
||||
|
#include "gerbview.h"
|
||||
|
#include "class_board_design_settings.h"
|
||||
|
#include "colors_selection.h"
|
||||
|
#include "class_gerber_draw_item.h"
|
||||
|
|
||||
|
|
||||
|
/**********************************************************/ |
||||
|
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent ) : |
||||
|
BOARD_ITEM( aParent, TYPE_GERBER_DRAW_ITEM ) |
||||
|
/**********************************************************/ |
||||
|
{ |
||||
|
m_Layer = 0; |
||||
|
m_Shape = GBR_SEGMENT; |
||||
|
m_Flashed = false; |
||||
|
m_DCode = 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// Copy constructor
|
||||
|
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) : |
||||
|
BOARD_ITEM( aSource ) |
||||
|
{ |
||||
|
m_Shape = aSource.m_Shape; |
||||
|
|
||||
|
m_Flags = aSource.m_Flags; |
||||
|
m_TimeStamp = aSource.m_TimeStamp; |
||||
|
|
||||
|
SetStatus( aSource.ReturnStatus() ); |
||||
|
m_Start = aSource.m_Start; |
||||
|
m_End = aSource.m_End; |
||||
|
m_Size = aSource.m_Size; |
||||
|
m_Layer = aSource.m_Layer; |
||||
|
m_Shape = aSource.m_Shape; |
||||
|
m_Flashed = aSource.m_Flashed; |
||||
|
m_DCode = aSource.m_DCode; |
||||
|
m_PolyCorners = aSource.m_PolyCorners; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
GERBER_DRAW_ITEM::~GERBER_DRAW_ITEM() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
GERBER_DRAW_ITEM* GERBER_DRAW_ITEM::Copy() const |
||||
|
{ |
||||
|
return new GERBER_DRAW_ITEM( *this ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
wxString GERBER_DRAW_ITEM::ShowGBRShape() |
||||
|
{ |
||||
|
switch( m_Shape ) |
||||
|
{ |
||||
|
case GBR_SEGMENT: |
||||
|
return _( "Line" ); |
||||
|
|
||||
|
case GBR_ARC: |
||||
|
return _( "Arc" ); |
||||
|
|
||||
|
case GBR_CIRCLE: |
||||
|
return _( "Circle" ); |
||||
|
|
||||
|
case GBR_SPOT_OVAL: |
||||
|
return wxT( "spot_oval" ); |
||||
|
|
||||
|
case GBR_SPOT_CIRCLE: |
||||
|
return wxT( "spot_circle" ); |
||||
|
|
||||
|
case GBR_SPOT_RECT: |
||||
|
return wxT( "spot_rect" ); |
||||
|
|
||||
|
case GBR_POLYGON: |
||||
|
return wxT( "polygon" ); |
||||
|
|
||||
|
case GBR_MACRO: |
||||
|
return wxT( "apt_macro" ); // TODO: add aperture macro name
|
||||
|
|
||||
|
default: |
||||
|
return wxT( "??" ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/**
|
||||
|
* Function GetDcodeDescr |
||||
|
* returns the GetDcodeDescr of this object, or NULL. |
||||
|
* @return D_CODE* - a pointer to the DCode description (for flashed items). |
||||
|
*/ |
||||
|
D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr() |
||||
|
{ |
||||
|
if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) ) |
||||
|
return NULL; |
||||
|
GERBER* gerber = g_GERBER_List[m_Layer]; |
||||
|
if( gerber == NULL ) |
||||
|
return NULL; |
||||
|
|
||||
|
D_CODE* d_code = gerber->GetDCODE( m_DCode, false ); |
||||
|
|
||||
|
return d_code; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
EDA_Rect GERBER_DRAW_ITEM::GetBoundingBox() |
||||
|
{ |
||||
|
// return a rectangle which is (pos,dim) in nature. therefore the +1
|
||||
|
EDA_Rect bbox( m_Start, wxSize( 1, 1 ) ); |
||||
|
|
||||
|
bbox.Inflate( m_Size.x / 2, m_Size.y / 2 ); |
||||
|
return bbox; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/**
|
||||
|
* Function Move |
||||
|
* move this object. |
||||
|
* @param const wxPoint& aMoveVector - the move vector for this object. |
||||
|
*/ |
||||
|
void GERBER_DRAW_ITEM::Move( const wxPoint& aMoveVector ) |
||||
|
{ |
||||
|
m_Start += aMoveVector; |
||||
|
m_End += aMoveVector; |
||||
|
m_ArcCentre += aMoveVector; |
||||
|
for( unsigned ii = 0; ii < m_PolyCorners.size(); ii++ ) |
||||
|
m_PolyCorners[ii] += aMoveVector; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** function Save.
|
||||
|
* currently: no nothing, but must be defined to meet requirements |
||||
|
* of the basic class |
||||
|
*/ |
||||
|
bool GERBER_DRAW_ITEM::Save( FILE* aFile ) const |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/*********************************************************************/ |
||||
|
void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, |
||||
|
const wxPoint& aOffset ) |
||||
|
/*********************************************************************/ |
||||
|
{ |
||||
|
static D_CODE dummyD_CODE( 0 ); // used when a D_CODE is not found. default D_CODE to draw a flashed item
|
||||
|
int color; |
||||
|
bool isFilled; |
||||
|
int radius; |
||||
|
int halfPenWidth; |
||||
|
static bool show_err; |
||||
|
BOARD* brd = GetBoard(); |
||||
|
D_CODE* d_codeDescr = GetDcodeDescr(); |
||||
|
|
||||
|
if( d_codeDescr == NULL ) |
||||
|
d_codeDescr = &dummyD_CODE; |
||||
|
|
||||
|
if( m_Flags & DRAW_ERASED ) // draw in background color ("negative" color)
|
||||
|
{ |
||||
|
color = g_DrawBgColor; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if( brd->IsLayerVisible( GetLayer() ) == false ) |
||||
|
return; |
||||
|
|
||||
|
color = brd->GetLayerColor( GetLayer() ); |
||||
|
|
||||
|
if( draw_mode & GR_SURBRILL ) |
||||
|
{ |
||||
|
if( draw_mode & GR_AND ) |
||||
|
color &= ~HIGHT_LIGHT_FLAG; |
||||
|
else |
||||
|
color |= HIGHT_LIGHT_FLAG; |
||||
|
} |
||||
|
if( color & HIGHT_LIGHT_FLAG ) |
||||
|
color = ColorRefs[color & MASKCOLOR].m_LightColor; |
||||
|
} |
||||
|
|
||||
|
GRSetDrawMode( DC, draw_mode ); |
||||
|
|
||||
|
isFilled = DisplayOpt.DisplayPcbTrackFill ? true : false; |
||||
|
|
||||
|
switch( m_Shape ) |
||||
|
{ |
||||
|
case GBR_POLYGON: |
||||
|
isFilled = (g_DisplayPolygonsModeSketch == false); |
||||
|
if( m_Flags & DRAW_ERASED ) |
||||
|
isFilled = true; |
||||
|
DrawGbrPoly( &panel->m_ClipBox, DC, color, aOffset, isFilled ); |
||||
|
break; |
||||
|
|
||||
|
case GBR_CIRCLE: |
||||
|
radius = (int) hypot( (double) ( m_End.x - m_Start.x ), |
||||
|
(double) ( m_End.y - m_Start.y ) ); |
||||
|
|
||||
|
halfPenWidth = m_Size.x >> 1; |
||||
|
|
||||
|
if( isFilled == SKETCH ) |
||||
|
{ |
||||
|
// draw the border of the pen's path using two circles, each as narrow as possible
|
||||
|
#ifdef USE_WX_ZOOM
|
||||
|
if( DC->LogicalToDeviceXRel( halfPenWidth ) < L_MIN_DESSIN ) |
||||
|
#else
|
||||
|
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN ) |
||||
|
#endif
|
||||
|
{ |
||||
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x, |
||||
|
m_Start.y, radius, 0, color ); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
radius - halfPenWidth, 0, color ); |
||||
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
radius + halfPenWidth, 0, color ); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
radius, m_Size.x, color ); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
case GBR_ARC: |
||||
|
if( !isFilled ) |
||||
|
{ |
||||
|
GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
m_End.x, m_End.y, |
||||
|
m_ArcCentre.x, m_ArcCentre.y, 0, color ); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
GRArc1( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
m_End.x, m_End.y, |
||||
|
m_ArcCentre.x, m_ArcCentre.y, |
||||
|
m_Size.x, color ); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
case GBR_SPOT_CIRCLE: |
||||
|
case GBR_SPOT_RECT: |
||||
|
case GBR_SPOT_OVAL: |
||||
|
isFilled = DisplayOpt.DisplayPadFill ? true : false; |
||||
|
d_codeDescr->DrawFlashedShape( &panel->m_ClipBox, DC, color, |
||||
|
m_Start, isFilled ); |
||||
|
break; |
||||
|
|
||||
|
case GBR_SEGMENT: |
||||
|
if( !isFilled ) |
||||
|
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, |
||||
|
m_End.x, m_End.y, m_Size.x, color ); |
||||
|
else |
||||
|
GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x, |
||||
|
m_Start.y, m_End.x, m_End.y, m_Size.x, color ); |
||||
|
break; |
||||
|
|
||||
|
default: |
||||
|
if( !show_err ) |
||||
|
{ |
||||
|
wxMessageBox( wxT( "Trace_Segment() type error" ) ); |
||||
|
show_err = TRUE; |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** function DrawGbrPoly
|
||||
|
* a helper function used id ::Draw to draw the polygon stored ion m_PolyCorners |
||||
|
* Draw filled polygons |
||||
|
*/ |
||||
|
void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_Rect* aClipBox, |
||||
|
wxDC* aDC, |
||||
|
int aColor, |
||||
|
const wxPoint& aOffset, |
||||
|
bool aFilledShape ) |
||||
|
{ |
||||
|
std::vector<wxPoint> points; |
||||
|
|
||||
|
points = m_PolyCorners; |
||||
|
if( aOffset != wxPoint( 0, 0 ) ) |
||||
|
{ |
||||
|
for( unsigned ii = 0; ii < points.size(); ii++ ) |
||||
|
{ |
||||
|
points[ii] += aOffset; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
GRClosedPoly( aClipBox, aDC, points.size(), &points[0], aFilledShape, aColor, aColor ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** Function DisplayInfoBase
|
||||
|
* has knowledge about the frame and how and where to put status information |
||||
|
* about this object into the frame's message panel. |
||||
|
* Display info about the track segment only, and does not calculate the full track length |
||||
|
* @param frame A WinEDA_DrawFrame in which to print status information. |
||||
|
*/ |
||||
|
void GERBER_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) |
||||
|
{ |
||||
|
wxString msg; |
||||
|
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard(); |
||||
|
|
||||
|
frame->ClearMsgPanel(); |
||||
|
|
||||
|
msg = ShowGBRShape(); |
||||
|
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); |
||||
|
|
||||
|
/* Display layer */ |
||||
|
msg = board->GetLayerName( m_Layer ); |
||||
|
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/**
|
||||
|
* Function HitTest |
||||
|
* tests if the given wxPoint is within the bounds of this object. |
||||
|
* @param ref_pos A wxPoint to test |
||||
|
* @return bool - true if a hit, else false |
||||
|
*/ |
||||
|
bool GERBER_DRAW_ITEM::HitTest( const wxPoint& ref_pos ) |
||||
|
{ |
||||
|
// TODO: a better analyse od the shape (perhaps create a D_CODE::HitTest for flashed items)
|
||||
|
int radius = MIN( m_Size.x, m_Size.y) >> 1; |
||||
|
|
||||
|
// delta is a vector from m_Start to m_End (an origin of m_Start)
|
||||
|
wxPoint delta = m_End - m_Start; |
||||
|
|
||||
|
// dist is a vector from m_Start to ref_pos (an origin of m_Start)
|
||||
|
wxPoint dist = ref_pos - m_Start; |
||||
|
|
||||
|
if( m_Flashed ) |
||||
|
{ |
||||
|
return (double) dist.x * dist.x + (double) dist.y * dist.y <= |
||||
|
(double) radius * radius; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if( DistanceTest( radius, delta.x, delta.y, dist.x, dist.y ) ) |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/**
|
||||
|
* Function HitTest (overlayed) |
||||
|
* tests if the given EDA_Rect intersect this object. |
||||
|
* For now, an ending point must be inside this rect. |
||||
|
* @param refArea : the given EDA_Rect |
||||
|
* @return bool - true if a hit, else false |
||||
|
*/ |
||||
|
bool GERBER_DRAW_ITEM::HitTest( EDA_Rect& refArea ) |
||||
|
{ |
||||
|
if( refArea.Inside( m_Start ) ) |
||||
|
return true; |
||||
|
if( refArea.Inside( m_End ) ) |
||||
|
return true; |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#if defined(DEBUG)
|
||||
|
|
||||
|
/**
|
||||
|
* Function Show |
||||
|
* is used to output the object tree, currently for debugging only. |
||||
|
* @param nestLevel An aid to prettier tree indenting, and is the level |
||||
|
* of nesting of this object within the overall tree. |
||||
|
* @param os The ostream& to output to. |
||||
|
*/ |
||||
|
void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) |
||||
|
{ |
||||
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << |
||||
|
|
||||
|
" shape=\"" << m_Shape << '"' << |
||||
|
" addr=\"" << std::hex << this << std::dec << '"' << |
||||
|
" layer=\"" << m_Layer << '"' << |
||||
|
" size=\"" << m_Size << '"' << |
||||
|
" flags=\"" << m_Flags << '"' << |
||||
|
" status=\"" << GetState( -1 ) << '"' << |
||||
|
"<start" << m_Start << "/>" << |
||||
|
"<end" << m_End << "/>"; |
||||
|
|
||||
|
os << "</" << GetClass().Lower().mb_str() << ">\n"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endif
|
@ -0,0 +1,183 @@ |
|||||
|
/*******************************************************************/ |
||||
|
/* class_gerber_draw_item.h: definitions relatives to tracks, vias and zones */ |
||||
|
/*******************************************************************/ |
||||
|
|
||||
|
#ifndef CLASS_GERBER_DRAW_ITEM_H |
||||
|
#define CLASS_GERBER_DRAW_ITEM_H |
||||
|
|
||||
|
/* |
||||
|
* This program source code file is part of KICAD, a free EDA CAD application. |
||||
|
* |
||||
|
* Copyright (C) 1992-2010 <Jean-Pierre Charras> |
||||
|
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors. |
||||
|
* |
||||
|
* This program is free software; you can redistribute it and/or |
||||
|
* modify it under the terms of the GNU General Public License |
||||
|
* as published by the Free Software Foundation; either version 2 |
||||
|
* of the License, or (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program; if not, you may find one here: |
||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
||||
|
* or you may search the http://www.gnu.org website for the version 2 license, |
||||
|
* or you may write to the Free Software Foundation, Inc., |
||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
||||
|
*/ |
||||
|
|
||||
|
#include "base_struct.h" |
||||
|
|
||||
|
/* Shapes id for basic shapes ( .m_Shape member ) */ |
||||
|
enum Gbr_Basic_Shapes { |
||||
|
GBR_SEGMENT = 0, // usual segment : line with rounded ends |
||||
|
GBR_ARC, // Arcs (with rounded ends) |
||||
|
GBR_CIRCLE, // ring |
||||
|
GBR_POLYGON, // polygonal shape |
||||
|
GBR_SPOT_CIRCLE, // flashed shape: round shape (can have hole) |
||||
|
GBR_SPOT_RECT, // flashed shape: rectangular shape can have hole) |
||||
|
GBR_SPOT_OVAL, // flashed shape: oval shape |
||||
|
GBR_MACRO, // complex shape described by a macro |
||||
|
GBR_LAST // last value for this list |
||||
|
}; |
||||
|
|
||||
|
/***/ |
||||
|
|
||||
|
class GERBER_DRAW_ITEM : public BOARD_ITEM |
||||
|
{ |
||||
|
// make SetNext() and SetBack() private so that they may not be called from anywhere. |
||||
|
// list management is done on GERBER_DRAW_ITEMs using DLIST<GERBER_DRAW_ITEM> only. |
||||
|
private: |
||||
|
void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } |
||||
|
void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } |
||||
|
|
||||
|
|
||||
|
public: |
||||
|
int m_Layer; |
||||
|
int m_Shape; // Shape and type of this gerber item |
||||
|
wxPoint m_Start; // Line or arc start point or position of the shape |
||||
|
// for flashed items |
||||
|
wxPoint m_End; // Line or arc end point |
||||
|
wxPoint m_ArcCentre; // for arcs only: Centre of arc |
||||
|
std::vector <wxPoint> m_PolyCorners; // list of corners for polygons (G36 to G37 coordinates) |
||||
|
// or for complex shapes which are converted to polygon |
||||
|
wxSize m_Size; // Flashed shapes size of the shape |
||||
|
// Lines : m_Size.x = m_Size.y = line width |
||||
|
bool m_Flashed; // True for flashed items |
||||
|
int m_DCode; // DCode used to draw this item. |
||||
|
// 0 for items that do not use DCodes (polygons) |
||||
|
// or when unknown and normal values are 10 to 999 |
||||
|
// values 0 to 9 can be used for special purposes |
||||
|
|
||||
|
public: |
||||
|
GERBER_DRAW_ITEM( BOARD_ITEM* aParent ); |
||||
|
GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ); |
||||
|
~GERBER_DRAW_ITEM(); |
||||
|
|
||||
|
/** |
||||
|
* Function Copy |
||||
|
* will copy this object |
||||
|
* the corresponding type. |
||||
|
* @return - GERBER_DRAW_ITEM* |
||||
|
*/ |
||||
|
GERBER_DRAW_ITEM* Copy() const; |
||||
|
|
||||
|
GERBER_DRAW_ITEM* Next() const { return (GERBER_DRAW_ITEM*) Pnext; } |
||||
|
GERBER_DRAW_ITEM* Back() const { return (GERBER_DRAW_ITEM*) Pback; } |
||||
|
|
||||
|
int ReturnMaskLayer() |
||||
|
{ |
||||
|
return 1 << m_Layer; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Function Move |
||||
|
* move this object. |
||||
|
* @param const wxPoint& aMoveVector - the move vector for this object. |
||||
|
*/ |
||||
|
void Move( const wxPoint& aMoveVector ); |
||||
|
|
||||
|
/** |
||||
|
* Function GetPosition |
||||
|
* returns the position of this object. |
||||
|
* @return const wxPoint& - The position of this object. |
||||
|
*/ |
||||
|
wxPoint& GetPosition() |
||||
|
{ |
||||
|
return m_Start; // it had to be start or end. |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Function GetDcodeDescr |
||||
|
* returns the GetDcodeDescr of this object, or NULL. |
||||
|
* @return D_CODE* - a pointer to the DCode description (for flashed items). |
||||
|
*/ |
||||
|
D_CODE* GetDcodeDescr(); |
||||
|
|
||||
|
EDA_Rect GetBoundingBox(); |
||||
|
|
||||
|
/* Display on screen: */ |
||||
|
void Draw( WinEDA_DrawPanel* aPanel, |
||||
|
wxDC* aDC, |
||||
|
int aDrawMode, |
||||
|
const wxPoint& aOffset = ZeroOffset ); |
||||
|
|
||||
|
/** function DrawGbrPoly |
||||
|
* a helper function used id ::Draw to draw the polygon stored ion m_PolyCorners |
||||
|
*/ |
||||
|
void DrawGbrPoly( EDA_Rect* aClipBox, |
||||
|
wxDC* aDC, int aColor, |
||||
|
const wxPoint& aOffset, bool aFilledShape ); |
||||
|
|
||||
|
/* divers */ |
||||
|
int Shape() const { return m_Shape; } |
||||
|
|
||||
|
/** |
||||
|
* Function DisplayInfo |
||||
|
* has knowledge about the frame and how and where to put status information |
||||
|
* about this object into the frame's message panel. |
||||
|
* Is virtual from EDA_BaseStruct. |
||||
|
* Display info about the track segment and the full track length |
||||
|
* @param frame A WinEDA_DrawFrame in which to print status information. |
||||
|
*/ |
||||
|
void DisplayInfo( WinEDA_DrawFrame* frame ); |
||||
|
|
||||
|
wxString ShowGBRShape(); |
||||
|
|
||||
|
/** |
||||
|
* Function HitTest |
||||
|
* tests if the given wxPoint is within the bounds of this object. |
||||
|
* @param refPos A wxPoint to test |
||||
|
* @return bool - true if a hit, else false |
||||
|
*/ |
||||
|
bool HitTest( const wxPoint& refPos ); |
||||
|
|
||||
|
/** |
||||
|
* Function HitTest (overlayed) |
||||
|
* tests if the given wxRect intersect this object. |
||||
|
* For now, an ending point must be inside this rect. |
||||
|
* @param refPos A wxPoint to test |
||||
|
* @return bool - true if a hit, else false |
||||
|
*/ |
||||
|
bool HitTest( EDA_Rect& refArea ); |
||||
|
|
||||
|
/** |
||||
|
* Function GetClass |
||||
|
* returns the class name. |
||||
|
* @return wxString |
||||
|
*/ |
||||
|
wxString GetClass() const |
||||
|
{ |
||||
|
return wxT( "GERBER_DRAW_ITEM" ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
bool Save( FILE* aFile ) const; |
||||
|
}; |
||||
|
|
||||
|
#endif /* CLASS_GERBER_DRAW_ITEM_H */ |
@ -0,0 +1,278 @@ |
|||||
|
/**************/ |
||||
|
/* dcode.h */ |
||||
|
/**************/ |
||||
|
|
||||
|
#ifndef _DCODE_H_ |
||||
|
#define _DCODE_H_ |
||||
|
|
||||
|
#include <vector> |
||||
|
#include <set> |
||||
|
|
||||
|
#include "base_struct.h" |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Enum APERTURE_T |
||||
|
* is the set of all gerber aperture types allowed, according to page 16 of |
||||
|
* http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf |
||||
|
*/ |
||||
|
enum APERTURE_T |
||||
|
{ |
||||
|
APT_CIRCLE = 'C', |
||||
|
APT_LINE = 'L', |
||||
|
APT_RECT = 'R', |
||||
|
APT_OVAL = '0', |
||||
|
APT_POLYGON = 'P', |
||||
|
APT_MACRO = 'M' |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
#define FIRST_DCODE 10 |
||||
|
#define LAST_DCODE 999 // dcodes values are from 10 to 999 |
||||
|
#define TOOLS_MAX_COUNT (LAST_DCODE+1) |
||||
|
|
||||
|
class D_CODE; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Class DCODE_PARAM |
||||
|
* holds a parameter for a DCODE or an "aperture macro" as defined within |
||||
|
* standard RS274X. The \a value field can be a constant, i.e. "immediate" |
||||
|
* parameter or it may not be used if this param is going to defer to the |
||||
|
* referencing aperture macro. In that case, the \a index field is an index |
||||
|
* into the aperture macro's parameters. |
||||
|
*/ |
||||
|
class DCODE_PARAM |
||||
|
{ |
||||
|
public: |
||||
|
DCODE_PARAM() : |
||||
|
index(-1), |
||||
|
value(0.0) |
||||
|
{} |
||||
|
|
||||
|
double GetValue( const D_CODE* aDcode ) const; |
||||
|
void SetValue( double aValue ) |
||||
|
{ |
||||
|
value = aValue; |
||||
|
index = -1; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Function IsImmediate |
||||
|
* tests if this DCODE_PARAM holds an immediate parameter or is a pointer |
||||
|
* into a parameter held by an owning D_CODE. |
||||
|
*/ |
||||
|
bool IsImmediate() const { return index == -1; } |
||||
|
|
||||
|
unsigned GetIndex() const |
||||
|
{ |
||||
|
return (unsigned) index; |
||||
|
} |
||||
|
|
||||
|
void SetIndex( int aIndex ) |
||||
|
{ |
||||
|
index = aIndex; |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
int index; ///< if -1, then \a value field is an immediate value, |
||||
|
// else this is an index into parent's |
||||
|
// D_CODE.m_am_params. |
||||
|
double value; ///< if IsImmediate()==true then use the value, else |
||||
|
// not used. |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Enum AM_PRIMITIVE_ID |
||||
|
* is the set of all "aperture macro primitives" (primitive numbers). See |
||||
|
* Table 3 in http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf |
||||
|
*/ |
||||
|
enum AM_PRIMITIVE_ID |
||||
|
{ |
||||
|
AMP_CIRCLE = 1, |
||||
|
AMP_LINE2 = 2, |
||||
|
AMP_LINE20 = 20, |
||||
|
AMP_LINE_CENTER = 21, |
||||
|
AMP_LINE_LOWER_LEFT = 22, |
||||
|
AMP_EOF = 3, |
||||
|
AMP_OUTLINE = 4, |
||||
|
AMP_POLYGON = 5, |
||||
|
AMP_MOIRE = 6, |
||||
|
AMP_THERMAL = 7, |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
typedef std::vector<DCODE_PARAM> DCODE_PARAMS; |
||||
|
|
||||
|
/** |
||||
|
* Struct AM_PRIMITIVE |
||||
|
* holds an aperture macro primitive as given in Table 3 of |
||||
|
* http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf |
||||
|
*/ |
||||
|
struct AM_PRIMITIVE |
||||
|
{ |
||||
|
AM_PRIMITIVE_ID primitive_id; ///< The primitive type |
||||
|
DCODE_PARAMS params; ///< A sequence of parameters used by |
||||
|
// the primitive |
||||
|
|
||||
|
/** |
||||
|
* Function GetExposure |
||||
|
* returns the first parameter in integer form. Some but not all primitives |
||||
|
* use the first parameter as an exposure control. |
||||
|
*/ |
||||
|
int GetExposure() const |
||||
|
{ |
||||
|
// No D_CODE* for GetValue() |
||||
|
wxASSERT( params.size() && params[0].IsImmediate() ); |
||||
|
return (int) params[0].GetValue( NULL ); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
typedef std::vector<AM_PRIMITIVE> AM_PRIMITIVES; |
||||
|
|
||||
|
/** |
||||
|
* Struct APERTURE_MACRO |
||||
|
* helps support the "aperture macro" defined within standard RS274X. |
||||
|
*/ |
||||
|
struct APERTURE_MACRO |
||||
|
{ |
||||
|
wxString name; ///< The name of the aperture macro |
||||
|
AM_PRIMITIVES primitives; ///< A sequence of AM_PRIMITIVEs |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Struct APERTURE_MACRO_less_than |
||||
|
* is used by std:set<APERTURE_MACRO> instantiation which uses |
||||
|
* APERTURE_MACRO.name as its key. |
||||
|
*/ |
||||
|
struct APERTURE_MACRO_less_than |
||||
|
{ |
||||
|
// a "less than" test on two APERTURE_MACROs (.name wxStrings) |
||||
|
bool operator()( const APERTURE_MACRO& am1, const APERTURE_MACRO& am2) const |
||||
|
{ |
||||
|
return am1.name.Cmp( am2.name ) < 0; // case specific wxString compare |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Type APERTURE_MACRO_SET |
||||
|
* is a sorted collection of APERTURE_MACROS whose key is the name field in |
||||
|
* the APERTURE_MACRO. |
||||
|
*/ |
||||
|
typedef std::set<APERTURE_MACRO, APERTURE_MACRO_less_than> APERTURE_MACRO_SET; |
||||
|
typedef std::pair<APERTURE_MACRO_SET::iterator, bool> APERTURE_MACRO_SET_PAIR; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Class D_CODE |
||||
|
* holds a gerber DCODE definition. |
||||
|
*/ |
||||
|
class D_CODE |
||||
|
{ |
||||
|
friend class DCODE_PARAM; |
||||
|
|
||||
|
APERTURE_MACRO* m_Macro; ///< no ownership, points to |
||||
|
// GERBER.m_aperture_macros element |
||||
|
|
||||
|
/** |
||||
|
* parameters used only when this D_CODE holds a reference to an aperture |
||||
|
* macro, and these parameters would customize the macro. |
||||
|
*/ |
||||
|
DCODE_PARAMS m_am_params; |
||||
|
|
||||
|
std::vector <wxPoint> m_PolyCorners; /* Polygon used to draw AMP_POLYGON shape and some other |
||||
|
* complex shapes which are converted to polygon |
||||
|
* (shapes with hole, rotated rectangles ... |
||||
|
*/ |
||||
|
|
||||
|
public: |
||||
|
wxSize m_Size; /* Horizontal and vertical dimensions. */ |
||||
|
APERTURE_T m_Shape; /* shape ( Line, rectangle, circle , oval .. ) */ |
||||
|
int m_Num_Dcode; /* D code ( >= 10 ) */ |
||||
|
wxSize m_Drill; /* dimension of the hole (if any) */ |
||||
|
int m_DrillShape; /* shape of the hole (round = 1, rect = 2) */ |
||||
|
double m_Rotation; /* shape rotation in degrees */ |
||||
|
bool m_InUse; /* FALSE if not used */ |
||||
|
bool m_Defined; /* FALSE if not defined */ |
||||
|
wxString m_SpecialDescr; |
||||
|
|
||||
|
public: |
||||
|
D_CODE( int num_dcode ); |
||||
|
~D_CODE(); |
||||
|
void Clear_D_CODE_Data(); |
||||
|
|
||||
|
void AppendParam( double aValue ) |
||||
|
{ |
||||
|
DCODE_PARAM param; |
||||
|
|
||||
|
param.SetValue( aValue ); |
||||
|
|
||||
|
m_am_params.push_back( param ); |
||||
|
} |
||||
|
|
||||
|
void SetMacro( APERTURE_MACRO* aMacro ) |
||||
|
{ |
||||
|
m_Macro = aMacro; |
||||
|
} |
||||
|
APERTURE_MACRO* GetMacro() { return m_Macro; } |
||||
|
|
||||
|
/** |
||||
|
* Function ShowApertureType |
||||
|
* returns a character string telling what type of aperture type \a aType is. |
||||
|
* @param aType The aperture type to show. |
||||
|
*/ |
||||
|
static const wxChar* ShowApertureType( APERTURE_T aType ); |
||||
|
|
||||
|
/** function DrawFlashedShape |
||||
|
* Draw the dcode shape for flashed items. |
||||
|
* When an item is flashed, the DCode shape is the shape of the item |
||||
|
*/ |
||||
|
void DrawFlashedShape( EDA_Rect* aClipBox, wxDC* aDC, int aColor, |
||||
|
wxPoint aShapePos, bool aFilledShape ); |
||||
|
|
||||
|
/** function DrawFlashedPolygon |
||||
|
* a helper function used id ::Draw to draw the polygon stored ion m_PolyCorners |
||||
|
* Draw some Apertures shapes when they are defined as filled polygons. |
||||
|
* APT_POLYGON is always a polygon, but some complex shapes are also converted to |
||||
|
* polygons (shapes with holes, some rotated shapes) |
||||
|
*/ |
||||
|
void DrawFlashedPolygon( EDA_Rect* aClipBox, wxDC* aDC, int aColor, |
||||
|
bool aFilled, const wxPoint& aPosition ); |
||||
|
|
||||
|
/** function ConvertShapeToPolygon |
||||
|
* convert a shape to an equivalent polygon. |
||||
|
* Arcs and circles are approximated by segments |
||||
|
* Useful when a shape is not a graphic primitive (shape with hole, |
||||
|
* rotated shape ... ) and cannot be easily drawn. |
||||
|
*/ |
||||
|
void ConvertShapeToPolygon( ); |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
inline double DCODE_PARAM::GetValue( const D_CODE* aDcode ) const |
||||
|
{ |
||||
|
if( IsImmediate() ) |
||||
|
return value; |
||||
|
else |
||||
|
{ |
||||
|
// the first one was numbered 1, not zero, as in $1, see page 19 of spec. |
||||
|
unsigned ndx = GetIndex() - 1; |
||||
|
wxASSERT(aDcode); |
||||
|
// get the parameter from the aDcode |
||||
|
if( ndx < aDcode->m_am_params.size() ) |
||||
|
return aDcode->m_am_params[ndx].GetValue( NULL ); |
||||
|
else |
||||
|
{ |
||||
|
wxASSERT( GetIndex()-1 < aDcode->m_am_params.size() ); |
||||
|
return 0.0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endif // ifndef _DCODE_H_ |
@ -0,0 +1,27 @@ |
|||||
|
G04 Test flashing of circular apertures* |
||||
|
G04 Four groups of circular apertures are arranged in a square* |
||||
|
G04 Handcoded by Julian Lamb * |
||||
|
%MOIN*% |
||||
|
%FSLAX23Y23*% |
||||
|
%ADD10C,0.050*% |
||||
|
%ADD11C,0.050X0.025*% |
||||
|
%ADD12C,0.050X0.025X0.030*% |
||||
|
|
||||
|
G04 No hole, centered at 0,0 * |
||||
|
G54D10* |
||||
|
X0Y0D03* |
||||
|
|
||||
|
G04 Round hole, centered at 0.1,0 * |
||||
|
G54D11* |
||||
|
X00100Y0D03* |
||||
|
|
||||
|
G04 Square hole, centered at 0,0.1 * |
||||
|
G54D12* |
||||
|
X0Y00100D03* |
||||
|
|
||||
|
G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * |
||||
|
G54D11* |
||||
|
X00100Y00090D03* |
||||
|
X00100Y00110D03* |
||||
|
|
||||
|
M02* |
@ -0,0 +1,27 @@ |
|||||
|
G04 Test flashing of obround apertures* |
||||
|
G04 Four groups of obround apertures are arranged in a square* |
||||
|
G04 Handcoded by Julian Lamb * |
||||
|
%MOIN*% |
||||
|
%FSLAX23Y23*% |
||||
|
%ADD10O,0.050X0.080*% |
||||
|
%ADD11O,0.080X0.050X0.025*% |
||||
|
%ADD12O,0.050X0.025X0.025X0.0150*% |
||||
|
|
||||
|
G04 No hole, centered at 0,0 * |
||||
|
G54D10* |
||||
|
X0Y0D03* |
||||
|
|
||||
|
G04 Round hole, centered at 0.1,0 * |
||||
|
G54D11* |
||||
|
X00100Y0D03* |
||||
|
|
||||
|
G04 Square hole, centered at 0,0.1 * |
||||
|
G54D12* |
||||
|
X0Y00100D03* |
||||
|
|
||||
|
G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * |
||||
|
G54D11* |
||||
|
X00100Y00090D03* |
||||
|
X00100Y00110D03* |
||||
|
|
||||
|
M02* |
@ -0,0 +1,27 @@ |
|||||
|
G04 Test flashing of polygon apertures* |
||||
|
G04 Four groups of polygon apertures are arranged in a square* |
||||
|
G04 Handcoded by Julian Lamb * |
||||
|
%MOIN*% |
||||
|
%FSLAX23Y23*% |
||||
|
%ADD10P,0.050X3*% |
||||
|
%ADD11P,0.050X6X-45X0.035*% |
||||
|
%ADD12P,0.040X10X25X0.025X0.025X0.0150*% |
||||
|
|
||||
|
G04 Triangle, centered at 0,0 * |
||||
|
G54D10* |
||||
|
X0Y0D03* |
||||
|
|
||||
|
G04 Hexagon with round hole rotate 45 degreed ccwise, centered at 0.1,0 * |
||||
|
G54D11* |
||||
|
X00100Y0D03* |
||||
|
|
||||
|
G04 10-sided with square hole rotated 25 degrees, centered at 0,0.1 * |
||||
|
G54D12* |
||||
|
X0Y00100D03* |
||||
|
|
||||
|
G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * |
||||
|
G54D11* |
||||
|
X00100Y00090D03* |
||||
|
X00100Y00110D03* |
||||
|
|
||||
|
M02* |
@ -0,0 +1,27 @@ |
|||||
|
G04 Test flashing of rectangular apertures* |
||||
|
G04 Four groups of rectangular apertures are arranged in a square* |
||||
|
G04 Handcoded by Julian Lamb * |
||||
|
%MOIN*% |
||||
|
%FSLAX23Y23*% |
||||
|
%ADD10R,0.050X0.080*% |
||||
|
%ADD11R,0.080X0.050X0.025*% |
||||
|
%ADD12R,0.050X0.025X0.025X0.0150*% |
||||
|
|
||||
|
G04 No hole, centered at 0,0 * |
||||
|
G54D10* |
||||
|
X0Y0D03* |
||||
|
|
||||
|
G04 Round hole, centered at 0.1,0 * |
||||
|
G54D11* |
||||
|
X00100Y0D03* |
||||
|
|
||||
|
G04 Square hole, centered at 0,0.1 * |
||||
|
G54D12* |
||||
|
X0Y00100D03* |
||||
|
|
||||
|
G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * |
||||
|
G54D11* |
||||
|
X00100Y00090D03* |
||||
|
X00100Y00110D03* |
||||
|
|
||||
|
M02* |
@ -1,37 +0,0 @@ |
|||||
/****************/ |
|
||||
/* lay2plot.cpp */ |
|
||||
/****************/ |
|
||||
|
|
||||
#include "fctsys.h"
|
|
||||
#include "common.h"
|
|
||||
#include "class_drawpanel.h"
|
|
||||
|
|
||||
#include "gerbview.h"
|
|
||||
#include "protos.h"
|
|
||||
|
|
||||
|
|
||||
/* Routine to plot the pcb, by selected layers. */ |
|
||||
void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer) |
|
||||
{ |
|
||||
DISPLAY_OPTIONS save_opt; |
|
||||
TRACK * pt_piste; |
|
||||
|
|
||||
save_opt = DisplayOpt; |
|
||||
DisplayOpt.DisplayPadFill = FILLED; |
|
||||
DisplayOpt.DisplayViaFill = FILLED; |
|
||||
DisplayOpt.DisplayPadNum = 0; |
|
||||
DisplayOpt.DisplayPadIsol = 0; |
|
||||
DisplayOpt.DisplayPcbTrackFill = FILLED; |
|
||||
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; |
|
||||
DisplayOpt.DisplayDrawItems = FILLED; |
|
||||
DisplayOpt.DisplayZonesMode = 0; |
|
||||
|
|
||||
pt_piste = Pcb->m_Track; |
|
||||
for( ; pt_piste != NULL ; pt_piste = pt_piste->Next() ) |
|
||||
{ |
|
||||
// if( (printmasklayer & ReturnMaskLayer(pt_piste) ) == 0 ) continue;
|
|
||||
Trace_Segment(Pcb, NULL, DC, pt_piste, drawmode); |
|
||||
} |
|
||||
|
|
||||
DisplayOpt = save_opt; |
|
||||
} |
|
@ -1,15 +1,4 @@ |
|||||
/* declarations prototype */ |
/* declarations prototype */ |
||||
|
|
||||
int* InstallDialogLayerPairChoice( WinEDA_GerberFrame* parent ); |
int* InstallDialogLayerPairChoice( WinEDA_GerberFrame* parent ); |
||||
|
|
||||
bool Read_Config(); |
bool Read_Config(); |
||||
|
|
||||
void Print_PcbItems( BOARD* Pcb, wxDC* DC, int drawmode, int printmasklayer ); |
|
||||
|
|
||||
void DisplayColorSetupFrame( WinEDA_GerberFrame* parent, const wxPoint& framepos ); |
|
||||
void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, |
|
||||
wxDC* DC, |
|
||||
TRACK* pt_piste, |
|
||||
int draw_mode ); |
|
||||
|
|
||||
|
|
948
gerbview/rs274d.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue