55 virtual bool Run()
override;
57 virtual const wxString
GetName()
const override
59 return wxT(
"silk_clearance" );
64 return wxT(
"Tests for overlapping silkscreen features." );
76 const int progressDelta = 500;
100 if( !
reportPhase(
_(
"Checking silkscreen for overlapping items..." ) ) )
123 if( item->IsOnLayer( layer ) )
124 silkTree.
Insert( item, layer );
130 auto addToTargetTree =
137 targetTree.
Insert( item, layer );
154 reportAux( wxT(
"Testing %d silkscreen features against %d board items." ),
158 const std::vector<DRC_RTREE::LAYER_PAIR> layerPairs =
187 const SHAPE* testShape = aTestItemShape->
shape;
189 std::shared_ptr<SHAPE> hole;
200 if( testItem->
IsTented( aLayers.first ) )
202 if( testItem->HasHole() )
204 hole = testItem->GetEffectiveHoleShape();
205 testShape = hole.get();
215 refItem, testItem, aLayers.second );
216 int minClearance = -1;
221 if( aLayers.second ==
F_Mask || aLayers.second ==
B_Mask )
223 if( checkIndividualMaskItems )
224 minClearance = std::max( minClearance, 0 );
226 errorCode = DRCE_SILK_MASK_CLEARANCE;
229 if( minClearance < 0 )
238 && refItem->GetParentFootprint() == testItem->GetParentFootprint() )
245 if( aLayers.first == aLayers.second )
247 if( refItem->m_Uuid > testItem->m_Uuid )
249 std::swap( refItem, testItem );
250 std::swap( refShape, testShape );
254 if( refShape->Collide( testShape, minClearance, &
actual, &pos ) )
256 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( errorCode );
258 if( minClearance > 0 )
260 wxString msg = formatMsg( _(
"(%s clearance %s; actual %s)" ),
261 constraint.GetParentRule()->m_Name,
265 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
268 drcItem->SetItems( refItem, testItem );
269 drcItem->SetViolatingRule( constraint.GetParentRule() );
271 reportViolation( drcItem, pos, aLayers.second );
273 *aCollisionDetected =
true;
279 [&](
int aCount,
int aSize ) ->
bool
281 return reportProgress( aCount, aSize, progressDelta );
284 reportRuleStatistics();
286 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).
virtual const wxString GetDescription() const override
DRC_TEST_PROVIDER_SILK_CLEARANCE()
virtual ~DRC_TEST_PROVIDER_SILK_CLEARANCE()
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
void reportAux(const wxString &aMsg)
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