59 virtual bool Run()
override;
61 virtual const wxString
GetName()
const override
63 return wxT(
"zone connections" );
68 return wxT(
"Checks thermal reliefs for a sufficient number of connecting spokes" );
80 std::shared_ptr<CONNECTIVITY_DATA> connectivity = board->
GetConnectivity();
91 auto layerIter = zoneIter->second.find( aLayer );
93 if( layerIter != zoneIter->second.end() )
94 isolatedIslands = layerIter->second;
99 for(
PAD*
pad : footprint->Pads() )
114 BOX2I item_bbox =
pad->GetBoundingBox();
119 if( !
pad->FlashLayer( aLayer ) )
126 constraint = bds.
m_DRCEngine->EvalZoneConnection(
pad, aZone, aLayer );
129 if( conn != ZONE_CONNECTION::THERMAL )
149 int ignoredSpokes = 0;
152 for(
int jj = 0; jj < zoneFill->OutlineCount(); ++jj )
154 std::vector<SHAPE_LINE_CHAIN::INTERSECTION> intersections;
156 zoneFill->Outline( jj ).Intersect( padOutline, intersections,
true, &padBBox );
161 if( intersections.size() >= 2 )
165 ignoredSpokes += (int) intersections.size() / 2;
166 ignoredSpokePos = ( intersections[0].p + intersections[1].p ) / 2;
170 spokes += (int) intersections.size() / 2;
175 if( spokes == 0 && ignoredSpokes == 0 )
178 if( spokes >= minCount )
185 for(
PCB_TRACK* track : connectivity->GetConnectedTracks(
pad ) )
192 else if( padOutline.
PointInside( track->GetEnd() ) )
207 spokes += ignoredSpokes;
215 if( spokes < minCount )
222 msg = wxString::Format(
_(
"(layer %s; %d spokes connected to isolated island)" ),
225 pos = ignoredSpokePos;
229 msg = wxString::Format(
_(
"(layer %s; %s min spoke count %d; actual %d)" ),
234 pos =
pad->GetPosition();
237 drce->SetErrorMessage( drce->GetErrorText() + wxS(
" " ) + msg );
238 drce->SetItems( aZone,
pad );
251 std::shared_ptr<CONNECTIVITY_DATA> connectivity = board->
GetConnectivity();
254 if( !
reportPhase(
_(
"Checking thermal reliefs..." ) ) )
257 std::vector< std::pair<ZONE*, PCB_LAYER_ID> > zoneLayers;
258 std::atomic<size_t> done( 1 );
259 size_t total_effort = 0;
267 zoneLayers.push_back( { zone, layer } );
273 total_effort = std::max( (
size_t) 1, total_effort );
276 std::vector<std::future<int>> returns;
278 returns.reserve( zoneLayers.size() );
280 for(
const std::pair<ZONE*, PCB_LAYER_ID>& zonelayer : zoneLayers )
282 returns.emplace_back(
tp.submit(
285 if( !m_drcEngine->IsCancelled() )
287 testZoneLayer( aZone, aLayer );
288 done.fetch_add( aZone->GetFilledPolysList( aLayer )->FullPointCount() );
293 zonelayer.first, zonelayer.second ) );
296 for(
const std::future<int>& ret : returns )
298 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
300 while( status != std::future_status::ready )
302 reportProgress( done, total_effort );
303 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
307 return !m_drcEngine->IsCancelled();
constexpr int ARC_LOW_DEF
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Information pertinent to a Pcbnew printed circuit board.
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
std::vector< ZONE * > m_DRCCopperZones
const FOOTPRINTS & Footprints() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
SEVERITY GetSeverity() const
ZONE_CONNECTION m_ZoneConnection
DRC_RULE * GetParentRule() const
bool IsErrorLimitExceeded(int error_code)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual ~DRC_TEST_PROVIDER_ZONE_CONNECTIONS()
virtual const wxString GetName() const override
void testZoneLayer(ZONE *aZone, PCB_LAYER_ID aLayer)
virtual const wxString GetDescription() const override
DRC_TEST_PROVIDER_ZONE_CONNECTIONS()
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)
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
Handle a list of polygons defining a copper zone.
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList(PCB_LAYER_ID aLayer) const
const BOX2I GetBoundingBox() const override
bool IsTeardropArea() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
@ MIN_RESOLVED_SPOKES_CONSTRAINT
@ THERMAL_RELIEF_GAP_CONSTRAINT
PCB_LAYER_ID
A quick note on layer IDs:
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
A struct recording the isolated and single-pad islands within a zone.
std::vector< int > m_SingleConnectionOutlines
BS::thread_pool thread_pool
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
ZONE_CONNECTION
How pads are covered by copper in zone.