Fix broken PNS router QA build.
This commit is contained in:
parent
369d813a32
commit
43cb710297
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers.
|
||||
* Copyright (C) 2020-2021 KiCad Developers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,6 +38,7 @@ static const wxString readLine( FILE* f )
|
|||
return wxString( str );
|
||||
}
|
||||
|
||||
|
||||
PNS_LOG_FILE::PNS_LOG_FILE()
|
||||
{
|
||||
m_routerSettings.reset( new PNS::ROUTING_SETTINGS( nullptr, "" ) );
|
||||
|
@ -54,6 +55,7 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
while( !feof( f ) )
|
||||
{
|
||||
wxStringTokenizer tokens( readLine( f ) );
|
||||
|
||||
if( !tokens.CountTokens() )
|
||||
continue;
|
||||
|
||||
|
@ -78,7 +80,8 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
|
||||
fclose( f );
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
PCB_IO io;
|
||||
m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) );
|
||||
|
||||
|
@ -93,10 +96,10 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
drcEngine->SetDesignSettings( &bds );
|
||||
drcEngine->SetLogReporter( new CONSOLE_MSG_REPORTER( &consoleLog ) );
|
||||
drcEngine->InitEngine( wxFileName() );
|
||||
|
||||
} catch ( const PARSE_ERROR& parse_error ) {
|
||||
printf("parse error : %s (%s)\n",
|
||||
(const char *) parse_error.Problem().c_str(),
|
||||
}
|
||||
catch( const PARSE_ERROR& parse_error )
|
||||
{
|
||||
printf( "parse error : %s (%s)\n", (const char*) parse_error.Problem().c_str(),
|
||||
(const char*) parse_error.What().c_str() );
|
||||
|
||||
return false;
|
||||
|
@ -105,16 +108,17 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
PNS_TEST_ENVIRONMENT::PNS_TEST_ENVIRONMENT()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
PNS_TEST_ENVIRONMENT::~PNS_TEST_ENVIRONMENT()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PNS_TEST_ENVIRONMENT::SetMode( PNS::ROUTER_MODE mode )
|
||||
{
|
||||
m_mode = mode;
|
||||
|
@ -140,7 +144,8 @@ void PNS_TEST_ENVIRONMENT::createRouter()
|
|||
m_iface->SetDebugDecorator( &m_debugDecorator );
|
||||
}
|
||||
|
||||
void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex, int aFrom, int aTo )
|
||||
void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex, int aFrom,
|
||||
int aTo )
|
||||
{
|
||||
|
||||
m_board = aLog->GetBoard();
|
||||
|
@ -186,11 +191,11 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
|||
m_router->Move( evt.p, ritem );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PNS::NODE* node = nullptr;
|
||||
|
||||
if( m_router->GetState() == PNS::ROUTER::ROUTE_TRACK )
|
||||
|
@ -199,6 +204,7 @@ void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex,
|
|||
m_debugDecorator.BeginGroup( "head");
|
||||
|
||||
auto traces = m_router->Placer()->Traces();
|
||||
|
||||
for( const auto& t : traces.CItems() )
|
||||
{
|
||||
const LINE *l = static_cast<LINE*>(t.item);
|
||||
|
@ -256,7 +262,8 @@ PNS_TEST_DEBUG_DECORATOR::STAGE* PNS_TEST_DEBUG_DECORATOR::currentStage()
|
|||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::BeginGroup( std::string name, const SRC_LOCATION_INFO& aSrcLoc )
|
||||
void PNS_TEST_DEBUG_DECORATOR::BeginGroup( const std::string& name,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
STAGE* st = currentStage();
|
||||
DEBUG_ENT *ent = new DEBUG_ENT();
|
||||
|
@ -306,7 +313,11 @@ void PNS_TEST_DEBUG_DECORATOR::addEntry( DEBUG_ENT* ent )
|
|||
const std::string aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
*/
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddPoint( VECTOR2I aP, const KIGFX::COLOR4D& aColor, int aSize, const std::string aName, const SRC_LOCATION_INFO& aSrcLoc )
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor,
|
||||
int aSize, const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = new SHAPE_LINE_CHAIN;
|
||||
|
||||
|
@ -331,7 +342,7 @@ void PNS_TEST_DEBUG_DECORATOR::AddPoint( VECTOR2I aP, const KIGFX::COLOR4D& aCol
|
|||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor,
|
||||
int aWidth, const std::string aName,
|
||||
int aWidth, const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = new SHAPE_LINE_CHAIN( aLine );
|
||||
|
@ -347,11 +358,11 @@ void PNS_TEST_DEBUG_DECORATOR::AddLine( const SHAPE_LINE_CHAIN& aLine, const KIG
|
|||
addEntry( ent );
|
||||
}
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddSegment( SEG aS, const KIGFX::COLOR4D& aColor,
|
||||
const std::string aName,
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddSegment( const SEG& aS, const KIGFX::COLOR4D& aColor,
|
||||
const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
|
||||
auto sh = new SHAPE_LINE_CHAIN( { aS.A, aS.B } );
|
||||
DEBUG_ENT* ent = new DEBUG_ENT();
|
||||
|
||||
|
@ -365,9 +376,9 @@ void PNS_TEST_DEBUG_DECORATOR::AddSegment( SEG aS, const KIGFX::COLOR4D& aColor,
|
|||
addEntry( ent );
|
||||
}
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor,
|
||||
const std::string aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::AddBox( const BOX2I& aB, const KIGFX::COLOR4D& aColor,
|
||||
const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
auto sh = new SHAPE_RECT( aB.GetPosition(), aB.GetWidth(), aB.GetHeight() );
|
||||
DEBUG_ENT* ent = new DEBUG_ENT();
|
||||
|
@ -379,11 +390,10 @@ void PNS_TEST_DEBUG_DECORATOR::AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor,
|
|||
ent->m_iter = m_iter;
|
||||
ent->m_srcLoc = aSrcLoc;
|
||||
addEntry( ent );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::Message( const wxString msg, const SRC_LOCATION_INFO& aSrcLoc )
|
||||
void PNS_TEST_DEBUG_DECORATOR::Message( const wxString& msg, const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
DEBUG_ENT* ent = new DEBUG_ENT();
|
||||
ent->m_msg = msg.c_str();
|
||||
|
@ -392,14 +402,16 @@ void PNS_TEST_DEBUG_DECORATOR::Message( const wxString msg, const SRC_LOCATION_I
|
|||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::NewStage(const std::string& name, int iter, const SRC_LOCATION_INFO& aSrcLoc)
|
||||
void PNS_TEST_DEBUG_DECORATOR::NewStage( const std::string& name, int iter,
|
||||
const SRC_LOCATION_INFO& aSrcLoc )
|
||||
{
|
||||
m_stages.push_back( new STAGE );
|
||||
m_activeEntry = m_stages.back()->m_entries;
|
||||
}
|
||||
|
||||
|
||||
void PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::IterateTree( std::function<bool(PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT*)> visitor, int depth )
|
||||
void PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::IterateTree(
|
||||
std::function<bool( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT* )> visitor, int depth )
|
||||
{
|
||||
if( !visitor( this ) )
|
||||
return;
|
||||
|
@ -411,14 +423,14 @@ void PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::IterateTree( std::function<bool(PNS_TE
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents( int stage ) const
|
||||
{
|
||||
STAGE* st = m_stages[stage];
|
||||
BOX2I bb;
|
||||
bool first = true;
|
||||
|
||||
auto visitor = [ & ] ( DEBUG_ENT *ent ) -> bool
|
||||
{
|
||||
auto visitor = [&]( DEBUG_ENT* ent ) -> bool {
|
||||
for( auto sh : ent->m_shapes )
|
||||
{
|
||||
if( first )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers.
|
||||
* Copyright (C) 2020-2021 KiCad Developers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -224,16 +224,16 @@ public:
|
|||
virtual void BeginGroup( const std::string& name,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void EndGroup( const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void AddPoint( VECTOR2I aP, const KIGFX::COLOR4D& aColor, int aSize,
|
||||
virtual void AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor, int aSize,
|
||||
const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor,
|
||||
int aWidth, const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void AddSegment( SEG aS, const KIGFX::COLOR4D& aColor,
|
||||
virtual void AddSegment( const SEG& aS, const KIGFX::COLOR4D& aColor,
|
||||
const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor,
|
||||
virtual void AddBox( const BOX2I& aB, const KIGFX::COLOR4D& aColor,
|
||||
const std::string& aName,
|
||||
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
|
||||
virtual void Clear(){};
|
||||
|
|
Loading…
Reference in New Issue