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
7f3bf1be
Commit
7f3bf1be
authored
Jan 31, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing operators==/!= for RN_NODE_PTR.
Moved ClearSimple() functions back to the header file.
parent
7f464814
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
27 deletions
+36
-27
ratsnest_data.cpp
pcbnew/ratsnest_data.cpp
+19
-24
ratsnest_data.h
pcbnew/ratsnest_data.h
+17
-3
No files found.
pcbnew/ratsnest_data.cpp
View file @
7f3bf1be
...
...
@@ -35,7 +35,6 @@
#include <class_track.h>
#include <class_zone.h>
#include <boost/foreach.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/make_shared.hpp>
...
...
@@ -75,10 +74,21 @@ bool sortArea( const RN_POLY& aP1, const RN_POLY& aP2 )
}
bool
operator
==
(
const
RN_NODE_PTR
&
aFirst
,
const
RN_NODE_PTR
&
aSecond
)
{
return
aFirst
->
GetX
()
==
aSecond
->
GetX
()
&&
aFirst
->
GetY
()
==
aSecond
->
GetY
();
}
bool
operator
!=
(
const
RN_NODE_PTR
&
aFirst
,
const
RN_NODE_PTR
&
aSecond
)
{
return
aFirst
->
GetX
()
!=
aSecond
->
GetX
()
||
aFirst
->
GetY
()
!=
aSecond
->
GetY
();
}
bool
isEdgeConnectingNode
(
const
RN_EDGE_PTR
&
aEdge
,
const
RN_NODE_PTR
&
aNode
)
{
return
(
aEdge
->
getSourceNode
().
get
()
==
aNode
.
get
()
)
||
(
aEdge
->
getTargetNode
().
get
()
==
aNode
.
get
()
);
return
aEdge
->
getSourceNode
()
==
aNode
||
aEdge
->
getTargetNode
()
==
aNode
;
}
...
...
@@ -246,7 +256,7 @@ void RN_NET::compute()
return
;
}
else
if
(
boardNodes
.
size
()
==
1
||
boardNodes
.
empty
()
)
// This case is even simpler
else
if
(
boardNodes
.
size
()
<=
1
)
// This case is even simpler
{
m_rnEdges
.
reset
(
new
std
::
vector
<
RN_EDGE_PTR
>
(
0
)
);
...
...
@@ -566,17 +576,18 @@ const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode,
for
(
it
=
nodes
.
begin
(),
itEnd
=
nodes
.
end
();
it
!=
itEnd
;
++
it
)
{
RN_NODE_PTR
baseN
ode
=
*
it
;
RN_NODE_PTR
n
ode
=
*
it
;
// Obviously the distance between node and itself is the shortest,
// that's why we have to skip it
if
(
*
it
!=
aNode
&&
aFilter
(
baseN
ode
)
)
if
(
node
!=
aNode
&&
aFilter
(
n
ode
)
)
{
unsigned
int
distance
=
getDistance
(
*
it
,
aNode
);
unsigned
int
distance
=
getDistance
(
node
,
aNode
);
if
(
distance
<
minDistance
)
{
minDistance
=
distance
;
closest
=
*
it
;
closest
=
node
;
}
}
}
...
...
@@ -706,15 +717,6 @@ void RN_DATA::AddSimple( const BOARD_ITEM* aItem )
}
void
RN_NET
::
ClearSimple
()
{
BOOST_FOREACH
(
const
RN_NODE_PTR
&
node
,
m_simpleNodes
)
node
->
SetFlag
(
false
);
m_simpleNodes
.
clear
();
}
void
RN_NET
::
processZones
()
{
BOOST_FOREACH
(
std
::
deque
<
RN_EDGE_PTR
>&
edges
,
m_zoneConnections
|
boost
::
adaptors
::
map_values
)
...
...
@@ -935,10 +937,3 @@ void RN_DATA::Recalculate( int aNet )
updateNet
(
aNet
);
}
}
void
RN_DATA
::
ClearSimple
()
{
BOOST_FOREACH
(
RN_NET
&
net
,
m_nets
)
net
.
ClearSimple
();
}
pcbnew/ratsnest_data.h
View file @
7f3bf1be
...
...
@@ -37,6 +37,7 @@
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include <boost/foreach.hpp>
class
BOARD
;
class
BOARD_ITEM
;
...
...
@@ -57,6 +58,9 @@ typedef hed::EdgeMST RN_EDGE_MST;
typedef
boost
::
shared_ptr
<
hed
::
EdgeMST
>
RN_EDGE_MST_PTR
;
typedef
hed
::
Triangulation
TRIANGULATOR
;
bool
operator
==
(
const
RN_NODE_PTR
&
aFirst
,
const
RN_NODE_PTR
&
aSecond
);
bool
operator
!=
(
const
RN_NODE_PTR
&
aFirst
,
const
RN_NODE_PTR
&
aSecond
);
///> General interface for filtering out nodes in search functions.
struct
RN_NODE_FILTER
:
public
std
::
unary_function
<
const
RN_NODE_PTR
&
,
bool
>
{
...
...
@@ -83,7 +87,7 @@ struct RN_NODE_COMPARE : std::binary_function<RN_NODE_PTR, RN_NODE_PTR, bool>
{
bool
operator
()(
const
RN_NODE_PTR
&
aNode1
,
const
RN_NODE_PTR
&
aNode2
)
const
{
return
(
aNode1
->
GetX
()
==
aNode2
->
GetX
()
&&
aNode1
->
GetY
()
==
aNode2
->
GetY
()
)
;
return
aNode1
==
aNode2
;
}
};
...
...
@@ -461,7 +465,13 @@ public:
* Function ClearSimple()
* Removes all nodes and edges that are used for displaying ratsnest in simple mode.
*/
void
ClearSimple
();
void
ClearSimple
()
{
BOOST_FOREACH
(
const
RN_NODE_PTR
&
node
,
m_simpleNodes
)
node
->
SetFlag
(
false
);
m_simpleNodes
.
clear
();
}
protected
:
///> Validates edge, ie. modifies source and target nodes for an edge
...
...
@@ -556,7 +566,11 @@ public:
* Function ClearSimple()
* Clears the list of nodes for which ratsnest is drawn in simple mode (one line per node).
*/
void
ClearSimple
();
void
ClearSimple
()
{
BOOST_FOREACH
(
RN_NET
&
net
,
m_nets
)
net
.
ClearSimple
();
}
/**
* Function ProcessBoard()
...
...
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