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
79631def
Commit
79631def
authored
Jun 03, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved ratsnest updating in GAL.
parent
2af3e5f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
15 deletions
+54
-15
class_board_connected_item.cpp
pcbnew/class_board_connected_item.cpp
+17
-4
netlist.cpp
pcbnew/netlist.cpp
+7
-2
ratsnest_data.cpp
pcbnew/ratsnest_data.cpp
+30
-9
No files found.
pcbnew/class_board_connected_item.cpp
View file @
79631def
...
...
@@ -34,6 +34,8 @@
#include <class_board.h>
#include <class_board_item.h>
#include <ratsnest_data.h>
BOARD_CONNECTED_ITEM
::
BOARD_CONNECTED_ITEM
(
BOARD_ITEM
*
aParent
,
KICAD_T
idtype
)
:
BOARD_ITEM
(
aParent
,
idtype
),
m_netinfo
(
&
NETINFO_LIST
::
ORPHANED
),
m_Subnet
(
0
),
m_ZoneSubnet
(
0
)
...
...
@@ -53,18 +55,29 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem )
void
BOARD_CONNECTED_ITEM
::
SetNetCode
(
int
aNetCode
)
{
BOARD
*
board
=
GetBoard
();
NETINFO_ITEM
*
oldNetInfo
=
m_netinfo
;
NETINFO_ITEM
*
newNetInfo
;
if
(
board
)
{
m_neti
nfo
=
board
->
FindNet
(
aNetCode
);
newNetI
nfo
=
board
->
FindNet
(
aNetCode
);
// The requested net does not exist, mark it as unconnected
if
(
m_neti
nfo
==
NULL
)
m_neti
nfo
=
board
->
FindNet
(
NETINFO_LIST
::
UNCONNECTED
);
if
(
newNetI
nfo
==
NULL
)
newNetI
nfo
=
board
->
FindNet
(
NETINFO_LIST
::
UNCONNECTED
);
}
else
{
// There is no board that contains list of nets, the item is orphaned
m_netinfo
=
&
NETINFO_LIST
::
ORPHANED
;
newNetInfo
=
&
NETINFO_LIST
::
ORPHANED
;
}
// Update ratsnest, if necessary
if
(
oldNetInfo
!=
newNetInfo
&&
board
)
{
board
->
GetRatsnest
()
->
Remove
(
this
);
m_netinfo
=
newNetInfo
;
board
->
GetRatsnest
()
->
Add
(
this
);
}
}
...
...
pcbnew/netlist.cpp
View file @
79631def
...
...
@@ -44,6 +44,7 @@
#include <class_board.h>
#include <class_module.h>
#include <ratsnest_data.h>
#include <pcbnew.h>
#include <io_mgr.h>
...
...
@@ -121,7 +122,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
for
(
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
module
->
RunOnChildren
(
boost
::
bind
(
&
KIGFX
::
VIEW
::
Add
,
view
,
_1
)
);
GetGalCanvas
()
->
GetView
()
->
Add
(
module
);
view
->
Add
(
module
);
}
if
(
aDeleteUnconnectedTracks
&&
GetBoard
()
->
m_Track
)
...
...
@@ -131,7 +132,11 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
}
// Rebuild the board connectivity:
Compile_Ratsnest
(
NULL
,
true
);
if
(
IsGalCanvasActive
()
)
GetBoard
()
->
GetRatsnest
()
->
Recalculate
();
else
Compile_Ratsnest
(
NULL
,
true
);
SetMsgPanel
(
GetBoard
()
);
m_canvas
->
Refresh
();
}
...
...
pcbnew/ratsnest_data.cpp
View file @
79631def
...
...
@@ -841,8 +841,7 @@ void RN_DATA::Add( const BOARD_ITEM* aItem )
if
(
net
<
1
)
// do not process unconnected items
return
;
// Autoresize
if
(
net
>=
(
int
)
m_nets
.
size
()
)
if
(
net
>=
(
int
)
m_nets
.
size
()
)
// Autoresize
m_nets
.
resize
(
net
+
1
);
}
else
if
(
aItem
->
Type
()
==
PCB_MODULE_T
)
...
...
@@ -851,11 +850,11 @@ void RN_DATA::Add( const BOARD_ITEM* aItem )
for
(
const
D_PAD
*
pad
=
module
->
Pads
().
GetFirst
();
pad
;
pad
=
pad
->
Next
()
)
{
net
=
pad
->
GetNetCode
();
if
(
net
<
1
)
// do not process unconnected items
continue
;
// Autoresize
if
(
net
>=
(
int
)
m_nets
.
size
()
)
if
(
net
>=
(
int
)
m_nets
.
size
()
)
// Autoresize
m_nets
.
resize
(
net
+
1
);
m_nets
[
net
].
AddItem
(
pad
);
...
...
@@ -897,8 +896,19 @@ void RN_DATA::Remove( const BOARD_ITEM* aItem )
if
(
aItem
->
IsConnected
()
)
{
net
=
static_cast
<
const
BOARD_CONNECTED_ITEM
*>
(
aItem
)
->
GetNetCode
();
if
(
net
<
1
)
// do not process unconnected items
return
;
#ifdef NDEBUG
if
(
net
>=
(
int
)
m_nets
.
size
()
)
// Autoresize
{
m_nets
.
resize
(
net
+
1
);
return
;
// if it was resized, then surely the item had not been added before
}
#endif
assert
(
net
<
(
int
)
m_nets
.
size
()
);
}
else
if
(
aItem
->
Type
()
==
PCB_MODULE_T
)
{
...
...
@@ -906,9 +916,20 @@ void RN_DATA::Remove( const BOARD_ITEM* aItem )
for
(
const
D_PAD
*
pad
=
module
->
Pads
().
GetFirst
();
pad
;
pad
=
pad
->
Next
()
)
{
net
=
pad
->
GetNetCode
();
if
(
net
<
1
)
// do not process unconnected items
continue
;
#ifdef NDEBUG
if
(
net
>=
(
int
)
m_nets
.
size
()
)
// Autoresize
{
m_nets
.
resize
(
net
+
1
);
return
;
// if it was resized, then surely the item had not been added before
}
#endif
assert
(
net
<
(
int
)
m_nets
.
size
()
);
m_nets
[
net
].
RemoveItem
(
pad
);
}
...
...
@@ -993,14 +1014,14 @@ void RN_DATA::ProcessBoard()
void
RN_DATA
::
Recalculate
(
int
aNet
)
{
if
(
m_board
->
GetNetCount
()
>
m_nets
.
size
()
)
m_nets
.
resize
(
m_board
->
GetNetCount
()
);
unsigned
int
netCount
=
m_board
->
GetNetCount
();
if
(
netCount
>
m_nets
.
size
()
)
m_nets
.
resize
(
netCount
);
if
(
aNet
<
0
)
// Recompute everything
{
unsigned
int
i
,
netCount
;
netCount
=
m_board
->
GetNetCount
();
unsigned
int
i
;
#ifdef USE_OPENMP
#pragma omp parallel shared(netCount) private(i)
{
...
...
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