54#include <wx/richmsgdlg.h>
58#define MULTICHANNEL_EXTRA_DEBUG
65 std::vector<wxString> refs;
72 refs.push_back( fp->GetReferenceAsString() );
75 std::sort( refs.begin(), refs.end(),
76 [](
const wxString& aLhs,
const wxString& aRhs )
78 return aLhs.CmpNoCase( aRhs ) < 0;
86 size_t componentsOnLine = 0;
88 for(
const wxString& ref : refs )
90 if( componentsOnLine == 10 )
104 if( !line.IsEmpty() )
117 const std::vector<wxString>& aReasons )
119 if( !aParent || aReasons.empty() )
124 for(
size_t idx = 0; idx < aReasons.size(); ++idx )
127 reasonText += wxT(
"\n" );
129 reasonText += aReasons[idx];
132 wxRichMessageDialog dlg( aParent, aSummary,
_(
"Topology mismatch" ), wxICON_ERROR | wxOK );
133 dlg.ShowDetailedText( reasonText );
149 const std::vector<wxString>& aReasons )
const
151 wxWindow* parent = aParent ? aParent :
frame();
164 std::set<FOOTPRINT*>& aComponents )
166 if( !aRuleArea || !aRuleArea->
m_zone )
177 aComponents.insert(
static_cast<FOOTPRINT*
>( item ) );
180 return (
int) aComponents.size();
189 [&](
const wxString& aMessage,
int aOffset )
219 auto ok = compiler.
Compile( ruleText, &ucode, &preflightCtx );
233 fp->GetSheetname() );
235 aComponents.insert( fp );
245 if( !aRuleArea || !aRuleArea->
m_zone )
270 if( !boardItem->IsConnected() || boardItem->Type() ==
PCB_ZONE_T )
271 aItems.insert( boardItem );
275 return aItems.size() > 0;
283 bool zoneOnBoard =
false;
287 if( zone == aRuleArea->
m_zone )
311 if( !boardItem->IsConnected() || boardItem->Type() ==
PCB_ZONE_T )
312 aItems.insert( boardItem );
317 return aItems.size() > 0;
326 [&](
const wxString& aMessage,
int aOffset )
337 wxString ruleText = wxString::Format( wxT(
"A.enclosedByArea('%s')" ),
340 if( !compiler.
Compile( ruleText, &ucode, &preflightCtx ) )
347 auto val = ucode.
Run( &ctx );
349 if( val->AsDouble() != 0.0 )
350 aItems.insert( aItem );
355 if( zone == aRuleArea->
m_zone )
363 if( !drawing->IsConnected() )
364 testAndAdd( drawing );
373 std::set<FOOTPRINT*> rv;
375 if( aSheetName.EndsWith( wxT(
"/" ) ) )
376 aSheetName.RemoveLast();
378 wxString childPrefix = aSheetName + wxT(
"/" );
382 auto sn = fp->GetSheetname();
384 if( sn.EndsWith( wxT(
"/" ) ) )
387 if( sn == aSheetName || sn.StartsWith( childPrefix ) )
398 std::set<FOOTPRINT*> rv;
402 if( fp->GetComponentClass()->ContainsClassName( aComponentClassName ) )
412 std::set<FOOTPRINT*> rv;
416 if(
group->GetName() == aGroupName )
421 rv.insert(
static_cast<FOOTPRINT*
>( item ) );
432 std::set<BOARD_ITEM*> rv;
436 if(
group->GetName() != aGroupName )
441 if( item->IsBOARD_ITEM() )
442 rv.insert(
static_cast<BOARD_ITEM*
>( item ) );
452 std::vector<VECTOR2I> bbCorners;
453 bbCorners.reserve( aFootprints.size() * 4 );
457 const BOX2I bb = fp->GetBoundingBox(
false ).GetInflated( aMargin );
461 std::vector<VECTOR2I> hullVertices;
472 std::vector<VECTOR2I> bbCorners;
473 bbCorners.reserve( aItems.size() * 4 );
477 BOX2I bb = item->GetBoundingBox();
480 bb =
static_cast<FOOTPRINT*
>( item )->GetBoundingBox(
false );
485 std::vector<VECTOR2I> hullVertices;
497 using PathAndName = std::pair<wxString, wxString>;
498 std::set<PathAndName> uniqueSheets;
499 std::set<wxString> uniqueComponentClasses;
500 std::set<wxString> uniqueGroups;
506 uniqueSheets.insert( PathAndName( fp->GetSheetname(), fp->GetSheetfile() ) );
511 uniqueComponentClasses.insert( singleClass->GetName() );
513 if( fp->GetParentGroup() && !fp->GetParentGroup()->GetName().IsEmpty() )
514 uniqueGroups.insert( fp->GetParentGroup()->GetName() );
517 for(
const PathAndName& sheet : uniqueSheets )
526 m_areas.m_areas.push_back( ent );
531 (
int)
m_areas.m_areas.size() );
534 for(
const wxString& compClass : uniqueComponentClasses )
542 m_areas.m_areas.push_back( ent );
546 static_cast<int>(
m_areas.m_areas.size() ) );
549 for(
const wxString& groupName : uniqueGroups )
557 m_areas.m_areas.push_back( ent );
561 static_cast<int>(
m_areas.m_areas.size() ) );
572 if( !zone->GetIsRuleArea() )
575 if( !zone->GetPlacementAreaEnabled() )
583 area.
m_center = zone->Outline()->COutline( 0 ).Centre();
587 m_areas.m_areas.push_back( area );
617 std::vector<ZONE*> refRAs;
619 auto isSelectedItemAnRA =
625 ZONE* zone =
static_cast<ZONE*
>( aItem );
638 if(
ZONE* zone = isSelectedItemAnRA( item ) )
640 refRAs.push_back( zone );
648 if(
ZONE* grpZone = isSelectedItemAnRA( grpItem ) )
649 refRAs.push_back( grpZone );
654 if( refRAs.size() != 1 )
659 _(
"Select a reference Rule Area to copy from..." ),
662 return isSelectedItemAnRA( aItem ) !=
nullptr;
676 if(
m_areas.m_areas.size() <= 1 )
678 frame()->ShowInfoBarError(
_(
"No Rule Areas to repeat layout to have been found." ),
true );
698 if( ra.
m_zone == aRefZone )
710 std::vector<RULE_AREA*> targets;
717 targets.push_back( &ra );
721 if( targets.empty() )
724 int total =
static_cast<int>( targets.size() );
725 std::atomic<int> completed( 0 );
726 std::atomic<bool> cancelled(
false );
727 std::atomic<int> matchedComponents( 0 );
728 std::atomic<int> totalComponents( 0 );
743 auto future =
tp.submit_task(
744 [
this, refRA, &targets, &completed, &cancelled, &matchedComponents, &isoParams]()
748 if( cancelled.load( std::memory_order_relaxed ) )
751 matchedComponents.store( 0, std::memory_order_relaxed );
755 completed.fetch_add( 1, std::memory_order_relaxed );
761 std::unique_ptr<WX_PROGRESS_REPORTER>
reporter;
762 auto startTime = std::chrono::steady_clock::now();
763 double highWaterMark = 0.0;
765 while( future.wait_for( std::chrono::milliseconds( 100 ) ) != std::future_status::ready )
769 auto elapsed = std::chrono::steady_clock::now() - startTime;
771 if( elapsed > std::chrono::seconds( 1 ) )
773 reporter = std::make_unique<WX_PROGRESS_REPORTER>(
779 wxLog::FlushActive();
785 int done = completed.load( std::memory_order_relaxed );
786 int matched = matchedComponents.load( std::memory_order_relaxed );
787 int compTotal = totalComponents.load( std::memory_order_relaxed );
789 double fraction = ( compTotal > 0 )
790 ?
static_cast<double>( matched ) / compTotal
792 double progress =
static_cast<double>( done + fraction ) / total;
794 if( progress > highWaterMark )
795 highWaterMark = progress;
797 reporter->SetCurrentProgress( highWaterMark );
799 _(
"Resolving topology %d of %d (%d/%d components)" ),
800 done + 1, total, matched, compTotal ) );
803 cancelled.store(
true, std::memory_order_relaxed );
812 if( cancelled.load( std::memory_order_relaxed ) )
824 wxString* aErrorOut )
826 wxCHECK_MSG( aRefArea.
m_zone, -1, wxT(
"Reference Rule Area has no zone." ) );
827 wxCHECK_MSG( aTargetArea.
m_zone, -1, wxT(
"Target Rule Area has no zone." ) );
829 const bool silent = aErrorOut !=
nullptr;
831 auto reportError = [&](
const wxString& aMsg )
835 else if(
Pgm().IsGUI() )
836 frame()->ShowInfoBarError( aMsg,
true );
847 else if(
Pgm().IsGUI() )
849 wxString summary = wxString::Format(
_(
"Rule Area topologies do not match: %s" ), compat.
m_errorMsg );
856 std::optional<BOARD_COMMIT> localCommit;
858 if( !aExternalCommit )
859 localCommit.emplace(
GetManager(),
true,
false );
861 BOARD_COMMIT& commit = aExternalCommit ? *aExternalCommit : *localCommit;
874 auto errMsg = wxString::Format(
_(
"Copy Rule Area contents failed between rule areas '%s' and '%s'." ),
877 if( !aExternalCommit )
880 reportError( errMsg );
894 if( !aExternalCommit )
897 reportError(
_(
"Target group does not have a group." ) );
907 group->AddItem( item );
911 if( !aExternalCommit )
912 commit.
Push(
_(
"Repeat layout" ) );
924 for(
auto& [targetArea, compatData] :
m_areas.m_compatMap )
926 if( !compatData.m_doCopy )
929 targetArea->m_ruleName );
933 if( !compatData.m_isOk )
938 auto errMsg = wxString::Format(
_(
"Copy Rule Area contents failed between rule areas '%s' and '%s'." ),
939 m_areas.m_refRA->m_zone->GetZoneName(),
940 targetArea->m_zone->GetZoneName() );
945 frame()->ShowInfoBarError( errMsg,
true );
954 if(
m_areas.m_options.m_groupItems )
956 for(
const auto& [targetArea, compatData] :
m_areas.m_compatMap )
958 if( compatData.m_groupableItems.size() < 2 )
967 for(
BOARD_ITEM* item : compatData.m_groupableItems )
970 group->AddItem( item );
975 commit.
Push(
_(
"Repeat layout" ) );
978 frame()->ShowInfoBarMsg( wxString::Format(
_(
"Copied to %d Rule Areas." ), totalCopied ),
true );
998 if( ( c >=
'a' && c <=
'z' ) || ( c >=
'A' && c <=
'Z' ) || ( c ==
'_' ) )
1009 std::shared_ptr<CONNECTIVITY_DATA> aConnectivity,
1012 if( !aRuleArea || !aRuleArea->
m_zone )
1041 if(
EDA_GROUP* parent = bci->GetParentGroup() )
1047 if( bci->IsConnected() )
1048 aOutput.insert( bci );
1052 return (
int) aOutput.size();
1059 bool zoneOnBoard =
false;
1063 if( zone == aRuleArea->
m_zone )
1077 if( aOutput.contains( aItem ) )
1081 if(
EDA_GROUP* parent = aItem->GetParentGroup() )
1091 aItem->TransformShapeToPolygon( itemShape, aItem->GetLayer(), 0, maxError,
ERROR_OUTSIDE );
1100 aOutput.insert( aItem );
1106 enclosedByZone( track );
1110 if( drawing->IsConnected() )
1123 [&](
const wxString& aMessage,
int aOffset )
1134 wxString ruleText = wxString::Format( wxT(
"A.enclosedByArea('%s')" ),
1140 if( aOutput.contains( aItem ) )
1148 aOutput.insert( aItem );
1153 if( compiler.
Compile( ruleText, &ucode, &preflightCtx ) )
1156 testAndAdd( track );
1160 if( drawing->IsConnected() )
1166 if( generator->GetGeneratorType() != wxT(
"tuning_pattern" ) )
1169 if( !generator->HitTest( aRAPoly.
Outline( 0 ),
false ) )
1172 for(
EDA_ITEM* member : generator->GetItems() )
1176 if( !aOutput.contains( bci ) )
1178 aOutput.insert( bci );
1207 targetAnchorFp = targetFP;
1215 if( targetAnchorFp )
1222 disp = newpos - oldpos;
1235 newTargetOutline.
Move( disp );
1250 std::vector<std::pair<BOARD_ITEM*, BOARD_ITEM*>> groupFixupPairs;
1251 std::set<BOARD_ITEM*> reproducedSourceItems;
1253 auto fixupParentGroup =
1258 destItem->SetParentGroup(
nullptr );
1260 if( !preserveGroups )
1264 groupFixupPairs.emplace_back( sourceItem, destItem );
1266 reproducedSourceItems.insert( sourceItem );
1272 bool targetZoneOnBoard =
false;
1274 if( aTargetArea->
m_zone )
1278 if( z == aTargetArea->
m_zone )
1280 targetZoneOnBoard =
true;
1286 if( targetZoneOnBoard )
1294 if( preserveGroups )
1297 groupFixupPairs.emplace_back( aRefArea->
m_zone, aTargetArea->
m_zone );
1299 reproducedSourceItems.insert( aRefArea->
m_zone );
1305 std::set<BOARD_CONNECTED_ITEM*> refRouting;
1306 std::set<BOARD_CONNECTED_ITEM*> targetRouting;
1312 std::set<int> targc;
1316 for(
PAD*
pad : refFP->Pads() )
1317 refc.insert(
pad->GetNetCode() );
1319 for(
PAD*
pad : targetFP->Pads() )
1320 targc.insert(
pad->GetNetCode() );
1382 fixupParentGroup( item,
copied );
1396 if( !targetGroup && !aTargetArea->
m_components.empty() )
1397 targetGroup = ( *aTargetArea->
m_components.begin() )->GetParentGroup();
1401 std::vector<PCB_GENERATOR*> targetGenerators;
1406 targetGenerators.push_back(
static_cast<PCB_GENERATOR*
>( member ) );
1414 aCommit->
Remove( child );
1430 clone->
Move( disp );
1431 aCommit->
Add( clone );
1441 aCommit->
Add( child );
1452 std::set<BOARD_ITEM*> sourceItems;
1453 std::set<BOARD_ITEM*> targetItems;
1471 if( item->GetParent() && item->GetParent()->Type() ==
PCB_FOOTPRINT_T )
1488 ZONE* zone =
static_cast<ZONE*
>( item );
1511 if( item->GetParent() && item->GetParent()->Type() ==
PCB_FOOTPRINT_T )
1521 ZONE* zone =
static_cast<ZONE*
>( item );
1523 if( !skipLayerFilter )
1525 LSET allowedLayers =
1533 ZONE* targetZone =
static_cast<ZONE*
>( item->Duplicate(
false ) );
1540 if( !skipLayerFilter )
1554 fixupParentGroup( item,
copied );
1572 refFP->GetReference() );
1578 refFP->GetReference() );
1585 && !refFP->GetEffectiveShape( refFP->GetLayer() )->Collide( &refPoly, 0 ) )
1593 aCommit->
Modify( targetFP );
1595 targetFP->SetLayerAndFlip( refFP->GetLayer() );
1596 targetFP->SetOrientation( refFP->GetOrientation() );
1597 targetFP->SetPosition( refFP->GetPosition() );
1598 targetFP->Rotate(
VECTOR2( 0, 0 ), rot );
1599 targetFP->Move( disp );
1601 for(
PCB_FIELD* refField : refFP->GetFields() )
1603 wxCHECK2( refField,
continue );
1605 PCB_FIELD* targetField = targetFP->GetField( refField->GetName() );
1610 targetField->
SetLayerSet( refField->GetLayerSet() );
1611 targetField->
SetVisible( refField->IsVisible() );
1613 targetField->
SetPosition( refField->GetPosition() );
1615 targetField->
Move( disp );
1622 std::set<PCB_TEXT*> consumedTargets;
1624 for(
BOARD_ITEM* refItem : refFP->GraphicalItems() )
1632 for(
BOARD_ITEM* targetItem : targetFP->GraphicalItems() )
1639 if( consumedTargets.contains( candidate ) || candidate->
GetText() != refText->
GetText() )
1644 targetText = candidate;
1653 consumedTargets.insert( targetText );
1660 targetText->
Move( disp );
1665 targetFP->Models() = refFP->Models();
1672 if( preserveGroups && refFP->GetParentGroup() )
1673 groupFixupPairs.emplace_back( refFP, targetFP );
1675 if( preserveGroups )
1676 reproducedSourceItems.insert( refFP );
1683 if( preserveGroups && !groupFixupPairs.empty() )
1685 std::map<EDA_GROUP*, EDA_GROUP*> groupMap;
1686 std::map<EDA_GROUP*, bool> fullyReproducedCache;
1688 auto groupFullyReproduced =
1691 if(
auto it = fullyReproducedCache.find( aGroup ); it != fullyReproducedCache.end() )
1694 bool reproduced =
true;
1696 for(
EDA_ITEM* member : aGroup->GetItems() )
1700 if( !member->IsBOARD_ITEM()
1701 || !reproducedSourceItems.contains(
static_cast<BOARD_ITEM*
>( member ) ) )
1708 fullyReproducedCache[aGroup] = reproduced;
1712 for(
const auto& [sourceItem, destItem] : groupFixupPairs )
1716 if( !parentGroup || !groupFullyReproduced( parentGroup ) )
1719 if( !groupMap.contains( parentGroup ) )
1729 newGroup->
Move( disp );
1732 groupMap[parentGroup] = newGroup;
1733 aCommit->
Add( newGroup );
1738 if(
EDA_GROUP* oldGroup = destItem->GetParentGroup() )
1740 if( oldGroup != groupMap[parentGroup] )
1741 aCommit->
Modify( oldGroup->AsEdaItem() );
1744 groupMap[parentGroup]->AddItem( destItem );
1764 if( aComponentMatches.empty() )
1771 const std::vector<BOARD_CONNECTED_ITEM*> refConnectedPads = connectivity->
GetNetItems( aRef->
GetNetCode(),
1779 const PAD* refPad =
static_cast<const PAD*
>( refConItem );
1782 if( aComponentMatches.contains( sourceFootprint ) )
1784 const FOOTPRINT* targetFootprint = aComponentMatches[sourceFootprint];
1785 std::vector<const PAD*> targetFpPads = targetFootprint->
GetPads( refPad->
GetNumber() );
1787 if( !targetFpPads.empty() )
1789 int targetNetCode = targetFpPads[0]->GetNet()->GetNetCode();
1821 std::set<FOOTPRINT*> shared;
1824 std::inserter( shared, shared.begin() ) );
1826 if( !shared.empty() )
1830 aMatches.
m_errorMsg =
_(
"Target Rule Area shares components with the reference area" );
1833 _(
"This target Rule Area selects the same components as the reference area. "
1834 "Repeat layout cannot copy a Rule Area onto itself. Give each placement Rule "
1835 "Area a distinct sheet, component class or group." ) );
1836 aMatches.
m_mismatchReasons.push_back( wxString::Format(
_(
"Shared components:\n%s" ),
1854 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> mismatchReasons;
1858 mismatchReasons, aParams );
1864 aMatches.
m_isOk = status;
1875 for(
const auto& reason : mismatchReasons )
1877 if( reason.m_reason.IsEmpty() )
1880 if( !reason.m_reference.IsEmpty() && !reason.m_candidate.IsEmpty() )
1885 reason.m_reason ) );
1887 else if( !reason.m_reference.IsEmpty() )
1891 reason.m_reason ) );
1904 wxString::Format(
_(
"Reference area total components: %d" ), (
int) aRefArea->
m_components.size() ) );
1905 aMatches.
m_mismatchReasons.push_back( wxString::Format(
_(
"Reference area components:\n%s" ),
1908 wxString::Format(
_(
"Target area total components: %d" ), (
int) aTargetArea->
m_components.size() ) );
1909 aMatches.
m_mismatchReasons.push_back( wxString::Format(
_(
"Target area components:\n%s" ),
1920 const std::unordered_set<BOARD_ITEM*>& aItemsToRemove )
1926 std::vector<EDA_ITEM*> pruneList;
1932 if( refItem->m_Uuid == testItem->m_Uuid )
1933 pruneList.push_back( refItem );
1937 if( !pruneList.empty() )
1942 group->RemoveItem( item );
1944 if(
group->GetItems().size() < 2 )
1959 if(
m_areas.m_areas.size() <= 1 )
1961 frame()->ShowInfoBarError(
_(
"Cannot auto-generate any placement areas because the "
1962 "schematic has only one or no hierarchical sheets, "
1963 "groups, or component classes." ),
1971 if( ret != wxID_OK )
1977 if( !zone->GetIsRuleArea() )
1980 if( !zone->GetPlacementAreaEnabled() )
1983 std::set<FOOTPRINT*> components;
1986 zoneRA.
m_sourceType = zone->GetPlacementAreaSourceType();
1989 if( components.empty() )
1999 wxT(
"Placement rule area for sheet '%s' already exists as '%s'\n" ),
2005 wxT(
"Placement rule area for component class '%s' already exists as '%s'\n" ),
2011 wxT(
"Placement rule area for group '%s' already exists as '%s'\n" ),
2045 if( groupItems.empty() )
2048 wxT(
"Skipping placement rule area generation for source group '%s': group has no board items." ),
2060 std::unique_ptr<ZONE> newZone(
new ZONE(
board() ) );
2063 newZone->SetZoneName( wxString::Format( wxT(
"auto-placement-area-%s" ), ra.
m_sheetPath ) );
2065 newZone->SetZoneName( wxString::Format( wxT(
"auto-placement-area-%s" ), ra.
m_componentClass ) );
2067 newZone->SetZoneName( wxString::Format( wxT(
"auto-placement-area-%s" ), ra.
m_groupName ) );
2070 newZone->GetZoneName(),
2073 newZone->SetIsRuleArea(
true );
2075 newZone->SetPlacementAreaEnabled(
true );
2076 newZone->SetDoNotAllowZoneFills(
false );
2077 newZone->SetDoNotAllowVias(
false );
2078 newZone->SetDoNotAllowTracks(
false );
2079 newZone->SetDoNotAllowPads(
false );
2080 newZone->SetDoNotAllowFootprints(
false );
2085 newZone->SetPlacementAreaSource( ra.
m_sheetPath );
2095 newZone->SetPlacementAreaSource( ra.
m_groupName );
2098 newZone->AddPolygon( raOutline );
2106 ra.
m_zone = newZone.release();
2113 if(
m_areas.m_options.m_groupItems )
2127 std::unordered_set<BOARD_ITEM*> toPrune;
2132 toPrune.insert( ra.
m_zone );
2146 group->AddItem( fp );
2151 commit.
Push(
_(
"Auto-generate placement rule areas" ) );
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.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
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 void SetLayerSet(const LSET &aLayers)
virtual bool IsKnockout() const
virtual void SetIsKnockout(bool aKnockout)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
FOOTPRINT * GetParentFootprint() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
constexpr BOX2< Vec > GetInflated(coord_type aDx, coord_type aDy) const
Get a new rectangle that is this one, inflated by aDx and aDy.
Represent a set of changes (additions, deletions or modifications) of a data model (e....
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.
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
A lightweight representation of a component class.
const std::vector< COMPONENT_CLASS * > & GetConstituentClasses() const
Fetches a vector of the constituent classes for this (effective) class.
const std::vector< BOARD_CONNECTED_ITEM * > GetNetItems(int aNetCode, const std::vector< KICAD_T > &aTypes) const
Function GetNetItems() Returns the list of items that belong to a certain net.
A set of EDA_ITEMs (i.e., without duplicates).
std::unordered_set< EDA_ITEM * > & GetItems()
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void SetParentGroup(EDA_GROUP *aGroup)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
virtual void SetVisible(bool aVisible)
const TEXT_ATTRIBUTES & GetAttributes() const
wxString AsString() const
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
VALUE * Run(CONTEXT *ctx)
virtual double AsDouble() const
LSET is a set of PCB_LAYER_IDs.
bool ContainsAll(const LSET &aLayers) const
See if this layer set contains all layers in another set.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
const wxString & GetNumber() const
void SetItems(BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
static TOOL_ACTION repeatLayout
static TOOL_ACTION generatePlacementRuleAreas
static TOOL_ACTION selectItemInteractively
Selection of reference points/items.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
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.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
virtual VECTOR2I GetPosition() const override
virtual void SetPosition(const VECTOR2I &aPos) override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
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
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
virtual void CacheTriangulation(bool aSimplify=false, const TASK_SUBMITTER &aSubmitter={})
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
static std::unique_ptr< CONNECTION_GRAPH > BuildFromFootprintSet(const std::set< FOOTPRINT * > &aFps, const std::set< FOOTPRINT * > &aOtherChannelFps={})
Define a general 2D-vector/point.
Handle a list of polygons defining a copper zone.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
wxString GetPlacementAreaSource() const
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
PLACEMENT_SOURCE_T GetPlacementAreaSourceType() const
SHAPE_POLY_SET * Outline()
const wxString & GetZoneName() const
bool GetPlacementAreaEnabled() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void UnHatchBorder()
Clear the zone's hatch.
void RemoveAllContours(void)
void BuildConvexHull(std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
SHAPE_LINE_CHAIN RectifyPolygon(const SHAPE_LINE_CHAIN &aPoly)
void CollectBoxCorners(const BOX2I &aBox, std::vector< VECTOR2I > &aCorners)
Add the 4 corners of a BOX2I to a vector.
std::map< FOOTPRINT *, FOOTPRINT * > COMPONENT_MATCHES
Class to handle a set of BOARD_ITEMs.
PGM_BASE & Pgm()
The global program "get" accessor.
Utility functions for working with shapes.
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
bool m_connectedRoutingOnly
bool m_includeLockedItems
std::vector< wxString > m_mismatchReasons
std::unordered_set< BOARD_ITEM * > m_affectedItems
Filled in by copyRuleAreaContents with items that were affected by the copy operation.
TMATCH::COMPONENT_MATCHES m_matchingComponents
std::unordered_set< BOARD_ITEM * > m_groupableItems
Filled in by copyRuleAreaContents with affected items that can be grouped together.
std::unordered_set< EDA_ITEM * > m_designBlockItems
PLACEMENT_SOURCE_T m_sourceType
wxString m_componentClass
std::set< FOOTPRINT * > m_components
std::atomic< bool > * m_cancelled
std::atomic< int > * m_matchedComponents
std::atomic< int > * m_totalComponents
IbisParser parser & reporter
wxString result
Test unit parsing edge cases and error handling.
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::priority_thread_pool thread_pool
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I