2007-06-05 12:10:51 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-08 03:50:44 +00:00
|
|
|
|
/* fonctions membres de la classe EQUIPOT et fonctions associ<63>s */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*****************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "wxstruct.h"
|
|
|
|
|
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
|
|
|
|
|
#ifdef CVPCB
|
|
|
|
|
#include "cvpcb.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
|
/*********************************************************/
|
|
|
|
|
/* classe EQUIPOT: gestion des listes d'equipotentielles */
|
|
|
|
|
/*********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
/* Constructeur de la classe EQUIPOT */
|
2008-12-04 04:28:11 +00:00
|
|
|
|
EQUIPOT::EQUIPOT( BOARD_ITEM* aParent ) :
|
|
|
|
|
BOARD_ITEM( aParent, TYPE_EQUIPOT )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
|
SetNet( 0 );
|
2008-12-14 19:45:05 +00:00
|
|
|
|
m_NbNodes = m_NbLink = m_NbNoconn = 0;
|
2007-08-08 03:50:44 +00:00
|
|
|
|
m_Masque_Layer = 0;
|
|
|
|
|
m_Masque_Plan = 0;
|
|
|
|
|
m_ForceWidth = 0;
|
|
|
|
|
m_PadzoneStart = NULL; // pointeur sur debut de liste pads du net
|
|
|
|
|
m_PadzoneEnd = NULL; // pointeur sur fin de liste pads du net
|
|
|
|
|
m_RatsnestStart = NULL; // pointeur sur debut de liste ratsnests du net
|
|
|
|
|
m_RatsnestEnd = NULL; // pointeur sur fin de liste ratsnests du net
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
|
/* destructeut */
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
EQUIPOT::~EQUIPOT()
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
wxPoint& EQUIPOT::GetPosition()
|
|
|
|
|
{
|
|
|
|
|
static wxPoint dummy;
|
2008-12-14 19:45:05 +00:00
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
return dummy;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*********************************************************/
|
2008-12-14 19:45:05 +00:00
|
|
|
|
int EQUIPOT:: ReadDescr( FILE* File, int* LineNum )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*********************************************************/
|
2007-08-08 03:50:44 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Routine de lecture de 1 descr Equipotentielle.
|
2007-08-08 03:50:44 +00:00
|
|
|
|
* retourne 0 si OK
|
|
|
|
|
* 1 si lecture incomplete
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-08 03:50:44 +00:00
|
|
|
|
char Line[1024], Ltmp[1024];
|
|
|
|
|
int tmp;
|
|
|
|
|
|
|
|
|
|
while( GetLine( File, Line, LineNum ) )
|
|
|
|
|
{
|
|
|
|
|
if( strnicmp( Line, "$End", 4 ) == 0 )
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if( strncmp( Line, "Na", 2 ) == 0 ) /* Texte */
|
|
|
|
|
{
|
|
|
|
|
sscanf( Line + 2, " %d", &tmp );
|
2007-10-13 06:18:44 +00:00
|
|
|
|
SetNet( tmp );
|
2007-08-08 03:50:44 +00:00
|
|
|
|
|
|
|
|
|
ReadDelimitedText( Ltmp, Line + 2, sizeof(Ltmp) );
|
|
|
|
|
m_Netname = CONV_FROM_UTF8( Ltmp );
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( strncmp( Line, "Lw", 2 ) == 0 ) /* Texte */
|
|
|
|
|
{
|
|
|
|
|
sscanf( Line + 2, " %d", &tmp );
|
|
|
|
|
m_ForceWidth = tmp;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
/**************************************/
|
2007-10-30 21:30:58 +00:00
|
|
|
|
bool EQUIPOT::Save( FILE* aFile ) const
|
2008-12-14 19:45:05 +00:00
|
|
|
|
/**************************************/
|
2007-10-30 21:30:58 +00:00
|
|
|
|
{
|
|
|
|
|
if( GetState( DELETED ) )
|
|
|
|
|
return true;
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
bool success = false;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
|
fprintf( aFile, "$EQUIPOT\n" );
|
2008-12-14 19:45:05 +00:00
|
|
|
|
fprintf( aFile, "Na %d \"%s\"\n", GetNet(), CONV_TO_UTF8( m_Netname ) );
|
2007-10-30 21:30:58 +00:00
|
|
|
|
fprintf( aFile, "St %s\n", "~" );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
|
if( m_ForceWidth )
|
|
|
|
|
fprintf( aFile, "Lw %d\n", m_ForceWidth );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
if( fprintf( aFile, "$EndEQUIPOT\n" ) != sizeof("$EndEQUIPOT\n") - 1 )
|
2007-10-30 21:30:58 +00:00
|
|
|
|
goto out;
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
success = true;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
|
|
out:
|
2008-12-14 19:45:05 +00:00
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function SetNetname
|
|
|
|
|
* @param const wxString : the new netname
|
|
|
|
|
*/
|
|
|
|
|
void EQUIPOT::SetNetname( const wxString & aNetname )
|
|
|
|
|
{
|
|
|
|
|
m_Netname = aNetname;
|
|
|
|
|
m_ShortNetname = m_Netname.AfterLast( '/' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** function Draw
|
|
|
|
|
* we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
|
|
|
|
|
*/
|
|
|
|
|
void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset )
|
|
|
|
|
{
|
2007-10-30 21:30:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-09 01:41:30 +00:00
|
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
2008-12-14 19:45:05 +00:00
|
|
|
|
|
2007-08-09 01:41:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function Show
|
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-11-24 06:53:43 +00:00
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2007-08-09 01:41:30 +00:00
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
|
*/
|
|
|
|
|
void EQUIPOT::Show( int nestLevel, std::ostream& os )
|
|
|
|
|
{
|
|
|
|
|
// for now, make it look like XML:
|
2008-11-24 06:53:43 +00:00
|
|
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
2008-12-14 19:45:05 +00:00
|
|
|
|
" name=\"" << m_Netname.mb_str() << '"' <<
|
|
|
|
|
" netcode=\"" << GetNet() << "\"/>\n";
|
2007-08-09 01:41:30 +00:00
|
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
|
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
|
#endif
|