40#include <../../tests/common/console_log.h>
48 if( item->m_Uuid == evt.
uuid )
61 fgets( str,
sizeof( str ) - 1, f );
62 return wxString( str );
67 m_mode(
PNS::ROUTER_MODE::PNS_MODE_ROUTE_SINGLE )
80 a.
x = wxAtoi( aTokens.GetNextToken() );
81 a.
y = wxAtoi( aTokens.GetNextToken() );
82 b.
x = wxAtoi( aTokens.GetNextToken() );
83 b.
y = wxAtoi( aTokens.GetNextToken() );
84 int width = wxAtoi( aTokens.GetNextToken() );
85 sh->SetSeg(
SEG( a, b ));
86 sh->SetWidth( width );
93 a.
x = wxAtoi( aTokens.GetNextToken() );
94 a.
y = wxAtoi( aTokens.GetNextToken() );
95 int radius = wxAtoi( aTokens.GetNextToken() );
97 sh->SetRadius( radius );
105 wxStringTokenizer& aTokens )
107 if( cmd == wxS(
"net" ) )
109 aItem->
SetNet(
m_board->FindNet( wxAtoi( aTokens.GetNextToken() ) ) );
112 else if( cmd == wxS(
"layers" ) )
114 int start = wxAtoi( aTokens.GetNextToken() );
115 int end = wxAtoi( aTokens.GetNextToken() );
126 while( aTokens.CountTokens() )
128 wxString cmd = aTokens.GetNextToken();
132 if( cmd == wxS(
"shape" ) )
152 while( aTokens.CountTokens() )
154 wxString cmd = aTokens.GetNextToken();
158 if( cmd == wxS(
"shape" ) )
170 else if( cmd == wxS(
"drill" ) )
172 via->SetDrill( wxAtoi( aTokens.GetNextToken() ) );
183 wxString type = aTokens.GetNextToken();
185 if( type == wxS(
"segment" ) )
187 else if( type == wxS(
"via" ) )
198 if( a->
Net() != b->
Net() )
215 if( va->
Pos() != vb->
Pos() )
224 if( sa->
Seg() != sb->
Seg() )
235const std::set<PNS::ITEM*>
deduplicate(
const std::vector<PNS::ITEM*>& items )
237 std::set<PNS::ITEM*> rv;
241 bool isDuplicate =
false;
284 chkAddedItems.erase( chk );
292 if( chkAddedItems.empty() && check.
m_removedIds.empty() )
301 std::vector<PNS::ITEM*> dummyHeads;
303 FILE* log_f = wxFopen( logFileName.GetFullPath(),
"wb" );
307 fprintf( log_f,
"%s\n", logString.c_str().AsChar() );
316 wxFileName fname_log( logFileName );
317 fname_log.SetExt( wxT(
"log" ) );
319 wxFileName fname_dump( logFileName );
320 fname_dump.SetExt( wxT(
"dump" ) );
322 wxFileName fname_project( logFileName );
323 fname_project.SetExt( wxT(
"kicad_pro" ) );
324 fname_project.MakeAbsolute();
326 wxFileName fname_settings( logFileName );
327 fname_settings.SetExt( wxT(
"settings" ) );
329 aRpt->
Report( wxString::Format( wxT(
"Loading router settings from '%s'" ),
330 fname_settings.GetFullPath() ) );
332 bool ok =
m_routerSettings->LoadFromRawFile( fname_settings.GetFullPath() );
336 aRpt->
Report( wxT(
"Failed to load routing settings. Using defaults." ),
340 aRpt->
Report( wxString::Format( wxT(
"Loading project settings from '%s'" ),
341 fname_settings.GetFullPath() ) );
351 aRpt->
Report( wxString::Format( wxT(
"Loading board snapshot from '%s'"),
352 fname_dump.GetFullPath() ) );
354 m_board.reset( io.
LoadBoard( fname_dump.GetFullPath(),
nullptr,
nullptr ) );
357 std::shared_ptr<DRC_ENGINE> drcEngine(
new DRC_ENGINE );
365 m_board->SynchronizeNetsAndNetClasses(
true );
367 drcEngine->SetBoard(
m_board.get() );
368 drcEngine->SetDesignSettings( &bds );
370 drcEngine->InitEngine( wxFileName() );
374 aRpt->
Report( wxString::Format(
"parse error : %s (%s)\n",
376 parse_error.
What() ),
382 FILE* f = fopen( fname_log.GetFullPath().c_str(),
"rb" );
384 aRpt->
Report( wxString::Format(
"Loading log from '%s'", fname_log.GetFullPath() ) );
395 wxStringTokenizer tokens( line );
397 if( !tokens.CountTokens() )
400 wxString cmd = tokens.GetNextToken();
402 if( cmd == wxT(
"mode" ) )
406 else if( cmd == wxT(
"event" ) )
410 else if ( cmd == wxT(
"added" ) )
415 else if ( cmd == wxT(
"removed" ) )
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
Design Rule Checker object that performs all the DRC tests.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
Represent a contiguous set of PCB layers.
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Load information from some input file format that this PLUGIN implementation knows about into either ...
Base class for PNS router board items.
void SetLayers(const LAYER_RANGE &aLayers)
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
void SetNet(NET_HANDLE aNet)
const LAYER_RANGE & Layers() const
static wxString FormatLogFileAsString(int aMode, const std::vector< ITEM * > &aAddedItems, const std::set< KIID > &aRemovedItems, const std::vector< ITEM * > &aHeads, const std::vector< EVENT_ENTRY > &aEvents)
static EVENT_ENTRY ParseEvent(const wxString &aLine)
Contain all persistent settings of the router, such as the mode, optimization effort,...
void SetShape(const SHAPE_SEGMENT &aShape)
int Width() const override
const VECTOR2I & Pos() const
BOARD_CONNECTED_ITEM * ItemById(const PNS::LOGGER::EVENT_ENTRY &evt)
PNS::ITEM * parseItemFromString(wxStringTokenizer &aTokens)
bool Load(const wxFileName &logFileName, REPORTER *aRpt)
bool SaveLog(const wxFileName &logFileName, REPORTER *aRpt)
PNS::SEGMENT * parsePnsSegmentFromString(wxStringTokenizer &aTokens)
std::shared_ptr< BOARD > m_board
std::shared_ptr< SETTINGS_MANAGER > m_settingsMgr
PNS::VIA * parsePnsViaFromString(wxStringTokenizer &aTokens)
bool parseCommonPnsProps(PNS::ITEM *aItem, const wxString &cmd, wxStringTokenizer &aTokens)
COMMIT_STATE m_commitState
std::vector< PNS::LOGGER::EVENT_ENTRY > m_events
std::unique_ptr< PNS::ROUTING_SETTINGS > m_routerSettings
Container for project specific data.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
const VECTOR2I GetCenter() const
Push and Shove diff pair dimensions (gap) settings dialog.
std::shared_ptr< SHAPE > parseShape(SHAPE_TYPE expectedType, wxStringTokenizer &aTokens)
bool comparePnsItems(const PNS::ITEM *a, const PNS::ITEM *b)
static const wxString readLine(FILE *f)
const std::set< PNS::ITEM * > deduplicate(const std::vector< PNS::ITEM * > &items)
SHAPE_TYPE
Lists all supported shapes.
A filename or source description, a problem input line, a line number, a byte offset,...
std::set< KIID > m_removedIds
bool Compare(const COMMIT_STATE &aOther)
std::vector< PNS::ITEM * > m_addedItems