55 virtual bool Run()
override;
57 virtual const wxString
GetName()
const override {
return wxT(
"disallow" ); };
63 if( !
reportPhase(
_(
"Checking keepouts & disallow constraints..." ) ) )
72 std::vector<ZONE*> antiCopperKeepouts;
73 std::vector<ZONE*> copperZones;
74 std::vector<std::pair<ZONE*, ZONE*>> toCache;
75 std::atomic<size_t> done( 1 );
77 std::unique_ptr<DRC_RTREE> antiTrackKeepouts = std::make_unique<DRC_RTREE>();
82 ZONE* zone =
static_cast<ZONE*
>( item );
86 antiCopperKeepouts.push_back( zone );
91 antiTrackKeepouts->Insert( zone, layer );
95 copperZones.push_back( zone );
103 for(
ZONE* ruleArea : antiCopperKeepouts )
105 for(
ZONE* copperZone : copperZones )
107 toCache.push_back( { ruleArea, copperZone } );
113 [&](
const int idx ) ->
size_t
117 const auto& areaZonePair = toCache[idx];
118 ZONE* ruleArea = areaZonePair.first;
119 ZONE* copperZone = areaZonePair.second;
122 bool isInside =
false;
137 for(
size_t ii = 0; ii < ruleArea->
GetLayerSet().size(); ++ii )
162 std::unique_lock<std::shared_mutex> writeLock( board->
m_CachesMutex );
172 auto futures =
tp.submit_loop( 0, toCache.size(), query_areas );
174 for(
auto& ret : futures )
176 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
178 while( status != std::future_status::ready )
181 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
191 const int progressDelta = 250;
192 int ii =
static_cast<int>( toCache.size() );
194 auto checkTextOnEdgeCuts =
205 drc->SetItems( item );
211 auto checkAntiTrackKeepout =
219 &dummyActual, &pos ) )
223 drcItem->SetItems( track );
237 PCB_LAYER_ID layer = item->GetLayerSet().ExtractLayer();
244 msg.Printf( drcItem->GetErrorText() + wxS(
" (%s)" ), constraint.
GetName() );
246 drcItem->SetErrorMessage( msg );
247 drcItem->SetItems( item );
258 checkTextOnEdgeCuts( item );
262 if(
ZONE* zone =
dynamic_cast<ZONE*
>( item ) )
264 if( zone->GetIsRuleArea() && zone->HasKeepoutParametersSet() )
275 antiTrackKeepouts->QueryColliding( track, layer, layer,
284 checkAntiTrackKeepout( track,
static_cast<ZONE*
>( other ) );
290 checkDisallow( item );
292 if( item->HasHole() )
295 checkDisallow( item );
constexpr int ARC_LOW_DEF
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
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.
Information pertinent to a Pcbnew printed circuit board.
int m_DRCMaxPhysicalClearance
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_mutex m_CachesMutex
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
constexpr bool Intersects(const BOX2< Vec > &aRect) const
SEVERITY GetSeverity() const
DRC_RULE * GetParentRule() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Implement an R-tree for fast spatial and layer indexing of connectable items.
int QueryColliding(BOARD_ITEM *aRefItem, PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer, std::function< bool(BOARD_ITEM *)> aFilter=nullptr, std::function< bool(BOARD_ITEM *)> aVisitor=nullptr, int aClearance=0) const
This is a fast test which essentially does bounding-box overlap given a worst-case clearance.
virtual ~DRC_TEST_PROVIDER_DISALLOW()=default
DRC_TEST_PROVIDER_DISALLOW()
virtual const wxString GetName() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual bool reportPhase(const wxString &aStageName)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::vector< PCB_SHAPE > &aShapes={})
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
static const LSET & AllLayersMask()
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Represent a set of closed polygons.
void Fracture()
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
SHAPE_POLY_SET CloneDropTriangulation() const
Handle a list of polygons defining a copper zone.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
const BOX2I GetBoundingBox() const override
bool GetDoNotAllowTracks() const
SHAPE_POLY_SET * Outline()
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool GetDoNotAllowZoneFills() const
bool IsOnCopperLayer() const override
@ ALLOW_ACUTE_CORNERS
just inflate the polygon. Acute angles create spikes
#define HOLE_PROXY
Indicates the BOARD_ITEM is a proxy for its hole.
PCB_LAYER_ID
A quick note on layer IDs:
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
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I