68#include <unordered_map>
69#include <unordered_set>
93#define ENTERED_GROUP_MAGIC_NUMBER ( (BOARD*)777 )
102 A( aA < aB ? aA : aB ),
103 B( aA < aB ? aB : aA ),
110 return A == other.
A &&
B == other.
B &&
Flag == other.
Flag;
121 size_t retval = 0xBADC0FFEE0DDF00D;
124 hash<const void*>()( k.A ),
125 hash<const void*>()( k.B ),
126 hash<int>()( k.Flag ) );
195 (
const void*) aItem->
Net(),
233 size_t retval = 0xBADC0FFEE0DDF00D;
238 hash<const void*>()( s->boardItem ),
239 hash<const void*>()( s->net ),
240 hash<int>()( s->start.x ), hash<int>()( s->start.y ),
241 hash<int>()( s->end.x ), hash<int>()( s->end.y ),
242 hash<int>()( s->layerStart ), hash<int>()( s->layerEnd ),
243 hash<int>()( s->kind ),
244 hash<bool>()( s->freePad ) );
277 size_t retval = 0xBADC0FFEE0DDF00D;
280 hash<const void*>()( k.item ),
281 hash<int>()( k.clearance ),
282 hash<int>()( k.walkaroundThickness ),
283 hash<int>()( k.layer ) );
310 const PNS::ITEM* aCollidingItem )
override;
332 int aWalkaroundThickness,
int aLayer )
override;
360 m_dummyArcs{ { aBoard }, { aBoard } },
361 m_dummyVias{ { aBoard }, { aBoard } }
366 for(
PCB_ARC& arc : m_dummyArcs )
373 m_clearanceEpsilon = aBoard->GetDesignSettings().GetDRCEpsilon();
375 m_clearanceEpsilon = 0;
396 if( !aItem || !aCollidingItem )
406 if( collidingFp && itemFp && ( collidingFp == itemFp ) && itemFp->
IsNetTie() )
416 aCollisionPos, collidingItem );
457 *aEnforce = checkKeepout( zone,
459 aObstacle->
Layer() ) ) );
509 parent = padVia->
Parent();
541 &&
pad->GetDrillSize().x !=
pad->GetDrillSize().y;
553 switch( aItem->
Kind() )
587 std::shared_ptr<DRC_ENGINE> drcEngine =
m_board->GetDesignSettings().m_DRCEngine;
609 default:
return false;
619 auto pickSmallerConstraint =
622 if( aCandidate.IsNull() )
629 else if( aCandidate.m_Value.HasMin() && aBest.
m_Value.
HasMin()
630 && aCandidate.m_Value.Min() < aBest.
m_Value.
Min() )
641 auto isMultiSegmentLine =
647 const auto* line =
static_cast<const PNS::LINE*
>( aItem );
651 bool lineANeedsSegmentEval =
false;
652 bool lineBNeedsSegmentEval =
false;
654 if( drcEngine->HasGeometryDependentRules() )
656 lineANeedsSegmentEval = isMultiSegmentLine( aItemA, parentA );
657 lineBNeedsSegmentEval = isMultiSegmentLine( aItemB, parentB );
661 auto evaluateLineSegments =
673 for(
int i = 0; i <
chain.SegmentCount(); i++ )
679 ? drcEngine->EvalRules( hostType, &dummyTrack, aOpposingItem, board_layer )
680 : drcEngine->EvalRules( hostType, aOpposingItem, &dummyTrack, board_layer );
682 if( pickSmallerConstraint( bestConstraint, segConstraint ) )
686 return bestConstraint;
690 auto linesBBoxOverlap =
693 if( !lineANeedsSegmentEval || !lineBNeedsSegmentEval )
698 const int proximityThreshold = std::max( lineA->
Width(), lineB->
Width() ) * 2;
701 bboxA.
Inflate( proximityThreshold );
707 if( ( lineANeedsSegmentEval || lineBNeedsSegmentEval ) && linesBBoxOverlap() )
710 if( aItemA && !parentA && !lineANeedsSegmentEval )
713 if( aItemB && !parentB && !lineBNeedsSegmentEval )
716 if( lineANeedsSegmentEval && lineBNeedsSegmentEval )
720 const auto* lineA =
static_cast<const PNS::LINE*
>( aItemA );
721 const auto* lineB =
static_cast<const PNS::LINE*
>( aItemB );
725 const int proximityThreshold = std::max( lineA->Width(), lineB->Width() ) * 2;
740 for(
int i = 0; i < chainA.
SegmentCount() && !done; i++ )
748 bboxA.
Inflate( proximityThreshold );
769 drcEngine->EvalRules( hostType, &dummyA, &dummyB, board_layer );
771 if( pickSmallerConstraint( hostConstraint, segConstraint ) )
779 else if( lineANeedsSegmentEval )
781 hostConstraint = evaluateLineSegments( aItemA, parentB,
true, 0 );
785 hostConstraint = evaluateLineSegments( aItemB, parentA,
false, 1 );
791 if( aItemA && !parentA )
794 if( aItemB && !parentB )
798 hostConstraint = drcEngine->EvalRules( hostType, parentA, parentB, board_layer );
801 if( hostConstraint.
IsNull() )
810 aConstraint->
m_Type = aType;
831 aConstraint->
m_Type = aType;
846 std::unordered_set<const PNS::ITEM*> dirtyItems( aItems.begin(), aItems.end() );
849 [&dirtyItems](
const auto& entry )
851 return dirtyItems.contains( entry.first.A ) || dirtyItems.contains( entry.first.B );
855 [&dirtyItems](
const auto& entry )
857 return dirtyItems.contains( entry.first.item );
879 int aWalkaroundThickness,
882 HULL_CACHE_KEY key = { aItem, aClearance, aWalkaroundThickness, aLayer };
892 return result.first->second;
900 if( std::shared_ptr<DRC_ENGINE>
drc =
m_board->GetDesignSettings().m_DRCEngine )
911 bool aUseClearanceEpsilon )
913 const bool bothOwned = aA && aB && aA->
Owner() && aB->
Owner();
948 const bool sameNet = aA && aB && aA->
Net() && aA->
Net() == aB->
Net();
951 for(
int layer = layers.
Start(); layer <= layers.
End(); ++layer )
976 if( !sameNet && !freePad )
1013 if( ( sameNet || freePad ) && rv == 0 )
1016 if( aUseClearanceEpsilon && rv > 0 )
1035 assert( aItem->
Owner() !=
nullptr );
1039 if( coupledNet && aInheritedGap )
1053 auto tryGetTrackWidth =
1056 switch( aPnsItem->Kind() )
1064 int itemTrackWidth = tryGetTrackWidth( aItem );
1066 if( itemTrackWidth > 0 )
1068 *aInheritedWidth = itemTrackWidth;
1072 switch( aItem->
Kind() )
1076 default:
return false;
1081 assert( jt !=
nullptr );
1086 if( linkedSegs.
Empty() )
1108 VECTOR2I otherEnd = ( anchor0 - p ).SquaredEuclideanNorm() > ( anchor1 - p ).SquaredEuclideanNorm()
1112 SEG::ecoord dist = ( otherEnd - aStartPosition ).SquaredEuclideanNorm();
1114 if( dist < minDist )
1123 int w = tryGetTrackWidth( closestItem );
1127 *aInheritedWidth = w;
1134 int min_current_layer = INT_MAX;
1135 int min_all_layers = INT_MAX;
1139 int w = tryGetTrackWidth( item );
1143 min_all_layers = std::min( w, min_all_layers );
1146 min_current_layer = std::min( w, min_current_layer );
1150 if( min_all_layers == INT_MAX )
1153 if( min_current_layer < INT_MAX )
1154 *aInheritedWidth = min_current_layer;
1156 *aInheritedWidth = min_all_layers;
1175 int startAnchor = 0;
1176 VECTOR2I startPosInt( aStartPosition.
x, aStartPosition.
y );
1181 double anchor0Distance = startPosInt.
Distance( aStartItem->
Anchor( 0 ) );
1182 double anchor1Distance = startPosInt.
Distance( aStartItem->
Anchor( 1 ) );
1184 if( anchor1Distance < anchor0Distance )
1191 dummyTrack.
SetEnds( aStartItem->
Anchor( startAnchor ), aStartItem->
Anchor( startAnchor ) );
1221 dummyTrack.
SetEnds( aStartItem->
Anchor( startAnchor ), aStartItem->
Anchor( startAnchor ) );
1316 diffPairWidth = std::max( diffPairWidth, constraint.
m_Value.
Opt() );
1318 if( diffPairWidth == constraint.
m_Value.
Opt() )
1326 diffPairViaGap = std::max( diffPairViaGap, constraint.
m_Value.
PinnedOpt() );
1328 if( diffPairGap == constraint.
m_Value.
Opt() )
1375 copperToHole = std::max( copperToHole, constraint.
m_Value.
Min() );
1378 copperToHole = std::max( copperToHole, constraint.
m_Value.
Min() );
1389 if( !
m_board || !
m_board->GetDesignSettings().m_UseHeightForLengthCalcs )
1422 refName = net->GetNetname();
1426 return m_board->MatchDpSuffix( refName, dummy1 );
1433 if( !aItem || !aItem->
Net() )
1437 wxString netNameN, netNameCoupled;
1439 int r =
m_board->MatchDpSuffix( netNameP, netNameCoupled );
1447 netNameN = netNameCoupled;
1451 netNameN = netNameP;
1452 netNameP = netNameCoupled;
1458 if( !netInfoP || !netInfoN )
1517 sh.
Append( aP.
x - aSize, aP.
y - aSize );
1518 sh.
Append( aP.
x + aSize, aP.
y + aSize );
1520 sh.
Append( aP.
x - aSize, aP.
y + aSize );
1521 sh.
Append( aP.
x + aSize, aP.
y - aSize );
1527 const wxString& aName = wxT(
"" ),
1553 const wxString& aName = wxT(
"" ),
1568 AddShape( &l, aColor, aOverrideWidth, aName, aSrcLoc );
1572 const wxString& aName = wxT(
"" ),
1696 std::vector<std::unique_ptr<PNS::SOLID>> solids;
1713 bool is_copper =
false;
1728 wxLogTrace( wxT(
"PNS" ), wxT(
"unsupported pad type 0x%x" ), aPad->
GetAttribute() );
1732 auto makeSolidFromPadLayer =
1739 && aLayer !=
F_Cu && aLayer !=
B_Cu
1745 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
1748 solid->SetRoutable(
false );
1756 if( aLayer ==
F_Cu || aLayer ==
B_Cu )
1763 solid->SetLayers( layers );
1766 solid->SetNet( aPad->
GetNet() );
1767 solid->SetParent( aPad );
1773 solid->SetIsFreePad();
1782 solid->SetPos(
VECTOR2I( c.
x - offset.
x, c.
y - offset.
y ) );
1783 solid->SetOffset(
VECTOR2I( offset.
x, offset.
y ) );
1795 if( shape->HasIndexableSubshapes() && shape->GetIndexableSubshapeCount() == 1 )
1797 std::vector<const SHAPE*> subshapes;
1798 shape->GetIndexableSubshapes( subshapes );
1800 solid->SetShape( subshapes[0]->Clone() );
1808 wxASSERT_MSG( poly->OutlineCount() <= 1, wxT(
"PAD::GetEffectivePolygon() should have fractured "
1809 "the SHAPE_POLY_SET, leaving a single outline." ) );
1811 if( poly->OutlineCount() )
1812 solid->SetShape(
new SHAPE_SIMPLE( poly->Outline( 0 ) ) );
1815 if( !solid->Shape( 0 ) )
1818 solids.emplace_back( std::move( solid ) );
1829 auto segment = std::make_unique<PNS::SEGMENT>(
SEG( aTrack->
GetStart(), aTrack->
GetEnd() ), aTrack->
GetNet() );
1831 segment->SetWidth( aTrack->
GetWidth() );
1833 segment->SetParent( aTrack );
1840 if( !generator->HasFlag(
IN_EDIT ) )
1855 arc->SetParent( aArc );
1862 if( !generator->HasFlag(
IN_EDIT ) )
1929 via->SetParent( aVia );
1936 if( !generator->HasFlag(
IN_EDIT ) )
1956 std::optional<PNS_LAYER_RANGE> secondaryLayers;
1965 via->SetSecondaryHoleLayers( secondaryLayers );
1966 via->SetSecondaryHolePostMachining( std::nullopt );
1976 static wxString msg;
1999 dlg.ShowDetailedText(
_(
"This zone cannot be handled by the router.\n"
2000 "Please verify it is not a self-intersecting polygon." ) );
2009 if( !layers[ layer ] )
2026 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2029 solid->SetNet(
nullptr );
2030 solid->SetParent( aZone );
2031 solid->SetShape( triShape );
2032 solid->SetIsCompoundShapePrimitive();
2033 solid->SetRoutable(
false );
2035 aWorld->
Add( std::move( solid ) );
2052 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2056 solid->SetNet(
nullptr );
2057 solid->SetParent( aItem );
2058 solid->SetShape( shape );
2059 solid->SetRoutable(
false );
2073 aWorld->
Add( std::move( solid ) );
2084 auto addPolysToWorld =
2087 for(
int ii = 0; ii < aPolys.OutlineCount(); ++ii )
2089 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2093 solid->SetNet(
nullptr );
2094 solid->SetParent( aDimension );
2095 solid->SetShape( shape );
2096 solid->SetRoutable(
false );
2098 for(
const VECTOR2I& pt : aPolys.Outline( ii ).CPoints() )
2101 aWorld->
Add( std::move( solid ) );
2113 addPolysToWorld( cornerBuffer );
2120 aDimension->PCB_TEXT::TransformShapeToPolygon( textBuffer, aDimension->
GetLayer(), 0,
2126 addPolysToWorld( textBuffer );
2141 for(
SHAPE* shape : shapes )
2143 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2148 solid->SetRoutable(
false );
2158 switch( shape->Type() )
2168 solid->SetNet( aItem->
GetNet() );
2169 solid->SetParent( aItem );
2170 solid->SetShape( shape );
2172 if( shapes.size() > 1 )
2173 solid->SetIsCompoundShapePrimitive();
2175 aWorld->
Add( std::move( solid ) );
2196 for(
int ii = 0; ii < cornerBuffer.
OutlineCount(); ++ii )
2198 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2202 solid->SetNet(
nullptr );
2203 solid->SetParent( aBarcode );
2204 solid->SetShape( shape );
2205 solid->SetRoutable(
false );
2210 aWorld->
Add( std::move( solid ) );
2223 wxLogTrace( wxT(
"PNS" ), wxT(
"m_board = %p" ),
m_board );
2236 return ::IsCopperLayer( aKicadLayer );
2245 for(
int i = aLayer.
Start(); i <= aLayer.
End(); i++ )
2285 return static_cast<const PNS::VIA*
>( aItem )->ConnectsLayer( aLayer );
2303 for(
int layer =
test.Start(); layer <=
test.End(); ++layer )
2316 for(
int layer =
test.Start(); layer <=
test.End(); ++layer )
2334 for(
int layer =
test.Start(); layer <=
test.End(); ++layer )
2336 if(
via->ConnectsLayer( layer ) )
2355 bool isOnVisibleLayer =
true;
2361 if(
m_view->IsVisible( item ) && isOnVisibleLayer )
2382 wxLogTrace( wxT(
"PNS" ), wxT(
"No board attached, aborting sync." ) );
2386 int worstClearance =
m_board->GetMaxClearanceValue();
2392 switch( gitem->Type() )
2434 if(
m_board->GetBoardPolygonOutlines( buffer,
true ) )
2435 boardOutline = &buffer;
2439 syncZone( aWorld, zone, boardOutline );
2444 for(
PAD*
pad : footprint->Pads() )
2446 std::vector<std::unique_ptr<PNS::SOLID>> solids =
syncPad(
pad );
2448 for( std::unique_ptr<PNS::SOLID>& solid : solids )
2449 aWorld->
Add( std::move( solid ) );
2451 std::optional<int> clearanceOverride =
pad->GetClearanceOverrides(
nullptr );
2453 if( clearanceOverride.has_value() )
2454 worstClearance = std::max( worstClearance, clearanceOverride.value() );
2458 std::unique_ptr<SHAPE> hole;
2459 hole.reset(
pad->GetEffectiveHoleShape()->Clone() );
2464 syncTextItem( aWorld, &footprint->Reference(), footprint->Reference().GetLayer() );
2465 syncTextItem( aWorld, &footprint->Value(), footprint->Value().GetLayer() );
2467 for(
ZONE* zone : footprint->Zones() )
2468 syncZone( aWorld, zone, boardOutline );
2470 for(
PCB_FIELD* field : footprint->GetFields() )
2473 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
2475 switch( item->Type() )
2518 if( std::unique_ptr<PNS::SEGMENT> segment =
syncTrack( t ) )
2519 aWorld->
Add( std::move( segment ),
true );
2523 if( std::unique_ptr<PNS::ARC> arc =
syncArc(
static_cast<PCB_ARC*
>( t ) ) )
2524 aWorld->
Add( std::move( arc ),
true );
2529 aWorld->
Add( std::move(
via ) );
2546 m_view->SetVisible( item,
true );
2570 if( zone->GetIsRuleArea() )
2578 bool showClearance =
false;
2580 if( aClearance >= 0 )
2589 showClearance = aItem->
OfKind( tracksOrVias );
2593 showClearance = aItem->
OfKind( tracksOrVias ) && !aEdit;
2597 showClearance = aItem->
OfKind( tracks ) && !aEdit;
2614 if( aClearance > 0 && ( showClearance || itemCollision ) )
2632 if( aImportance >= 1 )
2633 color =
COLOR4D( 1.0, 1.0, 0.0, 0.6 );
2634 else if( aImportance == 0 )
2635 color =
COLOR4D( 0.7, 0.7, 0.7, 0.6 );
2653 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
m_board->GetConnectivity();
2659 netCode = net->GetNetCode();
2662 const NET_SETTINGS* netSettings = connectivity->GetNetSettings();
2664 if( connectivity->HasNetNameForNetCode( netCode ) )
2666 const wxString& netName = connectivity->GetNetNameForNetCode( netCode );
2672 if( colorByNet && netColors.count( netCode ) )
2673 color = netColors.at( netCode );
2677 color = defaultColor;
2680 color = defaultColor;
2694 if(
m_view->IsVisible( parent ) )
2697 m_view->SetVisible( parent,
false );
2702 if( td->IsTeardropArea()
2704 && td->Outline()->Collide( aItem->
Shape( td->GetLayer() ) ) )
2706 m_view->SetVisible( td,
false );
2751 switch( aItem->
Kind() )
2759 aCommit.
Modify( arc_board );
2772 const SEG& s = seg->
Seg();
2787 aCommit.
Modify( via_board );
2804 if( std::optional<PNS_LAYER_RANGE> secondaryLayers =
via->SecondaryHoleLayers() )
2842 wxCHECK_RET(
m_commit, wxS(
"Cannot update a router item without a commit" ) );
2860 switch( aItem->
Kind() )
2877 newBoardItem = new_arc;
2885 const SEG& s = seg->
Seg();
2899 newBoardItem = track;
2910 via_board->
SetNet( net );
2922 if( std::optional<PNS_LAYER_RANGE> secondaryLayers =
via->SecondaryHoleLayers() )
2940 newBoardItem = via_board;
2962 newNetInfo->
SetNetClass(
m_board->GetDesignSettings().m_NetSettings->GetDefaultNetclass() );
2988 return newBoardItem;
3009 std::set<FOOTPRINT*> processedFootprints;
3015 VECTOR2I offset = fpOffset.p_new - fpOffset.p_old;
3020 pad->Move( offset );
3028 if( processedFootprints.find( footprint ) != processedFootprints.end() )
3031 processedFootprints.insert( footprint );
3053 group->AddItem( bi );
3067 return static_cast<EDA_UNITS>(
m_tool->GetManager()->GetSettings()->m_System.units );
3073 wxLogTrace( wxT(
"PNS" ), wxT(
"SetView %p" ), aView );
3102 return static_cast<NETINFO_ITEM*
>( aNet )->GetNetname();
3104 return wxEmptyString;
3110 wxLogTrace( wxT(
"PNS" ), wxT(
"Update-net %s" ),
GetNetName( aNet ) );
3135 if( aLayer < 0 || aLayer >=
m_board->GetCopperLayerCount() )
3141 if( aLayer ==
m_board->GetCopperLayerCount() - 1 )
3144 return static_cast<PCB_LAYER_ID>( ( aLayer + 1 ) * 2 );
3153 if( aLayer ==
F_Cu )
3156 if( aLayer ==
B_Cu )
3157 return m_board->GetCopperLayerCount() - 1;
3159 return ( aLayer / 2 ) - 1;
3163 long long& aExtraLength,
long long& aExtraDelay )
const
3167 if( !
m_board || !aNetP || !aNetN )
3173 if( sig.IsEmpty() || sig != netN->GetNetChain() )
3177 std::set<int> exclude;
3178 exclude.insert( netP->GetNetCode() );
3180 exclude.insert( netN->GetNetCode() );
3185 if( net->GetNetChain() != sig )
3187 if( exclude.count( net->GetNetCode() ) )
3194 if(
auto tr =
dynamic_cast<PCB_TRACK*
>( bi ) )
3196 if( tr->GetNetCode() == net->GetNetCode() )
3206 int count = 0;
double trk = 0,
pad = 0, tDelay = 0, padDelay = 0;
3207 std::tie( count, trk,
pad, tDelay, padDelay ) =
m_board->GetTrackLength( *rep );
3210 if( tDelay > 0.0 || padDelay > 0.0 )
3221 long long& aExtraLength,
long long& aExtraDelay )
const
3236 if(
auto tr =
dynamic_cast<PCB_TRACK*
>( bi ) )
3238 if( tr->GetNetCode() == ni->GetNetCode() )
3240 int count = 0;
double trk = 0,
pad = 0, tDelay = 0, padDelay = 0;
3241 std::tie( count, trk,
pad, tDelay, padDelay ) =
m_board->GetTrackLength( *tr );
3252 std::set<PNS::ITEM*>& aItems )
const
3257 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
m_board->GetConnectivity();
3258 std::set<const BOARD_ITEM*> boardJoined;
3264 if( !parent || !parent->
IsConnected() || !boardJoined.insert( parent ).second )
3270 boardJoined.insert( connected );
3274 std::erase_if( aItems,
3277 return aItem->
Parent() && boardJoined.count( aItem->
Parent() );
3296 auto touches = [&](
const ZONE* aZone )
3298 return !aZone->GetIsRuleArea() && !aZone->IsTeardropArea() && aZone->GetNet() == aItem->
Net()
3299 && aZone->IsOnLayer( layer ) && aZone->GetBoundingBox().Intersects( bbox )
3300 && aZone->Outline()->Collide( shape );
3305 if( touches( zone ) )
3311 for(
const ZONE* zone : footprint->Zones() )
3313 if( touches( zone ) )
3339 const PAD* startPad =
nullptr;
3340 const PAD* endPad =
nullptr;
3343 startPad =
static_cast<PAD*
>( aStartPad->
Parent() );
3346 endPad =
static_cast<PAD*
>( aEndPad->
Parent() );
3349 .OptimiseVias =
false,
3350 .MergeTracks =
false,
3351 .OptimiseTracesInPads =
false,
3352 .InferViaInPad =
true
3364 const PAD* startPad =
nullptr;
3365 const PAD* endPad =
nullptr;
3368 startPad =
static_cast<PAD*
>( aStartPad->
Parent() );
3371 endPad =
static_cast<PAD*
>( aEndPad->
Parent() );
3374 .OptimiseVias =
false,
3375 .MergeTracks =
false,
3376 .OptimiseTracesInPads =
false,
3377 .InferViaInPad =
true
3385 const bool aIsDiffPairCoupled,
const int aDiffPairCouplingGap,
3386 const int aPNSLayer,
const NETCLASS* aNetClass )
3401 bool aIsDiffPairCoupled,
int aDiffPairCouplingGap,
3402 int aPNSLayer,
const NETCLASS* aNetClass )
3416std::vector<LENGTH_DELAY_CALCULATION_ITEM>
3419 std::vector<LENGTH_DELAY_CALCULATION_ITEM> lengthItems;
3421 for(
int idx = 0; idx < aLine.
Size(); idx++ )
3435 lengthItems.emplace_back( std::move( item ) );
3439 const int layerPrev = aLine[idx - 1]->Layer();
3440 const int layerNext = aLine[idx + 1]->Layer();
3444 if( layerPrev != layerNext )
3448 item.
SetLayers( pcbLayerPrev, pcbLayerNext );
3450 lengthItems.emplace_back( std::move( item ) );
constexpr EDA_IU_SCALE pcbIUScale
#define SKIP_ENTERED_GROUP
@ OFF
Net (and netclass) colors are not shown.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
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 NETINFO_ITEM object for a given item.
Container for design settings for a BOARD object.
int GetCurrentViaSize() const
bool m_UseConnectedTrackWidth
bool m_TempOverrideTrackWidth
int GetCurrentDiffPairWidth() const
int GetCurrentDiffPairViaGap() const
int GetCurrentDiffPairGap() const
bool UseNetClassVia() const
Return true if netclass values should be used to obtain appropriate via size.
int GetCurrentTrackWidth() const
bool UseNetClassTrack() const
Return true if netclass values should be used to obtain appropriate track width.
bool UseNetClassDiffPair() const
Return true if netclass values should be used to obtain appropriate diff pair dimensions.
int GetCurrentViaDrill() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool HasDrilledHole() const
virtual int BoardCopperLayerCount() const
Return the total number of copper layers for the board that this item resides on.
virtual bool IsOnCopperLayer() const
Manage layers needed to make a physical board.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
Information pertinent to a Pcbnew printed circuit board.
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr void SetOrigin(const Vec &pos)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr const Vec & GetOrigin() const
constexpr const SizeVec & GetSize() const
constexpr void SetEnd(coord_type x, coord_type y)
constexpr bool Intersects(const BOX2< Vec > &aRect) const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
bool GetOption(OPTIONS option) const
DRC_RULE * GetParentRule() const
Design Rule Checker object that performs all the DRC tests.
bool IsNetTieExclusion(int aTrackNetCode, PCB_LAYER_ID aTrackLayer, const VECTOR2I &aCollisionPos, BOARD_ITEM *aCollidingItem)
Check if the given collision between a track and another item occurs during the track's entry into a ...
DRC_IMPLICIT_SOURCE GetImplicitSource() const
A set of EDA_ITEMs (i.e., without duplicates).
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
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 bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
std::vector< SHAPE * > MakeEffectiveShapesWithLineEndings(int aLineWidth) const
Make effective geometry for the shape body shortened for line endings plus the line-ending geometry i...
virtual int GetEffectiveWidth() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
PCB specific render settings.
NET_COLOR_MODE GetNetColorMode() const
COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
std::map< int, KIGFX::COLOR4D > & GetNetColorMap()
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.
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool GetHighContrast() const
Extend VIEW_ITEM by possibility of grouping items into a single object.
virtual double ViewGetLOD(int aLayer, const VIEW *aView) const
Return the level of detail (LOD) of the item.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Lightweight class which holds a pad, via, or a routed trace outline.
void SetLine(const SHAPE_LINE_CHAIN &aLine)
Sets the source SHAPE_LINE_CHAIN of this item.
void SetVia(const PCB_VIA *aVia)
Sets the VIA associated with this item.
void SetWidth(const int aWidth)
Sets the line width.
void SetEffectiveNetClass(const NETCLASS *aNetClass)
Sets the effective net class for the item.
void SetLayers(const PCB_LAYER_ID aStart, const PCB_LAYER_ID aEnd=PCB_LAYER_ID::UNDEFINED_LAYER)
Sets the first and last layers associated with this item.
int64_t CalculateLengthForDelay(int64_t aDesiredDelay, const TUNING_PROFILE_GEOMETRY_CONTEXT &aCtx) const
Calculates the length of track required for the given delay in a specific geometry context.
int64_t CalculatePropagationDelayForShapeLineChain(const SHAPE_LINE_CHAIN &aShape, const TUNING_PROFILE_GEOMETRY_CONTEXT &aCtx) const
Gets the propagation delay for the given shape line chain.
int64_t CalculateDelay(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr) const
Calculates the electrical propagation delay of the given items.
int64_t CalculateLength(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr) const
Calculates the electrical length of the given items.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
A collection of nets and the parameters used to route or test these nets.
COLOR4D GetPcbColor(bool aIsForSave=false) const
Handle the data for a net.
const wxString & GetNetChain() const
const wxString & GetNetname() const
void SetParent(BOARD *aParent)
void SetNetClass(const std::shared_ptr< NETCLASS > &aNetClass)
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
NET_SETTINGS stores various net-related settings in a project context.
bool HasEffectiveNetClass(const wxString &aNetName) const
Determines if an effective netclass for the given net name has been cached.
std::shared_ptr< NETCLASS > GetCachedEffectiveNetClass(const wxString &aNetName) const
Returns an already cached effective netclass for the given net name.
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
@ NORMAL
Shape is the same on all layers.
@ CUSTOM
Shapes can be defined on arbitrary layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
static constexpr PCB_LAYER_ID TEMP_ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Return a SHAPE_SEGMENT object representing the pad's hole.
PAD_ATTRIB GetAttribute() const
VECTOR2I GetOffset(PCB_LAYER_ID aLayer) const
VECTOR2I GetDrillSize() const
int GetPadToDieDelay() const
const PADSTACK & Padstack() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
int GetPadToDieLength() const
DISPLAY_OPTIONS m_Display
void SetMid(const VECTOR2I &aMid)
const VECTOR2I & GetMid() const
void GetBoundingHull(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Add two rectangular polygons separately bounding the barcode's symbol and the barcode's text.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
std::vector< VECTOR2I > GetConnectionPoints() const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void SetHasSolderMask(bool aVal)
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
virtual void SetWidth(int aWidth)
virtual int GetWidth() const
bool GetIsFree() const
Check if the via is a free via (as opposed to one created on a track by the router).
PCB_LAYER_ID BottomLayer() const
VECTOR2I GetPosition() const override
const PADSTACK & Padstack() const
void SetFrontTentingMode(TENTING_MODE aMode)
TENTING_MODE GetFrontTentingMode() const
std::optional< int > GetSecondaryDrillSize() const
void SetSecondaryDrillStartLayer(PCB_LAYER_ID aLayer)
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetFrontPostMachining() const
void SetDrill(int aDrill)
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
void SetBackTentingMode(TENTING_MODE aMode)
void SetIsFree(bool aFree=true)
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
void SetFrontPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
void SetSecondaryDrillEndLayer(PCB_LAYER_ID aLayer)
PCB_LAYER_ID GetPrimaryDrillEndLayer() const
void SetPosition(const VECTOR2I &aPoint) override
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
int GetWidth() const override
void SetViaType(VIATYPE aViaType)
TENTING_MODE GetBackTentingMode() const
PCB_LAYER_ID TopLayer() const
void SetSecondaryDrillSize(const VECTOR2I &aSize)
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
VIATYPE GetViaType() const
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
void SetWidth(int aWidth) override
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Return the 2 layers used by the via (the via actually uses all layers between these 2 layers)
int Width() const override
const SHAPE * Shape(int aLayer) const override
Return the geometrical shape of the item.
Basic class for a differential pair.
int GuessMostLikelyGap() const
static HOLE * MakeCircularHole(const VECTOR2I &pos, int radius, PNS_LAYER_RANGE aLayers)
ITEM_SET & ExcludeItem(const ITEM *aItem)
ITEM_SET & FilterKinds(int aKindMask, bool aInvert=false)
std::vector< ITEM * > & Items()
Base class for PNS router board items.
BOARD_ITEM * Parent() const
virtual ITEM * ParentPadVia() const
virtual const SHAPE * Shape(int aLayer) const
Return the geometrical shape of the item.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
virtual ITEM * Clone() const =0
Return a deep copy of the item.
void SetNet(NET_HANDLE aNet)
BOARD_ITEM * GetSourceItem() const
virtual int Layer() const
void SetLayer(int aLayer)
void SetParent(BOARD_ITEM *aParent)
bool OfKind(int aKindMask) const
virtual VECTOR2I Anchor(int n) const
virtual const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const
virtual BOARD_ITEM * BoardItem() const
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
const ITEM_SET & CLinks() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
const SHAPE_LINE_CHAIN & CLine() const
int Width() const
Return line width.
Keep the router "world" - i.e.
void SetMaxClearance(int aClearance)
Set the worst-case clearance between any pair of items.
const JOINT * FindJoint(const VECTOR2I &aPos, int aLayer, NET_HANDLE aNet) const
Search for a joint at a given position, layer and belonging to given net.
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
void SetRuleResolver(RULE_RESOLVER *aFunc)
Assign a clearance resolution function object.
void AddEdgeExclusion(std::unique_ptr< SHAPE > aShape)
const ITEM_OWNER * Owner() const
Return the owner of this item, or NULL if there's none.
virtual NET_HANDLE DpCoupledNet(NET_HANDLE aNet)=0
void SetEnds(const VECTOR2I &a, const VECTOR2I &b)
int Width() const override
int GetHoleToHole() const
void SetTrackWidth(int aWidth)
void SetBoardMinTrackWidth(int aWidth)
void SetDiffPairViaGapSameAsTraceGap(bool aEnable)
void SetDiffPairWidth(int aWidth)
void SetDiffPairCopperToHole(int aCopperToHole)
void SetDiffPairWidthSource(const wxString &aSource)
void SetDiffPairGapSource(const wxString &aSource)
void SetDiffPairGap(int aGap)
void SetHoleToHole(int aHoleToHole)
void SetViaDrill(int aDrill)
void SetDiffPairViaGap(int aGap)
void SetDiffPairHoleToHole(int aHoleToHole)
void SetMinClearance(int aClearance)
void SetClearance(int aClearance)
void SetViaDiameter(int aDiameter)
void SetClearanceSource(const wxString &aSource)
void SetWidthSource(const wxString &aSource)
void SetTrackWidthIsExplicit(bool aIsExplicit)
const DIFF_PAIR AssembleDiffPair(SEGMENT *aStart)
bool syncGraphicalItem(PNS::NODE *aWorld, PCB_SHAPE *aItem)
void AddItem(PNS::ITEM *aItem) override
bool syncDimension(PNS::NODE *aWorld, PCB_DIMENSION_BASE *aDimension)
virtual EDA_UNITS GetUnits() const
PNS::DEBUG_DECORATOR * m_debugDecorator
void SetDebugDecorator(PNS::DEBUG_DECORATOR *aDec)
bool syncZone(PNS::NODE *aWorld, ZONE *aZone, SHAPE_POLY_SET *aBoardOutline)
void SetBoard(BOARD *aBoard)
long long int CalculateRoutedPathLength(const PNS::ITEM_SET &aLine, const PNS::SOLID *aStartPad, const PNS::SOLID *aEndPad, const NETCLASS *aNetClass) override
int64_t CalculateRoutedPathDelay(const PNS::ITEM_SET &aLine, const PNS::SOLID *aStartPad, const PNS::SOLID *aEndPad, const NETCLASS *aNetClass) override
void RemoveBoardConnected(const std::vector< const PNS::ITEM * > &aJoined, std::set< PNS::ITEM * > &aItems) const override
Remove from aItems every item the board already joins to one of aJoined through objects the router do...
~PNS_KICAD_IFACE_BASE() override
std::unique_ptr< PNS::ARC > syncArc(PCB_ARC *aArc)
void RemoveItem(PNS::ITEM *aItem) override
bool GetSignalAggregate(PNS::NET_HANDLE aNetP, PNS::NET_HANDLE aNetN, long long &aExtraLength, long long &aExtraDelay) const override
bool IsPNSCopperLayer(int aPNSLayer) const override
int64_t CalculateLengthForDelay(int64_t aDesiredDelay, int aWidth, bool aIsDiffPairCoupled, int aDiffPairCouplingGap, int aPNSLayer, const NETCLASS *aNetClass) override
PNS::RULE_RESOLVER * GetRuleResolver() override
bool TouchesCopperZone(const PNS::ITEM *aItem) const override
Copper zones are absent from NODE joints, so tail pruning must keep items that touch one.
bool syncTextItem(PNS::NODE *aWorld, BOARD_ITEM *aItem, PCB_LAYER_ID aLayer)
bool IsKicadCopperLayer(PCB_LAYER_ID aPcbnewLayer) const
bool inheritTrackWidthAndDpGap(PNS::ITEM *aItem, const VECTOR2I &aStartPosition, int *aInheritedWidth, int *aInheritedGap)
std::vector< std::unique_ptr< PNS::SOLID > > syncPad(PAD *aPad)
void SetStartLayerFromPCBNew(PCB_LAYER_ID aLayer)
bool syncBarcode(PNS::NODE *aWorld, PCB_BARCODE *aBarcode)
bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const override
long long GetNetBoardLength(PNS::NET_HANDLE aNet) const override
PCB_LAYER_ID GetBoardLayerFromPNSLayer(int aLayer) const override
void SyncWorld(PNS::NODE *aWorld) override
int StackupHeight(int aFirstLayer, int aSecondLayer) const override
int64_t CalculateDelayForShapeLineChain(const SHAPE_LINE_CHAIN &aShape, int aWidth, bool aIsDiffPairCoupled, int aDiffPairCouplingGap, int aPNSLayer, const NETCLASS *aNetClass) override
PNS::DEBUG_DECORATOR * GetDebugDecorator() override
std::unique_ptr< PNS::SEGMENT > syncTrack(PCB_TRACK *aTrack)
PNS_PCBNEW_RULE_RESOLVER * m_ruleResolver
PNS::NET_HANDLE GetOrphanedNetHandle() override
std::unique_ptr< PNS::VIA > syncVia(PCB_VIA *aVia)
int GetPNSLayerFromBoardLayer(PCB_LAYER_ID aLayer) const override
PNS_LAYER_RANGE SetLayersFromPCBNew(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer)
std::vector< LENGTH_DELAY_CALCULATION_ITEM > GetLengthDelayCalculationItems(const PNS::ITEM_SET &aLine, const NETCLASS *aNetClass) const
void UpdateItem(PNS::ITEM *aItem) override
bool ImportSizes(PNS::SIZES_SETTINGS &aSizes, PNS::ITEM *aStartItem, PNS::NET_HANDLE aNet, VECTOR2D aStartPosition) override
std::vector< ROUTER_PREVIEW_ITEM * > m_previewItems
Each preview item is in the view directly so it draws at its own layer's place.
void SetView(KIGFX::VIEW *aView)
void RemoveItem(PNS::ITEM *aItem) override
void AddItem(PNS::ITEM *aItem) override
void UpdateItem(PNS::ITEM *aItem) override
std::map< PAD *, OFFSET > m_fpOffsets
int GetNetCode(PNS::NET_HANDLE aNet) const override
virtual void SetHostTool(PCB_TOOL_BASE *aTool)
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false, int aFlags=0) override
std::unique_ptr< BOARD_COMMIT > m_commit
void addPreviewItem(ROUTER_PREVIEW_ITEM *aItem)
Add a preview item to the view and take ownership of it.
void modifyBoardItem(PNS::ITEM *aItem, BOARD_COMMIT &aCommit)
void EraseView() override
void HideItem(PNS::ITEM *aItem) override
void UpdateNet(PNS::NET_HANDLE aNet) override
BOARD_CONNECTED_ITEM * createBoardItem(PNS::ITEM *aItem)
std::set< PAD * > m_independentPads
void DisplayPathLine(const SHAPE_LINE_CHAIN &aLine, int aImportance) override
std::unordered_map< BOARD_ITEM *, EDA_GROUP * > m_itemGroups
bool IsItemVisible(const PNS::ITEM *aItem) const override
std::unordered_set< BOARD_ITEM * > m_hiddenItems
EDA_UNITS GetUnits() const override
bool IsAnyLayerVisible(const PNS_LAYER_RANGE &aLayer) const override
bool GetSignalAggregate(PNS::NET_HANDLE aNetP, PNS::NET_HANDLE aNetN, long long &aExtraLength, long long &aExtraDelay) const override
void DisplayRatline(const SHAPE_LINE_CHAIN &aRatline, PNS::NET_HANDLE aNet) override
std::unordered_map< BOARD_ITEM *, std::vector< BOARD_ITEM * > > m_replacementMap
wxString GetNetName(PNS::NET_HANDLE aNet) const override
~PNS_KICAD_IFACE() override
Represent a contiguous set of PCB layers.
bool Overlaps(const PNS_LAYER_RANGE &aOther) const
PNS_LAYER_RANGE Intersection(const PNS_LAYER_RANGE &aOther) const
~PNS_PCBNEW_DEBUG_DECORATOR()
PNS_PCBNEW_DEBUG_DECORATOR(PNS::ROUTER_IFACE *aIface)
void AddPoint(const VECTOR2I &aP, const KIGFX::COLOR4D &aColor, int aSize, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
KIGFX::VIEW_GROUP * m_items
void AddShape(const BOX2I &aBox, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
PNS::ROUTER_IFACE * m_iface
void AddItem(const PNS::ITEM *aItem, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
virtual void Message(const wxString &msg, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
void SetView(KIGFX::VIEW *aView)
void AddShape(const SHAPE *aShape, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
std::vector< PNS::ITEM * > m_clonedItems
int NetCode(PNS::NET_HANDLE aNet) override
std::unordered_map< TEMP_CLEARANCE_CACHE_KEY, int > m_tempClearanceCache
virtual ~PNS_PCBNEW_RULE_RESOLVER()
PNS_PCBNEW_RULE_RESOLVER(BOARD *aBoard, PNS::ROUTER_IFACE *aRouterIface)
bool IsDrilledHole(const PNS::ITEM *aItem) override
void ClearCaches() override
void ClearTemporaryCaches() override
bool QueryConstraint(PNS::CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, int aLayer, PNS::CONSTRAINT *aConstraint) override
int ClearanceEpsilon() const override
BOARD_ITEM * getBoardItem(const PNS::ITEM *aItem, PCB_LAYER_ID aBoardLayer, int aIdx=0)
bool IsKeepout(const PNS::ITEM *aObstacle, const PNS::ITEM *aItem, bool *aEnforce) override
const SHAPE_LINE_CHAIN & HullCache(const PNS::ITEM *aItem, int aClearance, int aWalkaroundThickness, int aLayer) override
int Clearance(const PNS::ITEM *aA, const PNS::ITEM *aB, bool aUseClearanceEpsilon=true) override
void ClearCacheForItems(std::vector< const PNS::ITEM * > &aItems) override
bool IsNonPlatedSlot(const PNS::ITEM *aItem) override
bool HasUserDefinedPhysicalConstraint() override
std::unordered_map< CLEARANCE_CACHE_KEY, int > m_clearanceCache
int DpNetPolarity(PNS::NET_HANDLE aNet) override
bool IsNetTieExclusion(const PNS::ITEM *aItem, const VECTOR2I &aCollisionPos, const PNS::ITEM *aCollidingItem) override
PCB_TRACK m_dummyTracks[2]
bool IsInNetTie(const PNS::ITEM *aA) override
PNS::NET_HANDLE DpCoupledNet(PNS::NET_HANDLE aNet) override
bool DpNetPair(const PNS::ITEM *aItem, PNS::NET_HANDLE &aNetP, PNS::NET_HANDLE &aNetN) override
PNS::ROUTER_IFACE * m_routerIface
std::unordered_map< HULL_CACHE_KEY, SHAPE_LINE_CHAIN > m_hullCache
std::optional< bool > m_hasUserPhysicalConstraint
wxString NetName(PNS::NET_HANDLE aNet) override
@ DM_SHAPE
Shape body only, in the normal or collision color.
@ DM_SHADOW
Clearance halo only, drawn behind board items.
void SetWidth(int aWidth)
void SetClearance(int aClearance)
bool IsCollisionFlagged() const
static constexpr double PathOverlayDepth
void SetColor(const KIGFX::COLOR4D &aColor)
double GetOriginDepth() const
void SetDepth(double aDepth)
VECTOR2I::extended_type ecoord
const VECTOR2I & GetArcMid() const
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int Width() const
Get the current width of the segments in the chain.
void SetWidth(int aWidth) override
Set the width of all segments in the chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
const std::vector< VECTOR2I > & CPoints() const
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
size_t GetTriangleCount() const
void GetTriangle(int index, VECTOR2I &a, VECTOR2I &b, VECTOR2I &c) const
Represent a set of closed polygons.
bool IsTriangulationUpToDate() const
virtual void CacheTriangulation(bool aSimplify=false, const TASK_SUBMITTER &aSubmitter={}, bool aBuildIndexes=false)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
const TRIANGULATED_POLYGON * TriangulatedPolygon(int aIndex) const
unsigned int TriangulatedPolyCount() const
Return the number of triangulated polygons.
int OutlineCount() const
Return the number of outlines in the set.
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
void Append(int aX, int aY)
Append a new point at the end of the polygon.
An abstract shape on 2D plane.
virtual VECTOR2I GetStart() const
virtual VECTOR2I GetEnd() const
virtual const BOX2I BBox(int aClearance=0) const =0
Compute a bounding box of the shape, with a margin of aClearance a collision.
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
static constexpr extended_type ECOORD_MAX
VECTOR2_TRAITS< int32_t >::extended_type extended_type
Handle a list of polygons defining a copper zone.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
bool GetDoNotAllowVias() const
bool GetDoNotAllowPads() const
bool GetDoNotAllowTracks() const
SHAPE_POLY_SET * Outline()
SHAPE_POLY_SET GetBoardOutline() const
bool GetDoNotAllowFootprints() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool HasKeepoutParametersSet() const
Accessor to determine if any keepout parameters are set.
@ VIA_DIAMETER_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
@ EDGE_CLEARANCE_CONSTRAINT
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
@ MAX_UNCOUPLED_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ PHYSICAL_CLEARANCE_CONSTRAINT
@ HOLE_TO_HOLE_CONSTRAINT
#define ROUTER_TRANSIENT
transient items that should NOT be cached
#define IN_EDIT
Item currently edited.
static constexpr void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
@ ALWAYS_FLASHED
Always flashed for connectivity.
@ LAYER_SELECT_OVERLAY
Selected items overlay.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
@ APPEARANCE
Visibility flag has changed.
Push and Shove diff pair dimensions (gap) settings dialog.
@ CT_PHYSICAL_HOLE_CLEARANCE
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
@ CASTELLATED
a pad with a castellated through hole
BARCODE class definition.
@ SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING
@ SHOW_WITH_VIA_WHILE_ROUTING
static bool isEdge(const PNS::ITEM *aItem)
static bool isHole(const PNS::ITEM *aItem)
static bool isCopper(const PNS::ITEM *aItem)
#define ENTERED_GROUP_MAGIC_NUMBER
@ SH_LINE_CHAIN
line chain (polyline)
VECTOR2I::extended_type ecoord
bool operator==(const CLEARANCE_CACHE_KEY &other) const
CLEARANCE_CACHE_KEY(const PNS::ITEM *aA, const PNS::ITEM *aB, bool aFlag)
bool operator==(const HULL_CACHE_KEY &other) const
Struct to control which optimisations the length calculation code runs on the given path objects.
TRACK_CLEARANCE_MODE m_TrackClearance
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
bool operator<(const PARTICIPANT &o) const
bool operator==(const PARTICIPANT &o) const
TEMP_CLEARANCE_CACHE_KEY(const PNS::ITEM *aA, const PNS::ITEM *aB, bool aFlag)
bool operator==(const TEMP_CLEARANCE_CACHE_KEY &o) const
static PARTICIPANT makeParticipant(const PNS::ITEM *aItem)
A data structure to contain basic geometry data which can affect signal propagation calculations.
int64_t DiffPairCouplingGap
The gap between coupled tracks.
const NETCLASS * NetClass
The net class this track belongs to.
int64_t Width
The width (in internal units) of the track.
bool IsDiffPairCoupled
Whether this track or via is a member of a coupled differential pair.
PCB_LAYER_ID Layer
The layer this track is on.
std::size_t operator()(const CLEARANCE_CACHE_KEY &k) const noexcept
std::size_t operator()(const HULL_CACHE_KEY &k) const noexcept
std::size_t operator()(const TEMP_CLEARANCE_CACHE_KEY &k) const noexcept
KIBIS top(path, &reporter)
const SHAPE_LINE_CHAIN chain
wxString result
Test unit parsing edge cases and error handling.
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.
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_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_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_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_GRID_ITEM_T
a subgrid placed on a board
@ 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_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
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D