57 virtual bool Run()
override;
59 virtual const wxString
GetName()
const override
61 return wxT(
"courtyard_clearance" );
66 return wxT(
"Tests footprints' courtyard clearance" );
85 if( !
reportPhase(
_(
"Checking footprint courtyard definitions..." ) ) )
90 if( !
reportPhase(
_(
"Gathering footprint courtyards..." ) ) )
95 reportAux( wxT(
"All courtyard violations ignored. Tests not run." ) );
99 const int progressDelta = 500;
116 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
117 drcItem->SetItems( footprint );
122 footprint->BuildCourtyardCaches( &errorHandler );
124 else if( footprint->GetCourtyard(
F_CrtYd ).OutlineCount() == 0
125 && footprint->GetCourtyard(
B_CrtYd ).OutlineCount() == 0 )
134 drcItem->SetItems( footprint );
139 footprint->GetCourtyard(
F_CrtYd ).BuildBBoxCaches();
140 footprint->GetCourtyard(
B_CrtYd ).BuildBBoxCaches();
150 if( !
reportPhase(
_(
"Checking footprints for overlapping courtyards..." ) ) )
153 const int progressDelta = 100;
226 if( frontA.
Collide( &frontB, clearance, &actual, &pos ) )
232 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
237 drce->SetErrorMessage( drce->GetErrorText() + wxS(
" " ) + msg );
241 drce->SetItems( fpA, fpB );
259 if( backA.
Collide( &backB, clearance, &actual, &pos ) )
265 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
270 drce->SetErrorMessage( drce->GetErrorText() + wxS(
" " ) + msg );
274 drce->SetItems( fpA, fpB );
286 bool checkFront =
false;
287 bool checkBack =
false;
313 auto testPadAgainstCourtyards =
318 if(
pad->GetAttribute() == PAD_ATTRIB::PTH )
320 else if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
330 std::shared_ptr<SHAPE_SEGMENT> hole =
pad->GetEffectiveHoleShape();
337 drce->SetItems(
pad, fp );
343 drce->SetItems(
pad, fp );
352 for(
const PAD* padB : fpB->
Pads() )
353 testPadAgainstCourtyards( padB, fpA );
359 for(
const PAD* padA : fpA->
Pads() )
360 testPadAgainstCourtyards( padA, fpB );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const FOOTPRINTS & Footprints() const
bool Intersects(const BOX2< Vec > &aRect) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
DRC_RULE * GetParentRule() const
bool IsErrorLimitExceeded(int error_code)
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
bool QueryWorstConstraint(DRC_CONSTRAINT_T aRuleId, DRC_CONSTRAINT &aConstraint)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
DRC_TEST_PROVIDER_COURTYARD_CLEARANCE()
bool testFootprintCourtyardDefinitions()
int m_largestCourtyardClearance
virtual ~DRC_TEST_PROVIDER_COURTYARD_CLEARANCE()
virtual const wxString GetName() const override
bool testCourtyardClearances()
virtual const wxString GetDescription() const override
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual)
virtual bool reportPhase(const wxString &aStageName)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
void reportAux(const wxString &aMsg)
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
Represent a set of closed polygons.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int OutlineCount() const
Return the number of outlines in the set.
const BOX2I BBoxFromCaches() const
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
@ DRCE_OVERLAPPING_FOOTPRINTS
@ DRCE_MALFORMED_COURTYARD
@ COURTYARD_CLEARANCE_CONSTRAINT
#define MALFORMED_COURTYARDS
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy