50 virtual bool Run()
override;
52 virtual const wxString
GetName()
const override {
return wxT(
"hole_to_hole_clearance" ); };
68 return std::make_shared<SHAPE_SEGMENT>(
via->GetCenter(),
via->GetCenter(),
69 via->GetDrillValue() );
75 return static_cast<PAD*
>( aItem )->GetEffectiveHoleShape();
78 return std::make_shared<SHAPE_SEGMENT>(
VECTOR2I( 0, 0 ),
VECTOR2I( 0, 0 ), 0 );
87 REPORT_AUX( wxT(
"Hole to hole violations ignored. Tests not run." ) );
101 REPORT_AUX( wxT(
"No hole to hole constraints found. Skipping check." ) );
105 if( !
reportPhase(
_(
"Checking hole to hole clearances..." ) ) )
108 const size_t progressDelta = 200;
150 std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
178 if(
static_cast<void*
>( a ) >
static_cast<void*
>( b ) )
181 if( checkedPairs.find( { a, b } ) != checkedPairs.end() )
187 checkedPairs[ { a, b } ] = 1;
205 for(
PAD*
pad : footprint->Pads() )
224 if(
static_cast<void*
>( a ) >
static_cast<void*
>( b ) )
227 if( checkedPairs.find( { a, b } ) != checkedPairs.end() )
233 checkedPairs[ { a, b } ] = 1;
260 if( !reportCoLocation && !reportHole2Hole )
263 std::shared_ptr<SHAPE_SEGMENT> otherHole =
getHoleShape( aOther );
272 if( ( viaHoleLayers &
static_cast<PCB_VIA*
>( aOther )->GetLayerSet() ).none() )
277 if( ( aHole->
GetCenter() - otherHole->GetCenter() ).SquaredEuclideanNorm() < epsilon_sq )
279 if( reportCoLocation )
284 std::swap( aItem, aOther );
287 drcItem->SetItems( aItem, aOther );
292 else if( reportHole2Hole )
303 int minClearance = std::max( 0, constraint.GetValue().Min() -
epsilon );
307 &&
actual < minClearance )
312 std::swap( aItem, aOther );
315 drcItem->SetErrorDetail(
formatMsg(
_(
"(%s min %s; actual %s)" ),
316 constraint.GetName(),
319 drcItem->SetItems( aItem, aOther );
320 drcItem->SetViolatingRule( constraint.GetParentRule() );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
const MINOPTMAX< int > & GetValue() 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.
DRC_TEST_PROVIDER_HOLE_TO_HOLE()
int m_largestHoleToHoleClearance
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_HOLE_TO_HOLE()=default
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
bool testHoleAgainstHole(BOARD_ITEM *aItem, SHAPE_SEGMENT *aHole, BOARD_ITEM *aOther)
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)
void reportTwoPointGeometry(std::shared_ptr< DRC_ITEM > &aDrcItem, const VECTOR2I &aMarkerPos, const VECTOR2I &ptA, const VECTOR2I &ptB, PCB_LAYER_ID aLayer)
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 & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & AllLayersMask()
VECTOR2I::extended_type ecoord
static SEG::ecoord Square(int a)
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
const SEG & GetSeg() const
int GetWidth() const override
VECTOR2I GetCenter() const
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_DRILLED_HOLES_COLOCATED
@ HOLE_TO_HOLE_CONSTRAINT
static std::shared_ptr< SHAPE_SEGMENT > getHoleShape(BOARD_ITEM *aItem)
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I