30#define PNSLOGINFO PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO( __FILE__, __FUNCTION__, __LINE__ )
58 m_router->Sizes().SetTrackWidth( 250000 );
69 std::vector<PNS::ITEM*> added, removed, heads;
70 m_router->GetUpdatedItems( removed, added, heads );
73 for(
auto item : removed )
81 for(
auto item : added )
88 for(
auto head : heads )
90 state.
m_heads.push_back( head );
97 bool aUpdateExpectedResult )
106 int totalEvents = aLog->
Events().size();
110 for(
auto evt : aLog->
Events() )
112 if( eventIdx < aFrom || ( aTo >= 0 && eventIdx > aTo ) )
118 ITEM* ritem =
nullptr;
120 if( items.size() && items[0] )
121 ritem =
m_router->GetWorld()->FindItemByParent( items[0] );
123 int routingLayer = evt.layer;
127 if( routingLayer < ritem->Layers().Start() )
129 if( routingLayer > ritem->
Layers().
End() )
135 if(
ITEM* routerItem =
m_router->GetWorld()->FindItemByParent( item ) )
136 ritems.
Add( routerItem );
148 m_board->GetDesignSettings().m_UseConnectedTrackWidth = evt.useConnectedTrackWidth;
149 m_iface->SetStartLayerFromPNS( routingLayer );
150 m_iface->ImportSizes( sizes, ritem,
nullptr, evt.p );
156 for(
int i = 1; i < ritems.
Size(); i++ )
157 auxItems.
Add( ritems[i] );
160 bool status =
m_router->StartRouting( evt.p, ritem, routingLayer, auxItems );
162 double msecs = tmr.
msecs();
164 msg = wxString::Format(
"event [%d/%d]: route-start (%d, %d), layer %d, startitem %p status %d time %.0f ms", eventIdx,
165 totalEvents, evt.p.x, evt.p.y, routingLayer, ritem, status ? 1 : 0, msecs);
177 m_iface->SetStartLayerFromPNS( routingLayer );
178 m_iface->ImportSizes( sizes, ritem,
nullptr, evt.p );
187 bool rv =
m_router->StartDragging( evt.p, ritems, 0 );
189 double msecs = tmr.
msecs();
193 auto msg = wxString::Format(
"event [%d/%d]: drag-start (%d, %d) time %.0f ms", eventIdx,
194 totalEvents, evt.p.x, evt.p.y, msecs );
206 bool rv =
m_router->FixRoute( evt.p, ritem,
false,
false );
208 evt.p.x, evt.p.y, rv ? 1 : 0 ) );
216 m_debugDecorator->Message( wxString::Format(
"unfix (%d, %d)", evt.p.x, evt.p.y ) );
228 bool ret =
m_router->Move( evt.p, ritem );
230 double msecs = tmr.
msecs();
232 auto msg = wxString::Format(
"event [%d/%d]: move (%d, %d) time %.0f ms", eventIdx, totalEvents, evt.p.x, evt.p.y, msecs );
244 auto msg = wxString::Format(
"event [%d/%d]: toggle-via", eventIdx, totalEvents );
264 auto traces =
m_router->Placer()->Traces();
266 for(
const auto& t : traces.CItems() )
268 const LINE *l =
static_cast<LINE*
>(t.item);
269 const auto& sh = l->
CLine();
276 node =
m_router->Placer()->CurrentNode(
true );
280 node =
m_router->GetDragger()->CurrentNode();
289 if( ! added.empty() )
294 for(
auto t : added )
304 wxASSERT_MSG(
m_router->Mode() == aLog->
GetMode(),
"didn't set the router mode correctly?" );
306 if( aUpdateExpectedResult )
308 std::vector<PNS::ITEM*> added, removed, heads;
309 m_router->GetUpdatedItems( removed, added, heads );
311 std::set<KIID> removedKIIDs;
313 for(
auto item : removed )
319 removedKIIDs.insert( item->Parent()->m_Uuid );
322 std::vector<std::unique_ptr<PNS::ITEM>> myOwnedItems;
326 routerCommitState.
m_heads = heads;
329 myOwnedItems.emplace_back( head );
380 return static_cast<NETINFO_ITEM*
>( aNet )->GetNetname();
382 return wxEmptyString;
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Handle the data for a net.
static REPORTER & GetInstance()
void Add(const LINE &aLine)
Base class for PNS router board items.
const PNS_LAYER_RANGE & Layers() const
virtual ITEM * Clone() const =0
Return a deep copy of the item.
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
const SHAPE_LINE_CHAIN & CLine() const
Keep the router "world" - i.e.
std::vector< ITEM * > ITEM_VECTOR
void GetUpdatedItems(ITEM_VECTOR &aRemoved, ITEM_VECTOR &aAdded)
Return the list of items removed and added in this branch with respect to the root branch.
Contain all persistent settings of the router, such as the mode, optimization effort,...
void SetExpectedResult(const COMMIT_STATE &aCommitState, std::vector< std::unique_ptr< PNS::ITEM > > aParsedItems)
const COMMIT_STATE & GetExpectedResult() const
PNS::ROUTING_SETTINGS * GetRoutingSettings() const
PNS::ROUTER_MODE GetMode() const
std::vector< PNS::LOGGER::EVENT_ENTRY > & Events()
std::shared_ptr< BOARD > GetBoard() const
std::vector< BOARD_CONNECTED_ITEM * > ItemsById(const PNS::LOGGER::EVENT_ENTRY &evt)
int GetNetCode(PNS::NET_HANDLE aNet) const override
PNS_LOG_PLAYER_KICAD_IFACE(PNS_LOG_VIEW_TRACKER *aViewTracker)
PNS_LOG_VIEW_TRACKER * m_viewTracker
void HideItem(PNS::ITEM *aItem) override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false, int aFlags=0) override
~PNS_LOG_PLAYER_KICAD_IFACE() override
wxString GetNetName(PNS::NET_HANDLE aNet) const override
PNS_TEST_DEBUG_DECORATOR * m_debugDecorator
std::unique_ptr< PNS::ROUTING_SETTINGS > m_routingSettings
std::shared_ptr< BOARD > m_board
const PNS_LOG_FILE::COMMIT_STATE GetRouterUpdatedItems()
std::unique_ptr< PNS::ROUTER > m_router
void ReplayLog(PNS_LOG_FILE *aLog, int aStartEventIndex=0, int aFrom=0, int aTo=-1, bool aUpdateExpectedResult=false)
std::shared_ptr< PNS_LOG_VIEW_TRACKER > m_viewTracker
bool CompareResults(PNS_LOG_FILE *aLog, bool aSkipHeads=false)
std::unique_ptr< PNS_LOG_PLAYER_KICAD_IFACE > m_iface
void SetReporter(REPORTER *aReporter)
std::map< int, VIEW_ENTRIES > m_vitems
void DisplayItem(const PNS::ITEM *aItem)
void HideItem(PNS::ITEM *aItem)
std::vector< ENTRY > VIEW_ENTRIES
void SetStage(int aStage)
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
double msecs(bool aSinceLast=false)
Push and Shove diff pair dimensions (gap) settings dialog.
@ RM_Walkaround
Only walk around.
std::set< KIID > m_removedIds
std::vector< PNS::ITEM * > m_addedItems
std::vector< PNS::ITEM * > m_heads
std::unique_ptr< const PNS::ITEM > m_ownedItem