31using namespace std::placeholders;
133 m_isFootprintEditor( false ),
135 m_enteredGroup( nullptr ),
136 m_priv(
std::make_unique<
PRIV>() )
172 std::shared_ptr<SELECT_MENU> selectMenu = std::make_shared<SELECT_MENU>();
173 selectMenu->SetTool(
this );
174 m_menu->RegisterSubMenu( selectMenu );
178 auto& menu =
m_menu->GetMenu();
180 auto activeToolCondition =
194 auto groupEnterCondition =
197 auto inGroupCondition =
209 menu.AddSeparator( 1000 );
217 menu.AddSeparator( haveHighlight, 1 );
223 menu.AddSeparator( 1 );
238 m_frame = getEditFrame<PCB_BASE_FRAME>();
267 wxMouseState keyboardState = wxGetMouseState();
270 keyboardState.AltDown() );
296 catch(
const std::runtime_error& e )
298 wxFAIL_MSG( e.what() );
303 evt->Modifier(
MD_ALT ) );
314 else if( evt->IsMouseDown(
BUT_LEFT ) )
352 bool selectionCancelled =
false;
356 selectPoint( evt->Position(),
false, &selectionCancelled );
363 if( !selectionCancelled )
369 else if( evt->IsDblClick(
BUT_LEFT ) )
411 const int delta = evt->Parameter<
int>();
441 if(
board()->GetFirstFootprint() )
444 evt->DragOrigin(), guide );
463 else if(
hasModifier() || dragAction == MOUSE_DRAG_ACTION::SELECT )
474 auto zoneFilledAreaFilter =
478 int accuracy = aCollector.GetGuide()->Accuracy();
479 std::set<EDA_ITEM*> remove;
485 ZONE* zone =
static_cast<ZONE*
>( item );
490 remove.insert( zone );
496 aCollector.Remove( item );
502 if( evt->HasPosition() )
505 &&
selectPoint( evt->DragOrigin(),
false,
nullptr, zoneFilledAreaFilter ) )
522 if( isTracks && trackDragAction == TRACK_DRAG_ACTION::DRAG )
524 else if( isTracks && trackDragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE )
536 else if( evt->IsCancel() )
545 else if( evt->FirstResponder() ==
this && evt->GetCommandId() == (
int) WXK_ESCAPE )
560 catch(
const std::runtime_error& e )
562 wxCHECK_MSG(
false, 0, e.what() );
577 && dragAction == MOUSE_DRAG_ACTION::DRAG_SELECTED
579 && evt->HasPosition()
602 wxT(
"EnterGroup called when selection is not a single group" ) );
653 bool aConfirmLockedItems )
666 enum DISPOSITION { BEFORE = 1, AFTER, BOTH };
668 std::map<EDA_ITEM*, DISPOSITION> itemDispositions;
677 itemDispositions[ item ] = BEFORE;
680 aClientFilter(
VECTOR2I(), collector,
this );
684 if( itemDispositions.count( item ) )
685 itemDispositions[ item ] = BOTH;
687 itemDispositions[ item ] = AFTER;
695 for( std::pair<EDA_ITEM* const, DISPOSITION> itemDisposition : itemDispositions )
697 EDA_ITEM* item = itemDisposition.first;
698 DISPOSITION disposition = itemDisposition.second;
700 if( disposition == BEFORE )
704 for( std::pair<EDA_ITEM* const, DISPOSITION> itemDisposition : itemDispositions )
706 EDA_ITEM* item = itemDisposition.first;
707 DISPOSITION disposition = itemDisposition.second;
711 if( disposition == AFTER || disposition == BOTH )
718 if( aConfirmLockedItems )
720 std::vector<BOARD_ITEM*> lockedItems;
725 bool lockedDescendant =
false;
731 lockedDescendant =
true;
734 if( boardItem->
IsLocked() || lockedDescendant )
735 lockedItems.push_back( boardItem );
802 bool* aSelectionCancelledFlag,
819 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
821 if( !
Selectable( collector[ i ] ) || ( aOnDrag && collector[i]->IsLocked() ) )
833 aClientFilter( aWhere, collector,
this );
842 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
844 if( !collector[i]->IsSelected() )
856 catch(
const std::exception& exc )
858 wxLogWarning( wxS(
"Exception \"%s\" occurred attempting to guess selection "
859 "candidates." ), exc.what() );
872 if( aSelectionCancelledFlag )
873 *aSelectionCancelledFlag =
true;
880 bool anySubtracted =
false;
887 anySubtracted =
true;
893 for(
int i = 0; i < collector.
GetCount(); ++i )
898 anySubtracted =
true;
908 if( addedCount == 1 )
913 else if( addedCount > 1 )
918 else if( anySubtracted )
955 bool cancelled =
false;
960 if( cell->IsSelected() )
969 return ( aItem->GetFlags() &
CANDIDATE ) > 0;
974 if( evt->IsCancelInteractive() || evt->IsActivate() )
983 BOX2I selectionRect( evt->DragOrigin(), evt->Position() - evt->DragOrigin() );
988 bool doSelect =
false;
990 if( cell->HitTest( selectionRect,
false ) )
995 doSelect = !wasSelected( cell );
999 else if( wasSelected( cell ) )
1004 if( doSelect && !cell->IsSelected() )
1006 else if( !doSelect && cell->IsSelected() )
1010 else if( evt->IsMouseUp(
BUT_LEFT ) )
1014 bool anyAdded =
false;
1015 bool anySubtracted =
false;
1019 if( cell->IsSelected() && !wasSelected( cell ) )
1021 else if( wasSelected( cell ) && !cell->IsSelected() )
1022 anySubtracted =
true;
1041 evt->SetPassEvent();
1061 bool cancelled =
false;
1068 bool anyAdded =
false;
1069 bool anySubtracted =
false;
1079 bool greedySelection = width >= 0 ? false :
true;
1082 greedySelection = !greedySelection;
1085 : KICURSOR::SELECT_LASSO );
1087 if( evt->IsCancelInteractive() || evt->IsActivate() )
1099 anySubtracted =
true;
1106 area.
SetEnd( evt->Position() );
1123 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> candidates;
1125 view->
Query( selectionBox, candidates );
1136 std::set<BOARD_ITEM*> group_items;
1144 std::unordered_set<BOARD_ITEM*>& newset =
group->GetItems();
1148 if( !greedySelection && selectionRect.
Contains(
group->GetBoundingBox() )
1154 collector.
Append( *newset.begin() );
1159 group_items.emplace( group_item );
1166 if( item &&
Selectable( item ) && item->
HitTest( selectionRect, !greedySelection )
1167 && ( greedySelection || !group_items.count( item ) ) )
1170 padsCollector.
Append( item );
1172 collector.
Append( item );
1184 collector = padsCollector;
1196 anySubtracted =
true;
1210 else if( anySubtracted )
1221 evt->SetPassEvent();
1244 wxMouseState keyboardState = wxGetMouseState();
1247 keyboardState.AltDown() );
1291 collection.
Append( item );
1339 std::set<int> representedNets;
1341 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
1347 else if ( representedNets.count( item->
GetNetCode() ) )
1350 representedNets.insert( item->
GetNetCode() );
1360 std::vector<BOARD_CONNECTED_ITEM*> toUnroute;
1362 for(
EDA_ITEM* item : selectedItems )
1367 toUnroute.push_back(
pad );
1383 for(
EDA_ITEM* item : selectedItems )
1398 unsigned initialCount = 0;
1410 if( initialCount == 0 )
1413 std::vector<PCB_SHAPE*> startShapes;
1418 startShapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
1422 if( !startShapes.empty() )
1428 m_frame->SetStatusText(
_(
"Select/Expand Connection..." ) );
1434 for(
EDA_ITEM* item : selectedItems )
1435 item->ClearTempFlags();
1437 std::vector<BOARD_CONNECTED_ITEM*> startItems;
1439 for(
EDA_ITEM* item : selectedItems )
1446 startItems.push_back(
pad );
1468 m_frame->SetStatusText( wxEmptyString );
1478 const std::vector<BOARD_CONNECTED_ITEM*>& aStartItems,
STOP_CONDITION aStopCondition )
1483 double refreshIntervalMs = 500;
1488 std::map<VECTOR2I, std::vector<PCB_TRACK*>> trackMap;
1489 std::map<VECTOR2I, PCB_VIA*> viaMap;
1490 std::map<VECTOR2I, PAD*> padMap;
1491 std::map<VECTOR2I, std::vector<PCB_SHAPE*>> shapeMap;
1492 std::set<PAD*> startPadSet;
1493 std::vector<BOARD_CONNECTED_ITEM*> cleanupItems;
1494 std::vector<std::pair<VECTOR2I, LSET>> activePts;
1500 startPadSet.insert(
static_cast<PAD*
>( startItem ) );
1503 if( startItem->IsType( { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T } ) )
1512 auto connectedItems = connectivity->GetConnectedItems( startItem,
1518 switch( item->Type() )
1524 trackMap[track->
GetStart()].push_back( track );
1525 trackMap[track->
GetEnd()].push_back( track );
1532 viaMap[
via->GetStart()] =
via;
1539 padMap[
pad->GetPosition()] =
pad;
1548 shapeMap[point].push_back( shape );
1559 switch( startItem->Type() )
1572 activePts.push_back( { startItem->GetPosition(), startItem->GetLayerSet() } );
1576 activePts.push_back( { startItem->GetPosition(), startItem->GetLayerSet() } );
1584 activePts.push_back( { point, startItem->GetLayerSet() } );
1597 while( expand && failSafe++ < 100000 )
1601 for(
int i = (
int) activePts.size() - 1; i >= 0; --i )
1604 LSET layerSetCu = activePts[i].second & allCuMask;
1606 auto viaIt = viaMap.find( pt );
1607 auto padIt = padMap.find( pt );
1609 bool gotVia = ( viaIt != viaMap.end() )
1610 && ( layerSetCu & ( viaIt->second->GetLayerSet() ) ).any();
1612 bool gotPad = ( padIt != padMap.end() )
1613 && ( layerSetCu & ( padIt->second->GetLayerSet() ) ).any();
1615 bool gotNonStartPad =
1616 gotPad && ( startPadSet.find( padIt->second ) == startPadSet.end() );
1620 size_t pt_count = 0;
1624 if( track->GetStart() != track->GetEnd()
1625 && layerSetCu.
Contains( track->GetLayer() ) )
1631 if( pt_count > 2 || gotVia || gotNonStartPad )
1633 activePts.erase( activePts.begin() + i );
1639 if( gotNonStartPad )
1641 activePts.erase( activePts.begin() + i );
1648 PAD*
pad = padIt->second;
1653 cleanupItems.push_back(
pad );
1655 activePts.push_back( {
pad->GetPosition(),
pad->GetLayerSet() } );
1662 if( !layerSetCu.
Contains( track->GetLayer() ) )
1665 if( !track->IsSelected() )
1671 cleanupItems.push_back( track );
1673 if( track->GetStart() == pt )
1674 activePts.push_back( { track->GetEnd(), track->GetLayerSet() } );
1676 activePts.push_back( { track->GetStart(), track->GetLayerSet() } );
1684 if( !layerSetCu.Contains( shape->GetLayer() ) )
1687 if( !shape->IsSelected() )
1693 cleanupItems.push_back( shape );
1695 for(
const VECTOR2I& newPoint : shape->GetConnectionPoints() )
1697 if( newPoint == pt )
1700 activePts.push_back( { newPoint, shape->GetLayerSet() } );
1707 if( viaMap.count( pt ) )
1711 if( !
via->IsSelected() )
1717 cleanupItems.push_back(
via );
1719 activePts.push_back( {
via->GetPosition(),
via->GetLayerSet() } );
1724 activePts.erase( activePts.begin() + i );
1728 if( refreshTimer.
msecs() >= refreshIntervalMs )
1736 refreshTimer.
Start();
1741 std::set<EDA_ITEM*> toDeselect;
1742 std::set<EDA_ITEM*> toSelect;
1745 for(
EDA_ITEM* item : m_selection )
1747 if( !item->IsBOARD_ITEM() )
1755 toDeselect.insert( item );
1758 toSelect.insert( parent );
1781 case SHAPE_T::SEGMENT:
1783 case SHAPE_T::BEZIER:
1800 std::stack<PCB_SHAPE*> toSearch;
1801 std::set<PCB_SHAPE*> toCleanup;
1803 for(
PCB_SHAPE* startItem : aStartItems )
1804 toSearch.push( startItem );
1809 auto searchPoint = [&](
const VECTOR2I& aWhere )
1816 toSearch.push(
static_cast<PCB_SHAPE*
>( item ) );
1820 while( !toSearch.empty() )
1830 toCleanup.insert( shape );
1835 searchPoint( shape->
GetEnd() );
1846 std::vector<PAD*> pads;
1853 pads.push_back(
pad );
1857 pads.push_back(
static_cast<PAD*
>( item ) );
1866 for(
const CN_EDGE& edge : conn->GetRatsnestForPad(
pad ) )
1868 wxCHECK2( edge.GetSourceNode() && !edge.GetSourceNode()->Dirty(),
continue );
1869 wxCHECK2( edge.GetTargetNode() && !edge.GetTargetNode()->Dirty(),
continue );
1874 if( sourceParent ==
pad )
1877 select(
static_cast<PAD*
>( targetParent )->GetParent() );
1879 else if( targetParent ==
pad )
1882 select(
static_cast<PAD*
>( sourceParent )->GetParent() );
1896 std::vector<PAD*> pads;
1903 pads.push_back(
pad );
1907 pads.push_back(
static_cast<PAD*
>( item ) );
1918 const std::vector<CN_EDGE> edges = conn->GetRatsnestForPad(
pad );
1921 if( edges.size() == 0 )
1924 double currentDistance = DBL_MAX;
1928 for(
const CN_EDGE& edge : edges )
1930 if( edge.GetSourceNode()->Parent()->GetParentFootprint()
1931 == edge.GetTargetNode()->Parent()->GetParentFootprint() )
1937 const CN_ANCHOR* other = edge.GetSourceNode()->
Parent() ==
pad ? edge.GetTargetNode().get()
1938 : edge.GetSourceNode().get();
1940 wxCHECK2( other && !other->
Dirty(),
continue );
1946 if( edge.GetLength() < currentDistance )
1948 currentDistance = edge.GetLength();
1953 if( nearest !=
nullptr )
1967 for(
BOARD_ITEM* item : conn->GetNetItems( aNetCode, { PCB_TRACE_T,
2024 std::vector<BOARD_ITEM*> footprints;
2029 if( footprint ==
nullptr )
2032 wxString footprint_path = footprint->GetPath().AsString().BeforeLast(
'/' );
2034 if( footprint_path.IsEmpty() )
2035 footprint_path +=
'/';
2037 if( footprint_path == aSheetPath )
2038 footprints.push_back( footprint );
2054 std::list<int> netcodeList;
2055 std::vector<BOARD_CONNECTED_ITEM*> padList;
2059 switch( item->Type() )
2065 if(
pad->IsConnected() )
2067 netcodeList.push_back(
pad->GetNetCode() );
2068 padList.push_back(
pad );
2079 if(
pad->IsConnected() )
2081 netcodeList.push_back(
pad->GetNetCode() );
2082 padList.push_back(
pad );
2094 std::sort( padList.begin(), padList.end() );
2098 netcodeList.unique();
2104 std::vector<int> removeCodeList;
2107 for(
int netCode : netcodeList )
2111 if( !std::binary_search( padList.begin(), padList.end(),
pad ) )
2115 removeCodeList.push_back( netCode );
2121 for(
int removeCode : removeCodeList )
2122 netcodeList.remove( removeCode );
2124 std::unordered_set<BOARD_ITEM*> localConnectionList;
2126 for(
int netCode : netcodeList )
2128 for(
BOARD_ITEM* item : conn->GetNetItems( netCode, { PCB_TRACE_T,
2133 localConnectionList.insert( item );
2137 for(
BOARD_ITEM* item : localConnectionList )
2144 std::vector<BOARD_ITEM*>* items = aEvent.
Parameter<std::vector<BOARD_ITEM*>*>();
2155 std::vector<BOARD_ITEM*>* items = aEvent.
Parameter<std::vector<BOARD_ITEM*>*>();
2200 wxString sheetPath = *aEvent.
Parameter<wxString*>();
2226 if( !footprint || footprint->
GetPath().empty() )
2232 wxString sheetPath = footprint->
GetPath().
AsString().BeforeLast(
'/' );
2234 if( sheetPath.IsEmpty() )
2255 screenSize.
x = std::max( 10.0, screenSize.
x );
2256 screenSize.
y = std::max( 10.0, screenSize.
y );
2262 fabs( vsize.
y / screenSize.
y ) );
2284#ifdef DEFAULT_PCBNEW_CODE
2286 auto screenSize =
view->
ToWorld( GetCanvas()->GetClientSize(),
false );
2289 screenSize.
x = std::max( 10.0, fabs( screenSize.x ) );
2290 screenSize.y = std::max( 10.0, screenSize.y );
2291 double ratio = std::max( fabs( bbSize.x / screenSize.x ), fabs( bbSize.y / screenSize.y ) );
2294 if( crossProbingSettings.zoom_to_fit && ( ratio < 0.5 || ratio > 1.0 ) )
2298#ifndef DEFAULT_PCBNEW_CODE
2316 double compRatio = bbSize.y / currTextHeight;
2319 double compRatioBent = 1.0;
2330 screenSize.
x = std::max( 10.0, fabs( screenSize.
x ) );
2331 screenSize.
y = std::max( 10.0, screenSize.
y );
2332 double ratio = std::max( -1.0, fabs( bbSize.y / screenSize.
y ) );
2335 double kicadRatio = std::max( fabs( bbSize.x / screenSize.
x ),
2336 fabs( bbSize.y / screenSize.
y ) );
2344 std::vector<std::pair<double, double>> lut {
2357 std::vector<std::pair<double, double>>::iterator it;
2359 compRatioBent = lut.back().second;
2361 if( compRatio >= lut.front().first )
2367 for( it = lut.begin(); it < lut.end() - 1; it++ )
2369 if( it->first <= compRatio &&
next( it )->first >= compRatio )
2371 double diffx = compRatio - it->first;
2372 double diffn =
next( it )->first - it->first;
2374 compRatioBent = it->second + (
next( it )->second - it->second ) * diffx / diffn;
2381 compRatioBent = lut.front().second;
2389 if( bbSize.x > screenSize.
x * ratio * compRatioBent )
2393 compRatioBent = 1.0;
2394 wxLogTrace(
"CROSS_PROBE_SCALE",
2395 "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f", ratio );
2400 ratio *= compRatioBent;
2402 bool alwaysZoom =
false;
2405 if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
2413 bool cleared =
false;
2425 switch( aItem->
Type() )
2429 int netCode =
static_cast<NETINFO_ITEM*
>( aItem )->GetNetCode();
2448 double marginFactor = 2;
2457 double scaleX = screenSize.
x /
2459 double scaleY = screenSize.
y /
2462 scaleX /= marginFactor;
2463 scaleY /= marginFactor;
2465 double scale = scaleX > scaleY ? scaleY : scaleX;
2496 switch( aItem.
Type() )
2551 if( cmd != wxID_OK )
2580 std::set<BOARD_ITEM*> rejected;
2587 rejected.insert( item );
2591 aCollector.
Remove( item );
2627 itemType = ( *
static_cast<PCB_GENERATOR*
>( aItem )->GetItems().begin() )->Type();
2660 ZONE* zone =
static_cast<ZONE*
>( aItem );
2749 bool enteredGroupFound =
false;
2752 [&](
EDA_ITEM* item,
void* testData )
2760 return INSPECT_RESULT::CONTINUE;
2770 enteredGroupFound =
true;
2778 return INSPECT_RESULT::CONTINUE;
2784 if( !enteredGroupFound )
2797 auto visibleLayers =
2827 bool onActiveLayer =
false;
2829 for(
int layer : activeLayers )
2832 if( layer < PCB_LAYER_ID_COUNT && aItem->IsOnLayer(
ToLAYER_ID( layer ) ) )
2834 onActiveLayer =
true;
2859 if( !( visibleLayers() & boardSide ).any() )
2866 && footprint->
Pads().empty()
2867 && footprint->
Zones().empty() )
2884 for(
const ZONE* zone : footprint->
Zones() )
2910 const ZONE* zone =
nullptr;
2912 const PAD*
pad =
nullptr;
2926 switch( aItem->
Type() )
2932 zone =
static_cast<const ZONE*
>( aItem );
2940 if( !( zone->
GetLayerSet() & visibleLayers() ).any() )
2950 if( !layerVisible( aItem->
GetLayer() ) )
2962 if( !( visibleLayers() &
via->GetLayerSet() ).any() )
2968 field =
static_cast<const PCB_FIELD*
>( aItem );
2981 if( !
text->IsVisible() )
2987 if( !layerVisible(
text->GetLayer() ) )
2998 if(
text->GetText() == wxT(
"${REFERENCE}" ) )
3000 else if(
text->GetText() == wxT(
"${VALUE}" ) )
3031 if( !layerVisible( aItem->
GetLayer() ) )
3049 if( !layerVisible( aItem->
GetLayer() ) )
3058 pad =
static_cast<const PAD*
>( aItem );
3060 if(
pad->GetAttribute() == PAD_ATTRIB::PTH ||
pad->GetAttribute() == PAD_ATTRIB::NPTH )
3069 if( !(
pad->GetLayerSet() & visibleLayers() ).any() )
3122 aGroup->
Add( aItem );
3148 aMode, aUsingOverlay ) );
3184 aMode, aUsingOverlay ) );
3191 const unsigned GRIP_MARGIN = 20;
3197 BOX2I itemBox = item->ViewBBox();
3202 if( item->HitTest( aPoint, margin ) )
3209 group->RunOnDescendants(
3212 if( aItem->
HitTest( aPoint, margin ) )
3227 int aMaxDistance )
const
3232 SEG loc( aWhere, aWhere );
3234 switch( aItem->
Type() )
3242 if(
text->GetEffectiveTextShape()->Collide( loc, aMaxDistance, &
distance ) )
3267 if( cell->GetEffectiveTextShape()->Collide( loc, aMaxDistance, &
distance ) )
3276 ZONE* zone =
static_cast<ZONE*
>( aItem );
3298 catch(
const std::exception& e )
3300 wxFAIL_MSG( wxString::Format( wxT(
"Clipper exception occurred: %s" ), e.what() ) );
3334 static_cast<PAD*
>( aItem )->Padstack().ForEachUniqueLayer(
3337 int layerDistance = INT_MAX;
3338 aItem->
GetEffectiveShape( aLayer )->Collide( loc, aMaxDistance, &layerDistance );
3363 wxCHECK( settings, );
3370 wxCHECK( !enabledLayerStack.empty(), );
3372 auto isCopperPourKeepoutZone = [](
const BOARD_ITEM* aItem ) ->
bool
3376 const ZONE* zone =
static_cast<const ZONE*
>( aItem );
3378 wxCHECK( zone,
false );
3388 std::vector<LAYER_OPACITY_ITEM> opacityStackup;
3390 for(
int i = 0; i < aCollector.
GetCount(); i++ )
3394 LSET itemLayers = item->
GetLayerSet() & enabledLayers & visibleLayers;
3395 LSEQ itemLayerSeq = itemLayers.
Seq( enabledLayerStack );
3408 opacityItem.
m_Item = item;
3410 if( isCopperPourKeepoutZone( item ) )
3413 opacityStackup.emplace_back( opacityItem );
3417 std::sort( opacityStackup.begin(), opacityStackup.end(),
3420 int retv = enabledLayerStack.TestLayers( aLhs.m_Layer, aRhs.m_Layer );
3425 return aLhs.m_Opacity > aRhs.m_Opacity;
3428 std::set<const BOARD_ITEM*> visibleItems;
3429 std::set<const BOARD_ITEM*> itemsToRemove;
3431 double currentStackupOpacity = 0.0;
3432 PCB_LAYER_ID lastVisibleLayer = PCB_LAYER_ID::UNDEFINED_LAYER;
3436 if( lastVisibleLayer == PCB_LAYER_ID::UNDEFINED_LAYER )
3438 currentStackupOpacity = opacityItem.m_Opacity;
3439 lastVisibleLayer = opacityItem.m_Layer;
3440 visibleItems.emplace( opacityItem.m_Item );
3445 auto ignoreItem = [&]()
3449 wxCHECK( item,
false );
3452 if( visibleItems.count( item ) )
3458 && visibleItems.count( item->
GetParent() ) )
3464 if( isCopperPourKeepoutZone( item ) )
3471 if( opacityItem.m_Layer == enabledLayerStack[0] )
3473 visibleItems.emplace( opacityItem.m_Item );
3477 double itemVisibility = opacityItem.m_Opacity * ( 1.0 - currentStackupOpacity );
3479 if( ( itemVisibility <= minAlphaLimit ) && !ignoreItem() )
3480 itemsToRemove.emplace( opacityItem.m_Item );
3482 visibleItems.emplace( opacityItem.m_Item );
3485 if( opacityItem.m_Layer != lastVisibleLayer )
3487 currentStackupOpacity += opacityItem.m_Opacity * ( 1.0 - currentStackupOpacity );
3488 currentStackupOpacity = std::min( currentStackupOpacity, 1.0 );
3489 lastVisibleLayer = opacityItem.m_Layer;
3493 for(
const BOARD_ITEM* itemToRemove : itemsToRemove )
3495 wxCHECK( aCollector.
GetCount() > 1, );
3496 aCollector.
Remove( itemToRemove );
3519 static std::vector<KICAD_T> singleLayerSilkTypes = {
PCB_FIELD_T,
3530 std::set<BOARD_ITEM*> preferred;
3531 std::set<BOARD_ITEM*> rejected;
3538 if( silkLayers[activeLayer] )
3540 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3544 if( item->
IsType( singleLayerSilkTypes ) && silkLayers[ item->
GetLayer() ] )
3545 preferred.insert( item );
3550 else if( courtyardLayers[activeLayer] && settings->
GetHighContrast() )
3552 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3557 preferred.insert( item );
3561 if( preferred.size() > 0 )
3566 aCollector.
Append( item );
3568 if( preferred.size() == 1 )
3573 constexpr int MAX_SLOP = 5;
3577 int minSlop = INT_MAX;
3579 std::map<BOARD_ITEM*, int> itemsBySloppiness;
3581 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3586 itemsBySloppiness[ item ] = itemSlop;
3588 if( itemSlop < minSlop )
3593 if( minSlop < INT_MAX )
3595 for( std::pair<BOARD_ITEM*, int> pair : itemsBySloppiness )
3597 if( pair.second > minSlop + singlePixel )
3604 constexpr double sizeRatio = 1.5;
3606 std::vector<std::pair<BOARD_ITEM*, double>> itemsByArea;
3608 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3617 area = (double)
SEG::Square( singlePixel ) * MAX_SLOP;
3636 catch(
const std::exception& e )
3638 wxFAIL_MSG( wxString::Format( wxT(
"Clipper exception occurred: %s" ), e.what() ) );
3642 itemsByArea.emplace_back( item, area );
3645 std::sort( itemsByArea.begin(), itemsByArea.end(),
3646 [](
const std::pair<BOARD_ITEM*, double>& lhs,
3647 const std::pair<BOARD_ITEM*, double>& rhs ) ->
bool
3649 return lhs.second < rhs.second;
3652 bool rejecting =
false;
3654 for(
int i = 1; i < (int) itemsByArea.size(); ++i )
3656 if( itemsByArea[i].second > itemsByArea[i-1].second * sizeRatio )
3660 rejected.insert( itemsByArea[i].first );
3665 constexpr double maxCoverRatio = 0.70;
3667 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3671 if( footprint->CoverageRatio( aCollector ) > maxCoverRatio )
3672 rejected.erase( footprint );
3677 if( (
unsigned) aCollector.
GetCount() > rejected.size() )
3689 bool haveItemOnActive =
false;
3692 for(
int i = 0; i < aCollector.
GetCount(); ++i )
3694 if( !aCollector[i]->IsOnLayer( activeLayer ) )
3695 rejected.insert( aCollector[i] );
3697 haveItemOnActive =
true;
3700 if( haveItemOnActive )
3710 bool aMultiselect )
const
3712 std::unordered_set<BOARD_ITEM*> toAdd;
3716 for(
int j = 0; j < aCollector.
GetCount(); j++ )
3718 if( aCollector[j]->GetParent() )
3719 aCollector[j]->GetParent()->ClearFlags(
CANDIDATE );
3724 for(
int j = 0; j < aCollector.
GetCount(); j++ )
3728 for(
int j = 0; j < aCollector.
GetCount(); )
3740 aCollector.
Remove( item );
3751 toAdd.insert( top );
3754 aCollector.
Remove( item );
3763 aCollector.
Remove( item );
3772 if( !aCollector.
HasItem( item ) )
3773 aCollector.
Append( item );
3780 std::set<BOARD_ITEM*> to_add;
3783 for(
int i = (
int) aCollector.
GetCount() - 1; i >= 0; --i )
3792 aCollector.
Remove( item );
3797 aCollector.
Append( item );
3802 bool aForcePromotion )
const
3804 std::set<BOARD_ITEM*> to_add;
3807 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
3812 && ( !
frame()->GetPcbNewSettings()->m_AllowFreePads || aForcePromotion ) )
3817 aCollector.
Remove( item );
3822 aCollector.
Append( item );
3829 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
3834 aCollector.
Remove( item );
3846 bool need_direct_hit =
false;
3854 need_direct_hit =
true;
3861 fp =
static_cast<BOARD_ITEM*
>( item )->GetParentFootprint();
3869 single_fp =
nullptr;
3872 else if( !single_fp )
3878 else if( single_fp != fp )
3880 single_fp =
nullptr;
3886 auto visibleLayers =
3904 LSET layers = visibleLayers();
3912 for(
int layer : activeLayers )
3915 layers.
set( layer );
3920 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
3923 FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( item );
3936 aCollector.
Remove( item );
3938 bool has_hit =
false;
3952 aCollector.
Remove( item );
3957 else if( single_fp )
3959 if( fp == single_fp )
3962 else if( need_direct_hit )
3976 aCollector.
Remove( item );
3993 std::set<std::pair<PCB_TABLE*, int>> columns;
4001 columns.insert( std::make_pair( table, cell->GetColumn() ) );
4005 for(
auto& [ table, col ] : columns )
4007 for(
int row = 0; row < table->GetRowCount(); ++row )
4013 select( table->GetCell( row, col ) );
4028 std::set<std::pair<PCB_TABLE*, int>> rows;
4036 rows.insert( std::make_pair( table, cell->GetRow() ) );
4040 for(
auto& [ table, row ] : rows )
4042 for(
int col = 0; col < table->GetColCount(); ++col )
4048 select( table->GetCell( row, col ) );
4063 std::set<PCB_TABLE*> tables;
4069 tables.insert(
static_cast<PCB_TABLE*
>( cell->GetParent() ) );
4076 if( !table->IsSelected() )
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION unselectAll
static TOOL_ACTION cursorLeft
static TOOL_ACTION zoomOutCenter
static TOOL_ACTION zoomIn
static TOOL_ACTION cursorLeftFast
static TOOL_ACTION selectColumns
static TOOL_ACTION cursorDown
static TOOL_ACTION zoomOut
static TOOL_ACTION cursorRightFast
static TOOL_ACTION zoomCenter
static TOOL_ACTION panDown
static TOOL_ACTION cursorDownFast
static TOOL_ACTION selectRows
static TOOL_ACTION cursorUpFast
static TOOL_ACTION panLeft
static TOOL_ACTION updateMenu
static TOOL_ACTION doDelete
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION increment
static TOOL_ACTION zoomFitObjects
static TOOL_ACTION zoomInCenter
static TOOL_ACTION panRight
static TOOL_ACTION selectTable
static TOOL_ACTION cursorUp
Cursor control with keyboard.
static TOOL_ACTION cursorRight
static TOOL_ACTION selectAll
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
CROSS_PROBING_SETTINGS m_CrossProbing
BASE_SET & reset(size_t pos)
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
static bool ClassOf(const EDA_ITEM *aItem)
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
PCB_GROUP * GetParentGroup() const
virtual VECTOR2I GetCenter() const
This defaults to the center of the bounding box if not overridden.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
virtual bool IsOnCopperLayer() const
virtual void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction, int aDepth=0) const
Invoke a function on all descendants.
Information pertinent to a Pcbnew printed circuit board.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
ZONE * m_SolderMaskBridges
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
bool LegacyTeardrops() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
constexpr void SetMaximum()
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr const SizeVec & GetSize() const
CN_ANCHOR represents a physical location that can be connected: a pad or a track/arc/via endpoint.
BOARD_CONNECTED_ITEM * Parent() const
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
virtual double OnePixelInIU() const =0
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
void Empty()
Clear the list.
int GetCount() const
Return the number of objects in the list.
bool HasItem(const EDA_ITEM *aItem) const
Tests if aItem has already been collected.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
void Append(EDA_ITEM *item)
Add an item to the end of the list.
bool IsType(FRAME_T aType) const
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
void ForceRefresh()
Force a redraw.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
EDA_ITEM_FLAGS GetFlags() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, const BOX2I &aBBox=BOX2I(), const EDA_ANGLE &aAngle=ANGLE_0) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
static const TOOL_EVENT DisambiguatePoint
Used for hotkey feedback.
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT InhibitSelectionEditing
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT UninhibitSelectionEditing
Used to inform tool that it should display the disambiguation menu.
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
static const TOOL_EVENT UnselectedEvent
A general implementation of a COLLECTORS_GUIDE.
void SetIgnoreBlindBuriedVias(bool ignore)
void SetIgnoreTracks(bool ignore)
void SetIgnoreFootprintsOnFront(bool ignore)
void SetIgnoreFPTextOnFront(bool ignore)
void SetIgnoreMicroVias(bool ignore)
void SetIgnoreZoneFills(bool ignore)
void SetIgnorePadsOnBack(bool ignore)
void SetIgnoreFPTextOnBack(bool ignore)
void SetIgnoreThroughVias(bool ignore)
void SetIgnoreThroughHolePads(bool ignore)
void SetLayerVisibleBits(LSET aLayerBits)
void SetIgnoreFPReferences(bool ignore)
void SetIgnoreFPValues(bool ignore)
void SetIgnorePadsOnFront(bool ignore)
void SetIgnoreFootprintsOnBack(bool ignore)
Used when the right click button is pressed, or when the select tool is in effect.
void SetGuide(const COLLECTORS_GUIDE *aGuide)
Record which COLLECTORS_GUIDE to use.
const COLLECTORS_GUIDE * GetGuide() const
static const std::vector< KICAD_T > AllBoardItems
A scan list for all editable board items.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
A color representation with 4 components: red, green, blue, alpha.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
VECTOR2I GetOrigin() const
void SetSubtractive(bool aSubtractive)
void SetAdditive(bool aAdditive)
void SetOrigin(const VECTOR2I &aOrigin)
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
void SetExclusiveOr(bool aExclusiveOr)
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
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.
const std::set< int > GetHighContrastLayers() const
Returns the set of currently high-contrast layers.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const =0
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
bool GetHighContrast() const
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void Clear()
Remove all the stored items from the group.
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
An abstract base class for deriving all objects that can be added to a VIEW.
bool IsBOARD_ITEM() const
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
void Hide(VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
Temporarily hide the item in the view (e.g.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
wxString AsString() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
LSEQ SeqStackupTop2Bottom(PCB_LAYER_ID aSelectedLayer=UNDEFINED_LAYER) const
Generate a sequence of layers that represent a top to bottom stack of this set of layers.
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
const VECTOR2I & GetPos() const
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
Handle the data for a net.
bool m_CtrlClickHighlight
TRACK_DRAG_ACTION m_TrackDragAction
LOCKING_OPTIONS m_LockingOptions
bool m_ESCClearsNetHighlight
static TOOL_ACTION drag45Degree
static TOOL_ACTION unrouteSelected
Removes all tracks from the selected items to the first pad.
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION groupLeave
static TOOL_ACTION grabUnconnected
Select and move nearest unconnected footprint from ratsnest of selection.
static TOOL_ACTION filterSelection
Filter the items in the current selection (invokes dialog)
static TOOL_ACTION highlightNet
static TOOL_ACTION unselectItem
static TOOL_ACTION hideLocalRatsnest
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION selectOnSheetFromEeschema
Select all components on sheet from Eeschema crossprobing.
static TOOL_ACTION selectConnection
Select tracks between junctions or expands an existing selection to pads or the entire connection.
static TOOL_ACTION dragFreeAngle
static TOOL_ACTION clearHighlight
static TOOL_ACTION unselectItems
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
static TOOL_ACTION moveIndividually
move items one-by-one
static TOOL_ACTION syncSelection
Sets selection to specified items, zooms to fit, if enabled.
static TOOL_ACTION groupEnter
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION syncSelectionWithNets
Sets selection to specified items with connected nets, zooms to fit, if enabled.
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
static TOOL_ACTION reselectItem
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void FocusOnItem(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
double m_TrackOpacity
Opacity override for all tracks.
double m_FilledShapeOpacity
Opacity override for graphic shapes.
double m_ZoneOpacity
Opacity override for filled zone areas.
double m_ImageOpacity
Opacity override for user images.
double m_PadOpacity
Opacity override for SMD pads and PTHs.
double m_ViaOpacity
Opacity override for all types of via.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
A set of BOARD_ITEMs (i.e., without duplicates).
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
static bool WithinScope(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
static PCB_GROUP * TopLevelGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
std::unordered_set< BOARD_ITEM * > & GetItems()
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const override
Invoke a function on all descendants.
Tool that displays edit points allowing to modify items by dragging the points.
bool HasPoint()
Indicate the cursor is over an edit point.
BOX2I GetBoundingBox() const override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
std::vector< VECTOR2I > GetConnectionPoints() const
std::vector< PCB_TABLECELL * > GetCells() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
int GetDrill() const
Return the local drill setting for this PCB_VIA.
A small class to help profiling.
void Start()
Start or restart the counter.
double msecs(bool aSinceLast=false)
static SEG::ecoord Square(int a)
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual void Add(EDA_ITEM *aItem)
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
const std::deque< EDA_ITEM * > GetItems() const
void SetIsHover(bool aIsHover)
virtual void Remove(EDA_ITEM *aItem)
virtual unsigned int GetSize() const override
Return the number of stored items.
virtual void Clear() override
Remove all the stored items from the group.
int Size() const
Returns the number of selected parts.
void ClearReferencePoint()
bool OnlyContains(std::vector< KICAD_T > aList) const
Checks if all items in the selection have a type in aList.
bool Empty() const
Checks if there is anything selected.
bool Contains(EDA_ITEM *aItem) const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if point aP lies closer to us than aClearance.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
Handle a list of polygons defining a copper zone.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
bool HitTestForCorner(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a corner.
bool HitTestForEdge(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a segment defined by 2 corners.
bool IsTeardropArea() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool GetDoNotAllowCopperPour() const
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
static bool empty(const wxTextEntryBase *aCtrl)
std::function< INSPECT_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Used to inspect and possibly collect the (search) results of iterating over a list or tree of KICAD_T...
#define BRIGHTENED
item is drawn with a bright contour
#define IS_NEW
New item, just created.
#define SELECTED
Item was manually selected by the user.
#define ENTERED
indicates a group has been entered
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected
#define IS_MOVING
Item being moved.
int m_DisambiguationMenuDelay
The number of milliseconds to wait in a click before showing a disambiguation menu.
double m_PcbSelectionVisibilityRatio
Board object selection visibility limit.
@ LAYER_FOOTPRINTS_FR
show footprints on front
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
@ LAYER_FP_REFERENCES
show footprints references (when texts are visible)
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored)
@ LAYER_FOOTPRINTS_BK
show footprints on back
@ LAYER_FP_VALUES
show footprints values (when texts are visible)
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
@ REPAINT
Item needs to be redrawn.
@ TARGET_OVERLAY
Items that may change while the view stays the same (noncached)
Class to handle a set of BOARD_ITEMs.
Class that computes missing connections on a PCB.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
bool center_on_items
Automatically pan to cross-probed items.
Struct that will be set with the result of the user choices in the dialog.
bool includeItemsOnTechLayers
bool includeLockedModules
bool includeBoardOutlineLayer
constexpr int mmToIU(double mm) const
const BOARD_ITEM * m_Item
bool m_sessionSkipPrompts
bool otherItems
Anything not fitting one of the above categories.
bool vias
Vias (all types>
bool keepouts
Keepout zones.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool text
Text (free or attached to a footprint)
bool lockedItems
Allow selecting locked items.
bool tracks
Copper tracks.
bool dimensions
Dimension items.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ NOT_USED
the 3d code uses this value
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ 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_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
VECTOR2D ToVECTOR2D(const wxPoint &aPoint)