49    virtual bool Run() 
override;
 
   51    virtual const wxString 
GetName()
 const override { 
return wxT( 
"angle" ); };
 
 
   59        REPORT_AUX( wxT( 
"Track angle violations ignored. Tests not run." ) );
 
   65        REPORT_AUX( wxT( 
"No track angle constraints found. Tests not run." ) );
 
   72    auto checkTrackAngle =
 
   73            [&]( 
const int ind ) -> 
bool 
   89                std::shared_ptr<CONNECTIVITY_DATA> connectivity = 
m_drcEngine->GetBoard()->GetConnectivity();
 
   91                for( 
PCB_TRACK* other : connectivity->GetConnectedTracks( item ) )
 
   98                    SEG other_segment = 
SEG( other->GetStart(), other->GetEnd() );
 
  102                    if( !intersection_opt.has_value() )
 
  107                    VECTOR2I p0 = intersection_opt.value();
 
  109                    if( 
m_drcEngine->GetBoard()->GetPad( p0, { item->GetLayer() } ) )
 
  120                    bool angle_below_90 = 
false;
 
  122                    if( segment.
B == p0 )
 
  126                    else if( segment.
A != p0 )
 
  128                        angle_below_90 = 
true;
 
  131                    if( other_segment.
B == p0 )
 
  133                        other_direction *= -1;
 
  135                    else if( other_segment.
A != p0 )
 
  137                        angle_below_90 = 
true;
 
  146                    bool fail_min = 
false;
 
  147                    bool fail_max = 
false;
 
  152                        if( constraint.Value().HasMin() && 
actual.AsDegrees() < constraint.Value().Min() )
 
  158                        if( constraint.Value().HasMax() && 
actual.AsDegrees() > constraint.Value().Max() )
 
  165                    if( fail_min || fail_max )
 
  168                        wxString constraintName = constraint.GetName();
 
  173                            msg = 
formatMsg( 
_( 
"(%s min angle %s; actual %s)" ),
 
  180                            msg = 
formatMsg( 
_( 
"(%s max angle %s; actual %s)" ),
 
  186                        drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  187                        drcItem->SetItems( item , other );
 
  188                        drcItem->SetViolatingRule( constraint.GetParentRule() );
 
  197    const int progressDelta = 250;
 
  201    auto futures = 
tp.submit_loop( 0, 
m_drcEngine->GetBoard()->Tracks().size(), checkTrackAngle );
 
  203    for( 
auto& ret : futures )
 
  205        std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
 
  207        while( status != std::future_status::ready )
 
  210            status = ret.wait_for( std::chrono::milliseconds( 250 ) );
 
 
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_ANGLE()=default
 
virtual const wxString GetName() const override
 
DRC_TEST_PROVIDER_TRACK_ANGLE()
 
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
 
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)
 
static EDA_ANGLE Arccos(double x)
 
KICAD_T Type() const
Returns the type of object.
 
const VECTOR2I & GetStart() const
 
const VECTOR2I & GetEnd() const
 
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
 
constexpr extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
 
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
 
static constexpr EDA_ANGLE ANGLE_0
 
static constexpr EDA_ANGLE ANGLE_90
 
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
 
std::optional< VECTOR2I > OPT_VECTOR2I
 
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
 
BS::thread_pool< 0 > thread_pool
 
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D