66using namespace std::placeholders;
68#include <wx/hyperlink.h>
73#include <dialogs/dialog_tablecell_properties.h>
74#include <dialogs/dialog_table_properties.h>
94 ZONE* zone =
static_cast<ZONE*
>( aItem );
107 if( aSelection.
GetSize() != 1 )
163 else if( item->IsType( EDIT_TOOL::MirrorableItems ) )
193 auto menu = std::make_shared<CONDITIONAL_MENU>( aTool );
196 menu->SetUntranslatedTitle(
_HKI(
"Mirror / Rotate" ) );
198 auto canMirror = [](
const SELECTION& aSelection )
217 auto menu = std::make_shared<CONDITIONAL_MENU>( aTool );
220 menu->SetUntranslatedTitle(
_HKI(
"Routing" ) );
222 auto notMovingCondition = [](
const SELECTION& aSelection )
224 return aSelection.Empty() || !aSelection.Front()->IsMoving();
242 auto menu = std::make_shared<CONDITIONAL_MENU>( aTool );
245 menu->SetUntranslatedTitle(
_HKI(
"Position" ) );
247 auto notMovingCondition = [](
const SELECTION& aSelection )
249 return aSelection.Empty() || !aSelection.Front()->IsMoving();
263 auto menu = std::make_shared<CONDITIONAL_MENU>( aTool );
265 menu->SetUntranslatedTitle(
_HKI(
"Shape Modification" ) );
280 auto hasCornerCondition = [aTool](
const SELECTION& aSelection )
287 auto hasMidpointCondition = [aTool](
const SELECTION& aSelection )
294 auto canAddCornerCondition = [](
const SELECTION& aSelection )
296 const EDA_ITEM* item = aSelection.Front();
301 auto canChamferCornerCondition = [](
const SELECTION& aSelection )
303 const EDA_ITEM* item = aSelection.Front();
308 auto canRemoveCornerCondition = [aTool](
const SELECTION& aSelection )
374 for(
const EDA_ITEM* it : aSelection )
387 if( units.size() < 2 )
390 const wxString& padNum =
pad->GetNumber();
391 bool inAnyUnit =
false;
393 for(
const auto& u : units )
395 for(
const auto& pnum : u.m_pins )
413 else if( single != fp )
424 std::unordered_set<wxString> padNums;
426 for(
const EDA_ITEM* it : aSelection )
433 if(
pad->GetParentFootprint() != aFootprint )
436 padNums.insert(
pad->GetNumber() );
445 const std::unordered_set<wxString>& aSelPadNums )
447 std::vector<int> indices;
451 for(
size_t i = 0; i < units.size(); ++i )
455 for(
const auto& pn : units[i].m_pins )
457 if( aSelPadNums.count( pn ) )
465 indices.push_back(
static_cast<int>( i ) );
475 if( aUnitIndices.empty() )
479 const size_t cnt = units[
static_cast<size_t>( aUnitIndices.front() )].m_pins.size();
481 for(
int idx : aUnitIndices )
483 if( units[
static_cast<size_t>( idx )].m_pins.size() != cnt )
494 std::vector<int> targets;
497 const size_t pinCount = units[
static_cast<size_t>( aSourceIdx )].m_pins.size();
499 for(
size_t i = 0; i < units.size(); ++i )
501 if(
static_cast<int>( i ) == aSourceIdx )
504 if( units[i].m_pins.size() != pinCount )
507 targets.push_back(
static_cast<int>( i ) );
537 if( unitsHit.size() != 1 )
540 const int sourceIdx = unitsHit.front();
543 for(
int idx : targets )
546 label.Printf(
_(
"Swap with %s" ), fp->
GetUnitInfo()[
static_cast<size_t>( idx )].m_unitName );
554 int id = aEvent.GetId();
569 if( targetIdx < 0 || targetIdx >=
static_cast<int>( units.size() ) )
585 auto menu = std::make_shared<GATE_SWAP_MENU>();
586 menu->SetTool( aTool );
600 m_selectionTool->GetToolMenu().RegisterSubMenu( positioningToolsSubMenu );
606 m_selectionTool->GetToolMenu().RegisterSubMenu( shapeModificationSubMenu );
611 auto fpAttributesMenu = std::make_shared<CONDITIONAL_MENU>(
this );
612 fpAttributesMenu->SetUntranslatedTitle(
_HKI(
"Attributes" ) );
617 auto positioningToolsCondition = [
this](
const SELECTION& aSel )
620 subMenu->Evaluate( aSel );
621 return subMenu->GetMenuItemCount() > 0;
624 auto shapeModificationCondition = [
this](
const SELECTION& aSel )
627 subMenu->Evaluate( aSel );
628 return subMenu->GetMenuItemCount() > 0;
632 auto gateSwapSingleUnitOnOneFootprint = [](
const SELECTION& aSelection )
643 if( unitsHit.size() != 1 )
646 const int sourceIdx = unitsHit.front();
648 return !targets.empty();
652 auto gateSwapMultipleUnitsOnOneFootprint = [](
const SELECTION& aSelection )
663 if( unitsHit.size() < 2 )
669 auto propertiesCondition = [
this](
const SELECTION& aSel )
671 if( aSel.GetSize() == 0 )
685 if( aSel.GetSize() == 1 )
697 auto inFootprintEditor = [
this](
const SELECTION& aSelection )
702 auto canMirror = [
this](
const SELECTION& aSelection )
717 auto singleFootprintCondition =
720 auto multipleFootprintsCondition = [](
const SELECTION& aSelection )
722 bool foundFirst =
false;
738 auto excludeFromBOMCond = [
this](
const SELECTION& aSel )
740 wxString variantName;
741 int checked = 0, unchecked = 0;
744 variantName =
board->GetCurrentVariant();
750 if(
static_cast<const FOOTPRINT*
>( item )->GetExcludedFromBOMForVariant( variantName ) )
757 return checked > 0 && unchecked == 0;
760 auto excludeFromPosFilesCond = [
this](
const SELECTION& aSel )
762 wxString variantName;
763 int checked = 0, unchecked = 0;
766 variantName =
board->GetCurrentVariant();
772 if(
static_cast<const FOOTPRINT*
>( item )->GetExcludedFromPosFilesForVariant( variantName ) )
779 return checked > 0 && unchecked == 0;
782 auto noActiveToolCondition = [
this](
const SELECTION& aSelection )
784 return frame()->ToolStackIsEmpty();
787 auto notMovingCondition = [](
const SELECTION& aSelection )
789 return aSelection.Empty() || !aSelection.Front()->IsMoving();
792 auto noItemsCondition = [
this](
const SELECTION& aSelections ) ->
bool
794 return frame()->GetBoard() && !
frame()->GetBoard()->IsEmpty();
797 auto isSkippable = [
this](
const SELECTION& aSelection )
803 && notMovingCondition && !inFootprintEditor;
841 menu.AddMenu( gateSwapSubMenu.get(), gateSwapSingleUnitOnOneFootprint );
856 && !inFootprintEditor );
866 menu.AddMenu( fpAttributesMenu.get(), singleFootprintCondition || multipleFootprintsCondition );
869 menu.AddSeparator( 100 );
870 menu.AddMenu( routingSubMenu.get(), isRoutable, 100 );
871 menu.AddMenu( mirrorRotateSubMenu.get(), canMirror, 100 );
872 menu.AddMenu( shapeModificationSubMenu.get(), shapeModificationCondition, 100 );
873 menu.AddMenu( positioningToolsSubMenu.get(), positioningToolsCondition, 100 );
875 menu.AddSeparator( 150 );
888 menu.AddSeparator( 2000 );
907 wxString footprintName;
908 wxArrayString fplist;
913 fplist.Add( fp->GetReference() + wxT(
" ( " ) + fp->GetValue() + wxT(
" )" ) );
923 footprintName.Trim(
true );
924 footprintName.Trim(
false );
926 if( !footprintName.IsEmpty() )
930 if( fp->GetReference().CmpNoCase( footprintName ) == 0 )
1030 std::vector<PCB_TRACK*> tracks;
1031 std::vector<PCB_TRACK*> vias;
1032 std::vector<FOOTPRINT*> footprints;
1035 const auto gatherItemsByType = [&]()
1042 vias.push_back( track );
1044 tracks.push_back( track );
1054 gatherItemsByType();
1059 for(
int ii = aCollector.
GetCount() - 1; ii >= 0; --ii )
1065 else if( tracks.size() || vias.size() )
1079 gatherItemsByType();
1092 if( tracks.size() == 2 && vias.size() == 0 )
1094 if( connected( tracks[0], tracks[1]->GetStart() )
1095 || connected( tracks[0], tracks[1]->GetEnd() ) )
1097 aCollector.
Remove( tracks[1] );
1100 else if( tracks.size() == 2 && vias.size() == 1 )
1102 if( connected( tracks[0], vias[0]->GetPosition() )
1103 && connected( tracks[1], vias[0]->GetPosition() ) )
1105 aCollector.
Remove( tracks[0] );
1106 aCollector.
Remove( tracks[1] );
1132 wxString variantName;
1135 variantName =
board->GetCurrentVariant();
1137 bool new_state =
false;
1160 if( !variantName.IsEmpty() )
1184 if( !commit.
Empty() )
1185 commit.
Push(
_(
"Toggle Attribute" ) );
1200 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1205 aCollector.
Remove( item );
1235 new_width =
board()->GetDesignSettings().GetCurrentViaSize();
1236 new_drill =
board()->GetDesignSettings().GetCurrentViaDrill();
1239 via->SetDrill( new_drill );
1247 wxCHECK( track, 0 );
1251 int new_width =
board()->GetDesignSettings().GetCurrentTrackWidth();
1256 commit.
Push(
_(
"Edit Track Width/Via Size" ) );
1281 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1286 aCollector.
Remove( item );
1303 if( newLayer == origLayer )
1314 wxCHECK( track, 0 );
1322 commit.
Push(
_(
"Edit Track Layer" ) );
1339 static int filletRadius = 0;
1345 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1350 aCollector.
Remove( item );
1360 frame()->ShowInfoBarMsg(
_(
"At least two straight track segments must be selected." ) );
1376 bool t1Start =
true;
1377 bool t2Start =
true;
1380 std::vector<FILLET_OP> filletOperations;
1381 bool operationPerformedOnAtLeastOne =
false;
1382 bool didOneAttemptFail =
false;
1383 std::set<PCB_TRACK*> processedTracks;
1385 auto processFilletOp = [&](
PCB_TRACK* aTrack,
bool aStartPoint )
1387 std::shared_ptr<CONNECTIVITY_DATA> c =
board()->GetConnectivity();
1389 std::vector<BOARD_CONNECTED_ITEM*> itemsOnAnchor;
1393 if( itemsOnAnchor.size() > 0 &&
selection.Contains( itemsOnAnchor.at( 0 ) )
1399 if( processedTracks.find( trackOther ) == processedTracks.end() )
1401 if( itemsOnAnchor.size() == 1 )
1404 filletOp.t1 = aTrack;
1405 filletOp.t2 = trackOther;
1406 filletOp.t1Start = aStartPoint;
1407 filletOp.t2Start = aTrack->
IsPointOnEnds( filletOp.t2->GetStart() );
1408 filletOperations.push_back( filletOp );
1414 didOneAttemptFail =
true;
1428 processFilletOp( track,
true );
1429 processFilletOp( track,
false );
1431 processedTracks.insert( track );
1437 std::vector<BOARD_ITEM*> itemsToAddToSelection;
1439 for( FILLET_OP filletOp : filletOperations )
1447 if( trackOnStart && trackOnEnd )
1450 if( ( trackOnStart || trackOnEnd ) && track1->
GetLayer() == track2->
GetLayer() )
1458 SHAPE_ARC sArc( t1Seg, t2Seg, filletRadius );
1461 auto setIfPointOnSeg = [](
VECTOR2I& aPointToSet,
const SEG& aSegment,
const VECTOR2I& aVecToTest )
1463 VECTOR2I segToVec = aSegment.NearestPoint( aVecToTest ) - aVecToTest;
1468 aPointToSet.
x = aVecToTest.x;
1469 aPointToSet.
y = aVecToTest.y;
1477 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP0() )
1478 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP0() ) )
1480 didOneAttemptFail =
true;
1484 if( !setIfPointOnSeg( t1newPoint, t1Seg, sArc.
GetP1() )
1485 && !setIfPointOnSeg( t2newPoint, t2Seg, sArc.
GetP1() ) )
1487 didOneAttemptFail =
true;
1499 itemsToAddToSelection.push_back( tArc );
1504 if( filletOp.t1Start )
1507 track1->
SetEnd( t1newPoint );
1509 if( filletOp.t2Start )
1512 track2->
SetEnd( t2newPoint );
1514 operationPerformedOnAtLeastOne =
true;
1518 commit.
Push(
_(
"Fillet Tracks" ) );
1521 for(
BOARD_ITEM* item : itemsToAddToSelection )
1524 if( !operationPerformedOnAtLeastOne )
1525 frame()->ShowInfoBarMsg(
_(
"Unable to fillet the selected track segments." ) );
1526 else if( didOneAttemptFail )
1527 frame()->ShowInfoBarMsg(
_(
"Some of the track segments could not be filleted." ) );
1547 return std::nullopt;
1551 return aPersitentRadius;
1563 std::vector<WX_MULTI_ENTRY_DIALOG::ENTRY> entries{
1570 _(
"Add slots in acute corners" ),
1572 _(
"Add slots in acute corners to allow access to a cutter of the given radius" ),
1579 return std::nullopt;
1581 std::vector<WX_MULTI_ENTRY_DIALOG::RESULT> results = dlg.
GetValues();
1582 wxCHECK( results.size() == 2, std::nullopt );
1586 s_dogBoneParams.DogboneRadiusIU = std::get<long long int>( results[0] );
1587 s_dogBoneParams.AddSlots = std::get<bool>( results[1] );
1589 catch(
const std::bad_variant_access& )
1592 return std::nullopt;
1595 return s_dogBoneParams;
1609 const int default_setback =
pcbIUScale.mmToIU( 1 );
1611 static CHAMFER_PARAMS params{ default_setback, default_setback };
1613 WX_UNIT_ENTRY_DIALOG dlg( &aFrame,
_(
"Chamfer Lines" ),
_(
"Chamfer setback:" ), params.m_chamfer_setback_a );
1616 return std::nullopt;
1618 params.m_chamfer_setback_a = dlg.
GetValue();
1621 params.m_chamfer_setback_b = params.m_chamfer_setback_a;
1632 std::vector<VECTOR2I> pts;
1635 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1642 { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_POLY_T, PCB_SHAPE_LOCATE_RECT_T } ) )
1644 aCollector.
Remove( item );
1653 std::set<PCB_SHAPE*> lines_to_add;
1654 std::vector<PCB_SHAPE*> items_to_remove;
1658 std::vector<VECTOR2I> pts;
1665 items_to_remove.push_back( graphic );
1668 pts.emplace_back( start );
1670 pts.emplace_back(
end );
1676 items_to_remove.push_back( graphic );
1678 for(
int jj = 0; jj < graphic->
GetPolyShape().VertexCount(); ++jj )
1682 for(
size_t jj = 1; jj < pts.size(); ++jj )
1690 lines_to_add.insert( line );
1693 if( pts.size() > 1 )
1698 line->
SetEnd( pts.front() );
1701 lines_to_add.insert( line );
1709 frame()->ShowInfoBarMsg(
_(
"Exactly two lines must be selected to extend them." ) );
1716 else if( segmentCount < 2 )
1718 frame()->ShowInfoBarMsg(
_(
"A shape with at least two lines must be selected." ) );
1736 for(
PCB_SHAPE* item : items_to_remove )
1747 std::vector<BOARD_ITEM*> items_to_select_on_success;
1750 std::vector<BOARD_ITEM*> items_to_deselect_on_success;
1755 auto item_modification_handler = [&](
BOARD_ITEM& aItem )
1761 items_to_select_on_success.push_back( &aItem );
1765 bool any_items_created = !lines_to_add.empty();
1766 auto item_creation_handler = [&]( std::unique_ptr<BOARD_ITEM> aItem )
1768 any_items_created =
true;
1769 items_to_select_on_success.push_back( aItem.get() );
1770 commit.
Add( aItem.release() );
1773 bool any_items_removed = !items_to_remove.empty();
1774 auto item_removal_handler = [&](
BOARD_ITEM& aItem )
1777 any_items_removed =
true;
1778 items_to_deselect_on_success.push_back( &aItem );
1784 item_removal_handler );
1787 std::unique_ptr<PAIRWISE_LINE_ROUTINE> pairwise_line_routine;
1791 static int s_filletRadius =
pcbIUScale.mmToIU( 1 );
1792 std::optional<int> filletRadiusIU =
GetRadiusParams( *
frame(),
_(
"Fillet Lines" ), s_filletRadius );
1794 if( filletRadiusIU.has_value() )
1796 pairwise_line_routine =
1797 std::make_unique<LINE_FILLET_ROUTINE>(
frame()->GetModel(), change_handler, *filletRadiusIU );
1804 if( dogboneParams.has_value() )
1806 pairwise_line_routine =
1807 std::make_unique<DOGBONE_CORNER_ROUTINE>(
frame()->GetModel(), change_handler, *dogboneParams );
1814 if( chamfer_params.has_value() )
1816 pairwise_line_routine =
1817 std::make_unique<LINE_CHAMFER_ROUTINE>(
frame()->GetModel(), change_handler, *chamfer_params );
1822 pairwise_line_routine = std::make_unique<LINE_EXTENSION_ROUTINE>(
frame()->GetModel(), change_handler );
1825 if( !pairwise_line_routine )
1836 if( ( a->GetFlags() & STRUCT_DELETED ) == 0 && ( b->GetFlags() & STRUCT_DELETED ) == 0 )
1838 PCB_SHAPE* line_a = static_cast<PCB_SHAPE*>( a );
1839 PCB_SHAPE* line_b = static_cast<PCB_SHAPE*>( b );
1841 pairwise_line_routine->ProcessLinePair( *line_a, *line_b );
1846 for(
BOARD_ITEM* item : items_to_select_on_success )
1847 m_selectionTool->AddItemToSel( item,
true );
1850 for(
BOARD_ITEM* item : items_to_deselect_on_success )
1851 m_selectionTool->RemoveItemFromSel( item,
true );
1853 if( any_items_removed )
1856 if( any_items_created )
1862 commit.Push( pairwise_line_routine->GetCommitDescription() );
1864 if(
const std::optional<wxString> msg = pairwise_line_routine->GetStatusMessage( segmentCount ) )
1865 frame()->ShowInfoBarMsg( *msg );
1876 std::vector<VECTOR2I> pts;
1879 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1883 if( !item->
IsType( { PCB_SHAPE_LOCATE_POLY_T, PCB_ZONE_T } ) )
1884 aCollector.
Remove( item );
1888 if( zone->IsTeardropArea() )
1889 aCollector.
Remove( item );
1899 static int s_toleranceValue =
pcbIUScale.mmToIU( 3 );
1908 if( s_toleranceValue <= 0 )
1913 std::vector<PCB_SHAPE*> shapeList;
1917 commit.Modify( item );
1931 zone->HatchBorder();
1935 commit.
Push(
_(
"Simplify Polygons" ) );
1949 std::vector<VECTOR2I> pts;
1952 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
1959 { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_ARC_T, PCB_SHAPE_LOCATE_BEZIER_T } ) )
1961 aCollector.
Remove( item );
1971 static int s_toleranceValue =
pcbIUScale.mmToIU( 3 );
1980 if( s_toleranceValue <= 0 )
1985 std::vector<PCB_SHAPE*> shapeList;
1991 shapeList.push_back( shape );
1992 commit.Modify( shape );
1998 commit.Push(
_(
"Heal Shapes" ) );
2013 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2017 static const std::vector<KICAD_T> polygonBooleanTypes = {
2023 if( !item->
IsType( polygonBooleanTypes ) )
2024 aCollector.
Remove( item );
2035 std::vector<PCB_SHAPE*> items_to_process;
2039 items_to_process.push_back(
static_cast<PCB_SHAPE*
>( item ) );
2044 if( item == last_item )
2045 std::swap( items_to_process.back(), items_to_process.front() );
2051 auto item_modification_handler = [&](
BOARD_ITEM& aItem )
2053 commit.Modify( &aItem );
2056 std::vector<BOARD_ITEM*> items_to_select_on_success;
2058 auto item_creation_handler = [&]( std::unique_ptr<BOARD_ITEM> aItem )
2060 items_to_select_on_success.push_back( aItem.get() );
2061 commit.Add( aItem.release() );
2064 auto item_removal_handler = [&](
BOARD_ITEM& aItem )
2066 commit.Remove( &aItem );
2071 item_removal_handler );
2074 std::unique_ptr<POLYGON_BOOLEAN_ROUTINE> boolean_routine;
2076 const auto create_routine = [&]() -> std::unique_ptr<POLYGON_BOOLEAN_ROUTINE>
2083 wxCHECK(
model,
nullptr );
2087 return std::make_unique<POLYGON_MERGE_ROUTINE>(
model, change_handler );
2091 return std::make_unique<POLYGON_SUBTRACT_ROUTINE>(
model, change_handler );
2095 return std::make_unique<POLYGON_INTERSECT_ROUTINE>(
model, change_handler );
2100 const auto run_routine = [&]()
2103 for(
PCB_SHAPE* shape : items_to_process )
2104 boolean_routine->ProcessShape( *shape );
2106 boolean_routine->Finalize();
2109 boolean_routine = create_routine();
2111 wxCHECK_MSG( boolean_routine, 0,
"Could not find a polygon routine for this action" );
2118 if( !boolean_routine->IsCommutative() && items_to_select_on_success.empty() )
2122 items_to_select_on_success.clear();
2124 std::map<const PCB_SHAPE*, VECTOR2I::extended_type> items_area;
2126 for(
PCB_SHAPE* shape : items_to_process )
2129 items_area[shape] = area;
2138 std::sort( items_to_process.begin(), items_to_process.end(),
2141 return items_area[a] > items_area[b];
2145 boolean_routine = create_routine();
2150 for(
BOARD_ITEM* item : items_to_select_on_success )
2156 commit.Push( boolean_routine->GetCommitDescription() );
2158 if(
const std::optional<wxString> msg = boolean_routine->GetStatusMessage() )
2159 frame()->ShowInfoBarMsg( *msg );
2181 std::vector<PCB_TABLECELL*> cells;
2232 for(
EDA_ITEM* eda_item : selCopy )
2234 if( !eda_item->IsBOARD_ITEM() )
2276 if( editFrame && item )
2296 commit = &localCommit;
2319 std::optional<VECTOR2I> oldRefPt;
2324 oldRefPt =
selection.GetReferencePoint();
2350 bool usePcbShapeCenter =
false;
2357 usePcbShapeCenter =
true;
2361 usePcbShapeCenter =
true;
2367 else if( usePcbShapeCenter )
2379 if(
frame()->GetCanvas()->GetView()->GetGAL()->IsFlippedX() )
2380 rotateAngle = -rotateAngle;
2386 viewBBox.
Merge( item->ViewBBox() );
2395 typedef std::numeric_limits<int> coord_limits;
2400 bool outOfBounds = rotPos.
x < min || rotPos.
x > max || rotPos.
y < min || rotPos.
y > max || rotEnd.
x < min
2401 || rotEnd.
x > max || rotEnd.
y < min || rotEnd.
y > max;
2409 if( item->IsBOARD_ITEM() )
2413 board_item->
Rotate( refPt, rotateAngle );
2417 static_cast<FOOTPRINT*
>( board_item )->InvalidateComponentClassCache();
2424 localCommit.
Push(
_(
"Rotate" ) );
2441 selection.SetReferencePoint( *oldRefPt );
2459 MIRROR( tmpPt, aMirrorPoint, aFlipDirection );
2492 commit = &localCommit;
2514 int skippedFootprints = 0;
2515 int skippedGroups = 0;
2522 skippedFootprints++;
2537 switch( item->Type() )
2540 static_cast<PCB_SHAPE*
>( item )->
Mirror( mirrorPoint, flipDirection );
2544 static_cast<ZONE*
>( item )->
Mirror( mirrorPoint, flipDirection );
2549 static_cast<PCB_TEXT*
>( item )->
Mirror( mirrorPoint, flipDirection );
2559 mirrorPad( *
static_cast<PAD*
>( item ), mirrorPoint, flipDirection );
2565 static_cast<PCB_TRACK*
>( item )->
Mirror( mirrorPoint, flipDirection );
2569 static_cast<PCB_GROUP*
>( item )->
Mirror( mirrorPoint, flipDirection );
2578 static_cast<PCB_POINT*
>( item )->
Mirror( mirrorPoint, flipDirection );
break;
2589 localCommit.
Push(
_(
"Mirror" ) );
2593 frame()->ShowInfoBarMsg(
_(
"Footprints cannot be mirrored. Use Flip to move them to "
2594 "the other side of the board." ) );
2598 frame()->ShowInfoBarMsg(
_(
"Groups containing footprints or other items that cannot be "
2599 "mirrored were skipped." ) );
2629 commit = &localCommit;
2643 auto setJustify = [&](
EDA_TEXT* aTextItem )
2658 setJustify(
static_cast<PCB_TEXT*
>( item ) );
2667 if( !localCommit.
Empty() )
2670 localCommit.
Push(
_(
"Left Justify" ) );
2672 localCommit.
Push(
_(
"Center Justify" ) );
2674 localCommit.
Push(
_(
"Right Justify" ) );
2704 commit = &localCommit;
2721 std::optional<VECTOR2I> oldRefPt;
2724 oldRefPt =
selection.GetReferencePoint();
2754 if( !item->IsBOARD_ITEM() )
2761 boardItem->
Flip( refPt, flipDirection );
2765 static_cast<FOOTPRINT*
>( boardItem )->InvalidateComponentClassCache();
2771 localCommit.
Push(
_(
"Change Side / Flip" ) );
2787 selection.SetReferencePoint( *oldRefPt );
2799 int commitFlags = 0;
2804 int itemsDeleted = 0;
2805 int fieldsHidden = 0;
2806 int fieldsAlreadyHidden = 0;
2810 if( !item->IsBOARD_ITEM() )
2816 switch( item->Type() )
2822 wxASSERT( parentFP );
2823 commit.
Modify( parentFP );
2832 fieldsAlreadyHidden++;
2835 getView()->Update( parentFP );
2852 commit.
Remove( board_item );
2858 commit.
Modify( board_item );
2859 static_cast<PCB_TABLECELL*
>( board_item )->SetText( wxEmptyString );
2871 commit.
Remove( board_item );
2878 commit.
Remove( board_item );
2888 if( !aIsCut && aItems.
GetSize() == 1 )
2891 ZONE* zone =
static_cast<ZONE*
>( board_item );
2893 int outlineIdx, holeIdx;
2914 commit.
Remove( board_item );
2925 commit.Push(
_(
"Delete" ), commitFlags );
2933 commit.
Remove( board_item );
2941 commit.
Remove( board_item );
2950 if( enteredGroup && enteredGroup->
GetItems().empty() )
2955 commit.
Push(
_(
"Cut" ), commitFlags );
2957 else if( itemsDeleted == 0 )
2959 if( fieldsHidden == 1 )
2960 commit.
Push(
_(
"Hide Field" ), commitFlags );
2961 else if( fieldsHidden > 1 )
2962 commit.
Push(
_(
"Hide Fields" ), commitFlags );
2963 else if( fieldsAlreadyHidden > 0 )
2964 editFrame->
ShowInfoBarError(
_(
"Use the Footprint Properties dialog to remove fields." ) );
2968 commit.
Push(
_(
"Delete" ), commitFlags );
2979 std::vector<BOARD_ITEM*> lockedItems;
2997 const bool hadInitialSelection = !
m_selectionTool->GetSelection().Empty();
3012 if( hadInitialSelection && selectionCopy.
Empty() )
3042 if( selectionCopy.
Empty() )
3090 if( ret == wxID_OK )
3098 selCenter += translation;
3100 if( !
frame()->GetPcbNewSettings()->m_Display.m_DisplayInvertYAxis )
3101 rotation = -rotation;
3105 if( !item->IsBOARD_ITEM() )
3113 boardItem->
Move( translation );
3115 switch( rotationAnchor )
3121 boardItem->
Rotate(
board()->GetDesignSettings().GetAuxOrigin(), angle );
3126 getView()->Update( boardItem );
3129 commit.
Push(
_(
"Move Exactly" ) );
3185 std::vector<BOARD_ITEM*> new_items;
3192 if( !item->IsBOARD_ITEM() )
3204 switch( orig_item->
Type() )
3224 dupe_item = parentFootprint->
DuplicateItem(
true, &commit, orig_item );
3226 dupe_item = orig_item->
Duplicate(
true, &commit );
3237 new_items.push_back( dupe_item );
3238 commit.
Add( dupe_item );
3248 dupe_item = parentFootprint->
DuplicateItem(
true, &commit, orig_item );
3250 if( increment &&
static_cast<PAD*
>( dupe_item )->CanHaveNumber() )
3256 static_cast<PAD*
>( dupe_item )->SetNumber( padNumber );
3263 new_items.push_back( dupe_item );
3264 commit.
Add( dupe_item );
3273 dupe_item =
static_cast<PCB_GROUP*
>( orig_item )->DeepDuplicate(
true, &commit );
3279 new_items.push_back( aItem );
3280 commit.
Add( aItem );
3285 new_items.push_back( dupe_item );
3286 commit.
Add( dupe_item );
3298 EDA_ITEMS nItems( new_items.begin(), new_items.end() );
3304 editFrame->
DisplayToolMsg( wxString::Format(
_(
"Duplicated %d item(s)" ), (
int) new_items.size() ) );
3308 commit.
Push(
_(
"Duplicate" ) );
3326 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
3328 switch( aCollector[i]->Type() )
3332 default: aCollector.
Remove( i );
break;
3357 commit = &localCommit;
3361 switch( item->Type() )
3371 if( !
pad.CanHaveNumber() )
3375 std::optional<wxString> newNumber = incrementer.Increment(
pad.GetNumber(), param.
Delta, param.
Index );
3380 pad.SetNumber( *newNumber );
3389 std::optional<wxString> newText = incrementer.Increment(
text.GetText(), param.
Delta, param.
Index );
3394 text.SetText( *newText );
3406 commit->
Push(
_(
"Increment" ) );
3414 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
3416 if( aCollector[i]->Type() !=
PCB_PAD_T )
3424 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
3435 if( aSelection.
Empty() )
3459 BOX2I nonFieldsBBox;
3463 if( !item->IsType( { PCB_TEXT_T, PCB_FIELD_T } ) )
3464 nonFieldsBBox.
Merge( item->GetBoundingBox() );
3479 const wxString& aCanceledMessage,
VECTOR2I& aReferencePoint )
3483 std::optional<VECTOR2I> pickedPoint;
3493 const auto setPickerLayerSet =
3500 layerFilter =
LSET( { editFrame->GetActiveLayer() } );
3508 setPickerLayerSet();
3511 [&](
const VECTOR2D& aPoint ) ->
bool
3513 pickedPoint = aPoint;
3515 if( !aSuccessMessage.empty() )
3537 if( !aCanceledMessage.empty() )
3549 [&](
const int& aFinalState )
3568 setPickerLayerSet();
3571 evt->SetPassEvent();
3582 canvas()->SetStatusPopup(
nullptr );
3586 aReferencePoint = *pickedPoint;
3588 return pickedPoint.has_value();
3596 TOOL_EVENT selectReferencePoint( aEvent.
Category(), aEvent.
Action(),
"pcbnew.InteractiveEdit.selectReferencePoint",
3599 frame()->PushTool( selectReferencePoint );
3616 std::vector<BOARD_ITEM*> items;
3620 if( item->IsBOARD_ITEM() )
3621 items.push_back(
static_cast<BOARD_ITEM*
>( item ) );
3628 if( !
pickReferencePoint(
_(
"Select reference point for the copy..." ),
_(
"Selection copied" ),
3629 _(
"Copy canceled" ), refPoint ) )
3631 frame()->PopTool( selectReferencePoint );
3640 selection.SetReferencePoint( refPoint );
3644 frame()->SetStatusText(
_(
"Selection copied" ) );
3647 frame()->PopTool( selectReferencePoint );
3667 const auto getItemText = [&](
const BOARD_ITEM& aItem ) -> wxString
3669 switch( aItem.Type() )
3681 return text.GetShownText(
true );
3695 for(
int row = 0; row <
table.GetRowCount(); ++row )
3697 for(
int col = 0; col <
table.GetColCount(); ++col )
3702 if( col <
table.GetColCount() - 1 )
3708 if( row <
table.GetRowCount() - 1 )
3719 return wxEmptyString;
3722 wxArrayString itemTexts;
3726 if( item->IsBOARD_ITEM() )
3729 wxString itemText = getItemText( *boardItem );
3731 itemText.Trim(
false ).Trim(
true );
3733 if( !itemText.IsEmpty() )
3735 itemTexts.Add( std::move( itemText ) );
3741 if( !itemTexts.empty() )
3743 SaveClipboard( wxJoin( itemTexts,
'\n',
'\0' ).ToStdString() );
3768 board()->BuildConnectivity();
3770 canvas()->RedrawRatsnest();
constexpr EDA_IU_SCALE pcbIUScale
static TOOL_ACTION decrementPrimary
static TOOL_ACTION pickerSubTool
static TOOL_ACTION unselectAll
static TOOL_ACTION decrementSecondary
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION pasteSpecial
static TOOL_ACTION rightJustify
static TOOL_ACTION pageSettings
static TOOL_ACTION incrementSecondary
static TOOL_ACTION duplicate
static TOOL_ACTION incrementPrimary
static TOOL_ACTION doDelete
static TOOL_ACTION increment
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION leftJustify
static TOOL_ACTION copyAsText
static TOOL_ACTION refreshPreview
static TOOL_ACTION selectAll
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION centerJustify
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...
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
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 #NET_INFO object for a given item.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
void SetLocked(bool aLocked) override
bool IsLocked() const override
virtual void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Rotate this object.
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
BOARD_ITEM_CONTAINER * GetParent() const
virtual void Normalize()
Perform any normalization required after a user rotate and/or flip.
virtual void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Flip this object, i.e.
Information pertinent to a Pcbnew printed circuit board.
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
constexpr const Vec & GetPosition() const
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr const Vec GetCenter() const
constexpr bool IsValid() const
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
void SetBoard(BOARD *aBoard)
int GetCount() const
Return the number of objects in the list.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
@ TABLECELL_PROPS_EDIT_TABLE
enum TABLECELL_PROPS_RETVALUE GetReturnValue()
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const VECTOR2I &aPosition)
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...
void DisplayToolMsg(const wxString &msg) override
std::unordered_set< EDA_ITEM * > & GetItems()
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
SHAPE_POLY_SET & GetPolyShape()
bool IsHatchedFill() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual bool IsVisible() const
virtual void SetVisible(bool aVisible)
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 ConnectivityChangedEvent
Selected item had a property changed (except movement)
static const TOOL_EVENT UnselectedEvent
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.
A handler that is based on a set of callbacks provided by the user of the ITEM_MODIFICATION_ROUTINE.
bool IsBOARD_ITEM() const
virtual wxString GetClass() const =0
Return the class name.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllLayersMask()
A collection of nets and the parameters used to route or test these nets.
int GetuViaDiameter() const
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
VECTOR2I GetPosition() const override
void SetDelta(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
VECTOR2I GetOffset(PCB_LAYER_ID aLayer) const
void FlipPrimitives(FLIP_DIRECTION aFlipDirection)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
void SetPosition(const VECTOR2I &aPos) override
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
static TOOL_ACTION drag45Degree
static TOOL_ACTION duplicateIncrement
Activation of the duplication tool with incrementing (e.g. pad number)
static TOOL_ACTION layerPrev
static TOOL_ACTION changeTrackWidth
Update selected tracks & vias to the current track & via dimensions.
static TOOL_ACTION unrouteSelected
Removes all tracks from the selected items to the first pad.
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION updateFootprint
static TOOL_ACTION breakTrack
Break a single track into two segments at the cursor.
static TOOL_ACTION pointEditorMoveMidpoint
static TOOL_ACTION getAndPlace
Find an item and start moving.
static TOOL_ACTION routerRouteSelectedFromEnd
static TOOL_ACTION swapPadNets
Swap nets between selected pads/gates (and connected copper)
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION editFpInFpEditor
static TOOL_ACTION moveWithReference
move with a reference point
static TOOL_ACTION changeTrackLayerPrev
static TOOL_ACTION swap
Swapping of selected items.
static TOOL_ACTION routerAutorouteSelected
static TOOL_ACTION moveExact
Activation of the exact move tool.
static TOOL_ACTION intersectPolygons
Intersection of multiple polygons.
static TOOL_ACTION pointEditorMoveCorner
static TOOL_ACTION genRemove
static TOOL_ACTION selectConnection
Select tracks between junctions or expands an existing selection to pads or the entire connection.
static TOOL_ACTION assignNetClass
static TOOL_ACTION packAndMoveFootprints
Pack and start moving selected footprints.
static TOOL_ACTION copyWithReference
copy command with manual reference point selection
static TOOL_ACTION healShapes
Connect selected shapes, possibly extending or cutting them, or adding extra geometry.
static TOOL_ACTION toggleExcludeFromBOM
static TOOL_ACTION dragFreeAngle
static TOOL_ACTION inspectClearance
static TOOL_ACTION updateLocalRatsnest
static TOOL_ACTION updateFootprints
static TOOL_ACTION deleteFull
static TOOL_ACTION unrouteSegment
Removes track segment from the selected item to the next segment.
static TOOL_ACTION moveIndividually
move items one-by-one
static TOOL_ACTION changeFootprints
static TOOL_ACTION toggleExcludeFromPosFiles
static TOOL_ACTION chamferLines
Chamfer (i.e. adds a straight line) all selected straight lines by a user defined setback.
static TOOL_ACTION dogboneCorners
Add "dogbone" corners to selected lines to allow routing with a cutter radius.
static TOOL_ACTION filletTracks
Fillet (i.e. adds an arc tangent to) all selected straight tracks by a user defined radius.
static TOOL_ACTION simplifyPolygons
Simplify polygon outlines.
static TOOL_ACTION interactiveOffsetTool
static TOOL_ACTION footprintProperties
static TOOL_ACTION pointEditorChamferCorner
static TOOL_ACTION filletLines
Fillet (i.e. adds an arc tangent to) all selected straight lines by a user defined radius.
static TOOL_ACTION changeFootprint
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION pointEditorRemoveCorner
static TOOL_ACTION positionRelative
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION mirrorV
static TOOL_ACTION mergePolygons
Merge multiple polygons into a single polygon.
static TOOL_ACTION subtractPolygons
Subtract polygons from other polygons.
static TOOL_ACTION changeTrackLayerNext
static TOOL_ACTION flip
Flipping of selected objects.
static TOOL_ACTION pointEditorAddCorner
static TOOL_ACTION editVertices
Edit polygon vertices in a table.
static TOOL_ACTION swapGateNets
static TOOL_ACTION layerNext
static TOOL_ACTION extendLines
Extend selected lines to meet at a point.
static TOOL_ACTION routerRouteSelected
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
Common, abstract interface for edit frames.
virtual void OnEditItemRequest(BOARD_ITEM *aItem)
Install the corresponding dialog editor for the given item.
void OpenVertexEditor(BOARD_ITEM *aItem)
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
static const TOOL_EVENT & SnappingModeChangedByKeyEvent()
Hotkey feedback.
A set of BOARD_ITEMs (i.e., without duplicates).
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Tool that displays edit points allowing to modify items by dragging the points.
bool CanRemoveCorner(const SELECTION &aSelection)
Condition to display "Remove Corner" context menu entry.
static bool CanChamferCorner(const EDA_ITEM &aItem)
Check if a corner of the given item can be chamfered (zones, polys only).
static bool CanAddCorner(const EDA_ITEM &aItem)
Check if a corner can be added to the given item (zones, polys, segments, arcs).
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
void SetWidth(int aWidth) override
int GetWidth() const override
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
void SetHasSolderMask(bool aVal)
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
void SetEnd(const VECTOR2I &aEnd)
bool HasSolderMask() const
void SetStart(const VECTOR2I &aStart)
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
std::optional< int > GetLocalSolderMaskMargin() const
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...
virtual void SetWidth(int aWidth)
virtual int GetWidth() const
bool ApproxCollinear(const SEG &aSeg, int aDistanceThreshold=1) const
static SELECTION_CONDITION HasTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if among the selected items there is at least one of a given types.
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 bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
virtual unsigned int GetSize() const override
Return the number of stored items.
bool HasType(KICAD_T aType) const
Checks if there is at least one item of requested kind.
int Size() const
Returns the number of selected parts.
std::deque< EDA_ITEM * > & Items()
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
bool HasReferencePoint() const
size_t CountType(KICAD_T aType) const
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void SimplifyOutlines(int aMaxError=0)
Simplifies the lines in the polyset.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
static const int MIN_PRECISION_IU
This is the minimum precision for all the points in a shape.
Heuristically increment a string's n'th part from the right.
void SetSkipIOSQXZ(bool aSkip)
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2_TRAITS< int32_t >::extended_type extended_type
A dialog like WX_UNIT_ENTRY_DIALOG, but with multiple entries.
std::vector< RESULT > GetValues() const
Returns the values in the order they were added.
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
int GetValue()
Return the value in internal units.
Handle a list of polygons defining a copper zone.
bool UnFill()
Removes the zone filling.
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Test if the given point is contained within a cutout of the zone.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
void RemoveCutout(int aOutlineIdx, int aHoleIdx)
Remove a cutout from the zone.
bool IsTeardropArea() const
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
@ ROTATE_AROUND_USER_ORIGIN
@ ROTATE_AROUND_SEL_CENTER
@ ROTATE_AROUND_AUX_ORIGIN
@ ROTATE_AROUND_ITEM_ANCHOR
#define IS_NEW
New item, just created.
#define STRUCT_DELETED
flag indication structures to be erased
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
void ConnectBoardShapes(std::vector< PCB_SHAPE * > &aShapeList, int aChainingEpsilon)
Connects shapes to each other, making continious contours (adjacent shapes will have a common vertex)...
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
@ LAYER_SCHEMATIC_DRAWINGSHEET
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void for_all_pairs(_InputIterator __first, _InputIterator __last, _Function __f)
Apply a function to every possible pair of elements of a sequence.
Class to handle a set of BOARD_ITEMs.
std::deque< FOOTPRINT * > FOOTPRINTS
@ ID_POPUP_PCB_SWAP_UNIT_LAST
@ ID_POPUP_PCB_SWAP_UNIT_BASE
std::vector< EDA_ITEM * > EDA_ITEMS
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
Parameters that define a simple chamfer operation.
std::vector< std::vector< std::string > > table
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ 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
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_SHAPE_LOCATE_CIRCLE_T
@ PCB_SHAPE_LOCATE_SEGMENT_T
@ PCB_SHAPE_LOCATE_RECT_T
@ 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_SHAPE_LOCATE_BEZIER_T
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_SHAPE_LOCATE_POLY_T
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ 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
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D