64 if(
pad->IsAperturePad() ||
pad->IsNPTHWithNoCopper() )
102 bool aUseClearanceEpsilon =
true )
override
122 const bool sameNet = aA && aB && aA->
Net() && aA->
Net() == aB->
Net();
125 for(
int layer = layers.
Start(); layer <= layers.
End(); ++layer )
127 if( !sameNet && !freePad )
179 if( ( sameNet || freePad ) && rv == 0 )
203 return wxEmptyString;
236 default:
return false;
241 aConstraint->
m_Type = aType;
248 *aConstraint = it->second;
264 return a == other.
a &&
b == other.
b &&
type == other.
type;
273 else if (
a == other.
a )
277 else if (
b == other.
b )
288 const PNS::ITEM* aCollidingItem )
override
339 int aFlags = 0 )
override {};
431 hop =
static_cast<PCB_VIA*
>( item );
434 BOOST_REQUIRE_MESSAGE( hop,
"the stack must have built at least one microvia" );
436 m_iface->SetBoard( &board );
438 std::unique_ptr<PNS::VIA> synced = m_iface->TestSyncVia( hop );
441 BOOST_CHECK_MESSAGE( synced->IsRoutable(),
"a stack hop must be a valid route anchor" );
442 BOOST_CHECK_MESSAGE( synced->IsLocked(),
"a stack hop must still be locked against shoving" );
465 m_iface->SetBoard( &board );
467 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
468 world->SetMaxClearance( 10000000 );
469 world->SetRuleResolver( &m_ruleResolver );
478 std::unique_ptr<PNS::VIA> synced = m_iface->TestSyncVia(
static_cast<PCB_VIA*
>( item ) );
480 world->AddRaw( synced.release() );
484 BOOST_REQUIRE_EQUAL( hops, 2 );
488 world->AddRaw( intruder );
490 m_ruleResolver.m_defaultClearance = 200000;
493 world->QueryColliding( intruder, obstacles );
495 BOOST_CHECK_MESSAGE( obstacles.size() > 0,
"a stack hop must obstruct a foreign-net via" );
504 obs.m_head, obs.m_head->KindStr().c_str(),
505 obs.m_item, obs.m_item->KindStr().c_str(),
515 std::unique_ptr<PNS::NODE> world (
new PNS::NODE );
520 world->SetMaxClearance( 10000000 );
521 world->SetRuleResolver( &m_ruleResolver );
529 int count = world->QueryColliding(
v1, obstacles );
538 m_ruleResolver.m_defaultClearance = 1000000;
539 world->QueryColliding(
v1, obstacles );
543 const auto& first = *obstacles.begin();
553 m_ruleResolver.m_defaultClearance = 200000;
554 m_ruleResolver.m_defaultHole2Hole = 1000000;
556 world->QueryColliding(
v1, obstacles );
560 auto iter = obstacles.begin();
561 const auto& first = *iter++;
571 m_ruleResolver.m_defaultHole2Hole = 220000;
572 m_ruleResolver.m_defaultHole2Copper = 1000000;
574 world->QueryColliding(
v1, obstacles );
578 auto iter = obstacles.begin();
579 const auto& first = *iter++;
582 BOOST_CHECK( ( first.m_head ==
v1 && first.m_item ==
v2->Hole() )
583 || ( first.m_head ==
v1->Hole() && first.m_item ==
v2 ) );
596 via.SetSecondaryDrill( std::optional<int>( 12000 ) );
601 std::unique_ptr<PNS::VIA> viaClone(
via.Clone() );
603 auto checkVia = [&](
const PNS::VIA& candidate )
607 BOOST_CHECK( candidate.HolePostMachining().has_value() );
609 BOOST_CHECK( candidate.SecondaryDrill().has_value() );
611 BOOST_CHECK( candidate.SecondaryHoleLayers().has_value() );
613 via.SecondaryHoleLayers()->Start() );
615 via.SecondaryHoleLayers()->End() );
616 BOOST_CHECK( candidate.SecondaryHolePostMachining().has_value() );
619 if( candidate.SecondaryHolePostMachining().has_value() )
620 BOOST_CHECK( candidate.SecondaryHolePostMachining().value() ==
via.SecondaryHolePostMachining().value() );
624 checkVia( *viaClone );
633 via.SetPrimaryDrillStartLayer(
F_Cu );
634 via.SetPrimaryDrillEndLayer(
B_Cu );
636 via.SetSecondaryDrillSize( std::optional<int>( 15000 ) );
637 via.SetSecondaryDrillStartLayer(
F_Cu );
641 via.SetTertiaryDrillSize( std::optional<int>( 8000 ) );
642 via.SetTertiaryDrillStartLayer(
B_Cu );
646 std::unique_ptr<PCB_VIA> viaClone(
static_cast<PCB_VIA*
>(
via.Clone() ) );
648 auto checkVia = [&](
const PCB_VIA& candidate )
652 BOOST_CHECK( candidate.GetFrontPostMachining().has_value() );
653 BOOST_CHECK_EQUAL(
static_cast<int>( candidate.GetFrontPostMachining().value() ),
654 static_cast<int>(
via.GetFrontPostMachining().value() ) );
655 BOOST_CHECK( candidate.GetSecondaryDrillSize().has_value() );
657 via.GetSecondaryDrillSize().value() );
659 via.GetSecondaryDrillStartLayer() );
661 via.GetSecondaryDrillEndLayer() );
663 BOOST_CHECK( candidate.GetBackPostMachining().has_value() );
665 static_cast<int>(
via.GetBackPostMachining().value() ) );
666 BOOST_CHECK( candidate.GetTertiaryDrillSize().has_value() );
668 via.GetTertiaryDrillSize().value() );
670 via.GetTertiaryDrillStartLayer() );
672 via.GetTertiaryDrillEndLayer() );
676 checkVia( *viaClone );
700 BOOST_CHECK( innerLayersRange2Layer.
Overlaps( 0 ) );
701 BOOST_CHECK( innerLayersRange2Layer.
Overlaps( 1 ) );
708 BOOST_CHECK( !innerLayersRange4Layer.
Overlaps( 0 ) );
709 BOOST_CHECK( innerLayersRange4Layer.
Overlaps( 1 ) );
710 BOOST_CHECK( innerLayersRange4Layer.
Overlaps( 2 ) );
711 BOOST_CHECK( !innerLayersRange4Layer.
Overlaps( 3 ) );
724 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
725 world->SetMaxClearance( 10000000 );
726 world->SetRuleResolver( &m_ruleResolver );
739 BOOST_CHECK( lockedSeg->
IsLocked() );
741 world->AddRaw( lockedSeg );
744 std::unique_ptr<PNS::SEGMENT> clone1(
PNS::Clone( *lockedSeg ) );
745 std::unique_ptr<PNS::SEGMENT> clone2(
PNS::Clone( *lockedSeg ) );
747 clone1->SetEnds( segStart, splitPt );
748 clone2->SetEnds( splitPt, segEnd );
750 BOOST_CHECK_MESSAGE( clone1->IsLocked(),
751 "First half of split locked segment must retain locked state" );
752 BOOST_CHECK_MESSAGE( clone2->IsLocked(),
753 "Second half of split locked segment must retain locked state" );
768 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
769 world->SetMaxClearance( 10000000 );
770 world->SetRuleResolver( &m_ruleResolver );
778 pad->SetPos( padPos );
781 world->AddRaw(
pad );
784 int narrowWidth = 250000;
788 world->AddRaw( narrowSeg );
791 int wideWidth = 500000;
795 world->AddRaw( wideSeg );
800 BOOST_CHECK( m_iface->TestInheritTrackWidth(
pad, &inherited ) );
805 BOOST_CHECK( m_iface->TestInheritTrackWidth(
pad, &inherited,
VECTOR2I( 2000000, 0 ) ) );
810 BOOST_CHECK( m_iface->TestInheritTrackWidth(
pad, &inherited,
VECTOR2I( 0, -2000000 ) ) );
815 BOOST_CHECK( m_iface->TestInheritTrackWidth(
pad, &inherited,
VECTOR2I( 100000, 50000 ) ) );
820 BOOST_CHECK( m_iface->TestInheritTrackWidth(
pad, &inherited,
VECTOR2I( 50000, -100000 ) ) );
836 auto compileAndCheck = [&](
const wxString& aExpr,
bool aExpectGeometry )
841 bool ok = compiler.
Compile( aExpr.ToUTF8().data(), &ucode, &ctx );
842 BOOST_CHECK_MESSAGE( ok,
"Failed to compile: " + aExpr );
847 wxString::Format(
"Expression '%s': expected geometry=%s, got %s",
849 aExpectGeometry ?
"true" :
"false",
851 ?
"true" :
"false" ) );
856 compileAndCheck( wxT(
"A.NetClass == 'Power'" ),
false );
857 compileAndCheck( wxT(
"A.Type == 'via'" ),
false );
858 compileAndCheck( wxT(
"A.NetName == '/VCC'" ),
false );
861 compileAndCheck( wxT(
"A.intersectsCourtyard('U1')" ),
true );
862 compileAndCheck( wxT(
"A.intersectsArea('Zone1')" ),
true );
863 compileAndCheck( wxT(
"A.enclosedByArea('Zone1')" ),
true );
864 compileAndCheck( wxT(
"A.intersectsFrontCourtyard('U1')" ),
true );
865 compileAndCheck( wxT(
"A.intersectsBackCourtyard('U1')" ),
true );
868 compileAndCheck( wxT(
"A.insideCourtyard('U1')" ),
true );
869 compileAndCheck( wxT(
"A.insideArea('Zone1')" ),
true );
883 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
884 world->SetMaxClearance( 10000000 );
885 world->SetRuleResolver( &m_ruleResolver );
902 world->AddRaw( solid1 );
903 world->AddRaw( solid2 );
907 int count = world->QueryColliding( solid1, obstacles );
908 BOOST_CHECK( count > 0 );
916 nullShapeSolid.
SetNet( net2 );
918 bool collided = solid1->
Collide( &nullShapeSolid, world.get(),
F_Cu,
nullptr );
919 BOOST_CHECK( !collided );
926 const int tolerance = 1000;
937 for(
int ii = 0; ii <
chain.PointCount(); ii++ )
939 if( (
chain.CPoint( ii ) - aPoint ).EuclideanNorm() <= tolerance )
945 for(
int ii = 0; ii < item->AnchorCount(); ii++ )
947 if( ( item->Anchor( ii ) - aPoint ).EuclideanNorm() <= tolerance )
965 pad->SetRoutable(
true );
984 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
986 world->SetMaxClearance( 10000000 );
987 world->SetRuleResolver( aResolver );
996 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1003 world->AddRaw(
pad );
1004 world->AddRaw( track );
1011 itemsToDrag.
Add( track );
1023 BOOST_CHECK( node->
Overrides( track ) );
1025 world->KillChildren();
1032 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1040 world->AddRaw(
pad );
1041 world->AddRaw( track );
1057 BOOST_CHECK(
tracesTouch( traces, trackEnd,
true ) );
1058 BOOST_CHECK( node->
Overrides( track ) );
1060 world->KillChildren();
1067 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1075 world->AddRaw(
pad );
1076 world->AddRaw( track );
1082 itemsToDrag.
Add( track );
1091 BOOST_CHECK(
tracesTouch( traces, trackStart,
true ) );
1097 world->KillChildren();
1104 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1118 world->AddRaw(
pad );
1119 world->AddRaw( selected );
1120 world->AddRaw( run );
1121 world->AddRaw( branchUp );
1122 world->AddRaw( branchDown );
1129 itemsToDrag.
Add( selected );
1139 BOOST_CHECK( !
tracesTouch( traces, junction,
true ) );
1142 world->KillChildren();
1149 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1152 VECTOR2I arcMid( 1000000, 1000000 );
1157 world->AddRaw( arc );
1163 itemsToDrag.
Add( arc );
1176 world->KillChildren();
1183 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1186 VECTOR2I arcMid( 1000000, 1000000 );
1189 world->AddRaw(
makeTestPad( arcStart, net, 300000 ) );
1193 world->AddRaw( arc );
1199 itemsToDrag.
Add( arc );
1210 BOOST_CHECK(
tracesTouch( traces, arcStart,
true ) );
1217 BOOST_CHECK(
static_cast<PNS::LINE*
>( item )->CLine().ArcCount() > 0 );
1220 world->KillChildren();
1227 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1235 world->AddRaw( padA );
1236 world->AddRaw( padB );
1237 world->AddRaw( track );
1243 itemsToDrag.
Add( padA );
1244 itemsToDrag.
Add( padB );
1256 BOOST_CHECK( !
tracesTouch( traces, padBPos,
true ) );
1259 BOOST_CHECK( node->
Overrides( track ) );
1261 world->KillChildren();
1268 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1276 world->AddRaw( draggedPad );
1277 world->AddRaw( heldPad );
1278 world->AddRaw( track );
1284 itemsToDrag.
Add( draggedPad );
1285 itemsToDrag.
Add( track );
1295 BOOST_CHECK(
tracesTouch( traces, heldPadPos,
true ) );
1296 BOOST_CHECK( node->
Overrides( track ) );
1297 BOOST_CHECK( !node->
Overrides( heldPad ) );
1299 world->KillChildren();
1306 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1310 VECTOR2I farEnd( 3000000, 3000000 );
1315 world->AddRaw(
pad );
1316 world->AddRaw( first );
1317 world->AddRaw( second );
1333 BOOST_CHECK(
tracesTouch( traces, farEnd,
true ) );
1334 BOOST_CHECK( node->
Overrides( first ) );
1335 BOOST_CHECK( node->
Overrides( second ) );
1337 world->KillChildren();
1345 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1349 VECTOR2I farEnd( 3000000, 3000000 );
1354 world->AddRaw(
pad );
1355 world->AddRaw( selected );
1356 world->AddRaw( unselected );
1363 itemsToDrag.
Add( selected );
1373 BOOST_CHECK(
tracesTouch( traces, farEnd,
true ) );
1375 BOOST_CHECK( !
tracesTouch( traces, padPos,
true ) );
1378 BOOST_CHECK( node->
Overrides( selected ) );
1379 BOOST_CHECK( node->
Overrides( unselected ) );
1381 world->KillChildren();
1389 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1399 world->AddRaw( first );
1400 world->AddRaw( middle );
1401 world->AddRaw( last );
1407 itemsToDrag.
Add( first );
1408 itemsToDrag.
Add( last );
1421 BOOST_CHECK( node->
Overrides( first ) );
1422 BOOST_CHECK( node->
Overrides( middle ) );
1425 world->KillChildren();
1432 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1440 world->AddRaw( draggedVia );
1441 world->AddRaw( heldVia );
1442 world->AddRaw( track );
1448 itemsToDrag.
Add( draggedVia );
1449 itemsToDrag.
Add( track );
1459 BOOST_CHECK(
tracesTouch( traces, heldViaPos,
true ) );
1461 BOOST_CHECK( node->
Overrides( draggedVia ) );
1462 BOOST_CHECK( node->
Overrides( track ) );
1463 BOOST_CHECK( !node->
Overrides( heldVia ) );
1465 world->KillChildren();
1472 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1480 world->AddRaw(
pad );
1498 BOOST_CHECK( !
tracesTouch( traces, freeEnd,
true ) );
1502 world->KillChildren();
1509 std::unique_ptr<PNS::NODE> world =
makeTestWorld( &m_ruleResolver );
1512 VECTOR2I arcMid( 1000000, 1000000 );
1517 world->AddRaw(
makeTestPad( arcStart, net, 300000 ) );
1518 world->AddRaw(
makeTestPad( arcEnd, net, 300000 ) );
1519 world->AddRaw( arc );
1525 itemsToDrag.
Add( arc );
1533 world->KillChildren();
1547 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1548 world->SetMaxClearance( 10000000 );
1549 world->SetRuleResolver( &m_ruleResolver );
1562 VECTOR2I traceEnd( 2500000, 2500000 );
1567 world->AddRaw( pad1 );
1568 world->AddRaw( trace );
1574 itemsToDrag.
Add( pad1 );
1576 bool started = dragger.
Start( pad1Pos, itemsToDrag );
1588 for(
const VECTOR2I& pos : dragPositions )
1590 bool dragOk = dragger.
Drag( pos );
1591 BOOST_CHECK( dragOk );
1594 BOOST_CHECK( currentNode !=
nullptr );
1599 BOOST_CHECK( traces.
Size() > 0 );
1602 world->KillChildren();
1615 chain.SetWidth( 250000 );
1616 chain.Append( arc );
1624 double oldRadius = line.
CLine().
CArcs()[0].GetRadius();
1632 BOOST_CHECK( line.
CLine().
CArcs()[0].GetRadius() != oldRadius );
1643 chain.SetWidth( 250000 );
1644 chain.Append( arc );
1666 m_router->LoadSettings( &settings );
1680 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1681 world->SetMaxClearance( 10000000 );
1682 world->SetRuleResolver( &m_ruleResolver );
1685 world->AddRaw( arc );
1694 m_router->SetFailureReason( wxEmptyString );
1695 BOOST_CHECK( dragger.
Start( arc->
Anchor( 0 ), items ) );
1696 BOOST_CHECK( m_router->FailureReason().IsEmpty() );
1698 world->KillChildren();
1703 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1704 world->SetMaxClearance( 10000000 );
1705 world->SetRuleResolver( &m_ruleResolver );
1708 world->AddRaw( arc );
1717 m_router->SetFailureReason( wxEmptyString );
1718 BOOST_CHECK( !dragger.
Start( arc->
Anchor( 0 ), items ) );
1719 BOOST_CHECK( !m_router->FailureReason().IsEmpty() );
1721 world->KillChildren();
1727 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1728 world->SetMaxClearance( 10000000 );
1729 world->SetRuleResolver( &m_ruleResolver );
1732 world->AddRaw( arc );
1741 m_router->SetFailureReason( wxEmptyString );
1742 BOOST_CHECK( !dragger.
Start( arc->
Anchor( 0 ), items ) );
1743 BOOST_CHECK( !m_router->FailureReason().IsEmpty() );
1745 world->KillChildren();
1755 int NetCode(
PNS::NET_HANDLE aNet )
override {
return aNet ? 1 : -1; }
1765 BOOST_REQUIRE( topo.NearestUnconnectedAnchorPoint( &aTrack, anchorPoint, anchorLayers,
1778 NETCODE_RULE_RESOLVER resolver;
1788 VECTOR2I( 12000000, 10000000 ) ), net );
1815 NETCODE_RULE_RESOLVER resolver;
1875 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1876 world->SetMaxClearance( 10000000 );
1877 world->SetRuleResolver( &m_ruleResolver );
1881 world->AddRaw(
v1 );
1882 world->AddRaw(
v2 );
1884 m_ruleResolver.m_defaultClearance = 1000000;
1887 world->QueryColliding(
v1, obstacles );
1889 BOOST_CHECK_GE( obstacles.size(), (
size_t) 1 );
1896 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1897 world->SetMaxClearance( 10000000 );
1898 world->SetRuleResolver( &m_ruleResolver );
1903 world->AddRaw(
v1 );
1905 m_ruleResolver.m_hasUserPhysicalRules =
false;
1906 m_ruleResolver.m_defaultClearance = 1000000;
1909 world->QueryColliding(
v1, obstacles );
1919 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1920 world->SetMaxClearance( 10000000 );
1921 world->SetRuleResolver( &m_ruleResolver );
1926 world->AddRaw(
v1 );
1928 m_ruleResolver.m_hasUserPhysicalRules =
true;
1929 m_ruleResolver.m_defaultPhysicalClearance = 1000000;
1932 world->QueryColliding(
v1, obstacles );
1934 BOOST_CHECK_GE( obstacles.size(), (
size_t) 1 );
1935 if( !obstacles.empty() )
1943 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1944 world->SetMaxClearance( 10000000 );
1945 world->SetRuleResolver( &m_ruleResolver );
1949 world->AddRaw( freePad );
1952 m_ruleResolver.m_hasUserPhysicalRules =
false;
1953 m_ruleResolver.m_defaultClearance = 1000000;
1956 world->QueryColliding( v, obstacles );
1967 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1968 world->SetMaxClearance( 10000000 );
1969 world->SetRuleResolver( &m_ruleResolver );
1973 world->AddRaw( freePad );
1976 m_ruleResolver.m_hasUserPhysicalRules =
true;
1977 m_ruleResolver.m_defaultPhysicalClearance = 0;
1978 m_ruleResolver.m_defaultClearance = 1000000;
1981 world->QueryColliding( v, obstacles );
1990 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
1991 world->SetMaxClearance( 10000000 );
1992 world->SetRuleResolver( &m_ruleResolver );
1996 world->AddRaw( freePad );
1999 m_ruleResolver.m_hasUserPhysicalRules =
true;
2000 m_ruleResolver.m_defaultPhysicalClearance = 1000000;
2003 world->QueryColliding( v, obstacles );
2005 BOOST_CHECK_GE( obstacles.size(), (
size_t) 1 );
2013 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
2014 world->SetMaxClearance( 10000000 );
2015 world->SetRuleResolver( &m_ruleResolver );
2020 world->AddRaw(
pad );
2021 world->AddRaw(
via );
2023 m_ruleResolver.m_hasUserPhysicalRules =
true;
2024 m_ruleResolver.m_defaultPhysicalHoleClearance = 1000000;
2027 world->QueryColliding(
via, obstacles );
2029 BOOST_CHECK_GE( obstacles.size(), (
size_t) 1 );
2035 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
2036 world->SetMaxClearance( 10000000 );
2037 world->SetRuleResolver( &m_ruleResolver );
2042 world->AddRaw(
v1 );
2044 m_ruleResolver.m_hasUserPhysicalRules =
true;
2045 m_ruleResolver.m_defaultPhysicalClearance = 0;
2048 world->QueryColliding(
v1, obstacles );
2058 std::unique_ptr<PNS::NODE> world(
new PNS::NODE );
2059 world->SetMaxClearance( 10000000 );
2060 world->SetRuleResolver( &m_ruleResolver );
2065 world->AddRaw(
pad );
2066 world->AddRaw(
via );
2068 m_ruleResolver.m_hasUserPhysicalRules =
true;
2069 m_ruleResolver.m_defaultPhysicalClearance = 100000;
2070 m_ruleResolver.m_defaultPhysicalHoleClearance = 2000000;
2073 world->QueryColliding(
via, obstacles );
2075 BOOST_CHECK_GE( obstacles.size(), (
size_t) 1 );
2080 int maxClearance = 0;
2082 maxClearance = std::max( maxClearance, obs.m_clearance );
2134 PADSTACK_VIA_IFACE( PNS_TEST_FIXTURE* aFixture ) :
2135 MOCK_PNS_KICAD_IFACE( aFixture )
2139 void SyncWorld( PNS::NODE* aWorld )
override
2144 auto via = std::make_unique<PNS::VIA>(
VECTOR2I( 0, 0 ), PNS_LAYER_RANGE( 0, 5 ), 400000, 100000,
2147 via->SetDiameter( 0, 400000 );
2148 via->SetDiameter( 1, 450000 );
2149 via->SetDiameter( 5, 400000 );
2151 aWorld->
Add( std::move(
via ) );
2154 void DisplayItem(
const PNS::ITEM* aItem,
int aClearance,
bool aEdit =
false,
int aFlags = 0 )
override
2161 if( !aItem->
Shape( -1 ) )
2165 int m_viasDisplayed = 0;
2166 int m_nullShapes = 0;
2173 PADSTACK_VIA_IFACE iface(
this );
2177 m_router->SetInterface( &iface );
2178 m_router->LoadSettings( &settings );
2183 m_router->UpdateSizes( sizes );
2185 m_router->SyncWorld();
2189 BOOST_REQUIRE_MESSAGE( iface.m_viasDisplayed > 0,
"Via was not highlighted as a violation" );
2190 BOOST_CHECK_MESSAGE( iface.m_nullShapes == 0,
"Highlighted front/inner/back via has no resolvable shape" );
2199 COUNTED_HOLE(
SHAPE* aShape,
int& aAlive ) :
2200 PNS::
HOLE( aShape ),
2206 ~COUNTED_HOLE()
override { m_alive--; }
2229 std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
2232 solid->SetHole(
new COUNTED_HOLE(
new SHAPE_CIRCLE(
VECTOR2I( 1000000, 0 ), 5000 ), holesAlive ) );
2233 world.
Add( std::move( solid ) );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetCopperLayerCount(int aCount)
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
KICAD_T Type() const
Returns the type of object.
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
std::unique_ptr< PNS::VIA > TestSyncVia(PCB_VIA *aVia)
PNS::RULE_RESOLVER * GetRuleResolver() override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false, int aFlags=0) override
void HideItem(PNS::ITEM *aItem) override
~MOCK_PNS_KICAD_IFACE() override
MOCK_PNS_KICAD_IFACE(PNS_TEST_FIXTURE *aFixture)
PNS_TEST_FIXTURE * m_testFixture
bool TestInheritTrackWidth(PNS::ITEM *aItem, int *aInheritedWidth, const VECTOR2I &aStartPosition=VECTOR2I())
virtual int NetCode(PNS::NET_HANDLE aNet) override
bool IsNetTieExclusion(const PNS::ITEM *aItem, const VECTOR2I &aCollisionPos, const PNS::ITEM *aCollidingItem) override
bool IsKeepout(const PNS::ITEM *aObstacle, const PNS::ITEM *aItem, bool *aEnforce) override
int m_defaultPhysicalHoleClearance
virtual int Clearance(const PNS::ITEM *aA, const PNS::ITEM *aB, bool aUseClearanceEpsilon=true) override
virtual bool QueryConstraint(PNS::CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, int aLayer, PNS::CONSTRAINT *aConstraint) override
int m_defaultPhysicalClearance
bool IsInNetTie(const PNS::ITEM *aA) override
std::map< ITEM_KEY, PNS::CONSTRAINT > m_ruleMap
virtual PNS::NET_HANDLE DpCoupledNet(PNS::NET_HANDLE aNet) override
bool IsDrilledHole(const PNS::ITEM *aItem) override
void AddMockRule(PNS::CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, PNS::CONSTRAINT &aConstraint)
bool IsNonPlatedSlot(const PNS::ITEM *aItem) override
bool HasUserDefinedPhysicalConstraint() override
virtual bool DpNetPair(const PNS::ITEM *aItem, PNS::NET_HANDLE &aNetP, PNS::NET_HANDLE &aNetN) override
virtual wxString NetName(PNS::NET_HANDLE aNet) override
virtual ~MOCK_RULE_RESOLVER()
bool m_hasUserPhysicalRules
int ClearanceEpsilon() const override
virtual int DpNetPolarity(PNS::NET_HANDLE aNet) override
bool HasGeometryDependentFunctions() const
void SetPosition(const VECTOR2I &aPos) override
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
void Regenerate(BOARD *aBoard, BOARD_COMMIT *aCommit)
Rebuild the member vias (and, for a staggered stack, the connecting traces) from the current stack se...
void SetStartLayer(PCB_LAYER_ID aLayer)
void SetViaSize(int aSize)
void SetViaDrill(int aDrill)
void SetEndLayer(PCB_LAYER_ID aLayer)
virtual VECTOR2I Anchor(int n) const override
bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Sort the selection and the unselected copper touching it.
const std::vector< LINE > & AnchoredLines() const
Selected arcs held at both ends, which cannot move.
bool Drag(const VECTOR2I &aP) override
Rebuild the block at aP: displace rigid and bridge items, reroute connections.
NODE * CurrentNode() const override
The current branch, or the world before the first Drag().
const ITEM_SET Traces() override
Everything displaced or rerouted by the last Drag().
const ITEM_SET Traces() override
Function Traces()
NODE * CurrentNode() const override
Function CurrentNode()
bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
bool Drag(const VECTOR2I &aP) override
Function Drag()
virtual bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
void SetMode(PNS::DRAG_MODE aDragMode) override
virtual void SetWorld(NODE *aWorld)
Function SetWorld()
void Add(const LINE &aLine)
std::vector< ITEM * > & Items()
Base class for PNS router board items.
BOARD_ITEM * Parent() const
void SetLayers(const PNS_LAYER_RANGE &aLayers)
void SetIsFreePad(bool aIsFreePad=true)
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
void SetNet(NET_HANDLE aNet)
virtual int Layer() const
bool Collide(const ITEM *aHead, const NODE *aNode, int aLayer, COLLISION_SEARCH_CONTEXT *aCtx=nullptr) const
Check for a collision (clearance violation) with between us and item aOther.
bool OfKind(int aKindMask) const
virtual void Mark(int aMarker) const
virtual BOARD_ITEM * BoardItem() const
void SetRoutable(bool aRoutable)
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
void DragArc(const VECTOR2I &aP, int aIndex)
const SHAPE_LINE_CHAIN & CLine() const
SHAPE_LINE_CHAIN & Line()
Modifiable accessor to the underlying shape.
void SetWidth(int aWidth)
Set line width.
Keep the router "world" - i.e.
bool Overrides(ITEM *aItem) const
Check if this branch contains an updated version of the m_item from the root branch.
void SetMaxClearance(int aClearance)
Set the worst-case clearance between any pair of items.
void AddRaw(ITEM *aItem, bool aAllowRedundant=false)
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
std::set< OBSTACLE > OBSTACLES
void SetRuleResolver(RULE_RESOLVER *aFunc)
Assign a clearance resolution function object.
void Remove(ARC *aArc)
Remove an item from this branch.
Contain all persistent settings of the router, such as the mode, optimization effort,...
int Width() const override
void SetWidth(int aWidth) override
The actual Push and Shove algorithm.
void SetShovePolicy(const LINKED_ITEM *aItem, int aPolicy)
void SetTrackWidth(int aWidth)
void SetBoardMinTrackWidth(int aWidth)
void SetDiffPairViaGapSameAsTraceGap(bool aEnable)
void SetDiffPairCopperToHole(int aCopperToHole)
int GetDiffPairCopperToHole() const
void SetViaDrill(int aDrill)
void SetDiffPairViaGap(int aGap)
void SetDiffPairHoleToHole(int aHoleToHole)
void SetViaDiameter(int aDiameter)
int EffectiveDiffPairViaGap() const
void SetPos(const VECTOR2I &aCenter)
void SetShape(SHAPE *shape)
virtual void SetHole(HOLE *aHole) override
bool inheritTrackWidthAndDpGap(PNS::ITEM *aItem, const VECTOR2I &aStartPosition, int *aInheritedWidth, int *aInheritedGap)
std::unique_ptr< PNS::VIA > syncVia(PCB_VIA *aVia)
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
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const std::vector< SHAPE_ARC > & CArcs() const
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
@ CT_PHYSICAL_HOLE_CLEARANCE
std::unique_ptr< typename std::remove_const< T >::type > Clone(const T &aItem)
PNS::CONSTRAINT_TYPE type
bool operator<(const ITEM_KEY &other) const
bool operator==(const ITEM_KEY &other) const
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
Hold an object colliding with another object, along with some useful data about the collision.
SETTINGS_MANAGER m_settingsManager
MOCK_RULE_RESOLVER m_ruleResolver
MOCK_PNS_KICAD_IFACE * m_iface
static PCB_VIA * makeVia(BOARD *aBoard, const VECTOR2I &aPos, VIATYPE aType, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom, int aDrill)
static PCB_SHAPE makeArc(const VECTOR2I &aCenter, const VECTOR2I &aStart, double aAngle, PCB_LAYER_ID aLayer=Dwgs_User)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
static bool isEdge(const PNS::ITEM *aItem)
static PNS::SOLID * makeTestPad(const VECTOR2I &aPos, PNS::NET_HANDLE aNet, int aRadius=500000)
static bool isHole(const PNS::ITEM *aItem)
static void dumpObstacles(const PNS::NODE::OBSTACLES &obstacles)
static bool isCopper(const PNS::ITEM *aItem)
static PNS::SEGMENT * makeTestTrack(const VECTOR2I &aStart, const VECTOR2I &aEnd, PNS::NET_HANDLE aNet)
BOOST_AUTO_TEST_CASE(PCBViaBackdrillCloneRetainsData)
BOOST_FIXTURE_TEST_CASE(PNSShoveOwnsRootLineHistory, PNS_TEST_FIXTURE)
static std::unique_ptr< PNS::NODE > makeTestWorld(PNS::RULE_RESOLVER *aResolver)
static bool tracesTouch(PNS::ITEM_SET &aTraces, const VECTOR2I &aPoint, bool aCopperOnly=false)
const SHAPE_LINE_CHAIN chain
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I