2007-08-06 02:02:39 +00:00
|
|
|
/****************************************************/
|
2009-11-12 15:43:38 +00:00
|
|
|
/* class_module.cpp : MODULE class implementation. */
|
2007-08-06 02:02:39 +00:00
|
|
|
/****************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "wxstruct.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "trigo.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
#include "pcbcommon.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
|
|
|
#include "pcbnew.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2010-01-29 20:36:12 +00:00
|
|
|
#include "colors_selection.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "drag.h"
|
|
|
|
|
|
|
|
#include "3d_struct.h"
|
|
|
|
#include "protos.h"
|
2011-01-14 17:43:30 +00:00
|
|
|
#include "richio.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/*********************************************/
|
|
|
|
/* Class MODULE : describes a pcb component. */
|
|
|
|
/*********************************************/
|
2008-02-19 00:30:10 +00:00
|
|
|
MODULE::MODULE( BOARD* parent ) :
|
2008-12-04 04:28:11 +00:00
|
|
|
BOARD_ITEM( parent, TYPE_MODULE )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-06 02:02:39 +00:00
|
|
|
m_Attributs = MOD_DEFAULT;
|
2009-12-07 03:46:13 +00:00
|
|
|
m_Layer = LAYER_N_FRONT;
|
2007-08-06 02:02:39 +00:00
|
|
|
m_Orient = 0;
|
|
|
|
m_ModuleStatus = 0;
|
|
|
|
flag = 0;
|
|
|
|
m_CntRot90 = m_CntRot180 = 0;
|
2010-07-11 16:24:44 +00:00
|
|
|
m_Surface = 0.0;
|
2009-11-04 19:08:08 +00:00
|
|
|
m_Link = 0;
|
2010-07-20 10:30:40 +00:00
|
|
|
m_LastEdit_Time = time( NULL );
|
2009-11-04 19:08:08 +00:00
|
|
|
m_LocalClearance = 0;
|
|
|
|
m_LocalSolderMaskMargin = 0;
|
|
|
|
m_LocalSolderPasteMargin = 0;
|
|
|
|
m_LocalSolderPasteMarginRatio = 0.0;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
m_Value = new TEXTE_MODULE( this, TEXT_is_VALUE );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-08-04 18:21:32 +00:00
|
|
|
// Reserve one void 3D entry, to avoid problems with void list
|
|
|
|
m_3D_Drawings.PushBack( new S3D_MASTER( this ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
MODULE::~MODULE()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-06 02:02:39 +00:00
|
|
|
delete m_Reference;
|
|
|
|
delete m_Value;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Draw the anchor cross (vertical)
|
|
|
|
* Must be done after the pads, because drawing the hole will erase overwrite
|
|
|
|
* every thing already drawn.
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
2009-08-01 19:26:05 +00:00
|
|
|
int dim_ancre, int draw_mode )
|
|
|
|
{
|
2010-02-08 18:15:42 +00:00
|
|
|
#ifdef USE_WX_ZOOM
|
|
|
|
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
|
|
|
|
#else
|
2009-08-01 19:26:05 +00:00
|
|
|
int anchor_size = panel->GetScreen()->Unscale( dim_ancre );
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2009-08-01 19:26:05 +00:00
|
|
|
|
|
|
|
GRSetDrawMode( DC, draw_mode );
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2010-07-20 10:30:40 +00:00
|
|
|
int color = g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE );
|
2009-08-01 19:26:05 +00:00
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
2009-11-04 19:08:08 +00:00
|
|
|
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
|
|
|
|
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
|
2010-01-29 20:36:12 +00:00
|
|
|
0, color );
|
2009-08-01 19:26:05 +00:00
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
2009-11-04 19:08:08 +00:00
|
|
|
m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size,
|
|
|
|
m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size,
|
2010-01-29 20:36:12 +00:00
|
|
|
0, color );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2008-12-06 08:21:54 +00:00
|
|
|
void MODULE::Copy( MODULE* aModule )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-06 08:21:54 +00:00
|
|
|
m_Pos = aModule->m_Pos;
|
|
|
|
m_Layer = aModule->m_Layer;
|
|
|
|
m_LibRef = aModule->m_LibRef;
|
|
|
|
m_Attributs = aModule->m_Attributs;
|
|
|
|
m_Orient = aModule->m_Orient;
|
|
|
|
m_BoundaryBox = aModule->m_BoundaryBox;
|
|
|
|
m_PadNum = aModule->m_PadNum;
|
|
|
|
m_CntRot90 = aModule->m_CntRot90;
|
|
|
|
m_CntRot180 = aModule->m_CntRot180;
|
|
|
|
m_LastEdit_Time = aModule->m_LastEdit_Time;
|
2010-06-14 20:16:47 +00:00
|
|
|
m_Link = aModule->m_Link;
|
2008-12-06 08:21:54 +00:00
|
|
|
m_Path = aModule->m_Path; //is this correct behavior?
|
2007-08-06 02:02:39 +00:00
|
|
|
m_TimeStamp = GetTimeStamp();
|
2009-11-04 19:08:08 +00:00
|
|
|
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
|
|
|
|
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
|
|
|
|
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Copy reference and value. */
|
2008-12-06 08:21:54 +00:00
|
|
|
m_Reference->Copy( aModule->m_Reference );
|
|
|
|
m_Value->Copy( aModule->m_Value );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
/* Copy auxiliary data: Pads */
|
|
|
|
m_Pads.DeleteAll();
|
2008-12-06 08:21:54 +00:00
|
|
|
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
D_PAD* newpad = new D_PAD( this );
|
|
|
|
newpad->Copy( pad );
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
m_Pads.PushBack( newpad );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
/* Copy auxiliary data: Drawings */
|
|
|
|
m_Drawings.DeleteAll();
|
2008-12-06 08:21:54 +00:00
|
|
|
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
switch( item->Type() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2009-11-04 19:08:08 +00:00
|
|
|
TEXTE_MODULE * textm;
|
2008-12-04 04:28:11 +00:00
|
|
|
textm = new TEXTE_MODULE( this );
|
|
|
|
textm->Copy( (TEXTE_MODULE*) item );
|
|
|
|
m_Drawings.PushBack( textm );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2009-11-04 19:08:08 +00:00
|
|
|
EDGE_MODULE * edge;
|
2008-12-04 04:28:11 +00:00
|
|
|
edge = new EDGE_MODULE( this );
|
|
|
|
edge->Copy( (EDGE_MODULE*) item );
|
|
|
|
m_Drawings.PushBack( edge );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-08-03 18:54:48 +00:00
|
|
|
wxMessageBox( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Copy auxiliary data: 3D_Drawings info */
|
2009-08-04 18:21:32 +00:00
|
|
|
m_3D_Drawings.DeleteAll();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-08-04 18:21:32 +00:00
|
|
|
// Ensure there is one (or more) item in m_3D_Drawings
|
2009-11-12 15:43:38 +00:00
|
|
|
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
|
2008-12-06 08:21:54 +00:00
|
|
|
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
2009-04-15 07:20:30 +00:00
|
|
|
continue;
|
2009-04-15 06:32:15 +00:00
|
|
|
S3D_MASTER* t3d = m_3D_Drawings;
|
2010-07-20 10:30:40 +00:00
|
|
|
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
|
|
|
// exist, but is empty :
|
|
|
|
// use it.
|
2009-04-15 06:32:15 +00:00
|
|
|
t3d->Copy( item );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t3d = new S3D_MASTER( this );
|
|
|
|
t3d->Copy( item );
|
|
|
|
m_3D_Drawings.PushBack( t3d );
|
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 08:21:54 +00:00
|
|
|
m_Doc = aModule->m_Doc;
|
|
|
|
m_KeyWord = aModule->m_KeyWord;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
2008-03-13 21:18:05 +00:00
|
|
|
* Draws the footprint to the current Device Context
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aPanel = draw panel, Used to know the clip box
|
|
|
|
* @param aDC = Current Device Context
|
|
|
|
* @param aDrawMode = GR_OR, GR_XOR..
|
|
|
|
* @param aOffset = draw offset (usually wxPoint(0,0)
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-10-09 08:08:29 +00:00
|
|
|
if( (m_Flags & DO_NOT_DRAW) || (m_Flags & IS_MOVED) )
|
2008-03-15 10:24:32 +00:00
|
|
|
return;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
if( pad->m_Flags & IS_MOVED )
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-12-29 17:47:32 +00:00
|
|
|
pad->Draw( aPanel, aDC, aDrawMode, aOffset );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
BOARD* brd = GetBoard();
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
// Draws footprint anchor
|
2010-12-29 17:47:32 +00:00
|
|
|
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-03-13 21:18:05 +00:00
|
|
|
/* Draw graphic items */
|
2010-01-31 20:01:46 +00:00
|
|
|
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
|
2010-01-28 13:10:46 +00:00
|
|
|
{
|
|
|
|
if( !(m_Reference->m_Flags & IS_MOVED) )
|
2010-12-29 17:47:32 +00:00
|
|
|
m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset );
|
2010-01-28 13:10:46 +00:00
|
|
|
}
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
if( brd->IsElementVisible( MOD_VALUES_VISIBLE ) )
|
2010-01-28 13:10:46 +00:00
|
|
|
{
|
|
|
|
if( !(m_Value->m_Flags & IS_MOVED) )
|
2010-12-29 17:47:32 +00:00
|
|
|
m_Value->Draw( aPanel, aDC, aDrawMode, aOffset );
|
2010-01-28 13:10:46 +00:00
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
if( item->m_Flags & IS_MOVED )
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
switch( item->Type() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
|
|
|
case TYPE_EDGE_MODULE:
|
2010-12-29 17:47:32 +00:00
|
|
|
item->Draw( aPanel, aDC, aDrawMode, aOffset );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function DrawEdgesOnly
|
2008-03-13 21:18:05 +00:00
|
|
|
* Draws the footprint edges only to the current Device Context
|
|
|
|
* @param panel = The active Draw Panel (used to know the clip box)
|
|
|
|
* @param DC = current Device Context
|
|
|
|
* @param offset = draw offset (usually wxPoint(0,0)
|
|
|
|
* @param draw_mode = GR_OR, GR_XOR, GR_AND
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void MODULE::DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int draw_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
switch( item->Type() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2008-04-01 05:21:50 +00:00
|
|
|
item->Draw( panel, DC, draw_mode, offset );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
bool MODULE::Save( FILE* aFile ) const
|
|
|
|
{
|
2008-03-15 10:24:32 +00:00
|
|
|
char statusTxt[8];
|
|
|
|
BOARD_ITEM* item;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
if( GetState( DELETED ) )
|
|
|
|
return true;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
bool rc = false;
|
|
|
|
|
|
|
|
fprintf( aFile, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
|
|
|
|
|
|
|
|
memset( statusTxt, 0, sizeof(statusTxt) );
|
|
|
|
if( IsLocked() )
|
|
|
|
statusTxt[0] = 'F';
|
|
|
|
else
|
|
|
|
statusTxt[0] = '~';
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
if( m_ModuleStatus & MODULE_is_PLACED )
|
|
|
|
statusTxt[1] = 'P';
|
|
|
|
else
|
|
|
|
statusTxt[1] = '~';
|
|
|
|
|
|
|
|
fprintf( aFile, "Po %d %d %d %d %8.8lX %8.8lX %s\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
m_Pos.x, m_Pos.y,
|
|
|
|
m_Orient, m_Layer, m_LastEdit_Time,
|
|
|
|
m_TimeStamp, statusTxt );
|
2007-10-30 21:30:58 +00:00
|
|
|
|
|
|
|
fprintf( aFile, "Li %s\n", CONV_TO_UTF8( m_LibRef ) );
|
|
|
|
|
|
|
|
if( !m_Doc.IsEmpty() )
|
|
|
|
{
|
|
|
|
fprintf( aFile, "Cd %s\n", CONV_TO_UTF8( m_Doc ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !m_KeyWord.IsEmpty() )
|
|
|
|
{
|
|
|
|
fprintf( aFile, "Kw %s\n", CONV_TO_UTF8( m_KeyWord ) );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
|
2008-03-15 10:24:32 +00:00
|
|
|
fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) );
|
2007-10-30 21:30:58 +00:00
|
|
|
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
2009-11-04 19:08:08 +00:00
|
|
|
if( m_LocalSolderMaskMargin != 0 )
|
2010-07-20 10:30:40 +00:00
|
|
|
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
2009-11-04 19:08:08 +00:00
|
|
|
if( m_LocalSolderPasteMargin != 0 )
|
2010-07-20 10:30:40 +00:00
|
|
|
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
|
|
|
if( m_LocalSolderPasteMarginRatio != 0 )
|
|
|
|
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
2009-11-06 12:55:20 +00:00
|
|
|
if( m_LocalClearance != 0 )
|
2010-07-20 10:30:40 +00:00
|
|
|
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
2007-10-30 21:30:58 +00:00
|
|
|
|
|
|
|
// attributes
|
|
|
|
if( m_Attributs != MOD_DEFAULT )
|
|
|
|
{
|
|
|
|
fprintf( aFile, "At " );
|
|
|
|
if( m_Attributs & MOD_CMS )
|
|
|
|
fprintf( aFile, "SMD " );
|
|
|
|
if( m_Attributs & MOD_VIRTUAL )
|
|
|
|
fprintf( aFile, "VIRTUAL " );
|
|
|
|
fprintf( aFile, "\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// save reference
|
|
|
|
if( !m_Reference->Save( aFile ) )
|
|
|
|
goto out;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
// save value
|
|
|
|
if( !m_Value->Save( aFile ) )
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
// save drawing elements
|
2008-03-15 10:24:32 +00:00
|
|
|
for( item = m_Drawings; item; item = item->Next() )
|
2007-10-30 21:30:58 +00:00
|
|
|
{
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
|
|
|
case TYPE_EDGE_MODULE:
|
2007-10-30 21:30:58 +00:00
|
|
|
if( !item->Save( aFile ) )
|
|
|
|
goto out;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-11-04 19:08:08 +00:00
|
|
|
#if defined(DEBUG)
|
2007-10-30 21:30:58 +00:00
|
|
|
printf( "MODULE::Save() ignoring type %d\n", item->Type() );
|
2008-02-19 00:30:10 +00:00
|
|
|
#endif
|
2007-10-30 21:30:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// save the pads
|
2008-03-15 10:24:32 +00:00
|
|
|
for( item = m_Pads; item; item = item->Next() )
|
2007-10-30 21:30:58 +00:00
|
|
|
if( !item->Save( aFile ) )
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
Write_3D_Descr( aFile );
|
|
|
|
|
|
|
|
fprintf( aFile, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
rc = true;
|
2008-02-19 00:30:10 +00:00
|
|
|
out:
|
2007-10-30 21:30:58 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Save the description of 3D MODULE
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
int MODULE::Write_3D_Descr( FILE* File ) const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-04 19:08:08 +00:00
|
|
|
char buf[512];
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-06 21:20:50 +00:00
|
|
|
if( !t3D->m_Shape3DName.IsEmpty() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
fprintf( File, "$SHAPE3D\n" );
|
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
fprintf( File, "Na \"%s\"\n", CONV_TO_UTF8( t3D->m_Shape3DName ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
sprintf( buf, "Sc %lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
t3D->m_MatScale.x,
|
|
|
|
t3D->m_MatScale.y,
|
|
|
|
t3D->m_MatScale.z );
|
2009-10-05 04:22:27 +00:00
|
|
|
fprintf( File, "%s", to_point( buf ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
sprintf( buf, "Of %lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
t3D->m_MatPosition.x,
|
|
|
|
t3D->m_MatPosition.y,
|
|
|
|
t3D->m_MatPosition.z );
|
2009-10-05 04:22:27 +00:00
|
|
|
fprintf( File, "%s", to_point( buf ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
sprintf( buf, "Ro %lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
t3D->m_MatRotation.x,
|
|
|
|
t3D->m_MatRotation.y,
|
|
|
|
t3D->m_MatRotation.z );
|
2009-10-05 04:22:27 +00:00
|
|
|
fprintf( File, "%s", to_point( buf ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
fprintf( File, "$EndSHAPE3D\n" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Read 3D module from file. (Ascii)
|
|
|
|
* The 1st line of descr ($MODULE) is assumed to be already read
|
|
|
|
* Returns 0 if OK
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2011-01-14 17:43:30 +00:00
|
|
|
int MODULE::Read_3D_Descr( LINE_READER* aReader )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
char* Line = aReader->Line();
|
2009-11-04 19:08:08 +00:00
|
|
|
char* text = Line + 3;
|
2008-12-06 08:21:54 +00:00
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
S3D_MASTER* t3D = m_3D_Drawings;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
if( !t3D->m_Shape3DName.IsEmpty() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-12-06 08:21:54 +00:00
|
|
|
S3D_MASTER* n3D = new S3D_MASTER( this );
|
|
|
|
|
|
|
|
m_3D_Drawings.PushBack( n3D );
|
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
t3D = n3D;
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 17:43:30 +00:00
|
|
|
while( aReader->ReadLine() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
Line = aReader->Line();
|
2007-08-06 02:02:39 +00:00
|
|
|
switch( Line[0] )
|
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
case '$':
|
2007-08-06 02:02:39 +00:00
|
|
|
if( Line[1] == 'E' )
|
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case 'N': // Shape File Name
|
|
|
|
{
|
|
|
|
char buf[512];
|
|
|
|
ReadDelimitedText( buf, text, 512 );
|
2008-12-06 21:20:50 +00:00
|
|
|
t3D->m_Shape3DName = CONV_FROM_UTF8( buf );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'S': // Scale
|
|
|
|
sscanf( text, "%lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
&t3D->m_MatScale.x,
|
|
|
|
&t3D->m_MatScale.y,
|
|
|
|
&t3D->m_MatScale.z );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'O': // Offset
|
|
|
|
sscanf( text, "%lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
&t3D->m_MatPosition.x,
|
|
|
|
&t3D->m_MatPosition.y,
|
|
|
|
&t3D->m_MatPosition.z );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'R': // Rotation
|
|
|
|
sscanf( text, "%lf %lf %lf\n",
|
2009-11-04 19:08:08 +00:00
|
|
|
&t3D->m_MatRotation.x,
|
|
|
|
&t3D->m_MatRotation.y,
|
|
|
|
&t3D->m_MatRotation.z );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
/* Read a MODULE description
|
|
|
|
* The first description line ($MODULE) is already read
|
|
|
|
* @return 0 if no error
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2011-01-14 17:43:30 +00:00
|
|
|
int MODULE::ReadDescr( LINE_READER* aReader )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
char* Line;
|
|
|
|
char BufLine[256], BufCar1[128], * PtLine;
|
|
|
|
int itmp1, itmp2;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2011-01-14 17:43:30 +00:00
|
|
|
while( aReader->ReadLine() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
Line = aReader->Line();
|
2007-08-06 02:02:39 +00:00
|
|
|
if( Line[0] == '$' )
|
|
|
|
{
|
|
|
|
if( Line[1] == 'E' )
|
|
|
|
break;
|
|
|
|
if( Line[1] == 'P' )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
D_PAD* pad = new D_PAD( this );
|
2011-01-14 17:43:30 +00:00
|
|
|
pad->ReadDescr( aReader );
|
2010-07-20 10:30:40 +00:00
|
|
|
RotatePoint( &pad->m_Pos, m_Orient );
|
2008-12-04 04:28:11 +00:00
|
|
|
pad->m_Pos.x += m_Pos.x;
|
|
|
|
pad->m_Pos.y += m_Pos.y;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
m_Pads.PushBack( pad );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if( Line[1] == 'S' )
|
2011-01-14 17:43:30 +00:00
|
|
|
Read_3D_Descr( aReader );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( strlen( Line ) < 4 )
|
|
|
|
continue;
|
2007-08-06 20:26:59 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
PtLine = Line + 3;
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Decode the first code of the current line and read the
|
|
|
|
* corresponding data
|
2010-07-20 10:30:40 +00:00
|
|
|
*/
|
2007-08-06 02:02:39 +00:00
|
|
|
switch( Line[0] )
|
|
|
|
{
|
|
|
|
case 'P':
|
|
|
|
memset( BufCar1, 0, sizeof(BufCar1) );
|
|
|
|
sscanf( PtLine, "%d %d %d %d %lX %lX %s",
|
2009-11-04 19:08:08 +00:00
|
|
|
&m_Pos.x, &m_Pos.y,
|
|
|
|
&m_Orient, &m_Layer,
|
|
|
|
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
m_ModuleStatus = 0;
|
|
|
|
if( BufCar1[0] == 'F' )
|
2008-03-15 10:24:32 +00:00
|
|
|
SetLocked( true );
|
2007-08-06 02:02:39 +00:00
|
|
|
if( BufCar1[1] == 'P' )
|
|
|
|
m_ModuleStatus |= MODULE_is_PLACED;
|
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case 'L': /* Li = read the library name of the footprint */
|
2007-08-06 02:02:39 +00:00
|
|
|
*BufLine = 0;
|
|
|
|
sscanf( PtLine, " %s", BufLine );
|
|
|
|
m_LibRef = CONV_FROM_UTF8( BufLine );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
sscanf( PtLine, " %lX", &m_TimeStamp );
|
|
|
|
break;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case 'O': /* (Op)tions for auto placement */
|
2007-08-06 02:02:39 +00:00
|
|
|
itmp1 = itmp2 = 0;
|
|
|
|
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
|
|
|
|
|
|
|
|
m_CntRot180 = itmp2 & 0x0F;
|
|
|
|
if( m_CntRot180 > 10 )
|
|
|
|
m_CntRot180 = 10;
|
|
|
|
|
|
|
|
m_CntRot90 = itmp1 & 0x0F;
|
|
|
|
if( m_CntRot90 > 10 )
|
|
|
|
m_CntRot90 = 0;
|
|
|
|
itmp1 = (itmp1 >> 4) & 0x0F;
|
|
|
|
if( itmp1 > 10 )
|
|
|
|
itmp1 = 0;
|
|
|
|
m_CntRot90 |= itmp1 << 4;
|
|
|
|
break;
|
|
|
|
|
2008-02-19 00:30:10 +00:00
|
|
|
case 'A':
|
2008-03-15 10:24:32 +00:00
|
|
|
if( Line[1] == 't' )
|
|
|
|
{
|
2009-11-04 19:08:08 +00:00
|
|
|
/* At = (At)tributes of module */
|
2008-02-19 00:30:10 +00:00
|
|
|
if( strstr( PtLine, "SMD" ) )
|
|
|
|
m_Attributs |= MOD_CMS;
|
|
|
|
if( strstr( PtLine, "VIRTUAL" ) )
|
|
|
|
m_Attributs |= MOD_VIRTUAL;
|
|
|
|
}
|
2008-03-15 10:24:32 +00:00
|
|
|
if( Line[1] == 'R' )
|
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
// alternate reference, e.g. /478C2408/478AD1B6
|
2008-02-19 00:30:10 +00:00
|
|
|
sscanf( PtLine, " %s", BufLine );
|
2008-03-15 10:24:32 +00:00
|
|
|
m_Path = CONV_FROM_UTF8( BufLine );
|
2008-02-19 00:30:10 +00:00
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
case 'T': /* Read a footprint text description (ref, value, or
|
|
|
|
* drawing */
|
2009-11-04 19:08:08 +00:00
|
|
|
TEXTE_MODULE * textm;
|
2007-08-06 02:02:39 +00:00
|
|
|
sscanf( Line + 1, "%d", &itmp1 );
|
|
|
|
if( itmp1 == TEXT_is_REFERENCE )
|
2008-12-04 04:28:11 +00:00
|
|
|
textm = m_Reference;
|
2007-08-06 02:02:39 +00:00
|
|
|
else if( itmp1 == TEXT_is_VALUE )
|
2008-12-04 04:28:11 +00:00
|
|
|
textm = m_Value;
|
2007-08-06 02:02:39 +00:00
|
|
|
else /* text is a drawing */
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
textm = new TEXTE_MODULE( this );
|
|
|
|
m_Drawings.PushBack( textm );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
2011-01-14 17:43:30 +00:00
|
|
|
textm->ReadDescr( aReader );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case 'D': /* read a drawing item */
|
|
|
|
EDGE_MODULE * edge;
|
2008-12-04 04:28:11 +00:00
|
|
|
edge = new EDGE_MODULE( this );
|
|
|
|
m_Drawings.PushBack( edge );
|
2011-01-14 17:43:30 +00:00
|
|
|
edge->ReadDescr( aReader );
|
2008-12-04 04:28:11 +00:00
|
|
|
edge->SetDrawCoord();
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case 'C': /* read documentation data */
|
2007-08-06 02:02:39 +00:00
|
|
|
m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) );
|
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case 'K': /* Read key words */
|
2007-08-06 02:02:39 +00:00
|
|
|
m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) );
|
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
case '.': /* Read specific data */
|
2010-07-20 10:30:40 +00:00
|
|
|
if( strnicmp( Line, ".SolderMask ", 12 ) == 0 )
|
|
|
|
m_LocalSolderMaskMargin = atoi( Line + 12 );
|
|
|
|
else if( strnicmp( Line, ".SolderPaste ", 13 ) == 0 )
|
|
|
|
m_LocalSolderPasteMargin = atoi( Line + 13 );
|
|
|
|
else if( strnicmp( Line, ".SolderPasteRatio ", 18 ) == 0 )
|
|
|
|
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
|
|
|
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
|
|
|
m_LocalClearance = atoi( Line + 16 );
|
|
|
|
break;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2008-03-10 08:14:20 +00:00
|
|
|
/* Recalculate the bounding box */
|
2007-08-06 02:02:39 +00:00
|
|
|
Set_Rectangle_Encadrement();
|
|
|
|
return 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Update the bounding rectangle of the module
|
|
|
|
*
|
2010-04-17 16:30:25 +00:00
|
|
|
* The bounding box includes outlines and pads, but not the fields.
|
|
|
|
* The rectangle is:
|
|
|
|
* for orientation 0
|
|
|
|
* coordinates relative to the module anchor.
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
void MODULE::Set_Rectangle_Encadrement()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-04 19:08:08 +00:00
|
|
|
int width;
|
|
|
|
int cx, cy, uxf, uyf, rayon;
|
|
|
|
int xmax, ymax;
|
2010-07-11 16:24:44 +00:00
|
|
|
int xmin, ymin;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Initial coordinates of the module has a nonzero limit value. */
|
2010-07-11 16:24:44 +00:00
|
|
|
xmin = ymin = -250;
|
|
|
|
xmax = ymax = 250;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst();
|
|
|
|
edge; edge = edge->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2010-07-20 10:30:40 +00:00
|
|
|
if( edge->Type() != TYPE_EDGE_MODULE )
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
width = edge->m_Width / 2;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
switch( edge->m_Shape )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
case S_ARC:
|
|
|
|
case S_CIRCLE:
|
|
|
|
{
|
2010-07-20 10:30:40 +00:00
|
|
|
cx = edge->m_Start0.x;
|
|
|
|
cy = edge->m_Start0.y; // center
|
|
|
|
uxf = edge->m_End0.x;
|
|
|
|
uyf = edge->m_End0.y;
|
|
|
|
rayon = (int) hypot( (double) ( cx - uxf ), (double) ( cy - uyf ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
rayon += width;
|
2010-07-20 10:30:40 +00:00
|
|
|
xmin = MIN( xmin, cx - rayon );
|
|
|
|
ymin = MIN( ymin, cy - rayon );
|
|
|
|
xmax = MAX( xmax, cx + rayon );
|
|
|
|
ymax = MAX( ymax, cy + rayon );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
case S_SEGMENT:
|
2010-07-20 10:30:40 +00:00
|
|
|
xmin = MIN( xmin, edge->m_Start0.x - width );
|
|
|
|
xmin = MIN( xmin, edge->m_End0.x - width );
|
|
|
|
ymin = MIN( ymin, edge->m_Start0.y - width );
|
|
|
|
ymin = MIN( ymin, edge->m_End0.y - width );
|
|
|
|
xmax = MAX( xmax, edge->m_Start0.x + width );
|
|
|
|
xmax = MAX( xmax, edge->m_End0.x + width );
|
|
|
|
ymax = MAX( ymax, edge->m_Start0.y + width );
|
|
|
|
ymax = MAX( ymax, edge->m_End0.y + width );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
2010-07-11 16:24:44 +00:00
|
|
|
|
|
|
|
case S_POLYGON:
|
2010-07-20 10:30:40 +00:00
|
|
|
for( unsigned ii = 0; ii < edge->m_PolyPoints.size(); ii++ )
|
2010-07-11 16:24:44 +00:00
|
|
|
{
|
2010-07-20 10:30:40 +00:00
|
|
|
wxPoint pt = edge->m_PolyPoints[ii];
|
2010-07-11 16:24:44 +00:00
|
|
|
xmin = MIN( xmin, (pt.x - width) );
|
|
|
|
ymin = MIN( ymin, (pt.y - width) );
|
2010-07-20 10:30:40 +00:00
|
|
|
xmax = MAX( xmax, (pt.x + width) );
|
|
|
|
ymax = MAX( ymax, (pt.y + width) );
|
2010-07-11 16:24:44 +00:00
|
|
|
}
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
break;
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
/* Pads: find the min and max coordinates and update the bounding box.
|
2009-11-12 15:43:38 +00:00
|
|
|
*/
|
2008-11-24 06:53:43 +00:00
|
|
|
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2010-09-18 17:55:08 +00:00
|
|
|
rayon = pad->m_ShapeMaxRadius;
|
2009-11-12 15:43:38 +00:00
|
|
|
cx = pad->m_Pos0.x;
|
|
|
|
cy = pad->m_Pos0.y;
|
2010-07-20 10:30:40 +00:00
|
|
|
xmin = MIN( xmin, cx - rayon );
|
|
|
|
ymin = MIN( ymin, cy - rayon );
|
|
|
|
xmax = MAX( xmax, cx + rayon );
|
|
|
|
ymax = MAX( ymax, cy + rayon );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
m_BoundaryBox.m_Pos.x = xmin;
|
|
|
|
m_BoundaryBox.m_Pos.y = ymin;
|
|
|
|
m_BoundaryBox.SetWidth( xmax - xmin );
|
|
|
|
m_BoundaryBox.SetHeight( ymax - ymin );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect MODULE::GetFootPrintRect() const
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect area;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
area.m_Pos = m_Pos;
|
|
|
|
area.SetEnd( m_Pos );
|
|
|
|
area.Inflate( 500 ); // Give a min size
|
|
|
|
|
|
|
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2010-07-11 16:24:44 +00:00
|
|
|
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
area.Merge( edge->GetBoundingBox() );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
area.Merge( pad->GetBoundingBox() );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
return area;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Equivalent to Module::Set_Rectangle_Encadrement() but in board coordinates:
|
|
|
|
* Updates the module bounding box on the board
|
|
|
|
* The rectangle is the rectangle with outlines and pads, but not the fields
|
|
|
|
* Also updates the surface (.M_Surface) module.
|
|
|
|
*/
|
|
|
|
void MODULE::SetRectangleExinscrit()
|
|
|
|
{
|
|
|
|
m_RealBoundaryBox = GetFootPrintRect();
|
|
|
|
|
|
|
|
m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth() * m_RealBoundaryBox.GetHeight() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-13 10:08:42 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
2010-04-17 16:30:25 +00:00
|
|
|
* returns the full bounding box of this Footprint, including fields
|
2009-11-12 15:43:38 +00:00
|
|
|
* Mainly used to redraw the screen area occupied by the footprint
|
2008-03-13 10:08:42 +00:00
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect MODULE::GetBoundingBox() const
|
2008-03-13 10:08:42 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect area = GetFootPrintRect();;
|
2008-03-15 10:24:32 +00:00
|
|
|
|
|
|
|
// Calculate extended area including text field:
|
2009-11-04 19:08:08 +00:00
|
|
|
EDA_Rect text_area;
|
2008-03-15 10:24:32 +00:00
|
|
|
text_area = m_Reference->GetBoundingBox();
|
|
|
|
area.Merge( text_area );
|
|
|
|
|
|
|
|
text_area = m_Value->GetBoundingBox();
|
|
|
|
area.Merge( text_area );
|
2008-03-13 21:18:05 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
|
2008-03-13 21:18:05 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( edge->Type() != TYPE_TEXTE_MODULE )
|
2008-03-15 10:24:32 +00:00
|
|
|
continue;
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
text_area = ( (TEXTE_MODULE*) edge )->GetBoundingBox();
|
2008-03-15 10:24:32 +00:00
|
|
|
area.Merge( text_area );
|
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
// Add the Clearance shape size: (shape around the pads when the
|
|
|
|
// clearance is shown. Not optimized, but the draw cost is small
|
|
|
|
// (perhaps smaller than optimization).
|
2009-10-21 19:16:25 +00:00
|
|
|
int biggest_clearance = GetBoard()->GetBiggestClearanceValue();
|
2009-11-04 19:08:08 +00:00
|
|
|
area.Inflate( biggest_clearance );
|
2008-03-18 11:53:52 +00:00
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
return area;
|
2008-03-13 10:08:42 +00:00
|
|
|
}
|
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
/* Virtual function, from EDA_ITEM.
|
2009-01-31 21:42:05 +00:00
|
|
|
* display module info on MsgPanel
|
2009-11-04 19:08:08 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-06 02:02:39 +00:00
|
|
|
int nbpad;
|
|
|
|
char bufcar[512], Line[512];
|
|
|
|
bool flag = FALSE;
|
|
|
|
wxString msg;
|
2010-01-31 20:01:46 +00:00
|
|
|
BOARD* board = GetBoard();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->EraseMsgBox();
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
if( frame->m_Ident != PCB_FRAME )
|
|
|
|
flag = TRUE;
|
2009-10-11 13:04:47 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-10-11 13:04:47 +00:00
|
|
|
if( flag ) // Display last date the component was edited( useful in Module Editor)
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-10-29 15:26:53 +00:00
|
|
|
time_t edit_time = m_LastEdit_Time;
|
|
|
|
strcpy( Line, ctime( &edit_time ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
strtok( Line, " \n\r" );
|
|
|
|
strcpy( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, " " );
|
|
|
|
strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, ", " );
|
|
|
|
strtok( NULL, " \n\r" );
|
|
|
|
strcat( bufcar, strtok( NULL, " \n\r" ) );
|
|
|
|
msg = CONV_FROM_UTF8( bufcar );
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
2009-11-12 15:43:38 +00:00
|
|
|
else // display time stamp in schematic
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
msg.Printf( wxT( "%8.8lX" ), m_TimeStamp );
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Netlist path" ), m_Path, BROWN );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), RED );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* PtStruct = m_Pads;
|
2007-08-06 02:02:39 +00:00
|
|
|
nbpad = 0;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
while( PtStruct )
|
|
|
|
{
|
2008-02-19 00:30:10 +00:00
|
|
|
nbpad++;
|
2008-11-24 06:53:43 +00:00
|
|
|
PtStruct = PtStruct->Next();
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
msg.Printf( wxT( "%d" ), nbpad );
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Pads" ), msg, BLUE );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
msg = wxT( ".." );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2007-09-09 02:27:56 +00:00
|
|
|
if( IsLocked() )
|
2007-09-21 10:38:50 +00:00
|
|
|
msg[0] = 'L';
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
if( m_ModuleStatus & MODULE_is_PLACED )
|
|
|
|
msg[1] = 'P';
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Stat" ), msg, MAGENTA );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Orient" ), msg, BROWN );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Module" ), m_LibRef, BLUE );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-08-04 18:21:32 +00:00
|
|
|
if( m_3D_Drawings != NULL )
|
|
|
|
msg = m_3D_Drawings->m_Shape3DName;
|
|
|
|
else
|
2009-11-04 19:08:08 +00:00
|
|
|
msg = _( "No 3D shape" );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
wxString doc = _( "Doc: " ) + m_Doc;
|
|
|
|
wxString keyword = _( "KeyW: " ) + m_KeyWord;
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( doc, keyword, BLACK );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
/**
|
|
|
|
* 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 MODULE::HitTest( const wxPoint& refPos )
|
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Calculation of the cursor coordinate relative to module */
|
2010-12-20 17:44:25 +00:00
|
|
|
wxPoint pos = refPos - m_Pos;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
RotatePoint( &pos, -m_Orient );
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Check if cursor is in the rectangle. */
|
2010-12-20 17:44:25 +00:00
|
|
|
if( m_BoundaryBox.Contains( pos ) )
|
2007-08-08 03:50:44 +00:00
|
|
|
return true;
|
2007-09-09 02:27:56 +00:00
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-06 12:43:57 +00:00
|
|
|
/**
|
2009-11-12 15:43:38 +00:00
|
|
|
* Function HitTest (overlaid)
|
2008-01-06 12:43:57 +00:00
|
|
|
* tests if the given EDA_Rect intersect the bounds of this object.
|
|
|
|
* @param refArea : the given EDA_Rect
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2008-03-15 10:24:32 +00:00
|
|
|
bool MODULE::HitTest( EDA_Rect& refArea )
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
|
|
|
bool is_out_of_box = false;
|
|
|
|
|
|
|
|
SetRectangleExinscrit();
|
|
|
|
|
|
|
|
if( m_RealBoundaryBox.m_Pos.x < refArea.GetX() )
|
|
|
|
is_out_of_box = true;
|
|
|
|
if( m_RealBoundaryBox.m_Pos.y < refArea.GetY() )
|
|
|
|
is_out_of_box = true;
|
|
|
|
if( m_RealBoundaryBox.GetRight() > refArea.GetRight() )
|
|
|
|
is_out_of_box = true;
|
|
|
|
if( m_RealBoundaryBox.GetBottom() > refArea.GetBottom() )
|
|
|
|
is_out_of_box = true;
|
|
|
|
|
|
|
|
return is_out_of_box ? false : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
|
|
|
{
|
|
|
|
wxString buf;
|
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
2008-03-04 04:22:27 +00:00
|
|
|
{
|
|
|
|
pad->ReturnStringPadName( buf );
|
|
|
|
#if 1
|
|
|
|
if( buf.CmpNoCase( aPadName ) == 0 ) // why case insensitive?
|
|
|
|
#else
|
|
|
|
if( buf == aPadName )
|
|
|
|
#endif
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-19 00:30:10 +00:00
|
|
|
// see class_module.h
|
|
|
|
SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
2008-03-15 10:24:32 +00:00
|
|
|
const KICAD_T scanTypes[] )
|
2007-08-09 21:15:08 +00:00
|
|
|
{
|
2008-03-15 10:24:32 +00:00
|
|
|
KICAD_T stype;
|
|
|
|
SEARCH_RESULT result = SEARCH_CONTINUE;
|
|
|
|
const KICAD_T* p = scanTypes;
|
|
|
|
bool done = false;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2008-03-15 10:24:32 +00:00
|
|
|
std::cout << GetClass().mb_str() << ' ';
|
2008-02-19 00:30:10 +00:00
|
|
|
#endif
|
2007-08-09 21:15:08 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
while( !done )
|
2007-08-09 21:15:08 +00:00
|
|
|
{
|
2007-08-24 03:40:04 +00:00
|
|
|
stype = *p;
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
switch( stype )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2007-08-09 21:15:08 +00:00
|
|
|
result = inspector->Inspect( this, testData ); // inspect me
|
2007-08-24 03:40:04 +00:00
|
|
|
++p;
|
2007-08-09 21:15:08 +00:00
|
|
|
break;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2007-08-24 03:40:04 +00:00
|
|
|
result = IterateForward( m_Pads, inspector, testData, p );
|
|
|
|
++p;
|
2007-08-09 21:15:08 +00:00
|
|
|
break;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-08-09 21:15:08 +00:00
|
|
|
result = inspector->Inspect( m_Reference, testData );
|
|
|
|
if( result == SEARCH_QUIT )
|
|
|
|
break;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
result = inspector->Inspect( m_Value, testData );
|
|
|
|
if( result == SEARCH_QUIT )
|
|
|
|
break;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// m_Drawings can hold TYPETEXTMODULE also, so fall thru
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-24 03:40:04 +00:00
|
|
|
result = IterateForward( m_Drawings, inspector, testData, p );
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
// skip over any types handled in the above call.
|
2008-03-15 10:24:32 +00:00
|
|
|
for( ; ; )
|
2007-08-24 03:40:04 +00:00
|
|
|
{
|
|
|
|
switch( stype = *++p )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-24 03:40:04 +00:00
|
|
|
continue;
|
2008-03-15 10:24:32 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2007-08-24 03:40:04 +00:00
|
|
|
}
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
break;
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
default:
|
2007-08-24 03:40:04 +00:00
|
|
|
done = true;
|
2007-08-09 21:15:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-09 21:15:08 +00:00
|
|
|
if( result == SEARCH_QUIT )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-19 00:30:10 +00:00
|
|
|
return result;
|
2007-08-09 21:15:08 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
#if defined(DEBUG)
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-02-19 00:30:10 +00:00
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-08-06 02:02:39 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
|
|
|
void MODULE::Show( int nestLevel, std::ostream& os )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
BOARD* board = GetBoard();
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
// for now, make it look like XML, expand on this later.
|
2007-08-07 06:21:19 +00:00
|
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
2008-03-15 10:24:32 +00:00
|
|
|
" ref=\"" << m_Reference->m_Text.mb_str() << '"' <<
|
|
|
|
" value=\"" << m_Value->m_Text.mb_str() << '"' <<
|
|
|
|
" layer=\"" << board->GetLayerName( m_Layer ).mb_str() << '"' <<
|
|
|
|
">\n";
|
2007-08-30 22:20:52 +00:00
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
NestedSpace( nestLevel + 1, os ) <<
|
|
|
|
"<boundingBox" << m_BoundaryBox.m_Pos << m_BoundaryBox.m_Size << "/>\n";
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
NestedSpace( nestLevel + 1, os ) << "<orientation tenths=\"" << m_Orient
|
|
|
|
<< "\"/>\n";
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* p;
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
NestedSpace( nestLevel + 1, os ) << "<mpads>\n";
|
2007-08-07 06:21:19 +00:00
|
|
|
p = m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; p; p = p->Next() )
|
2008-03-15 10:24:32 +00:00
|
|
|
p->Show( nestLevel + 2, os );
|
|
|
|
|
|
|
|
NestedSpace( nestLevel + 1, os ) << "</mpads>\n";
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
NestedSpace( nestLevel + 1, os ) << "<mdrawings>\n";
|
2007-08-06 20:26:59 +00:00
|
|
|
p = m_Drawings;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; p; p = p->Next() )
|
2008-03-15 10:24:32 +00:00
|
|
|
p->Show( nestLevel + 2, os );
|
|
|
|
|
|
|
|
NestedSpace( nestLevel + 1, os ) << "</mdrawings>\n";
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
p = m_Son;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; p; p = p->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2008-03-15 10:24:32 +00:00
|
|
|
p->Show( nestLevel + 1, os );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
2008-02-19 00:30:10 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str()
|
|
|
|
<< ">\n";
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-15 10:24:32 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
#endif
|