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
3aa880de
Commit
3aa880de
authored
Jun 29, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pcb_parser for new board, coding standards
parent
06bf0821
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
39 deletions
+60
-39
connect.cpp
pcbnew/connect.cpp
+20
-5
pcb_parser.cpp
pcbnew/pcb_parser.cpp
+40
-34
No files found.
pcbnew/connect.cpp
View file @
3aa880de
...
...
@@ -245,12 +245,13 @@ static bool sortConnectedPointByXthenYCoordinates( const CONNECTED_POINT & aRef,
return
aRef
.
GetPoint
().
x
<
aTst
.
GetPoint
().
x
;
}
void
CONNECTIONS
::
BuildTracksCandidatesList
(
TRACK
*
aBegin
,
TRACK
*
aEnd
)
void
CONNECTIONS
::
BuildTracksCandidatesList
(
TRACK
*
aBegin
,
TRACK
*
aEnd
)
{
m_candidates
.
clear
();
m_firstTrack
=
m_lastTrack
=
aBegin
;
unsigned
ii
=
0
;
// Count candidates ( i.e. end points )
for
(
const
TRACK
*
track
=
aBegin
;
track
;
track
=
track
->
Next
()
)
{
...
...
@@ -260,14 +261,17 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd)
ii
+=
2
;
m_lastTrack
=
track
;
if
(
track
==
aEnd
)
break
;
}
// Build candidate list
m_candidates
.
reserve
(
ii
);
for
(
TRACK
*
track
=
aBegin
;
track
;
track
=
track
->
Next
()
)
{
CONNECTED_POINT
candidate
(
track
,
track
->
GetStart
());
CONNECTED_POINT
candidate
(
track
,
track
->
GetStart
()
);
m_candidates
.
push_back
(
candidate
);
if
(
track
->
Type
()
!=
PCB_VIA_T
)
{
...
...
@@ -285,6 +289,7 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd)
sort
(
m_candidates
.
begin
(),
m_candidates
.
end
(),
sortConnectedPointByXthenYCoordinates
);
}
/* Populates .m_connected with tracks/vias connected to aTrack
* param aTrack = track or via to use as reference
* For calculation time reason, an exhaustive search cannot be made
...
...
@@ -294,7 +299,7 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd)
* because with this constraint we can make a fast search in track list
* m_candidates is expected to be populated by the track candidates ends list
*/
int
CONNECTIONS
::
SearchConnectedTracks
(
const
TRACK
*
aTrack
)
int
CONNECTIONS
::
SearchConnectedTracks
(
const
TRACK
*
aTrack
)
{
int
count
=
0
;
m_connected
.
clear
();
...
...
@@ -308,7 +313,9 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
int
dist_max
=
aTrack
->
GetWidth
()
/
2
;
static
std
::
vector
<
CONNECTED_POINT
*>
tracks_candidates
;
#endif
wxPoint
position
=
aTrack
->
GetStart
();
for
(
int
kk
=
0
;
kk
<
2
;
kk
++
)
{
#ifndef USE_EXTENDED_SEARCH
...
...
@@ -321,8 +328,10 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
{
if
(
m_candidates
[
ii
].
GetTrack
()
==
aTrack
)
continue
;
if
(
m_candidates
[
ii
].
GetPoint
()
!=
position
)
break
;
if
(
(
m_candidates
[
ii
].
GetTrack
()
->
GetLayerSet
()
&
layerMask
).
any
()
)
m_connected
.
push_back
(
m_candidates
[
ii
].
GetTrack
()
);
}
...
...
@@ -332,18 +341,23 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
{
if
(
m_candidates
[
ii
].
GetTrack
()
==
aTrack
)
continue
;
if
(
m_candidates
[
ii
].
GetPoint
()
!=
position
)
break
;
if
(
(
m_candidates
[
ii
].
GetTrack
()
->
GetLayerSet
()
&
layerMask
).
any
()
)
m_connected
.
push_back
(
m_candidates
[
ii
].
GetTrack
()
);
}
}
#else
tracks_candidates
.
clear
();
CollectItemsNearTo
(
tracks_candidates
,
position
,
dist_max
);
for
(
unsigned
ii
=
0
;
ii
<
tracks_candidates
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
tracks_candidates
.
size
();
ii
++
)
{
TRACK
*
ctrack
=
tracks_candidates
[
ii
]
->
GetTrack
();
TRACK
*
ctrack
=
tracks_candidates
[
ii
]
->
GetTrack
();
if
(
!
(
ctrack
->
GetLayerSet
()
&
layerMask
).
any
()
)
continue
;
...
...
@@ -354,6 +368,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
// We have a good candidate: calculate the actual distance
// between ends, which should be <= dist max.
wxPoint
delta
=
tracks_candidates
[
ii
]
->
GetPoint
()
-
position
;
int
dist
=
KiROUND
(
EuclideanNorm
(
delta
)
);
if
(
dist
>
dist_max
)
...
...
pcbnew/pcb_parser.cpp
View file @
3aa880de
...
...
@@ -734,6 +734,7 @@ void PCB_PARSER::parseLayer( LAYER* aLayer ) throw( IO_ERROR, PARSE_ERROR )
}
void
PCB_PARSER
::
parseLayers
()
throw
(
IO_ERROR
,
PARSE_ERROR
)
{
wxCHECK_RET
(
CurTok
()
==
T_layers
,
...
...
@@ -752,50 +753,55 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
parseLayer
(
&
layer
);
if
(
layer
.
m_type
!=
LT_UNDEFINED
)
// it's a copper layer
{
cu
.
push_back
(
layer
);
if
(
layer
.
m_type
==
LT_UNDEFINED
)
// it's a non-copper layer
break
;
//DBG( printf( "cop m_visible:%s\n", cu.back().m_visible ? "true" : "false" );)
}
else
// all non-copper are fixed names, simply look up LAYER_ID.
cu
.
push_back
(
layer
);
// it's copper
}
// All Cu layers are parsed, but not the non-cu layers here.
// The original *.kicad_pcb file format and the inverted
// Cu stack format both have all the Cu layers first, so use this
// trick to handle either. The layer number in the (layers ..)
// s-expression element are ignored.
if
(
cu
.
size
()
)
{
// Rework the layer numbers, which changed when the Cu stack
// was flipped. So we instead use position in the list.
cu
[
cu
.
size
()
-
1
].
m_number
=
B_Cu
;
for
(
unsigned
i
=
0
;
i
<
cu
.
size
()
-
1
;
++
i
)
{
// This is an edge triggered one shot if( test ) that happens on
// the first non copper layer, which follow all the Cu layers.
// This is the feature that the original *.kicad_pcb file format and
// the inverted Cu stack format had in common and is therefore a trick
// used to handle either. The layer number in the (layers ..)
// s-expression element are ignored.
if
(
cu
.
size
()
)
{
// Rework the layer numbers, which changed when the Cu stack
// was flipped. So we instead use position in the list.
cu
[
cu
.
size
()
-
1
].
m_number
=
B_Cu
;
cu
[
i
].
m_number
=
i
;
}
for
(
unsigned
i
=
0
;
i
<
cu
.
size
()
-
1
;
++
i
)
{
cu
[
i
].
m_number
=
i
;
}
for
(
std
::
vector
<
LAYER
>::
const_iterator
it
=
cu
.
begin
();
it
<
cu
.
end
();
++
it
)
{
enabledLayers
.
set
(
it
->
m_number
);
for
(
std
::
vector
<
LAYER
>::
const_iterator
it
=
cu
.
begin
();
it
<
cu
.
end
();
++
it
)
{
enabledLayers
.
set
(
it
->
m_number
);
if
(
it
->
m_visible
)
visibleLayers
.
set
(
it
->
m_number
);
if
(
it
->
m_visible
)
visibleLayers
.
set
(
it
->
m_number
);
m_board
->
SetLayer
(
LAYER_ID
(
it
->
m_number
),
*
it
);
m_board
->
SetLayer
(
LAYER_ID
(
it
->
m_number
),
*
it
)
;
UTF8
name
=
it
->
m_name
;
UTF8
name
=
it
->
m_name
;
m_layerIndices
[
name
]
=
LAYER_ID
(
it
->
m_number
);
m_layerMasks
[
name
]
=
LSET
(
LAYER_ID
(
it
->
m_number
)
);
}
m_layerIndices
[
name
]
=
LAYER_ID
(
it
->
m_number
);
m_layerMasks
[
name
]
=
LSET
(
LAYER_ID
(
it
->
m_number
)
);
}
copperLayerCount
=
cu
.
size
();
}
copperLayerCount
=
cu
.
size
();
if
(
token
!=
T_RIGHT
)
{
// read any non-copper layers
for
(
token
=
NextTok
();
token
!=
T_RIGHT
;
token
=
NextTok
()
)
{
LAYER
layer
;
cu
.
clear
();
// this marks the list as "one time processed".
}
parseLayer
(
&
layer
);
LAYER_ID_MAP
::
const_iterator
it
=
m_layerIndices
.
find
(
UTF8
(
layer
.
m_name
)
);
...
...
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