47 if( !
pad->IsOnCopperLayer() )
58 if(
pad->GetSize().x <=
pad->GetDrillSize().x )
99 bool aUseClearanceEpsilon =
true )
override
117 for(
int layer = layers.
Start(); layer <= layers.
End(); ++layer )
172 return wxEmptyString;
195 default:
return false;
200 aConstraint->
m_Type = aType;
207 *aConstraint = it->second;
223 return a == other.
a &&
b == other.
b &&
type == other.
type;
232 else if (
a == other.
a )
236 else if (
b == other.
b )
247 const PNS::ITEM* aCollidingItem )
override
295 int aFlags = 0 )
override {};
330 printf(
"%p [%s] - %p [%s], clearance %d\n",
331 obs.m_head, obs.m_head->KindStr().c_str(),
332 obs.m_item, obs.m_item->KindStr().c_str(),
342 std::unique_ptr<PNS::NODE> world (
new PNS::NODE );
344 world->SetMaxClearance( 10000000 );
345 world->SetRuleResolver( &m_ruleResolver );
350 BOOST_TEST_MESSAGE(
"via to via, no violations" );
353 int count = world->QueryColliding(
v1, obstacles );
355 BOOST_CHECK_EQUAL( obstacles.size(), 0 );
356 BOOST_CHECK_EQUAL( count, 0 );
359 BOOST_TEST_MESSAGE(
"via to via, forced copper to copper violation" );
362 m_ruleResolver.m_defaultClearance = 1000000;
363 world->QueryColliding(
v1, obstacles );
366 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
367 const auto& first = *obstacles.begin();
369 BOOST_CHECK_EQUAL( first.m_head,
v1 );
370 BOOST_CHECK_EQUAL( first.m_item,
v2 );
371 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultClearance );
374 BOOST_TEST_MESSAGE(
"via to via, forced hole to hole violation" );
377 m_ruleResolver.m_defaultClearance = 200000;
378 m_ruleResolver.m_defaultHole2Hole = 1000000;
380 world->QueryColliding(
v1, obstacles );
383 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
384 auto iter = obstacles.begin();
385 const auto& first = *iter++;
387 BOOST_CHECK_EQUAL( first.m_head,
v1->Hole() );
388 BOOST_CHECK_EQUAL( first.m_item,
v2->Hole() );
389 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultHole2Hole );
392 BOOST_TEST_MESSAGE(
"via to via, forced copper to hole violation" );
395 m_ruleResolver.m_defaultHole2Hole = 220000;
396 m_ruleResolver.m_defaultHole2Copper = 1000000;
398 world->QueryColliding(
v1, obstacles );
401 BOOST_CHECK_EQUAL( obstacles.size(), 2 );
402 auto iter = obstacles.begin();
403 const auto& first = *iter++;
407 || ( first.m_head ==
v1->Hole() && first.m_item ==
v2 ) );
409 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.
Represent a contiguous set of PCB layers.
LAYER_RANGE Intersection(const LAYER_RANGE &aOther) const
Shortcut for comparisons/overlap tests.
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
Base class for PNS router board items.
BOARD_ITEM * Parent() const
const 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)
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
BOOST_CHECK(box.ClosestPointTo(VECTOR2D(0, 0))==VECTOR2D(1, 2))
Test suite for KiCad math code.
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)
VECTOR2I v2(1, 0)
Test suite for KiCad math code.
@ PCB_PAD_T
class PAD, a pad in a footprint