48 virtual bool Run()
override;
50 virtual const wxString
GetName()
const override
52 return wxT(
"width" );
57 return wxT(
"Tests track widths" );
66 reportAux( wxT(
"Track width violations ignored. Tests not run." ) );
72 reportAux( wxT(
"No track width constraints found. Tests not run." ) );
79 auto checkTrackWidth =
88 if(
PCB_ARC* arc = dyn_cast<PCB_ARC*>( item ) )
90 actual = arc->GetWidth();
93 else if(
PCB_TRACK* trk = dyn_cast<PCB_TRACK*>( item ) )
95 actual = trk->GetWidth();
96 p0 = ( trk->GetStart() + trk->GetEnd() ) / 2;
105 bool fail_min =
false;
106 bool fail_max =
false;
107 int constraintWidth = 0;
111 if( constraint.Value().HasMin() && actual < constraint.Value().Min() )
114 constraintWidth = constraint.
Value().
Min();
117 if( constraint.Value().HasMax() && actual > constraint.Value().Max() )
120 constraintWidth = constraint.Value().Max();
124 if( fail_min || fail_max )
131 msg =
formatMsg(
_(
"(%s min width %s; actual %s)" ),
132 constraint.GetName(),
138 msg =
formatMsg(
_(
"(%s max width %s; actual %s)" ),
139 constraint.GetName(),
144 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
145 drcItem->SetItems( item );
146 drcItem->SetViolatingRule( constraint.GetParentRule() );
154 const int progressDelta = 250;
162 if( !checkTrackWidth( item ) )
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
MINOPTMAX< int > & Value()
bool HasRulesForConstraintType(DRC_CONSTRAINT_T constraintID)
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)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
DRC_TEST_PROVIDER_TRACK_WIDTH()
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_TRACK_WIDTH()
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual const wxString GetDescription() const override
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out DRC_ITEM and posi...
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)
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, int aConstraint, int aActual)
virtual void reportRuleStatistics()
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy