2009-05-25 11:53:55 +00:00
|
|
|
/************************/
|
2009-11-12 15:43:38 +00:00
|
|
|
/* file class_netinfo.h */
|
2009-05-25 11:53:55 +00:00
|
|
|
/************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Classes to handle info on nets
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CLASSES_NETINFO__
|
|
|
|
#define __CLASSES_NETINFO__
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
#include "class_netclass.h"
|
2011-01-14 17:43:30 +00:00
|
|
|
#include "richio.h"
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-05-25 11:53:55 +00:00
|
|
|
class NETINFO_ITEM;
|
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting
|
|
|
|
* 2 pads */
|
|
|
|
|
2009-06-05 15:57:41 +00:00
|
|
|
/*****************************/
|
|
|
|
/* flags for a RATSNEST_ITEM */
|
|
|
|
/*****************************/
|
2009-11-12 15:43:38 +00:00
|
|
|
#define CH_VISIBLE 1 /* Visible */
|
|
|
|
#define CH_UNROUTABLE 2 /* Don't use autorouter. */
|
|
|
|
#define CH_ROUTE_REQ 4 /* Must be routed by the autorouter. */
|
|
|
|
#define CH_ACTIF 8 /* Not routed. */
|
|
|
|
#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single
|
|
|
|
* module. */
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
class RATSNEST_ITEM
|
|
|
|
{
|
|
|
|
private:
|
2009-11-12 15:43:38 +00:00
|
|
|
int m_NetCode; // netcode ( = 1.. n , 0 is the value used for not
|
|
|
|
// connected items)
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
public:
|
2009-11-12 15:43:38 +00:00
|
|
|
int m_Status; // State: see previous defines (CH_ ...)
|
|
|
|
D_PAD* m_PadStart; // pointer to the starting pad
|
|
|
|
D_PAD* m_PadEnd; // pointer to ending pad
|
|
|
|
int m_Lenght; // length of the line (used in some calculations)
|
2009-06-05 15:57:41 +00:00
|
|
|
|
|
|
|
RATSNEST_ITEM();
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetNet
|
|
|
|
* @return int - the net code.
|
|
|
|
*/
|
|
|
|
int GetNet() const
|
|
|
|
{
|
|
|
|
return m_NetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetNet( int aNetCode )
|
|
|
|
{
|
|
|
|
m_NetCode = aNetCode;
|
|
|
|
}
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
2009-05-25 11:53:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
/******************* class NETINFO *****************************/
|
|
|
|
/***************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class NETINFO_LIST
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
BOARD* m_Parent;
|
2009-11-12 15:43:38 +00:00
|
|
|
std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name,
|
|
|
|
// design constraints ..
|
2009-06-20 19:09:43 +00:00
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
public:
|
2009-11-12 15:43:38 +00:00
|
|
|
std::vector<D_PAD*> m_PadsFullList; // Entry for a sorted pad
|
|
|
|
// list (used in ratsnest
|
|
|
|
// calculations)
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
public: NETINFO_LIST( BOARD* aParent );
|
2009-05-25 11:53:55 +00:00
|
|
|
~NETINFO_LIST();
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetItem
|
2009-05-25 11:53:55 +00:00
|
|
|
* @param aNetcode = netcode to identify a given NETINFO_ITEM
|
2009-11-12 15:43:38 +00:00
|
|
|
* @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its
|
|
|
|
* netcode, or NULL if not found
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
2009-06-06 18:08:49 +00:00
|
|
|
NETINFO_ITEM* GetNetItem( int aNetcode );
|
2009-05-25 11:53:55 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetCount
|
2009-05-25 11:53:55 +00:00
|
|
|
* @return the number of nets ( always >= 1 )
|
2009-06-06 18:08:49 +00:00
|
|
|
* becuse the first net is the "not connected" net and always exists
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
unsigned GetCount() { return m_NetBuffer.size(); }
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Append
|
|
|
|
* adds \a aNewElement to the end of the list.
|
|
|
|
*/
|
2009-06-06 18:08:49 +00:00
|
|
|
void AppendNet( NETINFO_ITEM* aNewElement );
|
2009-05-25 11:53:55 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function DeleteData
|
2009-05-25 11:53:55 +00:00
|
|
|
* delete the list of nets (and free memory)
|
|
|
|
*/
|
2009-05-28 08:42:24 +00:00
|
|
|
void DeleteData();
|
2009-05-25 11:53:55 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function BuildListOfNets
|
2009-06-06 18:08:49 +00:00
|
|
|
* Build or rebuild the list of NETINFO_ITEM m_NetBuffer
|
2009-05-25 11:53:55 +00:00
|
|
|
* The list is sorted by names.
|
|
|
|
*/
|
|
|
|
void BuildListOfNets();
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPadsCount
|
2009-06-11 14:26:17 +00:00
|
|
|
* @return the number of pads in board
|
|
|
|
*/
|
|
|
|
unsigned GetPadsCount()
|
|
|
|
{
|
|
|
|
return m_PadsFullList.size();
|
|
|
|
}
|
|
|
|
|
2009-06-20 19:09:43 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPad
|
2009-06-11 14:26:17 +00:00
|
|
|
* @return the pad idx from m_PadsFullList
|
|
|
|
*/
|
2009-06-20 19:09:43 +00:00
|
|
|
D_PAD* GetPad( unsigned aIdx )
|
2009-06-11 14:26:17 +00:00
|
|
|
{
|
2009-06-20 19:09:43 +00:00
|
|
|
if( aIdx < m_PadsFullList.size() )
|
2009-06-11 14:26:17 +00:00
|
|
|
return m_PadsFullList[aIdx];
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-06-20 19:09:43 +00:00
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
private:
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Build_Pads_Full_List
|
2009-06-11 14:26:17 +00:00
|
|
|
* Create the pad list
|
|
|
|
* initialise:
|
|
|
|
* m_Pads (list of pads)
|
|
|
|
* set m_Status_Pcb = LISTE_PAD_OK;
|
|
|
|
* and clear for all pads in list the m_SubRatsnest member;
|
|
|
|
* clear m_Pcb->m_FullRatsnest
|
|
|
|
*/
|
|
|
|
void Build_Pads_Full_List();
|
2009-05-25 11:53:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-10 02:22:56 +00:00
|
|
|
/**
|
|
|
|
* Class NETINFO_ITEM
|
|
|
|
* handles the data for a net
|
|
|
|
*/
|
2009-05-25 11:53:55 +00:00
|
|
|
class NETINFO_ITEM
|
|
|
|
{
|
|
|
|
private:
|
2009-11-12 15:43:38 +00:00
|
|
|
int m_NetCode; // this is a number equivalent to the net name
|
|
|
|
// Used for fast comparisons in ratsnest and DRC computations.
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout
|
|
|
|
// used by eeschema
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
wxString m_ShortNetname; // short net name, like vout from
|
|
|
|
// /mysheet/mysubsheet/vout
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
wxString m_NetClassName; // Net Class name. if void this is equivalent
|
|
|
|
// to "default" (the first
|
|
|
|
// item of the net classes list
|
2009-08-10 02:22:56 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
NETCLASS* m_NetClass;
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
2009-11-12 15:43:38 +00:00
|
|
|
int m_NbNodes; // Pads count for this net
|
|
|
|
int m_NbLink; // Ratsnets count for this net
|
|
|
|
int m_NbNoconn; // Ratsnets remaining to route count
|
|
|
|
int m_Flag; // used in some calculations. Had no
|
|
|
|
// special meaning
|
2009-08-10 02:22:56 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
|
2009-08-10 02:22:56 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of
|
|
|
|
* this
|
|
|
|
* net (included) in a general buffer of
|
|
|
|
* ratsnest (a vector<RATSNEST_ITEM*>
|
|
|
|
* buffer) */
|
2009-08-10 02:22:56 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
unsigned m_RatsnestEndIdx; // Ending point of ratsnests of this net
|
|
|
|
// (excluded) in this buffer
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
NETINFO_ITEM( BOARD_ITEM* aParent );
|
|
|
|
~NETINFO_ITEM();
|
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function SetClass
|
|
|
|
* sets \a aNetclass into this NET
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
void SetClass( const NETCLASS* aNetClass )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
m_NetClass = (NETCLASS*) aNetClass;
|
2009-08-17 02:59:38 +00:00
|
|
|
if( aNetClass )
|
|
|
|
m_NetClassName = aNetClass->GetName();
|
|
|
|
else
|
|
|
|
m_NetClassName = NETCLASS::Default;
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
NETCLASS* GetNetClass()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
return m_NetClass;
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetClassName
|
|
|
|
* returns the class name
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-11-12 15:43:38 +00:00
|
|
|
const wxString& GetClassName() const
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
|
|
|
return m_NetClassName;
|
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
#if 1
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetTrackWidth
|
|
|
|
* returns the width of tracks used to route this net.
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
int GetTrackWidth()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
wxASSERT( m_NetClass );
|
|
|
|
return m_NetClass->GetTrackWidth();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetViaSize
|
|
|
|
* returns the size of vias used to route this net
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
int GetViaSize()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
wxASSERT( m_NetClass );
|
2009-10-10 17:27:53 +00:00
|
|
|
return m_NetClass->GetViaDiameter();
|
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
/**
|
|
|
|
* Function GetMicroViaSize
|
|
|
|
* returns the size of vias used to route this net
|
|
|
|
*/
|
|
|
|
int GetMicroViaSize()
|
|
|
|
{
|
|
|
|
wxASSERT( m_NetClass );
|
|
|
|
return m_NetClass->GetuViaDiameter();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetViaDrillSize
|
|
|
|
* returns the size of via drills used to route this net
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
int GetViaDrillSize()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
wxASSERT( m_NetClass );
|
2009-10-10 17:27:53 +00:00
|
|
|
return m_NetClass->GetViaDrill();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
/**
|
|
|
|
* Function GetViaDrillSize
|
|
|
|
* returns the size of via drills used to route this net
|
|
|
|
*/
|
|
|
|
int GetMicroViaDrillSize()
|
|
|
|
{
|
|
|
|
wxASSERT( m_NetClass );
|
|
|
|
return m_NetClass->GetuViaDrill();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetViaMinSize
|
|
|
|
* returns the Minimum value for via sizes (used in DRC)
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
int GetViaMinSize()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
wxASSERT( m_NetClass );
|
|
|
|
return m_NetClass->GetViaMinSize();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-11-12 15:43:38 +00:00
|
|
|
|
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
#endif
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetClearance
|
|
|
|
* returns the clearance when routing near aBoardItem
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-08-17 02:59:38 +00:00
|
|
|
int GetClearance( BOARD_ITEM* aBoardItem )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
wxASSERT( m_NetClass );
|
|
|
|
return m_NetClass->GetClearance();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-11-12 15:43:38 +00:00
|
|
|
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
#endif
|
2009-07-18 11:44:19 +00:00
|
|
|
|
|
|
|
/* Reading and writing data on files */
|
2011-01-14 17:43:30 +00:00
|
|
|
int ReadDescr( LINE_READER* aReader );
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-12 15:43:38 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd"
|
|
|
|
* format.
|
2009-05-25 11:53:55 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
2009-11-12 15:43:38 +00:00
|
|
|
* @todo we actually could show a NET, simply show all the tracks and
|
|
|
|
* a pads or net name on pad and vias
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
2009-05-25 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetNet
|
|
|
|
* @return int - the netcode
|
|
|
|
*/
|
|
|
|
int GetNet() const { return m_NetCode; }
|
|
|
|
void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
|
|
|
|
|
|
|
|
int GetNodesCount() const { return m_ListPad.size(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetNetname
|
|
|
|
* @return const wxString * , a pointer to the full netname
|
|
|
|
*/
|
|
|
|
wxString GetNetname() const { return m_Netname; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetShortNetname
|
|
|
|
* @return const wxString * , a pointer to the short netname
|
|
|
|
*/
|
|
|
|
wxString GetShortNetname() const { return m_ShortNetname; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetNetname
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aNetname : the new netname
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
|
|
|
void SetNetname( const wxString& aNetname );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DisplayInfo
|
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
2010-12-08 20:12:46 +00:00
|
|
|
* Is virtual from EDA_ITEM.
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2009-05-25 11:53:55 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
2009-05-25 11:53:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/***********************************************************/
|
|
|
|
/* Description of a trace point for monitoring connections */
|
|
|
|
/***********************************************************/
|
2009-05-25 11:53:55 +00:00
|
|
|
#define START_ON_PAD 0x10
|
|
|
|
#define END_ON_PAD 0x20
|
|
|
|
#define START_ON_TRACK 0x40
|
|
|
|
#define END_ON_TRACK 0x80
|
|
|
|
|
|
|
|
|
|
|
|
/* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */
|
|
|
|
enum StatusPcbFlags {
|
2009-11-12 15:43:38 +00:00
|
|
|
LISTE_PAD_OK = 1, /* Pad list is Ok */
|
|
|
|
LISTE_RATSNEST_ITEM_OK = 2, /* General Ratsnest is Ok */
|
|
|
|
RATSNEST_ITEM_LOCAL_OK = 4, /* current MODULE ratsnest is Ok */
|
|
|
|
CONNEXION_OK = 8, /* List of connections exists. */
|
|
|
|
NET_CODES_OK = 0x10, /* Bit indicating that Netcode is OK,
|
|
|
|
* do not change net name. */
|
|
|
|
DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general
|
|
|
|
* ratsnest (used in module moves) */
|
2009-05-25 11:53:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __CLASSES_NETINFO__
|