57 virtual bool Run()
override;
59 virtual const wxString
GetName()
const override
61 return wxT(
"disallow" );
66 return wxT(
"Tests for disallowed items (e.g. keepouts)" );
73 if( !
reportPhase(
_(
"Checking keepouts & disallow constraints..." ) ) )
82 std::vector<ZONE*> antiCopperKeepouts;
83 std::vector<ZONE*> copperZones;
84 std::vector<std::pair<ZONE*, ZONE*>> toCache;
85 std::atomic<size_t> done( 1 );
91 ZONE* zone =
dynamic_cast<ZONE*
>( item );
96 antiCopperKeepouts.push_back( zone );
100 copperZones.push_back( zone );
108 for(
ZONE* ruleArea : antiCopperKeepouts )
110 for(
ZONE* copperZone : copperZones )
112 toCache.push_back( { ruleArea, copperZone } );
118 [&]( std::pair<
ZONE* ,
ZONE* > areaZonePair ) ->
size_t
123 ZONE* ruleArea = areaZonePair.first;
124 ZONE* copperZone = areaZonePair.second;
127 bool isInside =
false;
142 for(
size_t ii = 0; ii < ruleArea->
GetLayerSet().size(); ++ii )
167 std::unique_lock<std::shared_mutex> writeLock( board->
m_CachesMutex );
177 std::vector<std::future<size_t>> returns;
179 returns.reserve( toCache.size() );
181 for(
const std::pair<ZONE*, ZONE*>& areaZonePair : toCache )
182 returns.emplace_back(
tp.submit( query_areas, areaZonePair ) );
184 for(
const std::future<size_t>& ret : returns )
186 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
188 while( status != std::future_status::ready )
191 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
201 const int progressDelta = 250;
202 int ii =
static_cast<int>( toCache.size() );
204 auto checkTextOnEdgeCuts =
213 drc->SetItems( item );
230 PCB_LAYER_ID layer = item->GetLayerSet().ExtractLayer();
233 msg.Printf( drcItem->GetErrorText() + wxS(
" (%s)" ), constraint.
GetName() );
235 drcItem->SetErrorMessage( msg );
236 drcItem->SetItems( item );
237 drcItem->SetViolatingRule( rule );
244 if(
ZONE* keepout =
dynamic_cast<ZONE*
>( ruleItem ) )
250 &dummyActual, &pos );
262 checkTextOnEdgeCuts( item );
266 ZONE* zone =
dynamic_cast<ZONE*
>( item );
273 checkDisallow( item );
275 if( item->HasHole() )
278 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::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()
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 void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
virtual void reportRuleStatistics()
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
static LSET AllLayersMask()
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...
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 HasKeepoutParametersSet() const
Accessor to determine if any keepout parameters are set.
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
BS::thread_pool thread_pool
thread_pool & GetKiCadThreadPool()
Get a reference to the current 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_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type