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
288 bool aIsHeadTrace =
false )
override {};
323 printf(
"%p [%s] - %p [%s], clearance %d\n",
324 obs.m_head, obs.m_head->KindStr().c_str(),
325 obs.m_item, obs.m_item->KindStr().c_str(),
335 std::unique_ptr<PNS::NODE> world (
new PNS::NODE );
337 world->SetMaxClearance( 10000000 );
338 world->SetRuleResolver( &m_ruleResolver );
343 BOOST_TEST_MESSAGE(
"via to via, no violations" );
346 int count = world->QueryColliding(
v1, obstacles );
348 BOOST_CHECK_EQUAL( obstacles.size(), 0 );
349 BOOST_CHECK_EQUAL( count, 0 );
352 BOOST_TEST_MESSAGE(
"via to via, forced copper to copper violation" );
355 m_ruleResolver.m_defaultClearance = 1000000;
356 world->QueryColliding(
v1, obstacles );
359 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
360 const auto first = *obstacles.begin();
362 BOOST_CHECK_EQUAL( first.m_head,
v1 );
363 BOOST_CHECK_EQUAL( first.m_item,
v2 );
364 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultClearance );
367 BOOST_TEST_MESSAGE(
"via to via, forced hole to hole violation" );
370 m_ruleResolver.m_defaultClearance = 200000;
371 m_ruleResolver.m_defaultHole2Hole = 1000000;
373 world->QueryColliding(
v1, obstacles );
376 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
377 auto iter = obstacles.begin();
378 const auto first = *iter++;
380 BOOST_CHECK_EQUAL( first.m_head,
v1->Hole() );
381 BOOST_CHECK_EQUAL( first.m_item,
v2->Hole() );
382 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultHole2Hole );
385 BOOST_TEST_MESSAGE(
"via to via, forced copper to hole violation" );
388 m_ruleResolver.m_defaultHole2Hole = 220000;
389 m_ruleResolver.m_defaultHole2Copper = 1000000;
391 world->QueryColliding(
v1, obstacles );
394 BOOST_CHECK_EQUAL( obstacles.size(), 2 );
395 auto iter = obstacles.begin();
396 const auto first = *iter++;
400 || ( first.m_head ==
v1->Hole() && first.m_item ==
v2 ) );
402 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, bool aIsHeadTrace=false) override
void HideItem(PNS::ITEM *aItem) 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 *aA, const PNS::ITEM *aB) 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
void AddMockRule(PNS::CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, PNS::CONSTRAINT &aConstraint)
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)
@ NPTH
like PAD_PTH, but not plated
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