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 [&]( std::pair<
ZONE* ,
ZONE* > areaZonePair ) ->
size_t
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 std::vector<std::future<size_t>> returns;
174 returns.reserve( toCache.size() );
176 for(
const std::pair<ZONE*, ZONE*>& areaZonePair : toCache )
177 returns.emplace_back(
tp.submit( query_areas, areaZonePair ) );
179 for(
const std::future<size_t>& ret : returns )
181 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
183 while( status != std::future_status::ready )
186 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
196 const int progressDelta = 250;
197 int ii =
static_cast<int>( toCache.size() );
199 auto checkTextOnEdgeCuts =
210 drc->SetItems( item );
216 auto checkAntiTrackKeepout =
224 &dummyActual, &pos ) )
228 drcItem->SetItems( track );
242 PCB_LAYER_ID layer = item->GetLayerSet().ExtractLayer();
249 msg.Printf( drcItem->GetErrorText() + wxS(
" (%s)" ), constraint.
GetName() );
251 drcItem->SetErrorMessage( msg );
252 drcItem->SetItems( item );
263 checkTextOnEdgeCuts( item );
267 if(
ZONE* zone =
dynamic_cast<ZONE*
>( item ) )
269 if( zone->GetIsRuleArea() && zone->HasKeepoutParametersSet() )
280 antiTrackKeepouts->QueryColliding( track, layer, layer,
289 checkAntiTrackKeepout( track,
static_cast<ZONE*
>( other ) );
295 checkDisallow( item );
297 if( item->HasHole() )
300 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
bool IsErrorLimitExceeded(int error_code)
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
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).
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, DRC_CUSTOM_MARKER_HANDLER *aCustomHandler=nullptr)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
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
#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 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)