23#include <wx/filedlg.h>
25#include <wx/hyperlink.h>
34using namespace std::placeholders;
106using namespace KIGFX;
110 const std::vector<PENDING_STACK_EXPANSION>& aPending )
112 if( aPreRoute.count( aVia->
m_Uuid ) )
118 if( !exp.m_Pos || *exp.m_Pos != aVia->
GetPosition() )
127 return &exp.m_Preset;
140 if( aCurrent == aStart )
144 if( aCurrent == aEnd )
156class UI_UPDATE_INTERVAL_GUARD
159 UI_UPDATE_INTERVAL_GUARD(
long aNewInterval ) :
160 m_saved( wxUpdateUIEvent::GetUpdateInterval() )
162 wxUpdateUIEvent::SetUpdateInterval( aNewInterval );
165 ~UI_UPDATE_INTERVAL_GUARD()
167 wxUpdateUIEvent::SetUpdateInterval( m_saved );
202 .Name(
"pcbnew.InteractiveRouter.PlaceVia" )
204 .DefaultHotkey(
'V' )
205 .LegacyHotkeyName(
"Add Through Via" )
206 .FriendlyName(
_(
"Place Through Via" ) )
207 .Tooltip(
_(
"Adds a through-hole via at the end of currently routed track." ) )
213 .Name(
"pcbnew.InteractiveRouter.PlaceBlindVia" )
216 .LegacyHotkeyName(
"Add Blind/Buried Via" )
217 .FriendlyName(
_(
"Place Blind/Buried Via" ) )
218 .Tooltip(
_(
"Adds a blind or buried via at the end of currently routed track.") )
224 .Name(
"pcbnew.InteractiveRouter.PlaceMicroVia" )
226 .DefaultHotkey(
MD_CTRL +
'V' )
227 .LegacyHotkeyName(
"Add MicroVia" )
228 .FriendlyName(
_(
"Place Microvia" ) )
229 .Tooltip(
_(
"Adds a microvia at the end of currently routed track." ) )
236 .Name(
"pcbnew.InteractiveRouter.PlaceViaStack" )
239 .FriendlyName(
_(
"Place Microvia Stack at Track End" ) )
240 .Tooltip(
_(
"Drops the active microvia stack preset at the end of the currently routed track "
241 "and continues on the target layer." ) )
246 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceVia" )
248 .DefaultHotkey(
'<' )
249 .LegacyHotkeyName(
"Select Layer and Add Through Via" )
250 .FriendlyName(
_(
"Select Layer and Place Through Via..." ) )
251 .Tooltip(
_(
"Select a layer, then add a through-hole via at the end of currently routed track." ) )
257 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia" )
259 .DefaultHotkey(
MD_ALT +
'<' )
260 .LegacyHotkeyName(
"Select Layer and Add Blind/Buried Via" )
261 .FriendlyName(
_(
"Select Layer and Place Blind/Buried Via..." ) )
262 .Tooltip(
_(
"Select a layer, then add a blind or buried via at the end of currently routed track." ) )
268 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia" )
270 .FriendlyName(
_(
"Select Layer and Place Micro Via..." ) )
271 .Tooltip(
_(
"Select a layer, then add a micro via at the end of currently routed track." ) )
277 .Name(
"pcbnew.InteractiveRouter.CustomTrackViaSize" )
279 .DefaultHotkey(
'Q' )
280 .LegacyHotkeyName(
"Custom Track/Via Size" )
281 .FriendlyName(
_(
"Custom Track/Via Size..." ) )
282 .Tooltip(
_(
"Shows a dialog for changing the track width and via size." ) )
286 .Name(
"pcbnew.InteractiveRouter.SwitchPosture" )
288 .DefaultHotkey(
'/' )
289 .LegacyHotkeyName(
"Switch Track Posture" )
290 .FriendlyName(
_(
"Switch Track Posture" ) )
291 .Tooltip(
_(
"Switches posture of the currently routed track." ) )
296 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingToNext" )
298 .DefaultHotkey(
MD_CTRL +
'/' )
299 .FriendlyName(
_(
"Track Corner Mode Switch" ) )
300 .Tooltip(
_(
"Switches between sharp/rounded and 45°/90° corners when routing tracks." ) )
305 .Name(
"pcbnew.InteractiveRouter.SwitchRounding45" )
307 .DefaultHotkey(
MD_CTRL +
'W' )
308 .FriendlyName(
_(
"Track Corner Mode 45" ) )
309 .Tooltip(
_(
"Switch to 45° corner when routing tracks." ) ) );
312 .Name(
"pcbnew.InteractiveRouter.SwitchRounding90" )
315 .FriendlyName(
_(
"Track Corner Mode 90" ) )
316 .Tooltip(
_(
"Switch to 90° corner when routing tracks." ) ) );
319 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc45" )
322 .FriendlyName(
_(
"Track Corner Mode Arc 45" ) )
323 .Tooltip(
_(
"Switch to arc 45° corner when routing tracks." ) ) );
326 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc90" )
328 .DefaultHotkey(
MD_ALT +
'W' )
329 .FriendlyName(
_(
"Track Corner Mode Arc 90" ) )
330 .Tooltip(
_(
"Switch to arc 90° corner when routing tracks." ) ) );
333#define _(s) wxGetTranslation((s))
356 SetTitle(
_(
"Select Track/Via Width" ) );
374 _(
"Route using the width of the starting track." ), wxITEM_CHECK );
379 _(
"Use track and via sizes from the net class" ), wxITEM_CHECK );
384 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
395 msg =
_(
"Track netclass width" );
397 msg.Printf(
_(
"Track %s" ),
m_frame.MessageTextFromValue( width ) );
400 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
411 msg =
_(
"Via netclass values" );
414 if(
via.m_Drill > 0 )
416 msg.Printf(
_(
"Via %s, hole %s" ),
417 m_frame.MessageTextFromValue(
via.m_Diameter ),
418 m_frame.MessageTextFromValue(
via.m_Drill ) );
422 msg.Printf(
_(
"Via %s" ),
423 m_frame.MessageTextFromValue(
via.m_Diameter ) );
428 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
436 int id = aEvent.GetId();
488 SetTitle(
_(
"Select Differential Pair Dimensions" ) );
504 _(
"Use differential pair dimensions from the net class" ), wxITEM_CHECK );
509 _(
"Specify custom differential pair dimensions" ), wxITEM_CHECK );
522 if( diffPair.
m_Gap <= 0 )
526 msg.Printf(
_(
"Width %s" ),
531 msg.Printf(
_(
"Width %s, via gap %s" ),
540 msg.Printf(
_(
"Width %s, gap %s" ),
546 msg.Printf(
_(
"Width %s, gap %s, via gap %s" ),
554 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
562 int id = aEvent.GetId();
606 auto& menu =
m_menu->GetMenu();
607 menu.SetUntranslatedTitle(
_HKI(
"Interactive Router" ) );
627 auto notRoutingCond =
630 return !
m_router->RoutingInProgress();
633 auto inRouteSelected =
642 std::vector<PNS::NET_HANDLE> currentNets =
m_router->GetCurrentNets();
644 if( currentNets.empty() || currentNets[0] ==
nullptr )
651 RN_NET* ratsnest =
board->GetConnectivity()->GetRatsnestForNet( currentNet );
653 return ratsnest && !ratsnest->
GetEdges().empty();
658 menu.AddSeparator( 1 );
661 menu.AddSeparator( haveHighlight, 2 );
689 submenuCornerMode->
SetTitle(
_(
"Track Corner Mode" ) );
699 menu.AddMenu( submenuCornerMode );
702 auto cornerMode45Cond =
708 auto cornerMode90Cond =
714 auto cornerModeArc45Cond =
720 auto cornerModeArc90Cond =
726#define CHECK( x ) ACTION_CONDITIONS().Check( x )
766 static size_t lastLoggerSize = 0;
767 static wxString mruPath;
772 if( !logger || logger->GetEvents().size() == 0
773 || logger->GetEvents().size() == lastLoggerSize )
778 if( !testCaseDir.IsEmpty() )
785 wxFileName
path = wxFileName::DirName( testCaseDir );
789 if(
path.DirExists() )
791 doExit = !
IsOK(
frame(), wxString::Format(
_(
"Test case in directory %s already exists. Overwrite?"),
path.GetFullPath() ) );
795 path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
798 path.SetName( wxT(
"pns") );
799 logPath =
path.GetFullPath();
808 lastLoggerSize = logger->GetEvents().size();
814 if ( mruPath.IsEmpty() )
819 wxFileDialog dlg(
frame(),
_(
"Save router log" ), mruPath,
"pns.log",
821 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
825 if( dlg.ShowModal() != wxID_OK )
827 lastLoggerSize = logger->GetEvents().size();
831 logPath = dlg.GetPath();
835 wxFileName fname_log( logPath );
836 mruPath = fname_log.GetPath();
837 fname_log.SetExt(
"log" );
838 wxLogTrace( wxT(
"PNS" ), wxT(
"save log to: %s" ), fname_log.GetFullPath() );
840 wxFileName fname_dump( fname_log );
841 fname_dump.SetExt(
"dump" );
843 wxFileName fname_settings( fname_log );
844 fname_settings.SetExt(
"settings" );
846 FILE* settings_f = wxFopen( fname_settings.GetAbsolutePath(),
"wb" );
850 DisplayError(
frame(), wxString::Format(
_(
"Unable to write '%s'." ), fname_settings.GetAbsolutePath() ) );
854 std::string settingsStr =
m_router->Settings().FormatAsString();
855 fprintf( settings_f,
"%s\n", settingsStr.c_str() );
856 fclose( settings_f );
863 pcb_io.
SaveBoard( fname_dump.GetAbsolutePath(), *
m_iface->GetBoard(),
nullptr );
872 wxString srcRules = editFrame->GetBoard()->GetDesignRulesPath();
874 if( !srcRules.IsEmpty() && wxFileName::FileExists( srcRules ) )
876 wxFileName fname_rules( fname_dump );
878 wxCopyFile( srcRules, fname_rules.GetAbsolutePath() );
883 std::vector<PNS::ITEM*> removed;
887 for(
auto item : removed )
892 wxASSERT_MSG( item->Parent() !=
nullptr,
"removed an item with no parent uuid?" );
904 logData.
m_Events = logger->GetEvents();
906 FILE* log_f = wxFopen( fname_log.GetAbsolutePath(),
"wb" );
912 fname_log.GetAbsolutePath() ) );
916 fprintf( log_f,
"%s\n", logString.c_str().AsChar() );
952 bool asChanged =
false;
1007 int startLayer =
m_iface->GetPNSLayerFromBoardLayer( tl );
1013 return m_iface->GetBoardLayerFromPNSLayer( ls.
Start() );
1022 int activeLayer =
m_iface->GetPNSLayerFromBoardLayer(
frame()->GetActiveLayer() );
1023 int currentLayer =
m_router->GetCurrentLayer();
1025 if( currentLayer != activeLayer )
1026 m_router->SwitchLayer( activeLayer );
1028 std::optional<int> newLayer =
m_router->Sizes().PairedLayer( currentLayer );
1031 newLayer =
m_router->Sizes().GetLayerTop();
1033 m_router->SwitchLayer( *newLayer );
1044 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
1048 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
1054 dummyTrack.
SetLayer( targetLayer );
1076 if( !constraint.
IsNull() )
1104 dummyTrackB.
SetLayer( targetLayer );
1111 if( !constraint.
IsNull() )
1129 if( !constraint.
IsNull() )
1163 wxASSERT_MSG(
false, wxT(
"Unhandled via type" ) );
1210 if( presets.empty() )
1212 frame()->GetInfoBar()->ShowMessageFor(
_(
"No microvia stack presets defined. Add one in Board Setup, "
1213 "Microvia Stacks." ),
1214 3000, wxICON_INFORMATION );
1218 int idx = std::clamp( bds.
GetViaStackIndex(), 0, (
int) presets.size() - 1 );
1230 frame()->GetInfoBar()->ShowMessageFor(
_(
"The microvia stack preset layers are not present on this board." ),
1231 3000, wxICON_ERROR );
1239 frame()->GetInfoBar()->ShowMessageFor( wxString::Format(
_(
"The microvia stack runs between %s and %s. "
1240 "Route on one of those layers to place it." ),
1243 3000, wxICON_ERROR );
1258 if( traces.
Size() > 0 )
1262 if( line->PointCount() > 0 )
1263 head = line->CLine().CLastPoint();
1269 frame()->GetInfoBar()->ShowMessageFor(
_(
"Could not end the track here for a microvia stack." ), 3000,
1287 if( !
m_router->GetCurrentNets().empty() )
1290 net = ni->GetNetCode();
1339 m_iface->GetPNSLayerFromBoardLayer( targetLayer ) );
1346 if(
m_router->RoutingInProgress() )
1364 if( traces.
Size() == 0 )
1371 if( line->EndsWithVia() )
1415 size_t target_idx = 0;
1417 for(
size_t i = 0; i < layers.size(); i++ )
1419 if( layers[i] == currentLayer )
1426 target_idx = ( idx + 1 ) % layers.size();
1429 for(
size_t i = 0; i < layers.size() - 1; i++ )
1433 targetLayer = layers[target_idx];
1438 if( target_idx >= layers.size() )
1453 size_t target_idx = 0;
1455 for(
size_t i = 0; i < layers.size(); i++ )
1457 if( layers[i] == currentLayer )
1464 target_idx = ( idx > 0 ) ? ( idx - 1 ) : ( layers.size() - 1 );
1466 for(
size_t i = 0; i < layers.size() - 1; i++ )
1470 targetLayer = layers[target_idx];
1474 if( target_idx > 0 )
1477 target_idx = layers.size() - 1;
1499 if( !enabledLayers.test( targetLayer ) )
1505 if( targetLayer == currentLayer )
1525 bool selectLayer =
false;
1530 const int actViaFlags = aEvent.
Parameter<
int>();
1545 endPoint =
frame()->GetCanvas()->ClientToScreen( endPoint );
1551 not_allowed_ly.
set( currentLayer );
1553 targetLayer =
frame()->SelectOneLayer(
static_cast<PCB_LAYER_ID>( currentLayer ),
1554 not_allowed_ly, endPoint );
1565 if( currentLayer == targetLayer )
1576 && ( ( targetLayer ==
B_Cu && currentLayer ==
F_Cu )
1577 || ( targetLayer ==
F_Cu && currentLayer ==
B_Cu ) ) )
1592 if( !
m_router->GetNearestRatnestAnchor( otherEnd, otherEndLayers, otherEndItem ) )
1595 currentLayer = pairTop;
1596 targetLayer = pairBottom;
1603 const std::optional<int> pairedLayerPns =
m_router->Sizes().PairedLayer(
m_router->GetCurrentLayer() );
1611 const bool otherEndIsThrough =
1612 otherEndLayers == allCopperLayers
1613 || ( otherEndItem && otherEndItem->
HasHole()
1614 && otherEndItem->
Hole()->
Layers() == allCopperLayers );
1616 if( otherEndIsThrough )
1620 if( currentLayer == pairBottom )
1621 targetLayer = pairTop;
1622 else if( currentLayer == pairTop )
1623 targetLayer = pairBottom;
1625 targetLayer = pairTop;
1627 else if( currentLayer == otherEndLayerPcbId && pairedLayerPns.has_value() )
1631 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( *pairedLayerPns );
1635 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( otherEndLayers.
Start() );
1641 if( currentLayer == pairTop || currentLayer == pairBottom )
1645 currentLayer = pairTop;
1646 targetLayer = pairBottom;
1652 targetLayer = pairTop;
1656 if( currentLayer == targetLayer )
1659 infobar->
ShowMessageFor(
_(
"Via needs 2 different layers." ), 5000, wxICON_ERROR,
1660 WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION );
1675 if( !
m_router->GetCurrentNets().empty() )
1682 if( !constraint.
IsNull() )
1687 if( !constraint.
IsNull() )
1698 m_iface->GetPNSLayerFromBoardLayer( targetLayer ) );
1705 if(
m_router->RoutingInProgress() )
1731 int pnsLayer =
m_iface->GetPNSLayerFromBoardLayer( pcbLayer );
1742 if( !
getView()->IsLayerVisible( pcbLayer ) )
1750 m_iface->SetStartLayerFromPCBNew( pcbLayer );
1752 frame()->GetBoard()->GetDesignSettings().m_TempOverrideTrackWidth =
false;
1755 m_iface->GetPNSLayerFromBoardLayer(
frame()->GetScreen()->m_Route_Layer_BOTTOM ) );
1785 m_router->ClearViewDecorations();
1796 frame()->UndoRedoBlock(
true );
1832 frame()->UndoRedoBlock(
false );
1854 auto syncRouterAndFrameLayer =
1857 int pnsLayer =
m_router->GetCurrentLayer();
1863 if( !
getView()->IsLayerVisible( pcbLayer ) )
1878 if( startWithVia && !startReachesViaTarget )
1885 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
1891 m_toolMgr->GetView()->SyncLayerVisibilityCache();
1896 if( !
m_router->RoutingInProgress() )
1898 if( evt->IsCancelInteractive() )
1915 if( std::optional<VECTOR2I> last =
m_router->UndoLastSegment() )
1918 evt->SetMousePosition( last.value() );
1929 bool* autoRouted = evt->Parameter<
bool*>();
1936 if( autoRouted !=
nullptr )
1945 if( autoRouted !=
nullptr )
1947 *autoRouted =
false;
1957 bool needsAppend =
m_router->Placer()->HasPlacedAnything();
1961 syncRouterAndFrameLayer();
1973 frame()->ShowInfoBarError(
m_router->FailureReason(),
true );
1982 bool needLayerSwitch =
m_router->IsPlacingVia();
1983 bool forceCommit =
false;
1993 if( needLayerSwitch )
2003 syncRouterAndFrameLayer();
2044 bool forceFinish =
true;
2045 bool forceCommit =
false;
2051 || evt->IsActivate()
2057 if( evt->IsActivate() && !evt->IsMoveTool() )
2064 else if( evt->IsUndoRedo() )
2082 evt->SetPassEvent();
2103 if( settingsDlg.
ShowModal() == wxID_OK )
2135 settings.SetMode( mode );
2163 return m_router->Settings().Mode();
2169 return m_router->RoutingInProgress();
2203 if(
m_router->RoutingInProgress() )
2227 controls->ForceCursorPosition(
false );
2232 std::vector<BOARD_CONNECTED_ITEM*> itemList;
2239 itemList.push_back(
pad );
2247 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
frame->GetBoard()->GetConnectivity();
2250 bool groupStart =
true;
2258 RN_NET* net = connectivity->GetRatsnestForNet( item->GetNetCode() );
2263 std::vector<std::shared_ptr<const CN_ANCHOR>> anchors;
2267 std::shared_ptr<const CN_ANCHOR> target = edge.GetTargetNode();
2268 std::shared_ptr<const CN_ANCHOR>
source = edge.GetSourceNode();
2270 if( !
source ||
source->Dirty() || !target || target->Dirty() )
2273 if(
source->Parent() == item )
2274 anchors.push_back(
source );
2275 else if( target->Parent() == item )
2276 anchors.push_back( target );
2280 for( std::shared_ptr<const CN_ANCHOR>
anchor : anchors )
2289 if(
frame->GetActiveLayer() != originalLayer )
2290 frame->SetActiveLayer( originalLayer );
2297 bool autoRouted =
false;
2342 std::vector<BOARD_CONNECTED_ITEM*> trackItems;
2350 if( trackItems.empty() )
2360 int dpSkipped = std::erase_if( trackItems,
2368 frame->ShowInfoBarMsg(
_(
"Differential pair members cannot be optimized." ) );
2370 bool groupStart =
true;
2388 branch->
Remove( originalLine );
2390 PNS::LINE optimizedLine( originalLine );
2399 if(
m_router->Settings().GetRestrictAngles() )
2421 branch->
Add( optimizedLine );
2442 if(
m_router->RoutingInProgress() )
2465 controls->ForceCursorPosition(
false );
2481 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2483 if( !evt->IsDrag() )
2486 if( evt->IsCancelInteractive() )
2490 else if( evt->IsActivate() )
2492 if( evt->IsMoveTool() || evt->IsEditorTool() )
2495 frame->PushTool( originalEvent );
2526 evt->SetPassEvent(
false );
2535 if( evt->HasPosition() )
2549 else if( evt->IsKeyPressed() )
2554 evt->SetPassEvent();
2562 evt->SetPassEvent();
2588 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
2589 wxOK | wxCANCEL | wxICON_WARNING );
2590 dlg.SetOKLabel(
_(
"Drag Anyway" ) );
2601 if( !
m_router->FailureReason().IsEmpty() )
2602 frame()->ShowInfoBarError(
m_router->FailureReason(),
true );
2612 frame()->UndoRedoBlock(
true );
2614 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
2620 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2633 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
2640 hint.Printf(
_(
"(%s to commit anyway.)" ),
2644 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
2654 bool forceFinish =
false;
2655 bool forceCommit = evt->Modifier(
MD_CTRL );
2665 || evt->IsActivate() )
2670 if( evt->IsActivate() && !evt->IsMoveTool() )
2675 else if( evt->IsUndoRedo() )
2703 evt->SetPassEvent();
2708 evt->SetPassEvent();
2717 if(
m_router->RoutingInProgress() )
2723 frame()->UndoRedoBlock(
false );
2750 if( vias + traces == 0 )
2764 for(
int i = 0; !reference && i < aCollector.
GetCount(); i++ )
2765 reference =
dynamic_cast<PCB_TRACK*
>( aCollector[i] );
2779 refPoint = reference->
GetEnd();
2783 for(
int i = 0; i < aCollector.
GetCount(); i++ )
2787 if( neighbor && neighbor != reference )
2792 if( neighbor->
GetStart() != refPoint && neighbor->
GetEnd() != refPoint )
2799 aCollector.
Append( reference );
2815 bool allFootprints =
true;
2816 bool allTracks =
true;
2820 switch( item->Type() )
2829 allFootprints =
false;
2865 default:
return false;
2873 std::copy( aOriginalSelection.
Items().begin(), aOriginalSelection.
Items().end(), std::back_inserter( selItems ) );
2889 std::deque<EDA_ITEM*> selectedItems =
selection.GetItems();
2899 std::set<FOOTPRINT*> footprints;
2900 std::set<PAD*> freePads;
2901 bool blockDrag =
false;
2904 footprints.insert(
static_cast<FOOTPRINT*
>( item ) );
2908 for(
int idx = 0; idx <
selection.Size(); ++idx )
2910 if( !
selection.GetItem( idx )->IsBOARD_ITEM() )
2916 footprints.insert(
static_cast<FOOTPRINT*
>( selItem ) );
2926 frame()->ShowInfoBarMsg(
_(
"The selection contains items that cannot be dragged." ) );
2943 bool wasLocked =
false;
2960 bool showCourtyardConflicts =
frame()->GetPcbNewSettings()->m_ShowCourtyardCollisions;
2962 std::shared_ptr<DRC_ENGINE> drcEngine =
m_toolMgr->GetTool<
DRC_TOOL>()->GetDRCEngine();
2966 std::vector<BOARD_ITEM*> dynamicItems;
2967 std::unique_ptr<CONNECTIVITY_DATA> dynamicData =
nullptr;
2969 std::vector<PNS::ITEM*> leaderSegments;
2970 bool singleFootprintDrag =
false;
2978 for(
auto it = footprints.begin(); it != footprints.end(); )
2980 bool hasSolid =
false;
2982 for(
PAD*
pad : ( *it )->Pads() )
2983 hasSolid |= !
m_router->GetWorld()->FindItemsByParent(
pad ).empty();
2985 it = hasSolid ? std::next( it ) : footprints.erase( it );
2989 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2991 if( !footprints.empty() )
2994 if( footprints.size() == 1 && !blockDrag )
2995 singleFootprintDrag =
true;
2997 if( showCourtyardConflicts )
3006 itemsToDrag.
Add( solid );
3010 if( connectivityData->GetRatsnestForPad(
pad ).size() > 0 )
3011 dynamicItems.push_back(
pad );
3018 itemsToDrag.
Add( solid );
3024 || shape->GetLayer() ==
Margin
3028 itemsToDrag.
Add( solid );
3032 if( showCourtyardConflicts )
3036 dynamicData = std::make_unique<CONNECTIVITY_DATA>(
board()->GetConnectivity(), dynamicItems,
true );
3037 connectivityData->BlockRatsnestItems( dynamicItems );
3040 if( footprints.empty() || blockDrag )
3042 for(
EDA_ITEM* selItem : selectedItems )
3044 if( !selItem->IsBOARD_ITEM() )
3057 itemsToDrag.
Add( pnsItem );
3061 PAD*
pad =
static_cast<PAD*
>( boardItem );
3064 if( footprints.count(
pad->GetParentFootprint() ) )
3067 freePads.insert(
pad );
3071 itemsToDrag.
Add( solid );
3083 if( itemsToDrag.
Count() >= 1 )
3089 int layer =
m_iface->GetPNSLayerFromBoardLayer( activeLayer );
3091 SEG::ecoord closestDistSq = std::numeric_limits<SEG::ecoord>::max();
3095 const SHAPE* shape = pitem->Shape( layer );
3102 if( distSq < closestDistSq )
3104 closestDistSq = distSq;
3105 closestItem = pitem;
3115 if( closestItem->
Net() )
3120 if( !footprints.empty() && singleFootprintDrag )
3131 tweakedMousePos =
footprint->GetPosition();
3146 int dragMode = aEvent.
Parameter<
int> ();
3148 if( !footprints.empty() || !freePads.empty() || blockDrag )
3149 dragMode &=
~PNS::DM_FREE_ANGLE;
3154 m_iface->SetIndependentPads( freePads );
3156 bool dragStarted =
m_router->StartDragging( p, itemsToDrag, dragMode );
3160 m_iface->SetIndependentPads( {} );
3163 frame()->ShowInfoBarMsg(
_(
"Nothing in the selection can be dragged." ) );
3168 if( !footprints.empty() )
3169 connectivityData->ClearLocalRatsnest();
3183 frame()->UndoRedoBlock(
true );
3187 size_t held = blockDragger->AnchoredLines().size();
3191 frame()->ShowInfoBarWarning(
3192 wxString::Format( wxPLURAL(
"%zu selected arc cannot move because both ends are fixed.",
3193 "%zu selected arcs cannot move because both ends are fixed.", held ),
3217 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
3219 bool hasMouseMoved =
false;
3220 bool hasMultidragCancelled =
false;
3226 m_toolMgr->GetView()->SyncLayerVisibilityCache();
3230 if( evt->IsCancelInteractive()
3232 || evt->IsActivate() )
3237 hasMultidragCancelled =
true;
3241 else if( evt->IsMotion()
3245 hasMouseMoved =
true;
3251 if( !footprints.empty() )
3260 previewItem =
static_cast<BOARD_ITEM*
>( drawing->Clone() );
3261 previewItem->
Move( offset );
3270 &&
pad->GetDrillSize().x == 0 )
3273 previewItem->
Move( offset );
3286 previewItem->
Move( offset );
3291 previewItem->
Move( offset );
3295 if( showCourtyardConflicts )
3299 if( showCourtyardConflicts )
3301 courtyardClearanceDRC.
Run();
3309 dynamicData->Move( offset - lastOffset );
3310 lastOffset = offset;
3311 connectivityData->ComputeLocalRatsnest( dynamicItems, dynamicData.get(), offset );
3314 for(
PAD*
pad : freePads )
3321 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
3329 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
3337 else if( hasMouseMoved && ( evt->IsMouseUp(
BUT_LEFT )
3341 bool forceFinish =
false;
3342 bool forceCommit = evt->Modifier(
MD_CTRL );
3346 leaderSegments =
m_router->GetLastCommittedLeaderSegments();
3350 else if( evt->IsUndoRedo() )
3378 evt->SetPassEvent();
3383 evt->SetPassEvent();
3389 if( !footprints.empty() )
3406 connectivityData->ClearLocalRatsnest();
3409 for(
PAD*
pad : freePads )
3412 m_iface->SetIndependentPads( {} );
3417 if(
m_router->RoutingInProgress() )
3421 if( itemsToDrag.
Size() && hasMultidragCancelled )
3425 else if( leaderSegments.size() )
3427 std::vector<EDA_ITEM*> newItems;
3430 newItems.push_back( lseg->Parent() );
3438 frame()->UndoRedoBlock(
false );
3462 m_toolMgr->GetView()->SyncLayerVisibilityCache();
3490 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
3491 wxOK | wxCANCEL | wxICON_WARNING );
3492 dlg.SetOKLabel(
_(
"Break Track" ) );
3501 frame()->UndoRedoBlock(
true );
3504 if(
m_router->RoutingInProgress() )
3507 frame()->UndoRedoBlock(
false );
3535 if( !
m_router->GetCurrentNets().empty() )
3554 std::vector<MSG_PANEL_ITEM> items;
3561 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
3562 wxString description;
3568 wxASSERT( nets.size() >= 2 );
3575 description = wxString::Format(
_(
"Routing Diff Pair: %s" ),
3582 if( *netclassA == *netclassB )
3588 secondary = wxString::Format(
_(
"Resolved Netclass: %s" ),
3591 else if( !nets.empty() && nets[0] )
3595 description = wxString::Format(
_(
"Routing Track: %s" ),
3598 secondary = wxString::Format(
3599 _(
"Resolved Netclass: %s" ),
3604 description =
_(
"Routing Track" );
3605 secondary =
_(
"(no net)" );
3608 items.emplace_back( description, secondary );
3610 wxString cornerMode;
3612 if(
m_router->Settings().GetFreeAngleMode() )
3614 cornerMode =
_(
"Free-angle" );
3618 switch(
m_router->Settings().GetCornerMode() )
3628 items.emplace_back(
_(
"Corner Style" ), cornerMode );
3630 switch(
m_router->Settings().Mode() )
3638 items.emplace_back(
_(
"Mode" ), mode );
3640#define FORMAT_VALUE( x ) frame()->MessageTextFromValue( x )
3644 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
3646 wxString::Format(
_(
"(from %s)" ),
3649 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
3651 wxString::Format(
_(
"(from %s)" ),
3654 items.emplace_back( wxString::Format(
_(
"Diff Pair Gap: %s" ),
3656 wxString::Format(
_(
"(from %s)" ),
3660 wxASSERT( traces.
Count() == 2 );
3663 traces[1],
m_router->GetCurrentLayer(), &constraint ) )
3665 items.emplace_back( wxString::Format(
_(
"DP Max Uncoupled-length: %s" ),
3667 wxString::Format(
_(
"(from %s)" ),
3673 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
3675 wxString::Format(
_(
"(from %s)" ),
3678 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
3680 wxString::Format(
_(
"(from %s)" ),
3686 frame()->SetMsgPanel( items );
std::function< void(const VECTOR2I &, GENERAL_COLLECTOR &, PCB_SELECTION_TOOL *)> CLIENT_SELECTION_FILTER
@ switch_corner_rounding_shape
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION pasteSpecial
static TOOL_ACTION cursorDblClick
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
static TOOL_ACTION finishInteractive
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetLayerVisible(int aLayer, bool isVisible)
Manually update visibility for a given layer.
BASE_SET & set(size_t pos)
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
NETINFO_ITEM * GetNet() const
Return NETINFO_ITEM object for a given item.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
void SetCustomDiffPairWidth(int aWidth)
Sets custom track width for differential pairs (i.e.
int GetCurrentViaSize() const
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
int GetTrackWidthIndex() const
int GetViaSizeIndex() const
int GetDiffPairIndex() const
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
void SetDiffPairIndex(int aIndex)
bool m_TempOverrideTrackWidth
void SetCustomDiffPairGap(int aGap)
Sets custom gap for differential pairs (i.e.
bool UseNetClassVia() const
Return true if netclass values should be used to obtain appropriate via size.
int GetViaStackIndex() const
bool UseNetClassTrack() const
Return true if netclass values should be used to obtain appropriate track width.
bool UseNetClassDiffPair() const
Return true if netclass values should be used to obtain appropriate diff pair dimensions.
void SetTrackWidthIndex(int aIndex)
Set the current track width list index to aIndex.
int GetCopperLayerCount() const
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
std::vector< int > m_TrackWidthList
int GetCurrentViaDrill() const
std::vector< VIA_STACK_PRESET > m_ViaStackPresets
std::vector< VIA_DIMENSION > m_ViasDimensionsList
void SetCustomDiffPairViaGap(int aGap)
Sets custom via gap for differential pairs (i.e.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
bool IsLocked() const override
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
Information pertinent to a Pcbnew printed circuit board.
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
BOARD_DESIGN_SETTINGS & GetDesignSettings()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
void Empty()
Clear the list.
int GetCount() const
Return the number of objects in the list.
int CountType(KICAD_T aType)
Count the number of items matching aType.
void Append(EDA_ITEM *item)
Add an item to the end of the list.
PNS::LOGGER::TEST_CASE_TYPE getTestCaseType() const
const wxString & getTestCaseName() const
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
@ ROUNDED_90
H/V with filleted corners.
@ MITERED_90
H/V only (90-degree corners)
@ ROUNDED_45
H/V/45 with filleted corners.
@ MITERED_45
H/V/45 with mitered corners (default)
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
std::vector< FOOTPRINT * > m_FpInMove
void ClearConflicts(KIGFX::VIEW *aView)
void UpdateConflicts(KIGFX::VIEW *aView, bool aHighlightMoved)
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=INFOBAR_MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
Used when the right click button is pressed, or when the select tool is in effect.
static const std::vector< KICAD_T > DraggableItems
A scan list for items that can be dragged.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
Abstract interface for drawing on a 2D-surface.
BOX2D GetVisibleWorldExtents() const
bool GetGridSnapping() const
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void ShowPreview(bool aShow=true)
virtual int GetTopLayer() const
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
void Hide(VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
Temporarily hide the item in the view (e.g.
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
A collection of nets and the parameters used to route or test these nets.
bool HasuViaDrill() const
const wxString GetHumanReadableName() const
Gets the consolidated name of this netclass (which may be an aggregate).
bool HasuViaDiameter() const
int GetuViaDiameter() const
Handle the data for a net.
const wxString & GetNetname() const
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
static TOOL_ACTION_GROUP layerDirectSwitchActions()
static TOOL_ACTION layerToggle
static TOOL_ACTION drag45Degree
static TOOL_ACTION layerInner12
static TOOL_ACTION routerUndoLastSegment
static TOOL_ACTION layerInner8
static TOOL_ACTION layerInner3
static TOOL_ACTION layerPrev
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
static TOOL_ACTION layerInner2
static TOOL_ACTION routerAttemptFinish
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION layerChanged
static TOOL_ACTION layerInner25
static TOOL_ACTION breakTrack
Break a single track into two segments at the cursor.
static TOOL_ACTION routerRouteSelectedFromEnd
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
static TOOL_ACTION routerWalkaroundMode
static TOOL_ACTION routerShoveMode
static TOOL_ACTION layerInner24
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION layerInner29
static TOOL_ACTION routerOptimizeSelected
static TOOL_ACTION routerAutorouteSelected
static TOOL_ACTION layerInner11
static TOOL_ACTION routerDiffPairDialog
static TOOL_ACTION routerContinueFromEnd
static TOOL_ACTION layerInner16
static TOOL_ACTION layerInner26
static TOOL_ACTION layerInner18
static TOOL_ACTION layerInner14
static TOOL_ACTION selectLayerPair
static TOOL_ACTION layerInner6
static TOOL_ACTION dragFreeAngle
static TOOL_ACTION clearHighlight
static TOOL_ACTION layerInner22
static TOOL_ACTION layerInner5
static TOOL_ACTION layerInner20
static TOOL_ACTION layerInner7
static TOOL_ACTION layerInner27
static TOOL_ACTION cancelCurrentItem
static TOOL_ACTION layerInner1
static TOOL_ACTION layerInner10
static TOOL_ACTION layerInner15
static TOOL_ACTION layerInner17
static TOOL_ACTION layerBottom
static TOOL_ACTION layerInner19
static TOOL_ACTION layerInner9
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION layerInner30
static TOOL_ACTION layerTop
static TOOL_ACTION cycleRouterMode
static TOOL_ACTION layerInner4
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
static TOOL_ACTION layerInner13
static TOOL_ACTION layerInner21
static TOOL_ACTION layerNext
static TOOL_ACTION routerRouteSelected
static TOOL_ACTION placeViaStack
static TOOL_ACTION layerInner23
static TOOL_ACTION layerInner28
Common, abstract interface for edit frames.
APPEARANCE_CONTROLS * GetAppearancePanel()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual PCB_LAYER_ID GetActiveLayer() const
The main frame for Pcbnew.
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
void SaveBoard(const wxString &aFileName, BOARD &aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
PCB_LAYER_ID m_Route_Layer_TOP
PCB_LAYER_ID m_Route_Layer_BOTTOM
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if point if near (dist = m...
static int ExpandMultiHopMicrovias(BOARD *aBoard, BOARD_COMMIT *aCommit, const std::function< const VIA_STACK_PRESET *(PCB_VIA *)> &aMatcher=nullptr)
Replace loose microvias spanning more than one hop with stacks of single hop microvias.
static std::set< KIID > CollectExpandableMicrovias(BOARD *aBoard)
Ids of the vias ExpandMultiHopMicrovias would consider right now.
static const wxString GENERATOR_TYPE
PCB_LAYER_ID BottomLayer() const
VECTOR2I GetPosition() const override
void SetPosition(const VECTOR2I &aPoint) override
void SetSizeFromRules(int aDiameter, int aDrill)
Give the via a uniform padstack sized from its diameter and hole rules.
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
int GetWidth() const override
void SetViaType(VIATYPE aViaType)
PCB_LAYER_ID TopLayer() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
int Count(int aKindMask=-1) const
void Add(const LINE &aLine)
std::vector< ITEM * > & Items()
Base class for PNS router board items.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
bool OfKind(int aKindMask) const
virtual HOLE * Hole() const
virtual bool HasHole() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
bool CompareGeometry(const LINE &aOther)
Return true if the line is geometrically identical as line aOther.
virtual void ClearLinks()
Erase the linking information. Used to detach the line from the owning node.
static wxString FormatLogFileAsJSON(const LOG_DATA &aLogData)
Keep the router "world" - i.e.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
RULE_RESOLVER * GetRuleResolver() const
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=nullptr, bool aStopAtLockedJoints=false, bool aFollowLockedSegments=false, bool aAllowSegmentSizeMismatch=true)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
ITEM * FindItemByParent(const BOARD_ITEM *aParent)
void Remove(ARC *aArc)
Remove an item from this branch.
static bool Optimize(LINE *aLine, int aEffortLevel, NODE *aWorld, const VECTOR2I &aV=VECTOR2I(0, 0))
A quick shortcut to optimize a line without creating and setting up an optimizer.
@ SMART_PADS
Reroute pad exits.
@ FANOUT_CLEANUP
Simplify pad-pad and pad-via connections if possible.
@ MERGE_SEGMENTS
Reduce corner cost iteratively.
@ MERGE_COLINEAR
Merge co-linear segments.
@ MERGE_OBTUSE
Reduce corner cost by merging obtuse segments.
@ REQUIRE_OBTUSE_ANGLES
Try to prevent 90-degree or acute corners in a drag.
Contain all persistent settings of the router, such as the mode, optimization effort,...
void SetMode(PNS_MODE aMode)
Set the routing mode.
PNS_MODE Mode() const
Return the routing mode.
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const ITEM *aItemA, const ITEM *aItemB, int aLayer, CONSTRAINT *aConstraint)=0
virtual NET_HANDLE DpCoupledNet(NET_HANDLE aNet)=0
void SetViaType(VIATYPE aViaType)
void SetTrackWidth(int aWidth)
int DiffPairWidth() const
void SetDiffPairWidth(int aWidth)
void SetDiffPairWidthSource(const wxString &aSource)
void SetDiffPairGapSource(const wxString &aSource)
void SetDiffPairGap(int aGap)
void SetViaDrill(int aDrill)
wxString GetClearanceSource() const
wxString GetDiffPairGapSource() const
wxString GetDiffPairWidthSource() const
void AddLayerPair(int aL1, int aL2)
void SetClearance(int aClearance)
bool TrackWidthIsExplicit() const
void SetViaDiameter(int aDiameter)
void SetClearanceSource(const wxString &aSource)
wxString GetWidthSource() const
void SetWidthSource(const wxString &aSource)
int DiffPairViaGap() const
Represent a contiguous set of PCB layers.
bool Overlaps(const PNS_LAYER_RANGE &aOther) const
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
Container for project specific data.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual PROJECT_FILE & GetProjectFile() const
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetEdges() const
void SetMessage(const wxString &aStatus)
void SetHint(const wxString &aHint)
void SetPosition(const VECTOR2I &aPos) override
VECTOR2I::extended_type ecoord
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
std::deque< EDA_ITEM * > & Items()
An abstract shape on 2D plane.
virtual SEG::ecoord SquaredDistance(const VECTOR2I &aP, bool aOutlineOnly=false) const
A modified version of the wxInfoBar class that allows us to:
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Handle a list of polygons defining a copper zone.
@ BLOCK
Cannot be represented at all, export to this target is not possible.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
@ VIA_DIAMETER_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
#define ROUTER_TRANSIENT
transient items that should NOT be cached
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define STARTPOINT
When a line is selected, these flags indicate which.
a few functions useful in geometry calculations.
VECTOR2< ret_type > GetClampedCoords(const VECTOR2< in_type > &aCoords, pad_type aPadding=1u)
Clamp a vector to values that can be negated, respecting numeric limits of coordinates data type with...
wxString m_RouterTestCaseDirectory
Router test case directory.
static const std::string DesignRulesFileExtension
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
std::optional< wxString > fileHashMMH3(const wxString &aFilePath)
Calculates an MMH3 hash of a given file.
The Cairo implementation of the graphics abstraction layer.
Push and Shove diff pair dimensions (gap) settings dialog.
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ PNS_MODE_ROUTE_DIFF_PAIR
@ ID_POPUP_PCB_SELECT_WIDTH1
@ ID_POPUP_PCB_SELECT_DIFFPAIR16
@ ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES
@ ID_POPUP_PCB_SELECT_WIDTH16
@ ID_POPUP_PCB_SELECT_AUTO_WIDTH
@ ID_POPUP_PCB_SELECT_CUSTOM_WIDTH
@ ID_POPUP_PCB_SELECT_DIFFPAIR1
@ ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR
@ ID_POPUP_PCB_SELECT_VIASIZE1
@ ID_POPUP_PCB_SELECT_CUSTOM_DIFFPAIR
@ ID_POPUP_PCB_SELECT_VIASIZE16
Class that computes missing connections on a PCB.
std::vector< EDA_ITEM * > EDA_ITEMS
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
Container to handle a stock of specific differential pairs each with unique track width,...
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
std::optional< wxString > m_BoardHash
std::optional< TEST_CASE_TYPE > m_TestCaseType
std::vector< ITEM * > m_AddedItems
std::vector< EVENT_ENTRY > m_Events
std::set< KIID > m_RemovedItems
std::vector< ITEM * > m_Heads
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
A named microvia stack definition, chosen while routing instead of entering the values each time.
PCB_LAYER_ID m_StartLayer
HYPERLINK_DV_RENDERER::RUN RUN
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
wxPoint ToWxPoint(const VECTOR2I &aSize)
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.