router: fixed snapping to target while placing diff pair

This commit is contained in:
Tomasz Wlostowski 2015-08-21 16:35:34 +02:00 committed by Maciej Suminski
parent 2605ab0984
commit b4135e0a33
11 changed files with 51 additions and 34 deletions

View File

@ -505,7 +505,7 @@ bool PNS_DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aI
NETINFO_ITEM* netInfoP = brd->FindNet( netNameP );
NETINFO_ITEM* netInfoN = brd->FindNet( netNameN );
if( !netInfoP || !netInfoN )
return false;
@ -819,3 +819,12 @@ void PNS_DIFF_PAIR_PLACER::updateLeadingRatLine()
Router()->DisplayDebugLine( ratLineN, 3, 10000 );
}
}
const std::vector<int> PNS_DIFF_PAIR_PLACER::CurrentNets() const
{
std::vector<int> rv;
rv.push_back( m_netP );
rv.push_back( m_netN );
return rv;
}

View File

@ -117,14 +117,11 @@ public:
}
/**
* Function CurrentNet()
* Function CurrentNets()
*
* Returns the net code of currently routed track.
*/
int CurrentNet() const
{
return m_currentNet;
}
const std::vector<int> CurrentNets() const;
/**
* Function CurrentLayer()

View File

@ -356,12 +356,6 @@ const VECTOR2I& PNS_DP_MEANDER_PLACER::CurrentEnd() const
}
int PNS_DP_MEANDER_PLACER::CurrentNet() const
{
return m_initialSegment->Net();
}
int PNS_DP_MEANDER_PLACER::CurrentLayer() const
{
return m_initialSegment->Layers().Start();
@ -402,3 +396,11 @@ PNS_DP_MEANDER_PLACER::TUNING_STATUS PNS_DP_MEANDER_PLACER::TuningStatus() const
{
return m_lastStatus;
}
const std::vector<int> PNS_DP_MEANDER_PLACER::CurrentNets() const
{
std::vector<int> rv;
rv.push_back( m_originPair.NetP() );
rv.push_back( m_originPair.NetN() );
return rv;
}

View File

@ -92,7 +92,9 @@ public:
const VECTOR2I& CurrentEnd() const;
int CurrentNet() const;
/// @copydoc PNS_PLACEMENT_ALGO::CurrentNets()
const std::vector<int> CurrentNets() const;
int CurrentLayer() const;
int totalLength();

View File

@ -141,9 +141,9 @@ public:
*
* Returns the net code of currently routed track.
*/
int CurrentNet() const
const std::vector<int> CurrentNets() const
{
return m_currentNet;
return std::vector<int>( 1, m_currentNet );
}
/**

View File

@ -229,13 +229,6 @@ const VECTOR2I& PNS_MEANDER_PLACER::CurrentEnd() const
return m_currentEnd;
}
int PNS_MEANDER_PLACER::CurrentNet() const
{
return m_initialSegment->Net();
}
int PNS_MEANDER_PLACER::CurrentLayer() const
{
return m_initialSegment->Layers().Start();

View File

@ -68,8 +68,11 @@ public:
/// @copydoc PNS_PLACEMENT_ALGO::CurrentEnd()
const VECTOR2I& CurrentEnd() const;
/// @copydoc PNS_PLACEMENT_ALGO::CurrentNet()
int CurrentNet() const;
/// @copydoc PNS_PLACEMENT_ALGO::CurrentNets()
const std::vector<int> CurrentNets() const
{
return std::vector<int> (1, m_originLine.Net() );
}
/// @copydoc PNS_PLACEMENT_ALGO::CurrentLayer()
int CurrentLayer() const;

View File

@ -115,17 +115,17 @@ public:
/**
* Function CurrentEnd()
*
* Returns the current end of the line being placed/tuned. It may not be equal
* Returns the current end of the line(s) being placed/tuned. It may not be equal
* to the cursor position due to collisions.
*/
virtual const VECTOR2I& CurrentEnd() const = 0;
/**
* Function CurrentNet()
* Function CurrentNets()
*
* Returns the net code of currently routed track.
* Returns the net code(s) of currently routed track(s).
*/
virtual int CurrentNet() const = 0;
virtual const std::vector<int> CurrentNets() const = 0;
/**
* Function CurrentLayer()

View File

@ -1018,11 +1018,12 @@ void PNS_ROUTER::ToggleViaPlacement()
}
int PNS_ROUTER::GetCurrentNet() const
const std::vector<int> PNS_ROUTER::GetCurrentNets() const
{
if( m_placer )
return m_placer->CurrentNet();
return -1;
return m_placer->CurrentNets();
return std::vector<int>();
}

View File

@ -129,7 +129,7 @@ public:
void SetOrthoMode ( bool aEnable );
int GetCurrentLayer() const;
int GetCurrentNet() const;
const std::vector<int> GetCurrentNets() const;
void DumpLog();

View File

@ -251,7 +251,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
m_router->EnableSnapping( snapEnabled );
if( m_router->GetCurrentNet() < 0 )
if( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 )
{
m_endItem = NULL;
m_endSnapPoint = cp;
@ -265,7 +265,17 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
else
layer = m_router->GetCurrentLayer();
PNS_ITEM* endItem = pickSingleItem( p, m_router->GetCurrentNet(), layer );
PNS_ITEM* endItem = NULL;
std::vector<int> nets = m_router->GetCurrentNets();
BOOST_FOREACH( int net, nets )
{
endItem = pickSingleItem( p, net, layer );
if( endItem )
break;
}
if( endItem )
{