more cleanup and enhancements about rats nest (work in progress)
This commit is contained in:
parent
e073bdc042
commit
3f970c85ce
|
@ -56,7 +56,7 @@ set(PCB_COMMON_SRCS
|
||||||
../pcbnew/class_drawsegment.cpp
|
../pcbnew/class_drawsegment.cpp
|
||||||
../pcbnew/class_drc_item.cpp
|
../pcbnew/class_drc_item.cpp
|
||||||
../pcbnew/class_edge_mod.cpp
|
../pcbnew/class_edge_mod.cpp
|
||||||
../pcbnew/class_equipot.cpp
|
../pcbnew/class_netinfo_item.cpp
|
||||||
../pcbnew/class_netinfolist.cpp
|
../pcbnew/class_netinfolist.cpp
|
||||||
../pcbnew/class_marker.cpp
|
../pcbnew/class_marker.cpp
|
||||||
../pcbnew/class_mire.cpp
|
../pcbnew/class_mire.cpp
|
||||||
|
|
|
@ -250,7 +250,7 @@ public:
|
||||||
#include "class_edge_mod.h" // Class for footprint graphic elements
|
#include "class_edge_mod.h" // Class for footprint graphic elements
|
||||||
#include "class_text_mod.h" // Class for footprint fields
|
#include "class_text_mod.h" // Class for footprint fields
|
||||||
#include "class_module.h" // Class for the footprint
|
#include "class_module.h" // Class for the footprint
|
||||||
#include "class_equipot.h"
|
#include "class_netinfo.h" // Class for nets
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
|
|
|
@ -286,7 +286,7 @@ public:
|
||||||
void Build_Board_Ratsnest( wxDC* DC );
|
void Build_Board_Ratsnest( wxDC* DC );
|
||||||
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
|
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
|
||||||
void trace_ratsnest_pad( wxDC* DC );
|
void trace_ratsnest_pad( wxDC* DC );
|
||||||
int* build_ratsnest_pad( EDA_BaseStruct* ref,
|
void build_ratsnest_pad( BOARD_ITEM* ref,
|
||||||
const wxPoint& refpos,
|
const wxPoint& refpos,
|
||||||
bool init );
|
bool init );
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "dlist.h"
|
#include "dlist.h"
|
||||||
#include "class_equipot.h"
|
#include "class_netinfo.h"
|
||||||
|
|
||||||
|
|
||||||
class ZONE_CONTAINER;
|
class ZONE_CONTAINER;
|
||||||
|
|
|
@ -1,212 +1,212 @@
|
||||||
/************************/
|
/************************/
|
||||||
/* file class_equipot.h */
|
/* file class_equipot.h */
|
||||||
/************************/
|
/************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Classes to handle info on nets
|
* Classes to handle info on nets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CLASSES_NETINFO__
|
#ifndef __CLASSES_NETINFO__
|
||||||
#define __CLASSES_NETINFO__
|
#define __CLASSES_NETINFO__
|
||||||
|
|
||||||
// Forward declaration:
|
// Forward declaration:
|
||||||
class NETINFO_ITEM;
|
class NETINFO_ITEM;
|
||||||
|
|
||||||
|
|
||||||
/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting 2 pads */
|
/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting 2 pads */
|
||||||
|
|
||||||
class RATSNEST_ITEM
|
class RATSNEST_ITEM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_NetCode; // netcode ( = 1.. n , 0 is the value used for not connected items)
|
int m_NetCode; // netcode ( = 1.. n , 0 is the value used for not connected items)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_Status; // etat: voir defines précédents (CH_ ...)
|
int m_Status; // etat: voir defines précédents (CH_ ...)
|
||||||
D_PAD* m_PadStart; // pointer to the starting pad
|
D_PAD* m_PadStart; // pointer to the starting pad
|
||||||
D_PAD* m_PadEnd; // pointer to ending pad
|
D_PAD* m_PadEnd; // pointer to ending pad
|
||||||
int m_Lenght; // lenght of the line
|
int m_Lenght; // lenght of the line
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNet
|
* Function GetNet
|
||||||
* @return int - the net code.
|
* @return int - the net code.
|
||||||
*/
|
*/
|
||||||
int GetNet() const
|
int GetNet() const
|
||||||
{
|
{
|
||||||
return m_NetCode;
|
return m_NetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetNet( int aNetCode )
|
void SetNet( int aNetCode )
|
||||||
{
|
{
|
||||||
m_NetCode = aNetCode;
|
m_NetCode = aNetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function Draw
|
/** function Draw
|
||||||
*/
|
*/
|
||||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/******************* class NETINFO *****************************/
|
/******************* class NETINFO *****************************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|
||||||
class NETINFO_LIST
|
class NETINFO_LIST
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
BOARD* m_Parent;
|
BOARD* m_Parent;
|
||||||
|
|
||||||
// boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
|
// boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
|
||||||
std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
|
std::vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
|
||||||
public:
|
public:
|
||||||
NETINFO_LIST( BOARD* aParent );
|
NETINFO_LIST( BOARD* aParent );
|
||||||
~NETINFO_LIST();
|
~NETINFO_LIST();
|
||||||
|
|
||||||
/** Function GetItem
|
/** Function GetItem
|
||||||
* @param aNetcode = netcode to identify a given NETINFO_ITEM
|
* @param aNetcode = netcode to identify a given NETINFO_ITEM
|
||||||
* @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its netcode, or NULL if not found
|
* @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its netcode, or NULL if not found
|
||||||
*/
|
*/
|
||||||
NETINFO_ITEM* GetItem( int aNetcode );
|
NETINFO_ITEM* GetItem( int aNetcode );
|
||||||
|
|
||||||
/** Function GetCount()
|
/** Function GetCount()
|
||||||
* @return the number of nets ( always >= 1 )
|
* @return the number of nets ( always >= 1 )
|
||||||
* the first net is the "not connected" net
|
* the first net is the "not connected" net
|
||||||
*/
|
*/
|
||||||
unsigned GetCount() { return m_NetBuffer.size(); }
|
unsigned GetCount() { return m_NetBuffer.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Append
|
* Function Append
|
||||||
* adds \a aNewElement to the end of the list.
|
* adds \a aNewElement to the end of the list.
|
||||||
*/
|
*/
|
||||||
void Append( NETINFO_ITEM* aNewElement );
|
void Append( NETINFO_ITEM* aNewElement );
|
||||||
|
|
||||||
/** Function Clear
|
/** Function Clear
|
||||||
* delete the list of nets (and free memory)
|
* delete the list of nets (and free memory)
|
||||||
*/
|
*/
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
/** Function BuildListOfNets
|
/** Function BuildListOfNets
|
||||||
* initialize the list of NETINFO_ITEM m_NetBuffer
|
* initialize the list of NETINFO_ITEM m_NetBuffer
|
||||||
* The list is sorted by names.
|
* The list is sorted by names.
|
||||||
*/
|
*/
|
||||||
void BuildListOfNets();
|
void BuildListOfNets();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** class NETINFO_ITEM
|
/** class NETINFO_ITEM
|
||||||
* @info This class handle the data relative to a given net
|
* @info This class handle the data relative to a given net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NETINFO_ITEM
|
class NETINFO_ITEM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_NetCode; // this is a number equivalent to the net name
|
int m_NetCode; // this is a number equivalent to the net name
|
||||||
// Used for fast comparisons in rastnest and DRC computations.
|
// Used for fast comparisons in rastnest and DRC computations.
|
||||||
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
|
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
|
||||||
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
|
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_NbNodes; // Pads count for this net
|
int m_NbNodes; // Pads count for this net
|
||||||
int m_NbLink; // Ratsnets count for this net
|
int m_NbLink; // Ratsnets count for this net
|
||||||
int m_NbNoconn; // Ratsnets remaining to route count
|
int m_NbNoconn; // Ratsnets remaining to route count
|
||||||
int m_ForceWidth; // specific width (O = default width)
|
int m_ForceWidth; // specific width (O = default width)
|
||||||
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
|
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
|
||||||
RATSNEST_ITEM* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net
|
RATSNEST_ITEM* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net
|
||||||
RATSNEST_ITEM* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net
|
RATSNEST_ITEM* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net
|
||||||
std::vector <RATSNEST_ITEM*> m_ListRatsnest; // List of Ratsnests for this net
|
std::vector <RATSNEST_ITEM*> m_ListRatsnest; // List of Ratsnests for this net
|
||||||
|
|
||||||
NETINFO_ITEM( BOARD_ITEM* aParent );
|
NETINFO_ITEM( BOARD_ITEM* aParent );
|
||||||
~NETINFO_ITEM();
|
~NETINFO_ITEM();
|
||||||
|
|
||||||
|
|
||||||
/* Readind and writing data on files */
|
/* Readind and writing data on files */
|
||||||
int ReadDescr( FILE* File, int* LineNum );
|
int ReadDescr( FILE* File, int* LineNum );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
bool Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
|
|
||||||
/** function Draw
|
/** function Draw
|
||||||
* @todo we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
|
* @todo we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
|
||||||
*/
|
*/
|
||||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNet
|
* Function GetNet
|
||||||
* @return int - the netcode
|
* @return int - the netcode
|
||||||
*/
|
*/
|
||||||
int GetNet() const { return m_NetCode; }
|
int GetNet() const { return m_NetCode; }
|
||||||
void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
|
void SetNet( int aNetCode ) { m_NetCode = aNetCode; }
|
||||||
|
|
||||||
int GetNodesCount() const { return m_ListPad.size(); }
|
int GetNodesCount() const { return m_ListPad.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNetname
|
* Function GetNetname
|
||||||
* @return const wxString * , a pointer to the full netname
|
* @return const wxString * , a pointer to the full netname
|
||||||
*/
|
*/
|
||||||
wxString GetNetname() const { return m_Netname; }
|
wxString GetNetname() const { return m_Netname; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetShortNetname
|
* Function GetShortNetname
|
||||||
* @return const wxString * , a pointer to the short netname
|
* @return const wxString * , a pointer to the short netname
|
||||||
*/
|
*/
|
||||||
wxString GetShortNetname() const { return m_ShortNetname; }
|
wxString GetShortNetname() const { return m_ShortNetname; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetNetname
|
* Function SetNetname
|
||||||
* @param const wxString : the new netname
|
* @param const wxString : the new netname
|
||||||
*/
|
*/
|
||||||
void SetNetname( const wxString& aNetname );
|
void SetNetname( const wxString& aNetname );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DisplayInfo
|
* Function DisplayInfo
|
||||||
* has knowledge about the frame and how and where to put status information
|
* has knowledge about the frame and how and where to put status information
|
||||||
* about this object into the frame's message panel.
|
* about this object into the frame's message panel.
|
||||||
* Is virtual from EDA_BaseStruct.
|
* Is virtual from EDA_BaseStruct.
|
||||||
* @param frame A WinEDA_DrawFrame in which to print status information.
|
* @param frame A WinEDA_DrawFrame in which to print status information.
|
||||||
*/
|
*/
|
||||||
void DisplayInfo( WinEDA_DrawFrame* frame );
|
void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* flags for a RATSNEST_ITEM */
|
/* flags for a RATSNEST_ITEM */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
#define CH_VISIBLE 1 /* affichage permanent demande */
|
#define CH_VISIBLE 1 /* affichage permanent demande */
|
||||||
#define CH_UNROUTABLE 2 /* non route par l'autorouteur */
|
#define CH_UNROUTABLE 2 /* non route par l'autorouteur */
|
||||||
#define CH_ROUTE_REQ 4 /* doit etre route par l'autorouteur */
|
#define CH_ROUTE_REQ 4 /* doit etre route par l'autorouteur */
|
||||||
#define CH_ACTIF 8 /* chevelu non encore routé */
|
#define CH_ACTIF 8 /* chevelu non encore routé */
|
||||||
#define LOCAL_RATSNEST_ITEM 0x8000 /* indique un chevelu reliant 2 pins d'un meme
|
#define LOCAL_RATSNEST_ITEM 0x8000 /* indique un chevelu reliant 2 pins d'un meme
|
||||||
* module pour le calcul des chevelus relatifs a 1 seul module */
|
* module pour le calcul des chevelus relatifs a 1 seul module */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* description d'un point de piste pour le suivi des connexions */
|
/* description d'un point de piste pour le suivi des connexions */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
#define START_ON_PAD 0x10
|
#define START_ON_PAD 0x10
|
||||||
#define END_ON_PAD 0x20
|
#define END_ON_PAD 0x20
|
||||||
#define START_ON_TRACK 0x40
|
#define START_ON_TRACK 0x40
|
||||||
#define END_ON_TRACK 0x80
|
#define END_ON_TRACK 0x80
|
||||||
|
|
||||||
|
|
||||||
/* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */
|
/* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */
|
||||||
enum StatusPcbFlags {
|
enum StatusPcbFlags {
|
||||||
LISTE_PAD_OK = 1, /* Pad list is Ok */
|
LISTE_PAD_OK = 1, /* Pad list is Ok */
|
||||||
LISTE_RATSNEST_ITEM_OK = 2, /* General Rastnest is Ok */
|
LISTE_RATSNEST_ITEM_OK = 2, /* General Rastnest is Ok */
|
||||||
RATSNEST_ITEM_LOCAL_OK = 4, /* current MODULE rastnest is Ok */
|
RATSNEST_ITEM_LOCAL_OK = 4, /* current MODULE rastnest is Ok */
|
||||||
CONNEXION_OK = 8, /* Bit indicant que la liste des connexions existe */
|
CONNEXION_OK = 8, /* Bit indicant que la liste des connexions existe */
|
||||||
NET_CODES_OK = 0x10, /* Bit indicant que les netcodes sont OK ( pas de modif
|
NET_CODES_OK = 0x10, /* Bit indicant que les netcodes sont OK ( pas de modif
|
||||||
* de noms de net */
|
* de noms de net */
|
||||||
DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general rastnest (used in module moves) */
|
DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general rastnest (used in module moves) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __CLASSES_NETINFO__
|
#endif // __CLASSES_NETINFO__
|
|
@ -3,14 +3,14 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "wxstruct.h"
|
#include "class_drawpanel.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/* class NETINFO_ITEM: hand data relative to a given net */
|
/* class NETINFO_ITEM: handle data relative to a given net */
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
|
@ -24,7 +24,7 @@ NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* destructot */
|
/* destructor */
|
||||||
|
|
||||||
NETINFO_ITEM::~NETINFO_ITEM()
|
NETINFO_ITEM::~NETINFO_ITEM()
|
||||||
{
|
{
|
||||||
|
@ -107,9 +107,8 @@ void NETINFO_ITEM::SetNetname( const wxString & aNetname )
|
||||||
|
|
||||||
|
|
||||||
/** function Draw (TODO)
|
/** function Draw (TODO)
|
||||||
* we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
|
|
||||||
*/
|
*/
|
||||||
void NETINFO_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset )
|
void NETINFO_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,3 +168,24 @@ void NETINFO_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const
|
||||||
valeur_param( (int) lengthnet, txt );
|
valeur_param( (int) lengthnet, txt );
|
||||||
Affiche_1_Parametre( frame, 60, _( "Net Length" ), txt, RED );
|
Affiche_1_Parametre( frame, 60, _( "Net Length" ), txt, RED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************/
|
||||||
|
/* class RATSNEST_ITEM */
|
||||||
|
/***********************/
|
||||||
|
|
||||||
|
/** function Draw
|
||||||
|
* Draws a line from the starting pad to the ending pad
|
||||||
|
*/
|
||||||
|
void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset )
|
||||||
|
{
|
||||||
|
EDA_Colors color = (EDA_Colors) g_DesignSettings.m_RatsnestColor;
|
||||||
|
if ( (m_Status & LOCAL_RATSNEST_ITEM) )
|
||||||
|
color = YELLOW;
|
||||||
|
GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos.x + aOffset.x,
|
||||||
|
m_PadStart->m_Pos.y + aOffset.y,
|
||||||
|
m_PadEnd->m_Pos.x + aOffset.x,
|
||||||
|
m_PadEnd->m_Pos.y + aOffset.y,
|
||||||
|
0, color );
|
||||||
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
D_PAD* pt_pad = NULL;
|
D_PAD* pt_pad = NULL;
|
||||||
TRACK* TrackOnStartPoint = NULL;
|
TRACK* TrackOnStartPoint = NULL;
|
||||||
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
|
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
|
||||||
EDA_BaseStruct* LockPoint;
|
BOARD_ITEM* LockPoint;
|
||||||
wxPoint pos = GetScreen()->m_Curseur;
|
wxPoint pos = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
static int InitialTrackWidthValue; /* first track segment width.
|
static int InitialTrackWidthValue; /* first track segment width.
|
||||||
|
@ -457,7 +457,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
* ceci contribue a la reduction du temps de calcul */
|
* ceci contribue a la reduction du temps de calcul */
|
||||||
|
|
||||||
/* Accrochage de la fin de la piste */
|
/* Accrochage de la fin de la piste */
|
||||||
EDA_BaseStruct* LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
|
BOARD_ITEM* LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
|
||||||
|
|
||||||
if( LockPoint ) /* La fin de la piste est sur un PAD */
|
if( LockPoint ) /* La fin de la piste est sur un PAD */
|
||||||
{
|
{
|
||||||
|
|
|
@ -924,7 +924,7 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
Track->SetState( EDIT, OFF );
|
Track->SetState( EDIT, OFF );
|
||||||
Track->Draw( DrawPanel, DC, draw_mode );
|
Track->Draw( DrawPanel, DC, draw_mode );
|
||||||
|
|
||||||
/* Tracage des segments dragges */
|
/* Draw ddragged tracks */
|
||||||
pt_drag = g_DragSegmentList;
|
pt_drag = g_DragSegmentList;
|
||||||
for( ; pt_drag; pt_drag = pt_drag->Pnext )
|
for( ; pt_drag; pt_drag = pt_drag->Pnext )
|
||||||
{
|
{
|
||||||
|
@ -954,10 +954,10 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
EDA_BaseStruct* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
/* Routine trouvant le point " d'accrochage " d'une extremite de piste.
|
/* Routine trouvant le point "d'accrochage" d'une extremite de piste.
|
||||||
* Ce point peut etre un PAD ou un autre segment de piste
|
* Ce point peut etre un PAD ou un autre segment de piste
|
||||||
* Retourne:
|
* Retourne:
|
||||||
* - pointeur sur ce PAD ou:
|
* - pointeur sur ce PAD ou:
|
||||||
|
|
|
@ -353,7 +353,7 @@ void MasqueAttributs( int* masque_set, int* masque_clr );
|
||||||
/* DUPLTRAC.CPP */
|
/* DUPLTRAC.CPP */
|
||||||
/***************/
|
/***************/
|
||||||
|
|
||||||
EDA_BaseStruct* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask );
|
BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask );
|
||||||
|
|
||||||
/* Routine trouvant le point " d'accrochage " d'une extremite de piste.
|
/* Routine trouvant le point " d'accrochage " d'une extremite de piste.
|
||||||
* Ce point peut etre un PAD ou un autre segment de piste
|
* Ce point peut etre un PAD ou un autre segment de piste
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
extern char* adr_lowmem; /* adresse de base memoire de calcul disponible */
|
extern char* adr_lowmem; /* adresse de base memoire de calcul disponible */
|
||||||
|
|
||||||
|
|
||||||
/* exported variables */
|
/* exported variables */
|
||||||
RATSNEST_ITEM* g_pt_chevelu;
|
RATSNEST_ITEM* g_pt_chevelu;
|
||||||
RATSNEST_ITEM* local_liste_chevelu; // Buffer address for local ratsnest
|
RATSNEST_ITEM* local_liste_chevelu; // Buffer address for local ratsnest
|
||||||
// (ratnest relative to one footprint while moving it
|
// (ratnest relative to one footprint while moving it
|
||||||
int nb_local_chevelu; // link count (active ratnest count) for the footprint beeing moved
|
int nb_local_chevelu; // link count (active ratnest count) for the footprint beeing moved
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
static int nb_pads_ref; // node count (node = pad with a net code) for the footprint beeing moved
|
static int nb_pads_ref; // node count (node = pad with a net code) for the footprint beeing moved
|
||||||
static int nb_pads_externes; // Connected pads count ( pads which are
|
static int nb_pads_externes; // Connected pads count ( pads which are
|
||||||
// in other footprints and connected to a pad of the footprint beeing moved
|
// in other footprints and connected to a pad of the footprint beeing moved
|
||||||
static bool DisplayRastnestInProgress; // Enable the display of the ratsnest during the ratsnest computations
|
static bool DisplayRastnestInProgress; // Enable the display of the ratsnest during the ratsnest computations
|
||||||
|
|
||||||
/* Note about the ratsnest computation:
|
/* Note about the ratsnest computation:
|
||||||
* Building the general ratsnest:
|
* Building the general ratsnest:
|
||||||
|
@ -211,8 +211,8 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
|
||||||
* @return blocks not connected count
|
* @return blocks not connected count
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int dist_min, current_dist;
|
int dist_min, current_dist;
|
||||||
int current_num_block = 1;
|
int current_num_block = 1;
|
||||||
D_PAD** pt_liste_pad_tmp;
|
D_PAD** pt_liste_pad_tmp;
|
||||||
D_PAD** pt_liste_pad_aux;
|
D_PAD** pt_liste_pad_aux;
|
||||||
D_PAD** pt_liste_pad_block1 = NULL;
|
D_PAD** pt_liste_pad_block1 = NULL;
|
||||||
|
@ -285,17 +285,13 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
|
||||||
/* Create the new ratsnet */
|
/* Create the new ratsnet */
|
||||||
(*nblinks)++;
|
(*nblinks)++;
|
||||||
g_pt_chevelu->SetNet( (*pt_liste_pad)->GetNet() );
|
g_pt_chevelu->SetNet( (*pt_liste_pad)->GetNet() );
|
||||||
g_pt_chevelu->m_Status = CH_ACTIF | CH_VISIBLE;
|
g_pt_chevelu->m_Status = CH_ACTIF | CH_VISIBLE;
|
||||||
g_pt_chevelu->m_Lenght = dist_min;
|
g_pt_chevelu->m_Lenght = dist_min;
|
||||||
g_pt_chevelu->m_PadStart = *pt_liste_pad;
|
g_pt_chevelu->m_PadStart = *pt_liste_pad;
|
||||||
g_pt_chevelu->m_PadEnd = *pt_liste_pad_tmp;
|
g_pt_chevelu->m_PadEnd = *pt_liste_pad_tmp;
|
||||||
|
|
||||||
if( DisplayRastnestInProgress && DC )
|
if( DisplayRastnestInProgress && DC )
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC, g_pt_chevelu->m_PadStart->m_Pos.x,
|
g_pt_chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||||
g_pt_chevelu->m_PadStart->m_Pos.y,
|
|
||||||
g_pt_chevelu->m_PadEnd->m_Pos.x,
|
|
||||||
g_pt_chevelu->m_PadEnd->m_Pos.y,
|
|
||||||
0, g_DesignSettings.m_RatsnestColor );
|
|
||||||
|
|
||||||
g_pt_chevelu++;
|
g_pt_chevelu++;
|
||||||
}
|
}
|
||||||
|
@ -331,17 +327,14 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
|
||||||
* last block number used
|
* last block number used
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int dist_min, current_dist;
|
int dist_min, current_dist;
|
||||||
D_PAD** pt_liste_pad_tmp;
|
D_PAD** pt_liste_pad_tmp;
|
||||||
D_PAD** pt_liste_pad_aux;
|
D_PAD** pt_liste_pad_aux;
|
||||||
D_PAD** pt_start_liste;
|
D_PAD** pt_start_liste;
|
||||||
D_PAD* ref_pad, * pad;
|
D_PAD* ref_pad, * pad;
|
||||||
|
|
||||||
pt_start_liste = pt_liste_pad;
|
pt_start_liste = pt_liste_pad;
|
||||||
|
|
||||||
if( DC )
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
|
||||||
|
|
||||||
for( ; pt_liste_pad < pt_limite; pt_liste_pad++ )
|
for( ; pt_liste_pad < pt_limite; pt_liste_pad++ )
|
||||||
{
|
{
|
||||||
ref_pad = *pt_liste_pad;
|
ref_pad = *pt_liste_pad;
|
||||||
|
@ -394,19 +387,14 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
|
||||||
|
|
||||||
(*nblinks)++;
|
(*nblinks)++;
|
||||||
g_pt_chevelu->SetNet( ref_pad->GetNet() );
|
g_pt_chevelu->SetNet( ref_pad->GetNet() );
|
||||||
g_pt_chevelu->m_Status = CH_ACTIF | CH_VISIBLE;
|
g_pt_chevelu->m_Status = CH_ACTIF | CH_VISIBLE;
|
||||||
g_pt_chevelu->m_Lenght = dist_min;
|
g_pt_chevelu->m_Lenght = dist_min;
|
||||||
g_pt_chevelu->m_PadStart = ref_pad;
|
g_pt_chevelu->m_PadStart = ref_pad;
|
||||||
g_pt_chevelu->m_PadEnd = pad;
|
g_pt_chevelu->m_PadEnd = pad;
|
||||||
|
|
||||||
if( DisplayRastnestInProgress && DC )
|
if( DisplayRastnestInProgress && DC )
|
||||||
{
|
g_pt_chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC, g_pt_chevelu->m_PadStart->m_Pos.x,
|
|
||||||
g_pt_chevelu->m_PadStart->m_Pos.y,
|
|
||||||
g_pt_chevelu->m_PadEnd->m_Pos.x,
|
|
||||||
g_pt_chevelu->m_PadEnd->m_Pos.y,
|
|
||||||
0, g_DesignSettings.m_RatsnestColor );
|
|
||||||
}
|
|
||||||
g_pt_chevelu++;
|
g_pt_chevelu++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,7 +465,8 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
||||||
if( m_Pcb->m_NbNodes == 0 )
|
if( m_Pcb->m_NbNodes == 0 )
|
||||||
return; /* pas de connexions utiles */
|
return; /* pas de connexions utiles */
|
||||||
|
|
||||||
m_Pcb->m_Ratsnest = (RATSNEST_ITEM*) MyZMalloc( (m_Pcb->m_NbNodes + 10 ) * sizeof(RATSNEST_ITEM) );
|
m_Pcb->m_Ratsnest =
|
||||||
|
(RATSNEST_ITEM*) MyZMalloc( (m_Pcb->m_NbNodes + 10 ) * sizeof(RATSNEST_ITEM) );
|
||||||
if( m_Pcb->m_Ratsnest == NULL )
|
if( m_Pcb->m_Ratsnest == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -505,10 +494,10 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
||||||
/* Compute the ratsnest relative to the current net */
|
/* Compute the ratsnest relative to the current net */
|
||||||
|
|
||||||
/* a - first pass : create the blocks from not already in block pads */
|
/* a - first pass : create the blocks from not already in block pads */
|
||||||
D_PAD ** pstart = &net->m_ListPad[0];
|
D_PAD** pstart = &net->m_ListPad[0];
|
||||||
D_PAD ** pend = pstart + net->m_ListPad.size();
|
D_PAD** pend = pstart + net->m_ListPad.size();
|
||||||
int icnt = gen_rats_pad_to_pad( DrawPanel, DC, pstart, pend,
|
int icnt = gen_rats_pad_to_pad( DrawPanel, DC, pstart, pend,
|
||||||
num_block, &noconn );
|
num_block, &noconn );
|
||||||
|
|
||||||
/* b - blocks connection (Iteration) */
|
/* b - blocks connection (Iteration) */
|
||||||
while( icnt > 1 )
|
while( icnt > 1 )
|
||||||
|
@ -530,19 +519,13 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
||||||
|
|
||||||
// erase the ratsnest displayed on screen if needed
|
// erase the ratsnest displayed on screen if needed
|
||||||
RATSNEST_ITEM* Chevelu = m_Pcb->m_Ratsnest;
|
RATSNEST_ITEM* Chevelu = m_Pcb->m_Ratsnest;
|
||||||
if( DC )
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
|
||||||
|
|
||||||
for( int ii = m_Pcb->GetNumRatsnests(); ii > 0 && Chevelu; ii--, Chevelu++ )
|
for( int ii = m_Pcb->GetNumRatsnests(); ii > 0 && Chevelu; ii--, Chevelu++ )
|
||||||
{
|
{
|
||||||
if( !g_Show_Ratsnest )
|
if( !g_Show_Ratsnest )
|
||||||
Chevelu->m_Status &= ~CH_VISIBLE;
|
Chevelu->m_Status &= ~CH_VISIBLE;
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC,
|
Chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||||
Chevelu->m_PadStart->m_Pos.x, Chevelu->m_PadStart->m_Pos.y,
|
|
||||||
Chevelu->m_PadEnd->m_Pos.x, Chevelu->m_PadEnd->m_Pos.y,
|
|
||||||
0, g_DesignSettings.m_RatsnestColor );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +552,7 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
|
||||||
* @param netcode if > 0, Display only the ratsnest relative to the correponding net_code
|
* @param netcode if > 0, Display only the ratsnest relative to the correponding net_code
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
RATSNEST_ITEM* Chevelu;
|
RATSNEST_ITEM* Chevelu;
|
||||||
|
|
||||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
|
@ -583,19 +566,13 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
|
||||||
if( Chevelu == NULL )
|
if( Chevelu == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
|
||||||
for( ii = m_Pcb->GetNumRatsnests(); ii > 0; Chevelu++, ii-- )
|
for( ii = m_Pcb->GetNumRatsnests(); ii > 0; Chevelu++, ii-- )
|
||||||
{
|
{
|
||||||
if( ( Chevelu->m_Status & (CH_VISIBLE | CH_ACTIF) ) != (CH_VISIBLE | CH_ACTIF) )
|
if( ( Chevelu->m_Status & (CH_VISIBLE | CH_ACTIF) ) != (CH_VISIBLE | CH_ACTIF) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (net_code <= 0) || ( net_code == Chevelu->GetNet() ) )
|
if( (net_code <= 0) || ( net_code == Chevelu->GetNet() ) )
|
||||||
{
|
Chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC,
|
|
||||||
Chevelu->m_PadStart->m_Pos.x, Chevelu->m_PadStart->m_Pos.y,
|
|
||||||
Chevelu->m_PadEnd->m_Pos.x, Chevelu->m_PadEnd->m_Pos.y,
|
|
||||||
0, g_DesignSettings.m_RatsnestColor );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +598,7 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC, NETIN
|
||||||
* @return blocks not connected count
|
* @return blocks not connected count
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int current_num_block, min_block;
|
int current_num_block, min_block;
|
||||||
RATSNEST_ITEM* chevelu, * min_chevelu;
|
RATSNEST_ITEM* chevelu, * min_chevelu;
|
||||||
|
|
||||||
/* Search a link from a block to an other block */
|
/* Search a link from a block to an other block */
|
||||||
|
@ -644,7 +621,7 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC, NETIN
|
||||||
* we must set its status to ACTIVE and merge the 2 blocks
|
* we must set its status to ACTIVE and merge the 2 blocks
|
||||||
*/
|
*/
|
||||||
min_chevelu->m_Status |= CH_ACTIF;
|
min_chevelu->m_Status |= CH_ACTIF;
|
||||||
current_num_block = min_chevelu->m_PadStart->GetSubRatsnest();
|
current_num_block = min_chevelu->m_PadStart->GetSubRatsnest();
|
||||||
min_block = min_chevelu->m_PadEnd->GetSubRatsnest();
|
min_block = min_chevelu->m_PadEnd->GetSubRatsnest();
|
||||||
|
|
||||||
if( min_block > current_num_block )
|
if( min_block > current_num_block )
|
||||||
|
@ -688,7 +665,7 @@ static int tst_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
|
||||||
* @return new block number
|
* @return new block number
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
D_PAD* pad_start, * pad_end;
|
D_PAD* pad_start, * pad_end;
|
||||||
RATSNEST_ITEM* chevelu;
|
RATSNEST_ITEM* chevelu;
|
||||||
|
|
||||||
for( chevelu = start_rat_list; chevelu < end_rat_list; chevelu++ )
|
for( chevelu = start_rat_list; chevelu < end_rat_list; chevelu++ )
|
||||||
|
@ -732,14 +709,14 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
* if ref_netcode == 0, test all nets, else test only ref_netcode
|
* if ref_netcode == 0, test all nets, else test only ref_netcode
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* chevelu;
|
RATSNEST_ITEM* chevelu;
|
||||||
D_PAD* pad;
|
D_PAD* pad;
|
||||||
int net_code;
|
int net_code;
|
||||||
NETINFO_ITEM* net;
|
NETINFO_ITEM* net;
|
||||||
|
|
||||||
if( m_Pcb->m_Pads.size() == 0 )
|
if( m_Pcb->m_Pads.size() == 0 )
|
||||||
return;
|
return;
|
||||||
if ( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
Build_Board_Ratsnest( DC );
|
Build_Board_Ratsnest( DC );
|
||||||
|
|
||||||
for( net_code = 1; ; net_code++ )
|
for( net_code = 1; ; net_code++ )
|
||||||
|
@ -760,21 +737,21 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
num_block = MAX( num_block, subnet );
|
num_block = MAX( num_block, subnet );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( chevelu = net->m_RatsnestStart; chevelu < net->m_RatsnestEnd; chevelu++ )
|
for( chevelu = net->m_RatsnestStart; chevelu < net->m_RatsnestEnd; chevelu++ )
|
||||||
{
|
{
|
||||||
chevelu->m_Status &= ~CH_ACTIF;
|
chevelu->m_Status &= ~CH_ACTIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a - tst connection between pads */
|
/* a - tst connection between pads */
|
||||||
int ii = tst_rats_pad_to_pad( DrawPanel, DC, num_block,
|
int ii = tst_rats_pad_to_pad( DrawPanel, DC, num_block,
|
||||||
net->m_RatsnestStart, net->m_RatsnestEnd );
|
net->m_RatsnestStart, net->m_RatsnestEnd );
|
||||||
|
|
||||||
/* b - test connexion between blocks (Iteration) */
|
/* b - test connexion between blocks (Iteration) */
|
||||||
while( ii > 1 )
|
while( ii > 1 )
|
||||||
{
|
{
|
||||||
ii = tst_rats_block_to_block( DrawPanel, DC, net );
|
ii = tst_rats_block_to_block( DrawPanel, DC, net );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Pcb->m_NbNoconnect = 0;
|
m_Pcb->m_NbNoconnect = 0;
|
||||||
RATSNEST_ITEM* Chevelu = m_Pcb->m_Ratsnest;
|
RATSNEST_ITEM* Chevelu = m_Pcb->m_Ratsnest;
|
||||||
|
@ -823,21 +800,21 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
||||||
* The ratsnest section must be computed for each new position
|
* The ratsnest section must be computed for each new position
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
D_PAD** pt_liste_pad;
|
D_PAD** pt_liste_pad;
|
||||||
D_PAD** pt_liste_ref;
|
D_PAD** pt_liste_ref;
|
||||||
D_PAD** pt_liste_generale;
|
D_PAD** pt_liste_generale;
|
||||||
D_PAD* pad_ref;
|
D_PAD* pad_ref;
|
||||||
D_PAD* pad_externe;
|
D_PAD* pad_externe;
|
||||||
D_PAD** pt_liste_pad_limite;
|
D_PAD** pt_liste_pad_limite;
|
||||||
D_PAD** pt_start_liste;
|
D_PAD** pt_start_liste;
|
||||||
D_PAD** pt_end_liste;
|
D_PAD** pt_end_liste;
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
RATSNEST_ITEM* local_chevelu;
|
RATSNEST_ITEM* local_chevelu;
|
||||||
static RATSNEST_ITEM* pt_fin_int_chevelu; // End list for "internal" ratsnest
|
static RATSNEST_ITEM* pt_fin_int_chevelu; // End list for "internal" ratsnest
|
||||||
static int nb_int_chevelu; // "internal" ratsnest count
|
static int nb_int_chevelu; // "internal" ratsnest count
|
||||||
int current_net_code;
|
int current_net_code;
|
||||||
int increment, distance; // variables de calcul de ratsnest
|
int increment, distance; // variables de calcul de ratsnest
|
||||||
int pad_pos_X, pad_pos_Y; // True pad position according to the current footprint position
|
int pad_pos_X, pad_pos_Y; // True pad position according to the current footprint position
|
||||||
|
|
||||||
|
|
||||||
if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 0 )
|
if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 0 )
|
||||||
|
@ -983,8 +960,8 @@ calcul_chevelu_ext:
|
||||||
pt_liste_ref = (D_PAD**) adr_lowmem;
|
pt_liste_ref = (D_PAD**) adr_lowmem;
|
||||||
pad_ref = *pt_liste_ref;
|
pad_ref = *pt_liste_ref;
|
||||||
|
|
||||||
current_net_code = pad_ref->GetNet();
|
current_net_code = pad_ref->GetNet();
|
||||||
local_chevelu->m_Lenght = 0x7FFFFFFF;
|
local_chevelu->m_Lenght = 0x7FFFFFFF;
|
||||||
local_chevelu->m_Status = 0;
|
local_chevelu->m_Status = 0;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
for( ii = 0; ii < nb_pads_ref; ii++ )
|
for( ii = 0; ii < nb_pads_ref; ii++ )
|
||||||
|
@ -998,7 +975,7 @@ calcul_chevelu_ext:
|
||||||
nb_local_chevelu++; local_chevelu++;
|
nb_local_chevelu++; local_chevelu++;
|
||||||
}
|
}
|
||||||
increment = 0;
|
increment = 0;
|
||||||
current_net_code = pad_ref->GetNet();
|
current_net_code = pad_ref->GetNet();
|
||||||
local_chevelu->m_Lenght = 0x7FFFFFFF;
|
local_chevelu->m_Lenght = 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,7 +1002,7 @@ calcul_chevelu_ext:
|
||||||
local_chevelu->m_PadStart = pad_ref;
|
local_chevelu->m_PadStart = pad_ref;
|
||||||
local_chevelu->m_PadEnd = pad_externe;
|
local_chevelu->m_PadEnd = pad_externe;
|
||||||
local_chevelu->SetNet( pad_ref->GetNet() );
|
local_chevelu->SetNet( pad_ref->GetNet() );
|
||||||
local_chevelu->m_Lenght = distance;
|
local_chevelu->m_Lenght = distance;
|
||||||
local_chevelu->m_Status = 0;
|
local_chevelu->m_Status = 0;
|
||||||
|
|
||||||
increment = 1;
|
increment = 1;
|
||||||
|
@ -1039,7 +1016,7 @@ calcul_chevelu_ext:
|
||||||
local_chevelu++;
|
local_chevelu++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char*)(local_chevelu + 1); /* the struct pointed by local_chevelu is used
|
return (char*) (local_chevelu + 1); /* the struct pointed by local_chevelu is used
|
||||||
* in temporary computations, so we skip it
|
* in temporary computations, so we skip it
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -1054,7 +1031,7 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* local_chevelu;
|
RATSNEST_ITEM* local_chevelu;
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
if( DC == NULL )
|
if( DC == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -1064,34 +1041,15 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
||||||
local_chevelu = local_liste_chevelu;
|
local_chevelu = local_liste_chevelu;
|
||||||
ii = nb_local_chevelu;
|
ii = nb_local_chevelu;
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
|
||||||
|
|
||||||
while( ii-- > 0 )
|
while( ii-- > 0 )
|
||||||
{
|
{
|
||||||
if( local_chevelu->m_Status & LOCAL_RATSNEST_ITEM )
|
local_chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||||
{
|
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC,
|
|
||||||
local_chevelu->m_PadStart->m_Pos.x - g_Offset_Module.x,
|
|
||||||
local_chevelu->m_PadStart->m_Pos.y - g_Offset_Module.y,
|
|
||||||
local_chevelu->m_PadEnd->m_Pos.x - g_Offset_Module.x,
|
|
||||||
local_chevelu->m_PadEnd->m_Pos.y - g_Offset_Module.y,
|
|
||||||
0, YELLOW );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC,
|
|
||||||
local_chevelu->m_PadStart->m_Pos.x - g_Offset_Module.x,
|
|
||||||
local_chevelu->m_PadStart->m_Pos.y - g_Offset_Module.y,
|
|
||||||
local_chevelu->m_PadEnd->m_Pos.x,
|
|
||||||
local_chevelu->m_PadEnd->m_Pos.y,
|
|
||||||
0, g_DesignSettings.m_RatsnestColor );
|
|
||||||
}
|
|
||||||
local_chevelu++;
|
local_chevelu++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* construction de la liste en mode de calcul rapide pour affichage
|
* construction de la liste en mode de calcul rapide pour affichage
|
||||||
* en temps reel du chevelu d'un pad lors des tracés d'une piste démarrant
|
* en temps reel du chevelu d'un pad lors des tracés d'une piste démarrant
|
||||||
* sur ce pad.
|
* sur ce pad.
|
||||||
|
@ -1102,61 +1060,53 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
||||||
* init (flag)
|
* init (flag)
|
||||||
* = 0 : mise a jour des chevelu
|
* = 0 : mise a jour des chevelu
|
||||||
* <> 0: creation de la liste
|
* <> 0: creation de la liste
|
||||||
* retourne: adresse memoire disponible
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Used by build_ratsnest_pad(): sort function by link lenght (manathan distance)*/
|
/* Buffer to store pads coordinates when creating a track.
|
||||||
static int sort_by_localnetlength( const void* o1, const void* o2 )
|
* these pads are members of the net
|
||||||
|
* and when the mouse is moved, the g_MaxLinksShowed links to neightbors are drawn
|
||||||
|
*/
|
||||||
|
static std::vector <wxPoint> s_RatsnestMouseToPads;
|
||||||
|
static wxPoint s_CursorPos; // Coordinate of the moving point (mouse cursor and end of current track segment)
|
||||||
|
|
||||||
|
/* Used by build_ratsnest_pad(): sort function by link lenght (manhattan distance)*/
|
||||||
|
static bool sort_by_localnetlength( const wxPoint& ref, const wxPoint& compare )
|
||||||
{
|
{
|
||||||
int* ref = (int*) o1;
|
wxPoint deltaref = ref - s_CursorPos;
|
||||||
int* compare = (int*) o2;
|
wxPoint deltacmp = compare - s_CursorPos;
|
||||||
|
|
||||||
int* org = (int*) adr_lowmem; // ref coordinate (todo : change for a betted code: used an external wxPoint variable)
|
// = distance between ref coordinate and pad ref
|
||||||
int ox = *org++;
|
int lengthref = abs( deltaref.x ) + abs( deltaref.y );
|
||||||
int oy = *org++;
|
|
||||||
int lengthref, lengthcmp;
|
|
||||||
|
|
||||||
lengthref = abs( *ref - ox );
|
// distance between ref coordinate and the other pad
|
||||||
ref++;
|
int lengthcmp = abs( deltacmp.x ) + abs( deltacmp.y );
|
||||||
|
|
||||||
lengthref += abs( *ref - oy ); // = distance between ref coordinate and pad ref
|
return lengthref < lengthcmp;
|
||||||
|
|
||||||
lengthcmp = abs( *compare - ox );
|
|
||||||
|
|
||||||
compare++;
|
|
||||||
|
|
||||||
lengthcmp += abs( *compare - oy ); // = distance between ref coordinate and the other pad
|
|
||||||
|
|
||||||
return lengthref - lengthcmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
|
void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
|
||||||
const wxPoint& refpos, bool init )
|
const wxPoint& refpos, bool init )
|
||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
{
|
{
|
||||||
int ii;
|
int current_net_code = 0, conn_number = 0;
|
||||||
int* pt_coord, * base_data;
|
D_PAD* pad_ref = NULL;
|
||||||
int current_net_code = 0, conn_number = 0;
|
|
||||||
D_PAD** padlist;
|
|
||||||
D_PAD* pad_ref = NULL;
|
|
||||||
|
|
||||||
if( ( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( ( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
|| ( (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) == 0 ) )
|
|| ( (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) == 0 ) || ( (m_Pcb->m_Status_Pcb & NET_CODES_OK) == 0 ) )
|
||||||
{
|
{
|
||||||
nb_local_chevelu = 0;
|
s_RatsnestMouseToPads.clear();
|
||||||
return NULL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
base_data = pt_coord = (int*) adr_lowmem;
|
s_CursorPos = refpos;
|
||||||
local_liste_chevelu = (RATSNEST_ITEM*) pt_coord;
|
|
||||||
if( init )
|
if( init )
|
||||||
{
|
{
|
||||||
nb_local_chevelu = 0;
|
s_RatsnestMouseToPads.clear();
|
||||||
if( ref == NULL )
|
if( ref == NULL )
|
||||||
return NULL;
|
return;
|
||||||
|
|
||||||
switch( ref->Type() )
|
switch( ref->Type() )
|
||||||
{
|
{
|
||||||
|
@ -1180,41 +1130,26 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( current_net_code <= 0 )
|
if( current_net_code <= 0 )
|
||||||
return NULL;
|
return;
|
||||||
|
|
||||||
*pt_coord++ = refpos.x;
|
NETINFO_ITEM * net = m_Pcb->FindNet(current_net_code);
|
||||||
*pt_coord++ = refpos.y;
|
if ( net == NULL )
|
||||||
|
return;
|
||||||
if( m_Pcb->m_Ratsnest == NULL )
|
|
||||||
return NULL;
|
// Create a list of pads candidates ( pads not already connected to the current track:
|
||||||
|
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
||||||
padlist = &m_Pcb->m_Pads[0];
|
|
||||||
for( ii = 0; ii < (int) m_Pcb->m_Pads.size(); padlist++, ii++ )
|
|
||||||
{
|
{
|
||||||
D_PAD* pad = *padlist;
|
D_PAD* pad = net->m_ListPad[ii];
|
||||||
if( pad->GetNet() != current_net_code )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( pad == pad_ref )
|
if( pad == pad_ref )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !pad->GetSubNet() || (pad->GetSubNet() != conn_number) )
|
if( !pad->GetSubNet() || (pad->GetSubNet() != conn_number) )
|
||||||
{
|
s_RatsnestMouseToPads.push_back( pad->m_Pos );
|
||||||
*pt_coord = pad->m_Pos.x; pt_coord++;
|
|
||||||
*pt_coord = pad->m_Pos.y; pt_coord++;
|
|
||||||
nb_local_chevelu++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} /* end if Init */
|
} /* end if Init */
|
||||||
else if( nb_local_chevelu )
|
|
||||||
{
|
|
||||||
*pt_coord = refpos.x;
|
|
||||||
*(pt_coord + 1) = refpos.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
qsort( base_data + 2, nb_local_chevelu, 2 * sizeof(int),
|
if( s_RatsnestMouseToPads.size() > 1)
|
||||||
sort_by_localnetlength );
|
sort( s_RatsnestMouseToPads.begin(), s_RatsnestMouseToPads.end(), sort_by_localnetlength );
|
||||||
return pt_coord;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1226,35 +1161,21 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
|
||||||
* Displays a "ratsnest" during track creation
|
* Displays a "ratsnest" during track creation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int* pt_coord;
|
|
||||||
int ii;
|
|
||||||
int refX, refY;
|
|
||||||
|
|
||||||
if( DC == NULL )
|
if( DC == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( s_RatsnestMouseToPads.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( nb_local_chevelu == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( local_liste_chevelu == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
pt_coord = (int*) local_liste_chevelu;
|
|
||||||
|
|
||||||
refX = *pt_coord++;
|
|
||||||
refY = *pt_coord++;
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
for( ii = 0; ii < nb_local_chevelu; ii++ )
|
for( int ii = 0; ii < (int)s_RatsnestMouseToPads.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( ii >= g_MaxLinksShowed )
|
if( ii >= g_MaxLinksShowed )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC, refX, refY, *pt_coord, *(pt_coord + 1),
|
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos.x, s_CursorPos.y,
|
||||||
|
s_RatsnestMouseToPads[ii].x, s_RatsnestMouseToPads[ii].y,
|
||||||
0, YELLOW );
|
0, YELLOW );
|
||||||
pt_coord += 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue