void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) { int worstPadClearance = 0; if( !m_board ) { wxLogTrace( "PNS", "No board attached, aborting sync." ); return; } for( auto module : m_board->Modules() ) { for( auto pad : module->Pads() ) { std::unique_ptr< PNS::SOLID > solid = syncPad( pad ); if( solid ) aWorld->Add( std::move( solid ) ); worstPadClearance = std::max( worstPadClearance, pad->GetLocalClearance() ); } } for( auto t : m_board->Tracks() ) { KICAD_T type = t->Type(); if( type == PCB_TRACE_T ) { std::unique_ptr< PNS::SEGMENT > segment = syncTrack( t ); if( segment ) { aWorld->Add( std::move( segment ) ); } } else if( type == PCB_VIA_T ) { std::unique_ptr< PNS::VIA > via = syncVia( static_cast<VIA*>( t ) ); if( via ) { aWorld->Add( std::move( via ) ); } } } int worstRuleClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); delete m_ruleResolver; m_ruleResolver = new PNS_PCBNEW_RULE_RESOLVER( m_board, m_router ); aWorld->SetRuleResolver( m_ruleResolver ); aWorld->SetMaxClearance( 4 * std::max(worstPadClearance, worstRuleClearance ) ); }
void PNS_ROUTER::SyncWorld() { if( !m_board ) { TRACEn( 0, "No board attached, aborting sync." ); return; } ClearWorld(); m_world = new PNS_NODE(); for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { PNS_ITEM* solid = syncPad( pad ); if( solid ) m_world->Add( solid ); } } for( TRACK* t = m_board->m_Track; t; t = t->Next() ) { KICAD_T type = t->Type(); PNS_ITEM* item = NULL; if( type == PCB_TRACE_T ) item = syncTrack( t ); else if( type == PCB_VIA_T ) item = syncVia( static_cast<VIA*>( t ) ); if( item ) m_world->Add( item ); } // TODO: Create resolvers in ctor, call resolver->SetBoard() in this->SetBoard() and delete it in dtor // TBD: Same remark as with m_sizes.SetMinimumTrackWidth in startRouting() int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); m_clearanceResolver = new PNS_PCBNEW_CLEARANCE_RESOLVER( this ); m_world->SetClearanceResolver( m_clearanceResolver ); m_world->SetMaxClearance( 4 * worstClearance ); m_pairingResolver = new PCBNEW_PAIRING_RESOLVER( m_board ); m_world->SetPairingResolver( m_pairingResolver ); }
void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) { if( !m_board ) { wxLogTrace( "PNS", "No board attached, aborting sync." ); return; } for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { std::unique_ptr< PNS::SOLID > solid = syncPad( pad ); if( solid ) aWorld->Add( std::move( solid ) ); } } for( TRACK* t = m_board->m_Track; t; t = t->Next() ) { KICAD_T type = t->Type(); if( type == PCB_TRACE_T ) { std::unique_ptr< PNS::SEGMENT > segment = syncTrack( t ); if( segment ) { aWorld->Add( std::move( segment ) ); } } else if( type == PCB_VIA_T ) { std::unique_ptr< PNS::VIA > via = syncVia( static_cast<VIA*>( t ) ); if( via ) { aWorld->Add( std::move( via ) ); } } } int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); delete m_ruleResolver; m_ruleResolver = new PNS_PCBNEW_RULE_RESOLVER( m_board, m_router ); aWorld->SetRuleResolver( m_ruleResolver ); aWorld->SetMaxClearance( 4 * worstClearance ); }
void PNS_ROUTER::SyncWorld() { if( !m_board ) { TRACEn( 0, "No board attached, aborting sync." ); return; } ClearWorld(); m_world = new PNS_NODE(); for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { PNS_ITEM* solid = syncPad( pad ); if( solid ) m_world->Add( solid ); } } for( TRACK* t = m_board->m_Track; t; t = t->Next() ) { KICAD_T type = t->Type(); PNS_ITEM* item = NULL; if( type == PCB_TRACE_T ) item = syncTrack( t ); else if( type == PCB_VIA_T ) item = syncVia( static_cast<VIA*>( t ) ); if( item ) m_world->Add( item ); } int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); m_clearanceFunc = new PNS_PCBNEW_CLEARANCE_FUNC( this ); m_world->SetClearanceFunctor( m_clearanceFunc ); m_world->SetMaxClearance( 4 * worstClearance ); }