Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
aef4b6e8
Commit
aef4b6e8
authored
Nov 27, 2007
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcbnew: connect.cpp : english translation of comments
parent
514c63c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
98 deletions
+103
-98
libs.win
libs.win
+1
-1
connect.cpp
pcbnew/connect.cpp
+102
-97
No files found.
libs.win
View file @
aef4b6e8
...
@@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
...
@@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
#Define the wxWidget path (if not found in environment variables):
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
ifndef WXWIN
WXWIN=f:/wxMSW-2.8.
6
WXWIN=f:/wxMSW-2.8.
7
endif
endif
LIBVERSION = 2.8
LIBVERSION = 2.8
...
...
pcbnew/connect.cpp
View file @
aef4b6e8
/*************************************************************/
/***************************************************************************************/
/******************* editeur de PCB **************************/
/* Rastnest calculations: Function to handle existing tracks in rastsnest calculations */
/* traitement du Chevelu: routines de calcul des connexions */
/***************************************************************************************/
/*************************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -13,9 +12,7 @@
...
@@ -13,9 +12,7 @@
#include "protos.h"
#include "protos.h"
/* variables locales */
/* Loca functions */
/* Routines locales */
static
void
propage_equipot
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
);
static
void
propage_equipot
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
);
static
void
calcule_connexite_1_net
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
);
static
void
calcule_connexite_1_net
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
);
static
void
RebuildTrackChain
(
BOARD
*
pcb
);
static
void
RebuildTrackChain
(
BOARD
*
pcb
);
...
@@ -29,10 +26,18 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
...
@@ -29,10 +26,18 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
int
old_val
,
int
new_val
)
int
old_val
,
int
new_val
)
/*****************************************************************/
/*****************************************************************/
/*
/** Function change_equipot()
* Change les num locaux d'equipot old valeur en new valeur
* Used by propage_equipot()
* retourne le nombre de changements
* Change a subnet value to a new value, for tracks ans pads which are connected to corresponding track
* si pt_end_conn = NULL: recherche jusqu'a fin de chaine
* for pads, this is the .m_physical_connexion member which is tested and modified
* for tracks, this is the .m_Sous_Netcode member which is tested and modified
* these members are block numbers (or cluster numbers) for a given net
* @return modification count
* @param old_val = subnet value to modify
* @param new_val = new subnet value for each item whith have old_val as subnet value
* @param pt_start_conn = first track segment to test
* @param pt_end_conn = last track segment to test
* If pt_end_conn = NULL: search is made from pt_start_conn to end of linked list
*/
*/
{
{
TRACK
*
pt_conn
;
TRACK
*
pt_conn
;
...
@@ -83,13 +88,16 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
...
@@ -83,13 +88,16 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
static
void
propage_equipot
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
)
static
void
propage_equipot
(
TRACK
*
pt_start_conn
,
TRACK
*
pt_end_conn
)
/******************************************************************/
/******************************************************************/
/* balaye la liste des SEGMENTS de PISTE
/** Function propage_equipot
* - debut = pt_start_conn
* Test a list of track segment, to create or propagate a sub netcode to pads and segments connected together
* - fin = pt_end_conn (pointe le dernier segment a analyser)
* the track list must be sorted by nets, and all segments from pt_start_conn to pt_end_conn have the save net
* pour attribuer ou propager un numero d'equipotentielle par
* When 2 items are connected (a track to a pad, or a track to an other track) they are grouped in a cluster.
* blocs de connexions existantes
* for pads, this is the .m_physical_connexion member which is a cluster identifier
* la zone balayee est supposee appartenir au meme net, c'est a dire que
* for tracks, this is the .m_Sous_Netcode member which is a cluster identifier
* les segments de pistes sont tries par net_code
* For a given net, if all tracks are created, there is only one cluster.
* but if not all tracks are created, there are are more than one cluster, and some ratsnets will be shown.
* @param pt_start_conn = first track to test
* @param pt_end_conn = last segment to test
*/
*/
{
{
TRACK
*
pt_conn
;
TRACK
*
pt_conn
;
...
@@ -118,34 +126,34 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -118,34 +126,34 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
sous_net_code
=
1
;
sous_net_code
=
1
;
pt_start_conn
->
SetSubNet
(
sous_net_code
);
pt_start_conn
->
SetSubNet
(
sous_net_code
);
/*
debut du calcul de propag
ation */
/*
Start of calcul
ation */
pt_conn
=
pt_start_conn
;
pt_conn
=
pt_start_conn
;
for
(
;
pt_conn
!=
NULL
;
pt_conn
=
(
TRACK
*
)
pt_conn
->
Pnext
)
for
(
;
pt_conn
!=
NULL
;
pt_conn
=
(
TRACK
*
)
pt_conn
->
Pnext
)
{
{
/*
Traitement des connexions a
pads */
/*
First: handling connections to
pads */
PtStruct
=
pt_conn
->
start
;
PtStruct
=
pt_conn
->
start
;
/*
la connexion debute sur 1
pad */
/*
The segment starts on a
pad */
if
(
PtStruct
&&
(
PtStruct
->
Type
()
==
TYPEPAD
)
)
if
(
PtStruct
&&
(
PtStruct
->
Type
()
==
TYPEPAD
)
)
{
{
pt_pad
=
(
D_PAD
*
)
PtStruct
;
pt_pad
=
(
D_PAD
*
)
PtStruct
;
if
(
pt_conn
->
GetSubNet
()
)
/*
la connexion fait deja partie d'une chaine
*/
if
(
pt_conn
->
GetSubNet
()
)
/*
the track segment is already a cluster member
*/
{
{
if
(
pt_pad
->
m_physical_connexion
>
0
)
/*
le pad fait aussi partie d'une chaine
*/
if
(
pt_pad
->
m_physical_connexion
>
0
)
/*
The pad is already a cluster member, so we can merge the 2 clusters
*/
{
{
change_equipot
(
pt_start_conn
,
pt_end_conn
,
change_equipot
(
pt_start_conn
,
pt_end_conn
,
pt_pad
->
m_physical_connexion
,
pt_conn
->
GetSubNet
()
);
pt_pad
->
m_physical_connexion
,
pt_conn
->
GetSubNet
()
);
}
}
else
else
/* The pad is not yet attached to a cluster , so we can add this pad to the cluster */
pt_pad
->
m_physical_connexion
=
pt_conn
->
GetSubNet
();
pt_pad
->
m_physical_connexion
=
pt_conn
->
GetSubNet
();
}
}
else
/* la connexion ne fait pas partie encore d'une chaine
*/
else
/* the track segment is not attached to a cluster
*/
{
{
if
(
pt_pad
->
m_physical_connexion
>
0
)
if
(
pt_pad
->
m_physical_connexion
>
0
)
/* it is connected to a pad in a cluster, merge this track */
{
{
pt_conn
->
SetSubNet
(
pt_pad
->
m_physical_connexion
);
pt_conn
->
SetSubNet
(
pt_pad
->
m_physical_connexion
);
}
}
else
else
/* it is connected to a pad not in a cluster, so we must create a new cluster (only with the 2 items: the track and the pad) */
{
{
sous_net_code
++
;
sous_net_code
++
;
pt_conn
->
SetSubNet
(
sous_net_code
);
pt_conn
->
SetSubNet
(
sous_net_code
);
...
@@ -156,7 +164,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -156,7 +164,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
PtStruct
=
pt_conn
->
end
;
PtStruct
=
pt_conn
->
end
;
if
(
PtStruct
&&
(
PtStruct
->
Type
()
==
TYPEPAD
)
)
if
(
PtStruct
&&
(
PtStruct
->
Type
()
==
TYPEPAD
)
)
/*
la connexion finit sur 1
pad */
/*
The segment end on a
pad */
{
{
pt_pad
=
(
D_PAD
*
)
PtStruct
;
pt_pad
=
(
D_PAD
*
)
PtStruct
;
if
(
pt_conn
->
GetSubNet
()
)
if
(
pt_conn
->
GetSubNet
()
)
...
@@ -185,32 +193,32 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -185,32 +193,32 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
}
}
/*
traitement des connexions entre
segments */
/*
Test connections between
segments */
PtStruct
=
pt_conn
->
start
;
PtStruct
=
pt_conn
->
start
;
if
(
PtStruct
&&
(
PtStruct
->
Type
()
!=
TYPEPAD
)
)
if
(
PtStruct
&&
(
PtStruct
->
Type
()
!=
TYPEPAD
)
)
{
{
/*
debut sur une autre piste
*/
/*
The segment starts on an other track
*/
pt_autre_piste
=
(
TRACK
*
)
PtStruct
;
pt_autre_piste
=
(
TRACK
*
)
PtStruct
;
if
(
pt_conn
->
GetSubNet
()
)
/* La connexion fait deja partie d'un block
*/
if
(
pt_conn
->
GetSubNet
()
)
/* the track segment is already a cluster member
*/
{
{
if
(
pt_autre_piste
->
GetSubNet
()
)
if
(
pt_autre_piste
->
GetSubNet
()
)
/* The other track is already a cluster member, so we can merge the 2 clusters */
{
{
change_equipot
(
pt_start_conn
,
pt_end_conn
,
change_equipot
(
pt_start_conn
,
pt_end_conn
,
pt_autre_piste
->
GetSubNet
(),
pt_conn
->
GetSubNet
()
);
pt_autre_piste
->
GetSubNet
(),
pt_conn
->
GetSubNet
()
);
}
}
else
else
/* The other track is not yet attached to a cluster , so we can add this other track to the cluster */
{
{
pt_autre_piste
->
SetSubNet
(
pt_conn
->
GetSubNet
()
);
pt_autre_piste
->
SetSubNet
(
pt_conn
->
GetSubNet
()
);
}
}
}
}
else
/* La connexion ne fait partie d'aucun block
*/
else
/* the track segment is not yet attached to a cluster
*/
{
{
if
(
pt_autre_piste
->
GetSubNet
()
)
if
(
pt_autre_piste
->
GetSubNet
()
)
/* The other track is already a cluster member, so we can add the segment to the cluster */
{
{
pt_conn
->
SetSubNet
(
pt_autre_piste
->
GetSubNet
()
);
pt_conn
->
SetSubNet
(
pt_autre_piste
->
GetSubNet
()
);
}
}
else
else
/* it is connected to an other segment not in a cluster, so we must create a new cluster (only with the 2 track segments) */
{
{
sous_net_code
++
;
sous_net_code
++
;
pt_conn
->
SetSubNet
(
sous_net_code
);
pt_conn
->
SetSubNet
(
sous_net_code
);
...
@@ -219,13 +227,12 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -219,13 +227,12 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
}
}
}
}
PtStruct
=
pt_conn
->
end
;
PtStruct
=
pt_conn
->
end
;
// Do the same calculations for the segment end point
if
(
PtStruct
&&
(
PtStruct
->
Type
()
!=
TYPEPAD
)
)
if
(
PtStruct
&&
(
PtStruct
->
Type
()
!=
TYPEPAD
)
)
{
{
/* fin connectee a une autre piste */
pt_autre_piste
=
(
TRACK
*
)
PtStruct
;
pt_autre_piste
=
(
TRACK
*
)
PtStruct
;
if
(
pt_conn
->
GetSubNet
()
)
/* La connexion fait deja partie d'un block
*/
if
(
pt_conn
->
GetSubNet
()
)
/* the track segment is already a cluster member
*/
{
{
if
(
pt_autre_piste
->
GetSubNet
()
)
if
(
pt_autre_piste
->
GetSubNet
()
)
{
{
...
@@ -235,7 +242,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -235,7 +242,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
else
else
pt_autre_piste
->
SetSubNet
(
pt_conn
->
GetSubNet
()
);
pt_autre_piste
->
SetSubNet
(
pt_conn
->
GetSubNet
()
);
}
}
else
/* La connexion ne fait partie d'aucun block
*/
else
/* the track segment is not yet attached to a cluster
*/
{
{
if
(
pt_autre_piste
->
GetSubNet
()
)
if
(
pt_autre_piste
->
GetSubNet
()
)
{
{
...
@@ -259,10 +266,12 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -259,10 +266,12 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
void
WinEDA_BasePcbFrame
::
test_connexions
(
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
test_connexions
(
wxDC
*
DC
)
/***************************************************/
/***************************************************/
/*
/** Function testing the connections relative to all nets
* Routine recherchant les connexions deja faites et mettant a jour
* This function update le status du chevelu ( flag CH_ACTIF = 0 if a connection is found, = 1 else)
* le status du chevelu ( Bit CH_ACTIF mis a 0 si connexion trouvee
* track segments are assumed to be sorted by net codes.
* Les pistes sont supposees etre triees par ordre de net_code croissant
* This is the case because when a new track is added, it is put in the linked link according to its net code.
* and when nets are changed (when a new netlist is read) tracks are sorted before using this function
* @param DC = current Device Context
*/
*/
{
{
TRACK
*
pt_start_conn
,
*
pt_end_conn
;
TRACK
*
pt_start_conn
,
*
pt_end_conn
;
...
@@ -270,31 +279,23 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
...
@@ -270,31 +279,23 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
LISTE_PAD
*
pt_pad
;
LISTE_PAD
*
pt_pad
;
int
current_net_code
;
int
current_net_code
;
/*
Etablissement des equipotentielles vraie
s */
/*
Clear the cluster identifier for all pad
s */
pt_pad
=
m_Pcb
->
m_Pads
;
pt_pad
=
m_Pcb
->
m_Pads
;
for
(
ii
=
0
;
ii
<
m_Pcb
->
m_NbPads
;
ii
++
,
pt_pad
++
)
for
(
ii
=
0
;
ii
<
m_Pcb
->
m_NbPads
;
ii
++
,
pt_pad
++
)
{
{
(
*
pt_pad
)
->
m_physical_connexion
=
0
;
(
*
pt_pad
)
->
m_physical_connexion
=
0
;
}
}
////////////////////////////
/* Test existing connections net by net */
// Calcul de la connexite //
pt_start_conn
=
m_Pcb
->
m_Track
;
// this is the first segment of the first net
////////////////////////////
/* Les pointeurs .start et .end sont mis a jour, si la
* connexion est du type segment a segment
*/
pt_start_conn
=
m_Pcb
->
m_Track
;
while
(
pt_start_conn
!=
NULL
)
while
(
pt_start_conn
!=
NULL
)
{
{
current_net_code
=
pt_start_conn
->
GetNet
();
current_net_code
=
pt_start_conn
->
GetNet
();
// this is the current net because pt_start_conn is the first segment of the net
pt_end_conn
=
pt_start_conn
->
GetEndNetCode
(
current_net_code
);
pt_end_conn
=
pt_start_conn
->
GetEndNetCode
(
current_net_code
);
// this is the last segment of the current net
/* Calcul des connexions type segment du net courant */
calcule_connexite_1_net
(
pt_start_conn
,
pt_end_conn
);
calcule_connexite_1_net
(
pt_start_conn
,
pt_end_conn
);
pt_start_conn
=
(
TRACK
*
)
pt_end_conn
->
Pnext
;
pt_start_conn
=
(
TRACK
*
)
pt_end_conn
->
Pnext
;
// this is now the first segment of the next net
}
}
return
;
return
;
...
@@ -305,8 +306,10 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
...
@@ -305,8 +306,10 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
void
WinEDA_BasePcbFrame
::
test_1_net_connexion
(
wxDC
*
DC
,
int
net_code
)
void
WinEDA_BasePcbFrame
::
test_1_net_connexion
(
wxDC
*
DC
,
int
net_code
)
/*************************************************************************/
/*************************************************************************/
/*
/** Function testing the connections relative to a given net
* Routine recherchant les connexions deja faites relatives a 1 net
* track segments are assumed to be sorted by net codes
* @param DC = current Device Context
* @param net_code = net code to test
*/
*/
{
{
TRACK
*
pt_start_conn
,
*
pt_end_conn
;
TRACK
*
pt_start_conn
,
*
pt_end_conn
;
...
@@ -333,7 +336,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
...
@@ -333,7 +336,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
(
*
pt_pad
)
->
m_physical_connexion
=
0
;
(
*
pt_pad
)
->
m_physical_connexion
=
0
;
}
}
/*
Determination des limites du net
*/
/*
Search for the first and the last segment relative to the given net code
*/
if
(
m_Pcb
->
m_Track
)
if
(
m_Pcb
->
m_Track
)
{
{
pt_end_conn
=
NULL
;
pt_end_conn
=
NULL
;
...
@@ -348,10 +351,10 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
...
@@ -348,10 +351,10 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
}
}
}
}
/* Test
des chevelus
*/
/* Test
the rastnest for this net
*/
nb_net_noconnect
=
Test_1_Net_Ratsnest
(
DC
,
net_code
);
nb_net_noconnect
=
Test_1_Net_Ratsnest
(
DC
,
net_code
);
/*
Affichage des resulta
ts */
/*
Display resul
ts */
msg
.
Printf
(
wxT
(
"links %d nc %d net:nc %d"
),
msg
.
Printf
(
wxT
(
"links %d nc %d net:nc %d"
),
m_Pcb
->
m_NbLinks
,
m_Pcb
->
GetNumNoconnect
(),
m_Pcb
->
m_NbLinks
,
m_Pcb
->
GetNumNoconnect
(),
nb_net_noconnect
);
nb_net_noconnect
);
...
@@ -395,7 +398,7 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -395,7 +398,7 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
/* Update connections type track to track */
/* Update connections type track to track */
for
(
Track
=
pt_start_conn
;
Track
!=
NULL
;
Track
=
(
TRACK
*
)
Track
->
Pnext
)
for
(
Track
=
pt_start_conn
;
Track
!=
NULL
;
Track
=
(
TRACK
*
)
Track
->
Pnext
)
{
{
if
(
Track
->
Type
()
==
TYPEVIA
)
// A via can connect many tracks, we must search for all track segments in this net
if
(
Track
->
Type
()
==
TYPEVIA
)
// A via can connect many tracks, we must search for all track segments in this net
{
{
TRACK
*
pt_segm
;
TRACK
*
pt_segm
;
int
layermask
=
Track
->
ReturnMaskLayer
();
int
layermask
=
Track
->
ReturnMaskLayer
();
...
@@ -419,12 +422,12 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -419,12 +422,12 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
}
}
}
}
if
(
Track
->
start
==
NULL
)
// end track not already connected, search a connection
if
(
Track
->
start
==
NULL
)
// end track not already connected, search a connection
{
{
Track
->
start
=
Locate_Piste_Connectee
(
Track
,
Track
,
pt_end_conn
,
START
);
Track
->
start
=
Locate_Piste_Connectee
(
Track
,
Track
,
pt_end_conn
,
START
);
}
}
if
(
Track
->
end
==
NULL
)
// end track not already connected, search a connection
if
(
Track
->
end
==
NULL
)
// end track not already connected, search a connection
{
{
Track
->
end
=
Locate_Piste_Connectee
(
Track
,
Track
,
pt_end_conn
,
END
);
Track
->
end
=
Locate_Piste_Connectee
(
Track
,
Track
,
pt_end_conn
,
END
);
}
}
...
@@ -443,19 +446,20 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
...
@@ -443,19 +446,20 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn )
static
D_PAD
*
SuperFast_Locate_Pad_Connecte
(
BOARD
*
pcb
,
LISTE_PAD
*
pt_liste
,
static
D_PAD
*
SuperFast_Locate_Pad_Connecte
(
BOARD
*
pcb
,
LISTE_PAD
*
pt_liste
,
int
px
,
int
py
,
int
masque_layer
)
int
px
,
int
py
,
int
masque_layer
)
/******************************************************************************/
/******************************************************************************/
/* recherche le pad connecte a l'extremite de la piste de coord px, py
* parametres d'appel:
/** Function SuperFast_Locate_Pad_Connecte
* px, py = coord du point tst
* Locate the pad connected to a track ended at coord px, py
* masque_layer = couche(s) de connexion
* A track is seen as connected if the px, py position is same as the pad position
* pt_liste = adresse de la liste des pointeurs de pads, tels que
* @param px = reference X coordinate
* apparaissant apres build_liste_pad, mais classee par position X
* @param py = reference Y coordinate
* de pads croissantes.
* @param masque_layer = Layers (bit to bit) to consider
* retourne : pointeur sur le pad connecte
* @param pt_liste = Pointers to pads buffer
* la routine travaille par dichotomie sur la liste des pads tries par pos X
* This buffer is a list like the list created by build_liste_pad, but sorted by increasing X pad coordinate
* croissante, elle est donc beaucoup plus rapide que Fast_Locate_Pad_connecte,
* @return : pointer on the connected pad
* mais implique le calcul de cette liste.
* This function uses a fast search in this sorted pad list and it is faster than Fast_Locate_Pad_connecte(),
* But this sorted pad list must be built before calling this function.
*
*
* (
la liste placee en m_Pcb->m_Pads et elle triee par netcodes croissants
)
* (
Note: The usual pad list (created by build_liste_pad) m_Pcb->m_Pads is sorted by increasing netcodes
)
*/
*/
{
{
D_PAD
*
pad
;
D_PAD
*
pad
;
...
@@ -474,14 +478,14 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
...
@@ -474,14 +478,14 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
if
(
(
ii
&
1
)
&&
(
ii
>
1
)
)
if
(
(
ii
&
1
)
&&
(
ii
>
1
)
)
nb_pad
++
;
nb_pad
++
;
if
(
pad
->
m_Pos
.
x
<
px
)
/*
on doit chercher plus loin
*/
if
(
pad
->
m_Pos
.
x
<
px
)
/*
Must search after this item
*/
{
{
ptr_pad
+=
nb_pad
;
ptr_pad
+=
nb_pad
;
if
(
ptr_pad
>
lim
)
if
(
ptr_pad
>
lim
)
ptr_pad
=
lim
;
ptr_pad
=
lim
;
continue
;
continue
;
}
}
if
(
pad
->
m_Pos
.
x
>
px
)
/*
on doit chercher moins loin
*/
if
(
pad
->
m_Pos
.
x
>
px
)
/*
Must search before this item
*/
{
{
ptr_pad
-=
nb_pad
;
ptr_pad
-=
nb_pad
;
if
(
ptr_pad
<
pt_liste
)
if
(
ptr_pad
<
pt_liste
)
...
@@ -489,9 +493,9 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
...
@@ -489,9 +493,9 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
continue
;
continue
;
}
}
if
(
pad
->
m_Pos
.
x
==
px
)
/*
zone de classement trouve
e */
if
(
pad
->
m_Pos
.
x
==
px
)
/*
A suitable block is found (X coordinate matches the px reference: but wue must matches the Y coordinat
e */
{
{
/*
recherche du debut de la zone
*/
/*
Search the beginning of the block
*/
while
(
ptr_pad
>=
pt_liste
)
while
(
ptr_pad
>=
pt_liste
)
{
{
pad
=
*
ptr_pad
;
pad
=
*
ptr_pad
;
...
@@ -501,22 +505,22 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
...
@@ -501,22 +505,22 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* pcb, LISTE_PAD* pt_liste,
break
;
break
;
}
}
ptr_pad
++
;
/* p
ointe depart de zone a
pad->m_Pos.x = px */
ptr_pad
++
;
/* p
tr_pad = first pad which have
pad->m_Pos.x = px */
for
(
;
;
ptr_pad
++
)
for
(
;
;
ptr_pad
++
)
{
{
if
(
ptr_pad
>
lim
)
if
(
ptr_pad
>
lim
)
return
NULL
;
/*
hors zone
*/
return
NULL
;
/*
outside suitable block
*/
pad
=
*
ptr_pad
;
pad
=
*
ptr_pad
;
if
(
pad
->
m_Pos
.
x
!=
px
)
if
(
pad
->
m_Pos
.
x
!=
px
)
return
NULL
;
/*
hors zone
*/
return
NULL
;
/*
outside suitable block
*/
if
(
pad
->
m_Pos
.
y
!=
py
)
if
(
pad
->
m_Pos
.
y
!=
py
)
continue
;
continue
;
/*
Pad peut-etre trouve ici: il doit etre sur la bonne couche
*/
/*
A Pad if found here: but it must mach the layer
*/
if
(
pad
->
m_Masque_Layer
&
masque_layer
)
if
(
pad
->
m_Masque_Layer
&
masque_layer
)
// Matches layer => a connected pad is found !
return
pad
;
return
pad
;
}
}
}
}
...
@@ -560,10 +564,10 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -560,10 +564,10 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
/********************************************************************/
/********************************************************************/
/* search connections between tracks and pads, and propagate pad net codes to the track segments
/* search connections between tracks and pads, and propagate pad net codes to the track segments
* This is a 2 pass computation.
* This is a 2 pass computation.
* The pad netcodes are assumed to be initialized.
* The pad netcodes are assumed to be initialized.
* First:
* First:
* We search a connection between a track segment and a pad: if found : this segment netcode is set to the pad netcode
* We search a connection between a track segment and a pad: if found : this segment netcode is set to the pad netcode
*/
*/
{
{
TRACK
*
pt_piste
,
TRACK
*
pt_piste
,
...
@@ -605,7 +609,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -605,7 +609,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
}
}
/* First pass: search connection between a track segment and a pad.
/* First pass: search connection between a track segment and a pad.
* if found, set the track net code to the pad netcode
* if found, set the track net code to the pad netcode
*/
*/
pt_piste
=
m_Pcb
->
m_Track
;
pt_piste
=
m_Pcb
->
m_Track
;
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
...
@@ -648,7 +652,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -648,7 +652,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
/* the .start et .end member pointers are updated, only if NULLs
/* the .start et .end member pointers are updated, only if NULLs
* (if not nuls, the end is already connected to a pad).
* (if not nuls, the end is already connected to a pad).
* the connection (if found) is between segments
* the connection (if found) is between segments
* when a track has a net code and the other has a null net code, the null net code is changed
* when a track has a net code and the other has a null net code, the null net code is changed
*/
*/
if
(
affiche
)
if
(
affiche
)
Affiche_1_Parametre
(
this
,
POS_AFF_CHREF
,
wxEmptyString
,
wxT
(
"Conn Segm"
),
a_color
);
Affiche_1_Parametre
(
this
,
POS_AFF_CHREF
,
wxEmptyString
,
wxT
(
"Conn Segm"
),
a_color
);
...
@@ -782,8 +786,8 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -782,8 +786,8 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
/*
/*
*
routine de tri de connexion utilisee par la fonction QSORT
*
Sort function for track segments used in RebuildTrackChain() (for the qsort C function)
*
le tri est fait par numero de net
*
The sorting is made by net code
*/
*/
int
Sort_By_NetCode
(
TRACK
**
pt_ref
,
TRACK
**
pt_compare
)
int
Sort_By_NetCode
(
TRACK
**
pt_ref
,
TRACK
**
pt_compare
)
{
{
...
@@ -798,8 +802,9 @@ int Sort_By_NetCode( TRACK** pt_ref, TRACK** pt_compare )
...
@@ -798,8 +802,9 @@ int Sort_By_NetCode( TRACK** pt_ref, TRACK** pt_compare )
static
void
RebuildTrackChain
(
BOARD
*
pcb
)
static
void
RebuildTrackChain
(
BOARD
*
pcb
)
/*****************************************/
/*****************************************/
/* Recalcule le chainage des pistes pour que le chainage soit fait par
/** Function RebuildTrackChain()
* netcodes croissants
* @param pcb = board to rebuild
* Rebuild the track segment linked list in order to have a chain sorted by increasing netcodes
*/
*/
{
{
TRACK
*
Track
,
**
Liste
;
TRACK
*
Track
,
**
Liste
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment