47 virtual bool Run()
override;
49 virtual const wxString
GetName()
const override
51 return wxT(
"segment_length" );
56 return wxT(
"Tests track segment lengths" );
65 reportAux( wxT(
"Track segment length violations ignored. Tests not run." ) );
71 reportAux( wxT(
"No track segment length constraints found. Tests not run." ) );
75 if( !
reportPhase(
_(
"Checking track segment lengths..." ) ) )
78 auto checkTrackSegmentLength =
108 bool fail_min =
false;
109 bool fail_max =
false;
110 int constraintLength = 0;
114 if( constraint.Value().HasMin() && actual < constraint.Value().Min() )
117 constraintLength = constraint.
Value().
Min();
120 if( constraint.Value().HasMax() && actual > constraint.Value().Max() )
123 constraintLength = constraint.Value().Max();
127 if( fail_min || fail_max )
130 wxString constraintName = constraint.GetName();
135 if( constraint.m_ImplicitMin )
136 constraintName =
_(
"board setup constraints" );
138 msg =
formatMsg(
_(
"(%s min length %s; actual %s)" ),
145 msg =
formatMsg(
_(
"(%s max length %s; actual %s)" ),
151 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
152 drcItem->SetItems( item );
153 drcItem->SetViolatingRule( constraint.GetParentRule() );
161 const int progressDelta = 250;
165 std::vector<std::future<bool>> returns;
171 returns.emplace_back(
tp.submit( checkTrackSegmentLength, item ) );
174 for( std::future<bool>& ret : returns )
176 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
178 while( status != std::future_status::ready )
181 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
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.
virtual const wxString GetDescription() const override
DRC_TEST_PROVIDER_TRACK_SEGMENT_LENGTH()
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual ~DRC_TEST_PROVIDER_TRACK_SEGMENT_LENGTH()
virtual const wxString GetName() 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)
virtual double GetLength() const override
Return the length of the arc track.
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
@ DRCE_TRACK_SEGMENT_LENGTH
@ TRACK_SEGMENT_LENGTH_CONSTRAINT
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
BS::thread_pool thread_pool
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
@ 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)