56 virtual bool Run()
override;
58 virtual const wxString
GetName()
const override
60 return wxT(
"disallow" );
65 return wxT(
"Tests for disallowed items (e.g. keepouts)" );
72 if( !
reportPhase(
_(
"Checking keepouts & disallow constraints..." ) ) )
81 std::vector<ZONE*> antiCopperKeepouts;
82 std::vector<ZONE*> copperZones;
83 std::vector<std::pair<ZONE*, ZONE*>> toCache;
84 std::atomic<size_t> done( 1 );
90 ZONE* zone =
dynamic_cast<ZONE*
>( item );
93 antiCopperKeepouts.push_back( zone );
95 copperZones.push_back( zone );
102 for(
ZONE* ruleArea : antiCopperKeepouts )
104 for(
ZONE* copperZone : copperZones )
106 toCache.push_back( { ruleArea, copperZone } );
112 [&]( std::pair<
ZONE* ,
ZONE* > areaZonePair ) ->
size_t
117 ZONE* ruleArea = areaZonePair.first;
118 ZONE* copperZone = areaZonePair.second;
121 bool isInside =
false;
156 std::unique_lock<std::mutex> cacheLock( board->
m_CachesMutex );
166 std::vector<std::future<size_t>> returns;
168 returns.reserve( toCache.size() );
170 for(
const std::pair<ZONE*, ZONE*>& areaZonePair : toCache )
171 returns.emplace_back(
tp.submit( query_areas, areaZonePair ) );
173 for(
const std::future<size_t>& ret : returns )
175 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
177 while( status != std::future_status::ready )
180 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
190 const int progressDelta = 250;
191 int ii =
static_cast<int>( toCache.size() );
193 auto checkTextOnEdgeCuts =
202 drc->SetItems( item );
222 msg.Printf( drcItem->GetErrorText() + wxS(
" (%s)" ), constraint.
GetName() );
224 drcItem->SetErrorMessage( msg );
225 drcItem->SetItems( item );
226 drcItem->SetViolatingRule( rule );
228 if( item->GetLayerSet().count() )
229 layer = item->GetLayerSet().Seq().front();
236 if(
ZONE* keepout =
dynamic_cast<ZONE*
>( ruleItem ) )
242 &dummyActual, &pos );
254 checkTextOnEdgeCuts( item );
258 ZONE* zone =
dynamic_cast<ZONE*
>( item );
265 checkDisallow( item );
267 if( item->HasHole() )
270 checkDisallow( item );
constexpr int ARC_LOW_DEF
int GetDRCEpsilon() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Information pertinent to a Pcbnew printed circuit board.
BOARD_ITEM * GetItem(const KIID &aID) const
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
bool Intersects(const BOX2< Vec > &aRect) const
SEVERITY GetSeverity() const
DRC_RULE * GetParentRule() const
bool ReportProgress(double aProgress)
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()
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 const wxString GetDescription() const override
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)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, LSET aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
virtual bool reportProgress(int aCount, int aSize, int aDelta)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
virtual void reportRuleStatistics()
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
static LSET AllLayersMask()
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Represent a set of closed polygons.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
@ ALLOW_ACUTE_CORNERS
just inflate the polygon. Acute angles create spikes
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
SHAPE_POLY_SET * Outline()
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool GetDoNotAllowCopperPour() 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_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type