46 virtual bool Run()
override;
48 virtual const wxString
GetName()
const override
50 return wxT(
"width" );
55 return wxT(
"Tests track widths" );
64 reportAux( wxT(
"Track width violations ignored. Tests not run." ) );
70 reportAux( wxT(
"No track width constraints found. Tests not run." ) );
77 auto checkTrackWidth =
107 bool fail_min =
false;
108 bool fail_max =
false;
109 int constraintWidth = 0;
113 if( constraint.Value().HasMin() && actual < constraint.Value().Min() )
116 constraintWidth = constraint.
Value().
Min();
119 if( constraint.Value().HasMax() && actual > constraint.Value().Max() )
122 constraintWidth = constraint.Value().Max();
126 if( fail_min || fail_max )
129 wxString constraintName = constraint.GetName();
134 if( constraint.m_ImplicitMin )
135 constraintName =
_(
"board setup constraints" );
137 msg =
formatMsg(
_(
"(%s min width %s; actual %s)" ),
144 msg =
formatMsg(
_(
"(%s max width %s; actual %s)" ),
150 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
151 drcItem->SetItems( item );
152 drcItem->SetViolatingRule( constraint.GetParentRule() );
160 const int progressDelta = 250;
168 if( !checkTrackWidth( item ) )
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const TRACKS & Tracks() const
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...
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 void reportRuleStatistics()
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual int GetWidth() const
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)