37#include <../../unittests/common/console_log.h>
43 for(
auto item :
m_board->AllConnectedItems() )
45 if( item->m_Uuid == evt.
uuid )
58 fgets( str,
sizeof( str ) - 1, f );
59 return wxString( str );
77 a.
x = wxAtoi( aTokens.GetNextToken() );
78 a.
y = wxAtoi( aTokens.GetNextToken() );
79 b.
x = wxAtoi( aTokens.GetNextToken() );
80 b.
y = wxAtoi( aTokens.GetNextToken() );
81 int width = wxAtoi( aTokens.GetNextToken() );
82 sh->SetSeg(
SEG( a, b ));
83 sh->SetWidth( width );
91 a.
x = wxAtoi( aTokens.GetNextToken() );
92 a.
y = wxAtoi( aTokens.GetNextToken() );
93 int radius = wxAtoi( aTokens.GetNextToken() );
95 sh->SetRadius( radius );
106 aItem->
SetNet( wxAtoi( aTokens.GetNextToken() ) );
108 }
else if ( cmd ==
"layers" )
110 int start = wxAtoi( aTokens.GetNextToken() );
111 int end = wxAtoi( aTokens.GetNextToken() );
123 while( aTokens.CountTokens() )
125 wxString cmd = aTokens.GetNextToken();
128 if ( cmd ==
"shape" )
148 while( aTokens.CountTokens() )
150 wxString cmd = aTokens.GetNextToken();
153 if ( cmd ==
"shape" )
162 via->SetPos( sc->GetCenter() );
163 via->SetDiameter( 2 * sc->GetRadius() );
165 else if ( cmd ==
"drill" )
167 via->SetDrill( wxAtoi( aTokens.GetNextToken() ) );
178 wxString type = aTokens.GetNextToken();
180 if( type ==
"segment" )
185 else if( type ==
"via" )
199 if( a->
Net() != b->
Net() )
207 auto va =
static_cast<const PNS::VIA*
>(a);
208 auto vb =
static_cast<const PNS::VIA*
>(b);
210 if( va->Diameter() != vb->Diameter() )
213 if( va->Drill() != vb->Drill() )
216 if( va->Pos() != vb->Pos() )
225 if( sa->Seg() != sb->Seg() )
228 if( sa->Width() != sb->Width() )
275 wxFileName fname_log( logFileName );
276 fname_log.SetExt( wxT(
"log" ) );
278 wxFileName fname_dump( logFileName );
279 fname_dump.SetExt( wxT(
"dump" ) );
281 wxFileName fname_project( logFileName );
282 fname_project.SetExt( wxT(
"kicad_pro" ) );
283 fname_project.MakeAbsolute();
285 wxFileName fname_settings( logFileName );
286 fname_settings.SetExt( wxT(
"settings" ) );
289 FILE* f = fopen( fname_log.GetFullPath().c_str(),
"rb" );
298 wxStringTokenizer tokens(
readLine( f ) );
300 if( !tokens.CountTokens() )
303 wxString cmd = tokens.GetNextToken();
305 if( cmd == wxT(
"mode") )
309 else if( cmd == wxT(
"event") )
312 evt.
p.
x = wxAtoi( tokens.GetNextToken() );
313 evt.
p.
y = wxAtoi( tokens.GetNextToken() );
315 evt.
uuid =
KIID( tokens.GetNextToken() );
318 else if ( cmd == wxT(
"added") )
323 else if ( cmd == wxT(
"removed") )
331 aRpt->
Report(
wxString::Format( wxT(
"Loading router settings from '%s'"), fname_settings.GetFullPath() ) );
333 bool ok =
m_routerSettings->LoadFromRawFile( fname_settings.GetFullPath() );
340 aRpt->
Report(
wxString::Format( wxT(
"Loading project settings from '%s'"), fname_settings.GetFullPath() ) );
350 m_board.reset( io.
Load( fname_dump.GetFullPath(),
nullptr,
nullptr ) );
353 std::shared_ptr<DRC_ENGINE> drcEngine(
new DRC_ENGINE );
360 m_board->SynchronizeNetsAndNetClasses(
true );
362 drcEngine->SetBoard(
m_board.get() );
363 drcEngine->SetDesignSettings( &bds );
365 drcEngine->InitEngine( wxFileName() );
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
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 * Load(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)
PnsKind Kind() const
Return the type (kind) of the item.
const LAYER_RANGE & Layers() const
Contain all persistent settings of the router, such as the mode, optimization effort,...
void SetShape(const SHAPE_SEGMENT &aShape)
bool Load(const wxFileName &logFileName, REPORTER *aRpt)
std::shared_ptr< BOARD > m_board
std::shared_ptr< SETTINGS_MANAGER > m_settingsMgr
BOARD_CONNECTED_ITEM * ItemById(const EVENT_ENTRY &evt)
COMMIT_STATE m_commitState
std::vector< EVENT_ENTRY > m_events
std::unique_ptr< PNS::ROUTING_SETTINGS > m_routerSettings
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.
Push and Shove diff pair dimensions (gap) settings dialog.
static PNS::VIA * parsePnsViaFromString(PNS::VIA *aSeg, wxStringTokenizer &aTokens)
static std::shared_ptr< SHAPE > parseShape(SHAPE_TYPE expectedType, wxStringTokenizer &aTokens)
bool parseCommonPnsProps(PNS::ITEM *aItem, const wxString &cmd, wxStringTokenizer &aTokens)
static PNS::ITEM * parseItemFromString(wxStringTokenizer &aTokens)
bool comparePnsItems(const PNS::ITEM *a, const PNS::ITEM *b)
static const wxString readLine(FILE *f)
static PNS::SEGMENT * parsePnsSegmentFromString(PNS::SEGMENT *aSeg, wxStringTokenizer &aTokens)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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
std::set< PNS::ITEM * > m_addedItems
bool Compare(const COMMIT_STATE &aOther)
PNS::LOGGER::EVENT_TYPE type