47 if( !
pad->IsOnCopperLayer() )
100 bool aUseClearanceEpsilon =
true )
override
118 for(
int layer = layers.
Start(); layer <= layers.
End(); ++layer )
173 return wxEmptyString;
196 default:
return false;
201 aConstraint->
m_Type = aType;
208 *aConstraint = it->second;
224 return a == other.
a &&
b == other.
b &&
type == other.
type;
233 else if (
a == other.
a )
237 else if (
b == other.
b )
248 const PNS::ITEM* aCollidingItem )
override
296 int aFlags = 0 )
override {};
331 BOOST_TEST_MESSAGE( wxString::Format(
"%p [%s] - %p [%s], clearance %d",
332 obs.m_head, obs.m_head->KindStr().c_str(),
333 obs.m_item, obs.m_item->KindStr().c_str(),
343 std::unique_ptr<PNS::NODE> world (
new PNS::NODE );
345 world->SetMaxClearance( 10000000 );
346 world->SetRuleResolver( &m_ruleResolver );
351 BOOST_TEST_MESSAGE(
"via to via, no violations" );
354 int count = world->QueryColliding(
v1, obstacles );
356 BOOST_CHECK_EQUAL( obstacles.size(), 0 );
357 BOOST_CHECK_EQUAL( count, 0 );
360 BOOST_TEST_MESSAGE(
"via to via, forced copper to copper violation" );
363 m_ruleResolver.m_defaultClearance = 1000000;
364 world->QueryColliding(
v1, obstacles );
367 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
368 const auto& first = *obstacles.begin();
370 BOOST_CHECK_EQUAL( first.m_head,
v1 );
371 BOOST_CHECK_EQUAL( first.m_item,
v2 );
372 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultClearance );
375 BOOST_TEST_MESSAGE(
"via to via, forced hole to hole violation" );
378 m_ruleResolver.m_defaultClearance = 200000;
379 m_ruleResolver.m_defaultHole2Hole = 1000000;
381 world->QueryColliding(
v1, obstacles );
384 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
385 auto iter = obstacles.begin();
386 const auto& first = *iter++;
388 BOOST_CHECK_EQUAL( first.m_head,
v1->Hole() );
389 BOOST_CHECK_EQUAL( first.m_item,
v2->Hole() );
390 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultHole2Hole );
393 BOOST_TEST_MESSAGE(
"via to via, forced copper to hole violation" );
396 m_ruleResolver.m_defaultHole2Hole = 220000;
397 m_ruleResolver.m_defaultHole2Copper = 1000000;
399 world->QueryColliding(
v1, obstacles );
402 BOOST_CHECK_EQUAL( obstacles.size(), 2 );
403 auto iter = obstacles.begin();
404 const auto& first = *iter++;
407 BOOST_CHECK( ( first.m_head ==
v1 && first.m_item ==
v2->Hole() )
408 || ( first.m_head ==
v1->Hole() && first.m_item ==
v2 ) );
410 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultHole2Copper );
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.
KICAD_T Type() const
Returns the type of object.
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
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
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
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
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()
int ClearanceEpsilon() const override
virtual int DpNetPolarity(PNS::NET_HANDLE aNet) override
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Base class for PNS router board items.
BOARD_ITEM * Parent() const
const PNS_LAYER_RANGE & Layers() const
bool OfKind(int aKindMask) const
virtual BOARD_ITEM * BoardItem() const
Keep the router "world" - i.e.
std::set< OBSTACLE > OBSTACLES
void SetInterface(ROUTER_IFACE *aIface)
Represent a contiguous set of PCB layers.
PNS_LAYER_RANGE Intersection(const PNS_LAYER_RANGE &aOther) const
Shortcut for comparisons/overlap tests.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
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 bool isEdge(const PNS::ITEM *aItem)
static bool isHole(const PNS::ITEM *aItem)
static void dumpObstacles(const PNS::NODE::OBSTACLES &obstacles)
BOOST_FIXTURE_TEST_CASE(PNSHoleCollisions, PNS_TEST_FIXTURE)
static bool isCopper(const PNS::ITEM *aItem)
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I