23#include <wx/filedlg.h>
25#include <wx/hyperlink.h>
34using namespace std::placeholders;
107using namespace KIGFX;
111 const std::vector<PENDING_STACK_EXPANSION>& aPending )
113 if( aPreRoute.count( aVia->
m_Uuid ) )
119 if( !exp.m_Pos || *exp.m_Pos != aVia->
GetPosition() )
128 return &exp.m_Preset;
141 if( aCurrent == aStart )
145 if( aCurrent == aEnd )
157class UI_UPDATE_INTERVAL_GUARD
160 UI_UPDATE_INTERVAL_GUARD(
long aNewInterval ) :
161 m_saved( wxUpdateUIEvent::GetUpdateInterval() )
163 wxUpdateUIEvent::SetUpdateInterval( aNewInterval );
166 ~UI_UPDATE_INTERVAL_GUARD()
168 wxUpdateUIEvent::SetUpdateInterval( m_saved );
203 .Name(
"pcbnew.InteractiveRouter.PlaceVia" )
205 .DefaultHotkey(
'V' )
206 .LegacyHotkeyName(
"Add Through Via" )
207 .FriendlyName(
_(
"Place Through Via" ) )
208 .Tooltip(
_(
"Adds a through-hole via at the end of currently routed track." ) )
214 .Name(
"pcbnew.InteractiveRouter.PlaceBlindVia" )
217 .LegacyHotkeyName(
"Add Blind/Buried Via" )
218 .FriendlyName(
_(
"Place Blind/Buried Via" ) )
219 .Tooltip(
_(
"Adds a blind or buried via at the end of currently routed track.") )
225 .Name(
"pcbnew.InteractiveRouter.PlaceMicroVia" )
227 .DefaultHotkey(
MD_CTRL +
'V' )
228 .LegacyHotkeyName(
"Add MicroVia" )
229 .FriendlyName(
_(
"Place Microvia" ) )
230 .Tooltip(
_(
"Adds a microvia at the end of currently routed track." ) )
237 .Name(
"pcbnew.InteractiveRouter.PlaceViaStack" )
240 .FriendlyName(
_(
"Place Microvia Stack at Track End" ) )
241 .Tooltip(
_(
"Drops the active microvia stack preset at the end of the currently routed track "
242 "and continues on the target layer." ) )
247 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceVia" )
249 .DefaultHotkey(
'<' )
250 .LegacyHotkeyName(
"Select Layer and Add Through Via" )
251 .FriendlyName(
_(
"Select Layer and Place Through Via..." ) )
252 .Tooltip(
_(
"Select a layer, then add a through-hole via at the end of currently routed track." ) )
258 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia" )
260 .DefaultHotkey(
MD_ALT +
'<' )
261 .LegacyHotkeyName(
"Select Layer and Add Blind/Buried Via" )
262 .FriendlyName(
_(
"Select Layer and Place Blind/Buried Via..." ) )
263 .Tooltip(
_(
"Select a layer, then add a blind or buried via at the end of currently routed track." ) )
269 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia" )
271 .FriendlyName(
_(
"Select Layer and Place Micro Via..." ) )
272 .Tooltip(
_(
"Select a layer, then add a micro via at the end of currently routed track." ) )
278 .Name(
"pcbnew.InteractiveRouter.CustomTrackViaSize" )
280 .DefaultHotkey(
'Q' )
281 .LegacyHotkeyName(
"Custom Track/Via Size" )
282 .FriendlyName(
_(
"Custom Track/Via Size..." ) )
283 .Tooltip(
_(
"Shows a dialog for changing the track width and via size." ) )
287 .Name(
"pcbnew.InteractiveRouter.SpreadTracksSetDistance" )
289 .DefaultHotkey(
'E' )
290 .LegacyHotkeyName(
"Set Spreading Distance" )
291 .FriendlyName(
_(
"Set Spreading Distance..." ) )
292 .Tooltip(
_(
"Sets the distance between the tracks for the Spread Tracks tool." ) )
296 .Name(
"pcbnew.InteractiveRouter.IncreaseSpreadingDistance" )
298 .DefaultHotkey(
']' )
299 .LegacyHotkeyName(
"Increase Spreading Distance" )
300 .FriendlyName(
_(
"Increase Spreading Distance..." ) )
301 .Tooltip(
_(
"Increases the distance between the tracks for the Spread Tracks tool by one grid unit." ) )
305 .Name(
"pcbnew.InteractiveRouter.DecreaseSpreadingDistance" )
307 .DefaultHotkey(
'[' )
308 .LegacyHotkeyName(
"Decrease Spreading Distance" )
309 .FriendlyName(
_(
"Decrease Spreading Distance..." ) )
310 .Tooltip(
_(
"Decreases the distance between the tracks for the Spread Tracks tool by one grid unit." ) )
315 .Name(
"pcbnew.InteractiveRouter.SwitchPosture" )
317 .DefaultHotkey(
'/' )
318 .LegacyHotkeyName(
"Switch Track Posture" )
319 .FriendlyName(
_(
"Switch Track Posture" ) )
320 .Tooltip(
_(
"Switches posture of the currently routed track." ) )
325 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingToNext" )
327 .DefaultHotkey(
MD_CTRL +
'/' )
328 .FriendlyName(
_(
"Track Corner Mode Switch" ) )
329 .Tooltip(
_(
"Switches between sharp/rounded and 45°/90° corners when routing tracks." ) )
334 .Name(
"pcbnew.InteractiveRouter.SwitchRounding45" )
336 .DefaultHotkey(
MD_CTRL +
'W' )
337 .FriendlyName(
_(
"Track Corner Mode 45" ) )
338 .Tooltip(
_(
"Switch to 45° corner when routing tracks." ) ) );
341 .Name(
"pcbnew.InteractiveRouter.SwitchRounding90" )
344 .FriendlyName(
_(
"Track Corner Mode 90" ) )
345 .Tooltip(
_(
"Switch to 90° corner when routing tracks." ) ) );
348 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc45" )
351 .FriendlyName(
_(
"Track Corner Mode Arc 45" ) )
352 .Tooltip(
_(
"Switch to arc 45° corner when routing tracks." ) ) );
355 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc90" )
357 .DefaultHotkey(
MD_ALT +
'W' )
358 .FriendlyName(
_(
"Track Corner Mode Arc 90" ) )
359 .Tooltip(
_(
"Switch to arc 90° corner when routing tracks." ) ) );
362#define _(s) wxGetTranslation((s))
384 SetTitle(
_(
"Select Track/Via Width" ) );
402 _(
"Route using the width of the starting track." ), wxITEM_CHECK );
407 _(
"Use track and via sizes from the net class" ), wxITEM_CHECK );
412 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
423 msg =
_(
"Track netclass width" );
425 msg.Printf(
_(
"Track %s" ),
m_frame.MessageTextFromValue( width ) );
428 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
439 msg =
_(
"Via netclass values" );
442 if(
via.m_Drill > 0 )
444 msg.Printf(
_(
"Via %s, hole %s" ),
445 m_frame.MessageTextFromValue(
via.m_Diameter ),
446 m_frame.MessageTextFromValue(
via.m_Drill ) );
450 msg.Printf(
_(
"Via %s" ),
451 m_frame.MessageTextFromValue(
via.m_Diameter ) );
456 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
464 int id = aEvent.GetId();
516 SetTitle(
_(
"Select Differential Pair Dimensions" ) );
532 _(
"Use differential pair dimensions from the net class" ), wxITEM_CHECK );
537 _(
"Specify custom differential pair dimensions" ), wxITEM_CHECK );
550 if( diffPair.
m_Gap <= 0 )
554 msg.Printf(
_(
"Width %s" ),
559 msg.Printf(
_(
"Width %s, via gap %s" ),
568 msg.Printf(
_(
"Width %s, gap %s" ),
574 msg.Printf(
_(
"Width %s, gap %s, via gap %s" ),
582 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
590 int id = aEvent.GetId();
634 auto& menu =
m_menu->GetMenu();
635 menu.SetUntranslatedTitle(
_HKI(
"Interactive Router" ) );
655 auto notRoutingCond =
658 return !
m_router->RoutingInProgress();
661 auto spreadingTracksCond =
667 auto inRouteSelected =
676 std::vector<PNS::NET_HANDLE> currentNets =
m_router->GetCurrentNets();
678 if( currentNets.empty() || currentNets[0] ==
nullptr )
685 RN_NET* ratsnest =
board->GetConnectivity()->GetRatsnestForNet( currentNet );
687 return ratsnest && !ratsnest->
GetEdges().empty();
692 menu.AddSeparator( 1 );
695 menu.AddSeparator( haveHighlight, 2 );
723 submenuCornerMode->
SetTitle(
_(
"Track Corner Mode" ) );
733 menu.AddMenu( submenuCornerMode );
736 auto cornerMode45Cond =
742 auto cornerMode90Cond =
748 auto cornerModeArc45Cond =
754 auto cornerModeArc90Cond =
760#define CHECK( x ) ACTION_CONDITIONS().Check( x )
804 static size_t lastLoggerSize = 0;
805 static wxString mruPath;
810 if( !logger || logger->GetEvents().size() == 0
811 || logger->GetEvents().size() == lastLoggerSize )
816 if( !testCaseDir.IsEmpty() )
823 wxFileName
path = wxFileName::DirName( testCaseDir );
827 if(
path.DirExists() )
829 doExit = !
IsOK(
frame(), wxString::Format(
_(
"Test case in directory %s already exists. Overwrite?"),
path.GetFullPath() ) );
833 path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
836 path.SetName( wxT(
"pns") );
837 logPath =
path.GetFullPath();
846 lastLoggerSize = logger->GetEvents().size();
852 if ( mruPath.IsEmpty() )
857 wxFileDialog dlg(
frame(),
_(
"Save router log" ), mruPath,
"pns.log",
859 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
863 if( dlg.ShowModal() != wxID_OK )
865 lastLoggerSize = logger->GetEvents().size();
869 logPath = dlg.GetPath();
873 wxFileName fname_log( logPath );
874 mruPath = fname_log.GetPath();
875 fname_log.SetExt(
"log" );
876 wxLogTrace( wxT(
"PNS" ), wxT(
"save log to: %s" ), fname_log.GetFullPath() );
878 wxFileName fname_dump( fname_log );
879 fname_dump.SetExt(
"dump" );
881 wxFileName fname_settings( fname_log );
882 fname_settings.SetExt(
"settings" );
884 FILE* settings_f = wxFopen( fname_settings.GetAbsolutePath(),
"wb" );
888 DisplayError(
frame(), wxString::Format(
_(
"Unable to write '%s'." ), fname_settings.GetAbsolutePath() ) );
892 std::string settingsStr =
m_router->Settings().FormatAsString();
893 fprintf( settings_f,
"%s\n", settingsStr.c_str() );
894 fclose( settings_f );
901 pcb_io.
SaveBoard( fname_dump.GetAbsolutePath(), *
m_iface->GetBoard(),
nullptr );
910 wxString srcRules = editFrame->GetBoard()->GetDesignRulesPath();
912 if( !srcRules.IsEmpty() && wxFileName::FileExists( srcRules ) )
914 wxFileName fname_rules( fname_dump );
916 wxCopyFile( srcRules, fname_rules.GetAbsolutePath() );
921 std::vector<PNS::ITEM*> removed;
925 for(
auto item : removed )
930 wxASSERT_MSG( item->Parent() !=
nullptr,
"removed an item with no parent uuid?" );
942 logData.
m_Events = logger->GetEvents();
944 FILE* log_f = wxFopen( fname_log.GetAbsolutePath(),
"wb" );
950 fname_log.GetAbsolutePath() ) );
954 fprintf( log_f,
"%s\n", logString.c_str().AsChar() );
990 bool asChanged =
false;
1045 int startLayer =
m_iface->GetPNSLayerFromBoardLayer( tl );
1051 return m_iface->GetBoardLayerFromPNSLayer( ls.
Start() );
1060 int activeLayer =
m_iface->GetPNSLayerFromBoardLayer(
frame()->GetActiveLayer() );
1061 int currentLayer =
m_router->GetCurrentLayer();
1063 if( currentLayer != activeLayer )
1064 m_router->SwitchLayer( activeLayer );
1066 std::optional<int> newLayer =
m_router->Sizes().PairedLayer( currentLayer );
1069 newLayer =
m_router->Sizes().GetLayerTop();
1071 m_router->SwitchLayer( *newLayer );
1082 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
1086 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
1092 dummyTrack.
SetLayer( targetLayer );
1114 if( !constraint.
IsNull() )
1142 dummyTrackB.
SetLayer( targetLayer );
1149 if( !constraint.
IsNull() )
1167 if( !constraint.
IsNull() )
1201 wxASSERT_MSG(
false, wxT(
"Unhandled via type" ) );
1248 if( presets.empty() )
1250 frame()->GetInfoBar()->ShowMessageFor(
_(
"No microvia stack presets defined. Add one in Board Setup, "
1251 "Microvia Stacks." ),
1252 3000, wxICON_INFORMATION );
1256 int idx = std::clamp( bds.
GetViaStackIndex(), 0, (
int) presets.size() - 1 );
1268 frame()->GetInfoBar()->ShowMessageFor(
_(
"The microvia stack preset layers are not present on this board." ),
1269 3000, wxICON_ERROR );
1277 frame()->GetInfoBar()->ShowMessageFor( wxString::Format(
_(
"The microvia stack runs between %s and %s. "
1278 "Route on one of those layers to place it." ),
1281 3000, wxICON_ERROR );
1296 if( traces.
Size() > 0 )
1300 if( line->PointCount() > 0 )
1301 head = line->CLine().CLastPoint();
1307 frame()->GetInfoBar()->ShowMessageFor(
_(
"Could not end the track here for a microvia stack." ), 3000,
1325 if( !
m_router->GetCurrentNets().empty() )
1328 net = ni->GetNetCode();
1377 m_iface->GetPNSLayerFromBoardLayer( targetLayer ) );
1384 if(
m_router->RoutingInProgress() )
1402 if( traces.
Size() == 0 )
1409 if( line->EndsWithVia() )
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 + 1 ) % layers.size();
1467 for(
size_t i = 0; i < layers.size() - 1; i++ )
1471 targetLayer = layers[target_idx];
1476 if( target_idx >= layers.size() )
1491 size_t target_idx = 0;
1493 for(
size_t i = 0; i < layers.size(); i++ )
1495 if( layers[i] == currentLayer )
1502 target_idx = ( idx > 0 ) ? ( idx - 1 ) : ( layers.size() - 1 );
1504 for(
size_t i = 0; i < layers.size() - 1; i++ )
1508 targetLayer = layers[target_idx];
1512 if( target_idx > 0 )
1515 target_idx = layers.size() - 1;
1537 if( !enabledLayers.test( targetLayer ) )
1543 if( targetLayer == currentLayer )
1563 bool selectLayer =
false;
1568 const int actViaFlags = aEvent.
Parameter<
int>();
1583 endPoint =
frame()->GetCanvas()->ClientToScreen( endPoint );
1589 not_allowed_ly.
set( currentLayer );
1591 targetLayer =
frame()->SelectOneLayer(
static_cast<PCB_LAYER_ID>( currentLayer ),
1592 not_allowed_ly, endPoint );
1603 if( currentLayer == targetLayer )
1614 && ( ( targetLayer ==
B_Cu && currentLayer ==
F_Cu )
1615 || ( targetLayer ==
F_Cu && currentLayer ==
B_Cu ) ) )
1630 if( !
m_router->GetNearestRatnestAnchor( otherEnd, otherEndLayers, otherEndItem ) )
1633 currentLayer = pairTop;
1634 targetLayer = pairBottom;
1641 const std::optional<int> pairedLayerPns =
m_router->Sizes().PairedLayer(
m_router->GetCurrentLayer() );
1649 const bool otherEndIsThrough =
1650 otherEndLayers == allCopperLayers
1651 || ( otherEndItem && otherEndItem->
HasHole()
1652 && otherEndItem->
Hole()->
Layers() == allCopperLayers );
1654 if( otherEndIsThrough )
1658 if( currentLayer == pairBottom )
1659 targetLayer = pairTop;
1660 else if( currentLayer == pairTop )
1661 targetLayer = pairBottom;
1663 targetLayer = pairTop;
1665 else if( currentLayer == otherEndLayerPcbId && pairedLayerPns.has_value() )
1669 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( *pairedLayerPns );
1673 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( otherEndLayers.
Start() );
1679 if( currentLayer == pairTop || currentLayer == pairBottom )
1683 currentLayer = pairTop;
1684 targetLayer = pairBottom;
1690 targetLayer = pairTop;
1694 if( currentLayer == targetLayer )
1697 infobar->
ShowMessageFor(
_(
"Via needs 2 different layers." ), 5000, wxICON_ERROR,
1698 WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION );
1713 if( !
m_router->GetCurrentNets().empty() )
1720 if( !constraint.
IsNull() )
1725 if( !constraint.
IsNull() )
1736 m_iface->GetPNSLayerFromBoardLayer( targetLayer ) );
1743 if(
m_router->RoutingInProgress() )
1769 int pnsLayer =
m_iface->GetPNSLayerFromBoardLayer( pcbLayer );
1780 if( !
getView()->IsLayerVisible( pcbLayer ) )
1788 m_iface->SetStartLayerFromPCBNew( pcbLayer );
1790 frame()->GetBoard()->GetDesignSettings().m_TempOverrideTrackWidth =
false;
1793 m_iface->GetPNSLayerFromBoardLayer(
frame()->GetScreen()->m_Route_Layer_BOTTOM ) );
1823 m_router->ClearViewDecorations();
1834 frame()->UndoRedoBlock(
true );
1870 frame()->UndoRedoBlock(
false );
1890 auto syncRouterAndFrameLayer =
1893 int pnsLayer =
m_router->GetCurrentLayer();
1899 if( !
getView()->IsLayerVisible( pcbLayer ) )
1911 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
1917 m_toolMgr->GetView()->SyncLayerVisibilityCache();
1922 if( !
m_router->RoutingInProgress() )
1924 if( evt->IsCancelInteractive() )
1941 if( std::optional<VECTOR2I> last =
m_router->UndoLastSegment() )
1944 evt->SetMousePosition( last.value() );
1955 bool* autoRouted = evt->Parameter<
bool*>();
1962 if( autoRouted !=
nullptr )
1971 if( autoRouted !=
nullptr )
1973 *autoRouted =
false;
1983 bool needsAppend =
m_router->Placer()->HasPlacedAnything();
1987 syncRouterAndFrameLayer();
1999 frame()->ShowInfoBarError(
m_router->FailureReason(),
true );
2008 bool needLayerSwitch =
m_router->IsPlacingVia();
2009 bool forceCommit =
false;
2019 if( needLayerSwitch )
2029 syncRouterAndFrameLayer();
2070 bool forceFinish =
true;
2071 bool forceCommit =
false;
2077 || evt->IsActivate()
2083 if( evt->IsActivate() && !evt->IsMoveTool() )
2090 else if( evt->IsUndoRedo() )
2108 evt->SetPassEvent();
2129 if( settingsDlg.
ShowModal() == wxID_OK )
2161 settings.SetMode( mode );
2189 return m_router->Settings().Mode();
2195 return m_router->RoutingInProgress();
2229 if(
m_router->RoutingInProgress() )
2253 controls->ForceCursorPosition(
false );
2258 std::vector<BOARD_CONNECTED_ITEM*> itemList;
2265 itemList.push_back(
pad );
2273 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
frame->GetBoard()->GetConnectivity();
2276 bool groupStart =
true;
2284 RN_NET* net = connectivity->GetRatsnestForNet( item->GetNetCode() );
2289 std::vector<std::shared_ptr<const CN_ANCHOR>> anchors;
2293 std::shared_ptr<const CN_ANCHOR> target = edge.GetTargetNode();
2294 std::shared_ptr<const CN_ANCHOR>
source = edge.GetSourceNode();
2296 if( !
source ||
source->Dirty() || !target || target->Dirty() )
2299 if(
source->Parent() == item )
2300 anchors.push_back(
source );
2301 else if( target->Parent() == item )
2302 anchors.push_back( target );
2306 for( std::shared_ptr<const CN_ANCHOR>
anchor : anchors )
2315 if(
frame->GetActiveLayer() != originalLayer )
2316 frame->SetActiveLayer( originalLayer );
2323 bool autoRouted =
false;
2368 std::vector<BOARD_CONNECTED_ITEM*> trackItems;
2376 if( trackItems.empty() )
2386 int dpSkipped = std::erase_if( trackItems,
2394 frame->ShowInfoBarMsg(
_(
"Differential pair members cannot be optimized." ) );
2396 bool groupStart =
true;
2414 branch->
Remove( originalLine );
2416 PNS::LINE optimizedLine( originalLine );
2425 if(
m_router->Settings().GetRestrictAngles() )
2447 branch->
Add( optimizedLine );
2459 int value =
m_router->Settings().GetSpreadTracksDistance();
2460 wxIntegerValidator<int>
validator( &value );
2465 if( modalResult == wxID_OK )
2467 int newSpreadDist = wxAtoi( dlg.
GetValue() );
2468 m_router->Settings().SetSpreadTracksDistance( newSpreadDist );
2480 int dist =
m_router->Settings().GetSpreadTracksDistance();
2482 int remainder = dist %
grid.x;
2485 dist += (
grid.x - remainder ) +
grid.x;
2487 dist -= remainder +
grid.x;
2492 m_router->Settings().SetSpreadTracksDistance( dist );
2514 controls->ForceCursorPosition(
false );
2522 bool pickingStartPoint =
true;
2528 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2539 trackItems.
Add( ritem );
2543 if( trackItems.
Empty() )
2545 frame->ShowInfoBarError(
_(
"Please select a group of tracks you want to spread." ) );
2548 frame->ShowInfoBarMsg(
_(
"Pick a track you want to spread other tracks around." ) );
2553 if( evt->IsCancelInteractive() )
2558 else if( evt->IsActivate() )
2560 if( evt->IsMoveTool() || evt->IsEditorTool() )
2563 frame->PushTool( originalEvent );
2576 else if( evt->IsMotion() )
2578 if( pickingStartPoint )
2588 else if( evt->IsClick(
BUT_LEFT ) )
2590 if( !pickingStartPoint )
2592 m_router->FixRoute( evt->Position(),
nullptr,
true,
true );
2597 pickingStartPoint =
false;
2599 frame->GetInfoBar()->Dismiss();
2625 evt->SetPassEvent();
2641 frame->GetInfoBar()->Dismiss();
2652 if(
m_router->RoutingInProgress() )
2657 controls->ForceCursorPosition(
false );
2675 if(
m_router->RoutingInProgress() )
2698 controls->ForceCursorPosition(
false );
2713 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2715 if( !evt->IsDrag() )
2718 if( evt->IsCancelInteractive() )
2722 else if( evt->IsActivate() )
2724 if( evt->IsMoveTool() || evt->IsEditorTool() )
2727 frame->PushTool( originalEvent );
2758 evt->SetPassEvent(
false );
2767 if( evt->HasPosition() )
2780 else if( evt->IsKeyPressed() )
2785 evt->SetPassEvent();
2793 evt->SetPassEvent();
2819 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
2820 wxOK | wxCANCEL | wxICON_WARNING );
2821 dlg.SetOKLabel(
_(
"Drag Anyway" ) );
2832 if( !
m_router->FailureReason().IsEmpty() )
2833 frame()->ShowInfoBarError(
m_router->FailureReason(),
true );
2843 frame()->UndoRedoBlock(
true );
2845 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
2851 m_toolMgr->GetView()->SyncLayerVisibilityCache();
2864 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
2871 hint.Printf(
_(
"(%s to commit anyway.)" ),
2875 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
2885 bool forceFinish =
false;
2886 bool forceCommit = evt->Modifier(
MD_CTRL );
2896 || evt->IsActivate() )
2901 if( evt->IsActivate() && !evt->IsMoveTool() )
2906 else if( evt->IsUndoRedo() )
2934 evt->SetPassEvent();
2939 evt->SetPassEvent();
2948 if(
m_router->RoutingInProgress() )
2954 frame()->UndoRedoBlock(
false );
2981 if( vias + traces == 0 )
2995 for(
int i = 0; !reference && i < aCollector.
GetCount(); i++ )
2996 reference =
dynamic_cast<PCB_TRACK*
>( aCollector[i] );
3010 refPoint = reference->
GetEnd();
3014 for(
int i = 0; i < aCollector.
GetCount(); i++ )
3018 if( neighbor && neighbor != reference )
3023 if( neighbor->
GetStart() != refPoint && neighbor->
GetEnd() != refPoint )
3030 aCollector.
Append( reference );
3046 bool allFootprints =
true;
3047 bool allTracks =
true;
3051 switch( item->Type() )
3060 allFootprints =
false;
3096 default:
return false;
3104 std::copy( aOriginalSelection.
Items().begin(), aOriginalSelection.
Items().end(), std::back_inserter( selItems ) );
3120 std::deque<EDA_ITEM*> selectedItems =
selection.GetItems();
3130 std::set<FOOTPRINT*> footprints;
3131 std::set<PAD*> freePads;
3132 bool blockDrag =
false;
3135 footprints.insert(
static_cast<FOOTPRINT*
>( item ) );
3139 for(
int idx = 0; idx <
selection.Size(); ++idx )
3141 if( !
selection.GetItem( idx )->IsBOARD_ITEM() )
3147 footprints.insert(
static_cast<FOOTPRINT*
>( selItem ) );
3157 frame()->ShowInfoBarMsg(
_(
"The selection contains items that cannot be dragged." ) );
3174 bool wasLocked =
false;
3191 bool showCourtyardConflicts =
frame()->GetPcbNewSettings()->m_ShowCourtyardCollisions;
3193 std::shared_ptr<DRC_ENGINE> drcEngine =
m_toolMgr->GetTool<
DRC_TOOL>()->GetDRCEngine();
3197 std::vector<BOARD_ITEM*> dynamicItems;
3198 std::unique_ptr<CONNECTIVITY_DATA> dynamicData =
nullptr;
3200 std::vector<PNS::ITEM*> leaderSegments;
3201 bool singleFootprintDrag =
false;
3209 for(
auto it = footprints.begin(); it != footprints.end(); )
3211 bool hasSolid =
false;
3213 for(
PAD*
pad : ( *it )->Pads() )
3214 hasSolid |= !
m_router->GetWorld()->FindItemsByParent(
pad ).empty();
3216 it = hasSolid ? std::next( it ) : footprints.erase( it );
3220 m_toolMgr->GetView()->SyncLayerVisibilityCache();
3222 if( !footprints.empty() )
3225 if( footprints.size() == 1 && !blockDrag )
3226 singleFootprintDrag =
true;
3228 if( showCourtyardConflicts )
3237 itemsToDrag.
Add( solid );
3241 if( connectivityData->GetRatsnestForPad(
pad ).size() > 0 )
3242 dynamicItems.push_back(
pad );
3249 itemsToDrag.
Add( solid );
3255 || shape->GetLayer() ==
Margin
3259 itemsToDrag.
Add( solid );
3263 if( showCourtyardConflicts )
3267 dynamicData = std::make_unique<CONNECTIVITY_DATA>(
board()->GetConnectivity(), dynamicItems,
true );
3268 connectivityData->BlockRatsnestItems( dynamicItems );
3271 if( footprints.empty() || blockDrag )
3273 for(
EDA_ITEM* selItem : selectedItems )
3275 if( !selItem->IsBOARD_ITEM() )
3288 itemsToDrag.
Add( pnsItem );
3292 PAD*
pad =
static_cast<PAD*
>( boardItem );
3295 if( footprints.count(
pad->GetParentFootprint() ) )
3298 freePads.insert(
pad );
3302 itemsToDrag.
Add( solid );
3314 if( itemsToDrag.
Count() >= 1 )
3320 int layer =
m_iface->GetPNSLayerFromBoardLayer( activeLayer );
3322 SEG::ecoord closestDistSq = std::numeric_limits<SEG::ecoord>::max();
3326 const SHAPE* shape = pitem->Shape( layer );
3333 if( distSq < closestDistSq )
3335 closestDistSq = distSq;
3336 closestItem = pitem;
3346 if( closestItem->
Net() )
3351 if( !footprints.empty() && singleFootprintDrag )
3362 tweakedMousePos =
footprint->GetPosition();
3377 int dragMode = aEvent.
Parameter<
int> ();
3379 if( !footprints.empty() || !freePads.empty() || blockDrag )
3380 dragMode &=
~PNS::DM_FREE_ANGLE;
3385 m_iface->SetIndependentPads( freePads );
3387 bool dragStarted =
m_router->StartDragging( p, itemsToDrag, dragMode );
3391 m_iface->SetIndependentPads( {} );
3394 frame()->ShowInfoBarMsg(
_(
"Nothing in the selection can be dragged." ) );
3399 if( !footprints.empty() )
3400 connectivityData->ClearLocalRatsnest();
3414 frame()->UndoRedoBlock(
true );
3418 size_t held = blockDragger->AnchoredLines().size();
3422 frame()->ShowInfoBarWarning(
3423 wxString::Format( wxPLURAL(
"%zu selected arc cannot move because both ends are fixed.",
3424 "%zu selected arcs cannot move because both ends are fixed.", held ),
3448 UI_UPDATE_INTERVAL_GUARD uiGuard( 200 );
3450 bool hasMouseMoved =
false;
3451 bool hasMultidragCancelled =
false;
3457 m_toolMgr->GetView()->SyncLayerVisibilityCache();
3461 if( evt->IsCancelInteractive()
3463 || evt->IsActivate() )
3468 hasMultidragCancelled =
true;
3472 else if( evt->IsMotion()
3476 hasMouseMoved =
true;
3482 if( !footprints.empty() )
3491 previewItem =
static_cast<BOARD_ITEM*
>( drawing->Clone() );
3492 previewItem->
Move( offset );
3501 &&
pad->GetDrillSize().x == 0 )
3504 previewItem->
Move( offset );
3517 previewItem->
Move( offset );
3522 previewItem->
Move( offset );
3526 if( showCourtyardConflicts )
3530 if( showCourtyardConflicts )
3532 courtyardClearanceDRC.
Run();
3540 dynamicData->Move( offset - lastOffset );
3541 lastOffset = offset;
3542 connectivityData->ComputeLocalRatsnest( dynamicItems, dynamicData.get(), offset );
3545 for(
PAD*
pad : freePads )
3552 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
3560 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
3568 else if( hasMouseMoved && ( evt->IsMouseUp(
BUT_LEFT )
3572 bool forceFinish =
false;
3573 bool forceCommit = evt->Modifier(
MD_CTRL );
3577 leaderSegments =
m_router->GetLastCommittedLeaderSegments();
3581 else if( evt->IsUndoRedo() )
3609 evt->SetPassEvent();
3614 evt->SetPassEvent();
3620 if( !footprints.empty() )
3637 connectivityData->ClearLocalRatsnest();
3640 for(
PAD*
pad : freePads )
3643 m_iface->SetIndependentPads( {} );
3648 if(
m_router->RoutingInProgress() )
3652 if( itemsToDrag.
Size() && hasMultidragCancelled )
3656 else if( leaderSegments.size() )
3658 std::vector<EDA_ITEM*> newItems;
3661 newItems.push_back( lseg->Parent() );
3669 frame()->UndoRedoBlock(
false );
3693 m_toolMgr->GetView()->SyncLayerVisibilityCache();
3721 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
3722 wxOK | wxCANCEL | wxICON_WARNING );
3723 dlg.SetOKLabel(
_(
"Break Track" ) );
3732 frame()->UndoRedoBlock(
true );
3735 if(
m_router->RoutingInProgress() )
3738 frame()->UndoRedoBlock(
false );
3766 if( !
m_router->GetCurrentNets().empty() )
3785 std::vector<MSG_PANEL_ITEM> items;
3792 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
3793 wxString description;
3799 wxASSERT( nets.size() >= 2 );
3806 description = wxString::Format(
_(
"Routing Diff Pair: %s" ),
3813 if( *netclassA == *netclassB )
3819 secondary = wxString::Format(
_(
"Resolved Netclass: %s" ),
3822 else if( !nets.empty() && nets[0] )
3826 description = wxString::Format(
_(
"Routing Track: %s" ),
3829 secondary = wxString::Format(
3830 _(
"Resolved Netclass: %s" ),
3835 description =
_(
"Routing Track" );
3836 secondary =
_(
"(no net)" );
3839 items.emplace_back( description, secondary );
3841 wxString cornerMode;
3843 if(
m_router->Settings().GetFreeAngleMode() )
3845 cornerMode =
_(
"Free-angle" );
3849 switch(
m_router->Settings().GetCornerMode() )
3859 items.emplace_back(
_(
"Corner Style" ), cornerMode );
3861 switch(
m_router->Settings().Mode() )
3869 items.emplace_back(
_(
"Mode" ), mode );
3871#define FORMAT_VALUE( x ) frame()->MessageTextFromValue( x )
3875 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
3877 wxString::Format(
_(
"(from %s)" ),
3880 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
3882 wxString::Format(
_(
"(from %s)" ),
3885 items.emplace_back( wxString::Format(
_(
"Diff Pair Gap: %s" ),
3887 wxString::Format(
_(
"(from %s)" ),
3891 wxASSERT( traces.
Count() == 2 );
3894 traces[1],
m_router->GetCurrentLayer(), &constraint ) )
3896 items.emplace_back( wxString::Format(
_(
"DP Max Uncoupled-length: %s" ),
3898 wxString::Format(
_(
"(from %s)" ),
3904 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
3906 wxString::Format(
_(
"(from %s)" ),
3909 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
3911 wxString::Format(
_(
"(from %s)" ),
3917 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 routerSpreadTracks
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()
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
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.
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
wxString GetValue() const
void SetTextValidator(const wxValidator &validator)
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
JSON_SCHEMA_VALIDATOR validator(schema)
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.