52 virtual bool Run()
override;
54 virtual const wxString
GetName()
const override {
return wxT(
"silk_clearance" ); };
65 const int progressDelta = 500;
87 if( !
reportPhase(
_(
"Checking silkscreen for overlapping items..." ) ) )
112 if( item->IsOnLayer( layer ) )
113 silkTree.
Insert( item, layer );
119 auto addToTargetTree =
126 targetTree.
Insert( item, layer );
137 REPORT_AUX( wxString::Format( wxT(
"Testing %d silkscreen features against %d board items." ),
139 targetTree.
size() ) );
141 const std::vector<DRC_RTREE::LAYER_PAIR> layerPairs =
170 const SHAPE* testShape = aTestItemShape->
shape;
172 std::shared_ptr<SHAPE> hole;
183 if( testItem->
IsTented( aLayers.first ) )
185 if( testItem->HasHole() )
187 hole = testItem->GetEffectiveHoleShape();
188 testShape = hole.get();
198 refItem, testItem, aLayers.second );
199 int minClearance = -1;
204 if( aLayers.second ==
F_Mask || aLayers.second ==
B_Mask )
206 if( checkIndividualMaskItems )
207 minClearance = std::max( minClearance, 0 );
209 errorCode = DRCE_SILK_MASK_CLEARANCE;
212 if( minClearance < 0 || m_drcEngine->IsErrorLimitExceeded( errorCode ) )
221 && refItem->GetParentFootprint() == testItem->GetParentFootprint() )
228 if( aLayers.first == aLayers.second )
230 if( refItem->m_Uuid > testItem->m_Uuid )
232 std::swap( refItem, testItem );
233 std::swap( refShape, testShape );
237 if( refShape->Collide( testShape, minClearance, &
actual, &pos ) )
239 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( errorCode );
241 if( minClearance > 0 )
243 wxString msg = formatMsg( _(
"(%s clearance %s; actual %s)" ),
244 constraint.GetParentRule()->m_Name,
248 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
251 drcItem->SetItems( refItem, testItem );
252 drcItem->SetViolatingRule( constraint.GetParentRule() );
254 reportViolation( drcItem, pos, aLayers.second );
256 *aCollisionDetected =
true;
262 [&](
int aCount,
int aSize ) ->
bool
264 return reportProgress( aCount, aSize, progressDelta );
267 return !m_drcEngine->IsCancelled();
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual bool IsTented(PCB_LAYER_ID aLayer) const
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
Information pertinent to a Pcbnew printed circuit board.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() 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)
bool QueryWorstConstraint(DRC_CONSTRAINT_T aRuleId, DRC_CONSTRAINT &aConstraint)
Implement an R-tree for fast spatial and layer indexing of connectable items.
void Insert(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int aWorstClearance=0)
Insert an item into the tree on a particular layer with an optional worst clearance.
size_t size() const
Return the number of items in the tree.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > LAYER_PAIR
int QueryCollidingPairs(DRC_RTREE *aRefTree, std::vector< LAYER_PAIR > aLayerPairs, std::function< bool(const LAYER_PAIR &, ITEM_WITH_SHAPE *, ITEM_WITH_SHAPE *, bool *aCollision)> aVisitor, int aMaxClearance, std::function< bool(int, int)> aProgressReporter) const
virtual const wxString GetName() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
DRC_TEST_PROVIDER_SILK_CLEARANCE()
virtual ~DRC_TEST_PROVIDER_SILK_CLEARANCE()=default
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, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
static std::vector< KICAD_T > s_allBasicItems
bool isInvisibleText(const BOARD_ITEM *aItem) const
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
LSET is a set of PCB_LAYER_IDs.
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
An abstract shape on 2D plane.
@ DRCE_SILK_MASK_CLEARANCE
@ SILK_CLEARANCE_CONSTRAINT
PCB_LAYER_ID
A quick note on layer IDs:
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers