PNS test app: Add logging information for curved track routing
This commit is contained in:
parent
94954386e6
commit
dc1fd3d9ba
|
@ -1405,10 +1405,8 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
|
||||||
|
|
||||||
m_multiLineMode = false;
|
m_multiLineMode = false;
|
||||||
|
|
||||||
if( Dbg() )
|
PNS_DBG( Dbg(), Message,
|
||||||
{
|
wxString::Format( "Shove start, lc = %d", aCurrentHead.SegmentCount() ) )
|
||||||
Dbg()->Message( wxString::Format( "Shove start, lc = %d", aCurrentHead.SegmentCount() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// empty head? nothing to shove...
|
// empty head? nothing to shove...
|
||||||
if( !aCurrentHead.SegmentCount() && !aCurrentHead.EndsWithVia() )
|
if( !aCurrentHead.SegmentCount() && !aCurrentHead.EndsWithVia() )
|
||||||
|
@ -1447,12 +1445,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
|
||||||
head.Mark( MK_HEAD );
|
head.Mark( MK_HEAD );
|
||||||
head.SetRank( 100000 );
|
head.SetRank( 100000 );
|
||||||
|
|
||||||
if( Dbg() )
|
PNS_DBG( Dbg(), AddLine, head.CLine(), CYAN, head.Width(), "head, after shove" );
|
||||||
{
|
|
||||||
Dbg()->BeginGroup( "initial" );
|
|
||||||
Dbg()->AddLine(head.CLine(), CYAN, head.Width(), "head" );
|
|
||||||
Dbg()->EndGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( head.EndsWithVia() )
|
if( head.EndsWithVia() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -526,10 +526,11 @@ void ROUTER_TOOL::saveRouterDebugLog()
|
||||||
FILE *f = fopen( fname_log.GetFullPath().c_str(), "wb" );
|
FILE *f = fopen( fname_log.GetFullPath().c_str(), "wb" );
|
||||||
|
|
||||||
// save base router configuration (mode, etc.)
|
// save base router configuration (mode, etc.)
|
||||||
fprintf(f, "config %d %d %d\n",
|
fprintf(f, "config %d %d %d %d\n",
|
||||||
m_router->Settings().Mode(),
|
m_router->Settings().Mode(),
|
||||||
m_router->Settings().RemoveLoops() ? 1 : 0,
|
m_router->Settings().RemoveLoops() ? 1 : 0,
|
||||||
m_router->Settings().GetFixAllSegments() ? 1 : 0
|
m_router->Settings().GetFixAllSegments() ? 1 : 0,
|
||||||
|
m_router->Settings().GetCornerMode()
|
||||||
);
|
);
|
||||||
|
|
||||||
const auto& events = logger->GetEvents();
|
const auto& events = logger->GetEvents();
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include <board_design_settings.h>
|
#include <board_design_settings.h>
|
||||||
#include <pcbnew/drc/drc_engine.h>
|
#include <pcbnew/drc/drc_engine.h>
|
||||||
#include <pcbnew/drc/drc_test_provider.h>
|
#include <pcbnew/drc/drc_test_provider.h>
|
||||||
|
#include <pns_arc.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define PNSLOGINFO PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, __LINE__ )
|
||||||
|
|
||||||
using namespace PNS;
|
using namespace PNS;
|
||||||
|
|
||||||
|
@ -75,6 +79,7 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
||||||
m_routerSettings->SetMode( (PNS::PNS_MODE) wxAtoi( tokens.GetNextToken() ) );
|
m_routerSettings->SetMode( (PNS::PNS_MODE) wxAtoi( tokens.GetNextToken() ) );
|
||||||
m_routerSettings->SetRemoveLoops( wxAtoi( tokens.GetNextToken() ) );
|
m_routerSettings->SetRemoveLoops( wxAtoi( tokens.GetNextToken() ) );
|
||||||
m_routerSettings->SetFixAllSegments( wxAtoi( tokens.GetNextToken() ) );
|
m_routerSettings->SetFixAllSegments( wxAtoi( tokens.GetNextToken() ) );
|
||||||
|
m_routerSettings->SetCornerMode( (PNS::CORNER_MODE) wxAtoi( tokens.GetNextToken() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +170,8 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
{
|
{
|
||||||
case LOGGER::EVT_START_ROUTE:
|
case LOGGER::EVT_START_ROUTE:
|
||||||
{
|
{
|
||||||
m_debugDecorator.NewStage( "route-start", 0 );
|
m_debugDecorator.NewStage( "route-start", 0, PNSLOGINFO );
|
||||||
|
m_debugDecorator.Message( wxString::Format( "route-start (%d, %d)", evt.p.x, evt.p.y ) );
|
||||||
printf( " rtr start-route (%d, %d) %p \n", evt.p.x, evt.p.y, ritem );
|
printf( " rtr start-route (%d, %d) %p \n", evt.p.x, evt.p.y, ritem );
|
||||||
m_router->StartRouting( evt.p, ritem, ritem ? ritem->Layers().Start() : F_Cu );
|
m_router->StartRouting( evt.p, ritem, ritem ? ritem->Layers().Start() : F_Cu );
|
||||||
break;
|
break;
|
||||||
|
@ -173,7 +179,8 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
|
|
||||||
case LOGGER::EVT_START_DRAG:
|
case LOGGER::EVT_START_DRAG:
|
||||||
{
|
{
|
||||||
m_debugDecorator.NewStage( "drag-start", 0 );
|
m_debugDecorator.NewStage( "drag-start", 0, PNSLOGINFO );
|
||||||
|
m_debugDecorator.Message( wxString::Format( "drag-start (%d, %d)", evt.p.x, evt.p.y ) );
|
||||||
bool rv = m_router->StartDragging( evt.p, ritem, 0 );
|
bool rv = m_router->StartDragging( evt.p, ritem, 0 );
|
||||||
printf( " rtr start-drag (%d, %d) %p ret %d\n", evt.p.x, evt.p.y, ritem, rv ? 1 : 0 );
|
printf( " rtr start-drag (%d, %d) %p ret %d\n", evt.p.x, evt.p.y, ritem, rv ? 1 : 0 );
|
||||||
break;
|
break;
|
||||||
|
@ -181,12 +188,17 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
|
|
||||||
case LOGGER::EVT_FIX:
|
case LOGGER::EVT_FIX:
|
||||||
{
|
{
|
||||||
|
m_debugDecorator.NewStage( "fix", 0, PNSLOGINFO );
|
||||||
|
m_debugDecorator.Message( wxString::Format( "fix (%d, %d)", evt.p.x, evt.p.y ) );
|
||||||
|
bool rv = m_router->FixRoute( evt.p, ritem );
|
||||||
|
printf( " fix -> (%d, %d) ret %d\n", evt.p.x, evt.p.y, rv ? 1 : 0 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGGER::EVT_MOVE:
|
case LOGGER::EVT_MOVE:
|
||||||
{
|
{
|
||||||
m_debugDecorator.NewStage( "move", 0 );
|
m_debugDecorator.NewStage( "move", 0, PNSLOGINFO );
|
||||||
|
m_debugDecorator.Message( wxString::Format( "move (%d, %d)", evt.p.x, evt.p.y ) );
|
||||||
printf( " move -> (%d, %d)\n", evt.p.x, evt.p.y );
|
printf( " move -> (%d, %d)\n", evt.p.x, evt.p.y );
|
||||||
m_router->Move( evt.p, ritem );
|
m_router->Move( evt.p, ritem );
|
||||||
break;
|
break;
|
||||||
|
@ -200,8 +212,8 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
|
|
||||||
if( m_router->GetState() == PNS::ROUTER::ROUTE_TRACK )
|
if( m_router->GetState() == PNS::ROUTER::ROUTE_TRACK )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 1
|
||||||
m_debugDecorator.BeginGroup( "head");
|
m_debugDecorator.BeginGroup( "current route", PNSLOGINFO );
|
||||||
|
|
||||||
auto traces = m_router->Placer()->Traces();
|
auto traces = m_router->Placer()->Traces();
|
||||||
|
|
||||||
|
@ -210,10 +222,11 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
const LINE *l = static_cast<LINE*>(t.item);
|
const LINE *l = static_cast<LINE*>(t.item);
|
||||||
const auto& sh = l->CLine();
|
const auto& sh = l->CLine();
|
||||||
|
|
||||||
m_debugDecorator.AddLine( sh, 4, 10000 );
|
m_debugDecorator.AddLine( sh, YELLOW, l->Width(), "line seg",
|
||||||
|
PNSLOGINFO );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_debugDecorator.EndGroup();
|
m_debugDecorator.EndGroup( PNSLOGINFO );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
node = m_router->Placer()->CurrentNode( true );
|
node = m_router->Placer()->CurrentNode( true );
|
||||||
|
@ -230,23 +243,32 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
||||||
|
|
||||||
node->GetUpdatedItems( removed, added );
|
node->GetUpdatedItems( removed, added );
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
if( ! added.empty() )
|
if( ! added.empty() )
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
m_debugDecorator.BeginGroup( "node-added-items");
|
m_debugDecorator.BeginGroup( "node-added-items", PNSLOGINFO );
|
||||||
|
|
||||||
for( auto t : added )
|
for( auto t : added )
|
||||||
{
|
{
|
||||||
if( t->OfKind( PNS::ITEM::SEGMENT_T ) )
|
if( t->OfKind( PNS::ITEM::SEGMENT_T ) )
|
||||||
{
|
{
|
||||||
auto s = static_cast<PNS::SEGMENT*>( t );
|
auto s = static_cast<PNS::SEGMENT*>( t );
|
||||||
m_debugDecorator.AddSegment( s->Seg(), 2 );
|
m_debugDecorator.AddLine( SHAPE_LINE_CHAIN( { s->Seg().A, s->Seg().B } ),
|
||||||
|
MAGENTA, s->Width(), "seg",
|
||||||
|
PNSLOGINFO );
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else if( t->OfKind( PNS::ITEM::ARC_T ) )
|
||||||
|
{
|
||||||
|
PNS::ARC* arc = static_cast<PNS::ARC*>( t );
|
||||||
|
m_debugDecorator.AddLine( SHAPE_LINE_CHAIN( arc->Arc() ), MAGENTA,
|
||||||
|
arc->Width(), "arc", PNSLOGINFO );
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_debugDecorator.EndGroup();
|
m_debugDecorator.EndGroup( PNSLOGINFO );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -405,7 +427,11 @@ void PNS_TEST_DEBUG_DECORATOR::Message( const wxString& msg, const SRC_LOCATION_
|
||||||
void PNS_TEST_DEBUG_DECORATOR::NewStage( const std::string& name, int iter,
|
void PNS_TEST_DEBUG_DECORATOR::NewStage( const std::string& name, int iter,
|
||||||
const SRC_LOCATION_INFO& aSrcLoc )
|
const SRC_LOCATION_INFO& aSrcLoc )
|
||||||
{
|
{
|
||||||
m_stages.push_back( new STAGE );
|
STAGE* stage = new STAGE();
|
||||||
|
stage->m_name = name;
|
||||||
|
stage->m_iter = iter;
|
||||||
|
|
||||||
|
m_stages.push_back( new STAGE);
|
||||||
m_activeEntry = m_stages.back()->m_entries;
|
m_activeEntry = m_stages.back()->m_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "label_manager.h"
|
#include "label_manager.h"
|
||||||
#define TOM_EXTRA_DEBUG
|
#define TOM_EXTRA_DEBUG
|
||||||
|
|
||||||
|
|
||||||
LABEL_MANAGER::LABEL_MANAGER( KIGFX::GAL* aGal ) : m_gal( aGal )
|
LABEL_MANAGER::LABEL_MANAGER( KIGFX::GAL* aGal ) : m_gal( aGal )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue