Allow changing router mode while routing
Keeps shove active even when not using to allow switching modes during routing. Fixes https://gitlab.com/kicad/code/kicad/issues/9342
This commit is contained in:
parent
7f1247a23c
commit
35e90d0cf4
|
@ -54,16 +54,12 @@ DIFF_PAIR_PLACER::DIFF_PAIR_PLACER( ROUTER* aRouter ) :
|
|||
m_orthoMode = false;
|
||||
m_snapOnTarget = false;
|
||||
m_currentEndItem = nullptr;
|
||||
m_currentMode = RM_MarkObstacles;
|
||||
m_currentTraceOk = false;
|
||||
m_idle = true;
|
||||
}
|
||||
|
||||
DIFF_PAIR_PLACER::~DIFF_PAIR_PLACER()
|
||||
{
|
||||
if( m_shove )
|
||||
delete m_shove;
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void DIFF_PAIR_PLACER::setWorld( NODE* aWorld )
|
||||
|
@ -133,12 +129,12 @@ bool DIFF_PAIR_PLACER::propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNe
|
|||
|
||||
bool solidsOnly = true;
|
||||
|
||||
if( m_currentMode == RM_MarkObstacles )
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
aNewP = aP;
|
||||
return true;
|
||||
}
|
||||
else if( m_currentMode == RM_Walkaround )
|
||||
else if( Settings().Mode() == RM_Walkaround )
|
||||
{
|
||||
solidsOnly = false;
|
||||
}
|
||||
|
@ -324,7 +320,7 @@ bool DIFF_PAIR_PLACER::rhWalkOnly( const VECTOR2I& aP )
|
|||
|
||||
bool DIFF_PAIR_PLACER::route( const VECTOR2I& aP )
|
||||
{
|
||||
switch( m_currentMode )
|
||||
switch( Settings().Mode() )
|
||||
{
|
||||
case RM_MarkObstacles:
|
||||
return rhMarkObstacles( aP );
|
||||
|
@ -621,17 +617,8 @@ void DIFF_PAIR_PLACER::initPlacement()
|
|||
|
||||
m_lastNode = nullptr;
|
||||
m_currentNode = rootNode;
|
||||
m_currentMode = Settings().Mode();
|
||||
|
||||
if( m_shove )
|
||||
delete m_shove;
|
||||
|
||||
m_shove = nullptr;
|
||||
|
||||
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
|
||||
{
|
||||
m_shove = new SHOVE( m_currentNode, Router() );
|
||||
}
|
||||
m_shove = std::make_unique<SHOVE>( m_currentNode, Router() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ private:
|
|||
VECTOR2I m_p_start;
|
||||
|
||||
///< The shove engine
|
||||
SHOVE* m_shove;
|
||||
std::unique_ptr<SHOVE> m_shove;
|
||||
|
||||
///< Current world state
|
||||
NODE* m_currentNode;
|
||||
|
@ -268,7 +268,6 @@ private:
|
|||
bool m_currentTraceOk;
|
||||
|
||||
ITEM* m_currentEndItem;
|
||||
PNS_MODE m_currentMode;
|
||||
|
||||
bool m_idle;
|
||||
};
|
||||
|
|
|
@ -51,7 +51,6 @@ LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) :
|
|||
m_placingVia = false;
|
||||
m_currentNet = 0;
|
||||
m_currentLayer = 0;
|
||||
m_currentMode = RM_MarkObstacles;
|
||||
m_startItem = nullptr;
|
||||
m_chainedPlacement = false;
|
||||
m_orthoMode = false;
|
||||
|
@ -806,7 +805,7 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead )
|
|||
|
||||
bool LINE_PLACER::routeHead( const VECTOR2I& aP, LINE& aNewHead )
|
||||
{
|
||||
switch( m_currentMode )
|
||||
switch( Settings().Mode() )
|
||||
{
|
||||
case RM_MarkObstacles:
|
||||
return rhMarkObstacles( aP, aNewHead );
|
||||
|
@ -1144,7 +1143,7 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
|||
|
||||
NODE *n;
|
||||
|
||||
if ( m_shove )
|
||||
if ( Settings().Mode() == PNS::RM_Shove || Settings().Mode() == PNS::RM_Smart )
|
||||
n = m_shove->CurrentNode();
|
||||
else
|
||||
n = m_currentNode;
|
||||
|
@ -1189,11 +1188,7 @@ void LINE_PLACER::initPlacement()
|
|||
|
||||
m_lastNode = nullptr;
|
||||
m_currentNode = m_world;
|
||||
m_currentMode = Settings().Mode();
|
||||
|
||||
m_shove.reset();
|
||||
|
||||
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
|
||||
m_shove = std::make_unique<SHOVE>( m_world->Branch(), Router() );
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1244,7 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
|
|||
|
||||
LINE pl = Trace();
|
||||
|
||||
if( m_currentMode == RM_MarkObstacles )
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
// Mark Obstacles is sort of a half-manual, half-automated mode in which the
|
||||
// user has more responsibility and authority.
|
||||
|
@ -1405,7 +1400,6 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
|
|||
m_currentNode = m_lastNode;
|
||||
m_lastNode = m_lastNode->Branch();
|
||||
|
||||
if( m_shove )
|
||||
m_shove->AddLockedSpringbackNode( m_currentNode );
|
||||
|
||||
DIRECTION_45 lastSegDir = pl.EndsWithVia() ? DIRECTION_45::UNDEFINED : d_last;
|
||||
|
@ -1451,10 +1445,11 @@ bool LINE_PLACER::UnfixRoute()
|
|||
m_mouseTrailTracer.SetDefaultDirections( m_initial_direction, m_direction );
|
||||
m_mouseTrailTracer.AddTrailPoint( m_p_start );
|
||||
|
||||
if( m_shove )
|
||||
{
|
||||
m_shove->RewindSpringbackTo( m_currentNode );
|
||||
m_shove->UnlockSpringbackNode( m_currentNode );
|
||||
|
||||
if( Settings().Mode() == PNS::RM_Shove || Settings().Mode() == PNS::RM_Smart )
|
||||
{
|
||||
m_currentNode = m_shove->CurrentNode();
|
||||
m_currentNode->KillChildren();
|
||||
}
|
||||
|
@ -1696,7 +1691,7 @@ bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead, bool aForce
|
|||
VIA v( makeVia( aP ) );
|
||||
v.SetNet( aHead.Net() );
|
||||
|
||||
if( m_currentMode == RM_MarkObstacles )
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
aHead.AppendVia( v );
|
||||
return true;
|
||||
|
@ -1705,7 +1700,7 @@ bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead, bool aForce
|
|||
VECTOR2I force;
|
||||
VECTOR2I lead = aP - m_p_start;
|
||||
|
||||
bool solidsOnly = ( m_currentMode != RM_Walkaround );
|
||||
bool solidsOnly = ( Settings().Mode() != RM_Walkaround );
|
||||
|
||||
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
|
||||
{
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
|
||||
#include "pns_sizes_settings.h"
|
||||
#include "pns_node.h"
|
||||
#include "pns_via.h"
|
||||
#include "pns_line.h"
|
||||
#include "pns_placement_algo.h"
|
||||
#include "pns_mouse_trail_tracer.h"
|
||||
#include "pns_node.h"
|
||||
#include "pns_placement_algo.h"
|
||||
#include "pns_sizes_settings.h"
|
||||
#include "pns_via.h"
|
||||
|
||||
namespace PNS {
|
||||
|
||||
|
@ -203,7 +203,6 @@ public:
|
|||
*/
|
||||
bool SplitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP );
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Re-route the current track to point aP. Returns true, when routing has completed
|
||||
|
@ -353,7 +352,6 @@ private:
|
|||
VECTOR2I m_currentStart;
|
||||
LINE m_currentTrace;
|
||||
|
||||
PNS_MODE m_currentMode;
|
||||
ITEM* m_startItem;
|
||||
|
||||
bool m_idle;
|
||||
|
|
|
@ -1190,7 +1190,6 @@ void ROUTER_TOOL::performRouting()
|
|||
}
|
||||
|
||||
m_router->CommitRouting();
|
||||
m_router->StopRouting();
|
||||
|
||||
finishInteractive();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue