FIx layer switching after via placement in PNS router.
This commit is contained in:
parent
0953d5730b
commit
327f307a7f
|
@ -758,9 +758,12 @@ void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PNS_LINE_PLACER::SetLayer(int aLayer)
|
void PNS_LINE_PLACER::SetLayer( int aLayer )
|
||||||
{
|
{
|
||||||
m_currentLayer = aLayer;
|
m_currentLayer = aLayer;
|
||||||
|
|
||||||
|
m_head.SetLayer( aLayer );
|
||||||
|
m_tail.SetLayer( aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -901,9 +904,18 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
||||||
VECTOR2I p_start = m_placingVia ? p_last : p_pre_last;
|
VECTOR2I p_start = m_placingVia ? p_last : p_pre_last;
|
||||||
|
|
||||||
if( m_placingVia )
|
if( m_placingVia )
|
||||||
m_currentLayer = Router()->NextCopperLayer( true );
|
{
|
||||||
|
int layerTop = Router()->Settings().GetLayerTop();
|
||||||
|
int layerBottom = Router()->Settings().GetLayerBottom();
|
||||||
|
|
||||||
setWorld ( Router()->GetWorld()->Branch() );
|
// Change the current layer to the other side of the board
|
||||||
|
if( m_currentLayer == layerTop )
|
||||||
|
m_currentLayer = layerBottom;
|
||||||
|
else
|
||||||
|
m_currentLayer = layerTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
setWorld( Router()->GetWorld()->Branch() );
|
||||||
startPlacement( p_start, m_head.Net(), m_head.Width(), m_currentLayer );
|
startPlacement( p_start, m_head.Net(), m_head.Width(), m_currentLayer );
|
||||||
|
|
||||||
m_startsOnVia = m_placingVia;
|
m_startsOnVia = m_placingVia;
|
||||||
|
|
|
@ -212,7 +212,7 @@ private:
|
||||||
*
|
*
|
||||||
* Sets the board to route.
|
* Sets the board to route.
|
||||||
*/
|
*/
|
||||||
void setWorld ( PNS_NODE* aWorld );
|
void setWorld( PNS_NODE* aWorld );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function startPlacement()
|
* Function startPlacement()
|
||||||
|
|
|
@ -323,6 +323,7 @@ PNS_ROUTER::PNS_ROUTER()
|
||||||
|
|
||||||
m_currentLayer = 1;
|
m_currentLayer = 1;
|
||||||
m_placingVia = false;
|
m_placingVia = false;
|
||||||
|
m_startsOnVia = false;
|
||||||
m_currentNet = -1;
|
m_currentNet = -1;
|
||||||
m_state = IDLE;
|
m_state = IDLE;
|
||||||
m_world = NULL;
|
m_world = NULL;
|
||||||
|
@ -758,6 +759,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
|
||||||
via_board->SetWidth( via->Diameter() );
|
via_board->SetWidth( via->Diameter() );
|
||||||
via_board->SetDrill( via->Drill() );
|
via_board->SetDrill( via->Drill() );
|
||||||
via_board->SetNetCode( via->Net() );
|
via_board->SetNetCode( via->Net() );
|
||||||
|
via_board->SetLayerPair( m_settings.GetLayerTop(), m_settings.GetLayerBottom() );
|
||||||
newBI = via_board;
|
newBI = via_board;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -809,6 +811,7 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
||||||
{
|
{
|
||||||
case ROUTE_TRACK:
|
case ROUTE_TRACK:
|
||||||
rv = m_placer->FixRoute( aP, aEndItem );
|
rv = m_placer->FixRoute( aP, aEndItem );
|
||||||
|
m_startsOnVia = m_placingVia;
|
||||||
m_placingVia = false;
|
m_placingVia = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -874,8 +877,7 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
|
||||||
if( m_startsOnVia )
|
if( m_startsOnVia )
|
||||||
{
|
{
|
||||||
m_currentLayer = aLayer;
|
m_currentLayer = aLayer;
|
||||||
//m_placer->StartPlacement( m_currentStart, m_currentNet, m_currentWidth,
|
m_placer->SetLayer( aLayer );
|
||||||
// m_currentLayer );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
void DisplayItems( const PNS_ITEMSET& aItems );
|
void DisplayItems( const PNS_ITEMSET& aItems );
|
||||||
|
|
||||||
void DisplayDebugLine( const SHAPE_LINE_CHAIN& aLine, int aType = 0, int aWidth = 0 );
|
void DisplayDebugLine( const SHAPE_LINE_CHAIN& aLine, int aType = 0, int aWidth = 0 );
|
||||||
void DisplayDebugPoint( const VECTOR2I aPos, int aType = 0);
|
void DisplayDebugPoint( const VECTOR2I aPos, int aType = 0 );
|
||||||
void DisplayDebugBox( const BOX2I& aBox, int aType = 0, int aWidth = 0 );
|
void DisplayDebugBox( const BOX2I& aBox, int aType = 0, int aWidth = 0 );
|
||||||
|
|
||||||
void SwitchLayer( int layer );
|
void SwitchLayer( int layer );
|
||||||
|
@ -223,7 +223,7 @@ private:
|
||||||
|
|
||||||
void highlightCurrent( bool enabled );
|
void highlightCurrent( bool enabled );
|
||||||
|
|
||||||
void markViolations( PNS_NODE *aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
|
void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
|
||||||
|
|
||||||
int m_currentLayer;
|
int m_currentLayer;
|
||||||
int m_currentNet;
|
int m_currentNet;
|
||||||
|
|
|
@ -127,6 +127,23 @@ public:
|
||||||
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
|
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
|
||||||
TIME_LIMIT WalkaroundTimeLimit() const;
|
TIME_LIMIT WalkaroundTimeLimit() const;
|
||||||
|
|
||||||
|
void SetLayerPair( int aLayer1, int aLayer2 )
|
||||||
|
{
|
||||||
|
if( aLayer1 > aLayer2 )
|
||||||
|
{
|
||||||
|
m_layerTop = aLayer1;
|
||||||
|
m_layerBottom = aLayer2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_layerBottom = aLayer1;
|
||||||
|
m_layerTop = aLayer2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetLayerTop() const { return m_layerTop; }
|
||||||
|
int GetLayerBottom() const { return m_layerBottom; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_shoveVias;
|
bool m_shoveVias;
|
||||||
bool m_startDiagonal;
|
bool m_startDiagonal;
|
||||||
|
@ -150,6 +167,10 @@ private:
|
||||||
int m_shoveIterationLimit;
|
int m_shoveIterationLimit;
|
||||||
TIME_LIMIT m_shoveTimeLimit;
|
TIME_LIMIT m_shoveTimeLimit;
|
||||||
TIME_LIMIT m_walkaroundTimeLimit;
|
TIME_LIMIT m_walkaroundTimeLimit;
|
||||||
|
|
||||||
|
// Routing layers pair
|
||||||
|
int m_layerTop;
|
||||||
|
int m_layerBottom;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -478,7 +478,7 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent )
|
||||||
int layer;
|
int layer;
|
||||||
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
|
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
|
||||||
|
|
||||||
m_router->EnableSnapping ( snapEnabled );
|
m_router->EnableSnapping( snapEnabled );
|
||||||
|
|
||||||
if( !snapEnabled || m_router->GetCurrentNet() < 0 || !m_startItem )
|
if( !snapEnabled || m_router->GetCurrentNet() < 0 || !m_startItem )
|
||||||
{
|
{
|
||||||
|
@ -566,31 +566,28 @@ void ROUTER_TOOL::performRouting()
|
||||||
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
|
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Synchronize the indicated layer
|
||||||
|
frame->SetActiveLayer( m_router->GetCurrentLayer() );
|
||||||
|
|
||||||
m_router->Move( m_endSnapPoint, m_endItem );
|
m_router->Move( m_endSnapPoint, m_endItem );
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
||||||
{
|
{
|
||||||
|
m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
|
||||||
|
frame->GetScreen()->m_Route_Layer_BOTTOM );
|
||||||
m_router->ToggleViaPlacement();
|
m_router->ToggleViaPlacement();
|
||||||
frame->GetGalCanvas()->SetTopLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||||
m_router->Move( m_endSnapPoint, m_endItem );
|
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_SwitchPosture ) )
|
else if( evt->IsAction( &ACT_SwitchPosture ) )
|
||||||
{
|
{
|
||||||
m_router->FlipPosture();
|
m_router->FlipPosture();
|
||||||
m_router->Move( m_endSnapPoint, m_endItem );
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &COMMON_ACTIONS::layerNext ) )
|
else if( evt->IsAction( &COMMON_ACTIONS::layerChanged ) )
|
||||||
{
|
{
|
||||||
m_router->SwitchLayer( m_router->NextCopperLayer( true ) );
|
|
||||||
updateEndItem( *evt );
|
updateEndItem( *evt );
|
||||||
frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
m_router->SwitchLayer( frame->GetActiveLayer() );
|
||||||
m_router->Move( m_endSnapPoint, m_endItem );
|
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||||
}
|
|
||||||
else if( evt->IsAction( &COMMON_ACTIONS::layerPrev ) )
|
|
||||||
{
|
|
||||||
m_router->SwitchLayer( m_router->NextCopperLayer( false ) );
|
|
||||||
frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
|
||||||
m_router->Move( m_endSnapPoint, m_endItem );
|
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_EndTrack ) )
|
else if( evt->IsAction( &ACT_EndTrack ) )
|
||||||
{
|
{
|
||||||
|
@ -598,7 +595,7 @@ void ROUTER_TOOL::performRouting()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommonEvents(*evt);
|
handleCommonEvents( *evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_router->StopRouting();
|
m_router->StopRouting();
|
||||||
|
@ -642,7 +639,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
m_router->Settings().SetViaDiameter( bds.GetCurrentViaSize() );
|
m_router->Settings().SetViaDiameter( bds.GetCurrentViaSize() );
|
||||||
m_router->Settings().SetViaDrill( bds.GetCurrentViaDrill() );
|
m_router->Settings().SetViaDrill( bds.GetCurrentViaDrill() );
|
||||||
|
|
||||||
ROUTER_TOOL_MENU *ctxMenu = new ROUTER_TOOL_MENU( board );
|
ROUTER_TOOL_MENU* ctxMenu = new ROUTER_TOOL_MENU( board );
|
||||||
|
|
||||||
SetContextMenu ( ctxMenu );
|
SetContextMenu ( ctxMenu );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue