kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #25967
PNS router patches batch #1
Hello,
as part of my efforts on the pns-router some refactoring patches are
attached. Prefix-numbers indicate the patch order.
The router is moved into namespace PNS, some places are decorated with
unique_ptr usage, some code quality improvements and then some
refactorings in preparation for future improvements which are in the
pipeline.
A batch of experimental patches will follow shortly. My sincere hopes of
not breaking anything are attached implicitly.
Cheers!
Michael
>From 50a9e68a57b8b8b276cd6c32063213bc8e2040a2 Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 20:36:05 +0200
Subject: [PATCH] Make the segment-ref container a true member of PNS::LINE
improve const correctness
return segment container by ref
change client code accordingly
---
pcbnew/router/pns_line.cpp | 113 +++++++++++++++++---------------------
pcbnew/router/pns_line.h | 38 ++++++-------
pcbnew/router/pns_line_placer.cpp | 4 +-
pcbnew/router/pns_node.cpp | 6 +-
pcbnew/router/pns_optimizer.cpp | 7 +--
pcbnew/router/pns_shove.cpp | 16 ++----
pcbnew/router/pns_topology.cpp | 10 ++--
7 files changed, 82 insertions(+), 112 deletions(-)
diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp
index 0b7affd..0d8ce01 100644
--- a/pcbnew/router/pns_line.cpp
+++ b/pcbnew/router/pns_line.cpp
@@ -54,7 +54,6 @@ LINE::LINE( const LINE& aOther ) :
LINE::~LINE()
{
- delete m_segmentRefs;
}
@@ -88,21 +87,16 @@ void LINE::Mark( int aMarker )
{
m_marker = aMarker;
- if( m_segmentRefs )
- {
- for( SEGMENT* s : *m_segmentRefs )
- s->Mark( aMarker );
- }
+ for( SEGMENT* s : m_segmentRefs )
+ s->Mark( aMarker );
+
}
void LINE::Unmark()
{
- if( m_segmentRefs )
- {
- for( SEGMENT* s : *m_segmentRefs )
- s->Unmark();
- }
+ for( SEGMENT* s : m_segmentRefs )
+ s->Unmark();
m_marker = 0;
}
@@ -112,12 +106,9 @@ int LINE::Marker() const
{
int marker = m_marker;
- if( m_segmentRefs )
+ for( SEGMENT* s : m_segmentRefs )
{
- for( SEGMENT* s : *m_segmentRefs )
- {
- marker |= s->Marker();
- }
+ marker |= s->Marker();
}
return marker;
@@ -126,14 +117,7 @@ int LINE::Marker() const
void LINE::copyLinks( const LINE* aParent )
{
- if( aParent->m_segmentRefs == NULL )
- {
- m_segmentRefs = NULL;
- return;
- }
-
- m_segmentRefs = new SEGMENT_REFS();
- *m_segmentRefs = *aParent->m_segmentRefs;
+ m_segmentRefs = aParent->m_segmentRefs;
}
@@ -151,7 +135,7 @@ SEGMENT* SEGMENT::Clone() const
}
-int LINE::CountCorners( int aAngles )
+int LINE::CountCorners( int aAngles ) const
{
int count = 0;
@@ -269,9 +253,7 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
}
-void LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
- SHAPE_LINE_CHAIN& aPath,
- bool aCw ) const
+void LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPath, bool aCw ) const
{
SHAPE_LINE_CHAIN walk, post;
@@ -288,7 +270,7 @@ const SHAPE_LINE_CHAIN SEGMENT::Hull( int aClearance, int aWalkaroundThickness )
}
-bool LINE::Is45Degree()
+bool LINE::Is45Degree() const
{
for( int i = 0; i < m_line.SegmentCount(); i++ )
{
@@ -340,18 +322,18 @@ const LINE LINE::ClipToNearestObstacle( NODE* aNode ) const
}
-void LINE::ShowLinks()
+void LINE::ShowLinks() const
{
- if( !m_segmentRefs )
+ if( !IsLinked() )
{
wxLogTrace( "PNS", "line %p: no links\n", this );
return;
}
- wxLogTrace( "PNS", "line %p: %lu linked segs\n", this, (int) m_segmentRefs->size() );
+ wxLogTrace( "PNS", "line %p: %lu linked segs\n", this, (int) m_segmentRefs.size() );
- for( int i = 0; i < (int) m_segmentRefs->size(); i++ )
- wxLogTrace( "PNS", "seg %d: %p\n", i, (*m_segmentRefs)[i] );
+ for( int i = 0; i < (int) m_segmentRefs.size(); i++ )
+ wxLogTrace( "PNS", "seg %d: %p\n", i, m_segmentRefs[i] );
}
SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aP )
@@ -376,7 +358,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT
VECTOR2I p_start = aOrigin.CPoint( i );
SHAPE_LINE_CHAIN paths[2];
DIRECTION_45 dirs[2];
- DIRECTION_45 d_prev = ( i > 0 ? DIRECTION_45( aOrigin.CSegment( i - 1 ) ) : DIRECTION_45() );
+ DIRECTION_45 d_prev = ( i > 0 ? DIRECTION_45( aOrigin.CSegment( i-1 ) ) : DIRECTION_45() );
for( int j = 0; j < 2; j++ )
{
@@ -588,7 +570,10 @@ void LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
if( aIndex == 0 )
{
if( !lockEndpointA )
- guideA[0] = guideA[1] = SEG( dragged.A, dragged.A + drag_dir.Right().Right().ToVector() );
+ {
+ guideA[0] = guideA[1] = SEG( dragged.A,
+ dragged.A + drag_dir.Right().Right().ToVector() );
+ }
else
{
guideA[0] = SEG( dragged.A, dragged.A + drag_dir.Right().ToVector() );
@@ -609,7 +594,10 @@ void LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
if( aIndex == m_line.SegmentCount() - 1 )
{
if( !lockEndpointB )
- guideB[0] = guideB[1] = SEG( dragged.B, dragged.B + drag_dir.Right().Right().ToVector() );
+ {
+ guideB[0] = guideB[1] = SEG( dragged.B,
+ dragged.B + drag_dir.Right().Right().ToVector() );
+ }
else
{
guideB[0] = SEG( dragged.B, dragged.B + drag_dir.Right().ToVector() );
@@ -712,8 +700,7 @@ void LINE::Reverse()
{
m_line = m_line.Reverse();
- if( m_segmentRefs )
- std::reverse( m_segmentRefs->begin(), m_segmentRefs->end() );
+ std::reverse( m_segmentRefs.begin(), m_segmentRefs.end() );
}
@@ -734,30 +721,27 @@ void LINE::SetRank( int aRank )
{
m_rank = aRank;
- if( m_segmentRefs )
- {
- for( SEGMENT* s : *m_segmentRefs )
- s->SetRank( aRank );
- }
+ for( SEGMENT* s : m_segmentRefs )
+ s->SetRank( aRank );
+
}
int LINE::Rank() const
{
int min_rank = INT_MAX;
- int rank;
- if( m_segmentRefs )
- {
- for( SEGMENT *s : *m_segmentRefs )
+ if( IsLinked() ) {
+ for( SEGMENT *s : m_segmentRefs )
+ {
min_rank = std::min( min_rank, s->Rank() );
- rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
- }
- else
- {
- rank = m_rank;
+ }
+ } else {
+ min_rank = m_rank;
}
+ int rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
+
return rank;
}
@@ -766,13 +750,17 @@ void LINE::ClipVertexRange( int aStart, int aEnd )
{
m_line = m_line.Slice( aStart, aEnd );
- if( m_segmentRefs )
- {
- SEGMENT_REFS* snew = new SEGMENT_REFS( m_segmentRefs->begin() + aStart,
- m_segmentRefs->begin() + aEnd );
+ if( IsLinked() ) {
+ assert( m_segmentRefs.size() >= (aEnd - aStart) );
+
+ // Note: The range includes aEnd, but we have n-1 segments.
+ std::rotate(
+ m_segmentRefs.begin(),
+ m_segmentRefs.begin() + aStart,
+ m_segmentRefs.begin() + aEnd
+ );
- delete m_segmentRefs;
- m_segmentRefs = snew;
+ m_segmentRefs.resize( aEnd - aStart );
}
}
@@ -794,10 +782,7 @@ bool LINE::HasLoops() const
void LINE::ClearSegmentLinks()
{
- if( m_segmentRefs )
- delete m_segmentRefs;
-
- m_segmentRefs = NULL;
+ m_segmentRefs.clear();
}
@@ -896,7 +881,7 @@ OPT_BOX2I LINE::ChangedArea( const LINE* aOther ) const
bool LINE::HasLockedSegments() const
{
- for( const SEGMENT* seg : *m_segmentRefs )
+ for( const SEGMENT* seg : m_segmentRefs )
{
if( seg->Marker() & MK_LOCKED )
return true;
diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h
index ea0fd44..151c83c 100644
--- a/pcbnew/router/pns_line.h
+++ b/pcbnew/router/pns_line.h
@@ -68,7 +68,6 @@ public:
*/
LINE() : ITEM( LINE_T )
{
- m_segmentRefs = NULL;
m_hasVia = false;
m_width = 1; // Dummy value
}
@@ -87,7 +86,6 @@ public:
{
m_net = aBase.m_net;
m_layers = aBase.m_layers;
- m_segmentRefs = NULL;
m_hasVia = false;
}
@@ -175,37 +173,36 @@ public:
///> Adds a reference to a segment registered in a NODE that is a part of this line.
void LinkSegment( SEGMENT* aSeg )
{
- if( !m_segmentRefs )
- m_segmentRefs = new SEGMENT_REFS();
-
- m_segmentRefs->push_back( aSeg );
+ m_segmentRefs.push_back( aSeg );
}
///> Returns the list of segments from the owning node that constitute this
///> line (or NULL if the line is not linked)
- SEGMENT_REFS* LinkedSegments()
+ SEGMENT_REFS& LinkedSegments()
{
return m_segmentRefs;
}
bool IsLinked() const
{
- return m_segmentRefs != NULL;
+ return m_segmentRefs.size() != 0;
+ }
+
+ bool IsLinkedChecked() const
+ {
+ return IsLinked() && LinkCount() == SegmentCount();
}
///> Checks if the segment aSeg is a part of the line.
bool ContainsSegment( SEGMENT* aSeg ) const
{
- if( !m_segmentRefs )
- return false;
-
- return std::find( m_segmentRefs->begin(), m_segmentRefs->end(),
- aSeg ) != m_segmentRefs->end();
+ return std::find( m_segmentRefs.begin(), m_segmentRefs.end(),
+ aSeg ) != m_segmentRefs.end();
}
SEGMENT* GetLink( int aIndex ) const
{
- return (*m_segmentRefs)[aIndex];
+ return m_segmentRefs[aIndex];
}
///> Erases the linking information. Used to detach the line from the owning node.
@@ -214,10 +211,7 @@ public:
///> Returns the number of segments that were assembled together to form this line.
int LinkCount() const
{
- if( !m_segmentRefs )
- return -1;
-
- return m_segmentRefs->size();
+ return m_segmentRefs.size();
}
///> Clips the line to the nearest obstacle, traversing from the line's start vertex (0).
@@ -228,7 +222,7 @@ public:
void ClipVertexRange ( int aStart, int aEnd );
///> Returns the number of corners of angles specified by mask aAngles.
- int CountCorners( int aAngles );
+ int CountCorners( int aAngles ) const;
///> Calculates a line thightly wrapping a convex hull
///> of an obstacle object (aObstacle).
@@ -246,10 +240,10 @@ public:
SHAPE_LINE_CHAIN& aPath,
bool aCw ) const;
- bool Is45Degree();
+ bool Is45Degree() const;
///> Prints out all linked segments
- void ShowLinks();
+ void ShowLinks() const;
bool EndsWithVia() const { return m_hasVia; }
@@ -285,7 +279,7 @@ private:
///> List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL
///> if the line is not a part of any node.
- SEGMENT_REFS* m_segmentRefs;
+ SEGMENT_REFS m_segmentRefs;
///> The actual shape of the line
SHAPE_LINE_CHAIN m_line;
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 3845521..125c0e9 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -947,7 +947,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest )
for( int s = 0; s < aLatest.LinkCount(); s++ )
{
- SEGMENT* seg = ( *aLatest.LinkedSegments() )[s];
+ SEGMENT* seg = aLatest.GetLink(s);
LINE ourLine = aNode->AssembleLine( seg );
JOINT a, b;
std::vector<LINE> lines;
@@ -970,7 +970,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest )
if( !( line.ContainsSegment( seg ) ) && line.SegmentCount() )
{
- for( SEGMENT *ss : *line.LinkedSegments() )
+ for( SEGMENT *ss : line.LinkedSegments() )
toErase.insert( ss );
removedCount++;
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index ccb7ae9..6bc3834 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -661,11 +661,9 @@ void NODE::removeSegment( SEGMENT* aSeg )
void NODE::removeLine( LINE* aLine )
{
- std::vector<SEGMENT*>* segRefs = aLine->LinkedSegments();
+ std::vector<SEGMENT*>& segRefs = aLine->LinkedSegments();
- assert( segRefs != NULL );
-
- for( SEGMENT* seg : *segRefs )
+ for( SEGMENT* seg : segRefs )
{
removeSegment( seg );
}
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index 6a22193..a916d7f 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -181,17 +181,16 @@ void OPTIMIZER::cacheAdd( ITEM* aItem, bool aIsStatic = false )
void OPTIMIZER::removeCachedSegments( LINE* aLine, int aStartVertex, int aEndVertex )
{
- LINE::SEGMENT_REFS* segs = aLine->LinkedSegments();
+ if( !aLine->IsLinked() ) return;
- if( !segs )
- return;
+ LINE::SEGMENT_REFS& segs = aLine->LinkedSegments();
if( aEndVertex < 0 )
aEndVertex += aLine->PointCount();
for( int i = aStartVertex; i < aEndVertex - 1; i++ )
{
- SEGMENT* s = (*segs)[i];
+ SEGMENT* s = segs[i];
m_cacheTags.erase( s );
m_cache.Remove( s );
}
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index 0630d9f..d286498 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -252,10 +252,8 @@ SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle,
bool obstacleIsHead = false;
- if( aObstacle.LinkedSegments() )
+ for( SEGMENT* s : aObstacle.LinkedSegments() )
{
- for( SEGMENT* s : *aObstacle.LinkedSegments() )
-
if( s->Marker() & MK_HEAD )
{
obstacleIsHead = true;
@@ -861,10 +859,7 @@ void SHOVE::unwindStack( ITEM* aItem )
{
LINE* l = static_cast<LINE*>( aItem );
- if( !l->LinkedSegments() )
- return;
-
- for( SEGMENT* seg : *l->LinkedSegments() )
+ for( SEGMENT* seg : l->LinkedSegments() )
unwindStack( seg );
}
}
@@ -872,7 +867,7 @@ void SHOVE::unwindStack( ITEM* aItem )
bool SHOVE::pushLine( const LINE& aL, bool aKeepCurrentOnTop )
{
- if( aL.LinkCount() >= 0 && ( aL.LinkCount() != aL.SegmentCount() ) )
+ if( !aL.IsLinkedChecked() )
return false;
if( aKeepCurrentOnTop && m_lineStack.size() > 0)
@@ -897,10 +892,7 @@ void SHOVE::popLine( )
{
bool found = false;
- if( !l.LinkedSegments() )
- continue;
-
- for( SEGMENT *s : *l.LinkedSegments() )
+ for( SEGMENT *s : l.LinkedSegments() )
{
if( i->ContainsSegment( s ) )
{
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index c862fd9..4c2eb8d 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -36,10 +36,10 @@ namespace PNS {
bool TOPOLOGY::SimplifyLine( LINE* aLine )
{
- if( !aLine->LinkedSegments() || !aLine->SegmentCount() )
+ if( !aLine->IsLinked() || !aLine->SegmentCount() )
return false;
- SEGMENT* root = ( *aLine->LinkedSegments() )[0];
+ SEGMENT* root = aLine->GetLink(0);
LINE l = m_world->AssembleLine( root );
SHAPE_LINE_CHAIN simplified( l.CLine() );
@@ -178,8 +178,10 @@ ITEM* TOPOLOGY::NearestUnconnectedItem( JOINT* aStart, int* aAnchor, int aKindMa
bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set<ITEM*>& aVisited )
{
- VECTOR2I anchor = aLeft ? aLine->CPoint( 0 ) : aLine->CPoint( -1 );
- SEGMENT* last = aLeft ? aLine->LinkedSegments()->front() : aLine->LinkedSegments()->back();
+ assert( aLine->IsLinked() );
+
+ VECTOR2I anchor = aLeft ? aLine->CPoint( 0 ) : aLine->CPoint( -1 );
+ SEGMENT* last = aLeft ? aLine->LinkedSegments().front() : aLine->LinkedSegments().back();
JOINT* jt = m_world->FindJoint( anchor, aLine );
assert( jt != NULL );
--
2.9.0.windows.1
>From 5abf1c6f3b556d88fe8bfdc3fca4e8f8c76f5b0a Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 20:42:56 +0200
Subject: [PATCH] use unique_ptr to document ownership (PNS::LINE_PLACER)
---
pcbnew/router/pns_line_placer.cpp | 9 ++-------
pcbnew/router/pns_line_placer.h | 2 +-
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 125c0e9..e7df822 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -59,8 +59,6 @@ LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) :
LINE_PLACER::~LINE_PLACER()
{
- if( m_shove )
- delete m_shove;
}
@@ -796,14 +794,11 @@ void LINE_PLACER::initPlacement()
m_currentNode = m_world;
m_currentMode = Settings().Mode();
- if( m_shove )
- delete m_shove;
-
- m_shove = NULL;
+ m_shove.reset();
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{
- m_shove = new SHOVE( m_world->Branch(), Router() );
+ m_shove.reset( new SHOVE( m_world->Branch(), Router() ) );
}
}
diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h
index 2e07cc5..e0f33df 100644
--- a/pcbnew/router/pns_line_placer.h
+++ b/pcbnew/router/pns_line_placer.h
@@ -368,7 +368,7 @@ private:
VECTOR2I m_p_start;
///> The shove engine
- SHOVE* m_shove;
+ std::unique_ptr< SHOVE > m_shove;
///> Current world state
NODE* m_currentNode;
--
2.9.0.windows.1
>From 4b485945eeece8f6cd47de2928ed7b8b4445f596 Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Tue, 30 Aug 2016 17:28:35 +0200
Subject: [PATCH] use unique_ptr at client <-> pns-router border, to document
the pns router is taking ownership
add overloads for NODE::Add( ... ) taking pointers to specific item types (retain old private add-Functions, they will come in handy later)
LINE overloads now take by reference, to document their special treatment.
updated code throughout affected by these changes
---
pcbnew/router/pns_diff_pair_placer.cpp | 8 ++--
pcbnew/router/pns_dp_meander_placer.cpp | 4 +-
pcbnew/router/pns_dragger.cpp | 12 +++---
pcbnew/router/pns_item.h | 16 +++++++
pcbnew/router/pns_kicad_iface.cpp | 71 +++++++++++++++++--------------
pcbnew/router/pns_kicad_iface.h | 6 +--
pcbnew/router/pns_line_placer.cpp | 27 ++++++------
pcbnew/router/pns_meander_placer.cpp | 2 +-
pcbnew/router/pns_node.cpp | 74 +++++++++++++++++++++------------
pcbnew/router/pns_node.h | 17 ++++++--
pcbnew/router/pns_shove.cpp | 55 ++++++++++++++----------
pcbnew/router/pns_shove.h | 3 +-
pcbnew/router/pns_topology.cpp | 4 +-
pcbnew/router/pns_utils.cpp | 5 +++
pcbnew/router/pns_utils.h | 6 ++-
15 files changed, 192 insertions(+), 118 deletions(-)
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 3205660..7c05ddc 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -778,8 +778,8 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
if( m_currentTrace.EndsWithVias() )
{
- m_lastNode->Add( m_currentTrace.PLine().Via().Clone() );
- m_lastNode->Add( m_currentTrace.NLine().Via().Clone() );
+ m_lastNode->Add( Clone( m_currentTrace.PLine().Via() ) );
+ m_lastNode->Add( Clone( m_currentTrace.NLine().Via() ) );
m_chainedPlacement = false;
}
else
@@ -790,8 +790,8 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
LINE lineP( m_currentTrace.PLine() );
LINE lineN( m_currentTrace.NLine() );
- m_lastNode->Add( &lineP );
- m_lastNode->Add( &lineN );
+ m_lastNode->Add( lineP );
+ m_lastNode->Add( lineN );
topo.SimplifyLine( &lineP );
topo.SimplifyLine( &lineN );
diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp
index 7604da0..589c6d6 100644
--- a/pcbnew/router/pns_dp_meander_placer.cpp
+++ b/pcbnew/router/pns_dp_meander_placer.cpp
@@ -307,8 +307,8 @@ bool DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
LINE lP( m_originPair.PLine(), m_finalShapeP );
LINE lN( m_originPair.NLine(), m_finalShapeN );
- m_currentNode->Add( &lP );
- m_currentNode->Add( &lN );
+ m_currentNode->Add( lP );
+ m_currentNode->Add( lN );
Router()->CommitRouting( m_currentNode );
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index ddf8725..0549a9f 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -158,7 +158,7 @@ bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
- m_lastNode->Add( &m_lastValidDraggedLine );
+ m_lastNode->Add( m_lastValidDraggedLine );
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
@@ -188,13 +188,15 @@ void DRAGGER::dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP )
m_draggedItems.Clear();
// fixme: this is awful.
- m_draggedVia = aVia->Clone();
+ auto via_clone = Clone( *aVia );
+
+ m_draggedVia = via_clone.get();
m_draggedVia->SetPos( aP );
m_draggedItems.Add( m_draggedVia );
m_lastNode->Remove( aVia );
- m_lastNode->Add( m_draggedVia );
+ m_lastNode->Add( std::move( via_clone ) );
for( ITEM* item : m_origViaConnections.Items() )
{
@@ -209,7 +211,7 @@ void DRAGGER::dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP )
m_draggedItems.Add( draggedLine );
m_lastNode->Remove( &origLine );
- m_lastNode->Add( &draggedLine );
+ m_lastNode->Add( draggedLine );
}
}
}
@@ -255,7 +257,7 @@ bool DRAGGER::dragShove( const VECTOR2I& aP )
m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark();
- m_lastNode->Add( &m_lastValidDraggedLine );
+ m_lastNode->Add( m_lastValidDraggedLine );
m_draggedItems.Clear();
m_draggedItems.Add( m_lastValidDraggedLine );
diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h
index b046311..edd0782 100644
--- a/pcbnew/router/pns_item.h
+++ b/pcbnew/router/pns_item.h
@@ -22,6 +22,7 @@
#ifndef __PNS_ITEM_H
#define __PNS_ITEM_H
+#include <memory>
#include <math/vector2d.h>
#include <geometry/shape.h>
@@ -354,6 +355,21 @@ protected:
int m_rank;
};
+template< typename T, typename S >
+std::unique_ptr< T > ItemCast( std::unique_ptr< S > aPtr )
+{
+ static_assert(std::is_base_of< ITEM, S >::value, "Need to be handed a ITEM!");
+ static_assert(std::is_base_of< ITEM, T >::value, "Need to cast to an ITEM!");
+ return std::unique_ptr< T >( static_cast<T*>(aPtr.release()) );
+}
+
+template< typename T >
+std::unique_ptr< typename std::remove_const< T >::type > Clone( const T& aItem )
+{
+ static_assert(std::is_base_of< ITEM, T >::value, "Need to be handed an ITEM!");
+ return std::unique_ptr< typename std::remove_const< T >::type >( aItem.Clone() );
+}
+
}
#endif // __PNS_ITEM_H
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 1e2b01a..9166707 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -429,7 +429,7 @@ PNS_KICAD_IFACE::~PNS_KICAD_IFACE()
}
-PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
+std::unique_ptr< PNS::SOLID > PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
{
LAYER_RANGE layers( 0, MAX_CU_LAYERS - 1 );
@@ -472,7 +472,7 @@ PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
return NULL;
}
- PNS::SOLID* solid = new PNS::SOLID;
+ std::unique_ptr< PNS::SOLID > solid( new PNS::SOLID );
solid->SetLayers( layers );
solid->SetNet( aPad->GetNetCode() );
@@ -564,8 +564,7 @@ PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
default:
wxLogTrace( "PNS", "unsupported pad shape" );
- delete solid;
- return NULL;
+ return nullptr;
}
}
else
@@ -661,9 +660,7 @@ PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
default:
wxLogTrace( "PNS", "unsupported pad shape" );
- delete solid;
-
- return NULL;
+ return nullptr;
}
}
}
@@ -671,33 +668,44 @@ PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
}
-PNS::ITEM* PNS_KICAD_IFACE::syncTrack( TRACK* aTrack )
+std::unique_ptr< PNS::SEGMENT > PNS_KICAD_IFACE::syncTrack( TRACK* aTrack )
{
- PNS::SEGMENT* s =
- new PNS::SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() );
+ std::unique_ptr< PNS::SEGMENT > segment(
+ new PNS::SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() )
+ );
+
+ segment->SetWidth( aTrack->GetWidth() );
+ segment->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) );
+ segment->SetParent( aTrack );
- s->SetWidth( aTrack->GetWidth() );
- s->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) );
- s->SetParent( aTrack );
- return s;
+ if( aTrack->IsLocked() ) {
+ segment->Mark( PNS::MK_LOCKED );
+ }
+
+ return segment;
}
-PNS::ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia )
+std::unique_ptr< PNS::VIA > PNS_KICAD_IFACE::syncVia( VIA* aVia )
{
LAYER_ID top, bottom;
aVia->LayerPair( &top, &bottom );
- PNS::VIA* v = new PNS::VIA(
+ std::unique_ptr<PNS::VIA> via( new PNS::VIA(
aVia->GetPosition(),
LAYER_RANGE( top, bottom ),
aVia->GetWidth(),
aVia->GetDrillValue(),
aVia->GetNetCode(),
- aVia->GetViaType() );
+ aVia->GetViaType() )
+ );
- v->SetParent( aVia );
+ via->SetParent( aVia );
- return v;
+ if( aVia->IsLocked() ) {
+ via->Mark( PNS::MK_LOCKED );
+ }
+
+ return via;
}
@@ -720,10 +728,10 @@ void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
{
- PNS::ITEM* solid = syncPad( pad );
+ std::unique_ptr< PNS::SOLID > solid = syncPad( pad );
if( solid )
- aWorld->Add( solid );
+ aWorld->Add( std::move( solid ) );
}
}
@@ -732,16 +740,17 @@ void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
KICAD_T type = t->Type();
PNS::ITEM* item = NULL;
- if( type == PCB_TRACE_T )
- item = syncTrack( t );
- else if( type == PCB_VIA_T )
- item = syncVia( static_cast<VIA*>( t ) );
-
- if( t->IsLocked() )
- item->Mark( PNS::MK_LOCKED );
-
- if( item )
- aWorld->Add( item );
+ if( type == PCB_TRACE_T ) {
+ std::unique_ptr< PNS::SEGMENT > segment = syncTrack( t );
+ if( segment ) {
+ aWorld->Add( std::move( segment ) );
+ }
+ } else if( type == PCB_VIA_T ) {
+ std::unique_ptr< PNS::VIA > via = syncVia( static_cast<VIA*>( t ) );
+ if( via ) {
+ aWorld->Add( std::move( via ) );
+ }
+ }
}
int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h
index 37994e3..3cf6ffb 100644
--- a/pcbnew/router/pns_kicad_iface.h
+++ b/pcbnew/router/pns_kicad_iface.h
@@ -62,9 +62,9 @@ private:
PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver;
PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator;
- PNS::ITEM* syncPad( D_PAD* aPad );
- PNS::ITEM* syncTrack( TRACK* aTrack );
- PNS::ITEM* syncVia( VIA* aVia );
+ std::unique_ptr< PNS::SOLID > syncPad( D_PAD* aPad );
+ std::unique_ptr< PNS::SEGMENT > syncTrack( TRACK* aTrack );
+ std::unique_ptr< PNS::VIA > syncVia( VIA* aVia );
KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems;
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index e7df822..0152ff1 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -697,17 +697,18 @@ void LINE_PLACER::splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I
return;
SEGMENT* s_old = static_cast<SEGMENT*>( aSeg );
- SEGMENT* s_new[2];
-
- s_new[0] = s_old->Clone();
- s_new[1] = s_old->Clone();
+
+ std::unique_ptr< SEGMENT > s_new[2] = {
+ Clone( *s_old ),
+ Clone( *s_old )
+ };
s_new[0]->SetEnds( s_old->Seg().A, aP );
s_new[1]->SetEnds( aP, s_old->Seg().B );
aNode->Remove( s_old );
- aNode->Add( s_new[0], true );
- aNode->Add( s_new[1], true );
+ aNode->Add( std::move( s_new[0] ), true );
+ aNode->Add( std::move( s_new[1] ), true );
}
@@ -861,7 +862,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
if( pl.EndsWithVia() )
{
- m_lastNode->Add( pl.Via().Clone() );
+ m_lastNode->Add( Clone( pl.Via() ) );
Router()->CommitRouting( m_lastNode );
m_lastNode = NULL;
@@ -893,15 +894,15 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
for( int i = 0; i < lastV; i++ )
{
const SEG& s = pl.CSegment( i );
- SEGMENT* seg = new SEGMENT( s, m_currentNet );
+ std::unique_ptr< SEGMENT > seg( new SEGMENT( s, m_currentNet ) );
seg->SetWidth( pl.Width() );
seg->SetLayer( m_currentLayer );
- m_lastNode->Add( seg );
- lastSeg = seg;
+ lastSeg = seg.get();
+ m_lastNode->Add( std::move( seg ) );
}
if( pl.EndsWithVia() )
- m_lastNode->Add( pl.Via().Clone() );
+ m_lastNode->Add( Clone( pl.Via() ) );
if( realEnd )
simplifyNewLine( m_lastNode, lastSeg );
@@ -938,7 +939,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest )
return;
std::set<SEGMENT *> toErase;
- aNode->Add( &aLatest, true );
+ aNode->Add( aLatest, true );
for( int s = 0; s < aLatest.LinkCount(); s++ )
{
@@ -994,7 +995,7 @@ void LINE_PLACER::simplifyNewLine( NODE* aNode, SEGMENT* aLatest )
LINE lnew( l );
aNode->Remove( &l );
lnew.SetShape( simplified );
- aNode->Add( &lnew );
+ aNode->Add( lnew );
}
}
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index 42daa7c..6d21ad8 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -194,7 +194,7 @@ bool MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
return false;
m_currentTrace = LINE( m_originLine, m_finalShape );
- m_currentNode->Add( &m_currentTrace );
+ m_currentNode->Add( m_currentTrace );
Router()->CommitRouting( m_currentNode );
return true;
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 6bc3834..6d3ec86 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -535,6 +535,11 @@ void NODE::addSolid( SOLID* aSolid )
m_index->Add( aSolid );
}
+void NODE::Add( std::unique_ptr< SOLID > aSolid )
+{
+ aSolid->SetOwner( this );
+ addSolid( aSolid.release() );
+}
void NODE::addVia( VIA* aVia )
{
@@ -542,10 +547,15 @@ void NODE::addVia( VIA* aVia )
m_index->Add( aVia );
}
+void NODE::Add( std::unique_ptr< VIA > aVia )
+{
+ aVia->SetOwner( this );
+ addVia( aVia.release() );
+}
-void NODE::addLine( LINE* aLine, bool aAllowRedundant )
+void NODE::addLine( LINE& aLine, bool aAllowRedundant )
{
- SHAPE_LINE_CHAIN& l = aLine->Line();
+ SHAPE_LINE_CHAIN& l = aLine.Line();
for( int i = 0; i < l.SegmentCount(); i++ )
{
@@ -553,7 +563,7 @@ void NODE::addLine( LINE* aLine, bool aAllowRedundant )
if( s.A != s.B )
{
- SEGMENT* pseg = new SEGMENT( *aLine, s );
+ SEGMENT* pseg = new SEGMENT( aLine, s );
SEGMENT* psegR = NULL;
if( !aAllowRedundant )
@@ -561,7 +571,7 @@ void NODE::addLine( LINE* aLine, bool aAllowRedundant )
if( psegR )
{
- aLine->LinkSegment( psegR );
+ aLine.LinkSegment( psegR );
delete pseg;
}
@@ -569,10 +579,10 @@ void NODE::addLine( LINE* aLine, bool aAllowRedundant )
{
pseg->SetOwner( this );
- linkJoint( s.A, pseg->Layers(), aLine->Net(), pseg );
- linkJoint( s.B, pseg->Layers(), aLine->Net(), pseg );
+ linkJoint( s.A, pseg->Layers(), aLine.Net(), pseg );
+ linkJoint( s.B, pseg->Layers(), aLine.Net(), pseg );
- aLine->LinkSegment( pseg );
+ aLine.LinkSegment( pseg );
m_index->Add( pseg );
}
@@ -580,47 +590,52 @@ void NODE::addLine( LINE* aLine, bool aAllowRedundant )
}
}
+void NODE::Add( LINE& aLine, bool aAllowRedundant )
+{
+ addLine( aLine, aAllowRedundant );
+}
-void NODE::addSegment( SEGMENT* aSeg, bool aAllowRedundant )
+void NODE::addSegment( SEGMENT* aSeg )
{
- if( aSeg->Seg().A == aSeg->Seg().B )
+ linkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
+ linkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
+
+ m_index->Add( aSeg );
+}
+
+void NODE::Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant )
+{
+ if( aSegment->Seg().A == aSegment->Seg().B )
{
wxLogTrace( "PNS", "attempting to add a segment with same end coordinates, ignoring." );
return;
}
- if( !aAllowRedundant && findRedundantSegment( aSeg ) )
+ if( !aAllowRedundant && findRedundantSegment( aSegment.get() ) )
return;
- aSeg->SetOwner( this );
-
- linkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
- linkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
-
- m_index->Add( aSeg );
+ aSegment->SetOwner( this );
+ addSegment( aSegment.release() );
}
-
-void NODE::Add( ITEM* aItem, bool aAllowRedundant )
+void NODE::Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant )
{
- aItem->SetOwner( this );
-
switch( aItem->Kind() )
{
case ITEM::SOLID_T:
- addSolid( static_cast<SOLID*>( aItem ) );
+ Add( ItemCast<SOLID>( std::move( aItem ) ) );
break;
case ITEM::SEGMENT_T:
- addSegment( static_cast<SEGMENT*>( aItem ), aAllowRedundant );
+ Add( ItemCast<SEGMENT>( std::move( aItem ) ), aAllowRedundant );
break;
case ITEM::LINE_T:
- addLine( static_cast<LINE*>( aItem ), aAllowRedundant );
+ assert( false );
break;
case ITEM::VIA_T:
- addVia( static_cast<VIA*>( aItem ) );
+ Add( ItemCast<VIA>( std::move( aItem ) ) );
break;
default:
@@ -719,12 +734,17 @@ void NODE::removeVia( VIA* aVia )
}
-void NODE::Replace( ITEM* aOldItem, ITEM* aNewItem )
+void NODE::Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem )
{
Remove( aOldItem );
- Add( aNewItem );
+ Add( std::move( aNewItem ) );
}
+void NODE::Replace( LINE& aOldLine, LINE& aNewLine )
+{
+ Remove( aOldLine );
+ Add( aNewLine );
+}
void NODE::Remove( ITEM* aItem )
{
@@ -1184,7 +1204,7 @@ void NODE::Commit( NODE* aNode )
{
(*i)->SetRank( -1 );
(*i)->Unmark();
- Add( *i );
+ Add( std::unique_ptr<ITEM>( *i ) );
}
releaseChildren();
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index 80965ef..d362122 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -273,8 +273,16 @@ public:
* @param aAllowRedundant if true, duplicate items are allowed (e.g. a segment or via
* at the same coordinates as an existing one)
*/
- void Add( ITEM* aItem, bool aAllowRedundant = false );
+ void Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant = false );
+ void Add( std::unique_ptr< SOLID > aSolid );
+ void Add( std::unique_ptr< VIA > aVia );
+ void Add( LINE& aLine, bool aAllowRedundant = false );
+
+private:
+ void Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant = false );
+
+public:
/**
* Function Remove()
*
@@ -298,7 +306,8 @@ public:
* @param aOldItem item to be removed
* @param aNewItem item add instead
*/
- void Replace( ITEM* aOldItem, ITEM* aNewItem );
+ void Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem );
+ void Replace( LINE& aOldLine, LINE& aNewLine );
/**
* Function Branch()
@@ -429,8 +438,8 @@ private:
///> helpers for adding/removing items
void addSolid( SOLID* aSeg );
- void addSegment( SEGMENT* aSeg, bool aAllowRedundant );
- void addLine( LINE* aLine, bool aAllowRedundant );
+ void addSegment( SEGMENT* aSeg );
+ void addLine( LINE& aLine, bool aAllowRedundant );
void addVia( VIA* aVia );
void removeSolid( SOLID* aSeg );
void removeLine( LINE* aLine );
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index d286498..a46000d 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -45,7 +45,19 @@
namespace PNS {
-void SHOVE::replaceItems( ITEM* aOld, ITEM* aNew )
+void SHOVE::replaceItems( ITEM* aOld, std::unique_ptr< ITEM > aNew )
+{
+ OPT_BOX2I changed_area = ChangedArea( aOld, aNew.get() );
+
+ if( changed_area )
+ {
+ m_affectedAreaSum = m_affectedAreaSum ? m_affectedAreaSum->Merge( *changed_area ) : *changed_area;
+ }
+
+ m_currentNode->Replace( aOld, std::move( aNew ) );
+}
+
+void SHOVE::replaceLine( LINE& aOld, LINE& aNew )
{
OPT_BOX2I changed_area = ChangedArea( aOld, aNew );
@@ -57,7 +69,6 @@ void SHOVE::replaceItems( ITEM* aOld, ITEM* aNew )
m_currentNode->Replace( aOld, aNew );
}
-
int SHOVE::getClearance( const ITEM* aA, const ITEM* aB ) const
{
if( m_forceClearance >= 0 )
@@ -349,7 +360,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacl
shovedLine.SetRank( rank - 1 );
sanityCheck( &obstacleLine, &shovedLine );
- replaceItems( &obstacleLine, &shovedLine );
+ replaceLine( obstacleLine, shovedLine );
if( !pushLine( shovedLine ) )
rv = SH_INCOMPLETE;
@@ -383,7 +394,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingLine( LINE& aCurrent, LINE& aObstacle )
}
sanityCheck( &aObstacle, &shovedLine );
- replaceItems( &aObstacle, &shovedLine );
+ replaceLine( aObstacle, shovedLine );
int rank = aObstacle.Rank();
shovedLine.SetRank( rank - 1 );
@@ -508,7 +519,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingSolid( LINE& aCurrent, ITEM* aObstacle )
if(!success)
return SH_INCOMPLETE;
- replaceItems( &aCurrent, &walkaroundLine );
+ replaceLine( aCurrent, walkaroundLine );
walkaroundLine.SetRank( nextRank );
#ifdef DEBUG
@@ -607,13 +618,13 @@ SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurr
p0_pushed += aForce.Resize( 2 ); // make sure pushed via does not overlap with any existing joint
}
- VIA* pushedVia = aVia->Clone();
+ std::unique_ptr< VIA > pushedVia = Clone( *aVia );
pushedVia->SetPos( p0_pushed );
pushedVia->Mark( aVia->Marker() );
if( aVia->Marker() & MK_HEAD )
{
- m_draggedVia = pushedVia;
+ m_draggedVia = pushedVia.get();
m_draggedViaHeadSet.Clear();
}
@@ -645,19 +656,19 @@ SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurr
}
}
- m_draggedViaHeadSet.Add( pushedVia );
+ m_draggedViaHeadSet.Add( pushedVia.get() );
if( aDryRun )
return SH_OK;
- replaceItems( aVia, pushedVia );
-
#ifdef DEBUG
m_logger.Log( aVia, 0, "obstacle-via" );
#endif
pushedVia->SetRank( aCurrentRank - 1 );
+ replaceItems( aVia, std::move( pushedVia ) );
+
#ifdef DEBUG
m_logger.Log( pushedVia, 1, "pushed-via" );
#endif
@@ -678,7 +689,7 @@ SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurr
if( lp.second.SegmentCount() )
{
- replaceItems( &lp.first, &lp.second );
+ replaceLine( lp.first, lp.second );
lp.second.SetRank( aCurrentRank - 1 );
if( !pushLine( lp.second, true ) )
@@ -820,7 +831,7 @@ SHOVE::SHOVE_STATUS SHOVE::onReverseCollidingVia( LINE& aCurrent, VIA* aObstacle
m_logger.Log( &shoved, 3, "shoved-line" );
#endif
int currentRank = aCurrent.Rank();
- replaceItems( &aCurrent, &shoved );
+ replaceLine( aCurrent, shoved );
if( !pushLine( shoved ) )
return SH_INCOMPLETE;
@@ -1092,7 +1103,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
m_currentNode = parent->Branch();
m_currentNode->ClearRanks();
- m_currentNode->Add( &head );
+ m_currentNode->Add( head );
m_currentNode->LockJoint( head.CPoint(0), &head, true );
@@ -1105,15 +1116,13 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
m_logger.NewGroup( "initial", 0 );
m_logger.Log( &head, 0, "head" );
- VIA* headVia = NULL;
-
if( head.EndsWithVia() )
{
- headVia = head.Via().Clone();
- m_currentNode->Add( headVia );
+ std::unique_ptr< VIA >headVia = Clone( head.Via() );
headVia->Mark( MK_HEAD );
headVia->SetRank( 100000 );
- m_logger.Log( headVia, 0, "head-via" );
+ m_logger.Log( headVia.get(), 0, "head-via" );
+ m_currentNode->Add( std::move( headVia ) );
}
if( !pushLine( head ) )
@@ -1204,7 +1213,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveMultiLines( const ITEM_SET& aHeadSet )
LINE head( *headOrig );
head.ClearSegmentLinks();
- m_currentNode->Add( &head );
+ m_currentNode->Add( head );
head.Mark( MK_HEAD );
head.SetRank( 100000 );
@@ -1217,11 +1226,11 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveMultiLines( const ITEM_SET& aHeadSet )
if( head.EndsWithVia() )
{
- headVia = head.Via().Clone(); // fixme: leak
- m_currentNode->Add( headVia );
+ std::unique_ptr< VIA > headVia = Clone( head.Via() );
headVia->Mark( MK_HEAD );
headVia->SetRank( 100000 );
- m_logger.Log( headVia, 0, "head-via" );
+ m_logger.Log( headVia.get(), 0, "head-via" );
+ m_currentNode->Add( std::move( headVia ) );
}
}
@@ -1375,7 +1384,7 @@ void SHOVE::runOptimizer( NODE* aNode )
{
aNode->Remove( &line );
line.SetShape( optimized.CLine() );
- aNode->Add( &line );
+ aNode->Add( line );
}
}
}
diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h
index 46de6f5..c25c993 100644
--- a/pcbnew/router/pns_shove.h
+++ b/pcbnew/router/pns_shove.h
@@ -131,7 +131,8 @@ private:
LINE assembleLine( const SEGMENT* aSeg, int* aIndex = NULL );
- void replaceItems( ITEM* aOld, ITEM* aNew );
+ void replaceItems( ITEM* aOld, std::unique_ptr< ITEM > aNew );
+ void replaceLine( LINE& aOld, LINE& aNew );
OPT_BOX2I m_affectedAreaSum;
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index 4c2eb8d..2948b29 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -50,7 +50,7 @@ bool TOPOLOGY::SimplifyLine( LINE* aLine )
LINE lnew( l );
m_world->Remove( &l );
lnew.SetShape( simplified );
- m_world->Add( &lnew );
+ m_world->Add( lnew );
return true;
}
@@ -102,7 +102,7 @@ bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine )
return false;
std::unique_ptr<NODE> tmpNode( m_world->Branch() );
- tmpNode->Add( &track );
+ tmpNode->Add( track );
JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track );
diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp
index 8c68637..f12d57f 100644
--- a/pcbnew/router/pns_utils.cpp
+++ b/pcbnew/router/pns_utils.cpp
@@ -248,4 +248,9 @@ OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB )
return OPT_BOX2I();
}
+OPT_BOX2I ChangedArea( const LINE& aLineA, const LINE& aLineB )
+{
+ return aLineA.ChangedArea( &aLineB );
+}
+
}
diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h
index 3dbd85f..0b1da8e 100644
--- a/pcbnew/router/pns_utils.h
+++ b/pcbnew/router/pns_utils.h
@@ -34,6 +34,7 @@ namespace PNS {
constexpr int HULL_MARGIN = 10;
class ITEM;
+class LINE;
/** Various utility functions */
@@ -55,14 +56,15 @@ const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& convex, int aClearance );
SHAPE_RECT ApproximateSegmentAsRect( const SHAPE_SEGMENT& aSeg );
-#if 0
+OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB );
+OPT_BOX2I ChangedArea( const LINE& aLineA, const LINE& aLineB );
+#if 0
void DrawDebugPoint( VECTOR2I aP, int aColor );
void DrawDebugBox( BOX2I aB, int aColor );
void DrawDebugSeg( SEG aS, int aColor );
void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor );
#endif
-OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB );
}
--
2.9.0.windows.1
>From 7aa98658ca8c5b484fa30a98f5bbc8bd65aeb26d Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Tue, 30 Aug 2016 20:55:00 +0200
Subject: [PATCH] fix eager dynamic allocation in PNS::NODE::addLine
move implementation into PNS::NODE::Add since lines will never be part of the index itself
---
pcbnew/router/pns_node.cpp | 64 +++++++++++++++++++++-------------------------
pcbnew/router/pns_node.h | 3 ++-
2 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 6d3ec86..1071c29 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -1,3 +1,4 @@
+#include "pns_node.h"
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
@@ -553,8 +554,10 @@ void NODE::Add( std::unique_ptr< VIA > aVia )
addVia( aVia.release() );
}
-void NODE::addLine( LINE& aLine, bool aAllowRedundant )
+void NODE::Add( LINE& aLine, bool aAllowRedundant )
{
+ assert( !aLine.IsLinked() );
+
SHAPE_LINE_CHAIN& l = aLine.Line();
for( int i = 0; i < l.SegmentCount(); i++ )
@@ -563,36 +566,22 @@ void NODE::addLine( LINE& aLine, bool aAllowRedundant )
if( s.A != s.B )
{
- SEGMENT* pseg = new SEGMENT( aLine, s );
- SEGMENT* psegR = NULL;
-
- if( !aAllowRedundant )
- psegR = findRedundantSegment( pseg );
-
- if( psegR )
+ SEGMENT* rseg;
+ if( !aAllowRedundant &&
+ (rseg = findRedundantSegment( s.A, s.B, aLine.Layers(), aLine.Net() )) )
{
- aLine.LinkSegment( psegR );
-
- delete pseg;
+ // another line could be referencing this segment too :(
+ aLine.LinkSegment( rseg );
}
else
{
- pseg->SetOwner( this );
-
- linkJoint( s.A, pseg->Layers(), aLine.Net(), pseg );
- linkJoint( s.B, pseg->Layers(), aLine.Net(), pseg );
-
- aLine.LinkSegment( pseg );
-
- m_index->Add( pseg );
+ std::unique_ptr< SEGMENT > newseg( new SEGMENT( aLine, s ) );
+ aLine.LinkSegment( newseg.get() );
+ Add( std::move( newseg ), true );
}
}
}
-}
-void NODE::Add( LINE& aLine, bool aAllowRedundant )
-{
- addLine( aLine, aAllowRedundant );
}
void NODE::addSegment( SEGMENT* aSeg )
@@ -682,6 +671,9 @@ void NODE::removeLine( LINE* aLine )
{
removeSegment( seg );
}
+
+ aLine->ClearSegmentLinks();
+ aLine->SetOwner( nullptr );
}
void NODE::removeVia( VIA* aVia )
@@ -1283,33 +1275,35 @@ int NODE::RemoveByMarker( int aMarker )
return 0;
}
-
-SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg )
+SEGMENT* NODE::findRedundantSegment( const VECTOR2I& A, const VECTOR2I& B, const LAYER_RANGE& lr,
+ int aNet )
{
- JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg );
+ JOINT* jtStart = FindJoint( A, lr.Start(), aNet );
if( !jtStart )
- return NULL;
+ return nullptr;
for( ITEM* item : jtStart->LinkList() )
{
if( item->OfKind( ITEM::SEGMENT_T ) )
{
- SEGMENT* seg2 = (SEGMENT*) item;
-
- const VECTOR2I a1( aSeg->Seg().A );
- const VECTOR2I b1( aSeg->Seg().B );
+ SEGMENT* seg2 = (SEGMENT*)item;
const VECTOR2I a2( seg2->Seg().A );
const VECTOR2I b2( seg2->Seg().B );
- if( seg2->Layers().Start() == aSeg->Layers().Start() &&
- ( ( a1 == a2 && b1 == b2 ) || ( a1 == b2 && a2 == b1 ) ) )
- return seg2;
+ if( seg2->Layers().Start() == lr.Start() &&
+ ((A == a2 && B == b2) || (A == b2 && B == a2)) )
+ return seg2;
}
}
- return NULL;
+ return nullptr;
+}
+
+SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg )
+{
+ return findRedundantSegment( aSeg->Seg().A, aSeg->Seg().B, aSeg->Layers(), aSeg->Net() );
}
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index d362122..c1f2efe 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -439,7 +439,6 @@ private:
///> helpers for adding/removing items
void addSolid( SOLID* aSeg );
void addSegment( SEGMENT* aSeg );
- void addLine( LINE& aLine, bool aAllowRedundant );
void addVia( VIA* aVia );
void removeSolid( SOLID* aSeg );
void removeLine( LINE* aLine );
@@ -456,6 +455,8 @@ private:
return m_parent == NULL;
}
+ SEGMENT* findRedundantSegment( const VECTOR2I& A, const VECTOR2I& B,
+ const LAYER_RANGE & lr, int aNet );
SEGMENT* findRedundantSegment( SEGMENT* aSeg );
///> scans the joint map, forming a line starting from segment (current).
--
2.9.0.windows.1
>From 811821a7922001a029286a7e6a4c555a1da2fb43 Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Tue, 30 Aug 2016 19:01:30 +0200
Subject: [PATCH] Add Remove overloads for specific item types, split removal
into index-handling and lifetime-handling (not 100% correct yet, since the
index is defactor lifetime-owner, it will be later.)
---
pcbnew/router/pns_dragger.cpp | 2 +-
pcbnew/router/pns_line_placer.cpp | 4 +-
pcbnew/router/pns_meander_placer.cpp | 2 +-
pcbnew/router/pns_meander_skew_placer.cpp | 2 +-
pcbnew/router/pns_node.cpp | 65 ++++++++++++++++++-------------
pcbnew/router/pns_node.h | 13 +++++--
pcbnew/router/pns_shove.cpp | 6 +--
pcbnew/router/pns_topology.cpp | 2 +-
8 files changed, 56 insertions(+), 40 deletions(-)
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index 0549a9f..541bfe1 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -210,7 +210,7 @@ void DRAGGER::dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP )
m_draggedItems.Add( draggedLine );
- m_lastNode->Remove( &origLine );
+ m_lastNode->Remove( origLine );
m_lastNode->Add( draggedLine );
}
}
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 0152ff1..9dadabe 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -979,7 +979,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest )
for( SEGMENT *s : toErase )
aNode->Remove( s );
- aNode->Remove( &aLatest );
+ aNode->Remove( aLatest );
}
@@ -993,7 +993,7 @@ void LINE_PLACER::simplifyNewLine( NODE* aNode, SEGMENT* aLatest )
if( simplified.PointCount() != l.PointCount() )
{
LINE lnew( l );
- aNode->Remove( &l );
+ aNode->Remove( l );
lnew.SetShape( simplified );
aNode->Add( lnew );
}
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index 6d21ad8..e0f876d 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -80,7 +80,7 @@ bool MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
TOPOLOGY topo( m_world );
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
- m_world->Remove( &m_originLine );
+ m_world->Remove( m_originLine );
m_currentWidth = m_originLine.Width();
m_currentEnd = VECTOR2I( 0, 0 );
diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp
index cfa26c3..ae59b97 100644
--- a/pcbnew/router/pns_meander_skew_placer.cpp
+++ b/pcbnew/router/pns_meander_skew_placer.cpp
@@ -85,7 +85,7 @@ bool MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
m_tunedPathP = topo.AssembleTrivialPath( m_originPair.PLine().GetLink( 0 ) );
m_tunedPathN = topo.AssembleTrivialPath( m_originPair.NLine().GetLink( 0 ) );
- m_world->Remove( &m_originLine );
+ m_world->Remove( m_originLine );
m_currentWidth = m_originLine.Width();
m_currentEnd = VECTOR2I( 0, 0 );
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 1071c29..efd1b21 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -1,4 +1,3 @@
-#include "pns_node.h"
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
@@ -581,7 +580,6 @@ void NODE::Add( LINE& aLine, bool aAllowRedundant )
}
}
}
-
}
void NODE::addSegment( SEGMENT* aSeg )
@@ -654,29 +652,13 @@ void NODE::doRemove( ITEM* aItem )
}
-void NODE::removeSegment( SEGMENT* aSeg )
+void NODE::removeSegmentIndex( SEGMENT* aSeg )
{
unlinkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
unlinkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
-
- doRemove( aSeg );
-}
-
-
-void NODE::removeLine( LINE* aLine )
-{
- std::vector<SEGMENT*>& segRefs = aLine->LinkedSegments();
-
- for( SEGMENT* seg : segRefs )
- {
- removeSegment( seg );
- }
-
- aLine->ClearSegmentLinks();
- aLine->SetOwner( nullptr );
}
-void NODE::removeVia( VIA* aVia )
+void NODE::removeViaIndex( VIA* aVia )
{
// We have to split a single joint (associated with a via, binding together multiple layers)
// into multiple independent joints. As I'm a lazy bastard, I simply delete the via and all its links and re-insert them.
@@ -721,8 +703,11 @@ void NODE::removeVia( VIA* aVia )
if( item != aVia )
linkJoint( p, item->Layers(), net, item );
}
+}
- doRemove( aVia );
+void NODE::removeSolidIndex( SOLID* aSolid )
+{
+ // fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care.
}
@@ -738,25 +723,42 @@ void NODE::Replace( LINE& aOldLine, LINE& aNewLine )
Add( aNewLine );
}
+void NODE::Remove( SOLID* aSolid )
+{
+ removeSolidIndex( aSolid );
+ doRemove( aSolid );
+}
+
+void NODE::Remove( VIA* aVia )
+{
+ removeViaIndex( aVia );
+ doRemove( aVia );
+}
+
+void NODE::Remove( SEGMENT* aSegment )
+{
+ removeSegmentIndex( aSegment );
+ doRemove( aSegment );
+}
+
void NODE::Remove( ITEM* aItem )
{
switch( aItem->Kind() )
{
case ITEM::SOLID_T:
- // fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care.
- doRemove( aItem );
+ Remove( static_cast<SOLID*>( aItem ) );
break;
case ITEM::SEGMENT_T:
- removeSegment( static_cast<SEGMENT*>( aItem ) );
+ Remove( static_cast<SEGMENT*>( aItem ) );
break;
case ITEM::LINE_T:
- removeLine( static_cast<LINE*>( aItem ) );
+ assert( false );
break;
case ITEM::VIA_T:
- removeVia( static_cast<VIA*>( aItem ) );
+ Remove( static_cast<VIA*>( aItem ) );
break;
default:
@@ -767,7 +769,16 @@ void NODE::Remove( ITEM* aItem )
void NODE::Remove( LINE& aLine )
{
- removeLine( &aLine );
+ // LINE does not have a seperate remover, as LINEs are never truly a member of the tree
+ std::vector<SEGMENT*>& segRefs = aLine.LinkedSegments();
+
+ for( SEGMENT* seg : segRefs )
+ {
+ Remove( seg );
+ }
+
+ aLine.SetOwner( nullptr );
+ aLine.ClearSegmentLinks();
}
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index c1f2efe..e584e0c 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -289,8 +289,12 @@ public:
* Just as the name says, removes an item from this branch.
* @param aItem item to remove
*/
+ void Remove( SOLID* aSolid );
+ void Remove( VIA* aVia );
+ void Remove( SEGMENT* aSegment );
void Remove( ITEM* aItem );
+public:
/**
* Function Remove()
*
@@ -440,10 +444,11 @@ private:
void addSolid( SOLID* aSeg );
void addSegment( SEGMENT* aSeg );
void addVia( VIA* aVia );
- void removeSolid( SOLID* aSeg );
- void removeLine( LINE* aLine );
- void removeSegment( SEGMENT* aSeg );
- void removeVia( VIA* aVia );
+
+ void removeLine( LINE& aLine );
+ void removeSolidIndex( SOLID* aSeg );
+ void removeSegmentIndex( SEGMENT* aSeg );
+ void removeViaIndex( VIA* aVia );
void doRemove( ITEM* aItem );
void unlinkParent();
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index a46000d..3bd3567 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -697,7 +697,7 @@ SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurr
}
else
{
- m_currentNode->Remove( &lp.first );
+ m_currentNode->Remove( lp.first );
}
#ifdef DEBUG
@@ -1382,7 +1382,7 @@ void SHOVE::runOptimizer( NODE* aNode )
if( optimizer.Optimize( &line, &optimized ) )
{
- aNode->Remove( &line );
+ aNode->Remove( line );
line.SetShape( optimized.CLine() );
aNode->Add( line );
}
@@ -1409,7 +1409,7 @@ const LINE SHOVE::NewHead() const
void SHOVE::SetInitialLine( LINE& aInitial )
{
m_root = m_root->Branch();
- m_root->Remove( &aInitial );
+ m_root->Remove( aInitial );
}
}
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index 2948b29..5eca29b 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -48,7 +48,7 @@ bool TOPOLOGY::SimplifyLine( LINE* aLine )
if( simplified.PointCount() != l.PointCount() )
{
LINE lnew( l );
- m_world->Remove( &l );
+ m_world->Remove( l );
lnew.SetShape( simplified );
m_world->Add( lnew );
return true;
--
2.9.0.windows.1
>From 334709c9aea66783ad35bf45624b505737dc9d0b Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 16:38:11 +0200
Subject: [PATCH] Move PNS router code into namespace PNS
update copyright messages
---
pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp | 3 +-
pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h | 9 +-
.../dialogs/dialog_pns_length_tuning_settings.cpp | 20 +-
pcbnew/dialogs/dialog_pns_length_tuning_settings.h | 11 +-
pcbnew/dialogs/dialog_pns_settings.cpp | 9 +-
pcbnew/dialogs/dialog_pns_settings.h | 13 +-
pcbnew/router/length_tuner_tool.cpp | 16 +-
pcbnew/router/length_tuner_tool.h | 7 +-
pcbnew/router/pns_algo_base.cpp | 5 +
pcbnew/router/pns_algo_base.h | 5 +
pcbnew/router/pns_debug_decorator.h | 5 +
pcbnew/router/pns_diff_pair.cpp | 5 +
pcbnew/router/pns_diff_pair.h | 5 +
pcbnew/router/pns_diff_pair_placer.cpp | 7 +-
pcbnew/router/pns_diff_pair_placer.h | 5 +
pcbnew/router/pns_dp_meander_placer.cpp | 5 +
pcbnew/router/pns_dp_meander_placer.h | 5 +
pcbnew/router/pns_dragger.cpp | 5 +
pcbnew/router/pns_dragger.h | 5 +
pcbnew/router/pns_index.h | 6 +
pcbnew/router/pns_item.cpp | 5 +
pcbnew/router/pns_item.h | 6 +
pcbnew/router/pns_itemset.cpp | 4 +
pcbnew/router/pns_itemset.h | 5 +
pcbnew/router/pns_joint.h | 5 +
pcbnew/router/pns_kicad_iface.cpp | 3 +
pcbnew/router/pns_kicad_iface.h | 28 +-
pcbnew/router/pns_line.cpp | 5 +
pcbnew/router/pns_line.h | 5 +
pcbnew/router/pns_line_placer.cpp | 5 +
pcbnew/router/pns_line_placer.h | 5 +
pcbnew/router/pns_logger.cpp | 5 +
pcbnew/router/pns_logger.h | 8 +-
pcbnew/router/pns_meander.cpp | 5 +
pcbnew/router/pns_meander.h | 5 +
pcbnew/router/pns_meander_placer.cpp | 4 +
pcbnew/router/pns_meander_placer.h | 5 +
pcbnew/router/pns_meander_placer_base.cpp | 5 +
pcbnew/router/pns_meander_placer_base.h | 5 +
pcbnew/router/pns_meander_skew_placer.cpp | 6 +-
pcbnew/router/pns_meander_skew_placer.h | 5 +
pcbnew/router/pns_node.cpp | 7 +-
pcbnew/router/pns_node.cpp.orig | 1340 ++++++++++++++++++++
pcbnew/router/pns_node.h | 5 +
pcbnew/router/pns_node.h.orig | 512 ++++++++
pcbnew/router/pns_optimizer.cpp | 5 +
pcbnew/router/pns_optimizer.h | 5 +
pcbnew/router/pns_placement_algo.h | 5 +
pcbnew/router/pns_router.cpp | 8 +-
pcbnew/router/pns_router.h | 20 +-
pcbnew/router/pns_routing_settings.cpp | 5 +
pcbnew/router/pns_routing_settings.h | 5 +
pcbnew/router/pns_segment.h | 5 +
pcbnew/router/pns_shove.cpp | 5 +
pcbnew/router/pns_shove.h | 5 +
pcbnew/router/pns_sizes_settings.cpp | 5 +
pcbnew/router/pns_sizes_settings.h | 6 +
pcbnew/router/pns_solid.cpp | 5 +
pcbnew/router/pns_solid.h | 5 +
pcbnew/router/pns_tool_base.cpp | 5 +
pcbnew/router/pns_tool_base.h | 8 +-
pcbnew/router/pns_topology.cpp | 7 +-
pcbnew/router/pns_topology.h | 5 +
pcbnew/router/pns_tune_status_popup.cpp | 11 +-
pcbnew/router/pns_tune_status_popup.h | 7 +-
pcbnew/router/pns_utils.cpp | 5 +
pcbnew/router/pns_utils.h | 7 +-
pcbnew/router/pns_via.cpp | 5 +
pcbnew/router/pns_via.h | 5 +
pcbnew/router/pns_walkaround.cpp | 5 +
pcbnew/router/pns_walkaround.h | 5 +
pcbnew/router/router_preview_item.cpp | 23 +-
pcbnew/router/router_preview_item.h | 11 +-
pcbnew/router/router_tool.cpp | 27 +-
pcbnew/router/router_tool.h | 7 +-
pcbnew/router/time_limit.cpp | 13 +-
pcbnew/router/time_limit.h | 5 +
77 files changed, 2292 insertions(+), 102 deletions(-)
create mode 100644 pcbnew/router/pns_node.cpp.orig
create mode 100644 pcbnew/router/pns_node.h.orig
diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
index 0ce3c63..920bf8b 100644
--- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
+++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -25,7 +26,7 @@
#include "dialog_pns_diff_pair_dimensions.h"
#include <router/pns_sizes_settings.h>
-DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ) :
+DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes ) :
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ),
m_traceWidth( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap( this, m_traceGapText, m_traceGapUnit ),
diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
index 70f0538..80e413f 100644
--- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
+++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,12 +30,16 @@
#include "dialog_pns_diff_pair_dimensions_base.h"
+namespace PNS {
+
class PNS_SIZES_SETTINGS;
+}
+
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
{
public:
- DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes );
+ DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes );
private:
void updateCheckbox();
@@ -46,7 +51,7 @@ private:
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
- PNS_SIZES_SETTINGS& m_sizes;
+ PNS::PNS_SIZES_SETTINGS& m_sizes;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
index 6ec2534..28f3ae1 100644
--- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
+++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -25,7 +26,9 @@
#include "dialog_pns_length_tuning_settings.h"
#include <router/pns_meander_placer.h>
-DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ) :
+DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent,
+ PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode )
+ :
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ),
m_minAmpl( this, m_minAmplText, m_minAmplUnit ),
m_maxAmpl( this, m_maxAmplText, m_maxAmplUnit ),
@@ -35,7 +38,7 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow*
m_mode( aMode )
{
m_miterStyle->Enable( true );
- m_radiusText->Enable( aMode != PNS_MODE_TUNE_DIFF_PAIR );
+ m_radiusText->Enable( aMode != PNS::PNS_MODE_TUNE_DIFF_PAIR );
//m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW );
m_minAmpl.SetValue( m_settings.m_minAmplitude );
@@ -44,23 +47,23 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow*
m_spacing.SetValue( m_settings.m_spacing );
m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) );
- m_miterStyle->SetSelection( m_settings.m_cornerStyle == MEANDER_STYLE_ROUND ? 1 : 0 );
+ m_miterStyle->SetSelection( m_settings.m_cornerStyle == PNS::MEANDER_STYLE_ROUND ? 1 : 0 );
switch( aMode )
{
- case PNS_MODE_TUNE_SINGLE:
+ case PNS::PNS_MODE_TUNE_SINGLE:
SetTitle( _( "Single Track Length Tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
- case PNS_MODE_TUNE_DIFF_PAIR:
+ case PNS::PNS_MODE_TUNE_DIFF_PAIR:
SetTitle( _( "Differential Pair Length Tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
- case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
+ case PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW:
SetTitle( _( "Differential Pair Skew Tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) );
m_targetLengthLabel->SetLabel( _( "Target skew: " ) );
@@ -89,7 +92,7 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() );
- if( m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW )
+ if( m_mode == PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW )
m_settings.m_targetSkew = m_targetLength.GetValue();
else
m_settings.m_targetLength = m_targetLength.GetValue();
@@ -97,7 +100,8 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
m_settings.m_maxAmplitude = m_settings.m_minAmplitude;
- m_settings.m_cornerStyle = m_miterStyle->GetSelection() ? MEANDER_STYLE_ROUND : MEANDER_STYLE_CHAMFER;
+ m_settings.m_cornerStyle = m_miterStyle->GetSelection() ?
+ PNS::MEANDER_STYLE_ROUND : PNS::MEANDER_STYLE_CHAMFER;
EndModal( wxID_OK );
}
diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
index f6dcba3..5057ad8 100644
--- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
+++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -31,12 +32,16 @@
#include <router/pns_router.h>
+namespace PNS {
+
class PNS_MEANDER_SETTINGS;
+}
+
class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
{
public:
- DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode );
+ DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode );
virtual void OnOkClick( wxCommandEvent& aEvent );
@@ -46,8 +51,8 @@ private:
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
- PNS_MEANDER_SETTINGS& m_settings;
- PNS_ROUTER_MODE m_mode;
+ PNS::PNS_MEANDER_SETTINGS& m_settings;
+ PNS::PNS_ROUTER_MODE m_mode;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp
index c310a52..6dc9122 100644
--- a/pcbnew/dialogs/dialog_pns_settings.cpp
+++ b/pcbnew/dialogs/dialog_pns_settings.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -25,11 +26,11 @@
#include "dialog_pns_settings.h"
#include <router/pns_routing_settings.h>
-DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) :
+DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ) :
DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
{
// "Figure out what's best" is not available yet
- m_mode->Enable( RM_Smart, false );
+ m_mode->Enable( PNS::RM_Smart, false );
// Add tool tip to the mode radio box, one by option
// (cannot be made with wxFormBuilder for each item )
@@ -59,13 +60,13 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTING
void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
{
// Save widgets' values to settings
- m_settings.SetMode( (PNS_MODE) m_mode->GetSelection() );
+ m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
m_settings.SetShoveVias( m_shoveVias->GetValue() );
m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() );
m_settings.SetSmartPads( m_autoNeckdown->GetValue() );
- m_settings.SetOptimizerEffort( (PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
+ m_settings.SetOptimizerEffort( (PNS::PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
diff --git a/pcbnew/dialogs/dialog_pns_settings.h b/pcbnew/dialogs/dialog_pns_settings.h
index d59cfa5..ec85dfc 100644
--- a/pcbnew/dialogs/dialog_pns_settings.h
+++ b/pcbnew/dialogs/dialog_pns_settings.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -27,17 +28,21 @@
#include "dialog_pns_settings_base.h"
+namespace PNS {
+
class PNS_ROUTING_SETTINGS;
+}
+
class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE
{
- public:
- DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings );
+ public:
+ DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings );
- private:
+ private:
virtual void OnOkClick( wxCommandEvent& aEvent );
- PNS_ROUTING_SETTINGS& m_settings;
+ PNS::PNS_ROUTING_SETTINGS& m_settings;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp
index 117abec..595d300 100644
--- a/pcbnew/router/length_tuner_tool.cpp
+++ b/pcbnew/router/length_tuner_tool.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -120,14 +121,14 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
}
}
- PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
+ PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS::PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
if( !placer )
return;
if( aEvent.IsAction( &ACT_Settings ) )
{
- PNS_MEANDER_SETTINGS settings = placer->MeanderSettings();
+ PNS::PNS_MEANDER_SETTINGS settings = placer->MeanderSettings();
DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( m_frame, settings, m_router->Mode() );
if( settingsDlg.ShowModal() )
@@ -170,7 +171,8 @@ void LENGTH_TUNER_TOOL::performTuning()
return;
}
- PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
+ PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS::PNS_MEANDER_PLACER_BASE*>(
+ m_router->Placer() );
placer->UpdateSettings( m_savedMeanderSettings );
@@ -236,25 +238,25 @@ void LENGTH_TUNER_TOOL::performTuning()
int LENGTH_TUNER_TOOL::TuneSingleTrace( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Trace Length" ) );
- return mainLoop( PNS_MODE_TUNE_SINGLE );
+ return mainLoop( PNS::PNS_MODE_TUNE_SINGLE );
}
int LENGTH_TUNER_TOOL::TuneDiffPair( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Length" ) );
- return mainLoop( PNS_MODE_TUNE_DIFF_PAIR );
+ return mainLoop( PNS::PNS_MODE_TUNE_DIFF_PAIR );
}
int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Skew" ) );
- return mainLoop( PNS_MODE_TUNE_DIFF_PAIR_SKEW );
+ return mainLoop( PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW );
}
-int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
+int LENGTH_TUNER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode )
{
// Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
diff --git a/pcbnew/router/length_tuner_tool.h b/pcbnew/router/length_tuner_tool.h
index 075d907..fbc9c72 100644
--- a/pcbnew/router/length_tuner_tool.h
+++ b/pcbnew/router/length_tuner_tool.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
@@ -27,7 +28,7 @@
class PNS_TUNE_STATUS_POPUP;
-class APIEXPORT LENGTH_TUNER_TOOL : public PNS_TOOL_BASE
+class APIEXPORT LENGTH_TUNER_TOOL : public PNS::PNS_TOOL_BASE
{
public:
LENGTH_TUNER_TOOL();
@@ -42,13 +43,13 @@ public:
private:
void performTuning( );
- int mainLoop( PNS_ROUTER_MODE aMode );
+ int mainLoop( PNS::PNS_ROUTER_MODE aMode );
void handleCommonEvents( const TOOL_EVENT& aEvent );
void updateStatusPopup ( PNS_TUNE_STATUS_POPUP& aPopup );
- PNS_MEANDER_SETTINGS m_savedMeanderSettings;
+ PNS::PNS_MEANDER_SETTINGS m_savedMeanderSettings;
};
#endif
diff --git a/pcbnew/router/pns_algo_base.cpp b/pcbnew/router/pns_algo_base.cpp
index a24678b..ce3ba8d 100644
--- a/pcbnew/router/pns_algo_base.cpp
+++ b/pcbnew/router/pns_algo_base.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -22,6 +23,8 @@
#include "pns_debug_decorator.h"
#include "pns_router.h"
+namespace PNS {
+
PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
{
return m_router->Settings();
@@ -32,3 +35,5 @@ PNS_LOGGER* PNS_ALGO_BASE::Logger()
{
return NULL;
}
+
+}
diff --git a/pcbnew/router/pns_algo_base.h b/pcbnew/router/pns_algo_base.h
index 78e7e87..ee6d930 100644
--- a/pcbnew/router/pns_algo_base.h
+++ b/pcbnew/router/pns_algo_base.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -23,6 +24,8 @@
#include "pns_routing_settings.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_LOGGER;
class PNS_DEBUG_DECORATOR;
@@ -74,4 +77,6 @@ private:
PNS_ROUTER* m_router;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_debug_decorator.h b/pcbnew/router/pns_debug_decorator.h
index 4cec4c5..dc991e8 100644
--- a/pcbnew/router/pns_debug_decorator.h
+++ b/pcbnew/router/pns_debug_decorator.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2016 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Christian Gagneraud <chgans@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -26,6 +27,8 @@
#include <geometry/seg.h>
#include <geometry/shape_line_chain.h>
+namespace PNS {
+
class PNS_DEBUG_DECORATOR
{
public:
@@ -43,4 +46,6 @@ public:
virtual void Clear() {};
};
+}
+
#endif
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 13d631a..16887f5 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -36,6 +37,8 @@
#include "pns_utils.h"
#include "pns_debug_decorator.h"
+namespace PNS {
+
class PNS_LINE;
PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN )
@@ -896,3 +899,5 @@ int PNS_DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const
return 0;
}
+
+}
diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h
index 6b6dae3..f5248de 100644
--- a/pcbnew/router/pns_diff_pair.h
+++ b/pcbnew/router/pns_diff_pair.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
#include "ranged_num.h"
+namespace PNS {
+
class PNS_DIFF_PAIR;
/**
@@ -511,4 +514,6 @@ private:
RANGED_NUM<int> m_gapConstraint;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 48930dc..5e9cf87 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
#include "pns_topology.h"
#include "pns_debug_decorator.h"
+namespace PNS {
+
PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) :
PNS_PLACEMENT_ALGO( aRouter )
{
@@ -576,7 +579,7 @@ bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_netN = m_start.PrimN()->Net();
#if 0
- // FIXME: this also needs to be factored out but not so important right now
+ // FIXME: this also needs to be factored out but not so important right now
// Check if the current track/via gap & track width settings are violated
BOARD* brd = NULL; // FIXME Router()->GetBoard();
NETCLASSPTR netclassP = brd->FindNet( m_netP )->GetNetClass();
@@ -844,3 +847,5 @@ const std::vector<int> PNS_DIFF_PAIR_PLACER::CurrentNets() const
rv.push_back( m_netN );
return rv;
}
+
+}
diff --git a/pcbnew/router/pns_diff_pair_placer.h b/pcbnew/router/pns_diff_pair_placer.h
index e5e3195..e7a076e 100644
--- a/pcbnew/router/pns_diff_pair_placer.h
+++ b/pcbnew/router/pns_diff_pair_placer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -35,6 +36,8 @@
#include "pns_placement_algo.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -296,4 +299,6 @@ private:
bool m_idle;
};
+}
+
#endif // __PNS_LINE_PLACER_H
diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp
index 62fb2fe..ba9db37 100644
--- a/pcbnew/router/pns_dp_meander_placer.cpp
+++ b/pcbnew/router/pns_dp_meander_placer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -30,6 +31,8 @@
#include "pns_router.h"
#include "pns_utils.h"
+namespace PNS {
+
using boost::optional;
PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
@@ -399,3 +402,5 @@ const std::vector<int> PNS_DP_MEANDER_PLACER::CurrentNets() const
rv.push_back( m_originPair.NetN() );
return rv;
}
+
+}
diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h
index 38a95aa..240d3de 100644
--- a/pcbnew/router/pns_dp_meander_placer.h
+++ b/pcbnew/router/pns_dp_meander_placer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -35,6 +36,8 @@
#include "pns_diff_pair.h"
#include "pns_debug_decorator.h"
+namespace PNS {
+
class PNS_ROUTER;
/**
@@ -141,4 +144,6 @@ private:
TUNING_STATUS m_lastStatus;
};
+}
+
#endif // __PNS_DP_MEANDER_PLACER_H
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index 42bc9a0..c99a3be 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -22,6 +23,8 @@
#include "pns_shove.h"
#include "pns_router.h"
+namespace PNS {
+
PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE( aRouter )
{
@@ -335,3 +338,5 @@ PNS_LOGGER* PNS_DRAGGER::Logger()
return NULL;
}
+
+}
diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h
index ed6a59b..d4c727a 100644
--- a/pcbnew/router/pns_dragger.h
+++ b/pcbnew/router/pns_dragger.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,8 @@
#include "pns_algo_base.h"
#include "pns_itemset.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -123,4 +126,6 @@ private:
PNS_ITEMSET m_draggedItems;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h
index abeeb61..15380b2 100644
--- a/pcbnew/router/pns_index.h
+++ b/pcbnew/router/pns_index.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -31,6 +32,9 @@
#include "pns_item.h"
+namespace PNS {
+
+
/**
* Class PNS_INDEX
*
@@ -311,4 +315,6 @@ PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet )
return &m_netMap[aNet];
}
+}
+
#endif
diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp
index eb4b607..01d5aa9 100644
--- a/pcbnew/router/pns_item.cpp
+++ b/pcbnew/router/pns_item.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -21,6 +22,8 @@
#include "pns_item.h"
#include "pns_line.h"
+namespace PNS {
+
bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV, bool aDifferentNetsOnly ) const
{
@@ -85,3 +88,5 @@ const std::string PNS_ITEM::KindStr() const
PNS_ITEM::~PNS_ITEM()
{
}
+
+}
diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h
index 24e1a3e..43a6e46 100644
--- a/pcbnew/router/pns_item.h
+++ b/pcbnew/router/pns_item.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,9 @@
#include "pns_layerset.h"
class BOARD_CONNECTED_ITEM;
+
+namespace PNS {
+
class PNS_NODE;
enum LineMarker {
@@ -350,4 +354,6 @@ protected:
int m_rank;
};
+}
+
#endif // __PNS_ITEM_H
diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp
index dc7b12c..32f19c5 100644
--- a/pcbnew/router/pns_itemset.cpp
+++ b/pcbnew/router/pns_itemset.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -21,6 +22,7 @@
#include "pns_itemset.h"
#include "pns_line.h"
+namespace PNS {
PNS_ITEMSET::~PNS_ITEMSET()
{
@@ -134,3 +136,5 @@ PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
return *this;
}
+
+}
diff --git a/pcbnew/router/pns_itemset.h b/pcbnew/router/pns_itemset.h
index e39a654..59e02a5 100644
--- a/pcbnew/router/pns_itemset.h
+++ b/pcbnew/router/pns_itemset.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -25,6 +26,8 @@
#include "pns_item.h"
+namespace PNS {
+
/**
* Class PNS_ITEMSET
*
@@ -223,4 +226,6 @@ private:
ENTRIES m_items;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h
index e3aef65..50c6afe 100644
--- a/pcbnew/router/pns_joint.h
+++ b/pcbnew/router/pns_joint.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -30,6 +31,8 @@
#include "pns_segment.h"
#include "pns_itemset.h"
+namespace PNS {
+
/**
* Class PNS_JOINT
*
@@ -256,4 +259,6 @@ inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP )
return seed;
}
+}
+
#endif // __PNS_JOINT_H
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index a4b3772..08203fa 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2016 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -59,6 +60,8 @@
#include "pns_debug_decorator.h"
#include "router_preview_item.h"
+using namespace PNS;
+
class PNS_PCBNEW_RULE_RESOLVER : public PNS_RULE_RESOLVER
{
public:
diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h
index 03f84d8..894e3b5 100644
--- a/pcbnew/router/pns_kicad_iface.h
+++ b/pcbnew/router/pns_kicad_iface.h
@@ -34,43 +34,43 @@ namespace KIGFX
class VIEW;
};
-class PNS_KICAD_IFACE : public PNS_ROUTER_IFACE {
+class PNS_KICAD_IFACE : public PNS::PNS_ROUTER_IFACE {
public:
PNS_KICAD_IFACE();
~PNS_KICAD_IFACE();
- void SetRouter( PNS_ROUTER* aRouter );
+ void SetRouter( PNS::PNS_ROUTER* aRouter );
void SetHostFrame( PCB_EDIT_FRAME* aFrame );
void SetBoard( BOARD* aBoard );
void SetView( KIGFX::VIEW* aView );
- void SyncWorld( PNS_NODE* aWorld );
+ void SyncWorld( PNS::PNS_NODE* aWorld );
void EraseView();
- void HideItem( PNS_ITEM* aItem );
- void DisplayItem( const PNS_ITEM* aItem, int aColor = 0, int aClearance = 0 );
- void AddItem( PNS_ITEM* aItem );
- void RemoveItem( PNS_ITEM* aItem );
+ void HideItem( PNS::PNS_ITEM* aItem );
+ void DisplayItem( const PNS::PNS_ITEM* aItem, int aColor = 0, int aClearance = 0 );
+ void AddItem( PNS::PNS_ITEM* aItem );
+ void RemoveItem( PNS::PNS_ITEM* aItem );
void Commit();
void UpdateNet( int aNetCode );
- PNS_RULE_RESOLVER* GetRuleResolver();
- PNS_DEBUG_DECORATOR* GetDebugDecorator();
+ PNS::PNS_RULE_RESOLVER* GetRuleResolver();
+ PNS::PNS_DEBUG_DECORATOR* GetDebugDecorator();
private:
PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver;
PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator;
- PNS_ITEM* syncPad( D_PAD* aPad );
- PNS_ITEM* syncTrack( TRACK* aTrack );
- PNS_ITEM* syncVia( VIA* aVia );
+ PNS::PNS_ITEM* syncPad( D_PAD* aPad );
+ PNS::PNS_ITEM* syncTrack( TRACK* aTrack );
+ PNS::PNS_ITEM* syncVia( VIA* aVia );
KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems;
std::unordered_set<BOARD_CONNECTED_ITEM*> m_hiddenItems;
- PNS_NODE* m_world;
- PNS_ROUTER* m_router;
+ PNS::PNS_NODE* m_world;
+ PNS::PNS_ROUTER* m_router;
BOARD* m_board;
PICKED_ITEMS_LIST m_undoBuffer;
PCB_EDIT_FRAME* m_frame;
diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp
index 7d54679..06dc7bd 100644
--- a/pcbnew/router/pns_line.cpp
+++ b/pcbnew/router/pns_line.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
using boost::optional;
+namespace PNS {
+
PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) :
PNS_ITEM( aOther ),
m_line( aOther.m_line ),
@@ -900,3 +903,5 @@ bool PNS_LINE::HasLockedSegments() const
}
return false;
}
+
+}
diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h
index ebfb493..6a38499 100644
--- a/pcbnew/router/pns_line.h
+++ b/pcbnew/router/pns_line.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -31,6 +32,8 @@
#include "pns_item.h"
#include "pns_via.h"
+namespace PNS {
+
class PNS_NODE;
class PNS_SEGMENT;
class PNS_VIA;
@@ -297,4 +300,6 @@ private:
PNS_VIA m_via;
};
+}
+
#endif // __PNS_LINE_H
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 2453c7c..c9b4ef1 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -33,6 +34,8 @@
using boost::optional;
+namespace PNS {
+
PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) :
PNS_PLACEMENT_ALGO( aRouter )
{
@@ -1101,3 +1104,5 @@ PNS_LOGGER* PNS_LINE_PLACER::Logger()
return NULL;
}
+
+}
diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h
index f74ab93..f07199e 100644
--- a/pcbnew/router/pns_line_placer.h
+++ b/pcbnew/router/pns_line_placer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
#include "pns_line.h"
#include "pns_placement_algo.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -393,4 +396,6 @@ private:
bool m_orthoMode;
};
+}
+
#endif // __PNS_LINE_PLACER_H
diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp
index 6491120..3d3df8e 100644
--- a/pcbnew/router/pns_logger.cpp
+++ b/pcbnew/router/pns_logger.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -31,6 +32,8 @@
#include <geometry/shape_circle.h>
#include <geometry/shape_convex.h>
+namespace PNS {
+
PNS_LOGGER::PNS_LOGGER( )
{
m_groupOpened = false;
@@ -201,3 +204,5 @@ void PNS_LOGGER::Save( const std::string& aFilename )
fwrite( s.c_str(), 1, s.length(), f );
fclose( f );
}
+
+}
diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h
index b38fd42..24f2bd3 100644
--- a/pcbnew/router/pns_logger.h
+++ b/pcbnew/router/pns_logger.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,10 +29,13 @@
#include <math/vector2d.h>
-class PNS_ITEM;
class SHAPE_LINE_CHAIN;
class SHAPE;
+namespace PNS {
+
+class PNS_ITEM;
+
class PNS_LOGGER
{
public:
@@ -56,4 +60,6 @@ private:
std::stringstream m_theLog;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp
index d7408bb..b6fd257 100644
--- a/pcbnew/router/pns_meander.cpp
+++ b/pcbnew/router/pns_meander.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,8 @@
#include "pns_router.h"
#include "pns_debug_decorator.h"
+namespace PNS {
+
const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const
{
return m_placer->MeanderSettings();
@@ -636,3 +639,5 @@ void PNS_MEANDER_SHAPE::updateBaseSegment( )
m_clippedBaseSeg.B = m_baseSeg.LineProject( CLine( 0 ).CPoint( -1 ) );
}
}
+
+}
diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h
index 0976a09..44ca3b2 100644
--- a/pcbnew/router/pns_meander.h
+++ b/pcbnew/router/pns_meander.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -26,6 +27,8 @@
#include <geometry/shape.h>
#include <geometry/shape_line_chain.h>
+namespace PNS {
+
class PNS_MEANDER_PLACER_BASE;
///< Shapes of available meanders
@@ -511,4 +514,6 @@ private:
int m_baselineOffset;
};
+}
+
#endif // __PNS_MEANDER_H
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index a67b145..ac0d3fa 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -27,6 +28,7 @@
#include "pns_router.h"
#include "pns_debug_decorator.h"
+namespace PNS {
PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
PNS_MEANDER_PLACER_BASE( aRouter )
@@ -262,3 +264,5 @@ PNS_MEANDER_PLACER::TUNING_STATUS PNS_MEANDER_PLACER::TuningStatus() const
{
return m_lastStatus;
}
+
+}
diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h
index b38457e..c6284bf 100644
--- a/pcbnew/router/pns_meander_placer.h
+++ b/pcbnew/router/pns_meander_placer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -33,6 +34,8 @@
#include "pns_meander.h"
#include "pns_meander_placer_base.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -115,4 +118,6 @@ protected:
TUNING_STATUS m_lastStatus;
};
+}
+
#endif // __PNS_MEANDER_PLACER_H
diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp
index bb15451..dc999b9 100644
--- a/pcbnew/router/pns_meander_placer_base.cpp
+++ b/pcbnew/router/pns_meander_placer_base.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -22,6 +23,8 @@
#include "pns_meander.h"
#include "pns_meander_placer_base.h"
+namespace PNS {
+
PNS_MEANDER_PLACER_BASE::PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter ) :
PNS_PLACEMENT_ALGO( aRouter )
{
@@ -185,3 +188,5 @@ int PNS_MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, in
else
return 0;
}
+
+}
diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h
index 070e322..f8f8899 100644
--- a/pcbnew/router/pns_meander_placer_base.h
+++ b/pcbnew/router/pns_meander_placer_base.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
#include "pns_placement_algo.h"
#include "pns_meander.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -162,4 +165,6 @@ protected:
VECTOR2I m_currentEnd;
};
+}
+
#endif // __PNS_MEANDER_PLACER_BASE_H
diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp
index a9c6b88..c125274 100644
--- a/pcbnew/router/pns_meander_skew_placer.cpp
+++ b/pcbnew/router/pns_meander_skew_placer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,7 @@
#include "pns_router.h"
#include "pns_debug_decorator.h"
+namespace PNS {
PNS_MEANDER_SKEW_PLACER::PNS_MEANDER_SKEW_PLACER ( PNS_ROUTER* aRouter ) :
PNS_MEANDER_PLACER ( aRouter )
@@ -126,7 +128,7 @@ int PNS_MEANDER_SKEW_PLACER::currentSkew() const
bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{
- for( const PNS_ITEM* item : m_tunedPathP.CItems() )
+ for( const PNS_ITEM* item : m_tunedPathP.CItems() )
{
if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
Dbg()->AddLine( l->CLine(), 5, 10000 );
@@ -167,3 +169,5 @@ const wxString PNS_MEANDER_SKEW_PLACER::TuningInfo() const
return status;
}
+
+}
diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h
index 7cb303c..3ca0c92 100644
--- a/pcbnew/router/pns_meander_skew_placer.h
+++ b/pcbnew/router/pns_meander_skew_placer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -24,6 +25,8 @@
#include "pns_meander_placer.h"
#include "pns_diff_pair.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_SHOVE;
class PNS_OPTIMIZER;
@@ -62,4 +65,6 @@ private:
int m_coupledLength;
};
+}
+
#endif // __PNS_MEANDER_SKEW_PLACER_H
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index a0bda08..86ac957 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -40,6 +41,8 @@
using boost::unordered_set;
using boost::unordered_map;
+namespace PNS {
+
#ifdef DEBUG
static boost::unordered_set<PNS_NODE*> allocNodes;
#endif
@@ -760,7 +763,7 @@ void PNS_NODE::Remove( PNS_LINE& aLine )
void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos,
int aLimit, VECTOR2I* aCorners, PNS_SEGMENT** aSegments, bool& aGuardHit,
- bool aStopAtLockedJoints )
+ bool aStopAtLockedJoints )
{
bool prevReversed = false;
@@ -1302,3 +1305,5 @@ PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
return NULL;
}
+
+}
diff --git a/pcbnew/router/pns_node.cpp.orig b/pcbnew/router/pns_node.cpp.orig
new file mode 100644
index 0000000..8fe69ff
--- /dev/null
+++ b/pcbnew/router/pns_node.cpp.orig
@@ -0,0 +1,1340 @@
+/*
+ * KiRouter - a push-and-(sometimes-)shove PCB router
+ *
+ * Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
+ * Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <vector>
+#include <cassert>
+
+#include <math/vector2d.h>
+
+#include <geometry/seg.h>
+#include <geometry/shape.h>
+#include <geometry/shape_line_chain.h>
+#include <geometry/shape_index.h>
+
+#include "pns_item.h"
+#include "pns_line.h"
+#include "pns_node.h"
+#include "pns_via.h"
+#include "pns_solid.h"
+#include "pns_joint.h"
+#include "pns_index.h"
+#include "pns_router.h"
+
+using boost::unordered_set;
+using boost::unordered_map;
+
+namespace PNS {
+
+#ifdef DEBUG
+static boost::unordered_set<NODE*> allocNodes;
+#endif
+
+NODE::NODE()
+{
+ wxLogTrace( "PNS", "NODE::create %p", this );
+ m_depth = 0;
+ m_root = this;
+ m_parent = NULL;
+ m_maxClearance = 800000; // fixme: depends on how thick traces are.
+ m_ruleResolver = NULL;
+ m_index = new INDEX;
+
+#ifdef DEBUG
+ allocNodes.insert( this );
+#endif
+}
+
+
+NODE::~NODE()
+{
+ wxLogTrace( "PNS", "NODE::delete %p", this );
+
+ if( !m_children.empty() )
+ {
+ wxLogTrace( "PNS", "attempting to free a node that has kids.\n" );
+ assert( false );
+ }
+
+#ifdef DEBUG
+ if( allocNodes.find( this ) == allocNodes.end() )
+ {
+ wxLogTrace( "PNS", "attempting to free an already-free'd node.\n" );
+ assert( false );
+ }
+
+ allocNodes.erase( this );
+#endif
+
+ m_joints.clear();
+
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ {
+ if( (*i)->BelongsTo( this ) )
+ delete *i;
+ }
+
+ unlinkParent();
+
+ delete m_index;
+}
+
+int NODE::GetClearance( const ITEM* aA, const ITEM* aB ) const
+{
+ if( !m_ruleResolver )
+ return 100000;
+
+ return m_ruleResolver->Clearance( aA, aB );
+}
+
+
+NODE* NODE::Branch()
+{
+ NODE* child = new NODE;
+
+ wxLogTrace( "PNS", "NODE::branch %p (parent %p)", child, this );
+
+ m_children.insert( child );
+
+ child->m_depth = m_depth + 1;
+ child->m_parent = this;
+ child->m_ruleResolver = m_ruleResolver;
+ child->m_root = isRoot() ? this : m_root;
+
+ // immmediate offspring of the root branch needs not copy anything.
+ // For the rest, deep-copy joints, overridden item map and pointers
+ // to stored items.
+ if( !isRoot() )
+ {
+ JOINT_MAP::iterator j;
+
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ child->m_index->Add( *i );
+
+ child->m_joints = m_joints;
+ child->m_override = m_override;
+ }
+
+ wxLogTrace( "PNS", "%d items, %lu joints, %lu overrides",
+ child->m_index->Size(), child->m_joints.size(), child->m_override.size() );
+
+ return child;
+}
+
+
+void NODE::unlinkParent()
+{
+ if( isRoot() )
+ return;
+
+ m_parent->m_children.erase( this );
+}
+
+
+OBSTACLE_VISITOR::OBSTACLE_VISITOR( const ITEM* aItem ) :
+ m_item( aItem ),
+ m_node( NULL ),
+ m_override( NULL ),
+ m_extraClearance( 0 )
+{
+ if( aItem && aItem->Kind() == ITEM::LINE_T )
+ m_extraClearance += static_cast<const LINE*>( aItem )->Width() / 2;
+}
+
+
+void OBSTACLE_VISITOR::SetWorld( const NODE* aNode, const NODE* aOverride )
+{
+ m_node = aNode;
+ m_override = aOverride;
+}
+
+
+bool OBSTACLE_VISITOR::visit( ITEM* aCandidate )
+{
+ // check if there is a more recent branch with a newer
+ // (possibily modified) version of this item.
+ if( m_override && m_override->Overrides( aCandidate ) )
+ return true;
+
+ return false;
+}
+
+
+// function object that visits potential obstacles and performs
+// the actual collision refining
+struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
+{
+ ///> list of encountered obstacles
+ OBSTACLES& m_tab;
+
+ ///> acccepted kinds of colliding items (solids, vias, segments, etc...)
+ int m_kindMask;
+
+ ///> max number of hits
+ int m_limitCount;
+
+ ///> number of items found so far
+ int m_matchCount;
+
+ ///> additional clearance
+ int m_extraClearance;
+
+ bool m_differentNetsOnly;
+
+ int m_forceClearance;
+
+ DEFAULT_OBSTACLE_VISITOR( NODE::OBSTACLES& aTab, const ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) :
+ OBSTACLE_VISITOR( aItem ),
+ m_tab( aTab ),
+ m_kindMask( aKindMask ),
+ m_limitCount( -1 ),
+ m_matchCount( 0 ),
+ m_extraClearance( 0 ),
+ m_differentNetsOnly( aDifferentNetsOnly ),
+ m_forceClearance( -1 )
+ {
+ }
+
+ void SetCountLimit( int aLimit )
+ {
+ m_limitCount = aLimit;
+ }
+
+ bool operator()( ITEM* aCandidate )
+ {
+ if( !aCandidate->OfKind( m_kindMask ) )
+ return true;
+
+ if( visit( aCandidate ) )
+ return true;
+
+ int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
+
+ if( aCandidate->Kind() == ITEM::LINE_T ) // this should never happen.
+ {
+ assert( false );
+ clearance += static_cast<LINE*>( aCandidate )->Width() / 2;
+ }
+
+ if( m_forceClearance >= 0 )
+ clearance = m_forceClearance;
+
+ if( !aCandidate->Collide( m_item, clearance, m_differentNetsOnly ) )
+ return true;
+
+ OBSTACLE obs;
+
+ obs.m_item = aCandidate;
+ obs.m_head = m_item;
+ m_tab.push_back( obs );
+
+ m_matchCount++;
+
+ if( m_limitCount > 0 && m_matchCount >= m_limitCount )
+ return false;
+
+ return true;
+ };
+};
+
+
+int NODE::QueryColliding( const ITEM* aItem, OBSTACLE_VISITOR& aVisitor )
+{
+ aVisitor.SetWorld( this, NULL );
+ m_index->Query( aItem, m_maxClearance, aVisitor );
+
+ // if we haven't found enough items, look in the root branch as well.
+ if( !isRoot() )
+ {
+ aVisitor.SetWorld( m_root, this );
+ m_root->m_index->Query( aItem, m_maxClearance, aVisitor );
+ }
+
+ return 0;
+}
+
+
+int NODE::QueryColliding( const ITEM* aItem,
+ NODE::OBSTACLES& aObstacles, int aKindMask, int aLimitCount, bool aDifferentNetsOnly, int aForceClearance )
+{
+ DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly );
+
+#ifdef DEBUG
+ assert( allocNodes.find( this ) != allocNodes.end() );
+#endif
+
+ visitor.SetCountLimit( aLimitCount );
+ visitor.SetWorld( this, NULL );
+ visitor.m_forceClearance = aForceClearance;
+ // first, look for colliding items in the local index
+ m_index->Query( aItem, m_maxClearance, visitor );
+
+ // if we haven't found enough items, look in the root branch as well.
+ if( !isRoot() && ( visitor.m_matchCount < aLimitCount || aLimitCount < 0 ) )
+ {
+ visitor.SetWorld( m_root, this );
+ m_root->m_index->Query( aItem, m_maxClearance, visitor );
+ }
+
+ return aObstacles.size();
+}
+
+
+NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask,
+ const std::set<ITEM*>* aRestrictedSet )
+{
+ OBSTACLES obs_list;
+ bool found_isects = false;
+
+ const SHAPE_LINE_CHAIN& line = aItem->CLine();
+
+ obs_list.reserve( 100 );
+
+ int n = 0;
+
+ for( int i = 0; i < line.SegmentCount(); i++ )
+ {
+ const SEGMENT s( *aItem, line.CSegment( i ) );
+ n += QueryColliding( &s, obs_list, aKindMask );
+ }
+
+ if( aItem->EndsWithVia() )
+ n += QueryColliding( &aItem->Via(), obs_list, aKindMask );
+
+ if( !n )
+ return OPT_OBSTACLE();
+
+ LINE& aLine = (LINE&) *aItem;
+
+ OBSTACLE nearest;
+ nearest.m_item = NULL;
+ nearest.m_distFirst = INT_MAX;
+
+ for( OBSTACLE obs : obs_list )
+ {
+ VECTOR2I ip_first, ip_last;
+ int dist_max = INT_MIN;
+
+ if( aRestrictedSet && aRestrictedSet->find( obs.m_item ) == aRestrictedSet->end() )
+ continue;
+
+ std::vector<SHAPE_LINE_CHAIN::INTERSECTION> isect_list;
+
+ int clearance = GetClearance( obs.m_item, &aLine );
+
+ SHAPE_LINE_CHAIN hull = obs.m_item->Hull( clearance, aItem->Width() );
+
+ if( aLine.EndsWithVia() )
+ {
+ int clearance = GetClearance( obs.m_item, &aLine.Via() );
+
+ SHAPE_LINE_CHAIN viaHull = aLine.Via().Hull( clearance, aItem->Width() );
+
+ viaHull.Intersect( hull, isect_list );
+
+ for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
+ {
+ int dist = aLine.CLine().Length() +
+ ( isect.p - aLine.Via().Pos() ).EuclideanNorm();
+
+ if( dist < nearest.m_distFirst )
+ {
+ found_isects = true;
+ nearest.m_distFirst = dist;
+ nearest.m_ipFirst = isect.p;
+ nearest.m_item = obs.m_item;
+ nearest.m_hull = hull;
+ }
+
+ if( dist > dist_max )
+ {
+ dist_max = dist;
+ ip_last = isect.p;
+ }
+ }
+ }
+
+ isect_list.clear();
+
+ hull.Intersect( aLine.CLine(), isect_list );
+
+ for( SHAPE_LINE_CHAIN::INTERSECTION isect : isect_list )
+ {
+ int dist = aLine.CLine().PathLength( isect.p );
+
+ if( dist < nearest.m_distFirst )
+ {
+ found_isects = true;
+ nearest.m_distFirst = dist;
+ nearest.m_ipFirst = isect.p;
+ nearest.m_item = obs.m_item;
+ nearest.m_hull = hull;
+ }
+
+ if( dist > dist_max )
+ {
+ dist_max = dist;
+ ip_last = isect.p;
+ }
+ }
+
+ nearest.m_ipLast = ip_last;
+ nearest.m_distLast = dist_max;
+ }
+
+ if( !found_isects )
+ nearest.m_item = obs_list[0].m_item;
+
+ return nearest;
+}
+
+
+NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM_SET& aSet, int aKindMask )
+{
+ for( const ITEM* item : aSet.CItems() )
+ {
+ OPT_OBSTACLE obs = CheckColliding( item, aKindMask );
+
+ if( obs )
+ return obs;
+ }
+
+ return OPT_OBSTACLE();
+}
+
+
+NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM* aItemA, int aKindMask )
+{
+ OBSTACLES obs;
+
+ obs.reserve( 100 );
+
+ if( aItemA->Kind() == ITEM::LINE_T )
+ {
+ int n = 0;
+ const LINE* line = static_cast<const LINE*>( aItemA );
+ const SHAPE_LINE_CHAIN& l = line->CLine();
+
+ for( int i = 0; i < l.SegmentCount(); i++ )
+ {
+ const SEGMENT s( *line, l.CSegment( i ) );
+ n += QueryColliding( &s, obs, aKindMask, 1 );
+
+ if( n )
+ return OPT_OBSTACLE( obs[0] );
+ }
+
+ if( line->EndsWithVia() )
+ {
+ n += QueryColliding( &line->Via(), obs, aKindMask, 1 );
+
+ if( n )
+ return OPT_OBSTACLE( obs[0] );
+ }
+ }
+ else if( QueryColliding( aItemA, obs, aKindMask, 1 ) > 0 )
+ return OPT_OBSTACLE( obs[0] );
+
+ return OPT_OBSTACLE();
+}
+
+
+bool NODE::CheckColliding( const ITEM* aItemA, const ITEM* aItemB, int aKindMask, int aForceClearance )
+{
+ assert( aItemB );
+ int clearance;
+ if( aForceClearance >= 0 )
+ clearance = aForceClearance;
+ else
+ clearance = GetClearance( aItemA, aItemB );
+
+ // fixme: refactor
+ if( aItemA->Kind() == ITEM::LINE_T )
+ clearance += static_cast<const LINE*>( aItemA )->Width() / 2;
+ if( aItemB->Kind() == ITEM::LINE_T )
+ clearance += static_cast<const LINE*>( aItemB )->Width() / 2;
+
+ return aItemA->Collide( aItemB, clearance );
+}
+
+
+struct HIT_VISITOR : public OBSTACLE_VISITOR
+{
+ ITEM_SET& m_items;
+ const VECTOR2I& m_point;
+
+ HIT_VISITOR( ITEM_SET& aTab, const VECTOR2I& aPoint ) :
+ OBSTACLE_VISITOR( NULL ),
+ m_items( aTab ), m_point( aPoint )
+ {}
+
+ bool operator()( ITEM* aItem )
+ {
+ SHAPE_CIRCLE cp( m_point, 0 );
+
+ int cl = 0;
+
+ if( aItem->Shape()->Collide( &cp, cl ) )
+ m_items.Add( aItem );
+
+ return true;
+ }
+};
+
+
+const ITEM_SET NODE::HitTest( const VECTOR2I& aPoint ) const
+{
+ ITEM_SET items;
+
+ // fixme: we treat a point as an infinitely small circle - this is inefficient.
+ SHAPE_CIRCLE s( aPoint, 0 );
+ HIT_VISITOR visitor( items, aPoint );
+ visitor.SetWorld( this, NULL );
+
+ m_index->Query( &s, m_maxClearance, visitor );
+
+ if( !isRoot() ) // fixme: could be made cleaner
+ {
+ ITEM_SET items_root;
+ visitor.SetWorld( m_root, NULL );
+ HIT_VISITOR visitor_root( items_root, aPoint );
+ m_root->m_index->Query( &s, m_maxClearance, visitor_root );
+
+ for( ITEM* item : items_root.Items() )
+ {
+ if( !Overrides( item ) )
+ items.Add( item );
+ }
+ }
+
+ return items;
+}
+
+
+void NODE::addSolidIndex( SOLID* aSolid )
+{
+ linkJoint( aSolid->Pos(), aSolid->Layers(), aSolid->Net(), aSolid );
+ m_index->Add( aSolid );
+}
+
+void NODE::Add( std::unique_ptr< SOLID > aSolid )
+{
+<<<<<<< HEAD
+ addSolid( aSolid.release() );
+=======
+ aSolid->SetOwner( this );
+ addSolidIndex( aSolid.release() );
+>>>>>>> 0371f40... remove garbage items functionality (delete removed items early)
+}
+
+void NODE::addViaIndex( VIA* aVia )
+{
+ linkJoint( aVia->Pos(), aVia->Layers(), aVia->Net(), aVia );
+ m_index->Add( aVia );
+}
+
+void NODE::Add( std::unique_ptr< VIA > aVia )
+{
+<<<<<<< HEAD
+ addVia( aVia.release() );
+=======
+ aVia->SetOwner( this );
+ addViaIndex( aVia.release() );
+>>>>>>> 0371f40... remove garbage items functionality (delete removed items early)
+}
+
+void NODE::addLine( LINE& aLine, bool aAllowRedundant )
+{
+ SHAPE_LINE_CHAIN& l = aLine.Line();
+
+ for( int i = 0; i < l.SegmentCount(); i++ )
+ {
+ SEG s = l.CSegment( i );
+
+ if( s.A != s.B )
+ {
+ SEGMENT* pseg = new SEGMENT( aLine, s );
+ SEGMENT* psegR = NULL;
+
+ if( !aAllowRedundant )
+ psegR = findRedundantSegment( pseg );
+
+ if( psegR )
+ {
+ aLine.LinkSegment( psegR );
+ delete pseg;
+ }
+ else
+ {
+ pseg->SetOwner( this );
+
+ linkJoint( s.A, pseg->Layers(), aLine.Net(), pseg );
+ linkJoint( s.B, pseg->Layers(), aLine.Net(), pseg );
+
+ aLine.LinkSegment( pseg );
+
+ m_index->Add( pseg );
+ }
+ }
+ }
+}
+
+void NODE::Add( LINE& aLine, bool aAllowRedundant )
+{
+ assert( !aLine.IsLinked() );
+ addLine( aLine, aAllowRedundant );
+}
+
+void NODE::addSegmentIndex( SEGMENT* aSeg )
+{
+ linkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
+ linkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
+
+ m_index->Add( aSeg );
+}
+
+void NODE::Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant )
+{
+<<<<<<< HEAD
+ addSegment( aSegment.release(), aAllowRedundant );
+=======
+ if( aSegment->Seg().A == aSegment->Seg().B )
+ {
+ wxLogTrace( "PNS", "attempting to add a segment with same end coordinates, ignoring." );
+ return;
+ }
+
+ if( !aAllowRedundant && findRedundantSegment( aSegment.get() ) )
+ return;
+
+ aSegment->SetOwner( this );
+ addSegmentIndex( aSegment.release() );
+>>>>>>> 0371f40... remove garbage items functionality (delete removed items early)
+}
+
+void NODE::Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant )
+{
+ aItem->SetOwner( this );
+
+ switch( aItem->Kind() )
+ {
+ case ITEM::SOLID_T:
+ Add( ItemCast<SOLID>( std::move( aItem ) ) );
+ break;
+
+ case ITEM::SEGMENT_T:
+ Add( ItemCast<SEGMENT>( std::move( aItem ) ), aAllowRedundant );
+ break;
+
+ case ITEM::LINE_T:
+ assert( false );
+ break;
+
+ case ITEM::VIA_T:
+ Add( ItemCast<VIA>( std::move( aItem ) ) );
+ break;
+
+ default:
+ assert( false );
+ }
+}
+
+
+void NODE::doRemove( ITEM* aItem )
+{
+ // Can't remove items in non-leaf-revisions.
+ assert( !m_children.size() );
+
+ // Can't remove items from child-revisions here
+ assert( aItem->Owner()->Depth() <= Depth() );
+
+ if( aItem->Owner() == this ) {
+ delete aItem;
+ } else {
+ // if the item doesn't belong to this node, it must
+ // have been added in an ancestor revision.
+ m_override.insert( aItem );
+ }
+}
+
+
+void NODE::removeSegmentIndex( SEGMENT* aSeg )
+{
+ unlinkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
+ unlinkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
+
+ m_index->Remove( aSeg );
+}
+
+void NODE::removeViaIndex( VIA* aVia )
+{
+ // We have to split a single joint (associated with a via, binding together multiple layers)
+ // into multiple independent joints. As I'm a lazy bastard, I simply delete the via and all its links and re-insert them.
+
+ JOINT::HASH_TAG tag;
+
+ VECTOR2I p( aVia->Pos() );
+ LAYER_RANGE vLayers( aVia->Layers() );
+ int net = aVia->Net();
+
+ JOINT* jt = FindJoint( p, vLayers.Start(), net );
+ JOINT::LINKED_ITEMS links( jt->LinkList() );
+
+ tag.net = net;
+ tag.pos = p;
+
+ bool split;
+ do
+ {
+ split = false;
+ std::pair<JOINT_MAP::iterator, JOINT_MAP::iterator> range = m_joints.equal_range( tag );
+
+ if( range.first == m_joints.end() )
+ break;
+
+ // find and remove all joints containing the via to be removed
+
+ for( JOINT_MAP::iterator f = range.first; f != range.second; ++f )
+ {
+ if( aVia->LayersOverlap( &f->second ) )
+ {
+ m_joints.erase( f );
+ split = true;
+ break;
+ }
+ }
+ } while( split );
+
+ // and re-link them, using the former via's link list
+ for(ITEM* item : links)
+ {
+ if( item != aVia )
+ linkJoint( p, item->Layers(), net, item );
+ }
+
+ m_index->Remove( aVia );
+}
+
+void NODE::removeSolidIndex( SOLID* aSolid )
+{
+ // fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care.
+ m_index->Remove( aSolid );
+}
+
+
+void NODE::Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem )
+{
+ Remove( aOldItem );
+ Add( std::move( aNewItem ) );
+}
+
+void NODE::Replace( LINE& aOldLine, LINE& aNewLine )
+{
+ Remove( aOldLine );
+ Add( aNewLine );
+}
+
+void NODE::Remove( SOLID* aSolid )
+{
+ removeSolidIndex( aSolid );
+ doRemove( aSolid );
+}
+
+void NODE::Remove( VIA* aVia )
+{
+ removeViaIndex( aVia );
+ doRemove( aVia );
+}
+
+void NODE::Remove( SEGMENT* aSegment )
+{
+ removeSegmentIndex( aSegment );
+ doRemove( aSegment );
+}
+
+void NODE::Remove( ITEM* aItem )
+{
+ switch( aItem->Kind() )
+ {
+ case ITEM::SOLID_T:
+ Remove( static_cast<SOLID*>( aItem ) );
+ break;
+
+ case ITEM::SEGMENT_T:
+ Remove( static_cast<SEGMENT*>( aItem ) );
+ break;
+
+ case ITEM::LINE_T:
+ assert( false );
+ break;
+
+ case ITEM::VIA_T:
+ Remove( static_cast<VIA*>( aItem ) );
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void NODE::Remove( LINE& aLine )
+{
+ // LINE does not have a seperate remover, as LINEs are never truly a member of the tree
+ std::vector<SEGMENT*>& segRefs = aLine.LinkedSegments();
+
+ for( SEGMENT* seg : segRefs )
+ {
+ Remove( seg );
+ }
+
+ aLine.ClearSegmentLinks();
+}
+
+
+void NODE::followLine( SEGMENT* aCurrent, bool aScanDirection, int& aPos,
+ int aLimit, VECTOR2I* aCorners, SEGMENT** aSegments, bool& aGuardHit,
+ bool aStopAtLockedJoints )
+{
+ bool prevReversed = false;
+
+ const VECTOR2I guard = aScanDirection ? aCurrent->Seg().B : aCurrent->Seg().A;
+
+ for( int count = 0 ; ; ++count )
+ {
+ const VECTOR2I p =
+ ( aScanDirection ^ prevReversed ) ? aCurrent->Seg().B : aCurrent->Seg().A;
+ const JOINT* jt = FindJoint( p, aCurrent );
+
+ assert( jt );
+
+ aCorners[aPos] = jt->Pos();
+ aSegments[aPos] = aCurrent;
+ aPos += ( aScanDirection ? 1 : -1 );
+
+ if( count && guard == p)
+ {
+ aSegments[aPos] = NULL;
+ aGuardHit = true;
+ break;
+ }
+
+ bool locked = aStopAtLockedJoints ? jt->IsLocked() : false;
+
+ if( locked || !jt->IsLineCorner() || aPos < 0 || aPos == aLimit )
+ break;
+
+ aCurrent = jt->NextSegment( aCurrent );
+
+ prevReversed =
+ ( jt->Pos() == ( aScanDirection ? aCurrent->Seg().B : aCurrent->Seg().A ) );
+ }
+}
+
+
+const LINE NODE::AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex, bool aStopAtLockedJoints )
+{
+ const int MaxVerts = 1024 * 16;
+
+ VECTOR2I corners[MaxVerts + 1];
+ SEGMENT* segs[MaxVerts + 1];
+
+ LINE pl;
+ bool guardHit = false;
+
+ int i_start = MaxVerts / 2, i_end = i_start + 1;
+
+ pl.SetWidth( aSeg->Width() );
+ pl.SetLayers( aSeg->Layers() );
+ pl.SetNet( aSeg->Net() );
+ pl.SetOwner( this );
+
+ followLine( aSeg, false, i_start, MaxVerts, corners, segs, guardHit, aStopAtLockedJoints );
+
+ if( !guardHit )
+ followLine( aSeg, true, i_end, MaxVerts, corners, segs, guardHit, aStopAtLockedJoints );
+
+ int n = 0;
+
+ SEGMENT* prev_seg = NULL;
+ bool originSet = false;
+
+ for( int i = i_start + 1; i < i_end; i++ )
+ {
+ const VECTOR2I& p = corners[i];
+
+ pl.Line().Append( p );
+
+ if( segs[i] && prev_seg != segs[i] )
+ {
+ pl.LinkSegment( segs[i] );
+
+ // latter condition to avoid loops
+ if( segs[i] == aSeg && aOriginSegmentIndex && !originSet )
+ {
+ *aOriginSegmentIndex = n;
+ originSet = true;
+ }
+ n++;
+ }
+
+ prev_seg = segs[i];
+ }
+
+ assert( pl.SegmentCount() != 0 );
+
+ return pl;
+}
+
+
+void NODE::FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB )
+{
+ aA = *FindJoint( aLine.CPoint( 0 ), &aLine );
+ aB = *FindJoint( aLine.CPoint( -1 ), &aLine );
+}
+
+
+#if 0
+void NODE::MapConnectivity( JOINT* aStart, std::vector<JOINT*>& aFoundJoints )
+{
+ std::deque<JOINT*> searchQueue;
+ std::set<JOINT*> processed;
+
+ searchQueue.push_back( aStart );
+ processed.insert( aStart );
+
+ while( !searchQueue.empty() )
+ {
+ JOINT* current = searchQueue.front();
+ searchQueue.pop_front();
+
+ for( ITEM* item : current->LinkList() )
+ {
+ if( item->OfKind( ITEM::SEGMENT_T ) )
+ {
+ SEGMENT* seg = static_cast<SEGMENT *>( item );
+ JOINT* a = FindJoint( seg->Seg().A, seg );
+ JOINT* b = FindJoint( seg->Seg().B, seg );
+ JOINT* next = ( *a == *current ) ? b : a;
+
+ if( processed.find( next ) == processed.end() )
+ {
+ processed.insert( next );
+ searchQueue.push_back( next );
+ }
+ }
+ }
+ }
+
+ for(JOINT* jt : processed)
+ aFoundJoints.push_back( jt );
+}
+#endif
+
+
+int NODE::FindLinesBetweenJoints( JOINT& aA, JOINT& aB, std::vector<LINE>& aLines )
+{
+ for( ITEM* item : aA.LinkList() )
+ {
+ if( item->Kind() == ITEM::SEGMENT_T )
+ {
+ SEGMENT* seg = static_cast<SEGMENT*>( item );
+ LINE line = AssembleLine( seg );
+
+ if( !line.Layers().Overlaps( aB.Layers() ) )
+ continue;
+
+ JOINT j_start, j_end;
+
+ FindLineEnds( line, j_start, j_end );
+
+ int id_start = line.CLine().Find( aA.Pos() );
+ int id_end = line.CLine().Find( aB.Pos() );
+
+ if( id_end < id_start )
+ std::swap( id_end, id_start );
+
+ if( id_start >= 0 && id_end >= 0 )
+ {
+ line.ClipVertexRange( id_start, id_end );
+ aLines.push_back( line );
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+JOINT* NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet )
+{
+ JOINT::HASH_TAG tag;
+
+ tag.net = aNet;
+ tag.pos = aPos;
+
+ JOINT_MAP::iterator f = m_joints.find( tag ), end = m_joints.end();
+
+ if( f == end && !isRoot() )
+ {
+ end = m_root->m_joints.end();
+ f = m_root->m_joints.find( tag ); // m_root->FindJoint(aPos, aLayer, aNet);
+ }
+
+ if( f == end )
+ return NULL;
+
+ while( f != end )
+ {
+ if( f->second.Layers().Overlaps( aLayer ) )
+ return &f->second;
+
+ ++f;
+ }
+
+ return NULL;
+}
+
+
+void NODE::LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock )
+{
+ JOINT& jt = touchJoint( aPos, aItem->Layers(), aItem->Net() );
+ jt.Lock( aLock );
+}
+
+
+JOINT& NODE::touchJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet )
+{
+ JOINT::HASH_TAG tag;
+
+ tag.pos = aPos;
+ tag.net = aNet;
+
+ // try to find the joint in this node.
+ JOINT_MAP::iterator f = m_joints.find( tag );
+
+ std::pair<JOINT_MAP::iterator, JOINT_MAP::iterator> range;
+
+ // not found and we are not root? find in the root and copy results here.
+ if( f == m_joints.end() && !isRoot() )
+ {
+ range = m_root->m_joints.equal_range( tag );
+
+ for( f = range.first; f != range.second; ++f )
+ m_joints.insert( *f );
+ }
+
+ // now insert and combine overlapping joints
+ JOINT jt( aPos, aLayers, aNet );
+
+ bool merged;
+
+ do
+ {
+ merged = false;
+ range = m_joints.equal_range( tag );
+
+ if( range.first == m_joints.end() )
+ break;
+
+ for( f = range.first; f != range.second; ++f )
+ {
+ if( aLayers.Overlaps( f->second.Layers() ) )
+ {
+ jt.Merge( f->second );
+ m_joints.erase( f );
+ merged = true;
+ break;
+ }
+ }
+ }
+ while( merged );
+
+ return m_joints.insert( TagJointPair( tag, jt ) )->second;
+}
+
+
+void JOINT::Dump() const
+{
+ wxLogTrace( "PNS", "joint layers %d-%d, net %d, pos %s, links: %d\n", m_layers.Start(),
+ m_layers.End(), m_tag.net, m_tag.pos.Format().c_str(), LinkCount() );
+}
+
+
+void NODE::linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere )
+{
+ JOINT& jt = touchJoint( aPos, aLayers, aNet );
+
+ jt.Link( aWhere );
+}
+
+
+void NODE::unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere )
+{
+ // fixme: remove dangling joints
+ JOINT& jt = touchJoint( aPos, aLayers, aNet );
+
+ jt.Unlink( aWhere );
+}
+
+
+void NODE::Dump( bool aLong )
+{
+#if 0
+ boost::unordered_set<SEGMENT*> all_segs;
+ SHAPE_INDEX_LIST<ITEM*>::iterator i;
+
+ for( i = m_items.begin(); i != m_items.end(); i++ )
+ {
+ if( (*i)->GetKind() == ITEM::SEGMENT_T )
+ all_segs.insert( static_cast<SEGMENT*>( *i ) );
+ }
+
+ if( !isRoot() )
+ {
+ for( i = m_root->m_items.begin(); i != m_root->m_items.end(); i++ )
+ {
+ if( (*i)->GetKind() == ITEM::SEGMENT_T && !overrides( *i ) )
+ all_segs.insert( static_cast<SEGMENT*>(*i) );
+ }
+ }
+
+ JOINT_MAP::iterator j;
+
+ if( aLong )
+ for( j = m_joints.begin(); j != m_joints.end(); ++j )
+ {
+ wxLogTrace( "PNS", "joint : %s, links : %d\n",
+ j->second.GetPos().Format().c_str(), j->second.LinkCount() );
+ JOINT::LINKED_ITEMS::const_iterator k;
+
+ for( k = j->second.GetLinkList().begin(); k != j->second.GetLinkList().end(); ++k )
+ {
+ const ITEM* m_item = *k;
+
+ switch( m_item->GetKind() )
+ {
+ case ITEM::SEGMENT_T:
+ {
+ const SEGMENT* seg = static_cast<const SEGMENT*>( m_item );
+ wxLogTrace( "PNS", " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(),
+ seg->GetSeg().B.Format().c_str() );
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ }
+
+
+ int lines_count = 0;
+
+ while( !all_segs.empty() )
+ {
+ SEGMENT* s = *all_segs.begin();
+ LINE* l = AssembleLine( s );
+
+ LINE::LinkedSegments* seg_refs = l->GetLinkedSegments();
+
+ if( aLong )
+ wxLogTrace( "PNS", "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() );
+
+ for( std::vector<SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j )
+ {
+ wxLogTrace( "PNS", "%s ", (*j)->GetSeg().A.Format().c_str() );
+
+ if( j + 1 == seg_refs->end() )
+ wxLogTrace( "PNS", "%s\n", (*j)->GetSeg().B.Format().c_str() );
+
+ all_segs.erase( *j );
+ }
+
+ lines_count++;
+ }
+
+ wxLogTrace( "PNS", "Local joints: %d, lines : %d \n", m_joints.size(), lines_count );
+#endif
+}
+
+
+void NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
+{
+ aRemoved.reserve( m_override.size() );
+ aAdded.reserve( m_index->Size() );
+
+ if( isRoot() )
+ return;
+
+ for( ITEM* item : m_override )
+ aRemoved.push_back( item );
+
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ aAdded.push_back( *i );
+}
+
+void NODE::releaseChildren()
+{
+ // copy the kids as the NODE destructor erases the item from the parent node.
+ std::set<NODE*> kids = m_children;
+
+ for( NODE* node : kids )
+ {
+ node->releaseChildren();
+ delete node;
+ }
+}
+
+void NODE::Commit( NODE* aNode )
+{
+ if( aNode->isRoot() )
+ return;
+
+ for( ITEM* item : aNode->m_override )
+ Remove( item );
+
+ for( INDEX::ITEM_SET::iterator i = aNode->m_index->begin();
+ i != aNode->m_index->end(); ++i )
+ {
+ (*i)->SetRank( -1 );
+ (*i)->Unmark();
+ Add( std::unique_ptr<ITEM>( *i ) );
+ }
+
+ releaseChildren();
+}
+
+
+void NODE::KillChildren()
+{
+ assert( isRoot() );
+ releaseChildren();
+}
+
+
+void NODE::AllItemsInNet( int aNet, std::set<ITEM*>& aItems )
+{
+ INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aNet );
+
+ if( l_cur )
+ {
+ for( ITEM*item : *l_cur )
+ aItems.insert( item );
+ }
+
+ if( !isRoot() )
+ {
+ INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet );
+
+ if( l_root )
+ for( INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i )
+ if( !Overrides( *i ) )
+ aItems.insert( *i );
+ }
+}
+
+
+void NODE::ClearRanks( int aMarkerMask )
+{
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ {
+ (*i)->SetRank( -1 );
+ (*i)->Mark( (*i)->Marker() & (~aMarkerMask) );
+ }
+}
+
+
+int NODE::FindByMarker( int aMarker, ITEM_SET& aItems )
+{
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ {
+ if( (*i)->Marker() & aMarker )
+ aItems.Add( *i );
+ }
+
+ return 0;
+}
+
+
+int NODE::RemoveByMarker( int aMarker )
+{
+ std::list<ITEM*> garbage;
+
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ {
+ if( (*i)->Marker() & aMarker )
+ {
+ garbage.push_back( *i );
+ }
+ }
+
+ for( std::list<ITEM*>::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i )
+ {
+ Remove( *i );
+ }
+
+ return 0;
+}
+
+
+SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg )
+{
+ JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg );
+
+ if( !jtStart )
+ return NULL;
+
+ for( ITEM* item : jtStart->LinkList() )
+ {
+ if( item->OfKind( ITEM::SEGMENT_T ) )
+ {
+ SEGMENT* seg2 = (SEGMENT*) item;
+
+ const VECTOR2I a1( aSeg->Seg().A );
+ const VECTOR2I b1( aSeg->Seg().B );
+
+ const VECTOR2I a2( seg2->Seg().A );
+ const VECTOR2I b2( seg2->Seg().B );
+
+ if( seg2->Layers().Start() == aSeg->Layers().Start() &&
+ ( ( a1 == a2 && b1 == b2 ) || ( a1 == b2 && a2 == b1 ) ) )
+ return seg2;
+ }
+ }
+
+ return NULL;
+}
+
+
+ITEM *NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
+{
+ INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
+
+ for( ITEM*item : *l_cur )
+ if( item->Parent() == aParent )
+ return item;
+
+ return NULL;
+}
+
+}
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index cdb8a16..f05803b 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -36,6 +37,8 @@
#include "pns_joint.h"
#include "pns_itemset.h"
+namespace PNS {
+
class PNS_SEGMENT;
class PNS_LINE;
class PNS_SOLID;
@@ -487,4 +490,6 @@ private:
boost::unordered_set<PNS_ITEM*> m_garbageItems;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_node.h.orig b/pcbnew/router/pns_node.h.orig
new file mode 100644
index 0000000..7e1c0dc
--- /dev/null
+++ b/pcbnew/router/pns_node.h.orig
@@ -0,0 +1,512 @@
+/*
+ * KiRouter - a push-and-(sometimes-)shove PCB router
+ *
+ * Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
+ * Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __PNS_NODE_H
+#define __PNS_NODE_H
+
+#include <vector>
+#include <list>
+
+#include <boost/unordered_set.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/optional.hpp>
+
+#include <geometry/shape.h>
+#include <geometry/shape_line_chain.h>
+#include <geometry/shape_index.h>
+
+#include "pns_item.h"
+#include "pns_joint.h"
+#include "pns_itemset.h"
+
+namespace PNS {
+
+class SEGMENT;
+class LINE;
+class SOLID;
+class VIA;
+class INDEX;
+class ROUTER;
+class NODE;
+
+/**
+ * Class RULE_RESOLVER
+ *
+ * An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between two items.
+ **/
+
+class RULE_RESOLVER
+{
+public:
+ virtual ~RULE_RESOLVER() {}
+
+ virtual int Clearance( const ITEM* aA, const ITEM* aB ) = 0;
+ virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) = 0;
+ virtual void UseDpGap( bool aUseDpGap ) = 0;
+ virtual int DpCoupledNet( int aNet ) = 0;
+ virtual int DpNetPolarity( int aNet ) = 0;
+ virtual bool DpNetPair( ITEM* aItem, int& aNetP, int& aNetN ) = 0;
+};
+
+/**
+ * Struct OBSTACLE
+ *
+ * Holds an object colliding with another object, along with
+ * some useful data about the collision.
+ **/
+struct OBSTACLE
+{
+ ///> Item we search collisions with
+ const ITEM* m_head;
+
+ ///> Item found to be colliding with m_head
+ ITEM* m_item;
+
+ ///> Hull of the colliding m_item
+ SHAPE_LINE_CHAIN m_hull;
+
+ ///> First and last intersection point between the head item and the hull
+ ///> of the colliding m_item
+ VECTOR2I m_ipFirst, m_ipLast;
+
+ ///> ... and the distance thereof
+ int m_distFirst, m_distLast;
+};
+
+/**
+ * Struct OBSTACLE_VISITOR
+ **/
+class OBSTACLE_VISITOR {
+
+public:
+
+ OBSTACLE_VISITOR( const ITEM* aItem );
+
+ void SetWorld( const NODE* aNode, const NODE* aOverride = NULL );
+
+ virtual bool operator()( ITEM* aCandidate ) = 0;
+
+protected:
+
+ bool visit( ITEM* aCandidate );
+
+ ///> the item we are looking for collisions with
+ const ITEM* m_item;
+
+ ///> node we are searching in (either root or a branch)
+ const NODE* m_node;
+
+ ///> node that overrides root entries
+ const NODE* m_override;
+
+ ///> additional clearance
+ int m_extraClearance;
+};
+
+/**
+ * Class NODE
+ *
+ * Keeps the router "world" - i.e. all the tracks, vias, solids in a
+ * hierarchical and indexed way.
+ * Features:
+ * - spatial-indexed container for PCB item shapes
+ * - collision search & clearance checking
+ * - assembly of lines connecting joints, finding loops and unique paths
+ * - lightweight cloning/branching (for recursive optimization and shove
+ * springback)
+ **/
+class NODE
+{
+public:
+ typedef boost::optional<OBSTACLE> OPT_OBSTACLE;
+ typedef std::vector<ITEM*> ITEM_VECTOR;
+ typedef std::vector<OBSTACLE> OBSTACLES;
+
+ NODE();
+ ~NODE();
+
+ ///> Returns the expected clearance between items a and b.
+ int GetClearance( const ITEM* aA, const ITEM* aB ) const;
+
+ ///> Returns the pre-set worst case clearance between any pair of items
+ int GetMaxClearance() const
+ {
+ return m_maxClearance;
+ }
+
+ ///> Sets the worst-case clerance between any pair of items
+ void SetMaxClearance( int aClearance )
+ {
+ m_maxClearance = aClearance;
+ }
+
+ ///> Assigns a clerance resolution function object
+ void SetRuleResolver( RULE_RESOLVER* aFunc )
+ {
+ m_ruleResolver = aFunc;
+ }
+
+ RULE_RESOLVER* GetRuleResolver()
+ {
+ return m_ruleResolver;
+ }
+
+ ///> Returns the number of joints
+ int JointCount() const
+ {
+ return m_joints.size();
+ }
+
+ ///> Returns the number of nodes in the inheritance chain (wrs to the root node)
+ int Depth() const
+ {
+ return m_depth;
+ }
+
+ /**
+ * Function QueryColliding()
+ *
+ * Finds items collliding (closer than clearance) with the item aItem.
+ * @param aItem item to check collisions against
+ * @param aObstacles set of colliding objects found
+ * @param aKindMask mask of obstacle types to take into account
+ * @param aLimitCount stop looking for collisions after finding this number of colliding items
+ * @return number of obstacles found
+ */
+ int QueryColliding( const ITEM* aItem,
+ OBSTACLES& aObstacles,
+ int aKindMask = ITEM::ANY_T,
+ int aLimitCount = -1,
+ bool aDifferentNetsOnly = true,
+ int aForceClearance = -1 );
+
+ int QueryColliding( const ITEM* aItem,
+ OBSTACLE_VISITOR& aVisitor
+ );
+
+ /**
+ * Function NearestObstacle()
+ *
+ * Follows the line in search of an obstacle that is nearest to the starting to the line's starting
+ * point.
+ * @param aItem the item to find collisions with
+ * @param aKindMask mask of obstacle types to take into account
+ * @return the obstacle, if found, otherwise empty.
+ */
+ OPT_OBSTACLE NearestObstacle( const LINE* aItem,
+ int aKindMask = ITEM::ANY_T,
+ const std::set<ITEM*>* aRestrictedSet = NULL );
+
+ /**
+ * Function CheckColliding()
+ *
+ * Checks if the item collides with anything else in the world,
+ * and if found, returns the obstacle.
+ * @param aItem the item to find collisions with
+ * @param aKindMask mask of obstacle types to take into account
+ * @return the obstacle, if found, otherwise empty.
+ */
+ OPT_OBSTACLE CheckColliding( const ITEM* aItem,
+ int aKindMask = ITEM::ANY_T );
+
+
+ /**
+ * Function CheckColliding()
+ *
+ * Checks if any item in the set collides with anything else in the world,
+ * and if found, returns the obstacle.
+ * @param aSet set of items to find collisions with
+ * @param aKindMask mask of obstacle types to take into account
+ * @return the obstacle, if found, otherwise empty.
+ */
+ OPT_OBSTACLE CheckColliding( const ITEM_SET& aSet,
+ int aKindMask = ITEM::ANY_T );
+
+
+ /**
+ * Function CheckColliding()
+ *
+ * Checks if 2 items collide.
+ * and if found, returns the obstacle.
+ * @param aItemA first item to find collisions with
+ * @param aItemB second item to find collisions with
+ * @param aKindMask mask of obstacle types to take into account
+ * @return the obstacle, if found, otherwise empty.
+ */
+ bool CheckColliding( const ITEM* aItemA,
+ const ITEM* aItemB,
+ int aKindMask = ITEM::ANY_T,
+ int aForceClearance = -1 );
+
+ /**
+ * Function HitTest()
+ *
+ * Finds all items that contain the point aPoint.
+ * @param aPoint the point
+ * @return the items
+ */
+ const ITEM_SET HitTest( const VECTOR2I& aPoint ) const;
+
+ /**
+ * Function Add()
+ *
+ * Adds an item to the current node.
+ * @param aItem item to add
+ * @param aAllowRedundant if true, duplicate items are allowed (e.g. a segment or via
+ * at the same coordinates as an existing one)
+ */
+ void Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant = false );
+ void Add( std::unique_ptr< SOLID > aSolid );
+ void Add( std::unique_ptr< VIA > aVia );
+
+ void Add( LINE& aLine, bool aAllowRedundant = false );
+
+private:
+ void Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant = false );
+
+public:
+ /**
+ * Function Remove()
+ *
+ * Just as the name says, removes an item from this branch.
+ * @param aItem item to remove
+ */
+ void Remove( SOLID* aSolid );
+ void Remove( VIA* aVia );
+ void Remove( SEGMENT* aSegment );
+ void Remove( ITEM* aItem );
+
+public:
+ /**
+ * Function Remove()
+ *
+ * Just as the name says, removes a line from this branch.
+ * @param aItem item to remove
+ */
+ void Remove( LINE& aLine );
+
+ /**
+ * Function Replace()
+ *
+ * Just as the name says, replaces an item with another one.
+ * @param aOldItem item to be removed
+ * @param aNewItem item add instead
+ */
+ void Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem );
+ void Replace( LINE& aOldLine, LINE& aNewLine );
+
+ /**
+ * Function Branch()
+ *
+ * Creates a lightweight copy (called branch) of self that tracks
+ * the changes (added/removed items) wrs to the root. Note that if there are
+ * any branches in use, their parents must NOT be deleted.
+ * @return the new branch
+ */
+ NODE* Branch();
+
+ /**
+ * Function AssembleLine()
+ *
+ * Follows the joint map to assemble a line connecting two non-trivial
+ * joints starting from segment aSeg.
+ * @param aSeg the initial segment
+ * @param aOriginSegmentIndex index of aSeg in the resulting line
+ * @return the line
+ */
+ const LINE AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex = NULL,
+ bool aStopAtLockedJoints = false );
+
+ ///> Prints the contents and joints structure
+ void Dump( bool aLong = false );
+
+ /**
+ * Function GetUpdatedItems()
+ *
+ * Returns the lists of items removed and added in this branch, with
+ * respect to the root branch.
+ * @param aRemoved removed items
+ * @param aAdded added items
+ */
+ void GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded );
+
+ /**
+ * Function Commit()
+ *
+ * Applies the changes from a given branch (aNode) to the root branch. Called on
+ * a non-root branch will fail. Calling commit also kills all children nodes of the root branch.
+ * @param aNode node to commit changes from
+ */
+ void Commit( NODE* aNode );
+
+ /**
+ * Function FindJoint()
+ *
+ * Searches for a joint at a given position, layer and belonging to given net.
+ * @return the joint, if found, otherwise empty
+ */
+ JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, int aNet );
+
+ void LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock );
+
+ /**
+ * Function FindJoint()
+ *
+ * Searches for a joint at a given position, linked to given item.
+ * @return the joint, if found, otherwise empty
+ */
+ JOINT* FindJoint( const VECTOR2I& aPos, const ITEM* aItem )
+ {
+ return FindJoint( aPos, aItem->Layers().Start(), aItem->Net() );
+ }
+
+#if 0
+ void MapConnectivity( JOINT* aStart, std::vector<JOINT*> & aFoundJoints );
+
+ ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = NULL,
+ int aKindMask = ITEM::ANY_T);
+
+#endif
+
+ ///> finds all lines between a pair of joints. Used by the loop removal procedure.
+ int FindLinesBetweenJoints( JOINT& aA,
+ JOINT& aB,
+ std::vector<LINE>& aLines );
+
+ ///> finds the joints corresponding to the ends of line aLine
+ void FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB );
+
+ ///> Destroys all child nodes. Applicable only to the root node.
+ void KillChildren();
+
+ void AllItemsInNet( int aNet, std::set<ITEM*>& aItems );
+
+ void ClearRanks( int aMarkerMask = MK_HEAD | MK_VIOLATION );
+
+ int FindByMarker( int aMarker, ITEM_SET& aItems );
+ int RemoveByMarker( int aMarker );
+
+ ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent );
+
+ bool HasChildren() const
+ {
+ return !m_children.empty();
+ }
+
+ ///> checks if this branch contains an updated version of the m_item
+ ///> from the root branch.
+ bool Overrides( ITEM* aItem ) const
+ {
+ return m_override.find( aItem ) != m_override.end();
+ }
+
+private:
+ struct DEFAULT_OBSTACLE_VISITOR;
+ typedef boost::unordered_multimap<JOINT::HASH_TAG, JOINT> JOINT_MAP;
+ typedef JOINT_MAP::value_type TagJointPair;
+
+ /// nodes are not copyable
+ NODE( const NODE& aB );
+ NODE& operator=( const NODE& aB );
+
+ ///> tries to find matching joint and creates a new one if not found
+ JOINT& touchJoint( const VECTOR2I& aPos,
+ const LAYER_RANGE& aLayers,
+ int aNet );
+
+ ///> touches a joint and links it to an m_item
+ void linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere );
+
+ ///> unlinks an item from a joint
+ void unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere );
+
+ ///> helpers for adding/removing items
+ void addSolidIndex( SOLID* aSeg );
+ void addSegmentIndex( SEGMENT* aSeg );
+ void addViaIndex( VIA* aVia );
+
+<<<<<<< HEAD
+ void addLine( LINE& aLine, bool aAllowRedundant );
+
+ void removeLine( LINE& aLine );
+=======
+>>>>>>> 4f70b34... fix eager dynamic allocation in PNS::NODE::addLine
+ void removeSolidIndex( SOLID* aSeg );
+ void removeSegmentIndex( SEGMENT* aSeg );
+ void removeViaIndex( VIA* aVia );
+
+ void doRemove( ITEM* aItem );
+ void unlinkParent();
+ void releaseChildren();
+
+ bool isRoot() const
+ {
+ return m_parent == NULL;
+ }
+
+ SEGMENT* findRedundantSegment( const VECTOR2I& A, const VECTOR2I& B,
+ const LAYER_RANGE & lr, int aNet );
+ SEGMENT* findRedundantSegment( SEGMENT* aSeg );
+
+ ///> scans the joint map, forming a line starting from segment (current).
+ void followLine( SEGMENT* aCurrent,
+ bool aScanDirection,
+ int& aPos,
+ int aLimit,
+ VECTOR2I* aCorners,
+ SEGMENT** aSegments,
+ bool& aGuardHit,
+ bool aStopAtLockedJoints );
+
+ ///> hash table with the joints, linking the items. Joints are hashed by
+ ///> their position, layer set and net.
+ JOINT_MAP m_joints;
+
+ ///> node this node was branched from
+ NODE* m_parent;
+
+ ///> root node of the whole hierarchy
+ NODE* m_root;
+
+ ///> list of nodes branched from this one
+ std::set<NODE*> m_children;
+
+ ///> hash of root's items that have been changed in this node
+ boost::unordered_set<ITEM*> m_override;
+
+ ///> worst case item-item clearance
+ int m_maxClearance;
+
+ ///> Design rules resolver
+ RULE_RESOLVER* m_ruleResolver;
+
+ ///> Geometric/Net index of the items
+ INDEX* m_index;
+
+ ///> depth of the node (number of parent nodes in the inheritance chain)
+ int m_depth;
+};
+
+}
+
+#endif
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index ee6c424..8b1f394 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -32,6 +33,8 @@
#include "pns_utils.h"
#include "pns_router.h"
+namespace PNS {
+
/**
* Cost Estimator Methods
*/
@@ -1224,3 +1227,5 @@ bool PNS_OPTIMIZER::Optimize( PNS_DIFF_PAIR* aPair )
{
return mergeDpSegments( aPair );
}
+
+}
diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h
index 61a0923..3be4a36 100644
--- a/pcbnew/router/pns_optimizer.h
+++ b/pcbnew/router/pns_optimizer.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,8 @@
#include "range.h"
+namespace PNS {
+
class PNS_NODE;
class PNS_ROUTER;
class PNS_LINE;
@@ -178,4 +181,6 @@ private:
bool m_restrictAreaActive;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_placement_algo.h b/pcbnew/router/pns_placement_algo.h
index 6598d82..de61c64 100644
--- a/pcbnew/router/pns_placement_algo.h
+++ b/pcbnew/router/pns_placement_algo.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -27,6 +28,8 @@
#include "pns_sizes_settings.h"
#include "pns_itemset.h"
+namespace PNS {
+
class PNS_ROUTER;
class PNS_ITEM;
class PNS_NODE;
@@ -182,4 +185,6 @@ public:
}
};
+}
+
#endif
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index 3af2fa4..41a1a0a 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -57,6 +58,7 @@
#include <layers_id_colors_and_visibility.h>
#include <geometry/convex_hull.h>
+namespace PNS {
// an ugly singleton for drawing debug items within the router context.
// To be fixed sometime in the future.
@@ -281,7 +283,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
aNode->GetUpdatedItems( removed, added );
- for ( auto item : added )
+ for ( auto item : added )
m_iface->DisplayItem( item );
for ( auto item : removed )
@@ -378,7 +380,7 @@ void PNS_ROUTER::StopRouting()
m_placer->GetModifiedNets( nets );
// Update the ratsnest with new changes
- for ( auto n : nets )
+ for ( auto n : nets )
m_iface->UpdateNet( n );
}
@@ -502,3 +504,5 @@ void PNS_ROUTER::SetInterface( PNS_ROUTER_IFACE *aIface )
m_iface = aIface;
m_iface->SetRouter( this );
}
+
+}
diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h
index 4803fbd..997bd8f 100644
--- a/pcbnew/router/pns_router.h
+++ b/pcbnew/router/pns_router.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -34,6 +35,16 @@
#include "pns_itemset.h"
#include "pns_node.h"
+namespace KIGFX
+{
+
+class VIEW;
+class VIEW_GROUP;
+
+};
+
+namespace PNS {
+
class PNS_DEBUG_DECORATOR;
class PNS_NODE;
class PNS_DIFF_PAIR_PLACER;
@@ -49,13 +60,6 @@ class PNS_RULE_RESOLVER;
class PNS_SHOVE;
class PNS_DRAGGER;
-namespace KIGFX
-{
- class VIEW;
- class VIEW_GROUP;
-};
-
-
enum PNS_ROUTER_MODE {
PNS_MODE_ROUTE_SINGLE = 1,
PNS_MODE_ROUTE_DIFF_PAIR,
@@ -271,4 +275,6 @@ private:
wxString m_failureReason;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp
index 4ff25e3..59340a3 100644
--- a/pcbnew/router/pns_routing_settings.cpp
+++ b/pcbnew/router/pns_routing_settings.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -23,6 +24,8 @@
#include "pns_routing_settings.h"
#include "direction.h"
+namespace PNS {
+
PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
{
m_routingMode = RM_Walkaround;
@@ -103,3 +106,5 @@ int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const
{
return m_shoveIterationLimit;
}
+
+}
diff --git a/pcbnew/router/pns_routing_settings.h b/pcbnew/router/pns_routing_settings.h
index f390045..6a2450c 100644
--- a/pcbnew/router/pns_routing_settings.h
+++ b/pcbnew/router/pns_routing_settings.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,8 @@
class DIRECTION_45;
class TOOL_SETTINGS;
+namespace PNS {
+
///> Routing modes
enum PNS_MODE
{
@@ -155,4 +158,6 @@ private:
TIME_LIMIT m_walkaroundTimeLimit;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h
index dbcb165..ed8c93a 100644
--- a/pcbnew/router/pns_segment.h
+++ b/pcbnew/router/pns_segment.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -30,6 +31,8 @@
#include "pns_item.h"
#include "pns_line.h"
+namespace PNS {
+
class PNS_NODE;
class PNS_SEGMENT : public PNS_ITEM
@@ -127,4 +130,6 @@ private:
SHAPE_SEGMENT m_seg;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index 1e92445..7cd9aab 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -42,6 +43,8 @@
#include <profile.h>
+namespace PNS {
+
void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew )
{
OPT_BOX2I changed_area = ChangedArea( aOld, aNew );
@@ -1407,3 +1410,5 @@ void PNS_SHOVE::SetInitialLine( PNS_LINE& aInitial )
m_root = m_root->Branch();
m_root->Remove( &aInitial );
}
+
+}
diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h
index f9eb60b..7c8eea2 100644
--- a/pcbnew/router/pns_shove.h
+++ b/pcbnew/router/pns_shove.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -30,6 +31,8 @@
#include "pns_logger.h"
#include "range.h"
+namespace PNS {
+
class PNS_LINE;
class PNS_NODE;
class PNS_ROUTER;
@@ -156,4 +159,6 @@ private:
void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew );
};
+}
+
#endif // __PNS_SHOVE_H
diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp
index 3ec1f78..7b11c83 100644
--- a/pcbnew/router/pns_sizes_settings.cpp
+++ b/pcbnew/router/pns_sizes_settings.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -26,6 +27,8 @@
#include "pns_node.h"
#include "pns_sizes_settings.h"
+namespace PNS {
+
int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
{
VECTOR2I p;
@@ -165,3 +168,5 @@ int PNS_SIZES_SETTINGS::GetLayerBottom() const
else
return m_layerPairs.begin()->second;
}
+
+}
diff --git a/pcbnew/router/pns_sizes_settings.h b/pcbnew/router/pns_sizes_settings.h
index bb30c9a..3763178 100644
--- a/pcbnew/router/pns_sizes_settings.h
+++ b/pcbnew/router/pns_sizes_settings.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,9 @@
class BOARD;
class BOARD_DESIGN_SETTINGS;
+
+namespace PNS {
+
class PNS_ITEM;
class PNS_SIZES_SETTINGS {
@@ -110,4 +114,6 @@ private:
std::map<int, int> m_layerPairs;
};
+}
+
#endif // __PNS_SIZES_SETTINGS_H
diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp
index d728015..2d5e8ba 100644
--- a/pcbnew/router/pns_solid.cpp
+++ b/pcbnew/router/pns_solid.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,8 @@
#include "pns_solid.h"
#include "pns_utils.h"
+namespace PNS {
+
const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
{
int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2;
@@ -75,3 +78,5 @@ PNS_ITEM* PNS_SOLID::Clone() const
PNS_ITEM* solid = new PNS_SOLID( *this );
return solid;
}
+
+}
diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h
index 593b3b0..5324896 100644
--- a/pcbnew/router/pns_solid.h
+++ b/pcbnew/router/pns_solid.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,8 @@
#include "pns_item.h"
+namespace PNS {
+
class PNS_SOLID : public PNS_ITEM
{
public:
@@ -104,4 +107,6 @@ private:
VECTOR2I m_offset;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index d89a266..55d4e2f 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -57,6 +58,8 @@ using namespace std::placeholders;
using namespace KIGFX;
+namespace PNS {
+
TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
AS_CONTEXT, 'E',
_( "Routing Options..." ),
@@ -395,3 +398,5 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS
return anchor;
}
+
+}
diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h
index 4cf7df1..998581d 100644
--- a/pcbnew/router/pns_tool_base.h
+++ b/pcbnew/router/pns_tool_base.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
@@ -31,9 +32,12 @@
#include "pns_router.h"
-class PNS_TUNE_STATUS_POPUP;
class GRID_HELPER;
+
class PNS_KICAD_IFACE;
+class PNS_TUNE_STATUS_POPUP;
+
+namespace PNS {
class APIEXPORT PNS_TOOL_BASE : public TOOL_INTERACTIVE
{
@@ -80,4 +84,6 @@ protected:
PNS_ROUTER* m_router;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index 13fdac3..dce4dc4 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -31,6 +32,8 @@
#include <class_board.h>
+namespace PNS {
+
bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine )
{
if( !aLine->LinkedSegments() || !aLine->SegmentCount() )
@@ -304,7 +307,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() )
{
int dist = s->Seg().Distance( refSeg->Seg() );
- bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() );
+ bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() );
SEG p_clip, n_clip;
bool isCoupled = commonParallelProjection( refSeg->Seg(), s->Seg(), p_clip, n_clip );
@@ -382,3 +385,5 @@ const std::set<PNS_ITEM*> PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int a
return visited;
}
+
+}
diff --git a/pcbnew/router/pns_topology.h b/pcbnew/router/pns_topology.h
index 5a5a130..f16e499 100644
--- a/pcbnew/router/pns_topology.h
+++ b/pcbnew/router/pns_topology.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -26,6 +27,8 @@
#include "pns_itemset.h"
+namespace PNS {
+
class PNS_NODE;
class PNS_SEGMENT;
class PNS_JOINT;
@@ -68,4 +71,6 @@ private:
PNS_NODE *m_world;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_tune_status_popup.cpp b/pcbnew/router/pns_tune_status_popup.cpp
index 40be366..906fbbd 100644
--- a/pcbnew/router/pns_tune_status_popup.cpp
+++ b/pcbnew/router/pns_tune_status_popup.cpp
@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -36,9 +37,9 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP()
}
-void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter )
+void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter )
{
- PNS_MEANDER_PLACER_BASE* placer = dynamic_cast<PNS_MEANDER_PLACER_BASE*>( aRouter->Placer() );
+ PNS::PNS_MEANDER_PLACER_BASE* placer = dynamic_cast<PNS::PNS_MEANDER_PLACER_BASE*>( aRouter->Placer() );
if( !placer )
return;
@@ -49,13 +50,13 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter )
switch( placer->TuningStatus() )
{
- case PNS_MEANDER_PLACER::TUNED:
+ case PNS::PNS_MEANDER_PLACER::TUNED:
color = wxColour( 0, 255, 0 );
break;
- case PNS_MEANDER_PLACER::TOO_SHORT:
+ case PNS::PNS_MEANDER_PLACER::TOO_SHORT:
color = wxColour( 255, 128, 128 );
break;
- case PNS_MEANDER_PLACER::TOO_LONG:
+ case PNS::PNS_MEANDER_PLACER::TOO_LONG:
color = wxColour( 128, 128, 255 );
break;
}
diff --git a/pcbnew/router/pns_tune_status_popup.h b/pcbnew/router/pns_tune_status_popup.h
index c6fe469..52d4bf0 100644
--- a/pcbnew/router/pns_tune_status_popup.h
+++ b/pcbnew/router/pns_tune_status_popup.h
@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software; you can redistribute it and/or
@@ -27,15 +28,19 @@
#include <wx_status_popup.h>
+namespace PNS {
+
class PNS_ROUTER;
+}
+
class PNS_TUNE_STATUS_POPUP : public WX_STATUS_POPUP
{
public:
PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
~PNS_TUNE_STATUS_POPUP();
- void UpdateStatus( PNS_ROUTER* aRouter );
+ void UpdateStatus( PNS::PNS_ROUTER* aRouter );
private:
wxStaticText* m_statusLine;
diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp
index 0cb28a1..cc83c82 100644
--- a/pcbnew/router/pns_utils.cpp
+++ b/pcbnew/router/pns_utils.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -27,6 +28,8 @@
#include <cmath>
+namespace PNS {
+
const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize,
int aClearance, int aChamfer )
{
@@ -244,3 +247,5 @@ OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB )
return OPT_BOX2I();
}
+
+}
diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h
index 709ec53..3728793 100644
--- a/pcbnew/router/pns_utils.h
+++ b/pcbnew/router/pns_utils.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,7 +29,9 @@
#include <geometry/shape_rect.h>
#include <geometry/shape_convex.h>
-#define HULL_MARGIN 10
+namespace PNS {
+
+constexpr int HULL_MARGIN = 10;
class PNS_ITEM;
@@ -61,4 +64,6 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor );
#endif
OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB );
+}
+
#endif // __PNS_UTILS_H
diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp
index e090139..650ceff 100644
--- a/pcbnew/router/pns_via.cpp
+++ b/pcbnew/router/pns_via.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -25,6 +26,8 @@
#include <geometry/shape_rect.h>
+namespace PNS {
+
bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce,
bool aSolidsOnly, int aMaxIterations )
{
@@ -107,3 +110,5 @@ OPT_BOX2I PNS_VIA::ChangedArea( const PNS_VIA* aOther ) const
return OPT_BOX2I();
}
+
+}
diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h
index 97c9954..5fa39b0 100644
--- a/pcbnew/router/pns_via.h
+++ b/pcbnew/router/pns_via.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,8 @@
#include "pns_item.h"
+namespace PNS {
+
class PNS_NODE;
class PNS_VIA : public PNS_ITEM
@@ -159,4 +162,6 @@ private:
VIATYPE_T m_viaType;
};
+}
+
#endif
diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp
index 27e3ad6..6ff094d 100644
--- a/pcbnew/router/pns_walkaround.cpp
+++ b/pcbnew/router/pns_walkaround.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -28,6 +29,8 @@
#include "pns_router.h"
using boost::optional;
+namespace PNS {
+
void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath )
{
m_iteration = 0;
@@ -270,3 +273,5 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia
return st;
}
+
+}
diff --git a/pcbnew/router/pns_walkaround.h b/pcbnew/router/pns_walkaround.h
index f143b46..d6c9c8c 100644
--- a/pcbnew/router/pns_walkaround.h
+++ b/pcbnew/router/pns_walkaround.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -29,6 +30,8 @@
#include "pns_logger.h"
#include "pns_algo_base.h"
+namespace PNS {
+
class PNS_WALKAROUND : public PNS_ALGO_BASE
{
static const int DefaultIterationLimit = 50;
@@ -146,4 +149,6 @@ private:
std::set<PNS_ITEM*> m_restrictedSet;
};
+}
+
#endif // __PNS_WALKAROUND_H
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index 92d62c3..9b1150b 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -36,7 +37,7 @@
using namespace KIGFX;
-ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem, VIEW_GROUP* aParent ) :
+ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem, VIEW_GROUP* aParent ) :
EDA_ITEM( NOT_USED )
{
m_parent = aParent;
@@ -63,13 +64,13 @@ ROUTER_PREVIEW_ITEM::~ROUTER_PREVIEW_ITEM()
}
-void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
+void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
{
m_originLayer = aItem->Layers().Start();
- if( aItem->OfKind( PNS_ITEM::LINE ) )
+ if( aItem->OfKind( PNS::PNS_ITEM::LINE ) )
{
- const PNS_LINE* l = static_cast<const PNS_LINE*>( aItem );
+ const PNS::PNS_LINE* l = static_cast<const PNS::PNS_LINE*>( aItem );
if( !l->SegmentCount() )
return;
@@ -85,20 +86,20 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS_ITEM::LINE:
+ case PNS::PNS_ITEM::LINE:
m_type = PR_SHAPE;
- m_width = ( (PNS_LINE*) aItem )->Width();
+ m_width = ( (PNS::PNS_LINE*) aItem )->Width();
break;
- case PNS_ITEM::SEGMENT:
+ case PNS::PNS_ITEM::SEGMENT:
{
- PNS_SEGMENT* seg = (PNS_SEGMENT*) aItem;
+ PNS::PNS_SEGMENT* seg = (PNS::PNS_SEGMENT*) aItem;
m_type = PR_SHAPE;
m_width = seg->Width();
break;
}
- case PNS_ITEM::VIA:
+ case PNS::PNS_ITEM::VIA:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE;
m_width = 0;
@@ -106,7 +107,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
m_depth = ViaOverlayDepth;
break;
- case PNS_ITEM::SOLID:
+ case PNS::PNS_ITEM::SOLID:
m_type = PR_SHAPE;
m_width = 0;
break;
@@ -115,7 +116,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
break;
}
- if( aItem->Marker() & MK_VIOLATION )
+ if( aItem->Marker() & PNS::MK_VIOLATION )
m_color = COLOR4D( 0, 1, 0, 1 );
ViewSetVisible( true );
diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h
index 653900d..56bb97b 100644
--- a/pcbnew/router/router_preview_item.h
+++ b/pcbnew/router/router_preview_item.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -38,9 +39,13 @@
#include <layers_id_colors_and_visibility.h>
+namespace PNS {
+
class PNS_ITEM;
class PNS_ROUTER;
+}
+
class ROUTER_PREVIEW_ITEM : public EDA_ITEM
{
public:
@@ -51,10 +56,10 @@ public:
PR_SHAPE
};
- ROUTER_PREVIEW_ITEM( const PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL );
+ ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL );
~ROUTER_PREVIEW_ITEM();
- void Update( const PNS_ITEM* aItem );
+ void Update( const PNS::PNS_ITEM* aItem );
void StuckMarker( VECTOR2I& aPosition );
@@ -102,7 +107,7 @@ private:
KIGFX::VIEW_GROUP* m_parent;
- PNS_ROUTER* m_router;
+ PNS::PNS_ROUTER* m_router;
SHAPE* m_shape;
ITEM_TYPE m_type;
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index dccbd33..9407fc2 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -199,7 +200,7 @@ private:
class ROUTER_TOOL_MENU: public CONTEXT_MENU
{
public:
- ROUTER_TOOL_MENU( BOARD* aBoard, PNS_ROUTER_MODE aMode )
+ ROUTER_TOOL_MENU( BOARD* aBoard, PNS::PNS_ROUTER_MODE aMode )
{
SetTitle( _( "Interactive Router" ) );
Add( ACT_NewTrack );
@@ -218,11 +219,11 @@ public:
Add( ACT_CustomTrackWidth );
- if( aMode == PNS_MODE_ROUTE_DIFF_PAIR )
+ if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
Add( ACT_SetDpDimensions );
AppendSeparator();
- Add( PNS_TOOL_BASE::ACT_RouterOptions );
+ Add( PNS::PNS_TOOL_BASE::ACT_RouterOptions );
}
private:
@@ -313,7 +314,7 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
}
else if( aEvent.IsAction( &ACT_SetDpDimensions ) )
{
- PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
if( settingsDlg.ShowModal() )
@@ -336,14 +337,14 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) )
{
- PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
+ PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
sizes.ImportCurrent( m_board->GetDesignSettings() );
m_router->UpdateSizes( sizes );
}
}
-int ROUTER_TOOL::getStartLayer( const PNS_ITEM* aItem )
+int ROUTER_TOOL::getStartLayer( const PNS::PNS_ITEM* aItem )
{
int tl = getView()->GetTopLayer();
@@ -390,7 +391,7 @@ bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType )
LAYER_ID pairTop = m_frame->GetScreen()->m_Route_Layer_TOP;
LAYER_ID pairBottom = m_frame->GetScreen()->m_Route_Layer_BOTTOM;
- PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
// fixme: P&S supports more than one fixed layer pair. Update the dialog?
sizes.ClearLayerPairs();
@@ -490,7 +491,7 @@ bool ROUTER_TOOL::prepareInteractive()
// fixme: switch on invisible layer
- // for some reason I don't understand, GetNetclass() may return null sometimes...
+ // for some reason I don't understand, GetNetclass() may return null sometimes...
if( m_startItem &&
m_startItem->Net() >= 0 &&
m_startItem->Parent() &&
@@ -506,7 +507,7 @@ bool ROUTER_TOOL::prepareInteractive()
m_ctls->ForceCursorPosition( false );
m_ctls->SetAutoPan( true );
- PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
+ PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
sizes.Init( m_board, m_startItem );
sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP,
@@ -618,7 +619,7 @@ int ROUTER_TOOL::DpDimensionsDialog( const TOOL_EVENT& aEvent )
{
Activate();
- PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
if( settingsDlg.ShowModal() )
@@ -648,18 +649,18 @@ int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent )
int ROUTER_TOOL::RouteSingleTrace( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
- return mainLoop( PNS_MODE_ROUTE_SINGLE );
+ return mainLoop( PNS::PNS_MODE_ROUTE_SINGLE );
}
int ROUTER_TOOL::RouteDiffPair( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
- return mainLoop( PNS_MODE_ROUTE_DIFF_PAIR );
+ return mainLoop( PNS::PNS_MODE_ROUTE_DIFF_PAIR );
}
-int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
+int ROUTER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode )
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD* board = getModel<BOARD>();
diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h
index c1bd1a2..ddf1fb9 100644
--- a/pcbnew/router/router_tool.h
+++ b/pcbnew/router/router_tool.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
* Author: Maciej Suminski <maciej.suminski@xxxxxxx>
*
@@ -24,7 +25,7 @@
#include "pns_tool_base.h"
-class APIEXPORT ROUTER_TOOL : public PNS_TOOL_BASE
+class APIEXPORT ROUTER_TOOL : public PNS::PNS_TOOL_BASE
{
public:
ROUTER_TOOL();
@@ -42,7 +43,7 @@ public:
private:
- int mainLoop( PNS_ROUTER_MODE aMode );
+ int mainLoop( PNS::PNS_ROUTER_MODE aMode );
int getDefaultWidth( int aNetCode );
@@ -52,7 +53,7 @@ private:
void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill );
void handleCommonEvents( const TOOL_EVENT& evt );
- int getStartLayer( const PNS_ITEM* aItem );
+ int getStartLayer( const PNS::PNS_ITEM* aItem );
void switchLayerOnViaPlacement();
bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType );
diff --git a/pcbnew/router/time_limit.cpp b/pcbnew/router/time_limit.cpp
index e0f250b..079daad 100644
--- a/pcbnew/router/time_limit.cpp
+++ b/pcbnew/router/time_limit.cpp
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -22,8 +23,10 @@
#include "time_limit.h"
+namespace PNS {
+
TIME_LIMIT::TIME_LIMIT( int aMilliseconds ) :
- m_limitMs( aMilliseconds )
+ m_limitMs( aMilliseconds )
{
Restart();
}
@@ -35,17 +38,19 @@ TIME_LIMIT::~TIME_LIMIT()
bool TIME_LIMIT::Expired() const
{
- return ( wxGetLocalTimeMillis().GetValue() - m_startTics ) >= m_limitMs;
+ return ( wxGetLocalTimeMillis().GetValue() - m_startTics ) >= m_limitMs;
}
void TIME_LIMIT::Restart()
{
- m_startTics = wxGetLocalTimeMillis().GetValue();
+ m_startTics = wxGetLocalTimeMillis().GetValue();
}
void TIME_LIMIT::Set( int aMilliseconds )
{
- m_limitMs = aMilliseconds;
+ m_limitMs = aMilliseconds;
+}
+
}
diff --git a/pcbnew/router/time_limit.h b/pcbnew/router/time_limit.h
index d917533..447f074 100644
--- a/pcbnew/router/time_limit.h
+++ b/pcbnew/router/time_limit.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -23,6 +24,8 @@
#include <stdint.h>
+namespace PNS {
+
class TIME_LIMIT
{
public:
@@ -40,4 +43,6 @@ private:
int64_t m_startTics;
};
+}
+
#endif
--
2.9.0.windows.1
>From 2ff5c0b6c1b9cc68371817459efd44b66e401acc Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 18:11:42 +0200
Subject: [PATCH] Rename pns item kind constants in preparation for renaming
pns classes
---
pcbnew/router/pns_diff_pair.cpp | 10 ++++----
pcbnew/router/pns_diff_pair.h | 10 ++++----
pcbnew/router/pns_diff_pair_placer.cpp | 12 +++++-----
pcbnew/router/pns_dp_meander_placer.cpp | 2 +-
pcbnew/router/pns_dragger.cpp | 6 ++---
pcbnew/router/pns_index.h | 8 +++----
pcbnew/router/pns_item.cpp | 12 +++++-----
pcbnew/router/pns_item.h | 14 ++++++------
pcbnew/router/pns_joint.h | 16 ++++++-------
pcbnew/router/pns_kicad_iface.cpp | 6 ++---
pcbnew/router/pns_line.h | 4 ++--
pcbnew/router/pns_line_placer.cpp | 10 ++++----
pcbnew/router/pns_logger.cpp | 8 +++----
pcbnew/router/pns_meander_placer.cpp | 2 +-
pcbnew/router/pns_meander_skew_placer.cpp | 2 +-
pcbnew/router/pns_node.cpp | 38 +++++++++++++++----------------
pcbnew/router/pns_node.h | 12 +++++-----
pcbnew/router/pns_optimizer.cpp | 18 +++++++--------
pcbnew/router/pns_router.cpp | 10 ++++----
pcbnew/router/pns_segment.h | 8 +++----
pcbnew/router/pns_shove.cpp | 30 ++++++++++++------------
pcbnew/router/pns_sizes_settings.cpp | 8 +++----
pcbnew/router/pns_solid.h | 4 ++--
pcbnew/router/pns_tool_base.cpp | 8 +++----
pcbnew/router/pns_topology.cpp | 6 ++---
pcbnew/router/pns_topology.h | 6 ++---
pcbnew/router/pns_utils.cpp | 4 ++--
pcbnew/router/pns_via.cpp | 2 +-
pcbnew/router/pns_via.h | 8 +++----
pcbnew/router/pns_walkaround.h | 6 ++---
pcbnew/router/router_preview_item.cpp | 10 ++++----
31 files changed, 150 insertions(+), 150 deletions(-)
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 16887f5..a0088f4 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -107,13 +107,13 @@ bool PNS_DP_PRIMITIVE_PAIR::Directional() const
if( !m_primP )
return false;
- return m_primP->OfKind( PNS_ITEM::SEGMENT );
+ return m_primP->OfKind( PNS_ITEM::SEGMENT_T );
}
DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const
{
- if( !aItem->OfKind ( PNS_ITEM::SEGMENT ) )
+ if( !aItem->OfKind ( PNS_ITEM::SEGMENT_T ) )
return DIRECTION_45();
PNS_SEGMENT* s = static_cast<PNS_SEGMENT*>( aItem );
@@ -130,7 +130,7 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
VECTOR2I aP, aN, dir, midpoint;
- if ( m_primP->OfKind( PNS_ITEM::SEGMENT ) && m_primN->OfKind( PNS_ITEM::SEGMENT ) )
+ if ( m_primP->OfKind( PNS_ITEM::SEGMENT_T ) && m_primN->OfKind( PNS_ITEM::SEGMENT_T ) )
{
aP = m_primP->Anchor( 1 );
aN = m_primN->Anchor( 1 );
@@ -421,7 +421,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
return;
}
- const int pvMask = PNS_ITEM::SOLID | PNS_ITEM::VIA;
+ const int pvMask = PNS_ITEM::SOLID_T | PNS_ITEM::VIA_T;
if( aPair.PrimP()->OfKind( pvMask ) && aPair.PrimN()->OfKind( pvMask ) )
{
@@ -430,7 +430,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
shP = aPair.PrimP()->Shape();
}
- else if( aPair.PrimP()->OfKind( PNS_ITEM::SEGMENT ) && aPair.PrimN()->OfKind( PNS_ITEM::SEGMENT ) )
+ else if( aPair.PrimP()->OfKind( PNS_ITEM::SEGMENT_T ) && aPair.PrimN()->OfKind( PNS_ITEM::SEGMENT_T ) )
{
buildDpContinuation( aPair, aPreferDiagonal );
diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h
index f5248de..902bf20 100644
--- a/pcbnew/router/pns_diff_pair.h
+++ b/pcbnew/router/pns_diff_pair.h
@@ -286,7 +286,7 @@ public:
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
- PNS_DIFF_PAIR() : PNS_ITEM( DIFF_PAIR ), m_hasVias( false )
+ PNS_DIFF_PAIR() : PNS_ITEM( DIFF_PAIR_T ), m_hasVias( false )
{
// Initialize some members, to avoid uninitialized variables.
m_net_p = 0;
@@ -299,7 +299,7 @@ public:
}
PNS_DIFF_PAIR( int aGap ) :
- PNS_ITEM( DIFF_PAIR ),
+ PNS_ITEM( DIFF_PAIR_T ),
m_hasVias( false )
{
m_gapConstraint = aGap;
@@ -315,7 +315,7 @@ public:
}
PNS_DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
- PNS_ITEM( DIFF_PAIR ),
+ PNS_ITEM( DIFF_PAIR_T ),
m_n( aN ),
m_p( aP ),
m_hasVias( false )
@@ -333,7 +333,7 @@ public:
}
PNS_DIFF_PAIR( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
- PNS_ITEM( DIFF_PAIR ),
+ PNS_ITEM( DIFF_PAIR_T ),
m_line_p( aLineP ),
m_line_n( aLineN ),
m_hasVias( false )
@@ -354,7 +354,7 @@ public:
static inline bool ClassOf( const PNS_ITEM* aItem )
{
- return aItem && DIFF_PAIR == aItem->Kind();
+ return aItem && DIFF_PAIR_T == aItem->Kind();
}
PNS_DIFF_PAIR* Clone() const { assert( false ); return NULL; }
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 5e9cf87..815bff1 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -181,7 +181,7 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent
bool currentIsP = aPFirst;
- int mask = aSolidsOnly ? PNS_ITEM::SOLID : PNS_ITEM::ANY;
+ int mask = aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T;
do
{
@@ -392,7 +392,7 @@ bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer )
return false;
else if( !m_prevPair )
return false;
- else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( PNS_ITEM::VIA ) &&
+ else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( PNS_ITEM::VIA_T ) &&
m_prevPair->PrimP()->Layers().Overlaps( aLayer ) ) )
{
m_currentLayer = aLayer;
@@ -444,11 +444,11 @@ OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM*
{
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA:
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::VIA_T:
+ case PNS_ITEM::SOLID_T:
return aItem->Anchor( 0 );
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
PNS_SEGMENT* s =static_cast<PNS_SEGMENT*>( aItem );
@@ -513,7 +513,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
bool shapeMatches = true;
- if( item->OfKind( PNS_ITEM::SOLID ) && item->Layers() != aItem->Layers() )
+ if( item->OfKind( PNS_ITEM::SOLID_T ) && item->Layers() != aItem->Layers() )
{
shapeMatches = false;
}
diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp
index ba9db37..59ccee9 100644
--- a/pcbnew/router/pns_dp_meander_placer.cpp
+++ b/pcbnew/router/pns_dp_meander_placer.cpp
@@ -72,7 +72,7 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT ) )
+ if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) );
return false;
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index c99a3be..5786c5d 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -89,7 +89,7 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
for( PNS_ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT ) )
+ if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
{
int segIndex;
PNS_SEGMENT* seg = ( PNS_SEGMENT*) item;
@@ -119,10 +119,10 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
switch( aStartItem->Kind() )
{
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
default:
diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h
index 15380b2..75636cf 100644
--- a/pcbnew/router/pns_index.h
+++ b/pcbnew/router/pns_index.h
@@ -171,11 +171,11 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
idx_n = SI_Multilayer;
break;
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
{
if( l.IsMultilayer() )
idx_n = SI_Multilayer;
@@ -186,8 +186,8 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
}
break;
- case PNS_ITEM::SEGMENT:
- case PNS_ITEM::LINE:
+ case PNS_ITEM::SEGMENT_T:
+ case PNS_ITEM::LINE_T:
idx_n = SI_Traces + 2 * l.Start() + SI_SegStraight;
break;
diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp
index 01d5aa9..b060d31 100644
--- a/pcbnew/router/pns_item.cpp
+++ b/pcbnew/router/pns_item.cpp
@@ -48,7 +48,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
return true;
// special case for "head" line with a via attached at the end.
- if( aOther->m_kind == LINE )
+ if( aOther->m_kind == LINE_T )
{
const PNS_LINE* line = static_cast<const PNS_LINE*>( aOther );
@@ -64,19 +64,19 @@ const std::string PNS_ITEM::KindStr() const
{
switch( m_kind )
{
- case LINE:
+ case LINE_T:
return "line";
- case SEGMENT:
+ case SEGMENT_T:
return "segment";
- case VIA:
+ case VIA_T:
return "via";
- case JOINT:
+ case JOINT_T:
return "joint";
- case SOLID:
+ case SOLID_T:
return "solid";
default:
diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h
index 43a6e46..6e4aa0a 100644
--- a/pcbnew/router/pns_item.h
+++ b/pcbnew/router/pns_item.h
@@ -57,13 +57,13 @@ public:
///> Supported item types
enum PnsKind
{
- SOLID = 1,
- LINE = 2,
- JOINT = 4,
- SEGMENT = 8,
- VIA = 16,
- DIFF_PAIR = 32,
- ANY = 0xff
+ SOLID_T = 1,
+ LINE_T = 2,
+ JOINT_T = 4,
+ SEGMENT_T = 8,
+ VIA_T = 16,
+ DIFF_PAIR_T = 32,
+ ANY_T = 0xff
};
PNS_ITEM( PnsKind aKind )
diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h
index 50c6afe..cf41eef 100644
--- a/pcbnew/router/pns_joint.h
+++ b/pcbnew/router/pns_joint.h
@@ -55,10 +55,10 @@ public:
};
PNS_JOINT() :
- PNS_ITEM( JOINT ), m_locked( false ) {}
+ PNS_ITEM( JOINT_T ), m_locked( false ) {}
PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet = -1 ) :
- PNS_ITEM( JOINT )
+ PNS_ITEM( JOINT_T )
{
m_tag.pos = aPos;
m_tag.net = aNet;
@@ -67,7 +67,7 @@ public:
}
PNS_JOINT( const PNS_JOINT& aB ) :
- PNS_ITEM( JOINT )
+ PNS_ITEM( JOINT_T )
{
m_layers = aB.m_layers;
m_tag.pos = aB.m_tag.pos;
@@ -87,7 +87,7 @@ public:
/// segments of the same net, on the same layer.
bool IsLineCorner() const
{
- if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT ) != 2 )
+ if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT_T ) != 2 )
return false;
PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
@@ -99,8 +99,8 @@ public:
bool IsNonFanoutVia() const
{
- int vias = m_linkedItems.Count( VIA );
- int segs = m_linkedItems.Count( SEGMENT );
+ int vias = m_linkedItems.Count( VIA_T );
+ int segs = m_linkedItems.Count( SEGMENT_T );
return ( m_linkedItems.Size() == 3 && vias == 1 && segs == 2 );
}
@@ -110,7 +110,7 @@ public:
if( m_linkedItems.Size() != 2 )
return false;
- if( m_linkedItems.Count( SEGMENT ) != 2)
+ if( m_linkedItems.Count( SEGMENT_T ) != 2)
return false;
PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
@@ -150,7 +150,7 @@ public:
{
for( PNS_ITEM* item : m_linkedItems.Items() )
{
- if( item->OfKind( VIA ) )
+ if( item->OfKind( VIA_T ) )
return static_cast<PNS_VIA*>( item );
}
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 08203fa..7f728e9 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -156,7 +156,7 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB
int net_b = aB->Net();
int cl_b = ( net_b >= 0 ? m_clearanceCache[net_b].clearance : m_defaultClearance );
- bool linesOnly = aA->OfKind( PNS_ITEM::SEGMENT | PNS_ITEM::LINE ) && aB->OfKind( PNS_ITEM::SEGMENT | PNS_ITEM::LINE );
+ bool linesOnly = aA->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T ) && aB->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T );
if( linesOnly && net_a >= 0 && net_b >= 0 && m_clearanceCache[net_a].coupledNet == net_b )
{
@@ -826,7 +826,7 @@ void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( aItem );
TRACK* track = new TRACK( m_board );
@@ -840,7 +840,7 @@ void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
break;
}
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
{
VIA* via_board = new VIA( m_board );
PNS_VIA* via = static_cast<PNS_VIA*>( aItem );
diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h
index 6a38499..6e0b48a 100644
--- a/pcbnew/router/pns_line.h
+++ b/pcbnew/router/pns_line.h
@@ -66,7 +66,7 @@ public:
* Constructor
* Makes an empty line.
*/
- PNS_LINE() : PNS_ITEM( LINE )
+ PNS_LINE() : PNS_ITEM( LINE_T )
{
m_segmentRefs = NULL;
m_hasVia = false;
@@ -95,7 +95,7 @@ public:
static inline bool ClassOf( const PNS_ITEM* aItem )
{
- return aItem && LINE == aItem->Kind();
+ return aItem && LINE_T == aItem->Kind();
}
/// @copydoc PNS_ITEM::Clone()
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index c9b4ef1..dca4173 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -249,7 +249,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
PNS_LINE tmp( m_tail, replacement );
- if( m_currentNode->CheckColliding( &tmp, PNS_ITEM::ANY ) )
+ if( m_currentNode->CheckColliding( &tmp, PNS_ITEM::ANY_T ) )
break;
if( DIRECTION_45( replacement.CSegment( 0 ) ) == dir )
@@ -437,7 +437,7 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
PNS_WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids );
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS );
- optimizer.SetCollisionMask( PNS_ITEM::SOLID );
+ optimizer.SetCollisionMask( PNS_ITEM::SOLID_T );
optimizer.Optimize( &walkSolids );
if( stat_solids == PNS_WALKAROUND::DONE )
@@ -487,7 +487,7 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
optimizer.SetWorld( m_currentNode );
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_OBTUSE | PNS_OPTIMIZER::SMART_PADS );
- optimizer.SetCollisionMask( PNS_ITEM::ANY );
+ optimizer.SetCollisionMask( PNS_ITEM::ANY_T );
optimizer.Optimize( &l2 );
aNewHead = l2;
@@ -690,7 +690,7 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
if( !aSeg )
return;
- if( !aSeg->OfKind( PNS_ITEM::SEGMENT ) )
+ if( !aSeg->OfKind( PNS_ITEM::SEGMENT_T ) )
return;
PNS_JOINT* jt = aNode->FindJoint( aP, aSeg );
@@ -724,7 +724,7 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer )
{
return false;
}
- else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA ) && m_startItem->Layers().Overlaps( aLayer ) ) )
+ else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) )
{
m_currentLayer = aLayer;
initPlacement();
diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp
index 3d3df8e..1777265 100644
--- a/pcbnew/router/pns_logger.cpp
+++ b/pcbnew/router/pns_logger.cpp
@@ -80,7 +80,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
switch( aItem->Kind() )
{
- case PNS_ITEM::LINE:
+ case PNS_ITEM::LINE_T:
{
PNS_LINE* l = (PNS_LINE*) aItem;
m_theLog << " line ";
@@ -90,7 +90,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
break;
}
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
{
m_theLog << " via 0 0 ";
dumpShape ( aItem->Shape() );
@@ -98,7 +98,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
break;
}
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
m_theLog << " line ";
@@ -107,7 +107,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
break;
}
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
{
PNS_SOLID* s = (PNS_SOLID*) aItem;
m_theLog << " solid 0 0 ";
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index ac0d3fa..633c599 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -61,7 +61,7 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT ) )
+ if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) );
return false;
diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp
index c125274..916cabc 100644
--- a/pcbnew/router/pns_meander_skew_placer.cpp
+++ b/pcbnew/router/pns_meander_skew_placer.cpp
@@ -48,7 +48,7 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT ) )
+ if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a differential pair trace you want to tune." ) );
return false;
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 86ac957..54e9205 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -155,7 +155,7 @@ PNS_OBSTACLE_VISITOR::PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ) :
m_override( NULL ),
m_extraClearance( 0 )
{
- if( aItem && aItem->Kind() == PNS_ITEM::LINE )
+ if( aItem && aItem->Kind() == PNS_ITEM::LINE_T )
m_extraClearance += static_cast<const PNS_LINE*>( aItem )->Width() / 2;
}
@@ -228,7 +228,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
- if( aCandidate->Kind() == PNS_ITEM::LINE ) // this should never happen.
+ if( aCandidate->Kind() == PNS_ITEM::LINE_T ) // this should never happen.
{
assert( false );
clearance += static_cast<PNS_LINE*>( aCandidate )->Width() / 2;
@@ -427,7 +427,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, int aKi
obs.reserve( 100 );
- if( aItemA->Kind() == PNS_ITEM::LINE )
+ if( aItemA->Kind() == PNS_ITEM::LINE_T )
{
int n = 0;
const PNS_LINE* line = static_cast<const PNS_LINE*>( aItemA );
@@ -467,9 +467,9 @@ bool PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB, i
clearance = GetClearance( aItemA, aItemB );
// fixme: refactor
- if( aItemA->Kind() == PNS_ITEM::LINE )
+ if( aItemA->Kind() == PNS_ITEM::LINE_T )
clearance += static_cast<const PNS_LINE*>( aItemA )->Width() / 2;
- if( aItemB->Kind() == PNS_ITEM::LINE )
+ if( aItemB->Kind() == PNS_ITEM::LINE_T )
clearance += static_cast<const PNS_LINE*>( aItemB )->Width() / 2;
return aItemA->Collide( aItemB, clearance );
@@ -607,19 +607,19 @@ void PNS_NODE::Add( PNS_ITEM* aItem, bool aAllowRedundant )
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
addSolid( static_cast<PNS_SOLID*>( aItem ) );
break;
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
addSegment( static_cast<PNS_SEGMENT*>( aItem ), aAllowRedundant );
break;
- case PNS_ITEM::LINE:
+ case PNS_ITEM::LINE_T:
addLine( static_cast<PNS_LINE*>( aItem ), aAllowRedundant );
break;
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
addVia( static_cast<PNS_VIA*>( aItem ) );
break;
@@ -732,20 +732,20 @@ void PNS_NODE::Remove( PNS_ITEM* aItem )
{
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
// fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care.
doRemove( aItem );
break;
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
removeSegment( static_cast<PNS_SEGMENT*>( aItem ) );
break;
- case PNS_ITEM::LINE:
+ case PNS_ITEM::LINE_T:
removeLine( static_cast<PNS_LINE*>( aItem ) );
break;
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
removeVia( static_cast<PNS_VIA*>( aItem ) );
break;
@@ -879,7 +879,7 @@ void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFou
for( PNS_ITEM* item : current->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT ) )
+ if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT *>( item );
PNS_JOINT* a = FindJoint( seg->Seg().A, seg );
@@ -905,7 +905,7 @@ int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<
{
for( PNS_ITEM* item : aA.LinkList() )
{
- if( item->Kind() == PNS_ITEM::SEGMENT )
+ if( item->Kind() == PNS_ITEM::SEGMENT_T )
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
PNS_LINE line = AssembleLine( seg );
@@ -1057,7 +1057,7 @@ void PNS_NODE::Dump( bool aLong )
for( i = m_items.begin(); i != m_items.end(); i++ )
{
- if( (*i)->GetKind() == PNS_ITEM::SEGMENT )
+ if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T )
all_segs.insert( static_cast<PNS_SEGMENT*>( *i ) );
}
@@ -1065,7 +1065,7 @@ void PNS_NODE::Dump( bool aLong )
{
for( i = m_root->m_items.begin(); i != m_root->m_items.end(); i++ )
{
- if( (*i)->GetKind() == PNS_ITEM::SEGMENT && !overrides( *i ) )
+ if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T && !overrides( *i ) )
all_segs.insert( static_cast<PNS_SEGMENT*>(*i) );
}
}
@@ -1085,7 +1085,7 @@ void PNS_NODE::Dump( bool aLong )
switch( m_item->GetKind() )
{
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
const PNS_SEGMENT* seg = static_cast<const PNS_SEGMENT*>( m_item );
wxLogTrace( "PNS", " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(),
@@ -1275,7 +1275,7 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
for( PNS_ITEM* item : jtStart->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT ) )
+ if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
{
PNS_SEGMENT* seg2 = (PNS_SEGMENT*) item;
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index f05803b..b56d674 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -193,7 +193,7 @@ public:
*/
int QueryColliding( const PNS_ITEM* aItem,
OBSTACLES& aObstacles,
- int aKindMask = PNS_ITEM::ANY,
+ int aKindMask = PNS_ITEM::ANY_T,
int aLimitCount = -1,
bool aDifferentNetsOnly = true,
int aForceClearance = -1 );
@@ -212,7 +212,7 @@ public:
* @return the obstacle, if found, otherwise empty.
*/
OPT_OBSTACLE NearestObstacle( const PNS_LINE* aItem,
- int aKindMask = PNS_ITEM::ANY,
+ int aKindMask = PNS_ITEM::ANY_T,
const std::set<PNS_ITEM*>* aRestrictedSet = NULL );
/**
@@ -225,7 +225,7 @@ public:
* @return the obstacle, if found, otherwise empty.
*/
OPT_OBSTACLE CheckColliding( const PNS_ITEM* aItem,
- int aKindMask = PNS_ITEM::ANY );
+ int aKindMask = PNS_ITEM::ANY_T );
/**
@@ -238,7 +238,7 @@ public:
* @return the obstacle, if found, otherwise empty.
*/
OPT_OBSTACLE CheckColliding( const PNS_ITEMSET& aSet,
- int aKindMask = PNS_ITEM::ANY );
+ int aKindMask = PNS_ITEM::ANY_T );
/**
@@ -253,7 +253,7 @@ public:
*/
bool CheckColliding( const PNS_ITEM* aItemA,
const PNS_ITEM* aItemB,
- int aKindMask = PNS_ITEM::ANY,
+ int aKindMask = PNS_ITEM::ANY_T,
int aForceClearance = -1 );
/**
@@ -369,7 +369,7 @@ public:
void MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*> & aFoundJoints );
PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL,
- int aKindMask = PNS_ITEM::ANY);
+ int aKindMask = PNS_ITEM::ANY_T);
#endif
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index 8b1f394..a2af3c1 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -125,7 +125,7 @@ bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther,
**/
PNS_OPTIMIZER::PNS_OPTIMIZER( PNS_NODE* aWorld ) :
m_world( aWorld ),
- m_collisionKindMask( PNS_ITEM::ANY ),
+ m_collisionKindMask( PNS_ITEM::ANY_T ),
m_effortLevel( MERGE_SEGMENTS ),
m_keepPostures( false ),
m_restrictAreaActive( false )
@@ -200,7 +200,7 @@ void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int
void PNS_OPTIMIZER::CacheRemove( PNS_ITEM* aItem )
{
- if( aItem->Kind() == PNS_ITEM::LINE )
+ if( aItem->Kind() == PNS_ITEM::LINE_T )
removeCachedSegments( static_cast<PNS_LINE*>( aItem ) );
}
@@ -274,7 +274,7 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c
for( const PNS_ITEM* item : jt->Links().CItems() )
{
- if( item->OfKind( PNS_ITEM::VIA ) || item->OfKind( PNS_ITEM::SOLID ) )
+ if( item->OfKind( PNS_ITEM::VIA_T ) || item->OfKind( PNS_ITEM::SOLID_T ) )
return 0xff;
else if( const PNS_SEGMENT* seg = dyn_cast<const PNS_SEGMENT*>( item ) )
{
@@ -767,13 +767,13 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::computeBreakouts( int aWidth,
{
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
{
const PNS_VIA* via = static_cast<const PNS_VIA*>( aItem );
return circleBreakouts( aWidth, via->Shape(), aPermitDiagonal );
}
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
{
const SHAPE* shape = aItem->Shape();
@@ -817,7 +817,7 @@ PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP
for( PNS_ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::VIA | PNS_ITEM::SOLID ) )
+ if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) )
return item;
}
@@ -985,12 +985,12 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine )
if( !startPad )
return false;
- bool startMatch = startPad->OfKind( PNS_ITEM::VIA | PNS_ITEM::SOLID );
+ bool startMatch = startPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T );
bool endMatch = false;
if(endPad)
{
- endMatch = endPad->OfKind( PNS_ITEM::VIA | PNS_ITEM::SOLID );
+ endMatch = endPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T );
}
else
{
@@ -1046,7 +1046,7 @@ bool verifyDpBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const
PNS_LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef );
PNS_LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled );
- if( aNode->CheckColliding( &refLine, &coupledLine, PNS_ITEM::ANY, aPair->Gap() - 10 ) )
+ if( aNode->CheckColliding( &refLine, &coupledLine, PNS_ITEM::ANY_T, aPair->Gap() - 10 ) )
return false;
if( aNode->CheckColliding ( &refLine ) )
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index 41a1a0a..c7c18c2 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -143,7 +143,7 @@ const PNS_ITEMSET PNS_ROUTER::QueryHoverItems( const VECTOR2I& aP )
bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{
- if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID ) )
+ if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID_T ) )
return false;
m_dragger = new PNS_DRAGGER( this );
@@ -245,16 +245,16 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
{
PNS_NODE::OBSTACLES obstacles;
- aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY );
+ aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY_T );
- if( item->OfKind( PNS_ITEM::LINE ) )
+ if( item->OfKind( PNS_ITEM::LINE_T ) )
{
PNS_LINE* l = static_cast<PNS_LINE*>( item );
if( l->EndsWithVia() )
{
PNS_VIA v( l->Via() );
- aNode->QueryColliding( &v, obstacles, PNS_ITEM::ANY );
+ aNode->QueryColliding( &v, obstacles, PNS_ITEM::ANY_T );
}
}
@@ -312,7 +312,7 @@ void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem )
for( const PNS_ITEM* item : current.CItems() )
{
- if( !item->OfKind( PNS_ITEM::LINE ) )
+ if( !item->OfKind( PNS_ITEM::LINE_T ) )
continue;
const PNS_LINE* l = static_cast<const PNS_LINE*>( item );
diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h
index ed8c93a..1070ae4 100644
--- a/pcbnew/router/pns_segment.h
+++ b/pcbnew/router/pns_segment.h
@@ -39,17 +39,17 @@ class PNS_SEGMENT : public PNS_ITEM
{
public:
PNS_SEGMENT() :
- PNS_ITEM( SEGMENT )
+ PNS_ITEM( SEGMENT_T )
{}
PNS_SEGMENT( const SEG& aSeg, int aNet ) :
- PNS_ITEM( SEGMENT ), m_seg( aSeg, 0 )
+ PNS_ITEM( SEGMENT_T ), m_seg( aSeg, 0 )
{
m_net = aNet;
}
PNS_SEGMENT( const PNS_LINE& aParentLine, const SEG& aSeg ) :
- PNS_ITEM( SEGMENT ),
+ PNS_ITEM( SEGMENT_T ),
m_seg( aSeg, aParentLine.Width() )
{
m_net = aParentLine.Net();
@@ -60,7 +60,7 @@ public:
static inline bool ClassOf( const PNS_ITEM* aItem )
{
- return aItem && SEGMENT == aItem->Kind();
+ return aItem && SEGMENT_T == aItem->Kind();
}
PNS_SEGMENT* Clone() const;
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index 7cd9aab..d173792 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -217,7 +217,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
continue;
}
- bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, PNS_ITEM::ANY, m_forceClearance );
+ bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, PNS_ITEM::ANY_T, m_forceClearance );
if( ( aCurrent.Marker() & MK_HEAD ) && !colliding )
{
@@ -416,7 +416,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
for( PNS_ITEM* item : jtStart->LinkList() )
{
- if( item->OfKind( PNS_ITEM::VIA ) )
+ if( item->OfKind( PNS_ITEM::VIA_T ) )
{
via = (PNS_VIA*) item;
break;
@@ -710,7 +710,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA*
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1;
- if( aCurrent->OfKind( PNS_ITEM::LINE ) )
+ if( aCurrent->OfKind( PNS_ITEM::LINE_T ) )
{
#ifdef DEBUG
m_logger.NewGroup( "push-via-by-line", m_iter );
@@ -738,7 +738,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA*
rank = currentLine->Rank();
}
- else if( aCurrent->OfKind( PNS_ITEM::SOLID ) )
+ else if( aCurrent->OfKind( PNS_ITEM::SOLID_T ) )
{
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid );
@@ -765,7 +765,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN
for( PNS_ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT ) && item->LayersOverlap( &aCurrent ) )
+ if( item->OfKind( PNS_ITEM::SEGMENT_T ) && item->LayersOverlap( &aCurrent ) )
{
PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
PNS_LINE head = assembleLine( seg );
@@ -855,9 +855,9 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg )
void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
{
- if( aItem->OfKind( PNS_ITEM::SEGMENT ) )
+ if( aItem->OfKind( PNS_ITEM::SEGMENT_T ) )
unwindStack( static_cast<PNS_SEGMENT*>( aItem ) );
- else if( aItem->OfKind( PNS_ITEM::LINE ) )
+ else if( aItem->OfKind( PNS_ITEM::LINE_T ) )
{
PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
@@ -924,7 +924,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
PNS_NODE::OPT_OBSTACLE nearest;
SHOVE_STATUS st = SH_NULL;
- PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT };
+ PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID_T, PNS_ITEM::VIA_T, PNS_ITEM::SEGMENT_T };
for( int i = 0; i < 3; i++ )
{
@@ -944,11 +944,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
unwindStack( ni );
- if( !ni->OfKind( PNS_ITEM::SOLID ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() )
+ if( !ni->OfKind( PNS_ITEM::SOLID_T ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() )
{
switch( ni->Kind() )
{
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
{
PNS_VIA* revVia = (PNS_VIA*) ni;
wxLogTrace( "PNS", "iter %d: reverse-collide-via", aIter );
@@ -965,7 +965,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
break;
}
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
PNS_SEGMENT* seg = (PNS_SEGMENT*) ni;
wxLogTrace( "PNS", "iter %d: reverse-collide-segment ", aIter );
@@ -987,7 +987,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ // "forward" collisions
switch( ni->Kind() )
{
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
wxLogTrace( "PNS", "iter %d: collide-segment ", aIter );
st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni );
@@ -998,7 +998,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
}
break;
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
wxLogTrace( "PNS", "iter %d: shove-via ", aIter );
st = onCollidingVia( ¤tLine, (PNS_VIA*) ni );
@@ -1008,7 +1008,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
}
break;
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
wxLogTrace( "PNS", "iter %d: walk-solid ", aIter );
st = onCollidingSolid( currentLine, (PNS_SOLID*) ni );
break;
@@ -1364,7 +1364,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
optFlags |= PNS_OPTIMIZER::SMART_PADS;
optimizer.SetEffortLevel( optFlags );
- optimizer.SetCollisionMask( PNS_ITEM::ANY );
+ optimizer.SetCollisionMask( PNS_ITEM::ANY_T );
for( int pass = 0; pass < n_passes; pass++ )
{
diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp
index 7b11c83..cd604fa 100644
--- a/pcbnew/router/pns_sizes_settings.cpp
+++ b/pcbnew/router/pns_sizes_settings.cpp
@@ -37,15 +37,15 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
p = static_cast<PNS_VIA*>( aItem )->Pos();
break;
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
p = static_cast<PNS_SOLID*>( aItem )->Pos();
break;
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
return static_cast<PNS_SEGMENT*>( aItem )->Width();
default:
@@ -60,7 +60,7 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
PNS_ITEMSET linkedSegs = jt->Links();
- linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT );
+ linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT_T );
for( PNS_ITEM* item : linkedSegs.Items() )
{
diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h
index 5324896..4bd3c35 100644
--- a/pcbnew/router/pns_solid.h
+++ b/pcbnew/router/pns_solid.h
@@ -35,7 +35,7 @@ namespace PNS {
class PNS_SOLID : public PNS_ITEM
{
public:
- PNS_SOLID() : PNS_ITEM( SOLID ), m_shape( NULL )
+ PNS_SOLID() : PNS_ITEM( SOLID_T ), m_shape( NULL )
{
m_movable = false;
}
@@ -54,7 +54,7 @@ public:
static inline bool ClassOf( const PNS_ITEM* aItem )
{
- return aItem && SOLID == aItem->Kind();
+ return aItem && SOLID_T == aItem->Kind();
}
PNS_ITEM* Clone() const;
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index 55d4e2f..6bc30cb 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -146,7 +146,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a
if( aNet < 0 || item->Net() == aNet )
{
- if( item->OfKind( PNS_ITEM::VIA | PNS_ITEM::SOLID ) )
+ if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) )
{
if( !prioritized[2] )
prioritized[2] = item;
@@ -358,17 +358,17 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID:
+ case PNS_ITEM::SOLID_T:
anchor = static_cast<PNS_SOLID*>( aItem )->Pos();
aSplitsSegment = false;
break;
- case PNS_ITEM::VIA:
+ case PNS_ITEM::VIA_T:
anchor = static_cast<PNS_VIA*>( aItem )->Pos();
aSplitsSegment = false;
break;
- case PNS_ITEM::SEGMENT:
+ case PNS_ITEM::SEGMENT_T:
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( aItem );
const SEG& s = seg->Seg();
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index dce4dc4..a54bbc0 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -73,7 +73,7 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart )
for( PNS_ITEM* item : current->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT ) )
+ if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
PNS_JOINT* a = m_world->FindJoint( seg->Seg().A, seg );
@@ -193,7 +193,7 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET&
for( PNS_ITEM* link : jt->Links().Items() )
{
- if( link->OfKind( PNS_ITEM::VIA ) )
+ if( link->OfKind( PNS_ITEM::VIA_T ) )
via = link;
else if( aVisited.find( link ) == aVisited.end() )
next_seg = static_cast<PNS_SEGMENT*>( link );
@@ -371,7 +371,7 @@ const std::set<PNS_ITEM*> PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int a
visited.insert( top );
- m_world->QueryColliding( top, obstacles, PNS_ITEM::ANY, -1, false );
+ m_world->QueryColliding( top, obstacles, PNS_ITEM::ANY_T, -1, false );
for( PNS_OBSTACLE& obs : obstacles )
{
diff --git a/pcbnew/router/pns_topology.h b/pcbnew/router/pns_topology.h
index f16e499..c4eb435 100644
--- a/pcbnew/router/pns_topology.h
+++ b/pcbnew/router/pns_topology.h
@@ -47,12 +47,12 @@ public:
~PNS_TOPOLOGY() {};
bool SimplifyLine( PNS_LINE *aLine );
- PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL, int aKindMask = PNS_ITEM::ANY );
+ PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL, int aKindMask = PNS_ITEM::ANY_T );
bool LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine );
const JOINT_SET ConnectedJoints( PNS_JOINT* aStart );
- const PNS_ITEMSET ConnectedItems( PNS_JOINT* aStart, int aKindMask = PNS_ITEM::ANY );
- const PNS_ITEMSET ConnectedItems( PNS_ITEM* aStart, int aKindMask = PNS_ITEM::ANY );
+ const PNS_ITEMSET ConnectedItems( PNS_JOINT* aStart, int aKindMask = PNS_ITEM::ANY_T );
+ const PNS_ITEMSET ConnectedItems( PNS_ITEM* aStart, int aKindMask = PNS_ITEM::ANY_T );
int64_t ShortestConnectionLength( PNS_ITEM* aFrom, PNS_ITEM* aTo );
const PNS_ITEMSET AssembleTrivialPath( PNS_ITEM* aStart );
diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp
index cc83c82..0e3a29d 100644
--- a/pcbnew/router/pns_utils.cpp
+++ b/pcbnew/router/pns_utils.cpp
@@ -230,14 +230,14 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor )
OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB )
{
- if( aItemA->OfKind( PNS_ITEM::VIA ) && aItemB->OfKind( PNS_ITEM::VIA ) )
+ if( aItemA->OfKind( PNS_ITEM::VIA_T ) && aItemB->OfKind( PNS_ITEM::VIA_T ) )
{
const PNS_VIA* va = static_cast<const PNS_VIA*>( aItemA );
const PNS_VIA* vb = static_cast<const PNS_VIA*>( aItemB );
return va->ChangedArea( vb );
}
- else if( aItemA->OfKind( PNS_ITEM::LINE ) && aItemB->OfKind( PNS_ITEM::LINE ) )
+ else if( aItemA->OfKind( PNS_ITEM::LINE_T ) && aItemB->OfKind( PNS_ITEM::LINE_T ) )
{
const PNS_LINE* la = static_cast<const PNS_LINE*> ( aItemA );
const PNS_LINE* lb = static_cast<const PNS_LINE*> ( aItemB );
diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp
index 650ceff..6706810 100644
--- a/pcbnew/router/pns_via.cpp
+++ b/pcbnew/router/pns_via.cpp
@@ -38,7 +38,7 @@ bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2
while( iter < aMaxIterations )
{
PNS_NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv,
- aSolidsOnly ? PNS_ITEM::SOLID : PNS_ITEM::ANY );
+ aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T );
if( !obs )
break;
diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h
index 5fa39b0..96b126b 100644
--- a/pcbnew/router/pns_via.h
+++ b/pcbnew/router/pns_via.h
@@ -37,7 +37,7 @@ class PNS_VIA : public PNS_ITEM
{
public:
PNS_VIA() :
- PNS_ITEM( VIA )
+ PNS_ITEM( VIA_T )
{
m_diameter = 2; // Dummy value
m_drill = 0;
@@ -46,7 +46,7 @@ public:
PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) :
- PNS_ITEM( VIA )
+ PNS_ITEM( VIA_T )
{
SetNet( aNet );
SetLayers( aLayers );
@@ -66,7 +66,7 @@ public:
PNS_VIA( const PNS_VIA& aB ) :
- PNS_ITEM( VIA )
+ PNS_ITEM( VIA_T )
{
SetNet( aB.Net() );
SetLayers( aB.Layers() );
@@ -81,7 +81,7 @@ public:
static inline bool ClassOf( const PNS_ITEM* aItem )
{
- return aItem && VIA == aItem->Kind();
+ return aItem && VIA_T == aItem->Kind();
}
diff --git a/pcbnew/router/pns_walkaround.h b/pcbnew/router/pns_walkaround.h
index d6c9c8c..583595d 100644
--- a/pcbnew/router/pns_walkaround.h
+++ b/pcbnew/router/pns_walkaround.h
@@ -46,7 +46,7 @@ public:
m_forceLongerPath = false;
m_forceWinding = false;
m_cursorApproachMode = false;
- m_itemMask = PNS_ITEM::ANY;
+ m_itemMask = PNS_ITEM::ANY_T;
// Initialize other members, to avoid uninitialized variables.
m_recursiveBlockageCount = 0;
@@ -77,9 +77,9 @@ public:
void SetSolidsOnly( bool aSolidsOnly )
{
if( aSolidsOnly )
- m_itemMask = PNS_ITEM::SOLID;
+ m_itemMask = PNS_ITEM::SOLID_T;
else
- m_itemMask = PNS_ITEM::ANY;
+ m_itemMask = PNS_ITEM::ANY_T;
}
void SetItemMask( int aMask )
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index 9b1150b..13dc99b 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -68,7 +68,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
{
m_originLayer = aItem->Layers().Start();
- if( aItem->OfKind( PNS::PNS_ITEM::LINE ) )
+ if( aItem->OfKind( PNS::PNS_ITEM::LINE_T ) )
{
const PNS::PNS_LINE* l = static_cast<const PNS::PNS_LINE*>( aItem );
@@ -86,12 +86,12 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS::PNS_ITEM::LINE:
+ case PNS::PNS_ITEM::LINE_T:
m_type = PR_SHAPE;
m_width = ( (PNS::PNS_LINE*) aItem )->Width();
break;
- case PNS::PNS_ITEM::SEGMENT:
+ case PNS::PNS_ITEM::SEGMENT_T:
{
PNS::PNS_SEGMENT* seg = (PNS::PNS_SEGMENT*) aItem;
m_type = PR_SHAPE;
@@ -99,7 +99,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
break;
}
- case PNS::PNS_ITEM::VIA:
+ case PNS::PNS_ITEM::VIA_T:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE;
m_width = 0;
@@ -107,7 +107,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
m_depth = ViaOverlayDepth;
break;
- case PNS::PNS_ITEM::SOLID:
+ case PNS::PNS_ITEM::SOLID_T:
m_type = PR_SHAPE;
m_width = 0;
break;
--
2.9.0.windows.1
>From 264307a8c8cc87ac7c6b17c0f42c08616e208dd9 Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 19:31:13 +0200
Subject: [PATCH] Remove PNS_ prefix from most types inside namespace PNS
---
pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp | 2 +-
pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h | 6 +-
.../dialogs/dialog_pns_length_tuning_settings.cpp | 2 +-
pcbnew/dialogs/dialog_pns_length_tuning_settings.h | 8 +-
pcbnew/dialogs/dialog_pns_settings.cpp | 2 +-
pcbnew/dialogs/dialog_pns_settings.h | 6 +-
pcbnew/pcb_painter.h | 1 +
pcbnew/router/length_tuner_tool.cpp | 12 +-
pcbnew/router/length_tuner_tool.h | 6 +-
pcbnew/router/pns_algo_base.cpp | 4 +-
pcbnew/router/pns_algo_base.h | 28 +-
pcbnew/router/pns_debug_decorator.h | 6 +-
pcbnew/router/pns_diff_pair.cpp | 142 ++++----
pcbnew/router/pns_diff_pair.h | 104 +++---
pcbnew/router/pns_diff_pair_placer.cpp | 172 +++++-----
pcbnew/router/pns_diff_pair_placer.h | 63 ++--
pcbnew/router/pns_dp_meander_placer.cpp | 84 ++---
pcbnew/router/pns_dp_meander_placer.h | 48 +--
pcbnew/router/pns_dragger.cpp | 100 +++---
pcbnew/router/pns_dragger.h | 67 ++--
pcbnew/router/pns_index.h | 60 ++--
pcbnew/router/pns_item.cpp | 10 +-
pcbnew/router/pns_item.h | 42 +--
pcbnew/router/pns_itemset.cpp | 26 +-
pcbnew/router/pns_itemset.h | 56 ++--
pcbnew/router/pns_joint.h | 64 ++--
pcbnew/router/pns_kicad_iface.cpp | 87 +++--
pcbnew/router/pns_kicad_iface.h | 29 +-
pcbnew/router/pns_layerset.h | 29 +-
pcbnew/router/pns_line.cpp | 82 ++---
pcbnew/router/pns_line.h | 62 ++--
pcbnew/router/pns_line_placer.cpp | 202 ++++++------
pcbnew/router/pns_line_placer.h | 79 +++--
pcbnew/router/pns_logger.cpp | 34 +-
pcbnew/router/pns_logger.h | 10 +-
pcbnew/router/pns_meander.cpp | 82 ++---
pcbnew/router/pns_meander.h | 66 ++--
pcbnew/router/pns_meander_placer.cpp | 56 ++--
pcbnew/router/pns_meander_placer.h | 67 ++--
pcbnew/router/pns_meander_placer_base.cpp | 28 +-
pcbnew/router/pns_meander_placer_base.h | 35 +-
pcbnew/router/pns_meander_skew_placer.cpp | 36 +--
pcbnew/router/pns_meander_skew_placer.h | 31 +-
pcbnew/router/pns_node.cpp | 356 ++++++++++-----------
pcbnew/router/pns_node.h | 226 ++++++-------
pcbnew/router/pns_optimizer.cpp | 170 +++++-----
pcbnew/router/pns_optimizer.h | 84 ++---
pcbnew/router/pns_placement_algo.h | 28 +-
pcbnew/router/pns_router.cpp | 118 +++----
pcbnew/router/pns_router.h | 154 ++++-----
pcbnew/router/pns_routing_settings.cpp | 12 +-
pcbnew/router/pns_routing_settings.h | 6 +-
pcbnew/router/pns_segment.h | 22 +-
pcbnew/router/pns_shove.cpp | 268 ++++++++--------
pcbnew/router/pns_shove.h | 98 +++---
pcbnew/router/pns_sizes_settings.cpp | 36 +--
pcbnew/router/pns_sizes_settings.h | 12 +-
pcbnew/router/pns_solid.cpp | 6 +-
pcbnew/router/pns_solid.h | 14 +-
pcbnew/router/pns_tool_base.cpp | 58 ++--
pcbnew/router/pns_tool_base.h | 26 +-
pcbnew/router/pns_topology.cpp | 132 ++++----
pcbnew/router/pns_topology.h | 50 +--
pcbnew/router/pns_tune_status_popup.cpp | 10 +-
pcbnew/router/pns_tune_status_popup.h | 4 +-
pcbnew/router/pns_utils.cpp | 22 +-
pcbnew/router/pns_utils.h | 4 +-
pcbnew/router/pns_via.cpp | 16 +-
pcbnew/router/pns_via.h | 26 +-
pcbnew/router/pns_walkaround.cpp | 32 +-
pcbnew/router/pns_walkaround.h | 36 +--
pcbnew/router/router_preview_item.cpp | 20 +-
pcbnew/router/router_preview_item.h | 10 +-
pcbnew/router/router_tool.cpp | 24 +-
pcbnew/router/router_tool.h | 6 +-
75 files changed, 2109 insertions(+), 2113 deletions(-)
diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
index 920bf8b..3c6ab1e 100644
--- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
+++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.cpp
@@ -26,7 +26,7 @@
#include "dialog_pns_diff_pair_dimensions.h"
#include <router/pns_sizes_settings.h>
-DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes ) :
+DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::SIZES_SETTINGS& aSizes ) :
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ),
m_traceWidth( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap( this, m_traceGapText, m_traceGapUnit ),
diff --git a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
index 80e413f..1ec8ea4 100644
--- a/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
+++ b/pcbnew/dialogs/dialog_pns_diff_pair_dimensions.h
@@ -32,14 +32,14 @@
namespace PNS {
-class PNS_SIZES_SETTINGS;
+class SIZES_SETTINGS;
}
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
{
public:
- DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::PNS_SIZES_SETTINGS& aSizes );
+ DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS::SIZES_SETTINGS& aSizes );
private:
void updateCheckbox();
@@ -51,7 +51,7 @@ private:
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
- PNS::PNS_SIZES_SETTINGS& m_sizes;
+ PNS::SIZES_SETTINGS& m_sizes;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
index 28f3ae1..b7d238e 100644
--- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
+++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp
@@ -27,7 +27,7 @@
#include <router/pns_meander_placer.h>
DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent,
- PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode )
+ PNS::MEANDER_SETTINGS& aSettings, PNS::ROUTER_MODE aMode )
:
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ),
m_minAmpl( this, m_minAmplText, m_minAmplUnit ),
diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
index 5057ad8..19e7647 100644
--- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
+++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.h
@@ -34,14 +34,14 @@
namespace PNS {
-class PNS_MEANDER_SETTINGS;
+class MEANDER_SETTINGS;
}
class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
{
public:
- DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::PNS_MEANDER_SETTINGS& aSettings, PNS::PNS_ROUTER_MODE aMode );
+ DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS::MEANDER_SETTINGS& aSettings, PNS::ROUTER_MODE aMode );
virtual void OnOkClick( wxCommandEvent& aEvent );
@@ -51,8 +51,8 @@ private:
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
- PNS::PNS_MEANDER_SETTINGS& m_settings;
- PNS::PNS_ROUTER_MODE m_mode;
+ PNS::MEANDER_SETTINGS& m_settings;
+ PNS::ROUTER_MODE m_mode;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp
index 6dc9122..0fa1b43 100644
--- a/pcbnew/dialogs/dialog_pns_settings.cpp
+++ b/pcbnew/dialogs/dialog_pns_settings.cpp
@@ -26,7 +26,7 @@
#include "dialog_pns_settings.h"
#include <router/pns_routing_settings.h>
-DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings ) :
+DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings ) :
DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
{
// "Figure out what's best" is not available yet
diff --git a/pcbnew/dialogs/dialog_pns_settings.h b/pcbnew/dialogs/dialog_pns_settings.h
index ec85dfc..09e40f1 100644
--- a/pcbnew/dialogs/dialog_pns_settings.h
+++ b/pcbnew/dialogs/dialog_pns_settings.h
@@ -30,19 +30,19 @@
namespace PNS {
-class PNS_ROUTING_SETTINGS;
+class ROUTING_SETTINGS;
}
class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE
{
public:
- DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::PNS_ROUTING_SETTINGS& aSettings );
+ DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings );
private:
virtual void OnOkClick( wxCommandEvent& aEvent );
- PNS::PNS_ROUTING_SETTINGS& m_settings;
+ PNS::ROUTING_SETTINGS& m_settings;
};
#endif // __dialog_pns_settings__
diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h
index 06f0b8c..9d4ce5d 100644
--- a/pcbnew/pcb_painter.h
+++ b/pcbnew/pcb_painter.h
@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
* @author Maciej Suminski <maciej.suminski@xxxxxxx>
*
diff --git a/pcbnew/router/length_tuner_tool.cpp b/pcbnew/router/length_tuner_tool.cpp
index 595d300..e7cc806 100644
--- a/pcbnew/router/length_tuner_tool.cpp
+++ b/pcbnew/router/length_tuner_tool.cpp
@@ -68,7 +68,7 @@ static TOOL_ACTION ACT_AmplDecrease( "pcbnew.LengthTuner.AmplDecrease", AS_CONTE
LENGTH_TUNER_TOOL::LENGTH_TUNER_TOOL() :
- PNS_TOOL_BASE( "pcbnew.LengthTuner" )
+ TOOL_BASE( "pcbnew.LengthTuner" )
{
}
@@ -101,7 +101,7 @@ LENGTH_TUNER_TOOL::~LENGTH_TUNER_TOOL()
void LENGTH_TUNER_TOOL::Reset( RESET_REASON aReason )
{
- PNS_TOOL_BASE::Reset( aReason );
+ TOOL_BASE::Reset( aReason );
Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, COMMON_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPair, COMMON_ACTIONS::routerActivateTuneDiffPair.MakeEvent() );
@@ -121,14 +121,14 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
}
}
- PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS::PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
+ PNS::MEANDER_PLACER_BASE* placer = static_cast<PNS::MEANDER_PLACER_BASE*>( m_router->Placer() );
if( !placer )
return;
if( aEvent.IsAction( &ACT_Settings ) )
{
- PNS::PNS_MEANDER_SETTINGS settings = placer->MeanderSettings();
+ PNS::MEANDER_SETTINGS settings = placer->MeanderSettings();
DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( m_frame, settings, m_router->Mode() );
if( settingsDlg.ShowModal() )
@@ -171,7 +171,7 @@ void LENGTH_TUNER_TOOL::performTuning()
return;
}
- PNS::PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS::PNS_MEANDER_PLACER_BASE*>(
+ PNS::MEANDER_PLACER_BASE* placer = static_cast<PNS::MEANDER_PLACER_BASE*>(
m_router->Placer() );
placer->UpdateSettings( m_savedMeanderSettings );
@@ -256,7 +256,7 @@ int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent )
}
-int LENGTH_TUNER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode )
+int LENGTH_TUNER_TOOL::mainLoop( PNS::ROUTER_MODE aMode )
{
// Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
diff --git a/pcbnew/router/length_tuner_tool.h b/pcbnew/router/length_tuner_tool.h
index fbc9c72..1fadd44 100644
--- a/pcbnew/router/length_tuner_tool.h
+++ b/pcbnew/router/length_tuner_tool.h
@@ -28,7 +28,7 @@
class PNS_TUNE_STATUS_POPUP;
-class APIEXPORT LENGTH_TUNER_TOOL : public PNS::PNS_TOOL_BASE
+class APIEXPORT LENGTH_TUNER_TOOL : public PNS::TOOL_BASE
{
public:
LENGTH_TUNER_TOOL();
@@ -43,13 +43,13 @@ public:
private:
void performTuning( );
- int mainLoop( PNS::PNS_ROUTER_MODE aMode );
+ int mainLoop( PNS::ROUTER_MODE aMode );
void handleCommonEvents( const TOOL_EVENT& aEvent );
void updateStatusPopup ( PNS_TUNE_STATUS_POPUP& aPopup );
- PNS::PNS_MEANDER_SETTINGS m_savedMeanderSettings;
+ PNS::MEANDER_SETTINGS m_savedMeanderSettings;
};
#endif
diff --git a/pcbnew/router/pns_algo_base.cpp b/pcbnew/router/pns_algo_base.cpp
index ce3ba8d..781360d 100644
--- a/pcbnew/router/pns_algo_base.cpp
+++ b/pcbnew/router/pns_algo_base.cpp
@@ -25,13 +25,13 @@
namespace PNS {
-PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
+ROUTING_SETTINGS& ALGO_BASE::Settings() const
{
return m_router->Settings();
}
-PNS_LOGGER* PNS_ALGO_BASE::Logger()
+LOGGER* ALGO_BASE::Logger()
{
return NULL;
}
diff --git a/pcbnew/router/pns_algo_base.h b/pcbnew/router/pns_algo_base.h
index ee6d930..36df0a4 100644
--- a/pcbnew/router/pns_algo_base.h
+++ b/pcbnew/router/pns_algo_base.h
@@ -26,55 +26,55 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_LOGGER;
-class PNS_DEBUG_DECORATOR;
+class ROUTER;
+class LOGGER;
+class DEBUG_DECORATOR;
/**
- * Class PNS_ALGO_BASE
+ * Class ALGO_BASE
*
* Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.)
* Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging)
*/
-class PNS_ALGO_BASE
+class ALGO_BASE
{
public:
- PNS_ALGO_BASE( PNS_ROUTER* aRouter ) :
+ ALGO_BASE( ROUTER* aRouter ) :
m_router( aRouter )
{}
- virtual ~PNS_ALGO_BASE() {}
+ virtual ~ALGO_BASE() {}
///> Returns the instance of our router
- PNS_ROUTER* Router() const
+ ROUTER* Router() const
{
return m_router;
}
///> Returns current router settings
- PNS_ROUTING_SETTINGS& Settings() const;
+ ROUTING_SETTINGS& Settings() const;
///> Returns the logger object, allowing to dump geometry to a file.
- virtual PNS_LOGGER* Logger();
+ virtual LOGGER* Logger();
/**
* Function SetDebugDecorator
*
* Assign a debug decorator allowing this algo to draw extra graphics for visual debugging
*/
- void SetDebugDecorator( PNS_DEBUG_DECORATOR* aDecorator )
+ void SetDebugDecorator( DEBUG_DECORATOR* aDecorator )
{
m_debugDecorator = aDecorator;
}
- PNS_DEBUG_DECORATOR* Dbg() const
+ DEBUG_DECORATOR* Dbg() const
{
return m_debugDecorator;
}
private:
- PNS_DEBUG_DECORATOR *m_debugDecorator;
- PNS_ROUTER* m_router;
+ DEBUG_DECORATOR *m_debugDecorator;
+ ROUTER* m_router;
};
}
diff --git a/pcbnew/router/pns_debug_decorator.h b/pcbnew/router/pns_debug_decorator.h
index dc991e8..6663de6 100644
--- a/pcbnew/router/pns_debug_decorator.h
+++ b/pcbnew/router/pns_debug_decorator.h
@@ -29,13 +29,13 @@
namespace PNS {
-class PNS_DEBUG_DECORATOR
+class DEBUG_DECORATOR
{
public:
- PNS_DEBUG_DECORATOR()
+ DEBUG_DECORATOR()
{}
- virtual ~PNS_DEBUG_DECORATOR()
+ virtual ~DEBUG_DECORATOR()
{}
virtual void AddPoint( VECTOR2I aP, int aColor ) {};
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index a0088f4..4b2d586 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -39,9 +39,9 @@
namespace PNS {
-class PNS_LINE;
+class LINE;
-PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN )
+DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( ITEM* aPrimP, ITEM* aPrimN )
{
m_primP = aPrimP->Clone();
m_primN = aPrimN->Clone();
@@ -51,14 +51,14 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN
}
-void PNS_DP_PRIMITIVE_PAIR::SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN )
+void DP_PRIMITIVE_PAIR::SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN )
{
m_anchorP = aAnchorP;
m_anchorN = aAnchorN;
}
-PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN )
+DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN )
{
m_anchorP = aAnchorP;
m_anchorN = aAnchorN;
@@ -66,7 +66,7 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VE
}
-PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther )
+DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR( const DP_PRIMITIVE_PAIR& aOther )
{
m_primP = m_primN = NULL;
@@ -81,7 +81,7 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOthe
}
-PNS_DP_PRIMITIVE_PAIR& PNS_DP_PRIMITIVE_PAIR::operator=( const PNS_DP_PRIMITIVE_PAIR& aOther )
+DP_PRIMITIVE_PAIR& DP_PRIMITIVE_PAIR::operator=( const DP_PRIMITIVE_PAIR& aOther )
{
if( aOther.m_primP )
m_primP = aOther.m_primP->Clone();
@@ -95,28 +95,28 @@ PNS_DP_PRIMITIVE_PAIR& PNS_DP_PRIMITIVE_PAIR::operator=( const PNS_DP_PRIMITIVE_
}
-PNS_DP_PRIMITIVE_PAIR::~PNS_DP_PRIMITIVE_PAIR()
+DP_PRIMITIVE_PAIR::~DP_PRIMITIVE_PAIR()
{
delete m_primP;
delete m_primN;
}
-bool PNS_DP_PRIMITIVE_PAIR::Directional() const
+bool DP_PRIMITIVE_PAIR::Directional() const
{
if( !m_primP )
return false;
- return m_primP->OfKind( PNS_ITEM::SEGMENT_T );
+ return m_primP->OfKind( ITEM::SEGMENT_T );
}
-DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const
+DIRECTION_45 DP_PRIMITIVE_PAIR::anchorDirection( ITEM* aItem, const VECTOR2I& aP ) const
{
- if( !aItem->OfKind ( PNS_ITEM::SEGMENT_T ) )
+ if( !aItem->OfKind ( ITEM::SEGMENT_T ) )
return DIRECTION_45();
- PNS_SEGMENT* s = static_cast<PNS_SEGMENT*>( aItem );
+ SEGMENT* s = static_cast<SEGMENT*>( aItem );
if( s->Seg().A == aP )
return DIRECTION_45( s->Seg().A - s->Seg().B );
@@ -124,18 +124,18 @@ DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::anchorDirection( PNS_ITEM* aItem, const VECT
return DIRECTION_45( s->Seg().B - s->Seg().A );
}
-void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint, VECTOR2I& aDirection ) const
+void DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I& aMidpoint, VECTOR2I& aDirection ) const
{
assert( m_primP && m_primN );
VECTOR2I aP, aN, dir, midpoint;
- if ( m_primP->OfKind( PNS_ITEM::SEGMENT_T ) && m_primN->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if ( m_primP->OfKind( ITEM::SEGMENT_T ) && m_primN->OfKind( ITEM::SEGMENT_T ) )
{
aP = m_primP->Anchor( 1 );
aN = m_primN->Anchor( 1 );
midpoint = ( aP + aN ) / 2;
- SEG s = static_cast <PNS_SEGMENT*>( m_primP )->Seg();
+ SEG s = static_cast <SEGMENT*>( m_primP )->Seg();
if ( s.B != s.A )
{
@@ -165,13 +165,13 @@ void PNS_DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTO
}
-DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirP() const
+DIRECTION_45 DP_PRIMITIVE_PAIR::DirP() const
{
return anchorDirection( m_primP, m_anchorP );
}
-DIRECTION_45 PNS_DP_PRIMITIVE_PAIR::DirN() const
+DIRECTION_45 DP_PRIMITIVE_PAIR::DirN() const
{
return anchorDirection( m_primN, m_anchorN );
}
@@ -205,14 +205,14 @@ static bool checkGap( const SHAPE_LINE_CHAIN &p, const SHAPE_LINE_CHAIN &n, int
}
-void PNS_DP_GATEWAY::Reverse()
+void DP_GATEWAY::Reverse()
{
m_entryN = m_entryN.Reverse();
m_entryP = m_entryP.Reverse();
}
-bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY &aTarget, bool aPrefDiagonal )
+bool DIFF_PAIR::BuildInitial( const DP_GATEWAY& aEntry, const DP_GATEWAY &aTarget, bool aPrefDiagonal )
{
SHAPE_LINE_CHAIN p = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorP(), aTarget.AnchorP(), aPrefDiagonal );
SHAPE_LINE_CHAIN n = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorN(), aTarget.AnchorN(), aPrefDiagonal );
@@ -246,7 +246,7 @@ bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GAT
if( aTarget.HasEntryLines() )
{
- PNS_DP_GATEWAY t(aTarget) ;
+ DP_GATEWAY t(aTarget) ;
t.Reverse();
if( !CheckConnectionAngle( t.Entry(), mask ) )
@@ -272,7 +272,7 @@ bool PNS_DIFF_PAIR::BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GAT
}
-bool PNS_DIFF_PAIR::CheckConnectionAngle( const PNS_DIFF_PAIR& aOther, int aAllowedAngles ) const
+bool DIFF_PAIR::CheckConnectionAngle( const DIFF_PAIR& aOther, int aAllowedAngles ) const
{
bool checkP, checkN;
@@ -300,16 +300,16 @@ bool PNS_DIFF_PAIR::CheckConnectionAngle( const PNS_DIFF_PAIR& aOther, int aAllo
}
-const PNS_DIFF_PAIR PNS_DP_GATEWAY::Entry() const
+const DIFF_PAIR DP_GATEWAY::Entry() const
{
- return PNS_DIFF_PAIR( m_entryP, m_entryN, 0 );
+ return DIFF_PAIR( m_entryP, m_entryN, 0 );
}
-void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
+void DP_GATEWAYS::BuildOrthoProjections( DP_GATEWAYS& aEntries,
const VECTOR2I& aCursorPos, int aOrthoScore )
{
- for( PNS_DP_GATEWAY g : aEntries.Gateways() )
+ for( DP_GATEWAY g : aEntries.Gateways() )
{
VECTOR2I midpoint( ( g.AnchorP() + g.AnchorN() ) / 2 );
SEG guide_s( midpoint, midpoint + VECTOR2I( 1, 0 ) );
@@ -324,7 +324,7 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
VECTOR2I proj = ( dist_s < dist_d ? proj_s : proj_d );
- PNS_DP_GATEWAYS targets( m_gap );
+ DP_GATEWAYS targets( m_gap );
targets.m_viaGap = m_viaGap;
targets.m_viaDiameter = m_viaDiameter;
@@ -332,7 +332,7 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
targets.BuildForCursor( proj );
- for( PNS_DP_GATEWAY t : targets.Gateways() )
+ for( DP_GATEWAY t : targets.Gateways() )
{
t.SetPriority( aOrthoScore );
m_gateways.push_back( t );
@@ -341,8 +341,8 @@ void PNS_DP_GATEWAYS::BuildOrthoProjections( PNS_DP_GATEWAYS& aEntries,
}
-bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget,
- bool aPrefDiagonal, PNS_DIFF_PAIR& aDp )
+bool DP_GATEWAYS::FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget,
+ bool aPrefDiagonal, DIFF_PAIR& aDp )
{
DP_CANDIDATE best;
@@ -350,9 +350,9 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
int bestScore = -1000;
bool found = false;
- for( const PNS_DP_GATEWAY& g_entry : aEntry.Gateways() )
+ for( const DP_GATEWAY& g_entry : aEntry.Gateways() )
{
- for( const PNS_DP_GATEWAY& g_target : aTarget.Gateways() )
+ for( const DP_GATEWAY& g_target : aTarget.Gateways() )
{
n++;
@@ -365,7 +365,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
if( score < bestScore )
continue;
- PNS_DIFF_PAIR l( m_gap );
+ DIFF_PAIR l( m_gap );
if( l.BuildInitial( g_entry, g_target, aPrefDiagonal ^ ( attempt ? true : false ) ) )
{
@@ -390,7 +390,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
}
-bool PNS_DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const
+bool DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const
{
VECTOR2I dir ( std::abs (a.x - b.x), std::abs ( a.y - b.y ));
@@ -398,16 +398,16 @@ bool PNS_DP_GATEWAYS::checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I&
}
-void PNS_DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation )
+void DP_GATEWAYS::FilterByOrientation ( int aAngleMask, DIRECTION_45 aRefOrientation )
{
- std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const PNS_DP_GATEWAY& dp) {
+ std::remove_if( m_gateways.begin(), m_gateways.end(), [aAngleMask, aRefOrientation]( const DP_GATEWAY& dp) {
DIRECTION_45 orient( dp.AnchorP() - dp.AnchorN() );
return !( orient.Angle( aRefOrientation ) & aAngleMask );
} );
}
-void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal )
+void DP_GATEWAYS::BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal )
{
VECTOR2I majorDirection;
VECTOR2I p0_p, p0_n;
@@ -421,7 +421,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
return;
}
- const int pvMask = PNS_ITEM::SOLID_T | PNS_ITEM::VIA_T;
+ const int pvMask = ITEM::SOLID_T | ITEM::VIA_T;
if( aPair.PrimP()->OfKind( pvMask ) && aPair.PrimN()->OfKind( pvMask ) )
{
@@ -430,7 +430,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
shP = aPair.PrimP()->Shape();
}
- else if( aPair.PrimP()->OfKind( PNS_ITEM::SEGMENT_T ) && aPair.PrimN()->OfKind( PNS_ITEM::SEGMENT_T ) )
+ else if( aPair.PrimP()->OfKind( ITEM::SEGMENT_T ) && aPair.PrimN()->OfKind( ITEM::SEGMENT_T ) )
{
buildDpContinuation( aPair, aPreferDiagonal );
@@ -506,7 +506,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
SHAPE_LINE_CHAIN entryP( p0_p, p0_p + sign * dir, gw_p );
SHAPE_LINE_CHAIN entryN( p0_n, p0_n + sign * dir, gw_n );
- PNS_DP_GATEWAY gw( gw_p, gw_n, false );
+ DP_GATEWAY gw( gw_p, gw_n, false );
gw.SetEntryLines( entryP, entryN );
gw.SetPriority( 100 - k );
@@ -519,7 +519,7 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
}
-void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
+void DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
{
int gap = m_fitVias ? m_viaGap + m_viaDiameter : m_gap;
@@ -550,7 +550,7 @@ void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
if( m_fitVias )
BuildGeneric( aCursorPos + dir, aCursorPos - dir, true, true );
else
- m_gateways.push_back( PNS_DP_GATEWAY( aCursorPos + dir,
+ m_gateways.push_back( DP_GATEWAY( aCursorPos + dir,
aCursorPos - dir, attempt ? true : false ) );
}
@@ -558,9 +558,9 @@ void PNS_DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
}
-void PNS_DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n )
+void DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n )
{
- for( PNS_DP_GATEWAY &g : m_gateways )
+ for( DP_GATEWAY &g : m_gateways )
{
if( !g.HasEntryLines() )
{
@@ -572,9 +572,9 @@ void PNS_DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n )
}
-void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal )
+void DP_GATEWAYS::buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal )
{
- PNS_DP_GATEWAY gw( aPair.AnchorP(), aPair.AnchorN(), aIsDiagonal );
+ DP_GATEWAY gw( aPair.AnchorP(), aPair.AnchorN(), aIsDiagonal );
gw.SetPriority( 100 );
m_gateways.push_back( gw );
@@ -589,7 +589,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs
VECTOR2I vdP = aPair.AnchorP() + dP.Left().ToVector();
VECTOR2I vdN = aPair.AnchorN() + dN.Left().ToVector();
- PNS_SEGMENT* sP = static_cast<PNS_SEGMENT*>( aPair.PrimP() );
+ SEGMENT* sP = static_cast<SEGMENT*>( aPair.PrimP() );
VECTOR2I t1, t2;
@@ -604,7 +604,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs
t2 = aPair.AnchorN() + dP.Left().ToVector().Resize( gap );
}
- PNS_DP_GATEWAY gwL( t2, aPair.AnchorN(), !aIsDiagonal );
+ DP_GATEWAY gwL( t2, aPair.AnchorN(), !aIsDiagonal );
SHAPE_LINE_CHAIN ep = dP.BuildInitialTrace( aPair.AnchorP(), t2, !aIsDiagonal );
gwL.SetPriority( 10 );
@@ -612,7 +612,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs
m_gateways.push_back( gwL );
- PNS_DP_GATEWAY gwR( aPair.AnchorP(), t1, !aIsDiagonal );
+ DP_GATEWAY gwR( aPair.AnchorP(), t1, !aIsDiagonal );
SHAPE_LINE_CHAIN en = dP.BuildInitialTrace( aPair.AnchorN(), t1, !aIsDiagonal );
gwR.SetPriority( 10) ;
gwR.SetEntryLines( SHAPE_LINE_CHAIN(), en );
@@ -621,7 +621,7 @@ void PNS_DP_GATEWAYS::buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIs
}
-void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries, bool aViaMode )
+void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries, bool aViaMode )
{
SEG st_p[2], st_n[2];
SEG d_n[2], d_p[2];
@@ -652,13 +652,13 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n,
if( !aViaMode )
{
- m_gateways.push_back( PNS_DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) );
+ m_gateways.push_back( DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) );
dir = ( p0_n - p0_p ).Resize( m_gap );
- m_gateways.push_back( PNS_DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) );
- m_gateways.push_back( PNS_DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) );
- m_gateways.push_back( PNS_DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) );
- m_gateways.push_back( PNS_DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) );
+ m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) );
+ m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) );
+ m_gateways.push_back( DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) );
+ m_gateways.push_back( DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) );
}
}
}
@@ -691,7 +691,7 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n,
VECTOR2I g_p( ( p0_p - m ).Resize( (double) m_gap * M_SQRT1_2 ) );
VECTOR2I g_n( ( p0_n - m ).Resize( (double) m_gap * M_SQRT1_2 ) );
- m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) );
+ m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) );
}
}
}
@@ -714,13 +714,13 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n,
g_n = ( p0_n - m ).Resize( (double) m_gap );
if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE )
- m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, true ) );
+ m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) );
g_p = ( p0_p - m ).Resize( m_gap );
g_n = ( p0_n - m ).Resize( (double) m_gap * M_SQRT2 );
if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE )
- m_gateways.push_back( PNS_DP_GATEWAY( m + g_p, m + g_n, true ) );
+ m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) );
}
}
}
@@ -732,19 +732,19 @@ void PNS_DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n,
}
-PNS_DP_PRIMITIVE_PAIR PNS_DIFF_PAIR::EndingPrimitives()
+DP_PRIMITIVE_PAIR DIFF_PAIR::EndingPrimitives()
{
if( m_hasVias )
- return PNS_DP_PRIMITIVE_PAIR( &m_via_p, &m_via_n );
+ return DP_PRIMITIVE_PAIR( &m_via_p, &m_via_n );
else
{
- const PNS_LINE lP( PLine() );
- const PNS_LINE lN( NLine() );
+ const LINE lP( PLine() );
+ const LINE lN( NLine() );
- PNS_SEGMENT sP( lP, lP.CSegment( -1 ) );
- PNS_SEGMENT sN( lN, lN.CSegment( -1 ) );
+ SEGMENT sP( lP, lP.CSegment( -1 ) );
+ SEGMENT sN( lN, lN.CSegment( -1 ) );
- PNS_DP_PRIMITIVE_PAIR dpair( &sP, &sN );
+ DP_PRIMITIVE_PAIR dpair( &sP, &sN );
dpair.SetAnchors( sP.Seg().B, sN.Seg().B );
return dpair;
@@ -794,13 +794,13 @@ bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip )
}
-double PNS_DIFF_PAIR::Skew() const
+double DIFF_PAIR::Skew() const
{
return m_p.Length() - m_n.Length();
}
-void PNS_DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const
+void DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const
{
SHAPE_LINE_CHAIN p( m_p );
SHAPE_LINE_CHAIN n( m_n );
@@ -829,7 +829,7 @@ void PNS_DIFF_PAIR::CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs ) const
}
-int64_t PNS_DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const
+int64_t DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const
{
int64_t total = 0;
@@ -854,7 +854,7 @@ int64_t PNS_DIFF_PAIR::CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LI
}
-double PNS_DIFF_PAIR::CoupledLength() const
+double DIFF_PAIR::CoupledLength() const
{
COUPLED_SEGMENTS_VEC pairs;
@@ -868,7 +868,7 @@ double PNS_DIFF_PAIR::CoupledLength() const
}
-double PNS_DIFF_PAIR::CoupledLengthFactor() const
+double DIFF_PAIR::CoupledLengthFactor() const
{
double t = TotalLength();
@@ -879,7 +879,7 @@ double PNS_DIFF_PAIR::CoupledLengthFactor() const
}
-double PNS_DIFF_PAIR::TotalLength() const
+double DIFF_PAIR::TotalLength() const
{
double lenP = m_p.Length();
double lenN = m_n.Length();
@@ -888,7 +888,7 @@ double PNS_DIFF_PAIR::TotalLength() const
}
-int PNS_DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const
+int DIFF_PAIR::CoupledLength ( const SEG& aP, const SEG& aN ) const
{
SEG p_clip, n_clip;
int64_t dist = std::abs( aP.Distance( aN ) - m_width );
diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h
index 902bf20..535026d 100644
--- a/pcbnew/router/pns_diff_pair.h
+++ b/pcbnew/router/pns_diff_pair.h
@@ -35,18 +35,18 @@
namespace PNS {
-class PNS_DIFF_PAIR;
+class DIFF_PAIR;
/**
- * Class PNS_DP_GATEWAY
+ * Class DP_GATEWAY
*
* Defines a "gateway" for routing a differential pair - e.g. a pair of points (anchors) with certain
* orientation, spacing and (optionally) predefined entry paths. The routing algorithm connects such
* gateways with parallel lines, thus creating a difrerential pair.
**/
-class PNS_DP_GATEWAY {
+class DP_GATEWAY {
public:
- PNS_DP_GATEWAY( const VECTOR2I& aAnchorP,
+ DP_GATEWAY( const VECTOR2I& aAnchorP,
const VECTOR2I& aAnchorN,
bool aIsDiagonal,
int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE,
@@ -60,7 +60,7 @@ public:
m_hasEntryLines = false;
}
- ~PNS_DP_GATEWAY()
+ ~DP_GATEWAY()
{
}
@@ -110,7 +110,7 @@ public:
const SHAPE_LINE_CHAIN& EntryP() const { return m_entryP; }
const SHAPE_LINE_CHAIN& EntryN() const { return m_entryN; }
- const PNS_DIFF_PAIR Entry() const ;
+ const DIFF_PAIR Entry() const ;
void Reverse();
@@ -129,31 +129,31 @@ private:
};
/**
- * Class PNS_DP_PRIMITIVE_PAIR
+ * Class DP_PRIMITIVE_PAIR
*
* Stores staring/ending primitives (pads, vias or segments) for a differential pair.
**/
-class PNS_DP_PRIMITIVE_PAIR
+class DP_PRIMITIVE_PAIR
{
public:
- PNS_DP_PRIMITIVE_PAIR():
+ DP_PRIMITIVE_PAIR():
m_primP( NULL ), m_primN( NULL ) {};
- PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther );
- PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN );
- PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
+ DP_PRIMITIVE_PAIR( const DP_PRIMITIVE_PAIR& aOther );
+ DP_PRIMITIVE_PAIR( ITEM* aPrimP, ITEM* aPrimN );
+ DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
- ~PNS_DP_PRIMITIVE_PAIR();
+ ~DP_PRIMITIVE_PAIR();
void SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
const VECTOR2I& AnchorP() const { return m_anchorP; }
const VECTOR2I& AnchorN() const { return m_anchorN; }
- PNS_DP_PRIMITIVE_PAIR& operator=( const PNS_DP_PRIMITIVE_PAIR& aOther );
+ DP_PRIMITIVE_PAIR& operator=( const DP_PRIMITIVE_PAIR& aOther );
- PNS_ITEM* PrimP() const { return m_primP; }
- PNS_ITEM* PrimN() const { return m_primN; }
+ ITEM* PrimP() const { return m_primP; }
+ ITEM* PrimN() const { return m_primN; }
bool Directional() const;
@@ -170,23 +170,23 @@ public:
}
private:
- DIRECTION_45 anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const;
+ DIRECTION_45 anchorDirection( ITEM* aItem, const VECTOR2I& aP ) const;
- PNS_ITEM* m_primP;
- PNS_ITEM* m_primN;
+ ITEM* m_primP;
+ ITEM* m_primN;
VECTOR2I m_anchorP, m_anchorN;
};
/**
- * Class PNS_GATEWAYS
+ * Class DP_GATEWAYS
*
* A set of gateways calculated for the cursor or starting/ending primitive pair.
**/
-class PNS_DP_GATEWAYS
+class DP_GATEWAYS
{
public:
- PNS_DP_GATEWAYS( int aGap ):
+ DP_GATEWAYS( int aGap ):
m_gap( aGap ), m_viaGap( aGap )
{
// Do not leave unitialized members, and keep static analyser quiet:
@@ -217,18 +217,18 @@ class PNS_DP_GATEWAYS
void BuildForCursor( const VECTOR2I& aCursorPos );
- void BuildOrthoProjections( PNS_DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
+ void BuildOrthoProjections( DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
void BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false );
- void BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal );
+ void BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal );
- bool FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, bool aPrefDiagonal, PNS_DIFF_PAIR& aDp );
+ bool FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget, bool aPrefDiagonal, DIFF_PAIR& aDp );
- std::vector<PNS_DP_GATEWAY>& Gateways()
+ std::vector<DP_GATEWAY>& Gateways()
{
return m_gateways;
}
- const std::vector<PNS_DP_GATEWAY>& CGateways() const
+ const std::vector<DP_GATEWAY>& CGateways() const
{
return m_gateways;
}
@@ -244,7 +244,7 @@ class PNS_DP_GATEWAYS
};
bool checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const;
- void buildDpContinuation( PNS_DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal );
+ void buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal );
void buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n );
int m_gap;
@@ -252,17 +252,17 @@ class PNS_DP_GATEWAYS
int m_viaDiameter;
bool m_fitVias;
- std::vector<PNS_DP_GATEWAY> m_gateways;
+ std::vector<DP_GATEWAY> m_gateways;
};
/**
- * Class PNS_DIFF_PAIR
+ * Class DIFF_PAIR
*
* Basic class for a differential pair. Stores two PNS_LINEs (for positive and negative nets, respectively),
* the gap and coupling constraints.
**/
-class PNS_DIFF_PAIR : public PNS_ITEM {
+class DIFF_PAIR : public ITEM {
public:
struct COUPLED_SEGMENTS {
@@ -286,7 +286,7 @@ public:
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
- PNS_DIFF_PAIR() : PNS_ITEM( DIFF_PAIR_T ), m_hasVias( false )
+ DIFF_PAIR() : ITEM( DIFF_PAIR_T ), m_hasVias( false )
{
// Initialize some members, to avoid uninitialized variables.
m_net_p = 0;
@@ -298,8 +298,8 @@ public:
m_chamferLimit = 0;
}
- PNS_DIFF_PAIR( int aGap ) :
- PNS_ITEM( DIFF_PAIR_T ),
+ DIFF_PAIR( int aGap ) :
+ ITEM( DIFF_PAIR_T ),
m_hasVias( false )
{
m_gapConstraint = aGap;
@@ -314,8 +314,8 @@ public:
m_chamferLimit = 0;
}
- PNS_DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
- PNS_ITEM( DIFF_PAIR_T ),
+ DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
+ ITEM( DIFF_PAIR_T ),
m_n( aN ),
m_p( aP ),
m_hasVias( false )
@@ -332,8 +332,8 @@ public:
m_chamferLimit = 0;
}
- PNS_DIFF_PAIR( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
- PNS_ITEM( DIFF_PAIR_T ),
+ DIFF_PAIR( const LINE &aLineP, const LINE &aLineN, int aGap = 0 ):
+ ITEM( DIFF_PAIR_T ),
m_line_p( aLineP ),
m_line_n( aLineN ),
m_hasVias( false )
@@ -352,14 +352,14 @@ public:
m_chamferLimit = 0;
}
- static inline bool ClassOf( const PNS_ITEM* aItem )
+ static inline bool ClassOf( const ITEM* aItem )
{
return aItem && DIFF_PAIR_T == aItem->Kind();
}
- PNS_DIFF_PAIR* Clone() const { assert( false ); return NULL; }
+ DIFF_PAIR* Clone() const { assert( false ); return NULL; }
- static PNS_DIFF_PAIR* AssembleDp( PNS_LINE *aLine );
+ static DIFF_PAIR* AssembleDp( LINE *aLine );
void SetShape( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, bool aSwapLanes = false )
{
@@ -375,7 +375,7 @@ public:
}
}
- void SetShape( const PNS_DIFF_PAIR& aPair )
+ void SetShape( const DIFF_PAIR& aPair )
{
m_p = aPair.m_p;
m_n = aPair.m_n;
@@ -405,7 +405,7 @@ public:
return m_gap;
}
- void AppendVias( const PNS_VIA &aViaP, const PNS_VIA& aViaN )
+ void AppendVias( const VIA &aViaP, const VIA& aViaN )
{
m_hasVias = true;
m_via_p = aViaP;
@@ -432,7 +432,7 @@ public:
return m_net_n;
}
- PNS_LINE& PLine()
+ LINE& PLine()
{
if( !m_line_p.IsLinked() )
updateLine( m_line_p, m_p, m_net_p, m_via_p );
@@ -440,7 +440,7 @@ public:
return m_line_p;
}
- PNS_LINE& NLine()
+ LINE& NLine()
{
if( !m_line_n.IsLinked() )
updateLine( m_line_n, m_n, m_net_n, m_via_n );
@@ -448,7 +448,7 @@ public:
return m_line_n;
}
- PNS_DP_PRIMITIVE_PAIR EndingPrimitives();
+ DP_PRIMITIVE_PAIR EndingPrimitives();
double CoupledLength() const;
double TotalLength() const;
@@ -463,7 +463,7 @@ public:
m_p.Clear();
}
- void Append( const PNS_DIFF_PAIR& aOther )
+ void Append( const DIFF_PAIR& aOther )
{
m_n.Append( aOther.m_n );
m_p.Append( aOther.m_p );
@@ -477,8 +477,8 @@ public:
const SHAPE_LINE_CHAIN& CP() const { return m_p; }
const SHAPE_LINE_CHAIN& CN() const { return m_n; }
- bool BuildInitial( const PNS_DP_GATEWAY& aEntry, const PNS_DP_GATEWAY& aTarget, bool aPrefDiagonal );
- bool CheckConnectionAngle( const PNS_DIFF_PAIR &aOther, int allowedAngles ) const;
+ bool BuildInitial( const DP_GATEWAY& aEntry, const DP_GATEWAY& aTarget, bool aPrefDiagonal );
+ bool CheckConnectionAngle( const DIFF_PAIR &aOther, int allowedAngles ) const;
int CoupledLength( const SEG& aP, const SEG& aN ) const;
int64_t CoupledLength( const SHAPE_LINE_CHAIN& aP, const SHAPE_LINE_CHAIN& aN ) const;
@@ -489,7 +489,7 @@ public:
}
private:
- void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia )
+ void updateLine( LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, VIA& aVia )
{
aLine.SetShape( aShape );
aLine.SetWidth( m_width );
@@ -501,8 +501,8 @@ private:
}
SHAPE_LINE_CHAIN m_n, m_p;
- PNS_LINE m_line_p, m_line_n;
- PNS_VIA m_via_p, m_via_n;
+ LINE m_line_p, m_line_n;
+ VIA m_via_p, m_via_n;
bool m_hasVias;
int m_net_p, m_net_n;
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 815bff1..3205660 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -35,8 +35,8 @@
namespace PNS {
-PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) :
- PNS_PLACEMENT_ALGO( aRouter )
+DIFF_PAIR_PLACER::DIFF_PAIR_PLACER( ROUTER* aRouter ) :
+ PLACEMENT_ALGO( aRouter )
{
m_state = RT_START;
m_chainedPlacement = false;
@@ -64,30 +64,30 @@ PNS_DIFF_PAIR_PLACER::PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter ) :
m_idle = true;
}
-PNS_DIFF_PAIR_PLACER::~PNS_DIFF_PAIR_PLACER()
+DIFF_PAIR_PLACER::~DIFF_PAIR_PLACER()
{
if( m_shove )
delete m_shove;
}
-void PNS_DIFF_PAIR_PLACER::setWorld( PNS_NODE* aWorld )
+void DIFF_PAIR_PLACER::setWorld( NODE* aWorld )
{
m_world = aWorld;
}
-const PNS_VIA PNS_DIFF_PAIR_PLACER::makeVia( const VECTOR2I& aP, int aNet )
+const VIA DIFF_PAIR_PLACER::makeVia( const VECTOR2I& aP, int aNet )
{
- const PNS_LAYERSET layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() );
+ const LAYER_RANGE layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() );
- PNS_VIA v( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() );
+ VIA v( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() );
v.SetNet( aNet );
return v;
}
-void PNS_DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode )
+void DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode )
{
m_orthoMode = aOrthoMode;
@@ -96,7 +96,7 @@ void PNS_DIFF_PAIR_PLACER::SetOrthoMode ( bool aOrthoMode )
}
-bool PNS_DIFF_PAIR_PLACER::ToggleVia( bool aEnabled )
+bool DIFF_PAIR_PLACER::ToggleVia( bool aEnabled )
{
m_placingVia = aEnabled;
@@ -107,7 +107,7 @@ bool PNS_DIFF_PAIR_PLACER::ToggleVia( bool aEnabled )
}
-bool PNS_DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP )
+bool DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP )
{
if( !routeHead( aP ) )
return false;
@@ -121,9 +121,9 @@ bool PNS_DIFF_PAIR_PLACER::rhMarkObstacles( const VECTOR2I& aP )
}
-bool PNS_DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP )
+bool DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP )
{
- PNS_VIA virtHead = makeVia( aP, -1 );
+ VIA virtHead = makeVia( aP, -1 );
if( m_placingVia )
virtHead.SetDiameter( viaGap() + 2 * virtHead.Diameter() );
@@ -158,11 +158,11 @@ bool PNS_DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I&
}
-bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent,
- PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly )
+bool DIFF_PAIR_PLACER::attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent,
+ DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly )
{
- PNS_WALKAROUND walkaround( aNode, Router() );
- PNS_WALKAROUND::WALKAROUND_STATUS wf1;
+ WALKAROUND walkaround( aNode, Router() );
+ WALKAROUND::WALKAROUND_STATUS wf1;
Router()->GetRuleResolver()->OverrideClearance( true,
aCurrent->NetP(), aCurrent->NetN(), aCurrent->Gap() );
@@ -170,24 +170,24 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent
walkaround.SetSolidsOnly( aSolidsOnly );
walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
- PNS_SHOVE shove( aNode, Router() );
- PNS_LINE walkP, walkN;
+ SHOVE shove( aNode, Router() );
+ LINE walkP, walkN;
aWalk = *aCurrent;
int iter = 0;
- PNS_DIFF_PAIR cur( *aCurrent );
+ DIFF_PAIR cur( *aCurrent );
bool currentIsP = aPFirst;
- int mask = aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T;
+ int mask = aSolidsOnly ? ITEM::SOLID_T : ITEM::ANY_T;
do
{
- PNS_LINE preWalk = ( currentIsP ? cur.PLine() : cur.NLine() );
- PNS_LINE preShove = ( currentIsP ? cur.NLine() : cur.PLine() );
- PNS_LINE postWalk;
+ LINE preWalk = ( currentIsP ? cur.PLine() : cur.NLine() );
+ LINE preShove = ( currentIsP ? cur.NLine() : cur.PLine() );
+ LINE postWalk;
if( !aNode->CheckColliding ( &preWalk, mask ) )
{
@@ -201,18 +201,18 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent
wf1 = walkaround.Route( preWalk, postWalk, false );
- if( wf1 != PNS_WALKAROUND::DONE )
+ if( wf1 != WALKAROUND::DONE )
return false;
- PNS_LINE postShove( preShove );
+ LINE postShove( preShove );
shove.ForceClearance( true, cur.Gap() - 2 * PNS_HULL_MARGIN );
- PNS_SHOVE::SHOVE_STATUS sh1;
+ SHOVE::SHOVE_STATUS sh1;
sh1 = shove.ProcessSingleLine( postWalk, preShove, postShove );
- if( sh1 != PNS_SHOVE::SH_OK )
+ if( sh1 != SHOVE::SH_OK )
return false;
postWalk.Line().Simplify();
@@ -239,15 +239,15 @@ bool PNS_DIFF_PAIR_PLACER::attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent
}
-bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, bool aSolidsOnly )
+bool DIFF_PAIR_PLACER::tryWalkDp( NODE* aNode, DIFF_PAIR &aPair, bool aSolidsOnly )
{
- PNS_DIFF_PAIR best;
+ DIFF_PAIR best;
double bestScore = 100000000000000.0;
for( int attempt = 0; attempt <= 3; attempt++ )
{
- PNS_DIFF_PAIR p;
- PNS_NODE *tmp = m_currentNode->Branch();
+ DIFF_PAIR p;
+ NODE *tmp = m_currentNode->Branch();
bool pfirst = ( attempt & 1 ) ? true : false;
bool wind_cw = ( attempt & 2 ) ? true : false;
@@ -272,7 +272,7 @@ bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, boo
if( bestScore > 0.0 )
{
- PNS_OPTIMIZER optimizer( m_currentNode );
+ OPTIMIZER optimizer( m_currentNode );
aPair.SetShape( best );
optimizer.Optimize( &aPair );
@@ -284,7 +284,7 @@ bool PNS_DIFF_PAIR_PLACER::tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, boo
}
-bool PNS_DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP )
+bool DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP )
{
if( !routeHead ( aP ) )
return false;
@@ -295,7 +295,7 @@ bool PNS_DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP )
}
-bool PNS_DIFF_PAIR_PLACER::route( const VECTOR2I& aP )
+bool DIFF_PAIR_PLACER::route( const VECTOR2I& aP )
{
switch( m_currentMode )
{
@@ -313,7 +313,7 @@ bool PNS_DIFF_PAIR_PLACER::route( const VECTOR2I& aP )
}
-bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP )
+bool DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP )
{
m_currentNode = m_shove->CurrentNode();
@@ -327,18 +327,18 @@ bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP )
if( !tryWalkDp( m_currentNode, m_currentTrace, true ) )
return false;
- PNS_LINE pLine( m_currentTrace.PLine() );
- PNS_LINE nLine( m_currentTrace.NLine() );
- PNS_ITEMSET head;
+ LINE pLine( m_currentTrace.PLine() );
+ LINE nLine( m_currentTrace.NLine() );
+ ITEM_SET head;
head.Add( &pLine );
head.Add( &nLine );
- PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveMultiLines( head );
+ SHOVE::SHOVE_STATUS status = m_shove->ShoveMultiLines( head );
m_currentNode = m_shove->CurrentNode();
- if( status == PNS_SHOVE::SH_OK )
+ if( status == SHOVE::SH_OK )
{
m_currentNode = m_shove->CurrentNode();
@@ -353,18 +353,18 @@ bool PNS_DIFF_PAIR_PLACER::rhShoveOnly( const VECTOR2I& aP )
}
-const PNS_ITEMSET PNS_DIFF_PAIR_PLACER::Traces()
+const ITEM_SET DIFF_PAIR_PLACER::Traces()
{
- PNS_ITEMSET t;
+ ITEM_SET t;
- t.Add( const_cast<PNS_LINE*>( &m_currentTrace.PLine() ) );
- t.Add( const_cast<PNS_LINE*>( &m_currentTrace.NLine() ) );
+ t.Add( const_cast<LINE*>( &m_currentTrace.PLine() ) );
+ t.Add( const_cast<LINE*>( &m_currentTrace.NLine() ) );
return t;
}
-void PNS_DIFF_PAIR_PLACER::FlipPosture()
+void DIFF_PAIR_PLACER::FlipPosture()
{
m_startDiagonal = !m_startDiagonal;
@@ -373,7 +373,7 @@ void PNS_DIFF_PAIR_PLACER::FlipPosture()
}
-PNS_NODE* PNS_DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const
+NODE* DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const
{
if( m_lastNode )
return m_lastNode;
@@ -382,7 +382,7 @@ PNS_NODE* PNS_DIFF_PAIR_PLACER::CurrentNode( bool aLoopsRemoved ) const
}
-bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer )
+bool DIFF_PAIR_PLACER::SetLayer( int aLayer )
{
if( m_idle )
{
@@ -392,7 +392,7 @@ bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer )
return false;
else if( !m_prevPair )
return false;
- else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( PNS_ITEM::VIA_T ) &&
+ else if( m_prevPair->PrimP() || ( m_prevPair->PrimP()->OfKind( ITEM::VIA_T ) &&
m_prevPair->PrimP()->Layers().Overlaps( aLayer ) ) )
{
m_currentLayer = aLayer;
@@ -406,7 +406,7 @@ bool PNS_DIFF_PAIR_PLACER::SetLayer( int aLayer )
}
-int PNS_DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
+int DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
@@ -440,20 +440,20 @@ int PNS_DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplemen
}
-OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* aItem )
+OPT_VECTOR2I DIFF_PAIR_PLACER::getDanglingAnchor( NODE* aNode, ITEM* aItem )
{
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA_T:
- case PNS_ITEM::SOLID_T:
+ case ITEM::VIA_T:
+ case ITEM::SOLID_T:
return aItem->Anchor( 0 );
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
{
- PNS_SEGMENT* s =static_cast<PNS_SEGMENT*>( aItem );
+ SEGMENT* s =static_cast<SEGMENT*>( aItem );
- PNS_JOINT* jA = aNode->FindJoint( s->Seg().A, s );
- PNS_JOINT* jB = aNode->FindJoint( s->Seg().B, s );
+ JOINT* jA = aNode->FindJoint( s->Seg().A, s );
+ JOINT* jB = aNode->FindJoint( s->Seg().B, s );
if( jA->LinkCount() == 1 )
return s->Seg().A;
@@ -471,7 +471,7 @@ OPT_VECTOR2I PNS_DIFF_PAIR_PLACER::getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM*
-bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aItem, PNS_DP_PRIMITIVE_PAIR& aPair )
+bool DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, ITEM* aItem, DP_PRIMITIVE_PAIR& aPair )
{
int netP, netN;
@@ -488,20 +488,20 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
wxLogTrace( "PNS", "result %d\n", !!result );
OPT_VECTOR2I refAnchor = getDanglingAnchor( m_currentNode, aItem );
- PNS_ITEM* primRef = aItem;
+ ITEM* primRef = aItem;
wxLogTrace( "PNS", "refAnchor %p\n", aItem );
if( !refAnchor )
return false;
- std::set<PNS_ITEM*> coupledItems;
+ std::set<ITEM*> coupledItems;
m_currentNode->AllItemsInNet( coupledNet, coupledItems );
double bestDist = std::numeric_limits<double>::max();
bool found = false;
- for( PNS_ITEM* item : coupledItems )
+ for( ITEM* item : coupledItems )
{
if( item->Kind() == aItem->Kind() )
{
@@ -513,7 +513,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
bool shapeMatches = true;
- if( item->OfKind( PNS_ITEM::SOLID_T ) && item->Layers() != aItem->Layers() )
+ if( item->OfKind( ITEM::SOLID_T ) && item->Layers() != aItem->Layers() )
{
shapeMatches = false;
}
@@ -525,12 +525,12 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
if( refNet == netP )
{
- aPair = PNS_DP_PRIMITIVE_PAIR ( item, primRef );
+ aPair = DP_PRIMITIVE_PAIR ( item, primRef );
aPair.SetAnchors( *anchor, *refAnchor );
}
else
{
- aPair = PNS_DP_PRIMITIVE_PAIR( primRef, item );
+ aPair = DP_PRIMITIVE_PAIR( primRef, item );
aPair.SetAnchors( *refAnchor, *anchor );
}
}
@@ -541,19 +541,19 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
}
-int PNS_DIFF_PAIR_PLACER::viaGap() const
+int DIFF_PAIR_PLACER::viaGap() const
{
return m_sizes.DiffPairViaGap();
}
-int PNS_DIFF_PAIR_PLACER::gap() const
+int DIFF_PAIR_PLACER::gap() const
{
return m_sizes.DiffPairGap() + m_sizes.DiffPairWidth();
}
-bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
VECTOR2I p( aP );
@@ -611,17 +611,17 @@ bool PNS_DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-void PNS_DIFF_PAIR_PLACER::initPlacement()
+void DIFF_PAIR_PLACER::initPlacement()
{
m_idle = false;
m_orthoMode = false;
m_currentEndItem = NULL;
m_startDiagonal = m_initialDiagonal;
- PNS_NODE* world = Router()->GetWorld();
+ NODE* world = Router()->GetWorld();
world->KillChildren();
- PNS_NODE* rootNode = world->Branch();
+ NODE* rootNode = world->Branch();
setWorld( rootNode );
@@ -636,24 +636,24 @@ void PNS_DIFF_PAIR_PLACER::initPlacement()
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{
- m_shove = new PNS_SHOVE( m_currentNode, Router() );
+ m_shove = new SHOVE( m_currentNode, Router() );
}
}
-bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
+bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
{
m_fitOk = false;
- PNS_DP_GATEWAYS gwsEntry( gap() );
- PNS_DP_GATEWAYS gwsTarget( gap() );
+ DP_GATEWAYS gwsEntry( gap() );
+ DP_GATEWAYS gwsTarget( gap() );
if( !m_prevPair )
m_prevPair = m_start;
gwsEntry.BuildFromPrimitivePair( *m_prevPair, m_startDiagonal );
- PNS_DP_PRIMITIVE_PAIR target;
+ DP_PRIMITIVE_PAIR target;
if( findDpPrimitivePair( aP, m_currentEndItem, target ) )
{
@@ -688,7 +688,7 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
m_snapOnTarget = false;
}
- m_currentTrace = PNS_DIFF_PAIR();
+ m_currentTrace = DIFF_PAIR();
m_currentTrace.SetGap( gap() );
m_currentTrace.SetLayer( m_currentLayer );
@@ -713,7 +713,7 @@ bool PNS_DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP )
}
-bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem )
+bool DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , ITEM* aEndItem )
{
m_currentEndItem = aEndItem;
m_fitOk = false;
@@ -724,7 +724,7 @@ bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem )
if( !route( aP ) )
return false;
- PNS_NODE* latestNode = m_currentNode;
+ NODE* latestNode = m_currentNode;
m_lastNode = latestNode->Branch();
assert( m_lastNode != NULL );
@@ -736,7 +736,7 @@ bool PNS_DIFF_PAIR_PLACER::Move( const VECTOR2I& aP , PNS_ITEM* aEndItem )
}
-void PNS_DIFF_PAIR_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
+void DIFF_PAIR_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes )
{
m_sizes = aSizes;
@@ -748,7 +748,7 @@ void PNS_DIFF_PAIR_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
}
-bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
if( !m_fitOk )
return false;
@@ -760,7 +760,7 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
if( m_currentTrace.CP().SegmentCount() > 1 )
m_initialDiagonal = !DIRECTION_45( m_currentTrace.CP().CSegment( -2 ) ).IsDiagonal();
- PNS_TOPOLOGY topo( m_lastNode );
+ TOPOLOGY topo( m_lastNode );
if( !m_snapOnTarget && !m_currentTrace.EndsWithVias() )
{
@@ -787,8 +787,8 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
m_chainedPlacement = !m_snapOnTarget;
}
- PNS_LINE lineP( m_currentTrace.PLine() );
- PNS_LINE lineN( m_currentTrace.NLine() );
+ LINE lineP( m_currentTrace.PLine() );
+ LINE lineN( m_currentTrace.NLine() );
m_lastNode->Add( &lineP );
m_lastNode->Add( &lineN );
@@ -816,17 +816,17 @@ bool PNS_DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-void PNS_DIFF_PAIR_PLACER::GetModifiedNets( std::vector<int> &aNets ) const
+void DIFF_PAIR_PLACER::GetModifiedNets( std::vector<int> &aNets ) const
{
aNets.push_back( m_netP );
aNets.push_back( m_netN );
}
-void PNS_DIFF_PAIR_PLACER::updateLeadingRatLine()
+void DIFF_PAIR_PLACER::updateLeadingRatLine()
{
SHAPE_LINE_CHAIN ratLineN, ratLineP;
- PNS_TOPOLOGY topo( m_lastNode );
+ TOPOLOGY topo( m_lastNode );
if( topo.LeadingRatLine( &m_currentTrace.PLine(), ratLineP ) )
{
@@ -840,7 +840,7 @@ void PNS_DIFF_PAIR_PLACER::updateLeadingRatLine()
}
-const std::vector<int> PNS_DIFF_PAIR_PLACER::CurrentNets() const
+const std::vector<int> DIFF_PAIR_PLACER::CurrentNets() const
{
std::vector<int> rv;
rv.push_back( m_netP );
diff --git a/pcbnew/router/pns_diff_pair_placer.h b/pcbnew/router/pns_diff_pair_placer.h
index e7a076e..b84a2e1 100644
--- a/pcbnew/router/pns_diff_pair_placer.h
+++ b/pcbnew/router/pns_diff_pair_placer.h
@@ -38,26 +38,25 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
-class PNS_VIA;
-class PNS_SIZES_SETTINGS;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
+class VIA;
+class SIZES_SETTINGS;
/**
- * Class PNS_LINE_PLACER
+ * Class LINE_PLACER
*
* Single track placement algorithm. Interactively routes a track.
* Applies shove and walkaround algorithms when needed.
*/
-class PNS_DIFF_PAIR_PLACER : public PNS_PLACEMENT_ALGO
+class DIFF_PAIR_PLACER : public PLACEMENT_ALGO
{
public:
- PNS_DIFF_PAIR_PLACER( PNS_ROUTER* aRouter );
- ~PNS_DIFF_PAIR_PLACER();
+ DIFF_PAIR_PLACER( ROUTER* aRouter );
+ ~DIFF_PAIR_PLACER();
/**
* Function Start()
@@ -65,7 +64,7 @@ public:
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL).
*/
- bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ bool Start( const VECTOR2I& aP, ITEM* aStartItem );
/**
* Function Move()
@@ -74,7 +73,7 @@ public:
* aEndItem as anchor (if not NULL).
* (unless NULL).
*/
- bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool Move( const VECTOR2I& aP, ITEM* aEndItem );
/**
* Function FixRoute()
@@ -85,7 +84,7 @@ public:
* result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on.
*/
- bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem );
/**
* Function ToggleVia()
@@ -104,9 +103,9 @@ public:
/**
* Function Traces()
*
- * Returns the complete routed line, as a single-member PNS_ITEMSET.
+ * Returns the complete routed line, as a single-member ITEM_SET.
*/
- const PNS_ITEMSET Traces();
+ const ITEM_SET Traces();
/**
* Function CurrentEnd()
@@ -141,7 +140,7 @@ public:
*
* Returns the most recent world state.
*/
- PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
+ NODE* CurrentNode( bool aLoopsRemoved = false ) const;
/**
* Function FlipPosture()
@@ -157,7 +156,7 @@ public:
* a settings class. Used to dynamically change these parameters as
* the track is routed.
*/
- void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
+ void UpdateSizes( const SIZES_SETTINGS& aSizes );
bool IsPlacingVia() const { return m_placingVia; }
@@ -195,7 +194,7 @@ private:
*
* Sets the board to route.
*/
- void setWorld( PNS_NODE* aWorld );
+ void setWorld( NODE* aWorld );
/**
* Function startPlacement()
@@ -214,7 +213,7 @@ private:
bool routeHead( const VECTOR2I& aP );
- bool tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR& aPair, bool aSolidsOnly );
+ bool tryWalkDp( NODE* aNode, DIFF_PAIR& aPair, bool aSolidsOnly );
///> route step, walkaround mode
bool rhWalkOnly( const VECTOR2I& aP );
@@ -225,12 +224,12 @@ private:
///> route step, mark obstacles mode
bool rhMarkObstacles( const VECTOR2I& aP );
- const PNS_VIA makeVia ( const VECTOR2I& aP, int aNet );
+ const VIA makeVia ( const VECTOR2I& aP, int aNet );
- bool findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aItem, PNS_DP_PRIMITIVE_PAIR& aPair );
- OPT_VECTOR2I getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* aItem );
+ bool findDpPrimitivePair( const VECTOR2I& aP, ITEM* aItem, DP_PRIMITIVE_PAIR& aPair );
+ OPT_VECTOR2I getDanglingAnchor( NODE* aNode, ITEM* aItem );
int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
- bool attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly );
+ bool attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent, DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly );
bool propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP );
enum State {
@@ -248,28 +247,28 @@ private:
int m_netP, m_netN;
- PNS_DP_PRIMITIVE_PAIR m_start;
- boost::optional<PNS_DP_PRIMITIVE_PAIR> m_prevPair;
+ DP_PRIMITIVE_PAIR m_start;
+ boost::optional<DP_PRIMITIVE_PAIR> m_prevPair;
///> current algorithm iteration
int m_iteration;
///> pointer to world to search colliding items
- PNS_NODE* m_world;
+ NODE* m_world;
///> current routing start point (end of tail, beginning of head)
VECTOR2I m_p_start;
///> The shove engine
- PNS_SHOVE* m_shove;
+ SHOVE* m_shove;
///> Current world state
- PNS_NODE* m_currentNode;
+ NODE* m_currentNode;
///> Postprocessed world state (including marked collisions & removed loops)
- PNS_NODE* m_lastNode;
+ NODE* m_lastNode;
- PNS_SIZES_SETTINGS m_sizes;
+ SIZES_SETTINGS m_sizes;
///> Are we placing a via?
bool m_placingVia;
@@ -291,9 +290,9 @@ private:
bool m_snapOnTarget;
VECTOR2I m_currentEnd, m_currentStart;
- PNS_DIFF_PAIR m_currentTrace;
+ DIFF_PAIR m_currentTrace;
- PNS_ITEM* m_currentEndItem;
+ ITEM* m_currentEndItem;
PNS_MODE m_currentMode;
bool m_idle;
diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp
index 59ccee9..7604da0 100644
--- a/pcbnew/router/pns_dp_meander_placer.cpp
+++ b/pcbnew/router/pns_dp_meander_placer.cpp
@@ -35,8 +35,8 @@ namespace PNS {
using boost::optional;
-PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
- PNS_MEANDER_PLACER_BASE( aRouter )
+DP_MEANDER_PLACER::DP_MEANDER_PLACER( ROUTER* aRouter ) :
+ MEANDER_PLACER_BASE( aRouter )
{
m_world = NULL;
m_currentNode = NULL;
@@ -48,18 +48,18 @@ PNS_DP_MEANDER_PLACER::PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
}
-PNS_DP_MEANDER_PLACER::~PNS_DP_MEANDER_PLACER()
+DP_MEANDER_PLACER::~DP_MEANDER_PLACER()
{
}
-const PNS_LINE PNS_DP_MEANDER_PLACER::Trace() const
+const LINE DP_MEANDER_PLACER::Trace() const
{
return m_currentTraceP;
}
-PNS_NODE* PNS_DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
+NODE* DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
{
if( !m_currentNode )
return m_world;
@@ -68,17 +68,17 @@ PNS_NODE* PNS_DP_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
}
-bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool DP_MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) );
return false;
}
- m_initialSegment = static_cast<PNS_SEGMENT*>( aStartItem );
+ m_initialSegment = static_cast<SEGMENT*>( aStartItem );
p = m_initialSegment->Seg().NearestPoint( aP );
@@ -87,7 +87,7 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_world = Router()->GetWorld()->Branch();
- PNS_TOPOLOGY topo( m_world );
+ TOPOLOGY topo( m_world );
if( !topo.AssembleDiffPair( m_initialSegment, m_originPair ) )
{
@@ -116,26 +116,26 @@ bool PNS_DP_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-void PNS_DP_MEANDER_PLACER::release()
+void DP_MEANDER_PLACER::release()
{
}
-int PNS_DP_MEANDER_PLACER::origPathLength() const
+int DP_MEANDER_PLACER::origPathLength() const
{
int totalP = 0;
int totalN = 0;
- for( const PNS_ITEM* item : m_tunedPathP.CItems() )
+ for( const ITEM* item : m_tunedPathP.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
totalP += l->CLine().Length();
}
- for( const PNS_ITEM* item : m_tunedPathN.CItems() )
+ for( const ITEM* item : m_tunedPathN.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
totalN += l->CLine().Length();
}
@@ -143,7 +143,7 @@ int PNS_DP_MEANDER_PLACER::origPathLength() const
}
-const SEG PNS_DP_MEANDER_PLACER::baselineSegment( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs )
+const SEG DP_MEANDER_PLACER::baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs )
{
const VECTOR2I a( ( aCoupledSegs.coupledP.A + aCoupledSegs.coupledN.A ) / 2 );
const VECTOR2I b( ( aCoupledSegs.coupledP.B + aCoupledSegs.coupledN.B ) / 2 );
@@ -152,7 +152,7 @@ const SEG PNS_DP_MEANDER_PLACER::baselineSegment( const PNS_DIFF_PAIR::COUPLED_S
}
-static bool pairOrientation( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aPair )
+static bool pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair )
{
VECTOR2I midp = ( aPair.coupledP.A + aPair.coupledN.A ) / 2;
@@ -162,11 +162,11 @@ static bool pairOrientation( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aPair )
}
-bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
{
// return false;
- PNS_DIFF_PAIR::COUPLED_SEGMENTS_VEC coupledSegments;
+ DIFF_PAIR::COUPLED_SEGMENTS_VEC coupledSegments;
if( m_currentNode )
delete m_currentNode;
@@ -179,7 +179,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
cutTunedLine( m_originPair.CP(), m_currentStart, aP, preP, tunedP, postP );
cutTunedLine( m_originPair.CN(), m_currentStart, aP, preN, tunedN, postN );
- PNS_DIFF_PAIR tuned( m_originPair );
+ DIFF_PAIR tuned( m_originPair );
tuned.SetShape( tunedP, tunedN );
@@ -194,7 +194,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
//Router()->DisplayDebugLine( m_originPair.CP(), 5, 20000 );
//Router()->DisplayDebugLine( m_originPair.CN(), 4, 20000 );
- m_result = PNS_MEANDERED_LINE( this, true );
+ m_result = MEANDERED_LINE( this, true );
m_result.SetWidth( tuned.Width() );
int offset = ( tuned.Gap() + tuned.Width() ) / 2;
@@ -204,21 +204,21 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
m_result.SetBaselineOffset( offset );
- for( const PNS_ITEM* item : m_tunedPathP.CItems() )
+ for( const ITEM* item : m_tunedPathP.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
Dbg()->AddLine( l->CLine(), 5, 10000 );
}
- for( const PNS_ITEM* item : m_tunedPathN.CItems() )
+ for( const ITEM* item : m_tunedPathN.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
Dbg()->AddLine( l->CLine(), 5, 10000 );
}
int curIndexP = 0, curIndexN = 0;
- for( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments )
+ for( const DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments )
{
SEG base = baselineSegment( sp );
@@ -265,7 +265,7 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
tunedP.Clear();
tunedN.Clear();
- for( PNS_MEANDER_SHAPE* m : m_result.Meanders() )
+ for( MEANDER_SHAPE* m : m_result.Meanders() )
{
if( m->Type() != MT_EMPTY )
{
@@ -302,10 +302,10 @@ bool PNS_DP_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-bool PNS_DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
- PNS_LINE lP( m_originPair.PLine(), m_finalShapeP );
- PNS_LINE lN( m_originPair.NLine(), m_finalShapeN );
+ LINE lP( m_originPair.PLine(), m_finalShapeP );
+ LINE lN( m_originPair.NLine(), m_finalShapeN );
m_currentNode->Add( &lP );
m_currentNode->Add( &lN );
@@ -316,10 +316,10 @@ bool PNS_DP_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-bool PNS_DP_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape )
+bool DP_MEANDER_PLACER::CheckFit( MEANDER_SHAPE* aShape )
{
- PNS_LINE l1( m_originPair.PLine(), aShape->CLine( 0 ) );
- PNS_LINE l2( m_originPair.NLine(), aShape->CLine( 1 ) );
+ LINE l1( m_originPair.PLine(), aShape->CLine( 0 ) );
+ LINE l2( m_originPair.NLine(), aShape->CLine( 1 ) );
if( m_currentNode->CheckColliding( &l1 ) )
return false;
@@ -334,12 +334,12 @@ bool PNS_DP_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape )
}
-const PNS_ITEMSET PNS_DP_MEANDER_PLACER::Traces()
+const ITEM_SET DP_MEANDER_PLACER::Traces()
{
- m_currentTraceP = PNS_LINE( m_originPair.PLine(), m_finalShapeP );
- m_currentTraceN = PNS_LINE( m_originPair.NLine(), m_finalShapeN );
+ m_currentTraceP = LINE( m_originPair.PLine(), m_finalShapeP );
+ m_currentTraceN = LINE( m_originPair.NLine(), m_finalShapeN );
- PNS_ITEMSET traces;
+ ITEM_SET traces;
traces.Add( &m_currentTraceP );
traces.Add( &m_currentTraceN );
@@ -348,19 +348,19 @@ const PNS_ITEMSET PNS_DP_MEANDER_PLACER::Traces()
}
-const VECTOR2I& PNS_DP_MEANDER_PLACER::CurrentEnd() const
+const VECTOR2I& DP_MEANDER_PLACER::CurrentEnd() const
{
return m_currentEnd;
}
-int PNS_DP_MEANDER_PLACER::CurrentLayer() const
+int DP_MEANDER_PLACER::CurrentLayer() const
{
return m_initialSegment->Layers().Start();
}
-const wxString PNS_DP_MEANDER_PLACER::TuningInfo() const
+const wxString DP_MEANDER_PLACER::TuningInfo() const
{
wxString status;
@@ -390,12 +390,12 @@ const wxString PNS_DP_MEANDER_PLACER::TuningInfo() const
}
-PNS_DP_MEANDER_PLACER::TUNING_STATUS PNS_DP_MEANDER_PLACER::TuningStatus() const
+DP_MEANDER_PLACER::TUNING_STATUS DP_MEANDER_PLACER::TuningStatus() const
{
return m_lastStatus;
}
-const std::vector<int> PNS_DP_MEANDER_PLACER::CurrentNets() const
+const std::vector<int> DP_MEANDER_PLACER::CurrentNets() const
{
std::vector<int> rv;
rv.push_back( m_originPair.NetP() );
diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h
index 240d3de..dc21f7b 100644
--- a/pcbnew/router/pns_dp_meander_placer.h
+++ b/pcbnew/router/pns_dp_meander_placer.h
@@ -38,19 +38,19 @@
namespace PNS {
-class PNS_ROUTER;
+class ROUTER;
/**
- * Class PNS_DP_MEANDER_PLACER
+ * Class DP_MEANDER_PLACER
*
* Differential Pair length-matching/meandering tool.
*/
-class PNS_DP_MEANDER_PLACER : public PNS_MEANDER_PLACER_BASE
+class DP_MEANDER_PLACER : public MEANDER_PLACER_BASE
{
public:
- PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter );
- ~PNS_DP_MEANDER_PLACER();
+ DP_MEANDER_PLACER( ROUTER* aRouter );
+ ~DP_MEANDER_PLACER();
/**
* Function Start()
@@ -58,7 +58,7 @@ public:
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL).
*/
- bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ bool Start( const VECTOR2I& aP, ITEM* aStartItem );
/**
* Function Move()
@@ -67,7 +67,7 @@ public:
* aEndItem as anchor (if not NULL).
* (unless NULL).
*/
- bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool Move( const VECTOR2I& aP, ITEM* aEndItem );
/**
* Function FixRoute()
@@ -78,22 +78,22 @@ public:
* result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on.
*/
- bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem );
- const PNS_LINE Trace() const;
+ const LINE Trace() const;
/**
* Function CurrentNode()
*
* Returns the most recent world state.
*/
- PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
+ NODE* CurrentNode( bool aLoopsRemoved = false ) const;
- const PNS_ITEMSET Traces();
+ const ITEM_SET Traces();
const VECTOR2I& CurrentEnd() const;
- /// @copydoc PNS_PLACEMENT_ALGO::CurrentNets()
+ /// @copydoc PLACEMENT_ALGO::CurrentNets()
const std::vector<int> CurrentNets() const;
int CurrentLayer() const;
@@ -103,42 +103,42 @@ public:
const wxString TuningInfo() const;
TUNING_STATUS TuningStatus() const;
- bool CheckFit( PNS_MEANDER_SHAPE* aShape );
+ bool CheckFit( MEANDER_SHAPE* aShape );
private:
- friend class PNS_MEANDER_SHAPE;
+ friend class MEANDER_SHAPE;
void meanderSegment( const SEG& aBase );
// void addMeander ( PNS_MEANDER *aM );
// void addCorner ( const VECTOR2I& aP );
- const SEG baselineSegment( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs );
+ const SEG baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs );
- void setWorld( PNS_NODE* aWorld );
+ void setWorld( NODE* aWorld );
void release();
int origPathLength() const;
///> pointer to world to search colliding items
- PNS_NODE* m_world;
+ NODE* m_world;
///> current routing start point (end of tail, beginning of head)
VECTOR2I m_currentStart;
///> Current world state
- PNS_NODE* m_currentNode;
+ NODE* m_currentNode;
- PNS_DIFF_PAIR m_originPair;
- PNS_DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments;
+ DIFF_PAIR m_originPair;
+ DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments;
- PNS_LINE m_currentTraceN, m_currentTraceP;
- PNS_ITEMSET m_tunedPath, m_tunedPathP, m_tunedPathN;
+ LINE m_currentTraceN, m_currentTraceP;
+ ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN;
SHAPE_LINE_CHAIN m_finalShapeP, m_finalShapeN;
- PNS_MEANDERED_LINE m_result;
- PNS_SEGMENT* m_initialSegment;
+ MEANDERED_LINE m_result;
+ SEGMENT* m_initialSegment;
int m_lastLength;
TUNING_STATUS m_lastStatus;
diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp
index 5786c5d..ddf8725 100644
--- a/pcbnew/router/pns_dragger.cpp
+++ b/pcbnew/router/pns_dragger.cpp
@@ -25,12 +25,12 @@
namespace PNS {
-PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
- PNS_ALGO_BASE( aRouter )
+DRAGGER::DRAGGER( ROUTER* aRouter ) :
+ ALGO_BASE( aRouter )
{
m_world = NULL;
m_lastNode = NULL;
- m_mode = SEGMENT;
+ m_mode = DRAG_SEGMENT;
m_draggedVia = NULL;
m_shove = NULL;
m_draggedSegmentIndex = 0;
@@ -40,20 +40,20 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
}
-PNS_DRAGGER::~PNS_DRAGGER()
+DRAGGER::~DRAGGER()
{
if( m_shove )
delete m_shove;
}
-void PNS_DRAGGER::SetWorld( PNS_NODE* aWorld )
+void DRAGGER::SetWorld( NODE* aWorld )
{
m_world = aWorld;
}
-bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
+bool DRAGGER::startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg )
{
int w2 = aSeg->Width() / 2;
@@ -63,37 +63,37 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
m_lastValidDraggedLine.ClearSegmentLinks();
if( ( aP - aSeg->Seg().A ).EuclideanNorm() <= w2 )
- m_mode = CORNER;
+ m_mode = DRAG_CORNER;
else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 )
{
m_draggedSegmentIndex++;
- m_mode = CORNER;
+ m_mode = DRAG_CORNER;
} else
- m_mode = SEGMENT;
+ m_mode = DRAG_SEGMENT;
return true;
}
-bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
+bool DRAGGER::startDragVia( const VECTOR2D& aP, VIA* aVia )
{
m_draggedVia = aVia;
m_initialVia = aVia;
- m_mode = VIA;
+ m_mode = DRAG_VIA;
VECTOR2I p0( aVia->Pos() );
- PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
+ JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
if( !jt )
return false;
- for( PNS_ITEM* item : jt->LinkList() )
+ for( ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( item->OfKind( ITEM::SEGMENT_T ) )
{
int segIndex;
- PNS_SEGMENT* seg = ( PNS_SEGMENT*) item;
- PNS_LINE l = m_world->AssembleLine( seg, &segIndex );
+ SEGMENT* seg = ( SEGMENT*) item;
+ LINE l = m_world->AssembleLine( seg, &segIndex );
if( segIndex != 0 )
l.Reverse();
@@ -106,9 +106,9 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
}
-bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool DRAGGER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
- m_shove = new PNS_SHOVE( m_world, Router() );
+ m_shove = new SHOVE( m_world, Router() );
m_lastNode = NULL;
m_draggedItems.Clear();
m_currentMode = Settings().Mode();
@@ -119,11 +119,11 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
switch( aStartItem->Kind() )
{
- case PNS_ITEM::SEGMENT_T:
- return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
+ case ITEM::SEGMENT_T:
+ return startDragSegment( aP, static_cast<SEGMENT*>( aStartItem ) );
- case PNS_ITEM::VIA_T:
- return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
+ case ITEM::VIA_T:
+ return startDragVia( aP, static_cast<VIA*>( aStartItem ) );
default:
return false;
@@ -131,7 +131,7 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
+bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
{
if( m_lastNode )
{
@@ -141,13 +141,13 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
switch( m_mode )
{
- case SEGMENT:
- case CORNER:
+ case DRAG_SEGMENT:
+ case DRAG_CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
- PNS_LINE dragged( m_draggedLine );
+ LINE dragged( m_draggedLine );
- if( m_mode == SEGMENT )
+ if( m_mode == DRAG_SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
@@ -165,7 +165,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
break;
}
- case VIA: // fixme...
+ case DRAG_VIA: // fixme...
{
m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia( m_initialVia, m_lastNode, aP );
@@ -183,7 +183,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
}
-void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP )
+void DRAGGER::dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP )
{
m_draggedItems.Clear();
@@ -196,12 +196,12 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
m_lastNode->Remove( aVia );
m_lastNode->Add( m_draggedVia );
- for( PNS_ITEM* item : m_origViaConnections.Items() )
+ for( ITEM* item : m_origViaConnections.Items() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
- PNS_LINE origLine( *l );
- PNS_LINE draggedLine( *l );
+ LINE origLine( *l );
+ LINE draggedLine( *l );
draggedLine.DragCorner( aP, origLine.CLine().Find( aVia->Pos() ) );
draggedLine.ClearSegmentLinks();
@@ -215,7 +215,7 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
}
-bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
+bool DRAGGER::dragShove( const VECTOR2I& aP )
{
bool ok = false;
@@ -227,22 +227,22 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
switch( m_mode )
{
- case SEGMENT:
- case CORNER:
+ case DRAG_SEGMENT:
+ case DRAG_CORNER:
{
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
- PNS_LINE dragged( m_draggedLine );
+ LINE dragged( m_draggedLine );
- if( m_mode == SEGMENT )
+ if( m_mode == DRAG_SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );
else
dragged.DragCorner( aP, m_draggedSegmentIndex, thresh );
- PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );
+ SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( dragged );
- if( st == PNS_SHOVE::SH_OK )
+ if( st == SHOVE::SH_OK )
ok = true;
- else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
+ else if( st == SHOVE::SH_HEAD_MODIFIED )
{
dragged = m_shove->NewHead();
ok = true;
@@ -262,12 +262,12 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
break;
}
- case VIA:
+ case DRAG_VIA:
{
- PNS_VIA* newVia;
- PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
+ VIA* newVia;
+ SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
- if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
+ if( st == SHOVE::SH_OK || st == SHOVE::SH_HEAD_MODIFIED )
ok = true;
m_lastNode = m_shove->CurrentNode()->Branch();
@@ -289,7 +289,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
}
-bool PNS_DRAGGER::FixRoute()
+bool DRAGGER::FixRoute()
{
if( m_dragStatus )
{
@@ -301,7 +301,7 @@ bool PNS_DRAGGER::FixRoute()
}
-bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
+bool DRAGGER::Drag( const VECTOR2I& aP )
{
switch( m_currentMode )
{
@@ -319,19 +319,19 @@ bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
}
-PNS_NODE* PNS_DRAGGER::CurrentNode() const
+NODE* DRAGGER::CurrentNode() const
{
return m_lastNode;
}
-const PNS_ITEMSET PNS_DRAGGER::Traces()
+const ITEM_SET DRAGGER::Traces()
{
return m_draggedItems;
}
-PNS_LOGGER* PNS_DRAGGER::Logger()
+LOGGER* DRAGGER::Logger()
{
if( m_shove )
return m_shove->Logger();
diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h
index d4c727a..8c87837 100644
--- a/pcbnew/router/pns_dragger.h
+++ b/pcbnew/router/pns_dragger.h
@@ -32,28 +32,27 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
/**
- * Class PNS_DRAGGER
+ * Class DRAGGER
*
* Via, segment and corner dragging algorithm.
*/
-class PNS_DRAGGER : public PNS_ALGO_BASE
+class DRAGGER : public ALGO_BASE
{
public:
- PNS_DRAGGER( PNS_ROUTER* aRouter );
- ~PNS_DRAGGER();
+ DRAGGER( ROUTER* aRouter );
+ ~DRAGGER();
/**
* Function SetWorld()
*
* Sets the board to work on.
*/
- void SetWorld( PNS_NODE* aWorld );
+ void SetWorld( NODE* aWorld );
/**
* Function Start()
@@ -61,7 +60,7 @@ public:
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL). Returns true if a dragging operation has started.
*/
- bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ bool Start( const VECTOR2I& aP, ITEM* aStartItem );
/**
* Function Drag()
@@ -86,44 +85,44 @@ public:
* Returns the most recent world state, including all
* items changed due to dragging operation.
*/
- PNS_NODE* CurrentNode() const;
+ NODE* CurrentNode() const;
/**
* Function Traces()
*
* Returns the set of dragged items.
*/
- const PNS_ITEMSET Traces();
+ const ITEM_SET Traces();
- /// @copydoc PNS_ALGO_BASE::Logger()
- virtual PNS_LOGGER* Logger();
+ /// @copydoc ALGO_BASE::Logger()
+ virtual LOGGER* Logger();
private:
enum DragMode {
- CORNER = 0,
- SEGMENT,
- VIA
+ DRAG_CORNER = 0,
+ DRAG_SEGMENT,
+ DRAG_VIA
};
bool dragMarkObstacles( const VECTOR2I& aP );
bool dragShove(const VECTOR2I& aP );
- bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg );
- bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia );
- void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP );
-
- PNS_NODE* m_world;
- PNS_NODE* m_lastNode;
- DragMode m_mode;
- PNS_LINE m_draggedLine;
- PNS_VIA* m_draggedVia;
- PNS_LINE m_lastValidDraggedLine;
- PNS_SHOVE* m_shove;
- int m_draggedSegmentIndex;
- bool m_dragStatus;
- PNS_MODE m_currentMode;
- PNS_ITEMSET m_origViaConnections;
- PNS_VIA* m_initialVia;
- PNS_ITEMSET m_draggedItems;
+ bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg );
+ bool startDragVia( const VECTOR2D& aP, VIA* aVia );
+ void dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP );
+
+ NODE* m_world;
+ NODE* m_lastNode;
+ DragMode m_mode;
+ LINE m_draggedLine;
+ VIA* m_draggedVia;
+ LINE m_lastValidDraggedLine;
+ SHOVE* m_shove;
+ int m_draggedSegmentIndex;
+ bool m_dragStatus;
+ PNS_MODE m_currentMode;
+ ITEM_SET m_origViaConnections;
+ VIA* m_initialVia;
+ ITEM_SET m_draggedItems;
};
}
diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h
index 75636cf..a948865 100644
--- a/pcbnew/router/pns_index.h
+++ b/pcbnew/router/pns_index.h
@@ -36,42 +36,42 @@ namespace PNS {
/**
- * Class PNS_INDEX
+ * Class INDEX
*
* Custom spatial index, holding our board items and allowing for very fast searches. Items
* are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing
* overlap and improving search time.
**/
-class PNS_INDEX
+class INDEX
{
public:
- typedef std::list<PNS_ITEM*> NET_ITEMS_LIST;
- typedef SHAPE_INDEX<PNS_ITEM*> ITEM_SHAPE_INDEX;
- typedef boost::unordered_set<PNS_ITEM*> ITEM_SET;
+ typedef std::list<ITEM*> NET_ITEMS_LIST;
+ typedef SHAPE_INDEX<ITEM*> ITEM_SHAPE_INDEX;
+ typedef boost::unordered_set<ITEM*> ITEM_SET;
- PNS_INDEX();
- ~PNS_INDEX();
+ INDEX();
+ ~INDEX();
/**
* Function Add()
*
* Adds item to the spatial index.
*/
- void Add( PNS_ITEM* aItem );
+ void Add( ITEM* aItem );
/**
* Function Remove()
*
* Removes an item from the spatial index.
*/
- void Remove( PNS_ITEM* aItem );
+ void Remove( ITEM* aItem );
/**
* Function Add()
*
* Replaces one item with another.
*/
- void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem );
+ void Replace( ITEM* aOldItem, ITEM* aNewItem );
/**
* Function Query()
@@ -87,7 +87,7 @@ public:
* @return number of items found.
*/
template<class Visitor>
- int Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor );
+ int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor );
/**
* Function Query()
@@ -124,7 +124,7 @@ public:
*
* Returns true if item aItem exists in the index.
*/
- bool Contains( PNS_ITEM* aItem ) const
+ bool Contains( ITEM* aItem ) const
{
return m_allItems.find( aItem ) != m_allItems.end();
}
@@ -151,31 +151,31 @@ private:
template <class Visitor>
int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
- ITEM_SHAPE_INDEX* getSubindex( const PNS_ITEM* aItem );
+ ITEM_SHAPE_INDEX* getSubindex( const ITEM* aItem );
ITEM_SHAPE_INDEX* m_subIndices[MaxSubIndices];
std::map<int, NET_ITEMS_LIST> m_netMap;
ITEM_SET m_allItems;
};
-PNS_INDEX::PNS_INDEX()
+INDEX::INDEX()
{
memset( m_subIndices, 0, sizeof( m_subIndices ) );
}
-PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
+INDEX::ITEM_SHAPE_INDEX* INDEX::getSubindex( const ITEM* aItem )
{
int idx_n = -1;
- const PNS_LAYERSET l = aItem->Layers();
+ const LAYER_RANGE l = aItem->Layers();
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA_T:
+ case ITEM::VIA_T:
idx_n = SI_Multilayer;
break;
- case PNS_ITEM::SOLID_T:
+ case ITEM::SOLID_T:
{
if( l.IsMultilayer() )
idx_n = SI_Multilayer;
@@ -186,8 +186,8 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
}
break;
- case PNS_ITEM::SEGMENT_T:
- case PNS_ITEM::LINE_T:
+ case ITEM::SEGMENT_T:
+ case ITEM::LINE_T:
idx_n = SI_Traces + 2 * l.Start() + SI_SegStraight;
break;
@@ -203,7 +203,7 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
return m_subIndices[idx_n];
}
-void PNS_INDEX::Add( PNS_ITEM* aItem )
+void INDEX::Add( ITEM* aItem )
{
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
@@ -217,7 +217,7 @@ void PNS_INDEX::Add( PNS_ITEM* aItem )
}
}
-void PNS_INDEX::Remove( PNS_ITEM* aItem )
+void INDEX::Remove( ITEM* aItem )
{
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
@@ -230,14 +230,14 @@ void PNS_INDEX::Remove( PNS_ITEM* aItem )
m_netMap[net].remove( aItem );
}
-void PNS_INDEX::Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem )
+void INDEX::Replace( ITEM* aOldItem, ITEM* aNewItem )
{
Remove( aOldItem );
Add( aNewItem );
}
template<class Visitor>
-int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
+int INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
{
if( !m_subIndices[index] )
return 0;
@@ -246,14 +246,14 @@ int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Vi
}
template<class Visitor>
-int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor )
+int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor )
{
const SHAPE* shape = aItem->Shape();
int total = 0;
total += querySingle( SI_Multilayer, shape, aMinDistance, aVisitor );
- const PNS_LAYERSET layers = aItem->Layers();
+ const LAYER_RANGE layers = aItem->Layers();
if( layers.IsMultilayer() )
{
@@ -279,7 +279,7 @@ int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor
}
template<class Visitor>
-int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
+int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
{
int total = 0;
@@ -289,7 +289,7 @@ int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
return total;
}
-void PNS_INDEX::Clear()
+void INDEX::Clear()
{
for( int i = 0; i < MaxSubIndices; ++i )
{
@@ -302,12 +302,12 @@ void PNS_INDEX::Clear()
}
}
-PNS_INDEX::~PNS_INDEX()
+INDEX::~INDEX()
{
Clear();
}
-PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet )
+INDEX::NET_ITEMS_LIST* INDEX::GetItemsForNet( int aNet )
{
if( m_netMap.find( aNet ) == m_netMap.end() )
return NULL;
diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp
index b060d31..da78611 100644
--- a/pcbnew/router/pns_item.cpp
+++ b/pcbnew/router/pns_item.cpp
@@ -24,7 +24,7 @@
namespace PNS {
-bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
+bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV, bool aDifferentNetsOnly ) const
{
// same nets? no collision!
@@ -41,7 +41,7 @@ bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeed
}
-bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
+bool ITEM::Collide( const ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV, bool aDifferentNetsOnly ) const
{
if( collideSimple( aOther, aClearance, aNeedMTV, aMTV, aDifferentNetsOnly ) )
@@ -50,7 +50,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
// special case for "head" line with a via attached at the end.
if( aOther->m_kind == LINE_T )
{
- const PNS_LINE* line = static_cast<const PNS_LINE*>( aOther );
+ const LINE* line = static_cast<const LINE*>( aOther );
if( line->EndsWithVia() )
return collideSimple( &line->Via(), aClearance - line->Width() / 2, aNeedMTV, aMTV, aDifferentNetsOnly );
@@ -60,7 +60,7 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
}
-const std::string PNS_ITEM::KindStr() const
+const std::string ITEM::KindStr() const
{
switch( m_kind )
{
@@ -85,7 +85,7 @@ const std::string PNS_ITEM::KindStr() const
}
-PNS_ITEM::~PNS_ITEM()
+ITEM::~ITEM()
{
}
diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h
index 6e4aa0a..b046311 100644
--- a/pcbnew/router/pns_item.h
+++ b/pcbnew/router/pns_item.h
@@ -33,7 +33,7 @@ class BOARD_CONNECTED_ITEM;
namespace PNS {
-class PNS_NODE;
+class NODE;
enum LineMarker {
MK_HEAD = ( 1 << 0 ),
@@ -44,12 +44,12 @@ enum LineMarker {
/**
- * Class PNS_ITEM
+ * Class ITEM
*
* Base class for PNS router board items. Implements the shared properties of all PCB items -
* net, spanned layers, geometric shape & refererence to owning model.
*/
-class PNS_ITEM
+class ITEM
{
public:
static const int UnusedNet = INT_MAX;
@@ -66,7 +66,7 @@ public:
ANY_T = 0xff
};
- PNS_ITEM( PnsKind aKind )
+ ITEM( PnsKind aKind )
{
m_net = UnusedNet;
m_movable = true;
@@ -77,7 +77,7 @@ public:
m_rank = -1;
}
- PNS_ITEM( const PNS_ITEM& aOther )
+ ITEM( const ITEM& aOther )
{
m_layers = aOther.m_layers;
m_net = aOther.m_net;
@@ -89,14 +89,14 @@ public:
m_rank = aOther.m_rank;
}
- virtual ~PNS_ITEM();
+ virtual ~ITEM();
/**
* Function Clone()
*
* Returns a deep copy of the item
*/
- virtual PNS_ITEM* Clone() const = 0;
+ virtual ITEM* Clone() const = 0;
/*
* Function Hull()
@@ -183,7 +183,7 @@ public:
*
* Sets the layers spanned by the item to aLayers.
*/
- void SetLayers( const PNS_LAYERSET& aLayers )
+ void SetLayers( const LAYER_RANGE& aLayers )
{
m_layers = aLayers;
}
@@ -195,7 +195,7 @@ public:
*/
void SetLayer( int aLayer )
{
- m_layers = PNS_LAYERSET( aLayer, aLayer );
+ m_layers = LAYER_RANGE( aLayer, aLayer );
}
/**
@@ -203,7 +203,7 @@ public:
*
* Returns the contiguous set of layers spanned by the item.
*/
- const PNS_LAYERSET& Layers() const
+ const LAYER_RANGE& Layers() const
{
return m_layers;
}
@@ -224,7 +224,7 @@ public:
* Returns true if the set of layers spanned by aOther overlaps our
* layers.
*/
- bool LayersOverlap( const PNS_ITEM* aOther ) const
+ bool LayersOverlap( const ITEM* aOther ) const
{
return Layers().Overlaps( aOther->Layers() );
}
@@ -233,9 +233,9 @@ public:
* Functon SetOwner()
*
* Sets the node that owns this item. An item can belong to a single
- * PNS_NODE or stay unowned.
+ * NODE or stay unowned.
*/
- void SetOwner( PNS_NODE* aOwner )
+ void SetOwner( NODE* aOwner )
{
m_owner = aOwner;
}
@@ -245,7 +245,7 @@ public:
*
* @return true if the item is owned by the node aNode.
*/
- bool BelongsTo( PNS_NODE* aNode ) const
+ bool BelongsTo( NODE* aNode ) const
{
return m_owner == aNode;
}
@@ -255,7 +255,7 @@ public:
*
* Returns the owner of this item, or NULL if there's none.
*/
- PNS_NODE* Owner() const { return m_owner; }
+ NODE* Owner() const { return m_owner; }
/**
* Function Collide()
@@ -271,15 +271,15 @@ public:
* @param aMTV the minimum translation vector
* @return true, if a collision was found.
*/
- virtual bool Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
+ virtual bool Collide( const ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV, bool aDifferentNetsOnly = true ) const;
/**
* Function Collide()
*
- * A shortcut for PNS_ITEM::Colllide() without MTV stuff.
+ * A shortcut for ITEM::Colllide() without MTV stuff.
*/
- bool Collide( const PNS_ITEM* aOther, int aClearance, bool aDifferentNetsOnly = true ) const
+ bool Collide( const ITEM* aOther, int aClearance, bool aDifferentNetsOnly = true ) const
{
VECTOR2I dummy;
@@ -338,15 +338,15 @@ public:
}
private:
- bool collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
+ bool collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV,
VECTOR2I& aMTV, bool aDifferentNetsOnly ) const;
protected:
PnsKind m_kind;
BOARD_CONNECTED_ITEM* m_parent;
- PNS_NODE* m_owner;
- PNS_LAYERSET m_layers;
+ NODE* m_owner;
+ LAYER_RANGE m_layers;
bool m_movable;
int m_net;
diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp
index 32f19c5..139ae5f 100644
--- a/pcbnew/router/pns_itemset.cpp
+++ b/pcbnew/router/pns_itemset.cpp
@@ -24,34 +24,34 @@
namespace PNS {
-PNS_ITEMSET::~PNS_ITEMSET()
+ITEM_SET::~ITEM_SET()
{
}
-void PNS_ITEMSET::Add( const PNS_LINE& aLine )
+void ITEM_SET::Add( const LINE& aLine )
{
- PNS_LINE* copy = aLine.Clone();
+ LINE* copy = aLine.Clone();
m_items.push_back( ENTRY( copy, true ) );
}
-void PNS_ITEMSET::Prepend( const PNS_LINE& aLine )
+void ITEM_SET::Prepend( const LINE& aLine )
{
- PNS_LINE* copy = aLine.Clone();
+ LINE* copy = aLine.Clone();
m_items.insert( m_items.begin(), ENTRY( copy, true ) );
}
-PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
+ITEM_SET& ITEM_SET::FilterLayers( int aStart, int aEnd, bool aInvert )
{
ENTRIES newItems;
- PNS_LAYERSET l;
+ LAYER_RANGE l;
if( aEnd < 0 )
- l = PNS_LAYERSET( aStart );
+ l = LAYER_RANGE( aStart );
else
- l = PNS_LAYERSET( aStart, aEnd );
+ l = LAYER_RANGE( aStart, aEnd );
for( const ENTRY& ent : m_items )
{
@@ -67,7 +67,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
}
-PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
+ITEM_SET& ITEM_SET::FilterKinds( int aKindMask, bool aInvert )
{
ENTRIES newItems;
@@ -85,7 +85,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
}
-PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert )
+ITEM_SET& ITEM_SET::FilterMarker( int aMarker, bool aInvert )
{
ENTRIES newItems;
@@ -103,7 +103,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert )
}
-PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
+ITEM_SET& ITEM_SET::FilterNet( int aNet, bool aInvert )
{
ENTRIES newItems;
@@ -121,7 +121,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
}
-PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
+ITEM_SET& ITEM_SET::ExcludeItem( const ITEM* aItem )
{
ENTRIES newItems;
diff --git a/pcbnew/router/pns_itemset.h b/pcbnew/router/pns_itemset.h
index 59e02a5..d55a180 100644
--- a/pcbnew/router/pns_itemset.h
+++ b/pcbnew/router/pns_itemset.h
@@ -29,19 +29,19 @@
namespace PNS {
/**
- * Class PNS_ITEMSET
+ * Class ITEM_SET
*
* Holds a list of board items, that can be filtered against net, kinds,
* layers, etc.
**/
-class PNS_LINE;
+class LINE;
-class PNS_ITEMSET
+class ITEM_SET
{
public:
struct ENTRY {
- ENTRY( PNS_ITEM* aItem, bool aOwned = false ) :
+ ENTRY( ITEM* aItem, bool aOwned = false ) :
item( aItem ),
owned( aOwned )
{}
@@ -84,18 +84,18 @@ public:
return *this;
}
- operator PNS_ITEM* () const
+ operator ITEM* () const
{
return item;
}
- PNS_ITEM *item;
+ ITEM *item;
bool owned;
};
typedef std::vector<ENTRY> ENTRIES;
- PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL, bool aBecomeOwner = false )
+ ITEM_SET( ITEM* aInitialItem = NULL, bool aBecomeOwner = false )
{
if( aInitialItem )
{
@@ -103,14 +103,14 @@ public:
}
}
- PNS_ITEMSET( const PNS_ITEMSET& aOther )
+ ITEM_SET( const ITEM_SET& aOther )
{
m_items = aOther.m_items;
}
- ~PNS_ITEMSET();
+ ~ITEM_SET();
- const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
+ const ITEM_SET& operator=( const ITEM_SET& aOther )
{
m_items = aOther.m_items;
return *this;
@@ -120,7 +120,7 @@ public:
{
int n = 0;
- for( PNS_ITEM* item : m_items )
+ for( ITEM* item : m_items )
{
if( item->Kind() & aKindMask )
n++;
@@ -137,47 +137,47 @@ public:
ENTRIES& Items() { return m_items; }
const ENTRIES& CItems() const { return m_items; }
- PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false );
- PNS_ITEMSET& FilterKinds( int aKindMask, bool aInvert = false );
- PNS_ITEMSET& FilterNet( int aNet, bool aInvert = false );
- PNS_ITEMSET& FilterMarker( int aMarker, bool aInvert = false );
+ ITEM_SET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false );
+ ITEM_SET& FilterKinds( int aKindMask, bool aInvert = false );
+ ITEM_SET& FilterNet( int aNet, bool aInvert = false );
+ ITEM_SET& FilterMarker( int aMarker, bool aInvert = false );
- PNS_ITEMSET& ExcludeLayers( int aStart, int aEnd = -1 )
+ ITEM_SET& ExcludeLayers( int aStart, int aEnd = -1 )
{
return FilterLayers( aStart, aEnd, true );
}
- PNS_ITEMSET& ExcludeKinds( int aKindMask )
+ ITEM_SET& ExcludeKinds( int aKindMask )
{
return FilterKinds( aKindMask, true );
}
- PNS_ITEMSET& ExcludeNet( int aNet )
+ ITEM_SET& ExcludeNet( int aNet )
{
return FilterNet( aNet, true );
}
- PNS_ITEMSET& ExcludeItem( const PNS_ITEM* aItem );
+ ITEM_SET& ExcludeItem( const ITEM* aItem );
int Size() const
{
return m_items.size();
}
- void Add( const PNS_LINE& aLine );
- void Prepend( const PNS_LINE& aLine );
+ void Add( const LINE& aLine );
+ void Prepend( const LINE& aLine );
- PNS_ITEM* operator[] ( int index ) const
+ ITEM* operator[] ( int index ) const
{
return m_items[index].item;
}
- void Add( PNS_ITEM* aItem, bool aBecomeOwner = false )
+ void Add( ITEM* aItem, bool aBecomeOwner = false )
{
m_items.push_back( ENTRY( aItem, aBecomeOwner ) );
}
- void Prepend( PNS_ITEM* aItem, bool aBecomeOwner = false )
+ void Prepend( ITEM* aItem, bool aBecomeOwner = false )
{
m_items.insert( m_items.begin(), ENTRY( aItem, aBecomeOwner ) );
}
@@ -187,13 +187,13 @@ public:
m_items.clear();
}
- bool Contains( PNS_ITEM* aItem ) const
+ bool Contains( ITEM* aItem ) const
{
const ENTRY ent( aItem );
return std::find( m_items.begin(), m_items.end(), ent ) != m_items.end();
}
- void Erase( PNS_ITEM* aItem )
+ void Erase( ITEM* aItem )
{
ENTRY ent( aItem );
ENTRIES::iterator f = std::find( m_items.begin(), m_items.end(), ent );
@@ -203,11 +203,11 @@ public:
}
template<class T>
- T* FindByKind( PNS_ITEM::PnsKind kind, int index = 0 )
+ T* FindByKind( ITEM::PnsKind kind, int index = 0 )
{
int n = 0;
- for( const PNS_ITEM* item : m_items )
+ for( const ITEM* item : m_items )
{
if( item->OfKind( kind ) )
{
diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h
index cf41eef..1927ffd 100644
--- a/pcbnew/router/pns_joint.h
+++ b/pcbnew/router/pns_joint.h
@@ -34,17 +34,17 @@
namespace PNS {
/**
- * Class PNS_JOINT
+ * Class JOINT
*
* Represents a 2D point on a given set of layers and belonging to a certain
* net, that links together a number of board items.
* A hash table of joints is used by the router to follow connectivity between
* the items.
**/
-class PNS_JOINT : public PNS_ITEM
+class JOINT : public ITEM
{
public:
- typedef PNS_ITEMSET::ENTRIES LINKED_ITEMS;
+ typedef ITEM_SET::ENTRIES LINKED_ITEMS;
///> Joints are hashed by their position, layers and net.
/// Linked items are, obviously, not hashed
@@ -54,11 +54,11 @@ public:
int net;
};
- PNS_JOINT() :
- PNS_ITEM( JOINT_T ), m_locked( false ) {}
+ JOINT() :
+ ITEM( JOINT_T ), m_locked( false ) {}
- PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet = -1 ) :
- PNS_ITEM( JOINT_T )
+ JOINT( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet = -1 ) :
+ ITEM( JOINT_T )
{
m_tag.pos = aPos;
m_tag.net = aNet;
@@ -66,8 +66,8 @@ public:
m_locked = false;
}
- PNS_JOINT( const PNS_JOINT& aB ) :
- PNS_ITEM( JOINT_T )
+ JOINT( const JOINT& aB ) :
+ ITEM( JOINT_T )
{
m_layers = aB.m_layers;
m_tag.pos = aB.m_tag.pos;
@@ -77,7 +77,7 @@ public:
m_locked = aB.m_locked;
}
- PNS_ITEM* Clone( ) const
+ ITEM* Clone( ) const
{
assert( false );
return NULL;
@@ -90,8 +90,8 @@ public:
if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT_T ) != 2 )
return false;
- PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
- PNS_SEGMENT* seg2 = static_cast<PNS_SEGMENT*>( m_linkedItems[1] );
+ SEGMENT* seg1 = static_cast<SEGMENT*>( m_linkedItems[0] );
+ SEGMENT* seg2 = static_cast<SEGMENT*>( m_linkedItems[1] );
// joints between segments of different widths are not considered trivial.
return seg1->Width() == seg2->Width();
@@ -113,14 +113,14 @@ public:
if( m_linkedItems.Count( SEGMENT_T ) != 2)
return false;
- PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
- PNS_SEGMENT* seg2 = static_cast<PNS_SEGMENT*>( m_linkedItems[1] );
+ SEGMENT* seg1 = static_cast<SEGMENT*>( m_linkedItems[0] );
+ SEGMENT* seg2 = static_cast<SEGMENT*>( m_linkedItems[1] );
return seg1->Width() != seg2->Width();
}
- ///> Links the joint to a given board item (when it's added to the PNS_NODE)
- void Link( PNS_ITEM* aItem )
+ ///> Links the joint to a given board item (when it's added to the NODE)
+ void Link( ITEM* aItem )
{
if( m_linkedItems.Contains( aItem ) )
return;
@@ -128,9 +128,9 @@ public:
m_linkedItems.Add( aItem );
}
- ///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE)
+ ///> Unlinks a given board item from the joint (upon its removal from a NODE)
///> Returns true if the joint became dangling after unlinking.
- bool Unlink( PNS_ITEM* aItem )
+ bool Unlink( ITEM* aItem )
{
m_linkedItems.Erase( aItem );
return m_linkedItems.Size() == 0;
@@ -138,20 +138,20 @@ public:
///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns
///> NULL, indicating the end of line.
- PNS_SEGMENT* NextSegment( PNS_SEGMENT* aCurrent ) const
+ SEGMENT* NextSegment( SEGMENT* aCurrent ) const
{
if( !IsLineCorner() )
return NULL;
- return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
+ return static_cast<SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
}
- PNS_VIA* Via()
+ VIA* Via()
{
- for( PNS_ITEM* item : m_linkedItems.Items() )
+ for( ITEM* item : m_linkedItems.Items() )
{
if( item->OfKind( VIA_T ) )
- return static_cast<PNS_VIA*>( item );
+ return static_cast<VIA*>( item );
}
return NULL;
@@ -179,12 +179,12 @@ public:
return m_linkedItems.CItems();
}
- const PNS_ITEMSET& CLinks() const
+ const ITEM_SET& CLinks() const
{
return m_linkedItems;
}
- PNS_ITEMSET& Links()
+ ITEM_SET& Links()
{
return m_linkedItems;
}
@@ -196,12 +196,12 @@ public:
void Dump() const;
- bool operator==( const PNS_JOINT& rhs ) const
+ bool operator==( const JOINT& rhs ) const
{
return m_tag.pos == rhs.m_tag.pos && m_tag.net == rhs.m_tag.net;
}
- void Merge( const PNS_JOINT& aJoint )
+ void Merge( const JOINT& aJoint )
{
if( !Overlaps( aJoint ) )
return;
@@ -211,13 +211,13 @@ public:
if( aJoint.IsLocked() )
m_locked = true;
- for( PNS_ITEM* item : aJoint.LinkList() )
+ for( ITEM* item : aJoint.LinkList() )
{
m_linkedItems.Add( item );
}
}
- bool Overlaps( const PNS_JOINT& rhs ) const
+ bool Overlaps( const JOINT& rhs ) const
{
return m_tag.pos == rhs.m_tag.pos &&
m_tag.net == rhs.m_tag.net && m_layers.Overlaps( rhs.m_layers );
@@ -238,18 +238,18 @@ private:
HASH_TAG m_tag;
///> list of items linked to this joint
- PNS_ITEMSET m_linkedItems;
+ ITEM_SET m_linkedItems;
///> locked (non-movable) flag
bool m_locked;
};
-inline bool operator==( PNS_JOINT::HASH_TAG const& aP1, PNS_JOINT::HASH_TAG const& aP2 )
+inline bool operator==( JOINT::HASH_TAG const& aP1, JOINT::HASH_TAG const& aP2 )
{
return aP1.pos == aP2.pos && aP1.net == aP2.net;
}
-inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP )
+inline std::size_t hash_value( JOINT::HASH_TAG const& aP )
{
std::size_t seed = 0;
boost::hash_combine( seed, aP.pos.x );
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 7f728e9..1e2b01a 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -60,20 +60,18 @@
#include "pns_debug_decorator.h"
#include "router_preview_item.h"
-using namespace PNS;
-
-class PNS_PCBNEW_RULE_RESOLVER : public PNS_RULE_RESOLVER
+class PNS_PCBNEW_RULE_RESOLVER : public PNS::RULE_RESOLVER
{
public:
- PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter );
+ PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER* aRouter );
virtual ~PNS_PCBNEW_RULE_RESOLVER();
- virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB );
+ virtual int Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB );
virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 );
virtual void UseDpGap( bool aUseDpGap ) { m_useDpGap = aUseDpGap; }
virtual int DpCoupledNet( int aNet );
virtual int DpNetPolarity( int aNet );
- virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN );
+ virtual bool DpNetPair( PNS::ITEM* aItem, int& aNetP, int& aNetN );
private:
struct CLEARANCE_ENT
@@ -82,11 +80,11 @@ private:
int clearance;
};
- int localPadClearance( const PNS_ITEM* aItem ) const;
+ int localPadClearance( const PNS::ITEM* aItem ) const;
int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
- PNS_ROUTER* m_router;
- BOARD* m_board;
+ PNS::ROUTER* m_router;
+ BOARD* m_board;
std::vector<CLEARANCE_ENT> m_clearanceCache;
int m_defaultClearance;
@@ -97,13 +95,13 @@ private:
};
-PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS_ROUTER* aRouter ) :
+PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER* aRouter ) :
m_router( aRouter ),
m_board( aBoard )
{
- PNS_NODE* world = m_router->GetWorld();
+ PNS::NODE* world = m_router->GetWorld();
- PNS_TOPOLOGY topo( world );
+ PNS::TOPOLOGY topo( world );
m_clearanceCache.resize( m_board->GetNetCount() );
for( unsigned int i = 0; i < m_board->GetNetCount(); i++ )
@@ -139,7 +137,7 @@ PNS_PCBNEW_RULE_RESOLVER::~PNS_PCBNEW_RULE_RESOLVER()
}
-int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const
+int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS::ITEM* aItem ) const
{
if( !aItem->Parent() || aItem->Parent()->Type() != PCB_PAD_T )
return 0;
@@ -149,14 +147,15 @@ int PNS_PCBNEW_RULE_RESOLVER::localPadClearance( const PNS_ITEM* aItem ) const
}
-int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB )
+int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB )
{
int net_a = aA->Net();
int cl_a = ( net_a >= 0 ? m_clearanceCache[net_a].clearance : m_defaultClearance );
int net_b = aB->Net();
int cl_b = ( net_b >= 0 ? m_clearanceCache[net_b].clearance : m_defaultClearance );
- bool linesOnly = aA->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T ) && aB->OfKind( PNS_ITEM::SEGMENT_T | PNS_ITEM::LINE_T );
+ bool linesOnly = aA->OfKind( PNS::ITEM::SEGMENT_T | PNS::ITEM::LINE_T )
+ && aB->OfKind( PNS::ITEM::SEGMENT_T | PNS::ITEM::LINE_T );
if( linesOnly && net_a >= 0 && net_b >= 0 && m_clearanceCache[net_a].coupledNet == net_b )
{
@@ -246,7 +245,7 @@ int PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity( int aNet )
}
-bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN )
+bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS::ITEM* aItem, int& aNetP, int& aNetN )
{
if( !aItem || !aItem->Parent() || !aItem->Parent()->GetNet() )
return false;
@@ -285,10 +284,10 @@ bool PNS_PCBNEW_RULE_RESOLVER::DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNet
}
-class PNS_PCBNEW_DEBUG_DECORATOR: public PNS_DEBUG_DECORATOR
+class PNS_PCBNEW_DEBUG_DECORATOR: public PNS::DEBUG_DECORATOR
{
public:
- PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS_DEBUG_DECORATOR(),
+ PNS_PCBNEW_DEBUG_DECORATOR( KIGFX::VIEW* aView = NULL ): PNS::DEBUG_DECORATOR(),
m_view( NULL ), m_items( NULL )
{
SetView( aView );
@@ -398,7 +397,7 @@ private:
};
-PNS_DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator()
+PNS::DEBUG_DECORATOR* PNS_KICAD_IFACE::GetDebugDecorator()
{
return m_debugDecorator;
}
@@ -430,9 +429,9 @@ PNS_KICAD_IFACE::~PNS_KICAD_IFACE()
}
-PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
+PNS::ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
{
- PNS_LAYERSET layers( 0, MAX_CU_LAYERS - 1 );
+ LAYER_RANGE layers( 0, MAX_CU_LAYERS - 1 );
// ignore non-copper pads
if( ( aPad->GetLayerSet() & LSET::AllCuMask()).none() )
@@ -457,7 +456,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
is_copper = true;
if( aPad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
- layers = PNS_LAYERSET( i );
+ layers = LAYER_RANGE( i );
break;
}
@@ -473,7 +472,7 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
return NULL;
}
- PNS_SOLID* solid = new PNS_SOLID;
+ PNS::SOLID* solid = new PNS::SOLID;
solid->SetLayers( layers );
solid->SetNet( aPad->GetNetCode() );
@@ -672,25 +671,25 @@ PNS_ITEM* PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
}
-PNS_ITEM* PNS_KICAD_IFACE::syncTrack( TRACK* aTrack )
+PNS::ITEM* PNS_KICAD_IFACE::syncTrack( TRACK* aTrack )
{
- PNS_SEGMENT* s =
- new PNS_SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() );
+ PNS::SEGMENT* s =
+ new PNS::SEGMENT( SEG( aTrack->GetStart(), aTrack->GetEnd() ), aTrack->GetNetCode() );
s->SetWidth( aTrack->GetWidth() );
- s->SetLayers( PNS_LAYERSET( aTrack->GetLayer() ) );
+ s->SetLayers( LAYER_RANGE( aTrack->GetLayer() ) );
s->SetParent( aTrack );
return s;
}
-PNS_ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia )
+PNS::ITEM* PNS_KICAD_IFACE::syncVia( VIA* aVia )
{
LAYER_ID top, bottom;
aVia->LayerPair( &top, &bottom );
- PNS_VIA* v = new PNS_VIA(
+ PNS::VIA* v = new PNS::VIA(
aVia->GetPosition(),
- PNS_LAYERSET( top, bottom ),
+ LAYER_RANGE( top, bottom ),
aVia->GetWidth(),
aVia->GetDrillValue(),
aVia->GetNetCode(),
@@ -709,7 +708,7 @@ void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard )
}
-void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
+void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
{
if( !m_board )
{
@@ -721,7 +720,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
{
- PNS_ITEM* solid = syncPad( pad );
+ PNS::ITEM* solid = syncPad( pad );
if( solid )
aWorld->Add( solid );
@@ -731,7 +730,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
for( TRACK* t = m_board->m_Track; t; t = t->Next() )
{
KICAD_T type = t->Type();
- PNS_ITEM* item = NULL;
+ PNS::ITEM* item = NULL;
if( type == PCB_TRACE_T )
item = syncTrack( t );
@@ -739,7 +738,7 @@ void PNS_KICAD_IFACE::SyncWorld( PNS_NODE *aWorld )
item = syncVia( static_cast<VIA*>( t ) );
if( t->IsLocked() )
- item->Mark( MK_LOCKED );
+ item->Mark( PNS::MK_LOCKED );
if( item )
aWorld->Add( item );
@@ -773,7 +772,7 @@ void PNS_KICAD_IFACE::EraseView()
}
-void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance )
+void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClearance )
{
wxLogTrace( "PNS", "DisplayItem %p\n", aItem );
@@ -792,7 +791,7 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClear
}
-void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem )
+void PNS_KICAD_IFACE::HideItem( PNS::ITEM* aItem )
{
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
@@ -807,7 +806,7 @@ void PNS_KICAD_IFACE::HideItem( PNS_ITEM* aItem )
}
-void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem )
+void PNS_KICAD_IFACE::RemoveItem( PNS::ITEM* aItem )
{
BOARD_CONNECTED_ITEM* parent = aItem->Parent();
@@ -820,15 +819,15 @@ void PNS_KICAD_IFACE::RemoveItem( PNS_ITEM* aItem )
}
-void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
+void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem )
{
BOARD_CONNECTED_ITEM* newBI = NULL;
switch( aItem->Kind() )
{
- case PNS_ITEM::SEGMENT_T:
+ case PNS::ITEM::SEGMENT_T:
{
- PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( aItem );
+ PNS::SEGMENT* seg = static_cast<PNS::SEGMENT*>( aItem );
TRACK* track = new TRACK( m_board );
const SEG& s = seg->Seg();
track->SetStart( wxPoint( s.A.x, s.A.y ) );
@@ -840,10 +839,10 @@ void PNS_KICAD_IFACE::AddItem( PNS_ITEM* aItem )
break;
}
- case PNS_ITEM::VIA_T:
+ case PNS::ITEM::VIA_T:
{
VIA* via_board = new VIA( m_board );
- PNS_VIA* via = static_cast<PNS_VIA*>( aItem );
+ PNS::VIA* via = static_cast<PNS::VIA*>( aItem );
via_board->SetPosition( wxPoint( via->Pos().x, via->Pos().y ) );
via_board->SetWidth( via->Diameter() );
via_board->SetDrill( via->Drill() );
@@ -906,12 +905,12 @@ void PNS_KICAD_IFACE::UpdateNet( int aNetCode )
wxLogTrace( "PNS", "Update-net %d\n", aNetCode );
}
-PNS_RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()
+PNS::RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()
{
return m_ruleResolver;
}
-void PNS_KICAD_IFACE::SetRouter( PNS_ROUTER* aRouter )
+void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter )
{
m_router = aRouter;
}
diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h
index 894e3b5..37994e3 100644
--- a/pcbnew/router/pns_kicad_iface.h
+++ b/pcbnew/router/pns_kicad_iface.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2016 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -34,43 +35,43 @@ namespace KIGFX
class VIEW;
};
-class PNS_KICAD_IFACE : public PNS::PNS_ROUTER_IFACE {
+class PNS_KICAD_IFACE : public PNS::ROUTER_IFACE {
public:
PNS_KICAD_IFACE();
~PNS_KICAD_IFACE();
- void SetRouter( PNS::PNS_ROUTER* aRouter );
+ void SetRouter( PNS::ROUTER* aRouter );
void SetHostFrame( PCB_EDIT_FRAME* aFrame );
void SetBoard( BOARD* aBoard );
void SetView( KIGFX::VIEW* aView );
- void SyncWorld( PNS::PNS_NODE* aWorld );
+ void SyncWorld( PNS::NODE* aWorld );
void EraseView();
- void HideItem( PNS::PNS_ITEM* aItem );
- void DisplayItem( const PNS::PNS_ITEM* aItem, int aColor = 0, int aClearance = 0 );
- void AddItem( PNS::PNS_ITEM* aItem );
- void RemoveItem( PNS::PNS_ITEM* aItem );
+ void HideItem( PNS::ITEM* aItem );
+ void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0 );
+ void AddItem( PNS::ITEM* aItem );
+ void RemoveItem( PNS::ITEM* aItem );
void Commit();
void UpdateNet( int aNetCode );
- PNS::PNS_RULE_RESOLVER* GetRuleResolver();
- PNS::PNS_DEBUG_DECORATOR* GetDebugDecorator();
+ PNS::RULE_RESOLVER* GetRuleResolver();
+ PNS::DEBUG_DECORATOR* GetDebugDecorator();
private:
PNS_PCBNEW_RULE_RESOLVER* m_ruleResolver;
PNS_PCBNEW_DEBUG_DECORATOR* m_debugDecorator;
- PNS::PNS_ITEM* syncPad( D_PAD* aPad );
- PNS::PNS_ITEM* syncTrack( TRACK* aTrack );
- PNS::PNS_ITEM* syncVia( VIA* aVia );
+ PNS::ITEM* syncPad( D_PAD* aPad );
+ PNS::ITEM* syncTrack( TRACK* aTrack );
+ PNS::ITEM* syncVia( VIA* aVia );
KIGFX::VIEW* m_view;
KIGFX::VIEW_GROUP* m_previewItems;
std::unordered_set<BOARD_CONNECTED_ITEM*> m_hiddenItems;
- PNS::PNS_NODE* m_world;
- PNS::PNS_ROUTER* m_router;
+ PNS::NODE* m_world;
+ PNS::ROUTER* m_router;
BOARD* m_board;
PICKED_ITEMS_LIST m_undoBuffer;
PCB_EDIT_FRAME* m_frame;
diff --git a/pcbnew/router/pns_layerset.h b/pcbnew/router/pns_layerset.h
index 9d01dd1..41546ee 100644
--- a/pcbnew/router/pns_layerset.h
+++ b/pcbnew/router/pns_layerset.h
@@ -2,6 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>
*
* This program is free software: you can redistribute it and/or modify it
@@ -24,19 +25,19 @@
#include <algorithm>
/**
- * Class PNS_LAYERSET
+ * Class LAYER_RANGE
*
* Represents a contiguous set of PCB layers.
*/
-class PNS_LAYERSET
+class LAYER_RANGE
{
public:
- PNS_LAYERSET() :
+ LAYER_RANGE() :
m_start( -1 ),
m_end( -1 )
{};
- PNS_LAYERSET( int aStart, int aEnd )
+ LAYER_RANGE( int aStart, int aEnd )
{
if( aStart > aEnd )
std::swap( aStart, aEnd );
@@ -45,26 +46,26 @@ public:
m_end = aEnd;
}
- PNS_LAYERSET( int aLayer )
+ LAYER_RANGE( int aLayer )
{
m_start = m_end = aLayer;
}
- PNS_LAYERSET( const PNS_LAYERSET& aB ) :
+ LAYER_RANGE( const LAYER_RANGE& aB ) :
m_start( aB.m_start ),
m_end( aB.m_end )
{}
- ~PNS_LAYERSET() {};
+ ~LAYER_RANGE() {};
- const PNS_LAYERSET& operator=( const PNS_LAYERSET& aB )
+ const LAYER_RANGE& operator=( const LAYER_RANGE& aB )
{
m_start = aB.m_start;
m_end = aB.m_end;
return *this;
}
- bool Overlaps( const PNS_LAYERSET& aOther ) const
+ bool Overlaps( const LAYER_RANGE& aOther ) const
{
return m_end >= aOther.m_start && m_start <= aOther.m_end;
}
@@ -89,7 +90,7 @@ public:
return m_end;
}
- void Merge( const PNS_LAYERSET& aOther )
+ void Merge( const LAYER_RANGE& aOther )
{
if( m_start < 0 || m_end < 0 )
{
@@ -106,17 +107,17 @@ public:
}
///> Shortcut for comparisons/overlap tests
- static PNS_LAYERSET All()
+ static LAYER_RANGE All()
{
- return PNS_LAYERSET( 0, 256 ); // fixme: use layer IDs header
+ return LAYER_RANGE( 0, 256 ); // fixme: use layer IDs header
}
- bool operator==( const PNS_LAYERSET& aOther ) const
+ bool operator==( const LAYER_RANGE& aOther ) const
{
return ( m_start == aOther.m_start ) && ( m_end == aOther.m_end );
}
- bool operator!=( const PNS_LAYERSET& aOther ) const
+ bool operator!=( const LAYER_RANGE& aOther ) const
{
return ( m_start != aOther.m_start ) || ( m_end != aOther.m_end );
}
diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp
index 06dc7bd..0b7affd 100644
--- a/pcbnew/router/pns_line.cpp
+++ b/pcbnew/router/pns_line.cpp
@@ -35,8 +35,8 @@ using boost::optional;
namespace PNS {
-PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) :
- PNS_ITEM( aOther ),
+LINE::LINE( const LINE& aOther ) :
+ ITEM( aOther ),
m_line( aOther.m_line ),
m_width( aOther.m_width )
{
@@ -52,13 +52,13 @@ PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) :
}
-PNS_LINE::~PNS_LINE()
+LINE::~LINE()
{
delete m_segmentRefs;
}
-const PNS_LINE& PNS_LINE::operator=( const PNS_LINE& aOther )
+const LINE& LINE::operator=( const LINE& aOther )
{
m_line = aOther.m_line;
m_width = aOther.m_width;
@@ -76,31 +76,31 @@ const PNS_LINE& PNS_LINE::operator=( const PNS_LINE& aOther )
}
-PNS_LINE* PNS_LINE::Clone() const
+LINE* LINE::Clone() const
{
- PNS_LINE* l = new PNS_LINE( *this );
+ LINE* l = new LINE( *this );
return l;
}
-void PNS_LINE::Mark( int aMarker )
+void LINE::Mark( int aMarker )
{
m_marker = aMarker;
if( m_segmentRefs )
{
- for( PNS_SEGMENT* s : *m_segmentRefs )
+ for( SEGMENT* s : *m_segmentRefs )
s->Mark( aMarker );
}
}
-void PNS_LINE::Unmark()
+void LINE::Unmark()
{
if( m_segmentRefs )
{
- for( PNS_SEGMENT* s : *m_segmentRefs )
+ for( SEGMENT* s : *m_segmentRefs )
s->Unmark();
}
@@ -108,13 +108,13 @@ void PNS_LINE::Unmark()
}
-int PNS_LINE::Marker() const
+int LINE::Marker() const
{
int marker = m_marker;
if( m_segmentRefs )
{
- for( PNS_SEGMENT* s : *m_segmentRefs )
+ for( SEGMENT* s : *m_segmentRefs )
{
marker |= s->Marker();
}
@@ -124,7 +124,7 @@ int PNS_LINE::Marker() const
}
-void PNS_LINE::copyLinks( const PNS_LINE* aParent )
+void LINE::copyLinks( const LINE* aParent )
{
if( aParent->m_segmentRefs == NULL )
{
@@ -137,9 +137,9 @@ void PNS_LINE::copyLinks( const PNS_LINE* aParent )
}
-PNS_SEGMENT* PNS_SEGMENT::Clone() const
+SEGMENT* SEGMENT::Clone() const
{
- PNS_SEGMENT* s = new PNS_SEGMENT;
+ SEGMENT* s = new SEGMENT;
s->m_seg = m_seg;
s->m_net = m_net;
@@ -151,7 +151,7 @@ PNS_SEGMENT* PNS_SEGMENT::Clone() const
}
-int PNS_LINE::CountCorners( int aAngles )
+int LINE::CountCorners( int aAngles )
{
int count = 0;
@@ -173,7 +173,7 @@ int PNS_LINE::CountCorners( int aAngles )
}
-bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
+bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
SHAPE_LINE_CHAIN& aWalk, SHAPE_LINE_CHAIN& aPost, bool aCw ) const
{
const SHAPE_LINE_CHAIN& line( CLine() );
@@ -269,7 +269,7 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
}
-void PNS_LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
+void LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
SHAPE_LINE_CHAIN& aPath,
bool aCw ) const
{
@@ -282,13 +282,13 @@ void PNS_LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
}
-const SHAPE_LINE_CHAIN PNS_SEGMENT::Hull( int aClearance, int aWalkaroundThickness ) const
+const SHAPE_LINE_CHAIN SEGMENT::Hull( int aClearance, int aWalkaroundThickness ) const
{
return SegmentHull( m_seg, aClearance, aWalkaroundThickness );
}
-bool PNS_LINE::Is45Degree()
+bool LINE::Is45Degree()
{
for( int i = 0; i < m_line.SegmentCount(); i++ )
{
@@ -314,15 +314,15 @@ bool PNS_LINE::Is45Degree()
}
-const PNS_LINE PNS_LINE::ClipToNearestObstacle( PNS_NODE* aNode ) const
+const LINE LINE::ClipToNearestObstacle( NODE* aNode ) const
{
const int IterationLimit = 5;
int i;
- PNS_LINE l( *this );
+ LINE l( *this );
for( i = 0; i < IterationLimit; i++ )
{
- PNS_NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l );
+ NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l );
if( obs )
{
@@ -340,7 +340,7 @@ const PNS_LINE PNS_LINE::ClipToNearestObstacle( PNS_NODE* aNode ) const
}
-void PNS_LINE::ShowLinks()
+void LINE::ShowLinks()
{
if( !m_segmentRefs )
{
@@ -423,7 +423,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT
}
-void PNS_LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
+void LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
{
SHAPE_LINE_CHAIN path;
@@ -447,7 +447,7 @@ void PNS_LINE::DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshol
}
-VECTOR2I PNS_LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP,
+VECTOR2I LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I& aP,
int aIndex, int aThreshold ) const
{
int s_start = std::max( aIndex - 2, 0 );
@@ -489,7 +489,7 @@ VECTOR2I PNS_LINE::snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTO
return best_snap;
}
-VECTOR2I PNS_LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
+VECTOR2I LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
int aIndex, int aThreshold ) const
{
VECTOR2I snap_p[2];
@@ -535,7 +535,7 @@ VECTOR2I PNS_LINE::snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const
}
-void PNS_LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
+void LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold )
{
SHAPE_LINE_CHAIN path( m_line );
VECTOR2I target( aP );
@@ -702,13 +702,13 @@ void PNS_LINE::DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThresho
}
-bool PNS_LINE::CompareGeometry( const PNS_LINE& aOther )
+bool LINE::CompareGeometry( const LINE& aOther )
{
return m_line.CompareGeometry( aOther.m_line );
}
-void PNS_LINE::Reverse()
+void LINE::Reverse()
{
m_line = m_line.Reverse();
@@ -717,7 +717,7 @@ void PNS_LINE::Reverse()
}
-void PNS_LINE::AppendVia( const PNS_VIA& aVia )
+void LINE::AppendVia( const VIA& aVia )
{
if( m_line.PointCount() > 1 && aVia.Pos() == m_line.CPoint( 0 ) )
{
@@ -730,26 +730,26 @@ void PNS_LINE::AppendVia( const PNS_VIA& aVia )
}
-void PNS_LINE::SetRank( int aRank )
+void LINE::SetRank( int aRank )
{
m_rank = aRank;
if( m_segmentRefs )
{
- for( PNS_SEGMENT* s : *m_segmentRefs )
+ for( SEGMENT* s : *m_segmentRefs )
s->SetRank( aRank );
}
}
-int PNS_LINE::Rank() const
+int LINE::Rank() const
{
int min_rank = INT_MAX;
int rank;
if( m_segmentRefs )
{
- for( PNS_SEGMENT *s : *m_segmentRefs )
+ for( SEGMENT *s : *m_segmentRefs )
min_rank = std::min( min_rank, s->Rank() );
rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
}
@@ -762,7 +762,7 @@ int PNS_LINE::Rank() const
}
-void PNS_LINE::ClipVertexRange( int aStart, int aEnd )
+void LINE::ClipVertexRange( int aStart, int aEnd )
{
m_line = m_line.Slice( aStart, aEnd );
@@ -777,7 +777,7 @@ void PNS_LINE::ClipVertexRange( int aStart, int aEnd )
}
-bool PNS_LINE::HasLoops() const
+bool LINE::HasLoops() const
{
for( int i = 0; i < PointCount(); i++ )
{
@@ -792,7 +792,7 @@ bool PNS_LINE::HasLoops() const
}
-void PNS_LINE::ClearSegmentLinks()
+void LINE::ClearSegmentLinks()
{
if( m_segmentRefs )
delete m_segmentRefs;
@@ -815,7 +815,7 @@ static void extendBox( BOX2I& aBox, bool& aDefined, const VECTOR2I& aP )
}
-OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const
+OPT_BOX2I LINE::ChangedArea( const LINE* aOther ) const
{
BOX2I area;
bool areaDefined = false;
@@ -894,9 +894,9 @@ OPT_BOX2I PNS_LINE::ChangedArea( const PNS_LINE* aOther ) const
}
-bool PNS_LINE::HasLockedSegments() const
+bool LINE::HasLockedSegments() const
{
- for( const PNS_SEGMENT* seg : *m_segmentRefs )
+ for( const SEGMENT* seg : *m_segmentRefs )
{
if( seg->Marker() & MK_LOCKED )
return true;
diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h
index 6e0b48a..ea0fd44 100644
--- a/pcbnew/router/pns_line.h
+++ b/pcbnew/router/pns_line.h
@@ -34,54 +34,54 @@
namespace PNS {
-class PNS_NODE;
-class PNS_SEGMENT;
-class PNS_VIA;
+class NODE;
+class SEGMENT;
+class VIA;
/**
- * Class PNS_LINE
+ * Class LINE
*
* Represents a track on a PCB, connecting two non-trivial joints (that is,
* vias, pads, junctions between multiple traces or two traces different widths
- * and combinations of these). PNS_LINEs are NOT stored in the model (PNS_NODE).
+ * and combinations of these). PNS_LINEs are NOT stored in the model (NODE).
* Instead, they are assembled on-the-fly, based on a via/pad/segment that
* belongs to/starts/ends them.
*
* PNS_LINEs can be either loose (consisting of segments that do not belong to
- * any PNS_NODE) or owned (with segments taken from a PNS_NODE) - these are
- * returned by PNS_NODE::AssembleLine and friends.
+ * any NODE) or owned (with segments taken from a NODE) - these are
+ * returned by NODE::AssembleLine and friends.
*
- * A PNS_LINE may have a PNS_VIA attached at its end (i.e. the last point) - this is used by via
+ * A LINE may have a VIA attached at its end (i.e. the last point) - this is used by via
* dragging/force propagation stuff.
*/
#define PNS_HULL_MARGIN 10
-class PNS_LINE : public PNS_ITEM
+class LINE : public ITEM
{
public:
- typedef std::vector<PNS_SEGMENT*> SEGMENT_REFS;
+ typedef std::vector<SEGMENT*> SEGMENT_REFS;
/**
* Constructor
* Makes an empty line.
*/
- PNS_LINE() : PNS_ITEM( LINE_T )
+ LINE() : ITEM( LINE_T )
{
m_segmentRefs = NULL;
m_hasVia = false;
m_width = 1; // Dummy value
}
- PNS_LINE( const PNS_LINE& aOther );
+ LINE( const LINE& aOther );
/**
* Constructor
* Copies properties (net, layers, etc.) from a base line and replaces the shape
* by another
**/
- PNS_LINE( const PNS_LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) :
- PNS_ITEM( aBase ),
+ LINE( const LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) :
+ ITEM( aBase ),
m_line( aLine ),
m_width( aBase.m_width )
{
@@ -91,17 +91,17 @@ public:
m_hasVia = false;
}
- ~PNS_LINE();
+ ~LINE();
- static inline bool ClassOf( const PNS_ITEM* aItem )
+ static inline bool ClassOf( const ITEM* aItem )
{
return aItem && LINE_T == aItem->Kind();
}
- /// @copydoc PNS_ITEM::Clone()
- virtual PNS_LINE* Clone() const;
+ /// @copydoc ITEM::Clone()
+ virtual LINE* Clone() const;
- const PNS_LINE& operator=( const PNS_LINE& aOther );
+ const LINE& operator=( const LINE& aOther );
///> Assigns a shape to the line (a polyline/line chain)
void SetShape( const SHAPE_LINE_CHAIN& aLine )
@@ -164,7 +164,7 @@ public:
}
///> Returns true if the line is geometrically identical as line aOther
- bool CompareGeometry( const PNS_LINE& aOther );
+ bool CompareGeometry( const LINE& aOther );
///> Reverses the point/vertex order
void Reverse();
@@ -172,8 +172,8 @@ public:
/* Linking functions */
- ///> Adds a reference to a segment registered in a PNS_NODE that is a part of this line.
- void LinkSegment( PNS_SEGMENT* aSeg )
+ ///> Adds a reference to a segment registered in a NODE that is a part of this line.
+ void LinkSegment( SEGMENT* aSeg )
{
if( !m_segmentRefs )
m_segmentRefs = new SEGMENT_REFS();
@@ -194,7 +194,7 @@ public:
}
///> Checks if the segment aSeg is a part of the line.
- bool ContainsSegment( PNS_SEGMENT* aSeg ) const
+ bool ContainsSegment( SEGMENT* aSeg ) const
{
if( !m_segmentRefs )
return false;
@@ -203,7 +203,7 @@ public:
aSeg ) != m_segmentRefs->end();
}
- PNS_SEGMENT* GetLink( int aIndex ) const
+ SEGMENT* GetLink( int aIndex ) const
{
return (*m_segmentRefs)[aIndex];
}
@@ -222,7 +222,7 @@ public:
///> Clips the line to the nearest obstacle, traversing from the line's start vertex (0).
///> Returns the clipped line.
- const PNS_LINE ClipToNearestObstacle( PNS_NODE* aNode ) const;
+ const LINE ClipToNearestObstacle( NODE* aNode ) const;
///> Clips the line to a given range of vertices.
void ClipVertexRange ( int aStart, int aEnd );
@@ -253,10 +253,10 @@ public:
bool EndsWithVia() const { return m_hasVia; }
- void AppendVia( const PNS_VIA& aVia );
+ void AppendVia( const VIA& aVia );
void RemoveVia() { m_hasVia = false; }
- const PNS_VIA& Via() const { return m_via; }
+ const VIA& Via() const { return m_via; }
virtual void Mark( int aMarker );
virtual void Unmark ();
@@ -271,7 +271,7 @@ public:
bool HasLoops() const;
bool HasLockedSegments() const;
- OPT_BOX2I ChangedArea( const PNS_LINE* aOther ) const;
+ OPT_BOX2I ChangedArea( const LINE* aOther ) const;
private:
VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
@@ -281,9 +281,9 @@ private:
int aIndex, int aThreshold ) const;
///> Copies m_segmentRefs from the line aParent.
- void copyLinks( const PNS_LINE* aParent ) ;
+ void copyLinks( const LINE* aParent ) ;
- ///> List of segments in the owning PNS_NODE (PNS_ITEM::m_owner) that constitute this line, or NULL
+ ///> List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL
///> if the line is not a part of any node.
SEGMENT_REFS* m_segmentRefs;
@@ -297,7 +297,7 @@ private:
bool m_hasVia;
///> Via at the end point, if m_hasVia == true
- PNS_VIA m_via;
+ VIA m_via;
};
}
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index dca4173..3845521 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -36,8 +36,8 @@ using boost::optional;
namespace PNS {
-PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) :
- PNS_PLACEMENT_ALGO( aRouter )
+LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) :
+ PLACEMENT_ALGO( aRouter )
{
m_initial_direction = DIRECTION_45::N;
m_world = NULL;
@@ -57,28 +57,28 @@ PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) :
}
-PNS_LINE_PLACER::~PNS_LINE_PLACER()
+LINE_PLACER::~LINE_PLACER()
{
if( m_shove )
delete m_shove;
}
-void PNS_LINE_PLACER::setWorld( PNS_NODE* aWorld )
+void LINE_PLACER::setWorld( NODE* aWorld )
{
m_world = aWorld;
}
-const PNS_VIA PNS_LINE_PLACER::makeVia( const VECTOR2I& aP )
+const VIA LINE_PLACER::makeVia( const VECTOR2I& aP )
{
- const PNS_LAYERSET layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() );
+ const LAYER_RANGE layers( m_sizes.GetLayerTop(), m_sizes.GetLayerBottom() );
- return PNS_VIA( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() );
+ return VIA( aP, layers, m_sizes.ViaDiameter(), m_sizes.ViaDrill(), -1, m_sizes.ViaType() );
}
-bool PNS_LINE_PLACER::ToggleVia( bool aEnabled )
+bool LINE_PLACER::ToggleVia( bool aEnabled )
{
m_placingVia = aEnabled;
@@ -89,7 +89,7 @@ bool PNS_LINE_PLACER::ToggleVia( bool aEnabled )
}
-void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection )
+void LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection )
{
m_initial_direction = aDirection;
@@ -98,7 +98,7 @@ void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection )
}
-bool PNS_LINE_PLACER::handleSelfIntersections()
+bool LINE_PLACER::handleSelfIntersections()
{
SHAPE_LINE_CHAIN::INTERSECTIONS ips;
SHAPE_LINE_CHAIN& head = m_head.Line();
@@ -158,7 +158,7 @@ bool PNS_LINE_PLACER::handleSelfIntersections()
}
-bool PNS_LINE_PLACER::handlePullback()
+bool LINE_PLACER::handlePullback()
{
SHAPE_LINE_CHAIN& head = m_head.Line();
SHAPE_LINE_CHAIN& tail = m_tail.Line();
@@ -217,7 +217,7 @@ bool PNS_LINE_PLACER::handlePullback()
}
-bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
+bool LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
{
SHAPE_LINE_CHAIN& head = m_head.Line();
SHAPE_LINE_CHAIN& tail = m_tail.Line();
@@ -247,9 +247,9 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
// the direction of the segment to be replaced
SHAPE_LINE_CHAIN replacement = dir.BuildInitialTrace( s.A, aEnd );
- PNS_LINE tmp( m_tail, replacement );
+ LINE tmp( m_tail, replacement );
- if( m_currentNode->CheckColliding( &tmp, PNS_ITEM::ANY_T ) )
+ if( m_currentNode->CheckColliding( &tmp, ITEM::ANY_T ) )
break;
if( DIRECTION_45( replacement.CSegment( 0 ) ) == dir )
@@ -279,7 +279,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
}
-bool PNS_LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const
+bool LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const
{
const DIRECTION_45 dir_a( aA );
const DIRECTION_45 dir_b( aB );
@@ -288,7 +288,7 @@ bool PNS_LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const
}
-bool PNS_LINE_PLACER::mergeHead()
+bool LINE_PLACER::mergeHead()
{
SHAPE_LINE_CHAIN& head = m_head.Line();
SHAPE_LINE_CHAIN& tail = m_tail.Line();
@@ -356,21 +356,21 @@ bool PNS_LINE_PLACER::mergeHead()
}
-bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
+bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead )
{
- PNS_LINE initTrack( m_head );
- PNS_LINE walkFull;
+ LINE initTrack( m_head );
+ LINE walkFull;
int effort = 0;
bool rv = true, viaOk;
viaOk = buildInitialLine( aP, initTrack );
- PNS_WALKAROUND walkaround( m_currentNode, Router() );
+ WALKAROUND walkaround( m_currentNode, Router() );
walkaround.SetSolidsOnly( false );
walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
- PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false );
+ WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false );
switch( Settings().OptimizerEffort() )
{
@@ -380,14 +380,14 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
case OE_MEDIUM:
case OE_FULL:
- effort = PNS_OPTIMIZER::MERGE_SEGMENTS;
+ effort = OPTIMIZER::MERGE_SEGMENTS;
break;
}
if( Settings().SmartPads() )
- effort |= PNS_OPTIMIZER::SMART_PADS;
+ effort |= OPTIMIZER::SMART_PADS;
- if( wf == PNS_WALKAROUND::STUCK )
+ if( wf == WALKAROUND::STUCK )
{
walkFull = walkFull.ClipToNearestObstacle( m_currentNode );
rv = true;
@@ -397,7 +397,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
walkFull.AppendVia( makeVia( walkFull.CPoint( -1 ) ) );
}
- PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
+ OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
if( m_currentNode->CheckColliding( &walkFull ) )
{
@@ -412,7 +412,7 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
}
-bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
+bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
{
buildInitialLine( aP, m_head );
aNewHead = m_head;
@@ -420,32 +420,32 @@ bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
}
-bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
+bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead )
{
- PNS_LINE initTrack( m_head );
- PNS_LINE walkSolids, l2;
+ LINE initTrack( m_head );
+ LINE walkSolids, l2;
bool viaOk = buildInitialLine( aP, initTrack );
m_currentNode = m_shove->CurrentNode();
- PNS_OPTIMIZER optimizer( m_currentNode );
+ OPTIMIZER optimizer( m_currentNode );
- PNS_WALKAROUND walkaround( m_currentNode, Router() );
+ WALKAROUND walkaround( m_currentNode, Router() );
walkaround.SetSolidsOnly( true );
walkaround.SetIterationLimit( 10 );
- PNS_WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids );
+ WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids );
- optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS );
- optimizer.SetCollisionMask( PNS_ITEM::SOLID_T );
+ optimizer.SetEffortLevel( OPTIMIZER::MERGE_SEGMENTS );
+ optimizer.SetCollisionMask( ITEM::SOLID_T );
optimizer.Optimize( &walkSolids );
- if( stat_solids == PNS_WALKAROUND::DONE )
+ if( stat_solids == WALKAROUND::DONE )
l2 = walkSolids;
else
l2 = initTrack.ClipToNearestObstacle( m_shove->CurrentNode() );
- PNS_LINE l( m_tail );
+ LINE l( m_tail );
l.Line().Append( l2.CLine() );
l.Line().Simplify();
@@ -457,8 +457,8 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
if( m_placingVia && viaOk )
{
- PNS_VIA v1( makeVia( l.CPoint( -1 ) ) );
- PNS_VIA v2( makeVia( l2.CPoint( -1 ) ) );
+ VIA v1( makeVia( l.CPoint( -1 ) ) );
+ VIA v2( makeVia( l2.CPoint( -1 ) ) );
l.AppendVia( v1 );
l2.AppendVia( v2 );
@@ -474,20 +474,20 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
return false;
}
- PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l );
+ SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l );
m_currentNode = m_shove->CurrentNode();
- if( status == PNS_SHOVE::SH_OK || status == PNS_SHOVE::SH_HEAD_MODIFIED )
+ if( status == SHOVE::SH_OK || status == SHOVE::SH_HEAD_MODIFIED )
{
- if( status == PNS_SHOVE::SH_HEAD_MODIFIED )
+ if( status == SHOVE::SH_HEAD_MODIFIED )
{
l2 = m_shove->NewHead();
}
optimizer.SetWorld( m_currentNode );
- optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_OBTUSE | PNS_OPTIMIZER::SMART_PADS );
- optimizer.SetCollisionMask( PNS_ITEM::ANY_T );
+ optimizer.SetEffortLevel( OPTIMIZER::MERGE_OBTUSE | OPTIMIZER::SMART_PADS );
+ optimizer.SetCollisionMask( ITEM::ANY_T );
optimizer.Optimize( &l2 );
aNewHead = l2;
@@ -510,7 +510,7 @@ bool PNS_LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
}
-bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead )
+bool LINE_PLACER::routeHead( const VECTOR2I& aP, LINE& aNewHead )
{
switch( m_currentMode )
{
@@ -528,11 +528,11 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead )
}
-bool PNS_LINE_PLACER::optimizeTailHeadTransition()
+bool LINE_PLACER::optimizeTailHeadTransition()
{
- PNS_LINE tmp = Trace();
+ LINE tmp = Trace();
- if( PNS_OPTIMIZER::Optimize( &tmp, PNS_OPTIMIZER::FANOUT_CLEANUP, m_currentNode ) )
+ if( OPTIMIZER::Optimize( &tmp, OPTIMIZER::FANOUT_CLEANUP, m_currentNode ) )
{
if( tmp.SegmentCount() < 1 )
return false;
@@ -565,15 +565,15 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition()
opt_line.Append( head.Slice( 0, end ) );
- PNS_LINE new_head( m_tail, opt_line );
+ LINE new_head( m_tail, opt_line );
// and see if it could be made simpler by merging obtuse/collnear segments.
// If so, replace the (threshold) last tail points and the head with
// the optimized line
- if( PNS_OPTIMIZER::Optimize( &new_head, PNS_OPTIMIZER::MERGE_OBTUSE, m_currentNode ) )
+ if( OPTIMIZER::Optimize( &new_head, OPTIMIZER::MERGE_OBTUSE, m_currentNode ) )
{
- PNS_LINE tmp( m_tail, opt_line );
+ LINE tmp( m_tail, opt_line );
wxLogTrace( "PNS", "Placer: optimize tail-head [%d]", threshold );
@@ -591,14 +591,14 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition()
}
-void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP )
+void LINE_PLACER::routeStep( const VECTOR2I& aP )
{
bool fail = false;
bool go_back = false;
int i, n_iter = 1;
- PNS_LINE new_head;
+ LINE new_head;
wxLogTrace( "PNS", "INIT-DIR: %s head: %d, tail: %d segs\n",
m_initial_direction.Format().c_str(), m_head.SegmentCount(), m_tail.SegmentCount() );
@@ -644,16 +644,16 @@ void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP )
}
-bool PNS_LINE_PLACER::route( const VECTOR2I& aP )
+bool LINE_PLACER::route( const VECTOR2I& aP )
{
routeStep( aP );
return CurrentEnd() == aP;
}
-const PNS_LINE PNS_LINE_PLACER::Trace() const
+const LINE LINE_PLACER::Trace() const
{
- PNS_LINE tmp( m_head );
+ LINE tmp( m_head );
tmp.SetShape( m_tail.CLine() );
tmp.Line().Append( m_head.CLine() );
@@ -662,21 +662,21 @@ const PNS_LINE PNS_LINE_PLACER::Trace() const
}
-const PNS_ITEMSET PNS_LINE_PLACER::Traces()
+const ITEM_SET LINE_PLACER::Traces()
{
m_currentTrace = Trace();
- return PNS_ITEMSET( &m_currentTrace );
+ return ITEM_SET( &m_currentTrace );
}
-void PNS_LINE_PLACER::FlipPosture()
+void LINE_PLACER::FlipPosture()
{
m_initial_direction = m_initial_direction.Right();
m_direction = m_direction.Right();
}
-PNS_NODE* PNS_LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const
+NODE* LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const
{
if( aLoopsRemoved && m_lastNode )
return m_lastNode;
@@ -685,21 +685,21 @@ PNS_NODE* PNS_LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const
}
-void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP )
+void LINE_PLACER::splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP )
{
if( !aSeg )
return;
- if( !aSeg->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( !aSeg->OfKind( ITEM::SEGMENT_T ) )
return;
- PNS_JOINT* jt = aNode->FindJoint( aP, aSeg );
+ JOINT* jt = aNode->FindJoint( aP, aSeg );
if( jt && jt->LinkCount() >= 1 )
return;
- PNS_SEGMENT* s_old = static_cast<PNS_SEGMENT*>( aSeg );
- PNS_SEGMENT* s_new[2];
+ SEGMENT* s_old = static_cast<SEGMENT*>( aSeg );
+ SEGMENT* s_new[2];
s_new[0] = s_old->Clone();
s_new[1] = s_old->Clone();
@@ -713,7 +713,7 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
}
-bool PNS_LINE_PLACER::SetLayer( int aLayer )
+bool LINE_PLACER::SetLayer( int aLayer )
{
if( m_idle )
{
@@ -724,7 +724,7 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer )
{
return false;
}
- else if( !m_startItem || ( m_startItem->OfKind( PNS_ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) )
+ else if( !m_startItem || ( m_startItem->OfKind( ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) )
{
m_currentLayer = aLayer;
initPlacement();
@@ -736,7 +736,7 @@ bool PNS_LINE_PLACER::SetLayer( int aLayer )
}
-bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
VECTOR2I p( aP );
@@ -762,7 +762,7 @@ bool PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-void PNS_LINE_PLACER::initPlacement()
+void LINE_PLACER::initPlacement()
{
m_idle = false;
@@ -780,10 +780,10 @@ void PNS_LINE_PLACER::initPlacement()
m_p_start = m_currentStart;
m_direction = m_initial_direction;
- PNS_NODE* world = Router()->GetWorld();
+ NODE* world = Router()->GetWorld();
world->KillChildren();
- PNS_NODE* rootNode = world->Branch();
+ NODE* rootNode = world->Branch();
splitAdjacentSegments( rootNode, m_startItem, m_currentStart );
@@ -803,19 +803,19 @@ void PNS_LINE_PLACER::initPlacement()
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{
- m_shove = new PNS_SHOVE( m_world->Branch(), Router() );
+ m_shove = new SHOVE( m_world->Branch(), Router() );
}
}
-bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
{
- PNS_LINE current;
+ LINE current;
VECTOR2I p = aP;
int eiDepth = -1;
if( aEndItem && aEndItem->Owner() )
- eiDepth = static_cast<PNS_NODE*>( aEndItem->Owner() )->Depth();
+ eiDepth = static_cast<NODE*>( aEndItem->Owner() )->Depth();
if( m_lastNode )
{
@@ -832,7 +832,7 @@ bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
else
m_currentEnd = current.CLine().CPoint( -1 );
- PNS_NODE* latestNode = m_currentNode;
+ NODE* latestNode = m_currentNode;
m_lastNode = latestNode->Branch();
if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && current.SegmentCount() )
@@ -848,12 +848,12 @@ bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
bool realEnd = false;
int lastV;
- PNS_LINE pl = Trace();
+ LINE pl = Trace();
if( m_currentMode == RM_MarkObstacles &&
!Settings().CanViolateDRC() &&
@@ -893,12 +893,12 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
else
lastV = std::max( 1, l.SegmentCount() - 1 );
- PNS_SEGMENT* lastSeg = NULL;
+ SEGMENT* lastSeg = NULL;
for( int i = 0; i < lastV; i++ )
{
const SEG& s = pl.CSegment( i );
- PNS_SEGMENT* seg = new PNS_SEGMENT( s, m_currentNet );
+ SEGMENT* seg = new SEGMENT( s, m_currentNet );
seg->SetWidth( pl.Width() );
seg->SetLayer( m_currentLayer );
m_lastNode->Add( seg );
@@ -934,7 +934,7 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
+void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest )
{
if( !aLatest.SegmentCount() )
return;
@@ -942,15 +942,15 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
if( aLatest.CLine().CPoint( 0 ) == aLatest.CLine().CPoint( -1 ) )
return;
- std::set<PNS_SEGMENT *> toErase;
+ std::set<SEGMENT *> toErase;
aNode->Add( &aLatest, true );
for( int s = 0; s < aLatest.LinkCount(); s++ )
{
- PNS_SEGMENT* seg = ( *aLatest.LinkedSegments() )[s];
- PNS_LINE ourLine = aNode->AssembleLine( seg );
- PNS_JOINT a, b;
- std::vector<PNS_LINE> lines;
+ SEGMENT* seg = ( *aLatest.LinkedSegments() )[s];
+ LINE ourLine = aNode->AssembleLine( seg );
+ JOINT a, b;
+ std::vector<LINE> lines;
aNode->FindLineEnds( ourLine, a, b );
@@ -964,13 +964,13 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
int removedCount = 0;
int total = 0;
- for( PNS_LINE& line : lines )
+ for( LINE& line : lines )
{
total++;
if( !( line.ContainsSegment( seg ) ) && line.SegmentCount() )
{
- for( PNS_SEGMENT *ss : *line.LinkedSegments() )
+ for( SEGMENT *ss : *line.LinkedSegments() )
toErase.insert( ss );
removedCount++;
@@ -980,23 +980,23 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest )
wxLogTrace( "PNS", "total segs removed: %d/%d\n", removedCount, total );
}
- for( PNS_SEGMENT *s : toErase )
+ for( SEGMENT *s : toErase )
aNode->Remove( s );
aNode->Remove( &aLatest );
}
-void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
+void LINE_PLACER::simplifyNewLine( NODE* aNode, SEGMENT* aLatest )
{
- PNS_LINE l = aNode->AssembleLine( aLatest );
+ LINE l = aNode->AssembleLine( aLatest );
SHAPE_LINE_CHAIN simplified( l.CLine() );
simplified.Simplify();
if( simplified.PointCount() != l.PointCount() )
{
- PNS_LINE lnew( l );
+ LINE lnew( l );
aNode->Remove( &l );
lnew.SetShape( simplified );
aNode->Add( &lnew );
@@ -1004,7 +1004,7 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
}
-void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
+void LINE_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes )
{
m_sizes = aSizes;
@@ -1015,24 +1015,24 @@ void PNS_LINE_PLACER::UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
}
-void PNS_LINE_PLACER::updateLeadingRatLine()
+void LINE_PLACER::updateLeadingRatLine()
{
- PNS_LINE current = Trace();
+ LINE current = Trace();
SHAPE_LINE_CHAIN ratLine;
- PNS_TOPOLOGY topo( m_lastNode );
+ TOPOLOGY topo( m_lastNode );
if( topo.LeadingRatLine( ¤t, ratLine ) )
Dbg()->AddLine( ratLine, 5, 10000 );
}
-void PNS_LINE_PLACER::SetOrthoMode( bool aOrthoMode )
+void LINE_PLACER::SetOrthoMode( bool aOrthoMode )
{
m_orthoMode = aOrthoMode;
}
-bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
+bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead )
{
SHAPE_LINE_CHAIN l;
@@ -1065,7 +1065,7 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
if( !m_placingVia )
return true;
- PNS_VIA v( makeVia( aP ) );
+ VIA v( makeVia( aP ) );
v.SetNet( aHead.Net() );
if( m_currentMode == RM_MarkObstacles )
@@ -1082,7 +1082,7 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
{
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP + force );
- aHead = PNS_LINE( aHead, line );
+ aHead = LINE( aHead, line );
v.SetPos( v.Pos() + force );
return true;
@@ -1092,12 +1092,12 @@ bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
}
-void PNS_LINE_PLACER::GetModifiedNets( std::vector<int>& aNets ) const
+void LINE_PLACER::GetModifiedNets( std::vector<int>& aNets ) const
{
aNets.push_back( m_currentNet );
}
-PNS_LOGGER* PNS_LINE_PLACER::Logger()
+LOGGER* LINE_PLACER::Logger()
{
if( m_shove )
return m_shove->Logger();
diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h
index f07199e..2e07cc5 100644
--- a/pcbnew/router/pns_line_placer.h
+++ b/pcbnew/router/pns_line_placer.h
@@ -35,26 +35,25 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
-class PNS_VIA;
-class PNS_SIZES_SETTINGS;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
+class VIA;
+class SIZES_SETTINGS;
/**
- * Class PNS_LINE_PLACER
+ * Class LINE_PLACER
*
* Single track placement algorithm. Interactively routes a track.
* Applies shove and walkaround algorithms when needed.
*/
-class PNS_LINE_PLACER : public PNS_PLACEMENT_ALGO
+class LINE_PLACER : public PLACEMENT_ALGO
{
public:
- PNS_LINE_PLACER( PNS_ROUTER* aRouter );
- ~PNS_LINE_PLACER();
+ LINE_PLACER( ROUTER* aRouter );
+ ~LINE_PLACER();
/**
* Function Start()
@@ -62,7 +61,7 @@ public:
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL).
*/
- bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ bool Start( const VECTOR2I& aP, ITEM* aStartItem );
/**
* Function Move()
@@ -71,7 +70,7 @@ public:
* aEndItem as anchor (if not NULL).
* (unless NULL).
*/
- bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool Move( const VECTOR2I& aP, ITEM* aEndItem );
/**
* Function FixRoute()
@@ -82,7 +81,7 @@ public:
* result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on.
*/
- bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem );
/**
* Function ToggleVia()
@@ -104,7 +103,7 @@ public:
* Returns the "head" of the line being placed, that is the volatile part
* that has not "settled" yet.
*/
- const PNS_LINE& Head() const { return m_head; }
+ const LINE& Head() const { return m_head; }
/**
* Function Tail()
@@ -112,21 +111,21 @@ public:
* Returns the "tail" of the line being placed, the part which has already wrapped around
* and shoved some obstacles.
*/
- const PNS_LINE& Tail() const { return m_tail; }
+ const LINE& Tail() const { return m_tail; }
/**
* Function Trace()
*
* Returns the complete routed line.
*/
- const PNS_LINE Trace() const;
+ const LINE Trace() const;
/**
* Function Traces()
*
- * Returns the complete routed line, as a single-member PNS_ITEMSET.
+ * Returns the complete routed line, as a single-member ITEM_SET.
*/
- const PNS_ITEMSET Traces();
+ const ITEM_SET Traces();
/**
* Function CurrentEnd()
@@ -164,7 +163,7 @@ public:
*
* Returns the most recent world state.
*/
- PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
+ NODE* CurrentNode( bool aLoopsRemoved = false ) const;
/**
* Function FlipPosture()
@@ -180,7 +179,7 @@ public:
* a settings class. Used to dynamically change these parameters as
* the track is routed.
*/
- void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
+ void UpdateSizes( const SIZES_SETTINGS& aSizes );
void SetOrthoMode( bool aOrthoMode );
@@ -188,7 +187,7 @@ public:
void GetModifiedNets( std::vector<int>& aNets ) const;
- PNS_LOGGER* Logger();
+ LOGGER* Logger();
private:
@@ -218,7 +217,7 @@ private:
*
* Sets the board to route.
*/
- void setWorld( PNS_NODE* aWorld );
+ void setWorld( NODE* aWorld );
/**
* Function startPlacement()
@@ -241,7 +240,7 @@ private:
* Checks if point aP lies on segment aSeg. If so, splits the segment in two,
* forming a joint at aP and stores updated topology in node aNode.
*/
- void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP );
+ void splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP );
/**
* Function removeLoops()
@@ -249,7 +248,7 @@ private:
* Searches aNode for traces concurrent to aLatest and removes them. Updated
* topology is stored in aNode.
*/
- void removeLoops( PNS_NODE* aNode, PNS_LINE& aLatest );
+ void removeLoops( NODE* aNode, LINE& aLatest );
/**
* Function simplifyNewLine()
@@ -258,7 +257,7 @@ private:
* and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode.
*/
- void simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest );
+ void simplifyNewLine( NODE* aNode, SEGMENT* aLatest );
/**
* Function checkObtusity()
@@ -325,7 +324,7 @@ private:
* around all colliding solid or non-movable items. Movable segments are
* ignored, as they'll be handled later by the shove algorithm.
*/
- bool routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead);
+ bool routeHead( const VECTOR2I& aP, LINE& aNewHead);
/**
* Function routeStep()
@@ -337,17 +336,17 @@ private:
void routeStep( const VECTOR2I& aP );
///> route step, walkaround mode
- bool rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead);
+ bool rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead);
///> route step, shove mode
- bool rhShoveOnly( const VECTOR2I& aP, PNS_LINE& aNewHead);
+ bool rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead);
///> route step, mark obstacles mode
- bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead );
+ bool rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead );
- const PNS_VIA makeVia( const VECTOR2I& aP );
+ const VIA makeVia( const VECTOR2I& aP );
- bool buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead );
+ bool buildInitialLine( const VECTOR2I& aP, LINE& aHead );
///> current routing direction
DIRECTION_45 m_direction;
@@ -357,27 +356,27 @@ private:
///> routing "head": volatile part of the track from the previously
/// analyzed point to the current routing destination
- PNS_LINE m_head;
+ LINE m_head;
///> routing "tail": part of the track that has been already fixed due to collisions with obstacles
- PNS_LINE m_tail;
+ LINE m_tail;
///> pointer to world to search colliding items
- PNS_NODE* m_world;
+ NODE* m_world;
///> current routing start point (end of tail, beginning of head)
VECTOR2I m_p_start;
///> The shove engine
- PNS_SHOVE* m_shove;
+ SHOVE* m_shove;
///> Current world state
- PNS_NODE* m_currentNode;
+ NODE* m_currentNode;
///> Postprocessed world state (including marked collisions & removed loops)
- PNS_NODE* m_lastNode;
+ NODE* m_lastNode;
- PNS_SIZES_SETTINGS m_sizes;
+ SIZES_SETTINGS m_sizes;
///> Are we placing a via?
bool m_placingVia;
@@ -386,10 +385,10 @@ private:
int m_currentLayer;
VECTOR2I m_currentEnd, m_currentStart;
- PNS_LINE m_currentTrace;
+ LINE m_currentTrace;
PNS_MODE m_currentMode;
- PNS_ITEM* m_startItem;
+ ITEM* m_startItem;
bool m_idle;
bool m_chainedPlacement;
diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp
index 1777265..2d3eb74 100644
--- a/pcbnew/router/pns_logger.cpp
+++ b/pcbnew/router/pns_logger.cpp
@@ -34,25 +34,25 @@
namespace PNS {
-PNS_LOGGER::PNS_LOGGER( )
+LOGGER::LOGGER( )
{
m_groupOpened = false;
}
-PNS_LOGGER::~PNS_LOGGER()
+LOGGER::~LOGGER()
{
}
-void PNS_LOGGER::Clear()
+void LOGGER::Clear()
{
m_theLog.str( std::string() );
m_groupOpened = false;
}
-void PNS_LOGGER::NewGroup( const std::string& aName, int aIter )
+void LOGGER::NewGroup( const std::string& aName, int aIter )
{
if( m_groupOpened )
m_theLog << "endgroup" << std::endl;
@@ -62,7 +62,7 @@ void PNS_LOGGER::NewGroup( const std::string& aName, int aIter )
}
-void PNS_LOGGER::EndGroup()
+void LOGGER::EndGroup()
{
if( !m_groupOpened )
return;
@@ -72,7 +72,7 @@ void PNS_LOGGER::EndGroup()
}
-void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName )
+void LOGGER::Log ( const ITEM* aItem, int aKind, const std::string aName )
{
m_theLog << "item " << aKind << " " << aName << " ";
m_theLog << aItem->Net() << " " << aItem->Layers().Start() << " " <<
@@ -80,9 +80,9 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
switch( aItem->Kind() )
{
- case PNS_ITEM::LINE_T:
+ case ITEM::LINE_T:
{
- PNS_LINE* l = (PNS_LINE*) aItem;
+ LINE* l = (LINE*) aItem;
m_theLog << " line ";
m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " ";
dumpShape ( l->Shape() );
@@ -90,7 +90,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
break;
}
- case PNS_ITEM::VIA_T:
+ case ITEM::VIA_T:
{
m_theLog << " via 0 0 ";
dumpShape ( aItem->Shape() );
@@ -98,18 +98,18 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
break;
}
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
{
- PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
+ SEGMENT* s =(SEGMENT*) aItem;
m_theLog << " line ";
m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<
s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl;
break;
}
- case PNS_ITEM::SOLID_T:
+ case ITEM::SOLID_T:
{
- PNS_SOLID* s = (PNS_SOLID*) aItem;
+ SOLID* s = (SOLID*) aItem;
m_theLog << " solid 0 0 ";
dumpShape( s->Shape() );
m_theLog << std::endl;
@@ -122,7 +122,7 @@ void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName
}
-void PNS_LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName )
+void LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName )
{
m_theLog << "item " << aKind << " " << aName << " ";
m_theLog << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0;
@@ -133,13 +133,13 @@ void PNS_LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string a
}
-void PNS_LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd,
+void LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aKind, const std::string aName)
{
}
-void PNS_LOGGER::dumpShape( const SHAPE* aSh )
+void LOGGER::dumpShape( const SHAPE* aSh )
{
switch( aSh->Type() )
{
@@ -194,7 +194,7 @@ void PNS_LOGGER::dumpShape( const SHAPE* aSh )
}
-void PNS_LOGGER::Save( const std::string& aFilename )
+void LOGGER::Save( const std::string& aFilename )
{
EndGroup();
diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h
index 24f2bd3..bcc9c91 100644
--- a/pcbnew/router/pns_logger.h
+++ b/pcbnew/router/pns_logger.h
@@ -34,13 +34,13 @@ class SHAPE;
namespace PNS {
-class PNS_ITEM;
+class ITEM;
-class PNS_LOGGER
+class LOGGER
{
public:
- PNS_LOGGER();
- ~PNS_LOGGER();
+ LOGGER();
+ ~LOGGER();
void Save( const std::string& aFilename );
void Clear();
@@ -48,7 +48,7 @@ public:
void NewGroup( const std::string& aName, int aIter = 0 );
void EndGroup();
- void Log( const PNS_ITEM* aItem, int aKind = 0, const std::string aName = std::string() );
+ void Log( const ITEM* aItem, int aKind = 0, const std::string aName = std::string() );
void Log( const SHAPE_LINE_CHAIN *aL, int aKind = 0, const std::string aName = std::string() );
void Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aKind = 0,
const std::string aName = std::string() );
diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp
index b6fd257..cf56219 100644
--- a/pcbnew/router/pns_meander.cpp
+++ b/pcbnew/router/pns_meander.cpp
@@ -31,19 +31,19 @@
namespace PNS {
-const PNS_MEANDER_SETTINGS& PNS_MEANDER_SHAPE::Settings() const
+const MEANDER_SETTINGS& MEANDER_SHAPE::Settings() const
{
return m_placer->MeanderSettings();
}
-const PNS_MEANDER_SETTINGS& PNS_MEANDERED_LINE::Settings() const
+const MEANDER_SETTINGS& MEANDERED_LINE::Settings() const
{
return m_placer->MeanderSettings();
}
-void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
+void MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
{
double base_len = aBase.Length();
@@ -62,7 +62,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
do
{
- PNS_MEANDER_SHAPE m( m_placer, m_width, m_dual );
+ MEANDER_SHAPE m( m_placer, m_width, m_dual );
m.SetBaselineOffset( m_baselineOffset );
m.SetBaseIndex( aBaseIndex );
@@ -84,7 +84,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
if( m.Fit( MT_CHECK_START, aBase, m_last, i ) )
{
turning = true;
- AddMeander( new PNS_MEANDER_SHAPE( m ) );
+ AddMeander( new MEANDER_SHAPE( m ) );
side = !i;
started = true;
break;
@@ -99,7 +99,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
{
if( m.Fit( MT_SINGLE, aBase, m_last, i ) )
{
- AddMeander( new PNS_MEANDER_SHAPE( m ) );
+ AddMeander( new MEANDER_SHAPE( m ) );
fail = false;
started = false;
side = !i;
@@ -113,12 +113,12 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
if( rv )
{
m.Fit( MT_TURN, aBase, m_last, side );
- AddMeander( new PNS_MEANDER_SHAPE( m ) );
+ AddMeander( new MEANDER_SHAPE( m ) );
started = true;
} else {
m.Fit( MT_FINISH, aBase, m_last, side );
started = false;
- AddMeander( new PNS_MEANDER_SHAPE( m ) );
+ AddMeander( new MEANDER_SHAPE( m ) );
turning = false;
}
@@ -128,7 +128,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
{
bool rv = m.Fit( MT_FINISH, aBase, m_last, side );
if( rv )
- AddMeander( new PNS_MEANDER_SHAPE( m ) );
+ AddMeander( new MEANDER_SHAPE( m ) );
break;
@@ -143,7 +143,7 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
if( fail )
{
- PNS_MEANDER_SHAPE tmp( m_placer, m_width, m_dual );
+ MEANDER_SHAPE tmp( m_placer, m_width, m_dual );
tmp.SetBaselineOffset( m_baselineOffset );
tmp.SetBaseIndex( aBaseIndex );
@@ -165,13 +165,13 @@ void PNS_MEANDERED_LINE::MeanderSegment( const SEG& aBase, int aBaseIndex )
}
-int PNS_MEANDER_SHAPE::cornerRadius() const
+int MEANDER_SHAPE::cornerRadius() const
{
return (int64_t) spacing() * Settings().m_cornerRadiusPercentage / 200;
}
-int PNS_MEANDER_SHAPE::spacing( ) const
+int MEANDER_SHAPE::spacing( ) const
{
if( !m_dual )
return std::max( 2 * m_width, Settings().m_spacing );
@@ -183,7 +183,7 @@ int PNS_MEANDER_SHAPE::spacing( ) const
}
-SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide )
+SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool aSide )
{
SHAPE_LINE_CHAIN lc;
@@ -254,7 +254,7 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir,
}
-VECTOR2I PNS_MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line )
+VECTOR2I MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line )
{
typedef int64_t ecoord;
VECTOR2I d = line.B - line.A;
@@ -273,7 +273,7 @@ VECTOR2I PNS_MEANDER_SHAPE::reflect( VECTOR2I p, const SEG& line )
}
-void PNS_MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir )
+void MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir )
{
m_currentTarget = aTarget;
m_currentTarget->Clear();
@@ -283,20 +283,20 @@ void PNS_MEANDER_SHAPE::start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere
}
-void PNS_MEANDER_SHAPE::forward( int aLength )
+void MEANDER_SHAPE::forward( int aLength )
{
m_currentPos += m_currentDir.Resize( aLength );
m_currentTarget->Append( m_currentPos );
}
-void PNS_MEANDER_SHAPE::turn( int aAngle )
+void MEANDER_SHAPE::turn( int aAngle )
{
m_currentDir = m_currentDir.Rotate( (double) aAngle * M_PI / 180.0 );
}
-void PNS_MEANDER_SHAPE::miter( int aRadius, bool aSide )
+void MEANDER_SHAPE::miter( int aRadius, bool aSide )
{
if( aRadius <= 0 )
{
@@ -314,7 +314,7 @@ void PNS_MEANDER_SHAPE::miter( int aRadius, bool aSide )
}
-void PNS_MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop )
+void MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop )
{
forward( aSides );
miter( aCorner, true );
@@ -324,10 +324,10 @@ void PNS_MEANDER_SHAPE::uShape( int aSides, int aCorner, int aTop )
}
-SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
- bool aSide, PNS_MEANDER_TYPE aType, int aAmpl, int aBaselineOffset )
+SHAPE_LINE_CHAIN MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
+ bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset )
{
- const PNS_MEANDER_SETTINGS& st = Settings();
+ const MEANDER_SETTINGS& st = Settings();
int cr = cornerRadius();
int offset = aBaselineOffset;
int spc = spacing();
@@ -417,11 +417,11 @@ SHAPE_LINE_CHAIN PNS_MEANDER_SHAPE::genMeanderShape( VECTOR2D aP, VECTOR2D aDir,
}
-bool PNS_MEANDERED_LINE::CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int aClearance )
+bool MEANDERED_LINE::CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearance )
{
for( int i = m_meanders.size() - 1; i >= 0; i-- )
{
- PNS_MEANDER_SHAPE* m = m_meanders[i];
+ MEANDER_SHAPE* m = m_meanders[i];
if( m->Type() == MT_EMPTY || m->Type() == MT_CORNER )
continue;
@@ -443,12 +443,12 @@ bool PNS_MEANDERED_LINE::CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int
}
-bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide )
+bool MEANDER_SHAPE::Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide )
{
- const PNS_MEANDER_SETTINGS& st = Settings();
+ const MEANDER_SETTINGS& st = Settings();
bool checkMode = false;
- PNS_MEANDER_TYPE prim1, prim2;
+ MEANDER_TYPE prim1, prim2;
if( aType == MT_CHECK_START )
{
@@ -465,8 +465,8 @@ bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECT
if( checkMode )
{
- PNS_MEANDER_SHAPE m1( m_placer, m_width, m_dual );
- PNS_MEANDER_SHAPE m2( m_placer, m_width, m_dual );
+ MEANDER_SHAPE m1( m_placer, m_width, m_dual );
+ MEANDER_SHAPE m2( m_placer, m_width, m_dual );
m1.SetBaselineOffset( m_baselineOffset );
m2.SetBaselineOffset( m_baselineOffset );
@@ -533,7 +533,7 @@ bool PNS_MEANDER_SHAPE::Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECT
}
-void PNS_MEANDER_SHAPE::Recalculate()
+void MEANDER_SHAPE::Recalculate()
{
m_shapes[0] = genMeanderShape( m_p0, m_baseSeg.B - m_baseSeg.A, m_side, m_type, m_amplitude, m_dual ? m_baselineOffset : 0 );
@@ -544,7 +544,7 @@ void PNS_MEANDER_SHAPE::Recalculate()
}
-void PNS_MEANDER_SHAPE::Resize( int aAmpl )
+void MEANDER_SHAPE::Resize( int aAmpl )
{
if( aAmpl < 0 )
return;
@@ -555,7 +555,7 @@ void PNS_MEANDER_SHAPE::Resize( int aAmpl )
}
-void PNS_MEANDER_SHAPE::MakeEmpty()
+void MEANDER_SHAPE::MakeEmpty()
{
updateBaseSegment();
@@ -570,9 +570,9 @@ void PNS_MEANDER_SHAPE::MakeEmpty()
}
-void PNS_MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB )
+void MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB )
{
- PNS_MEANDER_SHAPE* m = new PNS_MEANDER_SHAPE( m_placer, m_width, m_dual );
+ MEANDER_SHAPE* m = new MEANDER_SHAPE( m_placer, m_width, m_dual );
m->MakeCorner( aA, aB );
m_last = aA;
@@ -581,7 +581,7 @@ void PNS_MEANDERED_LINE::AddCorner( const VECTOR2I& aA, const VECTOR2I& aB )
}
-void PNS_MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 )
+void MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 )
{
SetType( MT_CORNER );
m_shapes[0].Clear();
@@ -593,16 +593,16 @@ void PNS_MEANDER_SHAPE::MakeCorner( VECTOR2I aP1, VECTOR2I aP2 )
}
-void PNS_MEANDERED_LINE::AddMeander( PNS_MEANDER_SHAPE* aShape )
+void MEANDERED_LINE::AddMeander( MEANDER_SHAPE* aShape )
{
m_last = aShape->BaseSegment().B;
m_meanders.push_back( aShape );
}
-void PNS_MEANDERED_LINE::Clear()
+void MEANDERED_LINE::Clear()
{
- for( PNS_MEANDER_SHAPE* m : m_meanders )
+ for( MEANDER_SHAPE* m : m_meanders )
{
delete m;
}
@@ -611,19 +611,19 @@ void PNS_MEANDERED_LINE::Clear()
}
-int PNS_MEANDER_SHAPE::BaselineLength() const
+int MEANDER_SHAPE::BaselineLength() const
{
return m_clippedBaseSeg.Length();
}
-int PNS_MEANDER_SHAPE::MaxTunableLength() const
+int MEANDER_SHAPE::MaxTunableLength() const
{
return CLine( 0 ).Length();
}
-void PNS_MEANDER_SHAPE::updateBaseSegment( )
+void MEANDER_SHAPE::updateBaseSegment( )
{
if( m_dual )
{
diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h
index 44ca3b2..03d29a2 100644
--- a/pcbnew/router/pns_meander.h
+++ b/pcbnew/router/pns_meander.h
@@ -29,10 +29,10 @@
namespace PNS {
-class PNS_MEANDER_PLACER_BASE;
+class MEANDER_PLACER_BASE;
///< Shapes of available meanders
-enum PNS_MEANDER_TYPE {
+enum MEANDER_TYPE {
MT_SINGLE, // _|^|_, single-sided
MT_START, // _|^|
MT_FINISH, // |^|_
@@ -44,21 +44,21 @@ enum PNS_MEANDER_TYPE {
};
///> meander corner shape
-enum PNS_MEANDER_STYLE {
+enum MEANDER_STYLE {
MEANDER_STYLE_ROUND = 1, // rounded (90 degree arc)
MEANDER_STYLE_CHAMFER // chamfered (45 degree segment)
};
/**
- * Class PNS_MEANDER_SETTINGS
+ * Class MEANDER_SETTINGS
*
* Holds dimensions for the meandering algorithm.
*/
-class PNS_MEANDER_SETTINGS
+class MEANDER_SETTINGS
{
public:
- PNS_MEANDER_SETTINGS()
+ MEANDER_SETTINGS()
{
m_minAmplitude = 100000;
m_maxAmplitude = 1000000;
@@ -83,7 +83,7 @@ public:
///> desired length of the tuned line/diff pair
int m_targetLength;
///> type of corners for the meandered line
- PNS_MEANDER_STYLE m_cornerStyle;
+ MEANDER_STYLE m_cornerStyle;
///> rounding percentage (0 - 100)
int m_cornerRadiusPercentage;
///> allowable tuning error
@@ -94,14 +94,14 @@ public:
int m_targetSkew;
};
-class PNS_MEANDERED_LINE;
+class MEANDERED_LINE;
/**
- * Class PNS_MEANDER_SETTINGS
+ * Class MEANDER_SETTINGS
*
* Holds the geometry of a single meander.
*/
-class PNS_MEANDER_SHAPE
+class MEANDER_SHAPE
{
public:
/**
@@ -112,7 +112,7 @@ public:
* @param aIsDual when true, the shape contains two meandered
* lines at a given offset (diff pairs)
*/
- PNS_MEANDER_SHAPE( PNS_MEANDER_PLACER_BASE* aPlacer, int aWidth, bool aIsDual = false ) :
+ MEANDER_SHAPE( MEANDER_PLACER_BASE* aPlacer, int aWidth, bool aIsDual = false ) :
m_placer( aPlacer ),
m_dual( aIsDual ),
m_width( aWidth ),
@@ -132,7 +132,7 @@ public:
*
* Sets the type of the meander.
*/
- void SetType( PNS_MEANDER_TYPE aType )
+ void SetType( MEANDER_TYPE aType )
{
m_type = aType;
}
@@ -142,7 +142,7 @@ public:
*
* @return the type of the meander.
*/
- PNS_MEANDER_TYPE Type() const
+ MEANDER_TYPE Type() const
{
return m_type;
}
@@ -150,7 +150,7 @@ public:
/**
* Function SetBaseIndex()
*
- * Sets an auxillary index of the segment being meandered in its original PNS_LINE.
+ * Sets an auxillary index of the segment being meandered in its original LINE.
*/
void SetBaseIndex( int aIndex )
{
@@ -160,7 +160,7 @@ public:
/**
* Function BaseIndex()
*
- * @return auxillary index of the segment being meandered in its original PNS_LINE.
+ * @return auxillary index of the segment being meandered in its original LINE.
*/
int BaseIndex() const
{
@@ -262,7 +262,7 @@ public:
* @param aSide side of aSeg to put the meander on (true = right)
* @return true on success.
*/
- bool Fit( PNS_MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide );
+ bool Fit( MEANDER_TYPE aType, const SEG& aSeg, const VECTOR2I& aP, bool aSide );
/**
* Function BaseSegment()
@@ -295,7 +295,7 @@ public:
*
* @return the current meandering settings.
*/
- const PNS_MEANDER_SETTINGS& Settings() const;
+ const MEANDER_SETTINGS& Settings() const;
/**
* Function Width()
@@ -320,7 +320,7 @@ public:
}
private:
- friend class PNS_MEANDERED_LINE;
+ friend class MEANDERED_LINE;
///> starts turtle drawing
void start( SHAPE_LINE_CHAIN* aTarget, const VECTOR2D& aWhere, const VECTOR2D& aDir );
@@ -340,7 +340,7 @@ private:
VECTOR2I reflect( VECTOR2I aP, const SEG& aLine );
///> produces a meander shape of given type
- SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, PNS_MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 );
+ SHAPE_LINE_CHAIN genMeanderShape( VECTOR2D aP, VECTOR2D aDir, bool aSide, MEANDER_TYPE aType, int aAmpl, int aBaselineOffset = 0 );
///> recalculates the clipped baseline after the parameters of
///> the meander have been changed.
@@ -353,9 +353,9 @@ private:
int spacing() const;
///> the type
- PNS_MEANDER_TYPE m_type;
+ MEANDER_TYPE m_type;
///> the placer that placed this meander
- PNS_MEANDER_PLACER_BASE* m_placer;
+ MEANDER_PLACER_BASE* m_placer;
///> dual or single line
bool m_dual;
///> width of the line
@@ -388,14 +388,14 @@ private:
/**
- * Class PNS_MEANDERED_LINE
+ * Class MEANDERED_LINE
*
* Represents a set of meanders fitted over a single or two lines.
*/
-class PNS_MEANDERED_LINE
+class MEANDERED_LINE
{
public:
- PNS_MEANDERED_LINE()
+ MEANDERED_LINE()
{
// Do not leave unitialized members, and keep static analyser quiet:
m_placer = NULL;
@@ -410,7 +410,7 @@ public:
* @param aPlacer the meander placer instance
* @param aIsDual when true, the meanders are generated for two coupled lines
*/
- PNS_MEANDERED_LINE( PNS_MEANDER_PLACER_BASE* aPlacer, bool aIsDual = false ) :
+ MEANDERED_LINE( MEANDER_PLACER_BASE* aPlacer, bool aIsDual = false ) :
m_placer( aPlacer ),
m_dual( aIsDual )
{
@@ -419,7 +419,7 @@ public:
m_baselineOffset = 0;
}
- ~PNS_MEANDERED_LINE()
+ ~MEANDERED_LINE()
{
Clear();
}
@@ -440,7 +440,7 @@ public:
* Adds a new meander shape the the meandered line.
* @param aShape the meander shape to add
*/
- void AddMeander( PNS_MEANDER_SHAPE* aShape );
+ void AddMeander( MEANDER_SHAPE* aShape );
/**
* Function Clear()
@@ -469,7 +469,7 @@ public:
*/
void MeanderSegment( const SEG& aSeg, int aBaseIndex = 0 );
- /// @copydoc PNS_MEANDER_SHAPE::SetBaselineOffset()
+ /// @copydoc MEANDER_SHAPE::SetBaselineOffset()
void SetBaselineOffset( int aOffset )
{
m_baselineOffset = aOffset;
@@ -480,7 +480,7 @@ public:
*
* @return set of meander shapes for this line
*/
- std::vector<PNS_MEANDER_SHAPE*>& Meanders()
+ std::vector<MEANDER_SHAPE*>& Meanders()
{
return m_meanders;
}
@@ -494,20 +494,20 @@ public:
* @param aClearance clearance value
* @return true, if the meander shape is not colliding
*/
- bool CheckSelfIntersections( PNS_MEANDER_SHAPE* aShape, int aClearance );
+ bool CheckSelfIntersections( MEANDER_SHAPE* aShape, int aClearance );
/**
* Function Settings()
*
* @return the current meandering settings.
*/
- const PNS_MEANDER_SETTINGS& Settings() const;
+ const MEANDER_SETTINGS& Settings() const;
private:
VECTOR2I m_last;
- PNS_MEANDER_PLACER_BASE* m_placer;
- std::vector<PNS_MEANDER_SHAPE*> m_meanders;
+ MEANDER_PLACER_BASE* m_placer;
+ std::vector<MEANDER_SHAPE*> m_meanders;
bool m_dual;
int m_width;
diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp
index 633c599..42daa7c 100644
--- a/pcbnew/router/pns_meander_placer.cpp
+++ b/pcbnew/router/pns_meander_placer.cpp
@@ -30,8 +30,8 @@
namespace PNS {
-PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
- PNS_MEANDER_PLACER_BASE( aRouter )
+MEANDER_PLACER::MEANDER_PLACER( ROUTER* aRouter ) :
+ MEANDER_PLACER_BASE( aRouter )
{
m_world = NULL;
m_currentNode = NULL;
@@ -43,12 +43,12 @@ PNS_MEANDER_PLACER::PNS_MEANDER_PLACER( PNS_ROUTER* aRouter ) :
}
-PNS_MEANDER_PLACER::~PNS_MEANDER_PLACER()
+MEANDER_PLACER::~MEANDER_PLACER()
{
}
-PNS_NODE* PNS_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
+NODE* MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
{
if( !m_currentNode )
return m_world;
@@ -57,17 +57,17 @@ PNS_NODE* PNS_MEANDER_PLACER::CurrentNode( bool aLoopsRemoved ) const
}
-bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool MEANDER_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) );
return false;
}
- m_initialSegment = static_cast<PNS_SEGMENT*>( aStartItem );
+ m_initialSegment = static_cast<SEGMENT*>( aStartItem );
p = m_initialSegment->Seg().NearestPoint( aP );
@@ -77,7 +77,7 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_world = Router()->GetWorld()->Branch();
m_originLine = m_world->AssembleLine( m_initialSegment );
- PNS_TOPOLOGY topo( m_world );
+ TOPOLOGY topo( m_world );
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
m_world->Remove( &m_originLine );
@@ -89,12 +89,12 @@ bool PNS_MEANDER_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-int PNS_MEANDER_PLACER::origPathLength() const
+int MEANDER_PLACER::origPathLength() const
{
int total = 0;
- for( const PNS_ITEM* item : m_tunedPath.CItems() )
+ for( const ITEM* item : m_tunedPath.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
total += l->CLine().Length();
}
@@ -104,13 +104,13 @@ int PNS_MEANDER_PLACER::origPathLength() const
}
-bool PNS_MEANDER_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
{
return doMove( aP, aEndItem, m_settings.m_targetLength );
}
-bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTargetLength )
+bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLength )
{
SHAPE_LINE_CHAIN pre, tuned, post;
@@ -121,7 +121,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
cutTunedLine( m_originLine.CLine(), m_currentStart, aP, pre, tuned, post );
- m_result = PNS_MEANDERED_LINE( this, false );
+ m_result = MEANDERED_LINE( this, false );
m_result.SetWidth( m_originLine.Width() );
m_result.SetBaselineOffset( 0 );
@@ -146,9 +146,9 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
tuneLineLength( m_result, aTargetLength - lineLen );
}
- for( const PNS_ITEM* item : m_tunedPath.CItems() )
+ for( const ITEM* item : m_tunedPath.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
Dbg()->AddLine( l->CLine(), 5, 30000 );
}
@@ -158,7 +158,7 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
{
tuned.Clear();
- for( PNS_MEANDER_SHAPE* m : m_result.Meanders() )
+ for( MEANDER_SHAPE* m : m_result.Meanders() )
{
if( m->Type() != MT_EMPTY )
{
@@ -188,12 +188,12 @@ bool PNS_MEANDER_PLACER::doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTa
}
-bool PNS_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool MEANDER_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
if( !m_currentNode )
return false;
- m_currentTrace = PNS_LINE( m_originLine, m_finalShape );
+ m_currentTrace = LINE( m_originLine, m_finalShape );
m_currentNode->Add( &m_currentTrace );
Router()->CommitRouting( m_currentNode );
@@ -201,9 +201,9 @@ bool PNS_MEANDER_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-bool PNS_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape )
+bool MEANDER_PLACER::CheckFit( MEANDER_SHAPE* aShape )
{
- PNS_LINE l( m_originLine, aShape->CLine( 0 ) );
+ LINE l( m_originLine, aShape->CLine( 0 ) );
if( m_currentNode->CheckColliding( &l ) )
return false;
@@ -215,25 +215,25 @@ bool PNS_MEANDER_PLACER::CheckFit( PNS_MEANDER_SHAPE* aShape )
}
-const PNS_ITEMSET PNS_MEANDER_PLACER::Traces()
+const ITEM_SET MEANDER_PLACER::Traces()
{
- m_currentTrace = PNS_LINE( m_originLine, m_finalShape );
- return PNS_ITEMSET( &m_currentTrace );
+ m_currentTrace = LINE( m_originLine, m_finalShape );
+ return ITEM_SET( &m_currentTrace );
}
-const VECTOR2I& PNS_MEANDER_PLACER::CurrentEnd() const
+const VECTOR2I& MEANDER_PLACER::CurrentEnd() const
{
return m_currentEnd;
}
-int PNS_MEANDER_PLACER::CurrentLayer() const
+int MEANDER_PLACER::CurrentLayer() const
{
return m_initialSegment->Layers().Start();
}
-const wxString PNS_MEANDER_PLACER::TuningInfo() const
+const wxString MEANDER_PLACER::TuningInfo() const
{
wxString status;
@@ -260,7 +260,7 @@ const wxString PNS_MEANDER_PLACER::TuningInfo() const
}
-PNS_MEANDER_PLACER::TUNING_STATUS PNS_MEANDER_PLACER::TuningStatus() const
+MEANDER_PLACER::TUNING_STATUS MEANDER_PLACER::TuningStatus() const
{
return m_lastStatus;
}
diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h
index c6284bf..894a04a 100644
--- a/pcbnew/router/pns_meander_placer.h
+++ b/pcbnew/router/pns_meander_placer.h
@@ -36,83 +36,82 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
/**
- * Class PNS_MEANDER_PLACER
+ * Class MEANDER_PLACER
*
* Single track length matching/meandering tool.
*/
-class PNS_MEANDER_PLACER : public PNS_MEANDER_PLACER_BASE
+class MEANDER_PLACER : public MEANDER_PLACER_BASE
{
public:
- PNS_MEANDER_PLACER( PNS_ROUTER* aRouter );
- virtual ~PNS_MEANDER_PLACER();
+ MEANDER_PLACER( ROUTER* aRouter );
+ virtual ~MEANDER_PLACER();
- /// @copydoc PNS_PLACEMENT_ALGO::Start()
- virtual bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ /// @copydoc PLACEMENT_ALGO::Start()
+ virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem );
- /// @copydoc PNS_PLACEMENT_ALGO::Move()
- virtual bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ /// @copydoc PLACEMENT_ALGO::Move()
+ virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem );
- /// @copydoc PNS_PLACEMENT_ALGO::FixRoute()
- virtual bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ /// @copydoc PLACEMENT_ALGO::FixRoute()
+ virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem );
- /// @copydoc PNS_PLACEMENT_ALGO::CurrentNode()
- PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
+ /// @copydoc PLACEMENT_ALGO::CurrentNode()
+ NODE* CurrentNode( bool aLoopsRemoved = false ) const;
- /// @copydoc PNS_PLACEMENT_ALGO::Traces()
- const PNS_ITEMSET Traces();
+ /// @copydoc PLACEMENT_ALGO::Traces()
+ const ITEM_SET Traces();
- /// @copydoc PNS_PLACEMENT_ALGO::CurrentEnd()
+ /// @copydoc PLACEMENT_ALGO::CurrentEnd()
const VECTOR2I& CurrentEnd() const;
- /// @copydoc PNS_PLACEMENT_ALGO::CurrentNets()
+ /// @copydoc PLACEMENT_ALGO::CurrentNets()
const std::vector<int> CurrentNets() const
{
return std::vector<int> (1, m_originLine.Net() );
}
- /// @copydoc PNS_PLACEMENT_ALGO::CurrentLayer()
+ /// @copydoc PLACEMENT_ALGO::CurrentLayer()
int CurrentLayer() const;
- /// @copydoc PNS_MEANDER_PLACER_BASE::TuningInfo()
+ /// @copydoc MEANDER_PLACER_BASE::TuningInfo()
virtual const wxString TuningInfo() const;
- /// @copydoc PNS_MEANDER_PLACER_BASE::TuningStatus()
+ /// @copydoc MEANDER_PLACER_BASE::TuningStatus()
virtual TUNING_STATUS TuningStatus() const;
- /// @copydoc PNS_MEANDER_PLACER_BASE::CheckFit()
- bool CheckFit ( PNS_MEANDER_SHAPE* aShape );
+ /// @copydoc MEANDER_PLACER_BASE::CheckFit()
+ bool CheckFit ( MEANDER_SHAPE* aShape );
protected:
- bool doMove( const VECTOR2I& aP, PNS_ITEM* aEndItem, int aTargetLength );
+ bool doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLength );
- void setWorld( PNS_NODE* aWorld );
+ void setWorld( NODE* aWorld );
virtual int origPathLength() const;
///> pointer to world to search colliding items
- PNS_NODE* m_world;
+ NODE* m_world;
///> current routing start point (end of tail, beginning of head)
VECTOR2I m_currentStart;
///> Current world state
- PNS_NODE* m_currentNode;
+ NODE* m_currentNode;
- PNS_LINE m_originLine;
- PNS_LINE m_currentTrace;
- PNS_ITEMSET m_tunedPath;
+ LINE m_originLine;
+ LINE m_currentTrace;
+ ITEM_SET m_tunedPath;
SHAPE_LINE_CHAIN m_finalShape;
- PNS_MEANDERED_LINE m_result;
- PNS_SEGMENT* m_initialSegment;
+ MEANDERED_LINE m_result;
+ SEGMENT* m_initialSegment;
int m_lastLength;
TUNING_STATUS m_lastStatus;
diff --git a/pcbnew/router/pns_meander_placer_base.cpp b/pcbnew/router/pns_meander_placer_base.cpp
index dc999b9..613c7a5 100644
--- a/pcbnew/router/pns_meander_placer_base.cpp
+++ b/pcbnew/router/pns_meander_placer_base.cpp
@@ -25,19 +25,19 @@
namespace PNS {
-PNS_MEANDER_PLACER_BASE::PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter ) :
- PNS_PLACEMENT_ALGO( aRouter )
+MEANDER_PLACER_BASE::MEANDER_PLACER_BASE( ROUTER* aRouter ) :
+ PLACEMENT_ALGO( aRouter )
{
m_currentWidth = 0;
}
-PNS_MEANDER_PLACER_BASE::~PNS_MEANDER_PLACER_BASE()
+MEANDER_PLACER_BASE::~MEANDER_PLACER_BASE()
{
}
-void PNS_MEANDER_PLACER_BASE::AmplitudeStep( int aSign )
+void MEANDER_PLACER_BASE::AmplitudeStep( int aSign )
{
int a = m_settings.m_maxAmplitude + aSign * m_settings.m_step;
a = std::max( a, m_settings.m_minAmplitude );
@@ -46,7 +46,7 @@ void PNS_MEANDER_PLACER_BASE::AmplitudeStep( int aSign )
}
-void PNS_MEANDER_PLACER_BASE::SpacingStep( int aSign )
+void MEANDER_PLACER_BASE::SpacingStep( int aSign )
{
int s = m_settings.m_spacing + aSign * m_settings.m_step;
s = std::max( s, 2 * m_currentWidth );
@@ -55,13 +55,13 @@ void PNS_MEANDER_PLACER_BASE::SpacingStep( int aSign )
}
-void PNS_MEANDER_PLACER_BASE::UpdateSettings( const PNS_MEANDER_SETTINGS& aSettings )
+void MEANDER_PLACER_BASE::UpdateSettings( const MEANDER_SETTINGS& aSettings )
{
m_settings = aSettings;
}
-void PNS_MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
+void MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
const VECTOR2I& aTuneStart,
const VECTOR2I& aCursorPos,
SHAPE_LINE_CHAIN& aPre,
@@ -106,12 +106,12 @@ void PNS_MEANDER_PLACER_BASE::cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
}
-void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aElongation )
+void MEANDER_PLACER_BASE::tuneLineLength( MEANDERED_LINE& aTuned, int aElongation )
{
int remaining = aElongation;
bool finished = false;
- for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() )
+ for( MEANDER_SHAPE* m : aTuned.Meanders() )
{
if( m->Type() != MT_CORNER )
{
@@ -122,7 +122,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
{
if( !finished )
{
- PNS_MEANDER_TYPE newType;
+ MEANDER_TYPE newType;
if( m->Type() == MT_START || m->Type() == MT_SINGLE )
newType = MT_SINGLE;
@@ -143,7 +143,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
remaining = aElongation;
int meanderCount = 0;
- for(PNS_MEANDER_SHAPE* m : aTuned.Meanders())
+ for(MEANDER_SHAPE* m : aTuned.Meanders())
{
if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
{
@@ -162,7 +162,7 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
if( balance >= 0 )
{
- for( PNS_MEANDER_SHAPE* m : aTuned.Meanders() )
+ for( MEANDER_SHAPE* m : aTuned.Meanders() )
{
if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
{
@@ -173,13 +173,13 @@ void PNS_MEANDER_PLACER_BASE::tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aE
}
-const PNS_MEANDER_SETTINGS& PNS_MEANDER_PLACER_BASE::MeanderSettings() const
+const MEANDER_SETTINGS& MEANDER_PLACER_BASE::MeanderSettings() const
{
return m_settings;
}
-int PNS_MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, int aTolerance ) const
+int MEANDER_PLACER_BASE::compareWithTolerance( int aValue, int aExpected, int aTolerance ) const
{
if( aValue < aExpected - aTolerance )
return -1;
diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h
index f8f8899..18d1180 100644
--- a/pcbnew/router/pns_meander_placer_base.h
+++ b/pcbnew/router/pns_meander_placer_base.h
@@ -35,18 +35,17 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
/**
- * Class PNS_MEANDER_PLACER_BASE
+ * Class MEANDER_PLACER_BASE
*
* Base class for Single trace & Differenial pair meandering tools, as
* both of them share a lot of code.
*/
-class PNS_MEANDER_PLACER_BASE : public PNS_PLACEMENT_ALGO
+class MEANDER_PLACER_BASE : public PLACEMENT_ALGO
{
public:
///> Result of the length tuning operation
@@ -56,8 +55,8 @@ public:
TUNED
};
- PNS_MEANDER_PLACER_BASE( PNS_ROUTER* aRouter );
- virtual ~PNS_MEANDER_PLACER_BASE();
+ MEANDER_PLACER_BASE( ROUTER* aRouter );
+ virtual ~MEANDER_PLACER_BASE();
/**
* Function TuningInfo()
@@ -97,7 +96,7 @@ public:
* Returns the current meandering configuration.
* @return the settings
*/
- virtual const PNS_MEANDER_SETTINGS& MeanderSettings() const;
+ virtual const MEANDER_SETTINGS& MeanderSettings() const;
/*
* Function UpdateSettings()
@@ -105,7 +104,7 @@ public:
* Sets the current meandering configuration.
* @param aSettings the settings
*/
- virtual void UpdateSettings( const PNS_MEANDER_SETTINGS& aSettings);
+ virtual void UpdateSettings( const MEANDER_SETTINGS& aSettings);
/**
* Function CheckFit()
@@ -116,7 +115,7 @@ public:
* @param aShape the shape to check
* @return true if the shape fits
*/
- virtual bool CheckFit( PNS_MEANDER_SHAPE* aShape )
+ virtual bool CheckFit( MEANDER_SHAPE* aShape )
{
return false;
}
@@ -136,11 +135,11 @@ protected:
* @param aPost part after the end of meanders
*/
void cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
- const VECTOR2I& aTuneStart,
- const VECTOR2I& aCursorPos,
- SHAPE_LINE_CHAIN& aPre,
- SHAPE_LINE_CHAIN& aTuned,
- SHAPE_LINE_CHAIN& aPost );
+ const VECTOR2I& aTuneStart,
+ const VECTOR2I& aCursorPos,
+ SHAPE_LINE_CHAIN& aPre,
+ SHAPE_LINE_CHAIN& aTuned,
+ SHAPE_LINE_CHAIN& aPost );
/**
* Function tuneLineLength()
@@ -148,7 +147,7 @@ protected:
* Takes a set of meanders in aTuned and tunes their length to
* extend the original line length by aElongation.
*/
- void tuneLineLength( PNS_MEANDERED_LINE& aTuned, int aElongation );
+ void tuneLineLength( MEANDERED_LINE& aTuned, int aElongation );
/**
* Function compareWithTolerance()
@@ -160,7 +159,7 @@ protected:
///> width of the meandered trace(s)
int m_currentWidth;
///> meandering settings
- PNS_MEANDER_SETTINGS m_settings;
+ MEANDER_SETTINGS m_settings;
///> current end point
VECTOR2I m_currentEnd;
};
diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp
index 916cabc..cfa26c3 100644
--- a/pcbnew/router/pns_meander_skew_placer.cpp
+++ b/pcbnew/router/pns_meander_skew_placer.cpp
@@ -31,30 +31,30 @@
namespace PNS {
-PNS_MEANDER_SKEW_PLACER::PNS_MEANDER_SKEW_PLACER ( PNS_ROUTER* aRouter ) :
- PNS_MEANDER_PLACER ( aRouter )
+MEANDER_SKEW_PLACER::MEANDER_SKEW_PLACER ( ROUTER* aRouter ) :
+ MEANDER_PLACER ( aRouter )
{
// Init temporary variables (do not leave uninitialized members)
m_coupledLength = 0;
}
-PNS_MEANDER_SKEW_PLACER::~PNS_MEANDER_SKEW_PLACER( )
+MEANDER_SKEW_PLACER::~MEANDER_SKEW_PLACER( )
{
}
-bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
VECTOR2I p;
- if( !aStartItem || !aStartItem->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T ) )
{
Router()->SetFailureReason( _( "Please select a differential pair trace you want to tune." ) );
return false;
}
- m_initialSegment = static_cast<PNS_SEGMENT*>( aStartItem );
+ m_initialSegment = static_cast<SEGMENT*>( aStartItem );
p = m_initialSegment->Seg().NearestPoint( aP );
@@ -64,7 +64,7 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
m_world = Router()->GetWorld( )->Branch();
m_originLine = m_world->AssembleLine( m_initialSegment );
- PNS_TOPOLOGY topo( m_world );
+ TOPOLOGY topo( m_world );
m_tunedPath = topo.AssembleTrivialPath( m_initialSegment );
if( !topo.AssembleDiffPair ( m_initialSegment, m_originPair ) )
@@ -99,18 +99,18 @@ bool PNS_MEANDER_SKEW_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
}
-int PNS_MEANDER_SKEW_PLACER::origPathLength( ) const
+int MEANDER_SKEW_PLACER::origPathLength( ) const
{
return itemsetLength ( m_tunedPath );
}
-int PNS_MEANDER_SKEW_PLACER::itemsetLength( const PNS_ITEMSET& aSet ) const
+int MEANDER_SKEW_PLACER::itemsetLength( const ITEM_SET& aSet ) const
{
int total = 0;
- for( const PNS_ITEM* item : aSet.CItems() )
+ for( const ITEM* item : aSet.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
total += l->CLine().Length();
}
@@ -120,23 +120,23 @@ int PNS_MEANDER_SKEW_PLACER::itemsetLength( const PNS_ITEMSET& aSet ) const
}
-int PNS_MEANDER_SKEW_PLACER::currentSkew() const
+int MEANDER_SKEW_PLACER::currentSkew() const
{
return m_lastLength - m_coupledLength;
}
-bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
{
- for( const PNS_ITEM* item : m_tunedPathP.CItems() )
+ for( const ITEM* item : m_tunedPathP.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
Dbg()->AddLine( l->CLine(), 5, 10000 );
}
- for( const PNS_ITEM* item : m_tunedPathN.CItems() )
+ for( const ITEM* item : m_tunedPathN.CItems() )
{
- if( const PNS_LINE* l = dyn_cast<const PNS_LINE*>( item ) )
+ if( const LINE* l = dyn_cast<const LINE*>( item ) )
Dbg()->AddLine( l->CLine(), 4, 10000 );
}
@@ -144,7 +144,7 @@ bool PNS_MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-const wxString PNS_MEANDER_SKEW_PLACER::TuningInfo() const
+const wxString MEANDER_SKEW_PLACER::TuningInfo() const
{
wxString status;
diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h
index 3ca0c92..04b7ef6 100644
--- a/pcbnew/router/pns_meander_skew_placer.h
+++ b/pcbnew/router/pns_meander_skew_placer.h
@@ -27,40 +27,39 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_SHOVE;
-class PNS_OPTIMIZER;
-class PNS_ROUTER_BASE;
+class ROUTER;
+class SHOVE;
+class OPTIMIZER;
/**
- * Class PNS_MEANDER_SKEW_PLACER
+ * Class MEANDER_SKEW_PLACER
*
* Differential pair skew adjustment algorithm.
*/
-class PNS_MEANDER_SKEW_PLACER : public PNS_MEANDER_PLACER
+class MEANDER_SKEW_PLACER : public MEANDER_PLACER
{
public:
- PNS_MEANDER_SKEW_PLACER( PNS_ROUTER* aRouter );
- ~PNS_MEANDER_SKEW_PLACER();
+ MEANDER_SKEW_PLACER( ROUTER* aRouter );
+ ~MEANDER_SKEW_PLACER();
- /// @copydoc PNS_PLACEMENT_ALGO::Start()
- bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
+ /// @copydoc PLACEMENT_ALGO::Start()
+ bool Start( const VECTOR2I& aP, ITEM* aStartItem );
- /// @copydoc PNS_PLACEMENT_ALGO::Move()
- bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem );
+ /// @copydoc PLACEMENT_ALGO::Move()
+ bool Move( const VECTOR2I& aP, ITEM* aEndItem );
- /// @copydoc PNS_MEANDER_PLACER_BASE::TuningInfo()
+ /// @copydoc MEANDER_PLACER_BASE::TuningInfo()
const wxString TuningInfo() const;
private:
int currentSkew( ) const;
- int itemsetLength( const PNS_ITEMSET& aSet ) const;
+ int itemsetLength( const ITEM_SET& aSet ) const;
int origPathLength () const;
- PNS_DIFF_PAIR m_originPair;
- PNS_ITEMSET m_tunedPath, m_tunedPathP, m_tunedPathN;
+ DIFF_PAIR m_originPair;
+ ITEM_SET m_tunedPath, m_tunedPathP, m_tunedPathN;
int m_coupledLength;
};
diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp
index 54e9205..ccb7ae9 100644
--- a/pcbnew/router/pns_node.cpp
+++ b/pcbnew/router/pns_node.cpp
@@ -44,18 +44,18 @@ using boost::unordered_map;
namespace PNS {
#ifdef DEBUG
-static boost::unordered_set<PNS_NODE*> allocNodes;
+static boost::unordered_set<NODE*> allocNodes;
#endif
-PNS_NODE::PNS_NODE()
+NODE::NODE()
{
- wxLogTrace( "PNS", "PNS_NODE::create %p", this );
+ wxLogTrace( "PNS", "NODE::create %p", this );
m_depth = 0;
m_root = this;
m_parent = NULL;
m_maxClearance = 800000; // fixme: depends on how thick traces are.
m_ruleResolver = NULL;
- m_index = new PNS_INDEX;
+ m_index = new INDEX;
#ifdef DEBUG
allocNodes.insert( this );
@@ -63,9 +63,9 @@ PNS_NODE::PNS_NODE()
}
-PNS_NODE::~PNS_NODE()
+NODE::~NODE()
{
- wxLogTrace( "PNS", "PNS_NODE::delete %p", this );
+ wxLogTrace( "PNS", "NODE::delete %p", this );
if( !m_children.empty() )
{
@@ -85,7 +85,7 @@ PNS_NODE::~PNS_NODE()
m_joints.clear();
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
{
if( (*i)->BelongsTo( this ) )
delete *i;
@@ -97,7 +97,7 @@ PNS_NODE::~PNS_NODE()
delete m_index;
}
-int PNS_NODE::GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const
+int NODE::GetClearance( const ITEM* aA, const ITEM* aB ) const
{
if( !m_ruleResolver )
return 100000;
@@ -106,11 +106,11 @@ int PNS_NODE::GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const
}
-PNS_NODE* PNS_NODE::Branch()
+NODE* NODE::Branch()
{
- PNS_NODE* child = new PNS_NODE;
+ NODE* child = new NODE;
- wxLogTrace( "PNS", "PNS_NODE::branch %p (parent %p)", child, this );
+ wxLogTrace( "PNS", "NODE::branch %p (parent %p)", child, this );
m_children.insert( child );
@@ -126,7 +126,7 @@ PNS_NODE* PNS_NODE::Branch()
{
JOINT_MAP::iterator j;
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
child->m_index->Add( *i );
child->m_joints = m_joints;
@@ -140,7 +140,7 @@ PNS_NODE* PNS_NODE::Branch()
}
-void PNS_NODE::unlinkParent()
+void NODE::unlinkParent()
{
if( isRoot() )
return;
@@ -149,25 +149,25 @@ void PNS_NODE::unlinkParent()
}
-PNS_OBSTACLE_VISITOR::PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem ) :
+OBSTACLE_VISITOR::OBSTACLE_VISITOR( const ITEM* aItem ) :
m_item( aItem ),
m_node( NULL ),
m_override( NULL ),
m_extraClearance( 0 )
{
- if( aItem && aItem->Kind() == PNS_ITEM::LINE_T )
- m_extraClearance += static_cast<const PNS_LINE*>( aItem )->Width() / 2;
+ if( aItem && aItem->Kind() == ITEM::LINE_T )
+ m_extraClearance += static_cast<const LINE*>( aItem )->Width() / 2;
}
-void PNS_OBSTACLE_VISITOR::SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride )
+void OBSTACLE_VISITOR::SetWorld( const NODE* aNode, const NODE* aOverride )
{
m_node = aNode;
m_override = aOverride;
}
-bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate )
+bool OBSTACLE_VISITOR::visit( ITEM* aCandidate )
{
// check if there is a more recent branch with a newer
// (possibily modified) version of this item.
@@ -180,7 +180,7 @@ bool PNS_OBSTACLE_VISITOR::visit( PNS_ITEM* aCandidate )
// function object that visits potential obstacles and performs
// the actual collision refining
-struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
+struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
{
///> list of encountered obstacles
OBSTACLES& m_tab;
@@ -201,8 +201,8 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
int m_forceClearance;
- DEFAULT_OBSTACLE_VISITOR( PNS_NODE::OBSTACLES& aTab, const PNS_ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) :
- PNS_OBSTACLE_VISITOR( aItem ),
+ DEFAULT_OBSTACLE_VISITOR( NODE::OBSTACLES& aTab, const ITEM* aItem, int aKindMask, bool aDifferentNetsOnly ) :
+ OBSTACLE_VISITOR( aItem ),
m_tab( aTab ),
m_kindMask( aKindMask ),
m_limitCount( -1 ),
@@ -218,7 +218,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
m_limitCount = aLimit;
}
- bool operator()( PNS_ITEM* aCandidate )
+ bool operator()( ITEM* aCandidate )
{
if( !aCandidate->OfKind( m_kindMask ) )
return true;
@@ -228,10 +228,10 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
int clearance = m_extraClearance + m_node->GetClearance( aCandidate, m_item );
- if( aCandidate->Kind() == PNS_ITEM::LINE_T ) // this should never happen.
+ if( aCandidate->Kind() == ITEM::LINE_T ) // this should never happen.
{
assert( false );
- clearance += static_cast<PNS_LINE*>( aCandidate )->Width() / 2;
+ clearance += static_cast<LINE*>( aCandidate )->Width() / 2;
}
if( m_forceClearance >= 0 )
@@ -240,7 +240,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
if( !aCandidate->Collide( m_item, clearance, m_differentNetsOnly ) )
return true;
- PNS_OBSTACLE obs;
+ OBSTACLE obs;
obs.m_item = aCandidate;
obs.m_head = m_item;
@@ -256,7 +256,7 @@ struct PNS_NODE::DEFAULT_OBSTACLE_VISITOR : public PNS_OBSTACLE_VISITOR
};
-int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisitor )
+int NODE::QueryColliding( const ITEM* aItem, OBSTACLE_VISITOR& aVisitor )
{
aVisitor.SetWorld( this, NULL );
m_index->Query( aItem, m_maxClearance, aVisitor );
@@ -272,8 +272,8 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem, PNS_OBSTACLE_VISITOR& aVisi
}
-int PNS_NODE::QueryColliding( const PNS_ITEM* aItem,
- PNS_NODE::OBSTACLES& aObstacles, int aKindMask, int aLimitCount, bool aDifferentNetsOnly, int aForceClearance )
+int NODE::QueryColliding( const ITEM* aItem,
+ NODE::OBSTACLES& aObstacles, int aKindMask, int aLimitCount, bool aDifferentNetsOnly, int aForceClearance )
{
DEFAULT_OBSTACLE_VISITOR visitor( aObstacles, aItem, aKindMask, aDifferentNetsOnly );
@@ -298,8 +298,8 @@ int PNS_NODE::QueryColliding( const PNS_ITEM* aItem,
}
-PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKindMask,
- const std::set<PNS_ITEM*>* aRestrictedSet )
+NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask,
+ const std::set<ITEM*>* aRestrictedSet )
{
OBSTACLES obs_list;
bool found_isects = false;
@@ -312,7 +312,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi
for( int i = 0; i < line.SegmentCount(); i++ )
{
- const PNS_SEGMENT s( *aItem, line.CSegment( i ) );
+ const SEGMENT s( *aItem, line.CSegment( i ) );
n += QueryColliding( &s, obs_list, aKindMask );
}
@@ -322,13 +322,13 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi
if( !n )
return OPT_OBSTACLE();
- PNS_LINE& aLine = (PNS_LINE&) *aItem;
+ LINE& aLine = (LINE&) *aItem;
- PNS_OBSTACLE nearest;
+ OBSTACLE nearest;
nearest.m_item = NULL;
nearest.m_distFirst = INT_MAX;
- for( PNS_OBSTACLE obs : obs_list )
+ for( OBSTACLE obs : obs_list )
{
VECTOR2I ip_first, ip_last;
int dist_max = INT_MIN;
@@ -407,9 +407,9 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::NearestObstacle( const PNS_LINE* aItem, int aKi
}
-PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEMSET& aSet, int aKindMask )
+NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM_SET& aSet, int aKindMask )
{
- for( const PNS_ITEM* item : aSet.CItems() )
+ for( const ITEM* item : aSet.CItems() )
{
OPT_OBSTACLE obs = CheckColliding( item, aKindMask );
@@ -421,21 +421,21 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEMSET& aSet, int aK
}
-PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, int aKindMask )
+NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM* aItemA, int aKindMask )
{
OBSTACLES obs;
obs.reserve( 100 );
- if( aItemA->Kind() == PNS_ITEM::LINE_T )
+ if( aItemA->Kind() == ITEM::LINE_T )
{
int n = 0;
- const PNS_LINE* line = static_cast<const PNS_LINE*>( aItemA );
+ const LINE* line = static_cast<const LINE*>( aItemA );
const SHAPE_LINE_CHAIN& l = line->CLine();
for( int i = 0; i < l.SegmentCount(); i++ )
{
- const PNS_SEGMENT s( *line, l.CSegment( i ) );
+ const SEGMENT s( *line, l.CSegment( i ) );
n += QueryColliding( &s, obs, aKindMask, 1 );
if( n )
@@ -457,7 +457,7 @@ PNS_NODE::OPT_OBSTACLE PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, int aKi
}
-bool PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB, int aKindMask, int aForceClearance )
+bool NODE::CheckColliding( const ITEM* aItemA, const ITEM* aItemB, int aKindMask, int aForceClearance )
{
assert( aItemB );
int clearance;
@@ -467,26 +467,26 @@ bool PNS_NODE::CheckColliding( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB, i
clearance = GetClearance( aItemA, aItemB );
// fixme: refactor
- if( aItemA->Kind() == PNS_ITEM::LINE_T )
- clearance += static_cast<const PNS_LINE*>( aItemA )->Width() / 2;
- if( aItemB->Kind() == PNS_ITEM::LINE_T )
- clearance += static_cast<const PNS_LINE*>( aItemB )->Width() / 2;
+ if( aItemA->Kind() == ITEM::LINE_T )
+ clearance += static_cast<const LINE*>( aItemA )->Width() / 2;
+ if( aItemB->Kind() == ITEM::LINE_T )
+ clearance += static_cast<const LINE*>( aItemB )->Width() / 2;
return aItemA->Collide( aItemB, clearance );
}
-struct HIT_VISITOR : public PNS_OBSTACLE_VISITOR
+struct HIT_VISITOR : public OBSTACLE_VISITOR
{
- PNS_ITEMSET& m_items;
+ ITEM_SET& m_items;
const VECTOR2I& m_point;
- HIT_VISITOR( PNS_ITEMSET& aTab, const VECTOR2I& aPoint ) :
- PNS_OBSTACLE_VISITOR( NULL ),
+ HIT_VISITOR( ITEM_SET& aTab, const VECTOR2I& aPoint ) :
+ OBSTACLE_VISITOR( NULL ),
m_items( aTab ), m_point( aPoint )
{}
- bool operator()( PNS_ITEM* aItem )
+ bool operator()( ITEM* aItem )
{
SHAPE_CIRCLE cp( m_point, 0 );
@@ -500,9 +500,9 @@ struct HIT_VISITOR : public PNS_OBSTACLE_VISITOR
};
-const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const
+const ITEM_SET NODE::HitTest( const VECTOR2I& aPoint ) const
{
- PNS_ITEMSET items;
+ ITEM_SET items;
// fixme: we treat a point as an infinitely small circle - this is inefficient.
SHAPE_CIRCLE s( aPoint, 0 );
@@ -513,12 +513,12 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const
if( !isRoot() ) // fixme: could be made cleaner
{
- PNS_ITEMSET items_root;
+ ITEM_SET items_root;
visitor.SetWorld( m_root, NULL );
HIT_VISITOR visitor_root( items_root, aPoint );
m_root->m_index->Query( &s, m_maxClearance, visitor_root );
- for( PNS_ITEM* item : items_root.Items() )
+ for( ITEM* item : items_root.Items() )
{
if( !Overrides( item ) )
items.Add( item );
@@ -529,21 +529,21 @@ const PNS_ITEMSET PNS_NODE::HitTest( const VECTOR2I& aPoint ) const
}
-void PNS_NODE::addSolid( PNS_SOLID* aSolid )
+void NODE::addSolid( SOLID* aSolid )
{
linkJoint( aSolid->Pos(), aSolid->Layers(), aSolid->Net(), aSolid );
m_index->Add( aSolid );
}
-void PNS_NODE::addVia( PNS_VIA* aVia )
+void NODE::addVia( VIA* aVia )
{
linkJoint( aVia->Pos(), aVia->Layers(), aVia->Net(), aVia );
m_index->Add( aVia );
}
-void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant )
+void NODE::addLine( LINE* aLine, bool aAllowRedundant )
{
SHAPE_LINE_CHAIN& l = aLine->Line();
@@ -553,8 +553,8 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant )
if( s.A != s.B )
{
- PNS_SEGMENT* pseg = new PNS_SEGMENT( *aLine, s );
- PNS_SEGMENT* psegR = NULL;
+ SEGMENT* pseg = new SEGMENT( *aLine, s );
+ SEGMENT* psegR = NULL;
if( !aAllowRedundant )
psegR = findRedundantSegment( pseg );
@@ -581,7 +581,7 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant )
}
-void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant )
+void NODE::addSegment( SEGMENT* aSeg, bool aAllowRedundant )
{
if( aSeg->Seg().A == aSeg->Seg().B )
{
@@ -601,26 +601,26 @@ void PNS_NODE::addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant )
}
-void PNS_NODE::Add( PNS_ITEM* aItem, bool aAllowRedundant )
+void NODE::Add( ITEM* aItem, bool aAllowRedundant )
{
aItem->SetOwner( this );
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID_T:
- addSolid( static_cast<PNS_SOLID*>( aItem ) );
+ case ITEM::SOLID_T:
+ addSolid( static_cast<SOLID*>( aItem ) );
break;
- case PNS_ITEM::SEGMENT_T:
- addSegment( static_cast<PNS_SEGMENT*>( aItem ), aAllowRedundant );
+ case ITEM::SEGMENT_T:
+ addSegment( static_cast<SEGMENT*>( aItem ), aAllowRedundant );
break;
- case PNS_ITEM::LINE_T:
- addLine( static_cast<PNS_LINE*>( aItem ), aAllowRedundant );
+ case ITEM::LINE_T:
+ addLine( static_cast<LINE*>( aItem ), aAllowRedundant );
break;
- case PNS_ITEM::VIA_T:
- addVia( static_cast<PNS_VIA*>( aItem ) );
+ case ITEM::VIA_T:
+ addVia( static_cast<VIA*>( aItem ) );
break;
default:
@@ -629,7 +629,7 @@ void PNS_NODE::Add( PNS_ITEM* aItem, bool aAllowRedundant )
}
-void PNS_NODE::doRemove( PNS_ITEM* aItem )
+void NODE::doRemove( ITEM* aItem )
{
// case 1: removing an item that is stored in the root node from any branch:
// mark it as overridden, but do not remove
@@ -650,7 +650,7 @@ void PNS_NODE::doRemove( PNS_ITEM* aItem )
}
-void PNS_NODE::removeSegment( PNS_SEGMENT* aSeg )
+void NODE::removeSegment( SEGMENT* aSeg )
{
unlinkJoint( aSeg->Seg().A, aSeg->Layers(), aSeg->Net(), aSeg );
unlinkJoint( aSeg->Seg().B, aSeg->Layers(), aSeg->Net(), aSeg );
@@ -659,31 +659,31 @@ void PNS_NODE::removeSegment( PNS_SEGMENT* aSeg )
}
-void PNS_NODE::removeLine( PNS_LINE* aLine )
+void NODE::removeLine( LINE* aLine )
{
- std::vector<PNS_SEGMENT*>* segRefs = aLine->LinkedSegments();
+ std::vector<SEGMENT*>* segRefs = aLine->LinkedSegments();
assert( segRefs != NULL );
- for( PNS_SEGMENT* seg : *segRefs )
+ for( SEGMENT* seg : *segRefs )
{
removeSegment( seg );
}
}
-void PNS_NODE::removeVia( PNS_VIA* aVia )
+void NODE::removeVia( VIA* aVia )
{
// We have to split a single joint (associated with a via, binding together multiple layers)
// into multiple independent joints. As I'm a lazy bastard, I simply delete the via and all its links and re-insert them.
- PNS_JOINT::HASH_TAG tag;
+ JOINT::HASH_TAG tag;
VECTOR2I p( aVia->Pos() );
- PNS_LAYERSET vLayers( aVia->Layers() );
+ LAYER_RANGE vLayers( aVia->Layers() );
int net = aVia->Net();
- PNS_JOINT* jt = FindJoint( p, vLayers.Start(), net );
- PNS_JOINT::LINKED_ITEMS links( jt->LinkList() );
+ JOINT* jt = FindJoint( p, vLayers.Start(), net );
+ JOINT::LINKED_ITEMS links( jt->LinkList() );
tag.net = net;
tag.pos = p;
@@ -711,7 +711,7 @@ void PNS_NODE::removeVia( PNS_VIA* aVia )
} while( split );
// and re-link them, using the former via's link list
- for(PNS_ITEM* item : links)
+ for(ITEM* item : links)
{
if( item != aVia )
linkJoint( p, item->Layers(), net, item );
@@ -721,32 +721,32 @@ void PNS_NODE::removeVia( PNS_VIA* aVia )
}
-void PNS_NODE::Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem )
+void NODE::Replace( ITEM* aOldItem, ITEM* aNewItem )
{
Remove( aOldItem );
Add( aNewItem );
}
-void PNS_NODE::Remove( PNS_ITEM* aItem )
+void NODE::Remove( ITEM* aItem )
{
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID_T:
+ case ITEM::SOLID_T:
// fixme: this fucks up the joints, but it's only used for marking colliding obstacles for the moment, so we don't care.
doRemove( aItem );
break;
- case PNS_ITEM::SEGMENT_T:
- removeSegment( static_cast<PNS_SEGMENT*>( aItem ) );
+ case ITEM::SEGMENT_T:
+ removeSegment( static_cast<SEGMENT*>( aItem ) );
break;
- case PNS_ITEM::LINE_T:
- removeLine( static_cast<PNS_LINE*>( aItem ) );
+ case ITEM::LINE_T:
+ removeLine( static_cast<LINE*>( aItem ) );
break;
- case PNS_ITEM::VIA_T:
- removeVia( static_cast<PNS_VIA*>( aItem ) );
+ case ITEM::VIA_T:
+ removeVia( static_cast<VIA*>( aItem ) );
break;
default:
@@ -755,14 +755,14 @@ void PNS_NODE::Remove( PNS_ITEM* aItem )
}
-void PNS_NODE::Remove( PNS_LINE& aLine )
+void NODE::Remove( LINE& aLine )
{
removeLine( &aLine );
}
-void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos,
- int aLimit, VECTOR2I* aCorners, PNS_SEGMENT** aSegments, bool& aGuardHit,
+void NODE::followLine( SEGMENT* aCurrent, bool aScanDirection, int& aPos,
+ int aLimit, VECTOR2I* aCorners, SEGMENT** aSegments, bool& aGuardHit,
bool aStopAtLockedJoints )
{
bool prevReversed = false;
@@ -773,7 +773,7 @@ void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos
{
const VECTOR2I p =
( aScanDirection ^ prevReversed ) ? aCurrent->Seg().B : aCurrent->Seg().A;
- const PNS_JOINT* jt = FindJoint( p, aCurrent );
+ const JOINT* jt = FindJoint( p, aCurrent );
assert( jt );
@@ -801,14 +801,14 @@ void PNS_NODE::followLine( PNS_SEGMENT* aCurrent, bool aScanDirection, int& aPos
}
-const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex, bool aStopAtLockedJoints )
+const LINE NODE::AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex, bool aStopAtLockedJoints )
{
const int MaxVerts = 1024 * 16;
VECTOR2I corners[MaxVerts + 1];
- PNS_SEGMENT* segs[MaxVerts + 1];
+ SEGMENT* segs[MaxVerts + 1];
- PNS_LINE pl;
+ LINE pl;
bool guardHit = false;
int i_start = MaxVerts / 2, i_end = i_start + 1;
@@ -825,7 +825,7 @@ const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentInd
int n = 0;
- PNS_SEGMENT* prev_seg = NULL;
+ SEGMENT* prev_seg = NULL;
bool originSet = false;
for( int i = i_start + 1; i < i_end; i++ )
@@ -856,7 +856,7 @@ const PNS_LINE PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentInd
}
-void PNS_NODE::FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB )
+void NODE::FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB )
{
aA = *FindJoint( aLine.CPoint( 0 ), &aLine );
aB = *FindJoint( aLine.CPoint( -1 ), &aLine );
@@ -864,27 +864,27 @@ void PNS_NODE::FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB
#if 0
-void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFoundJoints )
+void NODE::MapConnectivity( JOINT* aStart, std::vector<JOINT*>& aFoundJoints )
{
- std::deque<PNS_JOINT*> searchQueue;
- std::set<PNS_JOINT*> processed;
+ std::deque<JOINT*> searchQueue;
+ std::set<JOINT*> processed;
searchQueue.push_back( aStart );
processed.insert( aStart );
while( !searchQueue.empty() )
{
- PNS_JOINT* current = searchQueue.front();
+ JOINT* current = searchQueue.front();
searchQueue.pop_front();
- for( PNS_ITEM* item : current->LinkList() )
+ for( ITEM* item : current->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( item->OfKind( ITEM::SEGMENT_T ) )
{
- PNS_SEGMENT* seg = static_cast<PNS_SEGMENT *>( item );
- PNS_JOINT* a = FindJoint( seg->Seg().A, seg );
- PNS_JOINT* b = FindJoint( seg->Seg().B, seg );
- PNS_JOINT* next = ( *a == *current ) ? b : a;
+ SEGMENT* seg = static_cast<SEGMENT *>( item );
+ JOINT* a = FindJoint( seg->Seg().A, seg );
+ JOINT* b = FindJoint( seg->Seg().B, seg );
+ JOINT* next = ( *a == *current ) ? b : a;
if( processed.find( next ) == processed.end() )
{
@@ -895,25 +895,25 @@ void PNS_NODE::MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*>& aFou
}
}
- for(PNS_JOINT* jt : processed)
+ for(JOINT* jt : processed)
aFoundJoints.push_back( jt );
}
#endif
-int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<PNS_LINE>& aLines )
+int NODE::FindLinesBetweenJoints( JOINT& aA, JOINT& aB, std::vector<LINE>& aLines )
{
- for( PNS_ITEM* item : aA.LinkList() )
+ for( ITEM* item : aA.LinkList() )
{
- if( item->Kind() == PNS_ITEM::SEGMENT_T )
+ if( item->Kind() == ITEM::SEGMENT_T )
{
- PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
- PNS_LINE line = AssembleLine( seg );
+ SEGMENT* seg = static_cast<SEGMENT*>( item );
+ LINE line = AssembleLine( seg );
if( !line.Layers().Overlaps( aB.Layers() ) )
continue;
- PNS_JOINT j_start, j_end;
+ JOINT j_start, j_end;
FindLineEnds( line, j_start, j_end );
@@ -935,9 +935,9 @@ int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<
}
-PNS_JOINT* PNS_NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet )
+JOINT* NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet )
{
- PNS_JOINT::HASH_TAG tag;
+ JOINT::HASH_TAG tag;
tag.net = aNet;
tag.pos = aPos;
@@ -965,16 +965,16 @@ PNS_JOINT* PNS_NODE::FindJoint( const VECTOR2I& aPos, int aLayer, int aNet )
}
-void PNS_NODE::LockJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem, bool aLock )
+void NODE::LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock )
{
- PNS_JOINT& jt = touchJoint( aPos, aItem->Layers(), aItem->Net() );
+ JOINT& jt = touchJoint( aPos, aItem->Layers(), aItem->Net() );
jt.Lock( aLock );
}
-PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet )
+JOINT& NODE::touchJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet )
{
- PNS_JOINT::HASH_TAG tag;
+ JOINT::HASH_TAG tag;
tag.pos = aPos;
tag.net = aNet;
@@ -994,7 +994,7 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye
}
// now insert and combine overlapping joints
- PNS_JOINT jt( aPos, aLayers, aNet );
+ JOINT jt( aPos, aLayers, aNet );
bool merged;
@@ -1023,50 +1023,50 @@ PNS_JOINT& PNS_NODE::touchJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLaye
}
-void PNS_JOINT::Dump() const
+void JOINT::Dump() const
{
wxLogTrace( "PNS", "joint layers %d-%d, net %d, pos %s, links: %d\n", m_layers.Start(),
m_layers.End(), m_tag.net, m_tag.pos.Format().c_str(), LinkCount() );
}
-void PNS_NODE::linkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
- int aNet, PNS_ITEM* aWhere )
+void NODE::linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere )
{
- PNS_JOINT& jt = touchJoint( aPos, aLayers, aNet );
+ JOINT& jt = touchJoint( aPos, aLayers, aNet );
jt.Link( aWhere );
}
-void PNS_NODE::unlinkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
- int aNet, PNS_ITEM* aWhere )
+void NODE::unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere )
{
// fixme: remove dangling joints
- PNS_JOINT& jt = touchJoint( aPos, aLayers, aNet );
+ JOINT& jt = touchJoint( aPos, aLayers, aNet );
jt.Unlink( aWhere );
}
-void PNS_NODE::Dump( bool aLong )
+void NODE::Dump( bool aLong )
{
#if 0
- boost::unordered_set<PNS_SEGMENT*> all_segs;
- SHAPE_INDEX_LIST<PNS_ITEM*>::iterator i;
+ boost::unordered_set<SEGMENT*> all_segs;
+ SHAPE_INDEX_LIST<ITEM*>::iterator i;
for( i = m_items.begin(); i != m_items.end(); i++ )
{
- if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T )
- all_segs.insert( static_cast<PNS_SEGMENT*>( *i ) );
+ if( (*i)->GetKind() == ITEM::SEGMENT_T )
+ all_segs.insert( static_cast<SEGMENT*>( *i ) );
}
if( !isRoot() )
{
for( i = m_root->m_items.begin(); i != m_root->m_items.end(); i++ )
{
- if( (*i)->GetKind() == PNS_ITEM::SEGMENT_T && !overrides( *i ) )
- all_segs.insert( static_cast<PNS_SEGMENT*>(*i) );
+ if( (*i)->GetKind() == ITEM::SEGMENT_T && !overrides( *i ) )
+ all_segs.insert( static_cast<SEGMENT*>(*i) );
}
}
@@ -1077,17 +1077,17 @@ void PNS_NODE::Dump( bool aLong )
{
wxLogTrace( "PNS", "joint : %s, links : %d\n",
j->second.GetPos().Format().c_str(), j->second.LinkCount() );
- PNS_JOINT::LINKED_ITEMS::const_iterator k;
+ JOINT::LINKED_ITEMS::const_iterator k;
for( k = j->second.GetLinkList().begin(); k != j->second.GetLinkList().end(); ++k )
{
- const PNS_ITEM* m_item = *k;
+ const ITEM* m_item = *k;
switch( m_item->GetKind() )
{
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
{
- const PNS_SEGMENT* seg = static_cast<const PNS_SEGMENT*>( m_item );
+ const SEGMENT* seg = static_cast<const SEGMENT*>( m_item );
wxLogTrace( "PNS", " -> seg %s %s\n", seg->GetSeg().A.Format().c_str(),
seg->GetSeg().B.Format().c_str() );
break;
@@ -1104,15 +1104,15 @@ void PNS_NODE::Dump( bool aLong )
while( !all_segs.empty() )
{
- PNS_SEGMENT* s = *all_segs.begin();
- PNS_LINE* l = AssembleLine( s );
+ SEGMENT* s = *all_segs.begin();
+ LINE* l = AssembleLine( s );
- PNS_LINE::LinkedSegments* seg_refs = l->GetLinkedSegments();
+ LINE::LinkedSegments* seg_refs = l->GetLinkedSegments();
if( aLong )
wxLogTrace( "PNS", "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() );
- for( std::vector<PNS_SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j )
+ for( std::vector<SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j )
{
wxLogTrace( "PNS", "%s ", (*j)->GetSeg().A.Format().c_str() );
@@ -1130,7 +1130,7 @@ void PNS_NODE::Dump( bool aLong )
}
-void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
+void NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
{
aRemoved.reserve( m_override.size() );
aAdded.reserve( m_index->Size() );
@@ -1138,19 +1138,19 @@ void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
if( isRoot() )
return;
- for( PNS_ITEM* item : m_override )
+ for( ITEM* item : m_override )
aRemoved.push_back( item );
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
aAdded.push_back( *i );
}
-void PNS_NODE::releaseChildren()
+void NODE::releaseChildren()
{
- // copy the kids as the PNS_NODE destructor erases the item from the parent node.
- std::set<PNS_NODE*> kids = m_children;
+ // copy the kids as the NODE destructor erases the item from the parent node.
+ std::set<NODE*> kids = m_children;
- for( PNS_NODE* node : kids )
+ for( NODE* node : kids )
{
node->releaseChildren();
delete node;
@@ -1158,12 +1158,12 @@ void PNS_NODE::releaseChildren()
}
-void PNS_NODE::releaseGarbage()
+void NODE::releaseGarbage()
{
if( !isRoot() )
return;
- for( PNS_ITEM* item : m_garbageItems )
+ for( ITEM* item : m_garbageItems )
{
if( !item->BelongsTo( this ) )
delete item;
@@ -1173,15 +1173,15 @@ void PNS_NODE::releaseGarbage()
}
-void PNS_NODE::Commit( PNS_NODE* aNode )
+void NODE::Commit( NODE* aNode )
{
if( aNode->isRoot() )
return;
- for( PNS_ITEM* item : aNode->m_override )
+ for( ITEM* item : aNode->m_override )
Remove( item );
- for( PNS_INDEX::ITEM_SET::iterator i = aNode->m_index->begin();
+ for( INDEX::ITEM_SET::iterator i = aNode->m_index->begin();
i != aNode->m_index->end(); ++i )
{
(*i)->SetRank( -1 );
@@ -1194,38 +1194,38 @@ void PNS_NODE::Commit( PNS_NODE* aNode )
}
-void PNS_NODE::KillChildren()
+void NODE::KillChildren()
{
assert( isRoot() );
releaseChildren();
}
-void PNS_NODE::AllItemsInNet( int aNet, std::set<PNS_ITEM*>& aItems )
+void NODE::AllItemsInNet( int aNet, std::set<ITEM*>& aItems )
{
- PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aNet );
+ INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aNet );
if( l_cur )
{
- for( PNS_ITEM*item : *l_cur )
+ for( ITEM*item : *l_cur )
aItems.insert( item );
}
if( !isRoot() )
{
- PNS_INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet );
+ INDEX::NET_ITEMS_LIST* l_root = m_root->m_index->GetItemsForNet( aNet );
if( l_root )
- for( PNS_INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i )
+ for( INDEX::NET_ITEMS_LIST::iterator i = l_root->begin(); i!= l_root->end(); ++i )
if( !Overrides( *i ) )
aItems.insert( *i );
}
}
-void PNS_NODE::ClearRanks( int aMarkerMask )
+void NODE::ClearRanks( int aMarkerMask )
{
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
{
(*i)->SetRank( -1 );
(*i)->Mark( (*i)->Marker() & (~aMarkerMask) );
@@ -1233,9 +1233,9 @@ void PNS_NODE::ClearRanks( int aMarkerMask )
}
-int PNS_NODE::FindByMarker( int aMarker, PNS_ITEMSET& aItems )
+int NODE::FindByMarker( int aMarker, ITEM_SET& aItems )
{
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
{
if( (*i)->Marker() & aMarker )
aItems.Add( *i );
@@ -1245,11 +1245,11 @@ int PNS_NODE::FindByMarker( int aMarker, PNS_ITEMSET& aItems )
}
-int PNS_NODE::RemoveByMarker( int aMarker )
+int NODE::RemoveByMarker( int aMarker )
{
- std::list<PNS_ITEM*> garbage;
+ std::list<ITEM*> garbage;
- for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
+ for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
{
if( (*i)->Marker() & aMarker )
{
@@ -1257,7 +1257,7 @@ int PNS_NODE::RemoveByMarker( int aMarker )
}
}
- for( std::list<PNS_ITEM*>::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i )
+ for( std::list<ITEM*>::const_iterator i = garbage.begin(), end = garbage.end(); i != end; ++i )
{
Remove( *i );
}
@@ -1266,18 +1266,18 @@ int PNS_NODE::RemoveByMarker( int aMarker )
}
-PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
+SEGMENT* NODE::findRedundantSegment( SEGMENT* aSeg )
{
- PNS_JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg );
+ JOINT* jtStart = FindJoint( aSeg->Seg().A, aSeg );
if( !jtStart )
return NULL;
- for( PNS_ITEM* item : jtStart->LinkList() )
+ for( ITEM* item : jtStart->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( item->OfKind( ITEM::SEGMENT_T ) )
{
- PNS_SEGMENT* seg2 = (PNS_SEGMENT*) item;
+ SEGMENT* seg2 = (SEGMENT*) item;
const VECTOR2I a1( aSeg->Seg().A );
const VECTOR2I b1( aSeg->Seg().B );
@@ -1295,11 +1295,11 @@ PNS_SEGMENT* PNS_NODE::findRedundantSegment( PNS_SEGMENT* aSeg )
}
-PNS_ITEM *PNS_NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
+ITEM *NODE::FindItemByParent( const BOARD_CONNECTED_ITEM* aParent )
{
- PNS_INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
+ INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( aParent->GetNetCode() );
- for( PNS_ITEM*item : *l_cur )
+ for( ITEM*item : *l_cur )
if( item->Parent() == aParent )
return item;
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index b56d674..80965ef 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -39,46 +39,46 @@
namespace PNS {
-class PNS_SEGMENT;
-class PNS_LINE;
-class PNS_SOLID;
-class PNS_VIA;
-class PNS_INDEX;
-class PNS_ROUTER;
-class PNS_NODE;
+class SEGMENT;
+class LINE;
+class SOLID;
+class VIA;
+class INDEX;
+class ROUTER;
+class NODE;
/**
- * Class PNS_RULE_RESOLVER
+ * Class RULE_RESOLVER
*
* An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between two items.
**/
-class PNS_RULE_RESOLVER
+class RULE_RESOLVER
{
public:
- virtual ~PNS_RULE_RESOLVER() {}
+ virtual ~RULE_RESOLVER() {}
- virtual int Clearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) = 0;
+ virtual int Clearance( const ITEM* aA, const ITEM* aB ) = 0;
virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) = 0;
virtual void UseDpGap( bool aUseDpGap ) = 0;
virtual int DpCoupledNet( int aNet ) = 0;
virtual int DpNetPolarity( int aNet ) = 0;
- virtual bool DpNetPair( PNS_ITEM* aItem, int& aNetP, int& aNetN ) = 0;
+ virtual bool DpNetPair( ITEM* aItem, int& aNetP, int& aNetN ) = 0;
};
/**
- * Struct PNS_OBSTACLE
+ * Struct OBSTACLE
*
* Holds an object colliding with another object, along with
* some useful data about the collision.
**/
-struct PNS_OBSTACLE
+struct OBSTACLE
{
///> Item we search collisions with
- const PNS_ITEM* m_head;
+ const ITEM* m_head;
///> Item found to be colliding with m_head
- PNS_ITEM* m_item;
+ ITEM* m_item;
///> Hull of the colliding m_item
SHAPE_LINE_CHAIN m_hull;
@@ -92,37 +92,37 @@ struct PNS_OBSTACLE
};
/**
- * Struct PNS_OBSTACLE_VISITOR
+ * Struct OBSTACLE_VISITOR
**/
-class PNS_OBSTACLE_VISITOR {
+class OBSTACLE_VISITOR {
public:
- PNS_OBSTACLE_VISITOR( const PNS_ITEM* aItem );
+ OBSTACLE_VISITOR( const ITEM* aItem );
- void SetWorld( const PNS_NODE* aNode, const PNS_NODE* aOverride = NULL );
+ void SetWorld( const NODE* aNode, const NODE* aOverride = NULL );
- virtual bool operator()( PNS_ITEM* aCandidate ) = 0;
+ virtual bool operator()( ITEM* aCandidate ) = 0;
protected:
- bool visit( PNS_ITEM* aCandidate );
+ bool visit( ITEM* aCandidate );
///> the item we are looking for collisions with
- const PNS_ITEM* m_item;
+ const ITEM* m_item;
///> node we are searching in (either root or a branch)
- const PNS_NODE* m_node;
+ const NODE* m_node;
///> node that overrides root entries
- const PNS_NODE* m_override;
+ const NODE* m_override;
///> additional clearance
int m_extraClearance;
};
/**
- * Class PNS_NODE
+ * Class NODE
*
* Keeps the router "world" - i.e. all the tracks, vias, solids in a
* hierarchical and indexed way.
@@ -133,18 +133,18 @@ protected:
* - lightweight cloning/branching (for recursive optimization and shove
* springback)
**/
-class PNS_NODE
+class NODE
{
public:
- typedef boost::optional<PNS_OBSTACLE> OPT_OBSTACLE;
- typedef std::vector<PNS_ITEM*> ITEM_VECTOR;
- typedef std::vector<PNS_OBSTACLE> OBSTACLES;
+ typedef boost::optional<OBSTACLE> OPT_OBSTACLE;
+ typedef std::vector<ITEM*> ITEM_VECTOR;
+ typedef std::vector<OBSTACLE> OBSTACLES;
- PNS_NODE();
- ~PNS_NODE();
+ NODE();
+ ~NODE();
///> Returns the expected clearance between items a and b.
- int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
+ int GetClearance( const ITEM* aA, const ITEM* aB ) const;
///> Returns the pre-set worst case clearance between any pair of items
int GetMaxClearance() const
@@ -159,12 +159,12 @@ public:
}
///> Assigns a clerance resolution function object
- void SetRuleResolver( PNS_RULE_RESOLVER* aFunc )
+ void SetRuleResolver( RULE_RESOLVER* aFunc )
{
m_ruleResolver = aFunc;
}
- PNS_RULE_RESOLVER* GetRuleResolver()
+ RULE_RESOLVER* GetRuleResolver()
{
return m_ruleResolver;
}
@@ -191,15 +191,15 @@ public:
* @param aLimitCount stop looking for collisions after finding this number of colliding items
* @return number of obstacles found
*/
- int QueryColliding( const PNS_ITEM* aItem,
- OBSTACLES& aObstacles,
- int aKindMask = PNS_ITEM::ANY_T,
- int aLimitCount = -1,
- bool aDifferentNetsOnly = true,
- int aForceClearance = -1 );
-
- int QueryColliding( const PNS_ITEM* aItem,
- PNS_OBSTACLE_VISITOR& aVisitor
+ int QueryColliding( const ITEM* aItem,
+ OBSTACLES& aObstacles,
+ int aKindMask = ITEM::ANY_T,
+ int aLimitCount = -1,
+ bool aDifferentNetsOnly = true,
+ int aForceClearance = -1 );
+
+ int QueryColliding( const ITEM* aItem,
+ OBSTACLE_VISITOR& aVisitor
);
/**
@@ -211,9 +211,9 @@ public:
* @param aKindMask mask of obstacle types to take into account
* @return the obstacle, if found, otherwise empty.
*/
- OPT_OBSTACLE NearestObstacle( const PNS_LINE* aItem,
- int aKindMask = PNS_ITEM::ANY_T,
- const std::set<PNS_ITEM*>* aRestrictedSet = NULL );
+ OPT_OBSTACLE NearestObstacle( const LINE* aItem,
+ int aKindMask = ITEM::ANY_T,
+ const std::set<ITEM*>* aRestrictedSet = NULL );
/**
* Function CheckColliding()
@@ -224,8 +224,8 @@ public:
* @param aKindMask mask of obstacle types to take into account
* @return the obstacle, if found, otherwise empty.
*/
- OPT_OBSTACLE CheckColliding( const PNS_ITEM* aItem,
- int aKindMask = PNS_ITEM::ANY_T );
+ OPT_OBSTACLE CheckColliding( const ITEM* aItem,
+ int aKindMask = ITEM::ANY_T );
/**
@@ -237,8 +237,8 @@ public:
* @param aKindMask mask of obstacle types to take into account
* @return the obstacle, if found, otherwise empty.
*/
- OPT_OBSTACLE CheckColliding( const PNS_ITEMSET& aSet,
- int aKindMask = PNS_ITEM::ANY_T );
+ OPT_OBSTACLE CheckColliding( const ITEM_SET& aSet,
+ int aKindMask = ITEM::ANY_T );
/**
@@ -251,10 +251,10 @@ public:
* @param aKindMask mask of obstacle types to take into account
* @return the obstacle, if found, otherwise empty.
*/
- bool CheckColliding( const PNS_ITEM* aItemA,
- const PNS_ITEM* aItemB,
- int aKindMask = PNS_ITEM::ANY_T,
- int aForceClearance = -1 );
+ bool CheckColliding( const ITEM* aItemA,
+ const ITEM* aItemB,
+ int aKindMask = ITEM::ANY_T,
+ int aForceClearance = -1 );
/**
* Function HitTest()
@@ -263,7 +263,7 @@ public:
* @param aPoint the point
* @return the items
*/
- const PNS_ITEMSET HitTest( const VECTOR2I& aPoint ) const;
+ const ITEM_SET HitTest( const VECTOR2I& aPoint ) const;
/**
* Function Add()
@@ -273,7 +273,7 @@ public:
* @param aAllowRedundant if true, duplicate items are allowed (e.g. a segment or via
* at the same coordinates as an existing one)
*/
- void Add( PNS_ITEM* aItem, bool aAllowRedundant = false );
+ void Add( ITEM* aItem, bool aAllowRedundant = false );
/**
* Function Remove()
@@ -281,7 +281,7 @@ public:
* Just as the name says, removes an item from this branch.
* @param aItem item to remove
*/
- void Remove( PNS_ITEM* aItem );
+ void Remove( ITEM* aItem );
/**
* Function Remove()
@@ -289,7 +289,7 @@ public:
* Just as the name says, removes a line from this branch.
* @param aItem item to remove
*/
- void Remove( PNS_LINE& aLine );
+ void Remove( LINE& aLine );
/**
* Function Replace()
@@ -298,7 +298,7 @@ public:
* @param aOldItem item to be removed
* @param aNewItem item add instead
*/
- void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem );
+ void Replace( ITEM* aOldItem, ITEM* aNewItem );
/**
* Function Branch()
@@ -308,7 +308,7 @@ public:
* any branches in use, their parents must NOT be deleted.
* @return the new branch
*/
- PNS_NODE* Branch();
+ NODE* Branch();
/**
* Function AssembleLine()
@@ -319,7 +319,7 @@ public:
* @param aOriginSegmentIndex index of aSeg in the resulting line
* @return the line
*/
- const PNS_LINE AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex = NULL,
+ const LINE AssembleLine( SEGMENT* aSeg, int* aOriginSegmentIndex = NULL,
bool aStopAtLockedJoints = false );
///> Prints the contents and joints structure
@@ -342,7 +342,7 @@ public:
* a non-root branch will fail. Calling commit also kills all children nodes of the root branch.
* @param aNode node to commit changes from
*/
- void Commit( PNS_NODE* aNode );
+ void Commit( NODE* aNode );
/**
* Function FindJoint()
@@ -350,9 +350,9 @@ public:
* Searches for a joint at a given position, layer and belonging to given net.
* @return the joint, if found, otherwise empty
*/
- PNS_JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, int aNet );
+ JOINT* FindJoint( const VECTOR2I& aPos, int aLayer, int aNet );
- void LockJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem, bool aLock );
+ void LockJoint( const VECTOR2I& aPos, const ITEM* aItem, bool aLock );
/**
* Function FindJoint()
@@ -360,38 +360,38 @@ public:
* Searches for a joint at a given position, linked to given item.
* @return the joint, if found, otherwise empty
*/
- PNS_JOINT* FindJoint( const VECTOR2I& aPos, const PNS_ITEM* aItem )
+ JOINT* FindJoint( const VECTOR2I& aPos, const ITEM* aItem )
{
return FindJoint( aPos, aItem->Layers().Start(), aItem->Net() );
}
#if 0
- void MapConnectivity( PNS_JOINT* aStart, std::vector<PNS_JOINT*> & aFoundJoints );
+ void MapConnectivity( JOINT* aStart, std::vector<JOINT*> & aFoundJoints );
- PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL,
- int aKindMask = PNS_ITEM::ANY_T);
+ ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = NULL,
+ int aKindMask = ITEM::ANY_T);
#endif
///> finds all lines between a pair of joints. Used by the loop removal procedure.
- int FindLinesBetweenJoints( PNS_JOINT& aA,
- PNS_JOINT& aB,
- std::vector<PNS_LINE>& aLines );
+ int FindLinesBetweenJoints( JOINT& aA,
+ JOINT& aB,
+ std::vector<LINE>& aLines );
///> finds the joints corresponding to the ends of line aLine
- void FindLineEnds( const PNS_LINE& aLine, PNS_JOINT& aA, PNS_JOINT& aB );
+ void FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB );
///> Destroys all child nodes. Applicable only to the root node.
void KillChildren();
- void AllItemsInNet( int aNet, std::set<PNS_ITEM*>& aItems );
+ void AllItemsInNet( int aNet, std::set<ITEM*>& aItems );
void ClearRanks( int aMarkerMask = MK_HEAD | MK_VIOLATION );
- int FindByMarker( int aMarker, PNS_ITEMSET& aItems );
+ int FindByMarker( int aMarker, ITEM_SET& aItems );
int RemoveByMarker( int aMarker );
- PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent );
+ ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM* aParent );
bool HasChildren() const
{
@@ -400,44 +400,44 @@ public:
///> checks if this branch contains an updated version of the m_item
///> from the root branch.
- bool Overrides( PNS_ITEM* aItem ) const
+ bool Overrides( ITEM* aItem ) const
{
return m_override.find( aItem ) != m_override.end();
}
private:
struct DEFAULT_OBSTACLE_VISITOR;
- typedef boost::unordered_multimap<PNS_JOINT::HASH_TAG, PNS_JOINT> JOINT_MAP;
+ typedef boost::unordered_multimap<JOINT::HASH_TAG, JOINT> JOINT_MAP;
typedef JOINT_MAP::value_type TagJointPair;
/// nodes are not copyable
- PNS_NODE( const PNS_NODE& aB );
- PNS_NODE& operator=( const PNS_NODE& aB );
+ NODE( const NODE& aB );
+ NODE& operator=( const NODE& aB );
///> tries to find matching joint and creates a new one if not found
- PNS_JOINT& touchJoint( const VECTOR2I& aPos,
- const PNS_LAYERSET& aLayers,
- int aNet );
+ JOINT& touchJoint( const VECTOR2I& aPos,
+ const LAYER_RANGE& aLayers,
+ int aNet );
///> touches a joint and links it to an m_item
- void linkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
- int aNet, PNS_ITEM* aWhere );
+ void linkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere );
///> unlinks an item from a joint
- void unlinkJoint( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
- int aNet, PNS_ITEM* aWhere );
+ void unlinkJoint( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
+ int aNet, ITEM* aWhere );
///> helpers for adding/removing items
- void addSolid( PNS_SOLID* aSeg );
- void addSegment( PNS_SEGMENT* aSeg, bool aAllowRedundant );
- void addLine( PNS_LINE* aLine, bool aAllowRedundant );
- void addVia( PNS_VIA* aVia );
- void removeSolid( PNS_SOLID* aSeg );
- void removeLine( PNS_LINE* aLine );
- void removeSegment( PNS_SEGMENT* aSeg );
- void removeVia( PNS_VIA* aVia );
-
- void doRemove( PNS_ITEM* aItem );
+ void addSolid( SOLID* aSeg );
+ void addSegment( SEGMENT* aSeg, bool aAllowRedundant );
+ void addLine( LINE* aLine, bool aAllowRedundant );
+ void addVia( VIA* aVia );
+ void removeSolid( SOLID* aSeg );
+ void removeLine( LINE* aLine );
+ void removeSegment( SEGMENT* aSeg );
+ void removeVia( VIA* aVia );
+
+ void doRemove( ITEM* aItem );
void unlinkParent();
void releaseChildren();
void releaseGarbage();
@@ -447,47 +447,47 @@ private:
return m_parent == NULL;
}
- PNS_SEGMENT* findRedundantSegment( PNS_SEGMENT* aSeg );
+ SEGMENT* findRedundantSegment( SEGMENT* aSeg );
///> scans the joint map, forming a line starting from segment (current).
- void followLine( PNS_SEGMENT* aCurrent,
- bool aScanDirection,
- int& aPos,
- int aLimit,
- VECTOR2I* aCorners,
- PNS_SEGMENT** aSegments,
- bool& aGuardHit,
- bool aStopAtLockedJoints );
+ void followLine( SEGMENT* aCurrent,
+ bool aScanDirection,
+ int& aPos,
+ int aLimit,
+ VECTOR2I* aCorners,
+ SEGMENT** aSegments,
+ bool& aGuardHit,
+ bool aStopAtLockedJoints );
///> hash table with the joints, linking the items. Joints are hashed by
///> their position, layer set and net.
JOINT_MAP m_joints;
///> node this node was branched from
- PNS_NODE* m_parent;
+ NODE* m_parent;
///> root node of the whole hierarchy
- PNS_NODE* m_root;
+ NODE* m_root;
///> list of nodes branched from this one
- std::set<PNS_NODE*> m_children;
+ std::set<NODE*> m_children;
///> hash of root's items that have been changed in this node
- boost::unordered_set<PNS_ITEM*> m_override;
+ boost::unordered_set<ITEM*> m_override;
///> worst case item-item clearance
int m_maxClearance;
///> Design rules resolver
- PNS_RULE_RESOLVER* m_ruleResolver;
+ RULE_RESOLVER* m_ruleResolver;
///> Geometric/Net index of the items
- PNS_INDEX* m_index;
+ INDEX* m_index;
///> depth of the node (number of parent nodes in the inheritance chain)
int m_depth;
- boost::unordered_set<PNS_ITEM*> m_garbageItems;
+ boost::unordered_set<ITEM*> m_garbageItems;
};
}
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index a2af3c1..6a22193 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -38,7 +38,7 @@ namespace PNS {
/**
* Cost Estimator Methods
*/
-int PNS_COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB )
+int COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB )
{
DIRECTION_45 dir_a( aA ), dir_b( aB );
@@ -65,7 +65,7 @@ int PNS_COST_ESTIMATOR::CornerCost( const SEG& aA, const SEG& aB )
}
-int PNS_COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine )
+int COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine )
{
int total = 0;
@@ -76,27 +76,27 @@ int PNS_COST_ESTIMATOR::CornerCost( const SHAPE_LINE_CHAIN& aLine )
}
-int PNS_COST_ESTIMATOR::CornerCost( const PNS_LINE& aLine )
+int COST_ESTIMATOR::CornerCost( const LINE& aLine )
{
return CornerCost( aLine.CLine() );
}
-void PNS_COST_ESTIMATOR::Add( PNS_LINE& aLine )
+void COST_ESTIMATOR::Add( LINE& aLine )
{
m_lengthCost += aLine.CLine().Length();
m_cornerCost += CornerCost( aLine );
}
-void PNS_COST_ESTIMATOR::Remove( PNS_LINE& aLine )
+void COST_ESTIMATOR::Remove( LINE& aLine )
{
m_lengthCost -= aLine.CLine().Length();
m_cornerCost -= CornerCost( aLine );
}
-void PNS_COST_ESTIMATOR::Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine )
+void COST_ESTIMATOR::Replace( LINE& aOldLine, LINE& aNewLine )
{
m_lengthCost -= aOldLine.CLine().Length();
m_cornerCost -= CornerCost( aOldLine );
@@ -105,7 +105,7 @@ void PNS_COST_ESTIMATOR::Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine )
}
-bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther,
+bool COST_ESTIMATOR::IsBetter( COST_ESTIMATOR& aOther,
double aLengthTolerance,
double aCornerTolerance ) const
{
@@ -123,9 +123,9 @@ bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther,
/**
* Optimizer
**/
-PNS_OPTIMIZER::PNS_OPTIMIZER( PNS_NODE* aWorld ) :
+OPTIMIZER::OPTIMIZER( NODE* aWorld ) :
m_world( aWorld ),
- m_collisionKindMask( PNS_ITEM::ANY_T ),
+ m_collisionKindMask( ITEM::ANY_T ),
m_effortLevel( MERGE_SEGMENTS ),
m_keepPostures( false ),
m_restrictAreaActive( false )
@@ -133,21 +133,21 @@ PNS_OPTIMIZER::PNS_OPTIMIZER( PNS_NODE* aWorld ) :
}
-PNS_OPTIMIZER::~PNS_OPTIMIZER()
+OPTIMIZER::~OPTIMIZER()
{
}
-struct PNS_OPTIMIZER::CACHE_VISITOR
+struct OPTIMIZER::CACHE_VISITOR
{
- CACHE_VISITOR( const PNS_ITEM* aOurItem, PNS_NODE* aNode, int aMask ) :
+ CACHE_VISITOR( const ITEM* aOurItem, NODE* aNode, int aMask ) :
m_ourItem( aOurItem ),
m_collidingItem( NULL ),
m_node( aNode ),
m_mask( aMask )
{}
- bool operator()( PNS_ITEM* aOtherItem )
+ bool operator()( ITEM* aOtherItem )
{
if( !( m_mask & aOtherItem->Kind() ) )
return true;
@@ -161,14 +161,14 @@ struct PNS_OPTIMIZER::CACHE_VISITOR
return false;
}
- const PNS_ITEM* m_ourItem;
- PNS_ITEM* m_collidingItem;
- PNS_NODE* m_node;
+ const ITEM* m_ourItem;
+ ITEM* m_collidingItem;
+ NODE* m_node;
int m_mask;
};
-void PNS_OPTIMIZER::cacheAdd( PNS_ITEM* aItem, bool aIsStatic = false )
+void OPTIMIZER::cacheAdd( ITEM* aItem, bool aIsStatic = false )
{
if( m_cacheTags.find( aItem ) != m_cacheTags.end() )
return;
@@ -179,9 +179,9 @@ void PNS_OPTIMIZER::cacheAdd( PNS_ITEM* aItem, bool aIsStatic = false )
}
-void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int aEndVertex )
+void OPTIMIZER::removeCachedSegments( LINE* aLine, int aStartVertex, int aEndVertex )
{
- PNS_LINE::SEGMENT_REFS* segs = aLine->LinkedSegments();
+ LINE::SEGMENT_REFS* segs = aLine->LinkedSegments();
if( !segs )
return;
@@ -191,27 +191,27 @@ void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int
for( int i = aStartVertex; i < aEndVertex - 1; i++ )
{
- PNS_SEGMENT* s = (*segs)[i];
+ SEGMENT* s = (*segs)[i];
m_cacheTags.erase( s );
m_cache.Remove( s );
}
}
-void PNS_OPTIMIZER::CacheRemove( PNS_ITEM* aItem )
+void OPTIMIZER::CacheRemove( ITEM* aItem )
{
- if( aItem->Kind() == PNS_ITEM::LINE_T )
- removeCachedSegments( static_cast<PNS_LINE*>( aItem ) );
+ if( aItem->Kind() == ITEM::LINE_T )
+ removeCachedSegments( static_cast<LINE*>( aItem ) );
}
-void PNS_OPTIMIZER::CacheStaticItem( PNS_ITEM* aItem )
+void OPTIMIZER::CacheStaticItem( ITEM* aItem )
{
cacheAdd( aItem, true );
}
-void PNS_OPTIMIZER::ClearCache( bool aStaticOnly )
+void OPTIMIZER::ClearCache( bool aStaticOnly )
{
if( !aStaticOnly )
{
@@ -237,12 +237,12 @@ class LINE_RESTRICTIONS
LINE_RESTRICTIONS() {};
~LINE_RESTRICTIONS() {};
- void Build( PNS_NODE* aWorld, PNS_LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable );
+ void Build( NODE* aWorld, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable );
bool Check ( int aVertex1, int aVertex2, const SHAPE_LINE_CHAIN& aReplacement );
void Dump();
private:
- int allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, const VECTOR2I& aP, bool aFirst );
+ int allowedAngles( NODE* aWorld, const LINE* aLine, const VECTOR2I& aP, bool aFirst );
struct RVERTEX
{
@@ -261,9 +261,9 @@ class LINE_RESTRICTIONS
// fixme: use later
-int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, const VECTOR2I& aP, bool aFirst )
+int LINE_RESTRICTIONS::allowedAngles( NODE* aWorld, const LINE* aLine, const VECTOR2I& aP, bool aFirst )
{
- PNS_JOINT* jt = aWorld->FindJoint( aP , aLine );
+ JOINT* jt = aWorld->FindJoint( aP , aLine );
if( !jt )
return 0xff;
@@ -272,11 +272,11 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c
int n_dirs = 0;
- for( const PNS_ITEM* item : jt->Links().CItems() )
+ for( const ITEM* item : jt->Links().CItems() )
{
- if( item->OfKind( PNS_ITEM::VIA_T ) || item->OfKind( PNS_ITEM::SOLID_T ) )
+ if( item->OfKind( ITEM::VIA_T ) || item->OfKind( ITEM::SOLID_T ) )
return 0xff;
- else if( const PNS_SEGMENT* seg = dyn_cast<const PNS_SEGMENT*>( item ) )
+ else if( const SEGMENT* seg = dyn_cast<const SEGMENT*>( item ) )
{
SEG s = seg->Seg();
if( s.A != aP )
@@ -306,7 +306,7 @@ int LINE_RESTRICTIONS::allowedAngles( PNS_NODE* aWorld, const PNS_LINE* aLine, c
}
-void LINE_RESTRICTIONS::Build( PNS_NODE* aWorld, PNS_LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable )
+void LINE_RESTRICTIONS::Build( NODE* aWorld, LINE* aOriginLine, const SHAPE_LINE_CHAIN& aLine, const BOX2I& aRestrictedArea, bool aRestrictedAreaEnable )
{
const SHAPE_LINE_CHAIN& l = aLine;
VECTOR2I v_prev;
@@ -383,7 +383,7 @@ bool LINE_RESTRICTIONS::Check( int aVertex1, int aVertex2, const SHAPE_LINE_CHAI
}
-bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache )
+bool OPTIMIZER::checkColliding( ITEM* aItem, bool aUpdateCache )
{
CACHE_VISITOR v( aItem, m_world, m_collisionKindMask );
@@ -395,7 +395,7 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache )
if( !v.m_collidingItem )
{
- PNS_NODE::OPT_OBSTACLE obs = m_world->CheckColliding( aItem );
+ NODE::OPT_OBSTACLE obs = m_world->CheckColliding( aItem );
if( obs )
{
@@ -416,15 +416,15 @@ bool PNS_OPTIMIZER::checkColliding( PNS_ITEM* aItem, bool aUpdateCache )
}
-bool PNS_OPTIMIZER::checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath )
+bool OPTIMIZER::checkColliding( LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath )
{
- PNS_LINE tmp( *aLine, aOptPath );
+ LINE tmp( *aLine, aOptPath );
return checkColliding( &tmp );
}
-bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine )
+bool OPTIMIZER::mergeObtuse( LINE* aLine )
{
SHAPE_LINE_CHAIN& line = aLine->Line();
@@ -483,7 +483,7 @@ bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine )
opt_path.Append( s1opt.B );
opt_path.Append( s2opt.B );
- PNS_LINE opt_track( *aLine, opt_path );
+ LINE opt_track( *aLine, opt_path );
if( !checkColliding( &opt_track ) )
{
@@ -515,7 +515,7 @@ bool PNS_OPTIMIZER::mergeObtuse( PNS_LINE* aLine )
}
-bool PNS_OPTIMIZER::mergeFull( PNS_LINE* aLine )
+bool OPTIMIZER::mergeFull( LINE* aLine )
{
SHAPE_LINE_CHAIN& line = aLine->Line();
int step = line.SegmentCount() - 1;
@@ -552,7 +552,7 @@ bool PNS_OPTIMIZER::mergeFull( PNS_LINE* aLine )
}
-bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, PNS_LINE* aResult )
+bool OPTIMIZER::Optimize( LINE* aLine, LINE* aResult )
{
if( !aResult )
aResult = aLine;
@@ -579,12 +579,12 @@ bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, PNS_LINE* aResult )
}
-bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step )
+bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step )
{
int n = 0;
int n_segs = aCurrentPath.SegmentCount();
- int cost_orig = PNS_COST_ESTIMATOR::CornerCost( aCurrentPath );
+ int cost_orig = COST_ESTIMATOR::CornerCost( aCurrentPath );
LINE_RESTRICTIONS restr;
@@ -623,7 +623,7 @@ bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath,
path[i] = aCurrentPath;
path[i].Replace( s1.Index(), s2.Index(), bypass );
path[i].Simplify();
- cost[i] = PNS_COST_ESTIMATOR::CornerCost( path[i] );
+ cost[i] = COST_ESTIMATOR::CornerCost( path[i] );
}
}
@@ -646,7 +646,7 @@ bool PNS_OPTIMIZER::mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath,
}
-PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::circleBreakouts( int aWidth,
+OPTIMIZER::BREAKOUT_LIST OPTIMIZER::circleBreakouts( int aWidth,
const SHAPE* aShape, bool aPermitDiagonal ) const
{
BREAKOUT_LIST breakouts;
@@ -666,7 +666,7 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::circleBreakouts( int aWidth,
}
-PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::convexBreakouts( int aWidth,
+OPTIMIZER::BREAKOUT_LIST OPTIMIZER::convexBreakouts( int aWidth,
const SHAPE* aShape, bool aPermitDiagonal ) const
{
BREAKOUT_LIST breakouts;
@@ -708,7 +708,7 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::convexBreakouts( int aWidth,
}
-PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::rectBreakouts( int aWidth,
+OPTIMIZER::BREAKOUT_LIST OPTIMIZER::rectBreakouts( int aWidth,
const SHAPE* aShape, bool aPermitDiagonal ) const
{
const SHAPE_RECT* rect = static_cast<const SHAPE_RECT*>(aShape);
@@ -762,18 +762,18 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::rectBreakouts( int aWidth,
}
-PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::computeBreakouts( int aWidth,
- const PNS_ITEM* aItem, bool aPermitDiagonal ) const
+OPTIMIZER::BREAKOUT_LIST OPTIMIZER::computeBreakouts( int aWidth,
+ const ITEM* aItem, bool aPermitDiagonal ) const
{
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA_T:
+ case ITEM::VIA_T:
{
- const PNS_VIA* via = static_cast<const PNS_VIA*>( aItem );
+ const VIA* via = static_cast<const VIA*>( aItem );
return circleBreakouts( aWidth, via->Shape(), aPermitDiagonal );
}
- case PNS_ITEM::SOLID_T:
+ case ITEM::SOLID_T:
{
const SHAPE* shape = aItem->Shape();
@@ -808,16 +808,16 @@ PNS_OPTIMIZER::BREAKOUT_LIST PNS_OPTIMIZER::computeBreakouts( int aWidth,
}
-PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const
+ITEM* OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const
{
- PNS_JOINT* jt = m_world->FindJoint( aP, aLayer, aNet );
+ JOINT* jt = m_world->FindJoint( aP, aLayer, aNet );
if( !jt )
return NULL;
- for( PNS_ITEM* item : jt->LinkList() )
+ for( ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) )
+ if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
return item;
}
@@ -825,9 +825,9 @@ PNS_ITEM* PNS_OPTIMIZER::findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP
}
-int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex )
+int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVertex )
{
- int min_cost = INT_MAX; // PNS_COST_ESTIMATOR::CornerCost( line );
+ int min_cost = INT_MAX; // COST_ESTIMATOR::CornerCost( line );
int min_len = INT_MAX;
DIRECTION_45 dir;
@@ -837,7 +837,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
typedef std::pair<int, SHAPE_LINE_CHAIN> RtVariant;
std::vector<RtVariant> variants;
- PNS_SOLID* solid = dyn_cast<PNS_SOLID*>( aPad );
+ SOLID* solid = dyn_cast<SOLID*>( aPad );
// don't do auto-neckdown for offset pads
if( solid && solid->Offset() != VECTOR2I( 0, 0 ) )
@@ -882,7 +882,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
for( int i = p + 1; i < line.PointCount(); i++ )
v.Append( line.CPoint( i ) );
- PNS_LINE tmp( *aLine, v );
+ LINE tmp( *aLine, v );
int cc = tmp.CountCorners( ForbiddenAngles );
if( cc == 0 )
@@ -903,8 +903,8 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
for( RtVariant& vp : variants )
{
- PNS_LINE tmp( *aLine, vp.second );
- int cost = PNS_COST_ESTIMATOR::CornerCost( vp.second );
+ LINE tmp( *aLine, vp.second );
+ int cost = COST_ESTIMATOR::CornerCost( vp.second );
int len = vp.second.Length();
if( !checkColliding( &tmp ) )
@@ -932,7 +932,7 @@ int PNS_OPTIMIZER::smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd,
return -1;
}
-bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine )
+bool OPTIMIZER::runSmartPads( LINE* aLine )
{
SHAPE_LINE_CHAIN& line = aLine->Line();
@@ -941,8 +941,8 @@ bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine )
VECTOR2I p_start = line.CPoint( 0 ), p_end = line.CPoint( -1 );
- PNS_ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start );
- PNS_ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end );
+ ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start );
+ ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end );
int vtx = -1;
@@ -959,9 +959,9 @@ bool PNS_OPTIMIZER::runSmartPads( PNS_LINE* aLine )
}
-bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorld )
+bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld )
{
- PNS_OPTIMIZER opt( aWorld );
+ OPTIMIZER opt( aWorld );
opt.SetEffortLevel( aEffortLevel );
opt.SetCollisionMask( -1 );
@@ -969,15 +969,15 @@ bool PNS_OPTIMIZER::Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorl
}
-bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine )
+bool OPTIMIZER::fanoutCleanup( LINE* aLine )
{
if( aLine->PointCount() < 3 )
return false;
VECTOR2I p_start = aLine->CPoint( 0 ), p_end = aLine->CPoint( -1 );
- PNS_ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start );
- PNS_ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end );
+ ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start );
+ ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end );
int thr = aLine->Width() * 10;
int len = aLine->CLine().Length();
@@ -985,12 +985,12 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine )
if( !startPad )
return false;
- bool startMatch = startPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T );
+ bool startMatch = startPad->OfKind( ITEM::VIA_T | ITEM::SOLID_T );
bool endMatch = false;
if(endPad)
{
- endMatch = endPad->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T );
+ endMatch = endPad->OfKind( ITEM::VIA_T | ITEM::SOLID_T );
}
else
{
@@ -1002,8 +1002,8 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine )
for( int i = 0; i < 2; i++ )
{
SHAPE_LINE_CHAIN l2 = DIRECTION_45().BuildInitialTrace( p_start, p_end, i );
- PNS_LINE repl;
- repl = PNS_LINE( *aLine, l2 );
+ LINE repl;
+ repl = LINE( *aLine, l2 );
if( !m_world->CheckColliding( &repl ) )
{
@@ -1017,7 +1017,7 @@ bool PNS_OPTIMIZER::fanoutCleanup( PNS_LINE* aLine )
}
-int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHAPE_LINE_CHAIN& aCoupled, PNS_DIFF_PAIR* aPair, int* aIndices )
+int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHAPE_LINE_CHAIN& aCoupled, DIFF_PAIR* aPair, int* aIndices )
{
int count = 0;
for ( int i = 0; i < aCoupled.SegmentCount(); i++ )
@@ -1041,12 +1041,12 @@ int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHA
}
-bool verifyDpBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aNewRef, const SHAPE_LINE_CHAIN& aNewCoupled )
+bool verifyDpBypass( NODE* aNode, DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aNewRef, const SHAPE_LINE_CHAIN& aNewCoupled )
{
- PNS_LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef );
- PNS_LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled );
+ LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef );
+ LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled );
- if( aNode->CheckColliding( &refLine, &coupledLine, PNS_ITEM::ANY_T, aPair->Gap() - 10 ) )
+ if( aNode->CheckColliding( &refLine, &coupledLine, ITEM::ANY_T, aPair->Gap() - 10 ) )
return false;
if( aNode->CheckColliding ( &refLine ) )
@@ -1059,7 +1059,7 @@ bool verifyDpBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const
}
-bool coupledBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aRef, const SHAPE_LINE_CHAIN& aRefBypass, const SHAPE_LINE_CHAIN& aCoupled, SHAPE_LINE_CHAIN& aNewCoupled )
+bool coupledBypass( NODE* aNode, DIFF_PAIR* aPair, bool aRefIsP, const SHAPE_LINE_CHAIN& aRef, const SHAPE_LINE_CHAIN& aRefBypass, const SHAPE_LINE_CHAIN& aCoupled, SHAPE_LINE_CHAIN& aNewCoupled )
{
int vStartIdx[1024]; // fixme: possible overflow
@@ -1112,15 +1112,15 @@ bool coupledBypass( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aRefIsP, const S
}
-bool checkDpColliding( PNS_NODE* aNode, PNS_DIFF_PAIR* aPair, bool aIsP, const SHAPE_LINE_CHAIN& aPath )
+bool checkDpColliding( NODE* aNode, DIFF_PAIR* aPair, bool aIsP, const SHAPE_LINE_CHAIN& aPath )
{
- PNS_LINE tmp ( aIsP ? aPair->PLine() : aPair->NLine(), aPath );
+ LINE tmp ( aIsP ? aPair->PLine() : aPair->NLine(), aPath );
return static_cast<bool>( aNode->CheckColliding( &tmp ) );
}
-bool PNS_OPTIMIZER::mergeDpStep( PNS_DIFF_PAIR* aPair, bool aTryP, int step )
+bool OPTIMIZER::mergeDpStep( DIFF_PAIR* aPair, bool aTryP, int step )
{
int n = 1;
@@ -1182,7 +1182,7 @@ bool PNS_OPTIMIZER::mergeDpStep( PNS_DIFF_PAIR* aPair, bool aTryP, int step )
}
-bool PNS_OPTIMIZER::mergeDpSegments( PNS_DIFF_PAIR* aPair )
+bool OPTIMIZER::mergeDpSegments( DIFF_PAIR* aPair )
{
int step_p = aPair->CP().SegmentCount() - 2;
int step_n = aPair->CN().SegmentCount() - 2;
@@ -1223,7 +1223,7 @@ bool PNS_OPTIMIZER::mergeDpSegments( PNS_DIFF_PAIR* aPair )
}
-bool PNS_OPTIMIZER::Optimize( PNS_DIFF_PAIR* aPair )
+bool OPTIMIZER::Optimize( DIFF_PAIR* aPair )
{
return mergeDpSegments( aPair );
}
diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h
index 3be4a36..96b3e3b 100644
--- a/pcbnew/router/pns_optimizer.h
+++ b/pcbnew/router/pns_optimizer.h
@@ -32,40 +32,40 @@
namespace PNS {
-class PNS_NODE;
-class PNS_ROUTER;
-class PNS_LINE;
-class PNS_DIFF_PAIR;
+class NODE;
+class ROUTER;
+class LINE;
+class DIFF_PAIR;
/**
- * Class PNS_COST_ESTIMATOR
+ * Class COST_ESTIMATOR
*
* Calculates the cost of a given line, taking corner angles and total length into account.
**/
-class PNS_COST_ESTIMATOR
+class COST_ESTIMATOR
{
public:
- PNS_COST_ESTIMATOR() :
+ COST_ESTIMATOR() :
m_lengthCost( 0 ),
m_cornerCost( 0 )
{}
- PNS_COST_ESTIMATOR( const PNS_COST_ESTIMATOR& aB ) :
+ COST_ESTIMATOR( const COST_ESTIMATOR& aB ) :
m_lengthCost( aB.m_lengthCost ),
m_cornerCost( aB.m_cornerCost )
{}
- ~PNS_COST_ESTIMATOR() {};
+ ~COST_ESTIMATOR() {};
static int CornerCost( const SEG& aA, const SEG& aB );
static int CornerCost( const SHAPE_LINE_CHAIN& aLine );
- static int CornerCost( const PNS_LINE& aLine );
+ static int CornerCost( const LINE& aLine );
- void Add( PNS_LINE& aLine );
- void Remove( PNS_LINE& aLine );
- void Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine );
+ void Add( LINE& aLine );
+ void Remove( LINE& aLine );
+ void Replace( LINE& aOldLine, LINE& aNewLine );
- bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTolerance,
+ bool IsBetter( COST_ESTIMATOR& aOther, double aLengthTolerance,
double aCornerTollerace ) const;
double GetLengthCost() const { return m_lengthCost; }
@@ -77,7 +77,7 @@ private:
};
/**
- * Class PNS_OPTIMIZER
+ * Class OPTIMIZER
*
* Performs various optimizations of the lines being routed, attempting to make the lines shorter
* and less cornery. There are 3 kinds of optimizations so far:
@@ -87,7 +87,7 @@ private:
* the procedure as long as the total cost of the line keeps decreasing
* - "Smart Pads" - that is, rerouting pad/via exits to make them look nice (SMART_PADS).
**/
-class PNS_OPTIMIZER
+class OPTIMIZER
{
public:
enum OptimizationEffort
@@ -98,19 +98,19 @@ public:
FANOUT_CLEANUP = 0x08
};
- PNS_OPTIMIZER( PNS_NODE* aWorld );
- ~PNS_OPTIMIZER();
+ OPTIMIZER( NODE* aWorld );
+ ~OPTIMIZER();
///> a quick shortcut to optmize a line without creating and setting up an optimizer
- static bool Optimize( PNS_LINE* aLine, int aEffortLevel, PNS_NODE* aWorld);
+ static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld);
- bool Optimize( PNS_LINE* aLine, PNS_LINE* aResult = NULL );
- bool Optimize( PNS_DIFF_PAIR* aPair );
+ bool Optimize( LINE* aLine, LINE* aResult = NULL );
+ bool Optimize( DIFF_PAIR* aPair );
- void SetWorld( PNS_NODE* aNode ) { m_world = aNode; }
- void CacheStaticItem( PNS_ITEM* aItem );
- void CacheRemove( PNS_ITEM* aItem );
+ void SetWorld( NODE* aNode ) { m_world = aNode; }
+ void CacheStaticItem( ITEM* aItem );
+ void CacheRemove( ITEM* aItem );
void ClearCache( bool aStaticOnly = false );
void SetCollisionMask( int aMask )
@@ -143,36 +143,36 @@ private:
bool m_isStatic;
};
- bool mergeObtuse( PNS_LINE* aLine );
- bool mergeFull( PNS_LINE* aLine );
- bool removeUglyCorners( PNS_LINE* aLine );
- bool runSmartPads( PNS_LINE* aLine );
- bool mergeStep( PNS_LINE* aLine, SHAPE_LINE_CHAIN& aCurrentLine, int step );
- bool fanoutCleanup( PNS_LINE * aLine );
- bool mergeDpSegments( PNS_DIFF_PAIR *aPair );
- bool mergeDpStep( PNS_DIFF_PAIR *aPair, bool aTryP, int step );
+ bool mergeObtuse( LINE* aLine );
+ bool mergeFull( LINE* aLine );
+ bool removeUglyCorners( LINE* aLine );
+ bool runSmartPads( LINE* aLine );
+ bool mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentLine, int step );
+ bool fanoutCleanup( LINE * aLine );
+ bool mergeDpSegments( DIFF_PAIR *aPair );
+ bool mergeDpStep( DIFF_PAIR *aPair, bool aTryP, int step );
- bool checkColliding( PNS_ITEM* aItem, bool aUpdateCache = true );
- bool checkColliding( PNS_LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath );
+ bool checkColliding( ITEM* aItem, bool aUpdateCache = true );
+ bool checkColliding( LINE* aLine, const SHAPE_LINE_CHAIN& aOptPath );
- void cacheAdd( PNS_ITEM* aItem, bool aIsStatic );
- void removeCachedSegments( PNS_LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 );
+ void cacheAdd( ITEM* aItem, bool aIsStatic );
+ void removeCachedSegments( LINE* aLine, int aStartVertex = 0, int aEndVertex = -1 );
BREAKOUT_LIST circleBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BREAKOUT_LIST rectBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BREAKOUT_LIST ovalBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
BREAKOUT_LIST convexBreakouts( int aWidth, const SHAPE* aShape, bool aPermitDiagonal ) const;
- BREAKOUT_LIST computeBreakouts( int aWidth, const PNS_ITEM* aItem, bool aPermitDiagonal ) const;
+ BREAKOUT_LIST computeBreakouts( int aWidth, const ITEM* aItem, bool aPermitDiagonal ) const;
- int smartPadsSingle( PNS_LINE* aLine, PNS_ITEM* aPad, bool aEnd, int aEndVertex );
+ int smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVertex );
- PNS_ITEM* findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const;
+ ITEM* findPadOrVia( int aLayer, int aNet, const VECTOR2I& aP ) const;
- SHAPE_INDEX_LIST<PNS_ITEM*> m_cache;
+ SHAPE_INDEX_LIST<ITEM*> m_cache;
- typedef boost::unordered_map<PNS_ITEM*, CACHED_ITEM> CachedItemTags;
+ typedef boost::unordered_map<ITEM*, CACHED_ITEM> CachedItemTags;
CachedItemTags m_cacheTags;
- PNS_NODE* m_world;
+ NODE* m_world;
int m_collisionKindMask;
int m_effortLevel;
bool m_keepPostures;
diff --git a/pcbnew/router/pns_placement_algo.h b/pcbnew/router/pns_placement_algo.h
index de61c64..e7a9540 100644
--- a/pcbnew/router/pns_placement_algo.h
+++ b/pcbnew/router/pns_placement_algo.h
@@ -30,25 +30,25 @@
namespace PNS {
-class PNS_ROUTER;
-class PNS_ITEM;
-class PNS_NODE;
+class ROUTER;
+class ITEM;
+class NODE;
/**
- * Class PNS_PLACEMENT_ALGO
+ * Class PLACEMENT_ALGO
*
* Abstract class for a P&S placement/dragging algorithm.
* All subtools (drag, single/diff pair routing and meandering)
* are derived from it.
*/
-class PNS_PLACEMENT_ALGO : public PNS_ALGO_BASE
+class PLACEMENT_ALGO : public ALGO_BASE
{
public:
- PNS_PLACEMENT_ALGO( PNS_ROUTER* aRouter ) :
- PNS_ALGO_BASE( aRouter ) {};
+ PLACEMENT_ALGO( ROUTER* aRouter ) :
+ ALGO_BASE( aRouter ) {};
- virtual ~PNS_PLACEMENT_ALGO () {};
+ virtual ~PLACEMENT_ALGO () {};
/**
* Function Start()
@@ -56,7 +56,7 @@ public:
* Starts placement/drag operation at point aP, taking item aStartItem as anchor
* (unless NULL).
*/
- virtual bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) = 0;
+ virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem ) = 0;
/**
* Function Move()
@@ -65,7 +65,7 @@ public:
* aEndItem as the anchor (if not NULL).
* (unless NULL).
*/
- virtual bool Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) = 0;
+ virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) = 0;
/**
* Function FixRoute()
@@ -76,7 +76,7 @@ public:
* result is violating design rules - in such case, the track is only committed
* if Settings.CanViolateDRC() is on.
*/
- virtual bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) = 0;
+ virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem ) = 0;
/**
* Function ToggleVia()
@@ -113,7 +113,7 @@ public:
*
* Returns all routed/tuned traces.
*/
- virtual const PNS_ITEMSET Traces() = 0;
+ virtual const ITEM_SET Traces() = 0;
/**
* Function CurrentEnd()
@@ -142,7 +142,7 @@ public:
*
* Returns the most recent board state.
*/
- virtual PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const = 0;
+ virtual NODE* CurrentNode( bool aLoopsRemoved = false ) const = 0;
/**
* Function FlipPosture()
@@ -160,7 +160,7 @@ public:
* a settings class. Used to dynamically change these parameters as
* the track is routed.
*/
- virtual void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes )
+ virtual void UpdateSizes( const SIZES_SETTINGS& aSizes )
{
}
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index c7c18c2..2978e16 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -62,9 +62,9 @@ namespace PNS {
// an ugly singleton for drawing debug items within the router context.
// To be fixed sometime in the future.
-static PNS_ROUTER* theRouter;
+static ROUTER* theRouter;
-PNS_ROUTER::PNS_ROUTER()
+ROUTER::ROUTER()
{
theRouter = this;
@@ -87,28 +87,28 @@ PNS_ROUTER::PNS_ROUTER()
}
-PNS_ROUTER* PNS_ROUTER::GetInstance()
+ROUTER* ROUTER::GetInstance()
{
return theRouter;
}
-PNS_ROUTER::~PNS_ROUTER()
+ROUTER::~ROUTER()
{
ClearWorld();
theRouter = NULL;
}
-void PNS_ROUTER::SyncWorld( )
+void ROUTER::SyncWorld( )
{
ClearWorld();
- m_world = new PNS_NODE;
+ m_world = new NODE;
m_iface->SyncWorld( m_world );
}
-void PNS_ROUTER::ClearWorld()
+void ROUTER::ClearWorld()
{
if( m_world )
{
@@ -125,13 +125,13 @@ void PNS_ROUTER::ClearWorld()
}
-bool PNS_ROUTER::RoutingInProgress() const
+bool ROUTER::RoutingInProgress() const
{
return m_state != IDLE;
}
-const PNS_ITEMSET PNS_ROUTER::QueryHoverItems( const VECTOR2I& aP )
+const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP )
{
if( m_state == IDLE )
return m_world->HitTest( aP );
@@ -141,12 +141,12 @@ const PNS_ITEMSET PNS_ROUTER::QueryHoverItems( const VECTOR2I& aP )
}
}
-bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
+bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM* aStartItem )
{
- if( !aStartItem || aStartItem->OfKind( PNS_ITEM::SOLID_T ) )
+ if( !aStartItem || aStartItem->OfKind( ITEM::SOLID_T ) )
return false;
- m_dragger = new PNS_DRAGGER( this );
+ m_dragger = new DRAGGER( this );
m_dragger->SetWorld( m_world );
m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () );
@@ -162,24 +162,24 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
return true;
}
-bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLayer )
+bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
{
switch( m_mode )
{
case PNS_MODE_ROUTE_SINGLE:
- m_placer = new PNS_LINE_PLACER( this );
+ m_placer = new LINE_PLACER( this );
break;
case PNS_MODE_ROUTE_DIFF_PAIR:
- m_placer = new PNS_DIFF_PAIR_PLACER( this );
+ m_placer = new DIFF_PAIR_PLACER( this );
break;
case PNS_MODE_TUNE_SINGLE:
- m_placer = new PNS_MEANDER_PLACER( this );
+ m_placer = new MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
- m_placer = new PNS_DP_MEANDER_PLACER( this );
+ m_placer = new DP_MEANDER_PLACER( this );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
- m_placer = new PNS_MEANDER_SKEW_PLACER( this );
+ m_placer = new MEANDER_SKEW_PLACER( this );
break;
default:
@@ -201,13 +201,13 @@ bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLa
}
-void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems )
+void ROUTER::DisplayItems( const ITEM_SET& aItems )
{
- for( const PNS_ITEM* item : aItems.CItems() )
+ for( const ITEM* item : aItems.CItems() )
m_iface->DisplayItem( item );
}
-void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem )
+void ROUTER::Move( const VECTOR2I& aP, ITEM* endItem )
{
m_currentEnd = aP;
@@ -227,41 +227,41 @@ void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem )
}
-void PNS_ROUTER::moveDragging( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+void ROUTER::moveDragging( const VECTOR2I& aP, ITEM* aEndItem )
{
m_iface->EraseView();
m_dragger->Drag( aP );
- PNS_ITEMSET dragged = m_dragger->Traces();
+ ITEM_SET dragged = m_dragger->Traces();
updateView( m_dragger->CurrentNode(), dragged );
}
-void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
- PNS_NODE::ITEM_VECTOR& aRemoved )
+void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent,
+ NODE::ITEM_VECTOR& aRemoved )
{
- for( PNS_ITEM* item : aCurrent.Items() )
+ for( ITEM* item : aCurrent.Items() )
{
- PNS_NODE::OBSTACLES obstacles;
+ NODE::OBSTACLES obstacles;
- aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY_T );
+ aNode->QueryColliding( item, obstacles, ITEM::ANY_T );
- if( item->OfKind( PNS_ITEM::LINE_T ) )
+ if( item->OfKind( ITEM::LINE_T ) )
{
- PNS_LINE* l = static_cast<PNS_LINE*>( item );
+ LINE* l = static_cast<LINE*>( item );
if( l->EndsWithVia() )
{
- PNS_VIA v( l->Via() );
- aNode->QueryColliding( &v, obstacles, PNS_ITEM::ANY_T );
+ VIA v( l->Via() );
+ aNode->QueryColliding( &v, obstacles, ITEM::ANY_T );
}
}
- for( PNS_OBSTACLE& obs : obstacles )
+ for( OBSTACLE& obs : obstacles )
{
int clearance = aNode->GetClearance( item, obs.m_item );
- std::unique_ptr<PNS_ITEM> tmp( obs.m_item->Clone() );
+ std::unique_ptr<ITEM> tmp( obs.m_item->Clone() );
tmp->Mark( MK_VIOLATION );
m_iface->DisplayItem( tmp.get(), -1, clearance );
aRemoved.push_back( obs.m_item );
@@ -270,10 +270,10 @@ void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent,
}
-void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
+void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent )
{
- PNS_NODE::ITEM_VECTOR removed, added;
- PNS_NODE::OBSTACLES obstacles;
+ NODE::ITEM_VECTOR removed, added;
+ NODE::OBSTACLES obstacles;
if( !aNode )
return;
@@ -291,7 +291,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
}
-void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
+void ROUTER::UpdateSizes ( const SIZES_SETTINGS& aSizes )
{
m_sizes = aSizes;
@@ -303,34 +303,34 @@ void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
}
-void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
{
m_iface->EraseView();
m_placer->Move( aP, aEndItem );
- PNS_ITEMSET current = m_placer->Traces();
+ ITEM_SET current = m_placer->Traces();
- for( const PNS_ITEM* item : current.CItems() )
+ for( const ITEM* item : current.CItems() )
{
- if( !item->OfKind( PNS_ITEM::LINE_T ) )
+ if( !item->OfKind( ITEM::LINE_T ) )
continue;
- const PNS_LINE* l = static_cast<const PNS_LINE*>( item );
+ const LINE* l = static_cast<const LINE*>( item );
m_iface->DisplayItem( l );
if( l->EndsWithVia() )
m_iface->DisplayItem( &l->Via() );
}
- //PNS_ITEMSET tmp( ¤t );
+ //ITEM_SET tmp( ¤t );
updateView( m_placer->CurrentNode( true ), current );
}
-void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
+void ROUTER::CommitRouting( NODE* aNode )
{
- PNS_NODE::ITEM_VECTOR removed, added;
+ NODE::ITEM_VECTOR removed, added;
aNode->GetUpdatedItems( removed, added );
@@ -345,7 +345,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
}
-bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
+bool ROUTER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem )
{
bool rv = false;
@@ -370,7 +370,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
}
-void PNS_ROUTER::StopRouting()
+void ROUTER::StopRouting()
{
// Update the ratsnest with new changes
@@ -404,7 +404,7 @@ void PNS_ROUTER::StopRouting()
}
-void PNS_ROUTER::FlipPosture()
+void ROUTER::FlipPosture()
{
if( m_state == ROUTE_TRACK )
{
@@ -413,7 +413,7 @@ void PNS_ROUTER::FlipPosture()
}
-void PNS_ROUTER::SwitchLayer( int aLayer )
+void ROUTER::SwitchLayer( int aLayer )
{
switch( m_state )
{
@@ -426,7 +426,7 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
}
-void PNS_ROUTER::ToggleViaPlacement()
+void ROUTER::ToggleViaPlacement()
{
if( m_state == ROUTE_TRACK )
{
@@ -436,7 +436,7 @@ void PNS_ROUTER::ToggleViaPlacement()
}
-const std::vector<int> PNS_ROUTER::GetCurrentNets() const
+const std::vector<int> ROUTER::GetCurrentNets() const
{
if( m_placer )
return m_placer->CurrentNets();
@@ -445,7 +445,7 @@ const std::vector<int> PNS_ROUTER::GetCurrentNets() const
}
-int PNS_ROUTER::GetCurrentLayer() const
+int ROUTER::GetCurrentLayer() const
{
if( m_placer )
return m_placer->CurrentLayer();
@@ -453,9 +453,9 @@ int PNS_ROUTER::GetCurrentLayer() const
}
-void PNS_ROUTER::DumpLog()
+void ROUTER::DumpLog()
{
- PNS_LOGGER* logger = NULL;
+ LOGGER* logger = NULL;
switch( m_state )
{
@@ -476,7 +476,7 @@ void PNS_ROUTER::DumpLog()
}
-bool PNS_ROUTER::IsPlacingVia() const
+bool ROUTER::IsPlacingVia() const
{
if( !m_placer )
return false;
@@ -485,7 +485,7 @@ bool PNS_ROUTER::IsPlacingVia() const
}
-void PNS_ROUTER::SetOrthoMode( bool aEnable )
+void ROUTER::SetOrthoMode( bool aEnable )
{
if( !m_placer )
return;
@@ -494,12 +494,12 @@ void PNS_ROUTER::SetOrthoMode( bool aEnable )
}
-void PNS_ROUTER::SetMode( PNS_ROUTER_MODE aMode )
+void ROUTER::SetMode( ROUTER_MODE aMode )
{
m_mode = aMode;
}
-void PNS_ROUTER::SetInterface( PNS_ROUTER_IFACE *aIface )
+void ROUTER::SetInterface( ROUTER_IFACE *aIface )
{
m_iface = aIface;
m_iface->SetRouter( this );
diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h
index 997bd8f..e77c2e3 100644
--- a/pcbnew/router/pns_router.h
+++ b/pcbnew/router/pns_router.h
@@ -45,22 +45,22 @@ class VIEW_GROUP;
namespace PNS {
-class PNS_DEBUG_DECORATOR;
-class PNS_NODE;
-class PNS_DIFF_PAIR_PLACER;
-class PNS_PLACEMENT_ALGO;
-class PNS_LINE_PLACER;
-class PNS_ITEM;
-class PNS_LINE;
-class PNS_SOLID;
-class PNS_SEGMENT;
-class PNS_JOINT;
-class PNS_VIA;
-class PNS_RULE_RESOLVER;
-class PNS_SHOVE;
-class PNS_DRAGGER;
-
-enum PNS_ROUTER_MODE {
+class DEBUG_DECORATOR;
+class NODE;
+class DIFF_PAIR_PLACER;
+class PLACEMENT_ALGO;
+class LINE_PLACER;
+class ITEM;
+class LINE;
+class SOLID;
+class SEGMENT;
+class JOINT;
+class VIA;
+class RULE_RESOLVER;
+class SHOVE;
+class DRAGGER;
+
+enum ROUTER_MODE {
PNS_MODE_ROUTE_SINGLE = 1,
PNS_MODE_ROUTE_DIFF_PAIR,
PNS_MODE_TUNE_SINGLE,
@@ -69,34 +69,34 @@ enum PNS_ROUTER_MODE {
};
/**
- * Class PNS_ROUTER
+ * Class ROUTER
*
* Main router class.
*/
- class PNS_ROUTER_IFACE
+ class ROUTER_IFACE
{
public:
- PNS_ROUTER_IFACE() {};
- virtual ~PNS_ROUTER_IFACE() {};
-
- virtual void SetRouter( PNS_ROUTER* aRouter ) = 0;
- virtual void SyncWorld( PNS_NODE* aNode ) = 0;
- virtual void AddItem( PNS_ITEM* aItem ) = 0;
- virtual void RemoveItem( PNS_ITEM* aItem ) = 0;
- virtual void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0;
- virtual void HideItem( PNS_ITEM* aItem ) = 0;
+ ROUTER_IFACE() {};
+ virtual ~ROUTER_IFACE() {};
+
+ virtual void SetRouter( ROUTER* aRouter ) = 0;
+ virtual void SyncWorld( NODE* aNode ) = 0;
+ virtual void AddItem( ITEM* aItem ) = 0;
+ virtual void RemoveItem( ITEM* aItem ) = 0;
+ virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0;
+ virtual void HideItem( ITEM* aItem ) = 0;
virtual void Commit() = 0;
// virtual void Abort () = 0;
virtual void EraseView() = 0;
virtual void UpdateNet( int aNetCode ) = 0;
- virtual PNS_RULE_RESOLVER* GetRuleResolver() = 0;
- virtual PNS_DEBUG_DECORATOR* GetDebugDecorator() = 0;
+ virtual RULE_RESOLVER* GetRuleResolver() = 0;
+ virtual DEBUG_DECORATOR* GetDebugDecorator() = 0;
};
-class PNS_ROUTER
+class ROUTER
{
private:
enum RouterState
@@ -107,14 +107,14 @@ private:
};
public:
- PNS_ROUTER();
- ~PNS_ROUTER();
+ ROUTER();
+ ~ROUTER();
- void SetInterface( PNS_ROUTER_IFACE* aIface );
- void SetMode ( PNS_ROUTER_MODE aMode );
- PNS_ROUTER_MODE Mode() const { return m_mode; }
+ void SetInterface( ROUTER_IFACE* aIface );
+ void SetMode ( ROUTER_MODE aMode );
+ ROUTER_MODE Mode() const { return m_mode; }
- static PNS_ROUTER* GetInstance();
+ static ROUTER* GetInstance();
void ClearWorld();
void SyncWorld();
@@ -122,24 +122,24 @@ public:
void SetView( KIGFX::VIEW* aView );
bool RoutingInProgress() const;
- bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem, int aLayer );
- void Move( const VECTOR2I& aP, PNS_ITEM* aItem );
- bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem );
+ bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer );
+ void Move( const VECTOR2I& aP, ITEM* aItem );
+ bool FixRoute( const VECTOR2I& aP, ITEM* aItem );
void StopRouting();
- int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
+ int GetClearance( const ITEM* aA, const ITEM* aB ) const;
- PNS_NODE* GetWorld() const
+ NODE* GetWorld() const
{
return m_world;
}
void FlipPosture();
- void DisplayItem( const PNS_ITEM* aItem, int aColor = -1, int aClearance = -1 );
- void DisplayItems( const PNS_ITEMSET& aItems );
- void DeleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack );
+ void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 );
+ void DisplayItems( const ITEM_SET& aItems );
+ void DeleteTraces( ITEM* aStartItem, bool aWholeTrack );
void SwitchLayer( int layer );
void ToggleViaPlacement();
@@ -150,17 +150,17 @@ public:
void DumpLog();
- PNS_RULE_RESOLVER* GetRuleResolver() const
+ RULE_RESOLVER* GetRuleResolver() const
{
return m_iface->GetRuleResolver();
}
bool IsPlacingVia() const;
- const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP );
- const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
+ const ITEM_SET QueryHoverItems( const VECTOR2I& aP );
+ const VECTOR2I SnapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
- bool StartDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
+ bool StartDragging( const VECTOR2I& aP, ITEM* aItem );
void SetIterLimit( int aX ) { m_iterLimit = aX; }
int GetIterLimit() const { return m_iterLimit; };
@@ -174,21 +174,21 @@ public:
bool GetShowIntermediateSteps() const { return m_showInterSteps; }
int GetShapshotIter() const { return m_snapshotIter; }
- PNS_ROUTING_SETTINGS& Settings() { return m_settings; }
+ ROUTING_SETTINGS& Settings() { return m_settings; }
- void CommitRouting( PNS_NODE* aNode );
+ void CommitRouting( NODE* aNode );
/**
* Applies stored settings.
* @see Settings()
*/
- void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
+ void UpdateSizes( const SIZES_SETTINGS& aSizes );
/**
* Changes routing settings to ones passed in the parameter.
* @param aSettings are the new settings.
*/
- void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings )
+ void LoadSettings( const ROUTING_SETTINGS& aSettings )
{
m_settings = aSettings;
}
@@ -203,59 +203,59 @@ public:
return m_snappingEnabled;
}
- PNS_SIZES_SETTINGS& Sizes()
+ SIZES_SETTINGS& Sizes()
{
return m_sizes;
}
- PNS_ITEM* QueryItemByParent( const BOARD_ITEM* aItem ) const;
+ ITEM* QueryItemByParent( const BOARD_ITEM* aItem ) const;
void SetFailureReason ( const wxString& aReason ) { m_failureReason = aReason; }
const wxString& FailureReason() const { return m_failureReason; }
- PNS_PLACEMENT_ALGO* Placer() { return m_placer; }
+ PLACEMENT_ALGO* Placer() { return m_placer; }
- PNS_ROUTER_IFACE* GetInterface() const
+ ROUTER_IFACE* GetInterface() const
{
return m_iface;
}
private:
- void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem );
- void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
+ void movePlacing( const VECTOR2I& aP, ITEM* aItem );
+ void moveDragging( const VECTOR2I& aP, ITEM* aItem );
void eraseView();
- void updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent );
+ void updateView( NODE* aNode, ITEM_SET& aCurrent );
void clearViewFlags();
// optHoverItem queryHoverItemEx(const VECTOR2I& aP);
- PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const;
- void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP );
+ ITEM* pickSingleItem( ITEM_SET& aItems ) const;
+ void splitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP );
- PNS_ITEM* syncPad( D_PAD* aPad );
- PNS_ITEM* syncTrack( TRACK* aTrack );
- PNS_ITEM* syncVia( VIA* aVia );
+ ITEM* syncPad( D_PAD* aPad );
+ ITEM* syncTrack( TRACK* aTrack );
+ ITEM* syncVia( VIA* aVia );
- void commitPad( PNS_SOLID* aPad );
- void commitSegment( PNS_SEGMENT* aTrack );
- void commitVia( PNS_VIA* aVia );
+ void commitPad( SOLID* aPad );
+ void commitSegment( SEGMENT* aTrack );
+ void commitVia( VIA* aVia );
void highlightCurrent( bool enabled );
- void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
+ void markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR& aRemoved );
VECTOR2I m_currentEnd;
RouterState m_state;
- PNS_NODE* m_world;
- PNS_NODE* m_lastNode;
- PNS_PLACEMENT_ALGO * m_placer;
- PNS_DRAGGER* m_dragger;
- PNS_SHOVE* m_shove;
- PNS_ROUTER_IFACE* m_iface;
+ NODE* m_world;
+ NODE* m_lastNode;
+ PLACEMENT_ALGO * m_placer;
+ DRAGGER* m_dragger;
+ SHOVE* m_shove;
+ ROUTER_IFACE* m_iface;
int m_iterLimit;
bool m_showInterSteps;
@@ -266,10 +266,10 @@ private:
bool m_snappingEnabled;
bool m_violation;
- PNS_ROUTING_SETTINGS m_settings;
+ ROUTING_SETTINGS m_settings;
///> Stores list of modified items in the current operation
- PNS_SIZES_SETTINGS m_sizes;
- PNS_ROUTER_MODE m_mode;
+ SIZES_SETTINGS m_sizes;
+ ROUTER_MODE m_mode;
wxString m_toolStatusbarName;
wxString m_failureReason;
diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp
index 59340a3..b000eb4 100644
--- a/pcbnew/router/pns_routing_settings.cpp
+++ b/pcbnew/router/pns_routing_settings.cpp
@@ -26,7 +26,7 @@
namespace PNS {
-PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
+ROUTING_SETTINGS::ROUTING_SETTINGS()
{
m_routingMode = RM_Walkaround;
m_optimizerEffort = OE_MEDIUM;
@@ -47,7 +47,7 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
}
-void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
+void ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
{
aSettings.Set( "Mode", (int) m_routingMode );
aSettings.Set( "OptimizerEffort", (int) m_optimizerEffort );
@@ -67,7 +67,7 @@ void PNS_ROUTING_SETTINGS::Save( TOOL_SETTINGS& aSettings ) const
}
-void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
+void ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
{
m_routingMode = (PNS_MODE) aSettings.Get( "Mode", (int) RM_Walkaround );
m_optimizerEffort = (PNS_OPTIMIZATION_EFFORT) aSettings.Get( "OptimizerEffort", (int) OE_MEDIUM );
@@ -87,7 +87,7 @@ void PNS_ROUTING_SETTINGS::Load( const TOOL_SETTINGS& aSettings )
}
-const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
+const DIRECTION_45 ROUTING_SETTINGS::InitialDirection() const
{
if( m_startDiagonal )
return DIRECTION_45( DIRECTION_45::NE );
@@ -96,13 +96,13 @@ const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const
}
-TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const
+TIME_LIMIT ROUTING_SETTINGS::ShoveTimeLimit() const
{
return TIME_LIMIT ( m_shoveTimeLimit );
}
-int PNS_ROUTING_SETTINGS::ShoveIterationLimit() const
+int ROUTING_SETTINGS::ShoveIterationLimit() const
{
return m_shoveIterationLimit;
}
diff --git a/pcbnew/router/pns_routing_settings.h b/pcbnew/router/pns_routing_settings.h
index 6a2450c..b386c3b 100644
--- a/pcbnew/router/pns_routing_settings.h
+++ b/pcbnew/router/pns_routing_settings.h
@@ -49,15 +49,15 @@ enum PNS_OPTIMIZATION_EFFORT
};
/**
- * Class PNS_ROUTING_SETTINGS
+ * Class ROUTING_SETTINGS
*
* Contains all persistent settings of the router, such as the mode, optimization effort, etc.
*/
-class PNS_ROUTING_SETTINGS
+class ROUTING_SETTINGS
{
public:
- PNS_ROUTING_SETTINGS();
+ ROUTING_SETTINGS();
void Load( const TOOL_SETTINGS& where );
void Save( TOOL_SETTINGS& where ) const;
diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h
index 1070ae4..7cf94ba 100644
--- a/pcbnew/router/pns_segment.h
+++ b/pcbnew/router/pns_segment.h
@@ -33,23 +33,23 @@
namespace PNS {
-class PNS_NODE;
+class NODE;
-class PNS_SEGMENT : public PNS_ITEM
+class SEGMENT : public ITEM
{
public:
- PNS_SEGMENT() :
- PNS_ITEM( SEGMENT_T )
+ SEGMENT() :
+ ITEM( SEGMENT_T )
{}
- PNS_SEGMENT( const SEG& aSeg, int aNet ) :
- PNS_ITEM( SEGMENT_T ), m_seg( aSeg, 0 )
+ SEGMENT( const SEG& aSeg, int aNet ) :
+ ITEM( SEGMENT_T ), m_seg( aSeg, 0 )
{
m_net = aNet;
}
- PNS_SEGMENT( const PNS_LINE& aParentLine, const SEG& aSeg ) :
- PNS_ITEM( SEGMENT_T ),
+ SEGMENT( const LINE& aParentLine, const SEG& aSeg ) :
+ ITEM( SEGMENT_T ),
m_seg( aSeg, aParentLine.Width() )
{
m_net = aParentLine.Net();
@@ -58,12 +58,12 @@ public:
m_rank = aParentLine.Rank();
}
- static inline bool ClassOf( const PNS_ITEM* aItem )
+ static inline bool ClassOf( const ITEM* aItem )
{
return aItem && SEGMENT_T == aItem->Kind();
}
- PNS_SEGMENT* Clone() const;
+ SEGMENT* Clone() const;
const SHAPE* Shape() const
{
@@ -72,7 +72,7 @@ public:
void SetLayer( int aLayer )
{
- SetLayers( PNS_LAYERSET( aLayer ) );
+ SetLayers( LAYER_RANGE( aLayer ) );
}
int Layer() const
diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp
index d173792..0630d9f 100644
--- a/pcbnew/router/pns_shove.cpp
+++ b/pcbnew/router/pns_shove.cpp
@@ -45,7 +45,7 @@
namespace PNS {
-void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew )
+void SHOVE::replaceItems( ITEM* aOld, ITEM* aNew )
{
OPT_BOX2I changed_area = ChangedArea( aOld, aNew );
@@ -58,7 +58,7 @@ void PNS_SHOVE::replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew )
}
-int PNS_SHOVE::getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const
+int SHOVE::getClearance( const ITEM* aA, const ITEM* aB ) const
{
if( m_forceClearance >= 0 )
return m_forceClearance;
@@ -67,15 +67,15 @@ int PNS_SHOVE::getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const
}
-void PNS_SHOVE::sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew )
+void SHOVE::sanityCheck( LINE* aOld, LINE* aNew )
{
assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) );
assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) );
}
-PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
- PNS_ALGO_BASE( aRouter )
+SHOVE::SHOVE( NODE* aWorld, ROUTER* aRouter ) :
+ ALGO_BASE( aRouter )
{
m_forceClearance = -1;
m_root = aWorld;
@@ -88,21 +88,21 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
}
-PNS_SHOVE::~PNS_SHOVE()
+SHOVE::~SHOVE()
{
}
-PNS_LINE PNS_SHOVE::assembleLine( const PNS_SEGMENT* aSeg, int* aIndex )
+LINE SHOVE::assembleLine( const SEGMENT* aSeg, int* aIndex )
{
- return m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex, true );
+ return m_currentNode->AssembleLine( const_cast<SEGMENT*>( aSeg ), aIndex, true );
}
// A dumb function that checks if the shoved line is shoved the right way, e.g.
// visually "outwards" of the line/via applying pressure on it. Unfortunately there's no
// mathematical concept of orientation of an open curve, so we use some primitive heuristics:
// if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction.
-bool PNS_SHOVE::checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aShoved ) const
+bool SHOVE::checkBumpDirection( const LINE& aCurrent, const LINE& aShoved ) const
{
const SEG& ss = aCurrent.CSegment( 0 );
@@ -117,8 +117,8 @@ bool PNS_SHOVE::checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aS
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LINE& aObstacle,
- PNS_LINE& aShoved )
+SHOVE::SHOVE_STATUS SHOVE::walkaroundLoneVia( LINE& aCurrent, LINE& aObstacle,
+ LINE& aShoved )
{
int clearance = getClearance( &aCurrent, &aObstacle );
const SHAPE_LINE_CHAIN hull = aCurrent.Via().Hull( clearance, aObstacle.Width() );
@@ -147,8 +147,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LI
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE& aObstacle,
- PNS_LINE& aShoved, const HULL_SET& aHulls )
+SHOVE::SHOVE_STATUS SHOVE::processHullSet( LINE& aCurrent, LINE& aObstacle,
+ LINE& aShoved, const HULL_SET& aHulls )
{
const SHAPE_LINE_CHAIN& obs = aObstacle.CLine();
@@ -161,7 +161,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
int vFirst = -1, vLast = -1;
SHAPE_LINE_CHAIN path;
- PNS_LINE l( aObstacle );
+ LINE l( aObstacle );
for( int i = 0; i < (int) aHulls.size(); i++ )
{
@@ -217,13 +217,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
continue;
}
- bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, PNS_ITEM::ANY_T, m_forceClearance );
+ bool colliding = m_currentNode->CheckColliding( &l, &aCurrent, ITEM::ANY_T, m_forceClearance );
if( ( aCurrent.Marker() & MK_HEAD ) && !colliding )
{
- PNS_JOINT* jtStart = m_currentNode->FindJoint( aCurrent.CPoint( 0 ), &aCurrent );
+ JOINT* jtStart = m_currentNode->FindJoint( aCurrent.CPoint( 0 ), &aCurrent );
- for( PNS_ITEM* item : jtStart->LinkList() )
+ for( ITEM* item : jtStart->LinkList() )
{
if( m_currentNode->CheckColliding( item, &l ) )
colliding = true;
@@ -245,8 +245,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::processHullSet( PNS_LINE& aCurrent, PNS_LINE&
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle,
- PNS_LINE& aShoved )
+SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle,
+ LINE& aShoved )
{
aShoved.ClearSegmentLinks();
@@ -254,7 +254,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI
if( aObstacle.LinkedSegments() )
{
- for( PNS_SEGMENT* s : *aObstacle.LinkedSegments() )
+ for( SEGMENT* s : *aObstacle.LinkedSegments() )
if( s->Marker() & MK_HEAD )
{
@@ -284,7 +284,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI
for( int i = 0; i < n_segs; i++ )
{
- PNS_SEGMENT seg( aCurrent, aCurrent.CSegment( i ) );
+ SEGMENT seg( aCurrent, aCurrent.CSegment( i ) );
SHAPE_LINE_CHAIN hull = seg.Hull( clearance, w );
hulls.push_back( hull );
@@ -303,12 +303,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ProcessSingleLine( PNS_LINE& aCurrent, PNS_LI
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE& aCurrent, PNS_SEGMENT* aObstacleSeg )
+SHOVE::SHOVE_STATUS SHOVE::onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacleSeg )
{
int segIndex;
- PNS_LINE obstacleLine = assembleLine( aObstacleSeg, &segIndex );
- PNS_LINE shovedLine( obstacleLine );
- PNS_SEGMENT tmp( *aObstacleSeg );
+ LINE obstacleLine = assembleLine( aObstacleSeg, &segIndex );
+ LINE shovedLine( obstacleLine );
+ SEGMENT tmp( *aObstacleSeg );
if( obstacleLine.HasLockedSegments() )
return SH_TRY_WALK;
@@ -361,9 +361,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE& aCurrent, PNS_S
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle )
+SHOVE::SHOVE_STATUS SHOVE::onCollidingLine( LINE& aCurrent, LINE& aObstacle )
{
- PNS_LINE shovedLine( aObstacle );
+ LINE shovedLine( aObstacle );
SHOVE_STATUS rv = ProcessSingleLine( aCurrent, aObstacle, shovedLine );
@@ -400,25 +400,25 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE& aCurrent, PNS_LINE
return rv;
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITEM* aObstacle )
+SHOVE::SHOVE_STATUS SHOVE::onCollidingSolid( LINE& aCurrent, ITEM* aObstacle )
{
- PNS_WALKAROUND walkaround( m_currentNode, Router() );
- PNS_LINE walkaroundLine( aCurrent );
+ WALKAROUND walkaround( m_currentNode, Router() );
+ LINE walkaroundLine( aCurrent );
if( aCurrent.EndsWithVia() )
{
- PNS_VIA vh = aCurrent.Via();
- PNS_VIA* via = NULL;
- PNS_JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), &aCurrent );
+ VIA vh = aCurrent.Via();
+ VIA* via = NULL;
+ JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), &aCurrent );
if( !jtStart )
return SH_INCOMPLETE;
- for( PNS_ITEM* item : jtStart->LinkList() )
+ for( ITEM* item : jtStart->LinkList() )
{
- if( item->OfKind( PNS_ITEM::VIA_T ) )
+ if( item->OfKind( ITEM::VIA_T ) )
{
- via = (PNS_VIA*) item;
+ via = (VIA*) item;
break;
}
}
@@ -427,13 +427,13 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
return onCollidingVia( aObstacle, via );
}
- PNS_TOPOLOGY topo( m_currentNode );
+ TOPOLOGY topo( m_currentNode );
- std::set<PNS_ITEM*> cluster = topo.AssembleCluster( aObstacle, aCurrent.Layers().Start() );
+ std::set<ITEM*> cluster = topo.AssembleCluster( aObstacle, aCurrent.Layers().Start() );
#ifdef DEBUG
m_logger.NewGroup( "on-colliding-solid-cluster", m_iter );
- for( PNS_ITEM* item : cluster )
+ for( ITEM* item : cluster )
{
m_logger.Log( item, 0, "cluster-entry" );
}
@@ -463,9 +463,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
}
- PNS_WALKAROUND::WALKAROUND_STATUS status = walkaround.Route( aCurrent, walkaroundLine, false );
+ WALKAROUND::WALKAROUND_STATUS status = walkaround.Route( aCurrent, walkaroundLine, false );
- if( status != PNS_WALKAROUND::DONE )
+ if( status != WALKAROUND::DONE )
continue;
walkaroundLine.ClearSegmentLinks();
@@ -489,11 +489,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
if( !m_lineStack.empty() )
{
- PNS_LINE lastLine = m_lineStack.front();
+ LINE lastLine = m_lineStack.front();
if( m_currentNode->CheckColliding( &lastLine, &walkaroundLine ) )
{
- PNS_LINE dummy( lastLine );
+ LINE dummy( lastLine );
if( ProcessSingleLine( walkaroundLine, lastLine, dummy ) == SH_OK )
{
@@ -529,7 +529,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE& aCurrent, PNS_ITE
}
-bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet )
+bool SHOVE::reduceSpringback( const ITEM_SET& aHeadSet )
{
bool rv = false;
@@ -552,8 +552,8 @@ bool PNS_SHOVE::reduceSpringback( const PNS_ITEMSET& aHeadSet )
}
-bool PNS_SHOVE::pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems,
- const PNS_COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea )
+bool SHOVE::pushSpringback( NODE* aNode, const ITEM_SET& aHeadItems,
+ const COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea )
{
SPRINGBACK_TAG st;
OPT_BOX2I prev_area;
@@ -580,11 +580,11 @@ bool PNS_SHOVE::pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems,
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun )
+SHOVE::SHOVE_STATUS SHOVE::pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun )
{
LINE_PAIR_VEC draggedLines;
VECTOR2I p0( aVia->Pos() );
- PNS_JOINT* jt = m_currentNode->FindJoint( p0, aVia );
+ JOINT* jt = m_currentNode->FindJoint( p0, aVia );
VECTOR2I p0_pushed( p0 + aForce );
if( !jt )
@@ -601,7 +601,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
while( aForce.x != 0 || aForce.y != 0 )
{
- PNS_JOINT* jt_next = m_currentNode->FindJoint( p0_pushed, aVia );
+ JOINT* jt_next = m_currentNode->FindJoint( p0_pushed, aVia );
if( !jt_next )
break;
@@ -609,7 +609,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
p0_pushed += aForce.Resize( 2 ); // make sure pushed via does not overlap with any existing joint
}
- PNS_VIA* pushedVia = aVia->Clone();
+ VIA* pushedVia = aVia->Clone();
pushedVia->SetPos( p0_pushed );
pushedVia->Mark( aVia->Marker() );
@@ -619,9 +619,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
m_draggedViaHeadSet.Clear();
}
- for( PNS_ITEM* item : jt->LinkList() )
+ for( ITEM* item : jt->LinkList() )
{
- if( PNS_SEGMENT* seg = dyn_cast<PNS_SEGMENT*>( item ) )
+ if( SEGMENT* seg = dyn_cast<SEGMENT*>( item ) )
{
LINE_PAIR lp;
int segIndex;
@@ -701,23 +701,23 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia )
+SHOVE::SHOVE_STATUS SHOVE::onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia )
{
int clearance = getClearance( aCurrent, aObstacleVia ) ;
LINE_PAIR_VEC draggedLines;
bool colLine = false, colVia = false;
- PNS_LINE* currentLine = NULL;
+ LINE* currentLine = NULL;
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1;
- if( aCurrent->OfKind( PNS_ITEM::LINE_T ) )
+ if( aCurrent->OfKind( ITEM::LINE_T ) )
{
#ifdef DEBUG
m_logger.NewGroup( "push-via-by-line", m_iter );
m_logger.Log( aCurrent, 4, "current" );
#endif
- currentLine = (PNS_LINE*) aCurrent;
+ currentLine = (LINE*) aCurrent;
colLine = CollideShapes( aObstacleVia->Shape(), currentLine->Shape(),
clearance + currentLine->Width() / 2 + PNS_HULL_MARGIN,
true, mtvLine );
@@ -738,7 +738,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA*
rank = currentLine->Rank();
}
- else if( aCurrent->OfKind( PNS_ITEM::SOLID_T ) )
+ else if( aCurrent->OfKind( ITEM::SOLID_T ) )
{
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid );
@@ -750,25 +750,25 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA*
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PNS_VIA* aObstacleVia )
+SHOVE::SHOVE_STATUS SHOVE::onReverseCollidingVia( LINE& aCurrent, VIA* aObstacleVia )
{
int n = 0;
- PNS_LINE cur( aCurrent );
+ LINE cur( aCurrent );
cur.ClearSegmentLinks();
- PNS_JOINT* jt = m_currentNode->FindJoint( aObstacleVia->Pos(), aObstacleVia );
- PNS_LINE shoved( aCurrent );
+ JOINT* jt = m_currentNode->FindJoint( aObstacleVia->Pos(), aObstacleVia );
+ LINE shoved( aCurrent );
shoved.ClearSegmentLinks();
cur.RemoveVia();
unwindStack( &aCurrent );
- for( PNS_ITEM* item : jt->LinkList() )
+ for( ITEM* item : jt->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT_T ) && item->LayersOverlap( &aCurrent ) )
+ if( item->OfKind( ITEM::SEGMENT_T ) && item->LayersOverlap( &aCurrent ) )
{
- PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
- PNS_LINE head = assembleLine( seg );
+ SEGMENT* seg = (SEGMENT*) item;
+ LINE head = assembleLine( seg );
head.AppendVia( *aObstacleVia );
@@ -799,7 +799,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN
m_logger.Log( &aCurrent, 1, "current-line" );
#endif
- PNS_LINE head( aCurrent );
+ LINE head( aCurrent );
head.Line().Clear();
head.AppendVia( *aObstacleVia );
head.ClearSegmentLinks();
@@ -833,9 +833,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE& aCurrent, PN
}
-void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg )
+void SHOVE::unwindStack( SEGMENT* aSeg )
{
- for( std::vector<PNS_LINE>::iterator i = m_lineStack.begin(); i != m_lineStack.end() ; )
+ for( std::vector<LINE>::iterator i = m_lineStack.begin(); i != m_lineStack.end() ; )
{
if( i->ContainsSegment( aSeg ) )
i = m_lineStack.erase( i );
@@ -843,7 +843,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg )
i++;
}
- for( std::vector<PNS_LINE>::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end() ; )
+ for( std::vector<LINE>::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end() ; )
{
if( i->ContainsSegment( aSeg ) )
i = m_optimizerQueue.erase( i );
@@ -853,24 +853,24 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT* aSeg )
}
-void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
+void SHOVE::unwindStack( ITEM* aItem )
{
- if( aItem->OfKind( PNS_ITEM::SEGMENT_T ) )
- unwindStack( static_cast<PNS_SEGMENT*>( aItem ) );
- else if( aItem->OfKind( PNS_ITEM::LINE_T ) )
+ if( aItem->OfKind( ITEM::SEGMENT_T ) )
+ unwindStack( static_cast<SEGMENT*>( aItem ) );
+ else if( aItem->OfKind( ITEM::LINE_T ) )
{
- PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
+ LINE* l = static_cast<LINE*>( aItem );
if( !l->LinkedSegments() )
return;
- for( PNS_SEGMENT* seg : *l->LinkedSegments() )
+ for( SEGMENT* seg : *l->LinkedSegments() )
unwindStack( seg );
}
}
-bool PNS_SHOVE::pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop )
+bool SHOVE::pushLine( const LINE& aL, bool aKeepCurrentOnTop )
{
if( aL.LinkCount() >= 0 && ( aL.LinkCount() != aL.SegmentCount() ) )
return false;
@@ -889,18 +889,18 @@ bool PNS_SHOVE::pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop )
return true;
}
-void PNS_SHOVE::popLine( )
+void SHOVE::popLine( )
{
- PNS_LINE& l = m_lineStack.back();
+ LINE& l = m_lineStack.back();
- for( std::vector<PNS_LINE>::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); )
+ for( std::vector<LINE>::iterator i = m_optimizerQueue.begin(); i != m_optimizerQueue.end(); )
{
bool found = false;
if( !l.LinkedSegments() )
continue;
- for( PNS_SEGMENT *s : *l.LinkedSegments() )
+ for( SEGMENT *s : *l.LinkedSegments() )
{
if( i->ContainsSegment( s ) )
{
@@ -918,13 +918,13 @@ void PNS_SHOVE::popLine( )
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
+SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
{
- PNS_LINE currentLine = m_lineStack.back();
- PNS_NODE::OPT_OBSTACLE nearest;
+ LINE currentLine = m_lineStack.back();
+ NODE::OPT_OBSTACLE nearest;
SHOVE_STATUS st = SH_NULL;
- PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID_T, PNS_ITEM::VIA_T, PNS_ITEM::SEGMENT_T };
+ ITEM::PnsKind search_order[] = { ITEM::SOLID_T, ITEM::VIA_T, ITEM::SEGMENT_T };
for( int i = 0; i < 3; i++ )
{
@@ -940,17 +940,17 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
return SH_OK;
}
- PNS_ITEM* ni = nearest->m_item;
+ ITEM* ni = nearest->m_item;
unwindStack( ni );
- if( !ni->OfKind( PNS_ITEM::SOLID_T ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() )
+ if( !ni->OfKind( ITEM::SOLID_T ) && ni->Rank() >= 0 && ni->Rank() > currentLine.Rank() )
{
switch( ni->Kind() )
{
- case PNS_ITEM::VIA_T:
+ case ITEM::VIA_T:
{
- PNS_VIA* revVia = (PNS_VIA*) ni;
+ VIA* revVia = (VIA*) ni;
wxLogTrace( "PNS", "iter %d: reverse-collide-via", aIter );
if( currentLine.EndsWithVia() && m_currentNode->CheckColliding( ¤tLine.Via(), revVia ) )
@@ -965,11 +965,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
break;
}
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
{
- PNS_SEGMENT* seg = (PNS_SEGMENT*) ni;
+ SEGMENT* seg = (SEGMENT*) ni;
wxLogTrace( "PNS", "iter %d: reverse-collide-segment ", aIter );
- PNS_LINE revLine = assembleLine( seg );
+ LINE revLine = assembleLine( seg );
popLine();
st = onCollidingLine( revLine, currentLine );
@@ -987,10 +987,10 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ // "forward" collisions
switch( ni->Kind() )
{
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
wxLogTrace( "PNS", "iter %d: collide-segment ", aIter );
- st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni );
+ st = onCollidingSegment( currentLine, (SEGMENT*) ni );
if( st == SH_TRY_WALK )
{
@@ -998,9 +998,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
}
break;
- case PNS_ITEM::VIA_T:
+ case ITEM::VIA_T:
wxLogTrace( "PNS", "iter %d: shove-via ", aIter );
- st = onCollidingVia( ¤tLine, (PNS_VIA*) ni );
+ st = onCollidingVia( ¤tLine, (VIA*) ni );
if( st == SH_TRY_WALK )
{
@@ -1008,9 +1008,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
}
break;
- case PNS_ITEM::SOLID_T:
+ case ITEM::SOLID_T:
wxLogTrace( "PNS", "iter %d: walk-solid ", aIter );
- st = onCollidingSolid( currentLine, (PNS_SOLID*) ni );
+ st = onCollidingSolid( currentLine, (SOLID*) ni );
break;
default:
@@ -1022,7 +1022,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop()
+SHOVE::SHOVE_STATUS SHOVE::shoveMainLoop()
{
SHOVE_STATUS st = SH_OK;
@@ -1055,7 +1055,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveMainLoop()
}
-OPT_BOX2I PNS_SHOVE::totalAffectedArea() const
+OPT_BOX2I SHOVE::totalAffectedArea() const
{
OPT_BOX2I area;
if( !m_nodeStack.empty() )
@@ -1072,7 +1072,7 @@ OPT_BOX2I PNS_SHOVE::totalAffectedArea() const
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
+SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
{
SHOVE_STATUS st = SH_OK;
@@ -1083,7 +1083,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
if( !aCurrentHead.SegmentCount() && !aCurrentHead.EndsWithVia() )
return SH_INCOMPLETE;
- PNS_LINE head( aCurrentHead );
+ LINE head( aCurrentHead );
head.ClearSegmentLinks();
m_lineStack.clear();
@@ -1091,12 +1091,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
m_newHead = OPT_LINE();
m_logger.Clear();
- PNS_ITEMSET headSet;
+ ITEM_SET headSet;
headSet.Add( aCurrentHead );
reduceSpringback( headSet );
- PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
+ NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
m_currentNode = parent->Branch();
m_currentNode->ClearRanks();
@@ -1113,7 +1113,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
m_logger.NewGroup( "initial", 0 );
m_logger.Log( &head, 0, "head" );
- PNS_VIA* headVia = NULL;
+ VIA* headVia = NULL;
if( head.EndsWithVia() )
{
@@ -1151,7 +1151,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
if( st == SH_OK || st == SH_HEAD_MODIFIED )
{
- pushSpringback( m_currentNode, headSet, PNS_COST_ESTIMATOR(), m_affectedAreaSum );
+ pushSpringback( m_currentNode, headSet, COST_ESTIMATOR(), m_affectedAreaSum );
}
else
{
@@ -1166,7 +1166,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
if( m_newHead && head.EndsWithVia() )
{
- PNS_VIA v = head.Via();
+ VIA v = head.Via();
v.SetPos( m_newHead->CPoint( -1 ) );
m_newHead->AppendVia(v);
}
@@ -1175,17 +1175,17 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet )
+SHOVE::SHOVE_STATUS SHOVE::ShoveMultiLines( const ITEM_SET& aHeadSet )
{
SHOVE_STATUS st = SH_OK;
m_multiLineMode = true;
- PNS_ITEMSET headSet;
+ ITEM_SET headSet;
- for( const PNS_ITEM* item : aHeadSet.CItems() )
+ for( const ITEM* item : aHeadSet.CItems() )
{
- const PNS_LINE* headOrig = static_cast<const PNS_LINE*>( item );
+ const LINE* headOrig = static_cast<const LINE*>( item );
// empty head? nothing to shove...
if( !headOrig->SegmentCount() )
@@ -1200,16 +1200,16 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
reduceSpringback( headSet );
- PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
+ NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
m_currentNode = parent->Branch();
m_currentNode->ClearRanks();
int n = 0;
- for( const PNS_ITEM* item : aHeadSet.CItems() )
+ for( const ITEM* item : aHeadSet.CItems() )
{
- const PNS_LINE* headOrig = static_cast<const PNS_LINE*>( item );
- PNS_LINE head( *headOrig );
+ const LINE* headOrig = static_cast<const LINE*>( item );
+ LINE head( *headOrig );
head.ClearSegmentLinks();
m_currentNode->Add( &head );
@@ -1221,7 +1221,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
if( !pushLine( head ) )
return SH_INCOMPLETE;
- PNS_VIA* headVia = NULL;
+ VIA* headVia = NULL;
if( head.EndsWithVia() )
{
@@ -1248,7 +1248,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
if( st == SH_OK )
{
- pushSpringback( m_currentNode, PNS_ITEMSET(), PNS_COST_ESTIMATOR(), m_affectedAreaSum );
+ pushSpringback( m_currentNode, ITEM_SET(), COST_ESTIMATOR(), m_affectedAreaSum );
}
else
{
@@ -1260,8 +1260,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveMultiLines( const PNS_ITEMSET& aHeadSet
}
-PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR2I& aWhere,
- PNS_VIA** aNewVia )
+SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( VIA* aVia, const VECTOR2I& aWhere,
+ VIA** aNewVia )
{
SHOVE_STATUS st = SH_OK;
@@ -1271,7 +1271,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
m_draggedVia = NULL;
m_draggedViaHeadSet.Clear();
- PNS_NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
+ NODE* parent = m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
m_currentNode = parent;
@@ -1296,7 +1296,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
*aNewVia = m_draggedVia;
}
- pushSpringback( m_currentNode, m_draggedViaHeadSet, PNS_COST_ESTIMATOR(), m_affectedAreaSum );
+ pushSpringback( m_currentNode, m_draggedViaHeadSet, COST_ESTIMATOR(), m_affectedAreaSum );
}
else
{
@@ -1313,9 +1313,9 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveDraggingVia( PNS_VIA* aVia, const VECTOR
}
-void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
+void SHOVE::runOptimizer( NODE* aNode )
{
- PNS_OPTIMIZER optimizer( aNode );
+ OPTIMIZER optimizer( aNode );
int optFlags = 0, n_passes = 0;
PNS_OPTIMIZATION_EFFORT effort = Settings().OptimizerEffort();
@@ -1324,7 +1324,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
int maxWidth = 0;
- for( std::vector<PNS_LINE>::iterator i = m_optimizerQueue.begin();
+ for( std::vector<LINE>::iterator i = m_optimizerQueue.begin();
i != m_optimizerQueue.end(); ++i )
{
maxWidth = std::max( i->Width(), maxWidth );
@@ -1338,12 +1338,12 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
switch( effort )
{
case OE_LOW:
- optFlags = PNS_OPTIMIZER::MERGE_OBTUSE;
+ optFlags = OPTIMIZER::MERGE_OBTUSE;
n_passes = 1;
break;
case OE_MEDIUM:
- optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS;
+ optFlags = OPTIMIZER::MERGE_SEGMENTS;
if( area )
optimizer.SetRestrictArea( *area );
@@ -1352,7 +1352,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
break;
case OE_FULL:
- optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS;
+ optFlags = OPTIMIZER::MERGE_SEGMENTS;
n_passes = 2;
break;
@@ -1361,23 +1361,23 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
}
if( Settings().SmartPads() )
- optFlags |= PNS_OPTIMIZER::SMART_PADS;
+ optFlags |= OPTIMIZER::SMART_PADS;
optimizer.SetEffortLevel( optFlags );
- optimizer.SetCollisionMask( PNS_ITEM::ANY_T );
+ optimizer.SetCollisionMask( ITEM::ANY_T );
for( int pass = 0; pass < n_passes; pass++ )
{
std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() );
- for( std::vector<PNS_LINE>::iterator i = m_optimizerQueue.begin();
+ for( std::vector<LINE>::iterator i = m_optimizerQueue.begin();
i != m_optimizerQueue.end(); ++i )
{
- PNS_LINE& line = *i;
+ LINE& line = *i;
if( !( line.Marker() & MK_HEAD ) )
{
- PNS_LINE optimized;
+ LINE optimized;
if( optimizer.Optimize( &line, &optimized ) )
{
@@ -1391,13 +1391,13 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode )
}
-PNS_NODE* PNS_SHOVE::CurrentNode()
+NODE* SHOVE::CurrentNode()
{
return m_nodeStack.empty() ? m_root : m_nodeStack.back().m_node;
}
-const PNS_LINE PNS_SHOVE::NewHead() const
+const LINE SHOVE::NewHead() const
{
assert( m_newHead );
@@ -1405,7 +1405,7 @@ const PNS_LINE PNS_SHOVE::NewHead() const
}
-void PNS_SHOVE::SetInitialLine( PNS_LINE& aInitial )
+void SHOVE::SetInitialLine( LINE& aInitial )
{
m_root = m_root->Branch();
m_root->Remove( &aInitial );
diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h
index 7c8eea2..46de6f5 100644
--- a/pcbnew/router/pns_shove.h
+++ b/pcbnew/router/pns_shove.h
@@ -33,17 +33,17 @@
namespace PNS {
-class PNS_LINE;
-class PNS_NODE;
-class PNS_ROUTER;
+class LINE;
+class NODE;
+class ROUTER;
/**
- * Class PNS_SHOVE
+ * Class SHOVE
*
* The actual Push and Shove algorithm.
*/
-class PNS_SHOVE : public PNS_ALGO_BASE
+class SHOVE : public ALGO_BASE
{
public:
@@ -56,20 +56,20 @@ public:
SH_TRY_WALK
};
- PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter );
- ~PNS_SHOVE();
+ SHOVE( NODE* aWorld, ROUTER* aRouter );
+ ~SHOVE();
- virtual PNS_LOGGER* Logger()
+ virtual LOGGER* Logger()
{
return &m_logger;
}
- SHOVE_STATUS ShoveLines( const PNS_LINE& aCurrentHead );
- SHOVE_STATUS ShoveMultiLines( const PNS_ITEMSET& aHeadSet );
+ SHOVE_STATUS ShoveLines( const LINE& aCurrentHead );
+ SHOVE_STATUS ShoveMultiLines( const ITEM_SET& aHeadSet );
- SHOVE_STATUS ShoveDraggingVia( PNS_VIA* aVia, const VECTOR2I& aWhere, PNS_VIA** aNewVia );
- SHOVE_STATUS ProcessSingleLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle,
- PNS_LINE& aShoved );
+ SHOVE_STATUS ShoveDraggingVia( VIA* aVia, const VECTOR2I& aWhere, VIA** aNewVia );
+ SHOVE_STATUS ProcessSingleLine( LINE& aCurrent, LINE& aObstacle,
+ LINE& aShoved );
void ForceClearance ( bool aEnabled, int aClearance )
{
@@ -79,16 +79,16 @@ public:
m_forceClearance = -1;
}
- PNS_NODE* CurrentNode();
+ NODE* CurrentNode();
- const PNS_LINE NewHead() const;
+ const LINE NewHead() const;
- void SetInitialLine( PNS_LINE& aInitial );
+ void SetInitialLine( LINE& aInitial );
private:
typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
- typedef boost::optional<PNS_LINE> OPT_LINE;
- typedef std::pair<PNS_LINE, PNS_LINE> LINE_PAIR;
+ typedef boost::optional<LINE> OPT_LINE;
+ typedef std::pair<LINE, LINE> LINE_PAIR;
typedef std::vector<LINE_PAIR> LINE_PAIR_VEC;
struct SPRINGBACK_TAG
@@ -96,67 +96,67 @@ private:
int64_t m_length;
int m_segments;
VECTOR2I m_p;
- PNS_NODE* m_node;
- PNS_ITEMSET m_headItems;
- PNS_COST_ESTIMATOR m_cost;
+ NODE* m_node;
+ ITEM_SET m_headItems;
+ COST_ESTIMATOR m_cost;
OPT_BOX2I m_affectedArea;
};
- SHOVE_STATUS processHullSet( PNS_LINE& aCurrent, PNS_LINE& aObstacle,
- PNS_LINE& aShoved, const HULL_SET& hulls );
+ SHOVE_STATUS processHullSet( LINE& aCurrent, LINE& aObstacle,
+ LINE& aShoved, const HULL_SET& hulls );
- bool reduceSpringback( const PNS_ITEMSET& aHeadItems );
- bool pushSpringback( PNS_NODE* aNode, const PNS_ITEMSET& aHeadItems,
- const PNS_COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea );
+ bool reduceSpringback( const ITEM_SET& aHeadItems );
+ bool pushSpringback( NODE* aNode, const ITEM_SET& aHeadItems,
+ const COST_ESTIMATOR& aCost, const OPT_BOX2I& aAffectedArea );
- SHOVE_STATUS walkaroundLoneVia( PNS_LINE& aCurrent, PNS_LINE& aObstacle, PNS_LINE& aShoved );
- bool checkBumpDirection( const PNS_LINE& aCurrent, const PNS_LINE& aShoved ) const;
+ SHOVE_STATUS walkaroundLoneVia( LINE& aCurrent, LINE& aObstacle, LINE& aShoved );
+ bool checkBumpDirection( const LINE& aCurrent, const LINE& aShoved ) const;
- SHOVE_STATUS onCollidingLine( PNS_LINE& aCurrent, PNS_LINE& aObstacle );
- SHOVE_STATUS onCollidingSegment( PNS_LINE& aCurrent, PNS_SEGMENT* aObstacleSeg );
- SHOVE_STATUS onCollidingSolid( PNS_LINE& aCurrent, PNS_ITEM* aObstacle );
- SHOVE_STATUS onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia );
- SHOVE_STATUS onReverseCollidingVia( PNS_LINE& aCurrent, PNS_VIA* aObstacleVia );
- SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun = false );
+ SHOVE_STATUS onCollidingLine( LINE& aCurrent, LINE& aObstacle );
+ SHOVE_STATUS onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacleSeg );
+ SHOVE_STATUS onCollidingSolid( LINE& aCurrent, ITEM* aObstacle );
+ SHOVE_STATUS onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia );
+ SHOVE_STATUS onReverseCollidingVia( LINE& aCurrent, VIA* aObstacleVia );
+ SHOVE_STATUS pushVia( VIA* aVia, const VECTOR2I& aForce, int aCurrentRank, bool aDryRun = false );
OPT_BOX2I totalAffectedArea() const;
- void unwindStack( PNS_SEGMENT* aSeg );
- void unwindStack( PNS_ITEM* aItem );
+ void unwindStack( SEGMENT* aSeg );
+ void unwindStack( ITEM* aItem );
- void runOptimizer( PNS_NODE* aNode );
+ void runOptimizer( NODE* aNode );
- bool pushLine( const PNS_LINE& aL, bool aKeepCurrentOnTop = false );
+ bool pushLine( const LINE& aL, bool aKeepCurrentOnTop = false );
void popLine();
- PNS_LINE assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL );
+ LINE assembleLine( const SEGMENT* aSeg, int* aIndex = NULL );
- void replaceItems( PNS_ITEM* aOld, PNS_ITEM* aNew );
+ void replaceItems( ITEM* aOld, ITEM* aNew );
OPT_BOX2I m_affectedAreaSum;
SHOVE_STATUS shoveIteration( int aIter );
SHOVE_STATUS shoveMainLoop();
- int getClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
+ int getClearance( const ITEM* aA, const ITEM* aB ) const;
std::vector<SPRINGBACK_TAG> m_nodeStack;
- std::vector<PNS_LINE> m_lineStack;
- std::vector<PNS_LINE> m_optimizerQueue;
+ std::vector<LINE> m_lineStack;
+ std::vector<LINE> m_optimizerQueue;
- PNS_NODE* m_root;
- PNS_NODE* m_currentNode;
+ NODE* m_root;
+ NODE* m_currentNode;
OPT_LINE m_newHead;
- PNS_LOGGER m_logger;
- PNS_VIA* m_draggedVia;
- PNS_ITEMSET m_draggedViaHeadSet;
+ LOGGER m_logger;
+ VIA* m_draggedVia;
+ ITEM_SET m_draggedViaHeadSet;
int m_iter;
int m_forceClearance;
bool m_multiLineMode;
- void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew );
+ void sanityCheck( LINE* aOld, LINE* aNew );
};
}
diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp
index cd604fa..4dc94ea 100644
--- a/pcbnew/router/pns_sizes_settings.cpp
+++ b/pcbnew/router/pns_sizes_settings.cpp
@@ -29,7 +29,7 @@
namespace PNS {
-int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
+int SIZES_SETTINGS::inheritTrackWidth( ITEM* aItem )
{
VECTOR2I p;
@@ -37,34 +37,34 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS_ITEM::VIA_T:
- p = static_cast<PNS_VIA*>( aItem )->Pos();
+ case ITEM::VIA_T:
+ p = static_cast<VIA*>( aItem )->Pos();
break;
- case PNS_ITEM::SOLID_T:
- p = static_cast<PNS_SOLID*>( aItem )->Pos();
+ case ITEM::SOLID_T:
+ p = static_cast<SOLID*>( aItem )->Pos();
break;
- case PNS_ITEM::SEGMENT_T:
- return static_cast<PNS_SEGMENT*>( aItem )->Width();
+ case ITEM::SEGMENT_T:
+ return static_cast<SEGMENT*>( aItem )->Width();
default:
return 0;
}
- PNS_JOINT* jt = static_cast<PNS_NODE*>( aItem->Owner() )->FindJoint( p, aItem );
+ JOINT* jt = static_cast<NODE*>( aItem->Owner() )->FindJoint( p, aItem );
assert( jt != NULL );
int mval = INT_MAX;
- PNS_ITEMSET linkedSegs = jt->Links();
- linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT_T );
+ ITEM_SET linkedSegs = jt->Links();
+ linkedSegs.ExcludeItem( aItem ).FilterKinds( ITEM::SEGMENT_T );
- for( PNS_ITEM* item : linkedSegs.Items() )
+ for( ITEM* item : linkedSegs.Items() )
{
- int w = static_cast<PNS_SEGMENT*>( item )->Width();
+ int w = static_cast<SEGMENT*>( item )->Width();
mval = std::min( w, mval );
}
@@ -72,7 +72,7 @@ int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
}
-void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet )
+void SIZES_SETTINGS::Init( BOARD* aBoard, ITEM* aStartItem, int aNet )
{
BOARD_DESIGN_SETTINGS &bds = aBoard->GetDesignSettings();
@@ -128,13 +128,13 @@ void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet )
}
-void PNS_SIZES_SETTINGS::ClearLayerPairs()
+void SIZES_SETTINGS::ClearLayerPairs()
{
m_layerPairs.clear();
}
-void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 )
+void SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 )
{
int top = std::min( aL1, aL2 );
int bottom = std::max( aL1, aL2 );
@@ -144,7 +144,7 @@ void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 )
}
-void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings )
+void SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings )
{
m_trackWidth = aSettings.GetCurrentTrackWidth();
m_viaDiameter = aSettings.GetCurrentViaSize();
@@ -152,7 +152,7 @@ void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings )
}
-int PNS_SIZES_SETTINGS::GetLayerTop() const
+int SIZES_SETTINGS::GetLayerTop() const
{
if( m_layerPairs.empty() )
return F_Cu;
@@ -161,7 +161,7 @@ int PNS_SIZES_SETTINGS::GetLayerTop() const
}
-int PNS_SIZES_SETTINGS::GetLayerBottom() const
+int SIZES_SETTINGS::GetLayerBottom() const
{
if( m_layerPairs.empty() )
return B_Cu;
diff --git a/pcbnew/router/pns_sizes_settings.h b/pcbnew/router/pns_sizes_settings.h
index 3763178..cbc8570 100644
--- a/pcbnew/router/pns_sizes_settings.h
+++ b/pcbnew/router/pns_sizes_settings.h
@@ -32,12 +32,12 @@ class BOARD_DESIGN_SETTINGS;
namespace PNS {
-class PNS_ITEM;
+class ITEM;
-class PNS_SIZES_SETTINGS {
+class SIZES_SETTINGS {
public:
- PNS_SIZES_SETTINGS() :
+ SIZES_SETTINGS() :
m_trackWidth( 155000 ),
m_diffPairWidth( 125000 ),
m_diffPairGap( 180000 ),
@@ -48,9 +48,9 @@ public:
m_viaType( VIA_THROUGH )
{};
- ~PNS_SIZES_SETTINGS() {};
+ ~SIZES_SETTINGS() {};
- void Init( BOARD* aBoard, PNS_ITEM* aStartItem = NULL, int aNet = -1 );
+ void Init( BOARD* aBoard, ITEM* aStartItem = NULL, int aNet = -1 );
void ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings );
void ClearLayerPairs();
@@ -98,7 +98,7 @@ public:
private:
- int inheritTrackWidth( PNS_ITEM* aItem );
+ int inheritTrackWidth( ITEM* aItem );
int m_trackWidth;
int m_diffPairWidth;
diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp
index 2d5e8ba..20b6d0f 100644
--- a/pcbnew/router/pns_solid.cpp
+++ b/pcbnew/router/pns_solid.cpp
@@ -32,7 +32,7 @@
namespace PNS {
-const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
+const SHAPE_LINE_CHAIN SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
{
int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2;
@@ -73,9 +73,9 @@ const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness
}
-PNS_ITEM* PNS_SOLID::Clone() const
+ITEM* SOLID::Clone() const
{
- PNS_ITEM* solid = new PNS_SOLID( *this );
+ ITEM* solid = new SOLID( *this );
return solid;
}
diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h
index 4bd3c35..d3849ed 100644
--- a/pcbnew/router/pns_solid.h
+++ b/pcbnew/router/pns_solid.h
@@ -32,32 +32,32 @@
namespace PNS {
-class PNS_SOLID : public PNS_ITEM
+class SOLID : public ITEM
{
public:
- PNS_SOLID() : PNS_ITEM( SOLID_T ), m_shape( NULL )
+ SOLID() : ITEM( SOLID_T ), m_shape( NULL )
{
m_movable = false;
}
- ~PNS_SOLID()
+ ~SOLID()
{
delete m_shape;
}
- PNS_SOLID( const PNS_SOLID& aSolid ) :
- PNS_ITEM( aSolid )
+ SOLID( const SOLID& aSolid ) :
+ ITEM( aSolid )
{
m_shape = aSolid.m_shape->Clone();
m_pos = aSolid.m_pos;
}
- static inline bool ClassOf( const PNS_ITEM* aItem )
+ static inline bool ClassOf( const ITEM* aItem )
{
return aItem && SOLID_T == aItem->Kind();
}
- PNS_ITEM* Clone() const;
+ ITEM* Clone() const;
const SHAPE* Shape() const { return m_shape; }
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index 6bc30cb..0e99918 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -60,13 +60,13 @@ using namespace KIGFX;
namespace PNS {
-TOOL_ACTION PNS_TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
+TOOL_ACTION TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
AS_CONTEXT, 'E',
_( "Routing Options..." ),
_( "Shows a dialog containing router options." ), tools_xpm );
-PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) :
+TOOL_BASE::TOOL_BASE( const std::string& aToolName ) :
TOOL_INTERACTIVE( aToolName )
{
m_gridHelper = NULL;
@@ -85,7 +85,7 @@ PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) :
}
-PNS_TOOL_BASE::~PNS_TOOL_BASE()
+TOOL_BASE::~TOOL_BASE()
{
delete m_gridHelper;
delete m_iface;
@@ -94,7 +94,7 @@ PNS_TOOL_BASE::~PNS_TOOL_BASE()
-void PNS_TOOL_BASE::Reset( RESET_REASON aReason )
+void TOOL_BASE::Reset( RESET_REASON aReason )
{
delete m_gridHelper;
delete m_iface;
@@ -110,7 +110,7 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason )
m_iface->SetView( getView() );
m_iface->SetHostFrame( m_frame );
- m_router = new PNS_ROUTER;
+ m_router = new ROUTER;
m_router->SetInterface(m_iface);
m_router->ClearWorld();
m_router->SyncWorld();
@@ -121,21 +121,21 @@ void PNS_TOOL_BASE::Reset( RESET_REASON aReason )
}
-PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer )
+ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer )
{
int tl = getView()->GetTopLayer();
if( aLayer > 0 )
tl = aLayer;
- PNS_ITEM* prioritized[4];
+ ITEM* prioritized[4];
for( int i = 0; i < 4; i++ )
prioritized[i] = 0;
- PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere );
+ ITEM_SET candidates = m_router->QueryHoverItems( aWhere );
- for( PNS_ITEM* item : candidates.Items() )
+ for( ITEM* item : candidates.Items() )
{
if( !IsCopperLayer( item->Layers().Start() ) )
continue;
@@ -146,7 +146,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a
if( aNet < 0 || item->Net() == aNet )
{
- if( item->OfKind( PNS_ITEM::VIA_T | PNS_ITEM::SOLID_T ) )
+ if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
{
if( !prioritized[2] )
prioritized[2] = item;
@@ -163,13 +163,13 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a
}
}
- PNS_ITEM* rv = NULL;
+ ITEM* rv = NULL;
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
for( int i = 0; i < 4; i++ )
{
- PNS_ITEM* item = prioritized[i];
+ ITEM* item = prioritized[i];
if( displ_opts->m_ContrastModeDisplay )
if( item && !item->Layers().Overlaps( tl ) )
@@ -194,7 +194,7 @@ PNS_ITEM* PNS_TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int a
}
-void PNS_TOOL_BASE::highlightNet( bool aEnabled, int aNetcode )
+void TOOL_BASE::highlightNet( bool aEnabled, int aNetcode )
{
RENDER_SETTINGS* rs = getView()->GetPainter()->GetSettings();
@@ -207,13 +207,13 @@ void PNS_TOOL_BASE::highlightNet( bool aEnabled, int aNetcode )
}
-void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
+void TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
{
int tl = getView()->GetTopLayer();
VECTOR2I cp = m_ctls->GetCursorPosition();
VECTOR2I p;
- PNS_ITEM* startItem = NULL;
+ ITEM* startItem = NULL;
bool snapEnabled = true;
if( aEvent.IsMotion() || aEvent.IsClick() )
@@ -259,7 +259,7 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
}
-void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
+void TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
{
VECTOR2I mp = m_ctls->GetMousePosition();
VECTOR2I p = getView()->ToWorld( mp );
@@ -283,7 +283,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
else
layer = m_router->GetCurrentLayer();
- PNS_ITEM* endItem = NULL;
+ ITEM* endItem = NULL;
std::vector<int> nets = m_router->GetCurrentNets();
@@ -316,9 +316,9 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
}
-void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack )
+void TOOL_BASE::deleteTraces( ITEM* aStartItem, bool aWholeTrack )
{
- PNS_NODE *node = m_router->GetWorld()->Branch();
+ NODE *node = m_router->GetWorld()->Branch();
if( !aStartItem )
return;
@@ -329,8 +329,8 @@ void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack )
}
else
{
- PNS_TOPOLOGY topo( node );
- PNS_ITEMSET path = topo.AssembleTrivialPath( aStartItem );
+ TOPOLOGY topo( node );
+ ITEM_SET path = topo.AssembleTrivialPath( aStartItem );
for( auto ent : path.Items() )
node->Remove( ent.item );
@@ -340,13 +340,13 @@ void PNS_TOOL_BASE::deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack )
}
-PNS_ROUTER *PNS_TOOL_BASE::Router() const
+ROUTER *TOOL_BASE::Router() const
{
return m_router;
}
-const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment )
+const VECTOR2I TOOL_BASE::snapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment )
{
VECTOR2I anchor;
@@ -358,19 +358,19 @@ const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aS
switch( aItem->Kind() )
{
- case PNS_ITEM::SOLID_T:
- anchor = static_cast<PNS_SOLID*>( aItem )->Pos();
+ case ITEM::SOLID_T:
+ anchor = static_cast<SOLID*>( aItem )->Pos();
aSplitsSegment = false;
break;
- case PNS_ITEM::VIA_T:
- anchor = static_cast<PNS_VIA*>( aItem )->Pos();
+ case ITEM::VIA_T:
+ anchor = static_cast<VIA*>( aItem )->Pos();
aSplitsSegment = false;
break;
- case PNS_ITEM::SEGMENT_T:
+ case ITEM::SEGMENT_T:
{
- PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( aItem );
+ SEGMENT* seg = static_cast<SEGMENT*>( aItem );
const SEG& s = seg->Seg();
int w = seg->Width();
diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h
index 998581d..ceae7b3 100644
--- a/pcbnew/router/pns_tool_base.h
+++ b/pcbnew/router/pns_tool_base.h
@@ -39,41 +39,41 @@ class PNS_TUNE_STATUS_POPUP;
namespace PNS {
-class APIEXPORT PNS_TOOL_BASE : public TOOL_INTERACTIVE
+class APIEXPORT TOOL_BASE : public TOOL_INTERACTIVE
{
public:
static TOOL_ACTION ACT_RouterOptions;
- PNS_TOOL_BASE( const std::string& aToolName );
- virtual ~PNS_TOOL_BASE();
+ TOOL_BASE( const std::string& aToolName );
+ virtual ~TOOL_BASE();
virtual void Reset( RESET_REASON aReason );
- const PNS_ROUTING_SETTINGS& PNSSettings() const
+ const ROUTING_SETTINGS& PNSSettings() const
{
return m_savedSettings;
}
- PNS_ROUTER* Router() const;
+ ROUTER* Router() const;
protected:
- const VECTOR2I snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
- virtual PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
+ const VECTOR2I snapToItem( ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
+ virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
virtual void highlightNet( bool aEnabled, int aNetcode = -1 );
virtual void updateStartItem( TOOL_EVENT& aEvent );
virtual void updateEndItem( TOOL_EVENT& aEvent );
- void deleteTraces( PNS_ITEM* aStartItem, bool aWholeTrack );
+ void deleteTraces( ITEM* aStartItem, bool aWholeTrack );
MSG_PANEL_ITEMS m_panelItems;
- PNS_ROUTING_SETTINGS m_savedSettings; ///< Stores routing settings between router invocations
- PNS_SIZES_SETTINGS m_savedSizes; ///< Stores sizes settings between router invocations
- PNS_ITEM* m_startItem;
+ ROUTING_SETTINGS m_savedSettings; ///< Stores routing settings between router invocations
+ SIZES_SETTINGS m_savedSizes; ///< Stores sizes settings between router invocations
+ ITEM* m_startItem;
int m_startLayer;
VECTOR2I m_startSnapPoint;
- PNS_ITEM* m_endItem;
+ ITEM* m_endItem;
VECTOR2I m_endSnapPoint;
PCB_EDIT_FRAME* m_frame;
@@ -81,7 +81,7 @@ protected:
BOARD* m_board;
GRID_HELPER* m_gridHelper;
PNS_KICAD_IFACE* m_iface;
- PNS_ROUTER* m_router;
+ ROUTER* m_router;
};
}
diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
index a54bbc0..c862fd9 100644
--- a/pcbnew/router/pns_topology.cpp
+++ b/pcbnew/router/pns_topology.cpp
@@ -34,20 +34,20 @@
namespace PNS {
-bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine )
+bool TOPOLOGY::SimplifyLine( LINE* aLine )
{
if( !aLine->LinkedSegments() || !aLine->SegmentCount() )
return false;
- PNS_SEGMENT* root = ( *aLine->LinkedSegments() )[0];
- PNS_LINE l = m_world->AssembleLine( root );
+ SEGMENT* root = ( *aLine->LinkedSegments() )[0];
+ LINE l = m_world->AssembleLine( root );
SHAPE_LINE_CHAIN simplified( l.CLine() );
simplified.Simplify();
if( simplified.PointCount() != l.PointCount() )
{
- PNS_LINE lnew( l );
+ LINE lnew( l );
m_world->Remove( &l );
lnew.SetShape( simplified );
m_world->Add( &lnew );
@@ -58,9 +58,9 @@ bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine )
}
-const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart )
+const TOPOLOGY::JOINT_SET TOPOLOGY::ConnectedJoints( JOINT* aStart )
{
- std::deque<PNS_JOINT*> searchQueue;
+ std::deque<JOINT*> searchQueue;
JOINT_SET processed;
searchQueue.push_back( aStart );
@@ -68,17 +68,17 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart )
while( !searchQueue.empty() )
{
- PNS_JOINT* current = searchQueue.front();
+ JOINT* current = searchQueue.front();
searchQueue.pop_front();
- for( PNS_ITEM* item : current->LinkList() )
+ for( ITEM* item : current->LinkList() )
{
- if( item->OfKind( PNS_ITEM::SEGMENT_T ) )
+ if( item->OfKind( ITEM::SEGMENT_T ) )
{
- PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
- PNS_JOINT* a = m_world->FindJoint( seg->Seg().A, seg );
- PNS_JOINT* b = m_world->FindJoint( seg->Seg().B, seg );
- PNS_JOINT* next = ( *a == *current ) ? b : a;
+ SEGMENT* seg = static_cast<SEGMENT*>( item );
+ JOINT* a = m_world->FindJoint( seg->Seg().A, seg );
+ JOINT* b = m_world->FindJoint( seg->Seg().B, seg );
+ JOINT* next = ( *a == *current ) ? b : a;
if( processed.find( next ) == processed.end() )
{
@@ -93,18 +93,18 @@ const PNS_TOPOLOGY::JOINT_SET PNS_TOPOLOGY::ConnectedJoints( PNS_JOINT* aStart )
}
-bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine )
+bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine )
{
- PNS_LINE track( *aTrack );
+ LINE track( *aTrack );
VECTOR2I end;
if( !track.PointCount() )
return false;
- std::unique_ptr<PNS_NODE> tmpNode( m_world->Branch() );
+ std::unique_ptr<NODE> tmpNode( m_world->Branch() );
tmpNode->Add( &track );
- PNS_JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track );
+ JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track );
if( !jt )
return false;
@@ -117,8 +117,8 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa
{
int anchor;
- PNS_TOPOLOGY topo( tmpNode.get() );
- PNS_ITEM* it = topo.NearestUnconnectedItem( jt, &anchor );
+ TOPOLOGY topo( tmpNode.get() );
+ ITEM* it = topo.NearestUnconnectedItem( jt, &anchor );
if( !it )
return false;
@@ -133,15 +133,15 @@ bool PNS_TOPOLOGY::LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRa
}
-PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor, int aKindMask )
+ITEM* TOPOLOGY::NearestUnconnectedItem( JOINT* aStart, int* aAnchor, int aKindMask )
{
- std::set<PNS_ITEM*> disconnected;
+ std::set<ITEM*> disconnected;
m_world->AllItemsInNet( aStart->Net(), disconnected );
- for( const PNS_JOINT* jt : ConnectedJoints( aStart ) )
+ for( const JOINT* jt : ConnectedJoints( aStart ) )
{
- for( PNS_ITEM* link : jt->LinkList() )
+ for( ITEM* link : jt->LinkList() )
{
if( disconnected.find( link ) != disconnected.end() )
disconnected.erase( link );
@@ -149,9 +149,9 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor,
}
int best_dist = INT_MAX;
- PNS_ITEM* best = NULL;
+ ITEM* best = NULL;
- for( PNS_ITEM* item : disconnected )
+ for( ITEM* item : disconnected )
{
if( item->OfKind( aKindMask ) )
{
@@ -176,11 +176,11 @@ PNS_ITEM* PNS_TOPOLOGY::NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor,
}
-bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& aSet, std::set<PNS_ITEM*>& aVisited )
+bool TOPOLOGY::followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set<ITEM*>& aVisited )
{
VECTOR2I anchor = aLeft ? aLine->CPoint( 0 ) : aLine->CPoint( -1 );
- PNS_SEGMENT* last = aLeft ? aLine->LinkedSegments()->front() : aLine->LinkedSegments()->back();
- PNS_JOINT* jt = m_world->FindJoint( anchor, aLine );
+ SEGMENT* last = aLeft ? aLine->LinkedSegments()->front() : aLine->LinkedSegments()->back();
+ JOINT* jt = m_world->FindJoint( anchor, aLine );
assert( jt != NULL );
@@ -188,21 +188,21 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET&
if( jt->IsNonFanoutVia() || jt->IsTraceWidthChange() )
{
- PNS_ITEM* via = NULL;
- PNS_SEGMENT* next_seg = NULL;
+ ITEM* via = NULL;
+ SEGMENT* next_seg = NULL;
- for( PNS_ITEM* link : jt->Links().Items() )
+ for( ITEM* link : jt->Links().Items() )
{
- if( link->OfKind( PNS_ITEM::VIA_T ) )
+ if( link->OfKind( ITEM::VIA_T ) )
via = link;
else if( aVisited.find( link ) == aVisited.end() )
- next_seg = static_cast<PNS_SEGMENT*>( link );
+ next_seg = static_cast<SEGMENT*>( link );
}
if( !next_seg )
return false;
- PNS_LINE l = m_world->AssembleLine( next_seg );
+ LINE l = m_world->AssembleLine( next_seg );
VECTOR2I nextAnchor = ( aLeft ? l.CLine().CPoint( -1 ) : l.CLine().CPoint( 0 ) );
@@ -233,31 +233,31 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET&
}
-const PNS_ITEMSET PNS_TOPOLOGY::AssembleTrivialPath( PNS_ITEM* aStart )
+const ITEM_SET TOPOLOGY::AssembleTrivialPath( ITEM* aStart )
{
- PNS_ITEMSET path;
- std::set<PNS_ITEM*> visited;
- PNS_SEGMENT* seg;
- PNS_VIA* via;
+ ITEM_SET path;
+ std::set<ITEM*> visited;
+ SEGMENT* seg;
+ VIA* via;
- seg = dyn_cast<PNS_SEGMENT*> (aStart);
+ seg = dyn_cast<SEGMENT*> (aStart);
- if(!seg && (via = dyn_cast<PNS_VIA*>( aStart ) ) )
+ if(!seg && (via = dyn_cast<VIA*>( aStart ) ) )
{
- PNS_JOINT *jt = m_world->FindJoint( via->Pos(), via );
+ JOINT *jt = m_world->FindJoint( via->Pos(), via );
if( !jt->IsNonFanoutVia() )
- return PNS_ITEMSET();
+ return ITEM_SET();
for( auto entry : jt->Links().Items() )
- if( ( seg = dyn_cast<PNS_SEGMENT*>( entry.item ) ) )
+ if( ( seg = dyn_cast<SEGMENT*>( entry.item ) ) )
break;
}
if( !seg )
- return PNS_ITEMSET();
+ return ITEM_SET();
- PNS_LINE l = m_world->AssembleLine( seg );
+ LINE l = m_world->AssembleLine( seg );
path.Add( l );
@@ -268,22 +268,22 @@ const PNS_ITEMSET PNS_TOPOLOGY::AssembleTrivialPath( PNS_ITEM* aStart )
}
-const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_JOINT* aStart, int aKindMask )
+const ITEM_SET TOPOLOGY::ConnectedItems( JOINT* aStart, int aKindMask )
{
- return PNS_ITEMSET();
+ return ITEM_SET();
}
-const PNS_ITEMSET PNS_TOPOLOGY::ConnectedItems( PNS_ITEM* aStart, int aKindMask )
+const ITEM_SET TOPOLOGY::ConnectedItems( ITEM* aStart, int aKindMask )
{
- return PNS_ITEMSET();
+ return ITEM_SET();
}
bool commonParallelProjection( SEG n, SEG p, SEG &pClip, SEG& nClip );
-bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
+bool TOPOLOGY::AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair )
{
int refNet = aStart->Net();
int coupledNet = m_world->GetRuleResolver()->DpCoupledNet( refNet );
@@ -291,18 +291,18 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
if( coupledNet < 0 )
return false;
- std::set<PNS_ITEM*> coupledItems;
+ std::set<ITEM*> coupledItems;
m_world->AllItemsInNet( coupledNet, coupledItems );
- PNS_SEGMENT* coupledSeg = NULL, *refSeg;
+ SEGMENT* coupledSeg = NULL, *refSeg;
int minDist = std::numeric_limits<int>::max();
- if( ( refSeg = dyn_cast<PNS_SEGMENT*>( aStart ) ) != NULL )
+ if( ( refSeg = dyn_cast<SEGMENT*>( aStart ) ) != NULL )
{
- for( PNS_ITEM* item : coupledItems )
+ for( ITEM* item : coupledItems )
{
- if( PNS_SEGMENT* s = dyn_cast<PNS_SEGMENT*>( item ) )
+ if( SEGMENT* s = dyn_cast<SEGMENT*>( item ) )
{
if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() )
{
@@ -329,8 +329,8 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
if( !coupledSeg )
return false;
- PNS_LINE lp = m_world->AssembleLine( refSeg );
- PNS_LINE ln = m_world->AssembleLine( coupledSeg );
+ LINE lp = m_world->AssembleLine( refSeg );
+ LINE ln = m_world->AssembleLine( coupledSeg );
if( m_world->GetRuleResolver()->DpNetPolarity( refNet ) < 0 )
{
@@ -347,7 +347,7 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
gap = (int) std::abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp.Width();
}
- aPair = PNS_DIFF_PAIR( lp, ln );
+ aPair = DIFF_PAIR( lp, ln );
aPair.SetWidth( lp.Width() );
aPair.SetLayers( lp.Layers() );
aPair.SetGap( gap );
@@ -355,25 +355,25 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
return true;
}
-const std::set<PNS_ITEM*> PNS_TOPOLOGY::AssembleCluster( PNS_ITEM* aStart, int aLayer )
+const std::set<ITEM*> TOPOLOGY::AssembleCluster( ITEM* aStart, int aLayer )
{
- std::set<PNS_ITEM*> visited;
- std::deque<PNS_ITEM*> pending;
+ std::set<ITEM*> visited;
+ std::deque<ITEM*> pending;
pending.push_back( aStart );
while( !pending.empty() )
{
- PNS_NODE::OBSTACLES obstacles;
- PNS_ITEM* top = pending.front();
+ NODE::OBSTACLES obstacles;
+ ITEM* top = pending.front();
pending.pop_front();
visited.insert( top );
- m_world->QueryColliding( top, obstacles, PNS_ITEM::ANY_T, -1, false );
+ m_world->QueryColliding( top, obstacles, ITEM::ANY_T, -1, false );
- for( PNS_OBSTACLE& obs : obstacles )
+ for( OBSTACLE& obs : obstacles )
{
if( visited.find( obs.m_item ) == visited.end() && obs.m_item->Layers().Overlaps( aLayer ) && !( obs.m_item->Marker() & MK_HEAD ) )
{
diff --git a/pcbnew/router/pns_topology.h b/pcbnew/router/pns_topology.h
index c4eb435..d0bfe93 100644
--- a/pcbnew/router/pns_topology.h
+++ b/pcbnew/router/pns_topology.h
@@ -29,46 +29,46 @@
namespace PNS {
-class PNS_NODE;
-class PNS_SEGMENT;
-class PNS_JOINT;
-class PNS_ITEM;
-class PNS_SOLID;
-class PNS_DIFF_PAIR;
-
-class PNS_TOPOLOGY
+class NODE;
+class SEGMENT;
+class JOINT;
+class ITEM;
+class SOLID;
+class DIFF_PAIR;
+
+class TOPOLOGY
{
public:
- typedef std::set<PNS_JOINT*> JOINT_SET;
+ typedef std::set<JOINT*> JOINT_SET;
- PNS_TOPOLOGY( PNS_NODE* aNode ):
+ TOPOLOGY( NODE* aNode ):
m_world( aNode ) {};
- ~PNS_TOPOLOGY() {};
+ ~TOPOLOGY() {};
- bool SimplifyLine( PNS_LINE *aLine );
- PNS_ITEM* NearestUnconnectedItem( PNS_JOINT* aStart, int* aAnchor = NULL, int aKindMask = PNS_ITEM::ANY_T );
- bool LeadingRatLine( const PNS_LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine );
+ bool SimplifyLine( LINE *aLine );
+ ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = NULL, int aKindMask = ITEM::ANY_T );
+ bool LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine );
- const JOINT_SET ConnectedJoints( PNS_JOINT* aStart );
- const PNS_ITEMSET ConnectedItems( PNS_JOINT* aStart, int aKindMask = PNS_ITEM::ANY_T );
- const PNS_ITEMSET ConnectedItems( PNS_ITEM* aStart, int aKindMask = PNS_ITEM::ANY_T );
- int64_t ShortestConnectionLength( PNS_ITEM* aFrom, PNS_ITEM* aTo );
+ const JOINT_SET ConnectedJoints( JOINT* aStart );
+ const ITEM_SET ConnectedItems( JOINT* aStart, int aKindMask = ITEM::ANY_T );
+ const ITEM_SET ConnectedItems( ITEM* aStart, int aKindMask = ITEM::ANY_T );
+ int64_t ShortestConnectionLength( ITEM* aFrom, ITEM* aTo );
- const PNS_ITEMSET AssembleTrivialPath( PNS_ITEM* aStart );
- const PNS_DIFF_PAIR AssembleDiffPair( PNS_SEGMENT* aStart );
+ const ITEM_SET AssembleTrivialPath( ITEM* aStart );
+ const DIFF_PAIR AssembleDiffPair( SEGMENT* aStart );
int DpCoupledNet( int aNet );
int DpNetPolarity( int aNet );
- const PNS_LINE DpCoupledLine( PNS_LINE* aLine );
- bool AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair );
+ const LINE DpCoupledLine( LINE* aLine );
+ bool AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair );
- const std::set<PNS_ITEM*> AssembleCluster( PNS_ITEM* aStart, int aLayer );
+ const std::set<ITEM*> AssembleCluster( ITEM* aStart, int aLayer );
private:
- bool followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& aSet, std::set<PNS_ITEM*>& aVisited );
+ bool followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set<ITEM*>& aVisited );
- PNS_NODE *m_world;
+ NODE *m_world;
};
}
diff --git a/pcbnew/router/pns_tune_status_popup.cpp b/pcbnew/router/pns_tune_status_popup.cpp
index 906fbbd..0d391a7 100644
--- a/pcbnew/router/pns_tune_status_popup.cpp
+++ b/pcbnew/router/pns_tune_status_popup.cpp
@@ -37,9 +37,9 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP()
}
-void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter )
+void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
{
- PNS::PNS_MEANDER_PLACER_BASE* placer = dynamic_cast<PNS::PNS_MEANDER_PLACER_BASE*>( aRouter->Placer() );
+ PNS::MEANDER_PLACER_BASE* placer = dynamic_cast<PNS::MEANDER_PLACER_BASE*>( aRouter->Placer() );
if( !placer )
return;
@@ -50,13 +50,13 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::PNS_ROUTER* aRouter )
switch( placer->TuningStatus() )
{
- case PNS::PNS_MEANDER_PLACER::TUNED:
+ case PNS::MEANDER_PLACER::TUNED:
color = wxColour( 0, 255, 0 );
break;
- case PNS::PNS_MEANDER_PLACER::TOO_SHORT:
+ case PNS::MEANDER_PLACER::TOO_SHORT:
color = wxColour( 255, 128, 128 );
break;
- case PNS::PNS_MEANDER_PLACER::TOO_LONG:
+ case PNS::MEANDER_PLACER::TOO_LONG:
color = wxColour( 128, 128, 255 );
break;
}
diff --git a/pcbnew/router/pns_tune_status_popup.h b/pcbnew/router/pns_tune_status_popup.h
index 52d4bf0..6d02d94 100644
--- a/pcbnew/router/pns_tune_status_popup.h
+++ b/pcbnew/router/pns_tune_status_popup.h
@@ -30,7 +30,7 @@
namespace PNS {
-class PNS_ROUTER;
+class ROUTER;
}
@@ -40,7 +40,7 @@ public:
PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
~PNS_TUNE_STATUS_POPUP();
- void UpdateStatus( PNS::PNS_ROUTER* aRouter );
+ void UpdateStatus( PNS::ROUTER* aRouter );
private:
wxStaticText* m_statusLine;
diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp
index 0e3a29d..8c68637 100644
--- a/pcbnew/router/pns_utils.cpp
+++ b/pcbnew/router/pns_utils.cpp
@@ -174,13 +174,13 @@ void DrawDebugPoint( VECTOR2I aP, int aColor )
l.Append( aP - VECTOR2I( -50000, -50000 ) );
l.Append( aP + VECTOR2I( -50000, -50000 ) );
- PNS_ROUTER::GetInstance()->DisplayDebugLine ( l, aColor, 10000 );
+ ROUTER::GetInstance()->DisplayDebugLine ( l, aColor, 10000 );
l.Clear();
l.Append( aP - VECTOR2I( 50000, -50000 ) );
l.Append( aP + VECTOR2I( 50000, -50000 ) );
- PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
+ ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
}
@@ -197,7 +197,7 @@ void DrawDebugBox( BOX2I aB, int aColor )
l.Append( o.x, o.y + s.y );
l.Append( o );
- PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
+ ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
}
@@ -208,7 +208,7 @@ void DrawDebugSeg( SEG aS, int aColor )
l.Append( aS.A );
l.Append( aS.B );
- PNS_ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
+ ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
}
@@ -228,19 +228,19 @@ void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor )
}
#endif
-OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB )
+OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB )
{
- if( aItemA->OfKind( PNS_ITEM::VIA_T ) && aItemB->OfKind( PNS_ITEM::VIA_T ) )
+ if( aItemA->OfKind( ITEM::VIA_T ) && aItemB->OfKind( ITEM::VIA_T ) )
{
- const PNS_VIA* va = static_cast<const PNS_VIA*>( aItemA );
- const PNS_VIA* vb = static_cast<const PNS_VIA*>( aItemB );
+ const VIA* va = static_cast<const VIA*>( aItemA );
+ const VIA* vb = static_cast<const VIA*>( aItemB );
return va->ChangedArea( vb );
}
- else if( aItemA->OfKind( PNS_ITEM::LINE_T ) && aItemB->OfKind( PNS_ITEM::LINE_T ) )
+ else if( aItemA->OfKind( ITEM::LINE_T ) && aItemB->OfKind( ITEM::LINE_T ) )
{
- const PNS_LINE* la = static_cast<const PNS_LINE*> ( aItemA );
- const PNS_LINE* lb = static_cast<const PNS_LINE*> ( aItemB );
+ const LINE* la = static_cast<const LINE*> ( aItemA );
+ const LINE* lb = static_cast<const LINE*> ( aItemB );
return la->ChangedArea( lb );
}
diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h
index 3728793..3dbd85f 100644
--- a/pcbnew/router/pns_utils.h
+++ b/pcbnew/router/pns_utils.h
@@ -33,7 +33,7 @@ namespace PNS {
constexpr int HULL_MARGIN = 10;
-class PNS_ITEM;
+class ITEM;
/** Various utility functions */
@@ -62,7 +62,7 @@ void DrawDebugBox( BOX2I aB, int aColor );
void DrawDebugSeg( SEG aS, int aColor );
void DrawDebugDirs( VECTOR2D aP, int aMask, int aColor );
#endif
-OPT_BOX2I ChangedArea( const PNS_ITEM* aItemA, const PNS_ITEM* aItemB );
+OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB );
}
diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp
index 6706810..4ad5b47 100644
--- a/pcbnew/router/pns_via.cpp
+++ b/pcbnew/router/pns_via.cpp
@@ -28,17 +28,17 @@
namespace PNS {
-bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce,
+bool VIA::PushoutForce( NODE* aNode, const VECTOR2I& aDirection, VECTOR2I& aForce,
bool aSolidsOnly, int aMaxIterations )
{
int iter = 0;
- PNS_VIA mv( *this );
+ VIA mv( *this );
VECTOR2I force, totalForce, force2;
while( iter < aMaxIterations )
{
- PNS_NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv,
- aSolidsOnly ? PNS_ITEM::SOLID_T : PNS_ITEM::ANY_T );
+ NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv,
+ aSolidsOnly ? ITEM::SOLID_T : ITEM::ANY_T );
if( !obs )
break;
@@ -71,7 +71,7 @@ bool PNS_VIA::PushoutForce( PNS_NODE* aNode, const VECTOR2I& aDirection, VECTOR2
}
-const SHAPE_LINE_CHAIN PNS_VIA::Hull( int aClearance, int aWalkaroundThickness ) const
+const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness ) const
{
int cl = ( aClearance + aWalkaroundThickness / 2 );
@@ -81,9 +81,9 @@ const SHAPE_LINE_CHAIN PNS_VIA::Hull( int aClearance, int aWalkaroundThickness )
}
-PNS_VIA* PNS_VIA::Clone() const
+VIA* VIA::Clone() const
{
- PNS_VIA* v = new PNS_VIA();
+ VIA* v = new VIA();
v->SetNet( Net() );
v->SetLayers( Layers() );
@@ -99,7 +99,7 @@ PNS_VIA* PNS_VIA::Clone() const
}
-OPT_BOX2I PNS_VIA::ChangedArea( const PNS_VIA* aOther ) const
+OPT_BOX2I VIA::ChangedArea( const VIA* aOther ) const
{
if ( aOther->Pos() != Pos() )
{
diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h
index 96b126b..bf7e9f1 100644
--- a/pcbnew/router/pns_via.h
+++ b/pcbnew/router/pns_via.h
@@ -31,22 +31,22 @@
namespace PNS {
-class PNS_NODE;
+class NODE;
-class PNS_VIA : public PNS_ITEM
+class VIA : public ITEM
{
public:
- PNS_VIA() :
- PNS_ITEM( VIA_T )
+ VIA() :
+ ITEM( VIA_T )
{
m_diameter = 2; // Dummy value
m_drill = 0;
m_viaType = VIA_THROUGH;
}
- PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
+ VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers,
int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) :
- PNS_ITEM( VIA_T )
+ ITEM( VIA_T )
{
SetNet( aNet );
SetLayers( aLayers );
@@ -59,14 +59,14 @@ public:
//If we're a through-board via, use all layers regardless of the set passed
if( aViaType == VIA_THROUGH )
{
- PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
+ LAYER_RANGE allLayers( 0, MAX_CU_LAYERS - 1 );
SetLayers( allLayers );
}
}
- PNS_VIA( const PNS_VIA& aB ) :
- PNS_ITEM( VIA_T )
+ VIA( const VIA& aB ) :
+ ITEM( VIA_T )
{
SetNet( aB.Net() );
SetLayers( aB.Layers() );
@@ -79,7 +79,7 @@ public:
m_viaType = aB.m_viaType;
}
- static inline bool ClassOf( const PNS_ITEM* aItem )
+ static inline bool ClassOf( const ITEM* aItem )
{
return aItem && VIA_T == aItem->Kind();
}
@@ -127,7 +127,7 @@ public:
m_drill = aDrill;
}
- bool PushoutForce( PNS_NODE* aNode,
+ bool PushoutForce( NODE* aNode,
const VECTOR2I& aDirection,
VECTOR2I& aForce,
bool aSolidsOnly = true,
@@ -138,7 +138,7 @@ public:
return &m_shape;
}
- PNS_VIA* Clone() const;
+ VIA* Clone() const;
const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const;
@@ -152,7 +152,7 @@ public:
return 1;
}
- OPT_BOX2I ChangedArea( const PNS_VIA* aOther ) const;
+ OPT_BOX2I ChangedArea( const VIA* aOther ) const;
private:
int m_diameter;
diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp
index 6ff094d..3e26ea4 100644
--- a/pcbnew/router/pns_walkaround.cpp
+++ b/pcbnew/router/pns_walkaround.cpp
@@ -31,16 +31,16 @@ using boost::optional;
namespace PNS {
-void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath )
+void WALKAROUND::start( const LINE& aInitialPath )
{
m_iteration = 0;
m_iterationLimit = 50;
}
-PNS_NODE::OPT_OBSTACLE PNS_WALKAROUND::nearestObstacle( const PNS_LINE& aPath )
+NODE::OPT_OBSTACLE WALKAROUND::nearestObstacle( const LINE& aPath )
{
- PNS_NODE::OPT_OBSTACLE obs = m_world->NearestObstacle( &aPath, m_itemMask, m_restrictedSet.empty() ? NULL : &m_restrictedSet );
+ NODE::OPT_OBSTACLE obs = m_world->NearestObstacle( &aPath, m_itemMask, m_restrictedSet.empty() ? NULL : &m_restrictedSet );
if( m_restrictedSet.empty() )
return obs;
@@ -48,14 +48,14 @@ PNS_NODE::OPT_OBSTACLE PNS_WALKAROUND::nearestObstacle( const PNS_LINE& aPath )
else if( obs && m_restrictedSet.find ( obs->m_item ) != m_restrictedSet.end() )
return obs;
- return PNS_NODE::OPT_OBSTACLE();
+ return NODE::OPT_OBSTACLE();
}
-PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
+WALKAROUND::WALKAROUND_STATUS WALKAROUND::singleStep( LINE& aPath,
bool aWindingDirection )
{
- optional<PNS_OBSTACLE>& current_obs =
+ optional<OBSTACLE>& current_obs =
aWindingDirection ? m_currentObstacle[0] : m_currentObstacle[1];
bool& prev_recursive = aWindingDirection ? m_recursiveCollision[0] : m_recursiveCollision[1];
@@ -97,7 +97,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
int len_pre = path_walk[0].Length();
int len_alt = path_walk[1].Length();
- PNS_LINE walk_path( aPath, path_walk[1] );
+ LINE walk_path( aPath, path_walk[1] );
bool alt_collides = static_cast<bool>( m_world->CheckColliding( &walk_path, m_itemMask ) );
@@ -110,9 +110,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_post[1] );
if( !path_post[1].PointCount() || !path_walk[1].PointCount() )
- current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[1] ) );
+ current_obs = nearestObstacle( LINE( aPath, path_pre[1] ) );
else
- current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) );
+ current_obs = nearestObstacle( LINE( aPath, path_post[1] ) );
prev_recursive = false;
}
else
@@ -122,14 +122,14 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_post[0] );
if( !path_post[0].PointCount() || !path_walk[0].PointCount() )
- current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[0] ) );
+ current_obs = nearestObstacle( LINE( aPath, path_pre[0] ) );
else
- current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) );
+ current_obs = nearestObstacle( LINE( aPath, path_walk[0] ) );
if( !current_obs )
{
prev_recursive = false;
- current_obs = nearestObstacle( PNS_LINE( aPath, path_post[0] ) );
+ current_obs = nearestObstacle( LINE( aPath, path_post[0] ) );
}
else
prev_recursive = true;
@@ -142,10 +142,10 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
}
-PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitialPath,
- PNS_LINE& aWalkPath, bool aOptimize )
+WALKAROUND::WALKAROUND_STATUS WALKAROUND::Route( const LINE& aInitialPath,
+ LINE& aWalkPath, bool aOptimize )
{
- PNS_LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
+ LINE path_cw( aInitialPath ), path_ccw( aInitialPath );
WALKAROUND_STATUS s_cw = IN_PROGRESS, s_ccw = IN_PROGRESS;
SHAPE_LINE_CHAIN best_path;
@@ -268,7 +268,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::Route( const PNS_LINE& aInitia
if( st == DONE )
{
if( aOptimize )
- PNS_OPTIMIZER::Optimize( &aWalkPath, PNS_OPTIMIZER::MERGE_OBTUSE, m_world );
+ OPTIMIZER::Optimize( &aWalkPath, OPTIMIZER::MERGE_OBTUSE, m_world );
}
return st;
diff --git a/pcbnew/router/pns_walkaround.h b/pcbnew/router/pns_walkaround.h
index 583595d..ff6087d 100644
--- a/pcbnew/router/pns_walkaround.h
+++ b/pcbnew/router/pns_walkaround.h
@@ -32,13 +32,13 @@
namespace PNS {
-class PNS_WALKAROUND : public PNS_ALGO_BASE
+class WALKAROUND : public ALGO_BASE
{
static const int DefaultIterationLimit = 50;
public:
- PNS_WALKAROUND( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
- PNS_ALGO_BASE ( aRouter ),
+ WALKAROUND( NODE* aWorld, ROUTER* aRouter ) :
+ ALGO_BASE ( aRouter ),
m_world( aWorld ),
m_iterationLimit( DefaultIterationLimit )
{
@@ -46,7 +46,7 @@ public:
m_forceLongerPath = false;
m_forceWinding = false;
m_cursorApproachMode = false;
- m_itemMask = PNS_ITEM::ANY_T;
+ m_itemMask = ITEM::ANY_T;
// Initialize other members, to avoid uninitialized variables.
m_recursiveBlockageCount = 0;
@@ -55,7 +55,7 @@ public:
m_forceCw = false;
}
- ~PNS_WALKAROUND() {};
+ ~WALKAROUND() {};
enum WALKAROUND_STATUS
{
@@ -64,7 +64,7 @@ public:
STUCK
};
- void SetWorld( PNS_NODE* aNode )
+ void SetWorld( NODE* aNode )
{
m_world = aNode;
}
@@ -77,9 +77,9 @@ public:
void SetSolidsOnly( bool aSolidsOnly )
{
if( aSolidsOnly )
- m_itemMask = PNS_ITEM::SOLID_T;
+ m_itemMask = ITEM::SOLID_T;
else
- m_itemMask = PNS_ITEM::ANY_T;
+ m_itemMask = ITEM::ANY_T;
}
void SetItemMask( int aMask )
@@ -110,7 +110,7 @@ public:
m_forceWinding = aEnabled;
}
- void RestrictToSet( bool aEnabled, const std::set<PNS_ITEM*>& aSet )
+ void RestrictToSet( bool aEnabled, const std::set<ITEM*>& aSet )
{
if( aEnabled )
m_restrictedSet = aSet;
@@ -118,21 +118,21 @@ public:
m_restrictedSet.clear();
}
- WALKAROUND_STATUS Route( const PNS_LINE& aInitialPath, PNS_LINE& aWalkPath,
+ WALKAROUND_STATUS Route( const LINE& aInitialPath, LINE& aWalkPath,
bool aOptimize = true );
- virtual PNS_LOGGER* Logger()
+ virtual LOGGER* Logger()
{
return &m_logger;
}
private:
- void start( const PNS_LINE& aInitialPath );
+ void start( const LINE& aInitialPath );
- WALKAROUND_STATUS singleStep( PNS_LINE& aPath, bool aWindingDirection );
- PNS_NODE::OPT_OBSTACLE nearestObstacle( const PNS_LINE& aPath );
+ WALKAROUND_STATUS singleStep( LINE& aPath, bool aWindingDirection );
+ NODE::OPT_OBSTACLE nearestObstacle( const LINE& aPath );
- PNS_NODE* m_world;
+ NODE* m_world;
int m_recursiveBlockageCount;
int m_iteration;
@@ -143,10 +143,10 @@ private:
bool m_forceWinding;
bool m_forceCw;
VECTOR2I m_cursorPos;
- PNS_NODE::OPT_OBSTACLE m_currentObstacle[2];
+ NODE::OPT_OBSTACLE m_currentObstacle[2];
bool m_recursiveCollision[2];
- PNS_LOGGER m_logger;
- std::set<PNS_ITEM*> m_restrictedSet;
+ LOGGER m_logger;
+ std::set<ITEM*> m_restrictedSet;
};
}
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index 13dc99b..7e15eda 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -37,7 +37,7 @@
using namespace KIGFX;
-ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem, VIEW_GROUP* aParent ) :
+ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, VIEW_GROUP* aParent ) :
EDA_ITEM( NOT_USED )
{
m_parent = aParent;
@@ -64,13 +64,13 @@ ROUTER_PREVIEW_ITEM::~ROUTER_PREVIEW_ITEM()
}
-void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
+void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem )
{
m_originLayer = aItem->Layers().Start();
- if( aItem->OfKind( PNS::PNS_ITEM::LINE_T ) )
+ if( aItem->OfKind( PNS::ITEM::LINE_T ) )
{
- const PNS::PNS_LINE* l = static_cast<const PNS::PNS_LINE*>( aItem );
+ const PNS::LINE* l = static_cast<const PNS::LINE*>( aItem );
if( !l->SegmentCount() )
return;
@@ -86,20 +86,20 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
switch( aItem->Kind() )
{
- case PNS::PNS_ITEM::LINE_T:
+ case PNS::ITEM::LINE_T:
m_type = PR_SHAPE;
- m_width = ( (PNS::PNS_LINE*) aItem )->Width();
+ m_width = ( (PNS::LINE*) aItem )->Width();
break;
- case PNS::PNS_ITEM::SEGMENT_T:
+ case PNS::ITEM::SEGMENT_T:
{
- PNS::PNS_SEGMENT* seg = (PNS::PNS_SEGMENT*) aItem;
+ PNS::SEGMENT* seg = (PNS::SEGMENT*) aItem;
m_type = PR_SHAPE;
m_width = seg->Width();
break;
}
- case PNS::PNS_ITEM::VIA_T:
+ case PNS::ITEM::VIA_T:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE;
m_width = 0;
@@ -107,7 +107,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::PNS_ITEM* aItem )
m_depth = ViaOverlayDepth;
break;
- case PNS::PNS_ITEM::SOLID_T:
+ case PNS::ITEM::SOLID_T:
m_type = PR_SHAPE;
m_width = 0;
break;
diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h
index 56bb97b..33f211c 100644
--- a/pcbnew/router/router_preview_item.h
+++ b/pcbnew/router/router_preview_item.h
@@ -41,8 +41,8 @@
namespace PNS {
-class PNS_ITEM;
-class PNS_ROUTER;
+class ITEM;
+class ROUTER;
}
@@ -56,10 +56,10 @@ public:
PR_SHAPE
};
- ROUTER_PREVIEW_ITEM( const PNS::PNS_ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL );
+ ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = NULL, KIGFX::VIEW_GROUP* aParent = NULL );
~ROUTER_PREVIEW_ITEM();
- void Update( const PNS::PNS_ITEM* aItem );
+ void Update( const PNS::ITEM* aItem );
void StuckMarker( VECTOR2I& aPosition );
@@ -107,7 +107,7 @@ private:
KIGFX::VIEW_GROUP* m_parent;
- PNS::PNS_ROUTER* m_router;
+ PNS::ROUTER* m_router;
SHAPE* m_shape;
ITEM_TYPE m_type;
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index 9407fc2..2e62349 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -110,7 +110,7 @@ static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimension
ROUTER_TOOL::ROUTER_TOOL() :
- PNS_TOOL_BASE( "pcbnew.InteractiveRouter" )
+ TOOL_BASE( "pcbnew.InteractiveRouter" )
{
}
@@ -200,7 +200,7 @@ private:
class ROUTER_TOOL_MENU: public CONTEXT_MENU
{
public:
- ROUTER_TOOL_MENU( BOARD* aBoard, PNS::PNS_ROUTER_MODE aMode )
+ ROUTER_TOOL_MENU( BOARD* aBoard, PNS::ROUTER_MODE aMode )
{
SetTitle( _( "Interactive Router" ) );
Add( ACT_NewTrack );
@@ -223,7 +223,7 @@ public:
Add( ACT_SetDpDimensions );
AppendSeparator();
- Add( PNS::PNS_TOOL_BASE::ACT_RouterOptions );
+ Add( PNS::TOOL_BASE::ACT_RouterOptions );
}
private:
@@ -245,7 +245,7 @@ bool ROUTER_TOOL::Init()
void ROUTER_TOOL::Reset( RESET_REASON aReason )
{
- PNS_TOOL_BASE::Reset( aReason );
+ TOOL_BASE::Reset( aReason );
Go( &ROUTER_TOOL::RouteSingleTrace, COMMON_ACTIONS::routerActivateSingle.MakeEvent() );
Go( &ROUTER_TOOL::RouteDiffPair, COMMON_ACTIONS::routerActivateDiffPair.MakeEvent() );
@@ -314,7 +314,7 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
}
else if( aEvent.IsAction( &ACT_SetDpDimensions ) )
{
- PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::SIZES_SETTINGS sizes = m_router->Sizes();
DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
if( settingsDlg.ShowModal() )
@@ -337,20 +337,20 @@ void ROUTER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
else if( aEvent.IsAction( &COMMON_ACTIONS::trackViaSizeChanged ) )
{
- PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
+ PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
sizes.ImportCurrent( m_board->GetDesignSettings() );
m_router->UpdateSizes( sizes );
}
}
-int ROUTER_TOOL::getStartLayer( const PNS::PNS_ITEM* aItem )
+int ROUTER_TOOL::getStartLayer( const PNS::ITEM* aItem )
{
int tl = getView()->GetTopLayer();
if( m_startItem )
{
- const PNS_LAYERSET& ls = m_startItem->Layers();
+ const LAYER_RANGE& ls = m_startItem->Layers();
if( ls.Overlaps( tl ) )
return tl;
@@ -391,7 +391,7 @@ bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType )
LAYER_ID pairTop = m_frame->GetScreen()->m_Route_Layer_TOP;
LAYER_ID pairBottom = m_frame->GetScreen()->m_Route_Layer_BOTTOM;
- PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::SIZES_SETTINGS sizes = m_router->Sizes();
// fixme: P&S supports more than one fixed layer pair. Update the dialog?
sizes.ClearLayerPairs();
@@ -507,7 +507,7 @@ bool ROUTER_TOOL::prepareInteractive()
m_ctls->ForceCursorPosition( false );
m_ctls->SetAutoPan( true );
- PNS::PNS_SIZES_SETTINGS sizes( m_router->Sizes() );
+ PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
sizes.Init( m_board, m_startItem );
sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP,
@@ -619,7 +619,7 @@ int ROUTER_TOOL::DpDimensionsDialog( const TOOL_EVENT& aEvent )
{
Activate();
- PNS::PNS_SIZES_SETTINGS sizes = m_router->Sizes();
+ PNS::SIZES_SETTINGS sizes = m_router->Sizes();
DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
if( settingsDlg.ShowModal() )
@@ -660,7 +660,7 @@ int ROUTER_TOOL::RouteDiffPair( const TOOL_EVENT& aEvent )
}
-int ROUTER_TOOL::mainLoop( PNS::PNS_ROUTER_MODE aMode )
+int ROUTER_TOOL::mainLoop( PNS::ROUTER_MODE aMode )
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD* board = getModel<BOARD>();
diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h
index ddf1fb9..95d0cdd 100644
--- a/pcbnew/router/router_tool.h
+++ b/pcbnew/router/router_tool.h
@@ -25,7 +25,7 @@
#include "pns_tool_base.h"
-class APIEXPORT ROUTER_TOOL : public PNS::PNS_TOOL_BASE
+class APIEXPORT ROUTER_TOOL : public PNS::TOOL_BASE
{
public:
ROUTER_TOOL();
@@ -43,7 +43,7 @@ public:
private:
- int mainLoop( PNS::PNS_ROUTER_MODE aMode );
+ int mainLoop( PNS::ROUTER_MODE aMode );
int getDefaultWidth( int aNetCode );
@@ -53,7 +53,7 @@ private:
void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill );
void handleCommonEvents( const TOOL_EVENT& evt );
- int getStartLayer( const PNS::PNS_ITEM* aItem );
+ int getStartLayer( const PNS::ITEM* aItem );
void switchLayerOnViaPlacement();
bool onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType );
--
2.9.0.windows.1
>From 0a007d44b5a4d5478e703db7b10100494bd9f9d0 Mon Sep 17 00:00:00 2001
From: decimad <michsteinb@xxxxxxxxx>
Date: Mon, 29 Aug 2016 19:48:16 +0200
Subject: [PATCH] use unique_ptr to document ownership (PNS::ROUTER)
---
pcbnew/router/pns_router.cpp | 51 ++++++++++++++++----------------------------
pcbnew/router/pns_router.h | 17 +++++++++------
2 files changed, 28 insertions(+), 40 deletions(-)
diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp
index 2978e16..1a72718 100644
--- a/pcbnew/router/pns_router.cpp
+++ b/pcbnew/router/pns_router.cpp
@@ -70,18 +70,14 @@ ROUTER::ROUTER()
m_state = IDLE;
- m_world = NULL;
- m_placer = NULL;
- m_dragger = NULL;
m_mode = PNS_MODE_ROUTE_SINGLE;
// Initialize all other variables:
- m_lastNode = NULL;
- m_shove = NULL;
+ m_lastNode = nullptr;
m_iterLimit = 0;
m_showInterSteps = false;
m_snapshotIter = 0;
- m_view = NULL;
+ m_view = nullptr;
m_snappingEnabled = false;
m_violation = false;
}
@@ -96,15 +92,15 @@ ROUTER* ROUTER::GetInstance()
ROUTER::~ROUTER()
{
ClearWorld();
- theRouter = NULL;
+ theRouter = nullptr;
}
void ROUTER::SyncWorld( )
{
ClearWorld();
- m_world = new NODE;
- m_iface->SyncWorld( m_world );
+ m_world = std::unique_ptr< NODE >( new NODE );
+ m_iface->SyncWorld( m_world.get() );
}
@@ -113,15 +109,10 @@ void ROUTER::ClearWorld()
if( m_world )
{
m_world->KillChildren();
- delete m_world;
+ m_world.reset();
}
- if( m_placer )
- delete m_placer;
-
-
- m_world = NULL;
- m_placer = NULL;
+ m_placer.reset();
}
@@ -146,15 +137,15 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM* aStartItem )
if( !aStartItem || aStartItem->OfKind( ITEM::SOLID_T ) )
return false;
- m_dragger = new DRAGGER( this );
- m_dragger->SetWorld( m_world );
+ m_dragger.reset( new DRAGGER( this ) );
+ m_dragger->SetWorld( m_world.get() );
m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () );
if( m_dragger->Start ( aP, aStartItem ) )
m_state = DRAG_SEGMENT;
else
{
- delete m_dragger;
+ m_dragger.reset();
m_state = IDLE;
return false;
}
@@ -167,19 +158,19 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
switch( m_mode )
{
case PNS_MODE_ROUTE_SINGLE:
- m_placer = new LINE_PLACER( this );
+ m_placer.reset( new LINE_PLACER( this ) );
break;
case PNS_MODE_ROUTE_DIFF_PAIR:
- m_placer = new DIFF_PAIR_PLACER( this );
+ m_placer.reset( new DIFF_PAIR_PLACER( this ) );
break;
case PNS_MODE_TUNE_SINGLE:
- m_placer = new MEANDER_PLACER( this );
+ m_placer.reset( new MEANDER_PLACER( this ) );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
- m_placer = new DP_MEANDER_PLACER( this );
+ m_placer.reset( new DP_MEANDER_PLACER( this ) );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
- m_placer = new MEANDER_SKEW_PLACER( this );
+ m_placer.reset( new MEANDER_SKEW_PLACER( this ) );
break;
default:
@@ -387,14 +378,8 @@ void ROUTER::StopRouting()
if( !RoutingInProgress() )
return;
- if( m_placer )
- delete m_placer;
-
- if( m_dragger )
- delete m_dragger;
-
- m_placer = NULL;
- m_dragger = NULL;
+ m_placer.reset();
+ m_dragger.reset();
m_iface->EraseView();
@@ -455,7 +440,7 @@ int ROUTER::GetCurrentLayer() const
void ROUTER::DumpLog()
{
- LOGGER* logger = NULL;
+ LOGGER* logger = nullptr;
switch( m_state )
{
diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h
index e77c2e3..66b0e52 100644
--- a/pcbnew/router/pns_router.h
+++ b/pcbnew/router/pns_router.h
@@ -24,6 +24,7 @@
#include <list>
+#include <memory>
#include <boost/optional.hpp>
#include <boost/unordered_set.hpp>
@@ -132,7 +133,7 @@ public:
NODE* GetWorld() const
{
- return m_world;
+ return m_world.get();
}
void FlipPosture();
@@ -214,7 +215,7 @@ public:
void SetFailureReason ( const wxString& aReason ) { m_failureReason = aReason; }
const wxString& FailureReason() const { return m_failureReason; }
- PLACEMENT_ALGO* Placer() { return m_placer; }
+ PLACEMENT_ALGO* Placer() { return m_placer.get(); }
ROUTER_IFACE* GetInterface() const
{
@@ -250,11 +251,13 @@ private:
VECTOR2I m_currentEnd;
RouterState m_state;
- NODE* m_world;
- NODE* m_lastNode;
- PLACEMENT_ALGO * m_placer;
- DRAGGER* m_dragger;
- SHOVE* m_shove;
+ std::unique_ptr< NODE > m_world;
+ NODE* m_lastNode;
+
+ std::unique_ptr< PLACEMENT_ALGO > m_placer;
+ std::unique_ptr< DRAGGER > m_dragger;
+ std::unique_ptr< SHOVE > m_shove;
+
ROUTER_IFACE* m_iface;
int m_iterLimit;
--
2.9.0.windows.1
Follow ups