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 =
70 [&](
const int idx ) ->
bool
100 bool fail_min =
false;
101 bool fail_max =
false;
102 int constraintLength = 0;
106 if( constraint.Value().HasMin() &&
actual < constraint.Value().Min() )
109 constraintLength = constraint.Value().Min();
112 if( constraint.Value().HasMax() &&
actual > constraint.Value().Max() )
115 constraintLength = constraint.Value().Max();
119 if( fail_min || fail_max )
122 wxString constraintName = constraint.GetName();
127 if( constraint.m_ImplicitMin )
128 constraintName =
_(
"board setup constraints" );
130 msg =
formatMsg(
_(
"(%s min length %s; actual %s)" ),
137 msg =
formatMsg(
_(
"(%s max length %s; actual %s)" ),
143 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
144 drcItem->SetItems( item );
145 drcItem->SetViolatingRule( constraint.GetParentRule() );
153 const int progressDelta = 250;
157 auto futures =
tp.submit_loop( 0,
m_drcEngine->GetBoard()->Tracks().size(), checkTrackSegmentLength );
159 for(
auto& ret : futures )
161 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
163 while( status != std::future_status::ready )
166 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...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
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
virtual bool reportPhase(const wxString &aStageName)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::vector< PCB_SHAPE > &aShapes={})
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)
KICAD_T Type() const
Returns the type of object.
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< 0 > 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)
VECTOR2< int32_t > VECTOR2I