46 virtual bool Run()
override;
48 virtual const wxString
GetName()
const override {
return wxT(
"segment_length" ); };
56 REPORT_AUX( wxT(
"Track segment length violations ignored. Tests not run." ) );
62 REPORT_AUX( wxT(
"No track segment length constraints found. Tests not run." ) );
66 if( !
reportPhase(
_(
"Checking track segment lengths..." ) ) )
69 auto checkTrackSegmentLength =
99 bool fail_min =
false;
100 bool fail_max =
false;
101 int constraintLength = 0;
105 if( constraint.Value().HasMin() &&
actual < constraint.Value().Min() )
108 constraintLength = constraint.
Value().
Min();
111 if( constraint.Value().HasMax() &&
actual > constraint.Value().Max() )
114 constraintLength = constraint.Value().Max();
118 if( fail_min || fail_max )
121 wxString constraintName = constraint.GetName();
126 if( constraint.m_ImplicitMin )
127 constraintName =
_(
"board setup constraints" );
129 msg =
formatMsg(
_(
"(%s min length %s; actual %s)" ),
136 msg =
formatMsg(
_(
"(%s max length %s; actual %s)" ),
142 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
143 drcItem->SetItems( item );
144 drcItem->SetViolatingRule( constraint.GetParentRule() );
152 const int progressDelta = 250;
156 std::vector<std::future<bool>> returns;
162 returns.emplace_back(
tp.submit( checkTrackSegmentLength, item ) );
165 for( std::future<bool>& ret : returns )
167 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
169 while( status != std::future_status::ready )
172 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 ~DRC_TEST_PROVIDER_TRACK_SEGMENT_LENGTH()=default
DRC_TEST_PROVIDER_TRACK_SEGMENT_LENGTH()
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
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...
virtual bool reportPhase(const wxString &aStageName)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, DRC_CUSTOM_MARKER_HANDLER *aCustomHandler=nullptr)
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
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
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::thread_pool 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)