53 virtual bool Run()
override;
55 virtual const wxString
GetName()
const override {
return wxT(
"silk_clearance" ); };
66 const int progressDelta = 500;
74 bool checkIndividualMaskItems =
m_board->GetDesignSettings().m_SolderMaskMinWidth <= 0;
88 if( !
reportPhase(
_(
"Checking silkscreen for overlapping items..." ) ) )
113 if( item->IsOnLayer( layer ) )
114 silkTree.
Insert( item, layer );
120 auto addToTargetTree =
127 targetTree.
Insert( item, layer );
138 REPORT_AUX( wxString::Format( wxT(
"Testing %d silkscreen features against %d board items." ),
140 targetTree.
size() ) );
142 const std::vector<DRC_RTREE::LAYER_PAIR> layerPairs =
171 const SHAPE* testShape = aTestItemShape->
shape;
173 std::shared_ptr<SHAPE> hole;
184 if( testItem->
IsTented( aLayers.first ) )
189 testShape = hole.get();
199 refItem, testItem, aLayers.second );
200 int minClearance = -1;
205 if( aLayers.second ==
F_Mask || aLayers.second ==
B_Mask )
207 if( checkIndividualMaskItems )
208 minClearance = std::max( minClearance, 0 );
213 if( minClearance < 0 || m_drcEngine->IsErrorLimitExceeded( errorCode ) )
229 if( aLayers.first == aLayers.second )
233 std::swap( refItem, testItem );
234 std::swap( refShape, testShape );
238 if( refShape->
Collide( testShape, minClearance, &
actual, &pos ) )
242 if( minClearance > 0 )
244 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
249 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
252 drcItem->SetItems( refItem, testItem );
255 *aCollisionDetected =
true;
261 [&](
int aCount,
int aSize ) ->
bool
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINT * GetParentFootprint() const
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 ...
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
virtual bool HasHole() const
Information pertinent to a Pcbnew printed circuit board.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
DRC_RULE * GetParentRule() const
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.
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
virtual bool reportPhase(const wxString &aStageName)
void reportTwoShapeGeometry(std::shared_ptr< DRC_ITEM > &aDrcItem, const VECTOR2I &aMarkerPos, const SHAPE *aShape1, const SHAPE *aShape2, PCB_LAYER_ID aLayer, int aDistance)
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
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
KICAD_T Type() const
Returns the type of object.
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.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
@ 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
VECTOR2< int32_t > VECTOR2I