42 virtual bool Run()
override;
44 virtual const wxString
GetName()
const override {
return wxT(
"segment_length" ); };
52 REPORT_AUX( wxT(
"Track segment length violations ignored. Tests not run." ) );
58 REPORT_AUX( wxT(
"No track segment length constraints found. Tests not run." ) );
62 if( !
reportPhase(
_(
"Checking track segment lengths..." ) ) )
65 auto checkTrackSegmentLength =
66 [&](
const int idx ) ->
bool
96 bool fail_min =
false;
97 bool fail_max =
false;
98 int constraintLength = 0;
102 if( constraint.Value().HasMin() &&
actual < constraint.Value().Min() )
105 constraintLength = constraint.Value().Min();
108 if( constraint.Value().HasMax() &&
actual > constraint.Value().Max() )
111 constraintLength = constraint.Value().Max();
115 if( fail_min || fail_max )
118 wxString constraintName = constraint.GetName();
122 if( constraint.m_ImplicitMin )
123 constraintName =
_(
"board setup constraints" );
125 drcItem->SetErrorDetail(
formatMsg(
_(
"(%s min length %s; actual %s)" ),
132 drcItem->SetErrorDetail(
formatMsg(
_(
"(%s max length %s; actual %s)" ),
138 drcItem->SetItems( item );
139 drcItem->SetViolatingRule( constraint.GetParentRule() );
147 const int progressDelta = 250;
151 auto futures =
tp.submit_loop( 0,
m_drcEngine->GetBoard()->Tracks().size(), checkTrackSegmentLength );
153 for(
auto& ret : futures )
155 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
157 while( status != std::future_status::ready )
160 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)
void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::function< void(PCB_MARKER *)> &aPathGenerator=[](PCB_MARKER *){})
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::priority_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)
VECTOR2< int32_t > VECTOR2I