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 );
348 world->SetMaxClearance( 10000000 );
349 world->SetRuleResolver( &m_ruleResolver );
354 BOOST_TEST_MESSAGE(
"via to via, no violations" );
357 int count = world->QueryColliding(
v1, obstacles );
359 BOOST_CHECK_EQUAL( obstacles.size(), 0 );
360 BOOST_CHECK_EQUAL( count, 0 );
363 BOOST_TEST_MESSAGE(
"via to via, forced copper to copper violation" );
366 m_ruleResolver.m_defaultClearance = 1000000;
367 world->QueryColliding(
v1, obstacles );
370 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
371 const auto& first = *obstacles.begin();
373 BOOST_CHECK_EQUAL( first.m_head,
v1 );
374 BOOST_CHECK_EQUAL( first.m_item,
v2 );
375 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultClearance );
378 BOOST_TEST_MESSAGE(
"via to via, forced hole to hole violation" );
381 m_ruleResolver.m_defaultClearance = 200000;
382 m_ruleResolver.m_defaultHole2Hole = 1000000;
384 world->QueryColliding(
v1, obstacles );
387 BOOST_CHECK_EQUAL( obstacles.size(), 1 );
388 auto iter = obstacles.begin();
389 const auto& first = *iter++;
391 BOOST_CHECK_EQUAL( first.m_head,
v1->Hole() );
392 BOOST_CHECK_EQUAL( first.m_item,
v2->Hole() );
393 BOOST_CHECK_EQUAL( first.m_clearance, m_ruleResolver.m_defaultHole2Hole );
396 BOOST_TEST_MESSAGE(
"via to via, forced copper to hole violation" );
399 m_ruleResolver.m_defaultHole2Hole = 220000;
400 m_ruleResolver.m_defaultHole2Copper = 1000000;
402 world->QueryColliding(
v1, obstacles );
405 BOOST_CHECK_EQUAL( obstacles.size(), 2 );
406 auto iter = obstacles.begin();
407 const auto& first = *iter++;
410 BOOST_CHECK( ( first.m_head ==
v1 && first.m_item ==
v2->Hole() )
411 || ( first.m_head ==
v1->Hole() && first.m_item ==
v2 ) );
413 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