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 );
287 auto testPadAgainstCourtyards =
292 if(
pad->GetAttribute() == PAD_ATTRIB::PTH )
294 else if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
304 std::shared_ptr<SHAPE_SEGMENT> hole =
pad->GetEffectiveHoleShape();
311 drce->SetItems(
pad, fp );
317 drce->SetItems(
pad, fp );
326 for(
const PAD* padB : fpB->
Pads() )
327 testPadAgainstCourtyards( padB, fpA );
333 for(
const PAD* padA : fpA->
Pads() )
334 testPadAgainstCourtyards( padA, fpB );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINTS & Footprints()
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 bool reportProgress(int aCount, int aSize, int aDelta)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
void reportAux(const wxString &aMsg)
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