Better layer handling for DRC markers.

Fixes https://gitlab.com/kicad/code/kicad/issues/10126
This commit is contained in:
Jeff Young 2021-12-26 13:47:00 +00:00
parent 5e4a704155
commit ab583a32f9
36 changed files with 123 additions and 107 deletions

View File

@ -356,7 +356,7 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
}
};
if( node && item )
if( node && item && item != DELETED_BOARD_ITEM::GetInstance() )
{
PCB_LAYER_ID principalLayer = item->GetLayer();
LSET violationLayers;

View File

@ -1363,12 +1363,13 @@ bool DRC_ENGINE::IsErrorLimitExceeded( int error_code )
}
void DRC_ENGINE::ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, const wxPoint& aPos )
void DRC_ENGINE::ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, const wxPoint& aPos,
PCB_LAYER_ID aMarkerLayer )
{
m_errorLimits[ aItem->GetErrorCode() ] -= 1;
if( m_violationHandler )
m_violationHandler( aItem, aPos );
m_violationHandler( aItem, aPos, aMarkerLayer );
if( m_reporter )
{

View File

@ -65,7 +65,7 @@ class DRC_CONSTRAINT;
typedef
std::function<void( const std::shared_ptr<DRC_ITEM>& aItem,
const wxPoint& aPos )> DRC_VIOLATION_HANDLER;
const wxPoint& aPos, PCB_LAYER_ID aLayer )> DRC_VIOLATION_HANDLER;
/**
@ -164,7 +164,9 @@ public:
bool RulesValid() { return m_rulesValid; }
void ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, const wxPoint& aPos );
void ReportViolation( const std::shared_ptr<DRC_ITEM>& aItem, const wxPoint& aPos,
PCB_LAYER_ID aMarkerLayer );
bool ReportProgress( double aProgress );
bool ReportPhase( const wxString& aMessage );
void ReportAux( const wxString& aStr );

View File

@ -54,13 +54,13 @@ const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; }
void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr<DRC_ITEM>& item,
const wxPoint& aMarkerPos )
const wxPoint& aMarkerPos, PCB_LAYER_ID aMarkerLayer )
{
if( item->GetViolatingRule() )
accountCheck( item->GetViolatingRule() );
item->SetViolatingTest( this );
m_drcEngine->ReportViolation( item, aMarkerPos );
m_drcEngine->ReportViolation( item, aMarkerPos, aMarkerLayer );
}

View File

@ -94,7 +94,8 @@ protected:
const std::function<bool(BOARD_ITEM*)>& aFunc );
virtual void reportAux( wxString fmt, ... );
virtual void reportViolation( std::shared_ptr<DRC_ITEM>& item, const wxPoint& aMarkerPos );
virtual void reportViolation( std::shared_ptr<DRC_ITEM>& item, const wxPoint& aMarkerPos,
PCB_LAYER_ID aMarkerLayer );
virtual bool reportProgress( int aCount, int aSize, int aDelta );
virtual bool reportPhase( const wxString& aStageName );

View File

@ -139,7 +139,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition() );
reportViolation( drcItem, via->GetPosition(), via->GetLayer() );
}
return true;

View File

@ -109,7 +109,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( code );
drcItem->SetItems( track );
reportViolation( drcItem, pos );
reportViolation( drcItem, pos, track->GetLayer() );
}
}
@ -135,7 +135,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_ZONE_HAS_EMPTY_NET );
drcItem->SetItems( zone );
reportViolation( drcItem, zone->GetPosition() );
reportViolation( drcItem, zone->GetPosition(), zone->GetLayer() );
}
}
@ -162,7 +162,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNCONNECTED_ITEMS );
drcItem->SetItems( edge.GetSourceNode()->Parent(), edge.GetTargetNode()->Parent() );
reportViolation( drcItem, (wxPoint) edge.GetSourceNode()->Pos() );
reportViolation( drcItem, (wxPoint) edge.GetSourceNode()->Pos(), UNDEFINED_LAYER );
}
reportRuleStatistics();

View File

@ -291,7 +291,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drcItem->SetItems( track, other );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, (wxPoint) intersection.get() );
reportViolation( drcItem, (wxPoint) intersection.get(), layer );
return m_drcEngine->GetReportAllTrackErrors();
}
@ -312,7 +312,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drce->SetItems( track, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
if( !m_drcEngine->GetReportAllTrackErrors() )
return false;
@ -360,7 +360,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drce->SetItems( track, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
if( !m_drcEngine->GetReportAllTrackErrors() )
return false;
@ -446,7 +446,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
drce->SetItems( aItem, aZone );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
@ -492,7 +492,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
drce->SetItems( aItem, aZone );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
}
@ -566,7 +566,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* padShape,
PCB_LAYER_ID layer,
PCB_LAYER_ID aLayer,
BOARD_ITEM* other )
{
bool testClearance = !m_drcEngine->IsErrorLimitExceeded( DRCE_CLEARANCE );
@ -595,14 +595,14 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( other->Type() == PCB_VIA_T )
otherVia = static_cast<PCB_VIA*>( other );
if( !IsCopperLayer( layer ) )
if( !IsCopperLayer( aLayer ) )
testClearance = false;
// A NPTH has no cylinder, but it may still have pads on some layers
if( pad->GetAttribute() == PAD_ATTRIB::NPTH && !pad->FlashLayer( layer ) )
if( pad->GetAttribute() == PAD_ATTRIB::NPTH && !pad->FlashLayer( aLayer ) )
testClearance = false;
if( otherPad && otherPad->GetAttribute() == PAD_ATTRIB::NPTH && !otherPad->FlashLayer( layer ) )
if( otherPad && otherPad->GetAttribute() == PAD_ATTRIB::NPTH && !otherPad->FlashLayer( aLayer ) )
testClearance = false;
// Track clearances are tested in testTrackClearances()
@ -630,7 +630,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( !testClearance && !testShorting && !testHoles )
return false;
std::shared_ptr<SHAPE> otherShape = DRC_ENGINE::GetShape( other, layer );
std::shared_ptr<SHAPE> otherShape = DRC_ENGINE::GetShape( other, aLayer );
DRC_CONSTRAINT constraint;
int clearance;
int actual;
@ -654,7 +654,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + m_msg );
drce->SetItems( pad, otherPad );
reportViolation( drce, otherPad->GetPosition() );
reportViolation( drce, otherPad->GetPosition(), aLayer );
}
return true;
@ -662,7 +662,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( testClearance )
{
constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, pad, other, layer );
constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, pad, other, aLayer );
clearance = constraint.GetValue().Min();
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE && clearance > 0 )
@ -681,7 +681,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations
}
}
@ -689,14 +689,14 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( testHoles )
{
constraint = m_drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, pad, other, layer );
constraint = m_drcEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, pad, other, aLayer );
clearance = constraint.GetValue().Min();
if( constraint.GetSeverity() == RPT_SEVERITY_IGNORE )
testHoles = false;
}
if( testHoles && otherPad && pad->FlashLayer( layer ) && otherPad->GetDrillSize().x )
if( testHoles && otherPad && pad->FlashLayer( aLayer ) && otherPad->GetDrillSize().x )
{
if( clearance > 0 && padShape->Collide( otherPad->GetEffectiveHoleShape(),
std::max( 0, clearance - m_drcEpsilon ),
@ -713,12 +713,12 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations
}
}
if( testHoles && otherPad && otherPad->FlashLayer( layer ) && pad->GetDrillSize().x )
if( testHoles && otherPad && otherPad->FlashLayer( aLayer ) && pad->GetDrillSize().x )
{
if( clearance >= 0 && otherShape->Collide( pad->GetEffectiveHoleShape(),
std::max( 0, clearance - m_drcEpsilon ),
@ -735,12 +735,12 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations
}
}
if( testHoles && otherVia && otherVia->IsOnLayer( layer ) )
if( testHoles && otherVia && otherVia->IsOnLayer( aLayer ) )
{
pos = otherVia->GetPosition();
otherShape.reset( new SHAPE_SEGMENT( pos, pos, otherVia->GetDrill() ) );
@ -760,7 +760,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
drce->SetItems( pad, otherVia );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
@ -910,7 +910,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones()
drce->SetItems( zoneA, zoneB );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, pt );
reportViolation( drce, pt, layer );
}
}
@ -926,7 +926,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones()
drce->SetItems( zoneB, zoneA );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, pt );
reportViolation( drce, pt, layer );
}
}
@ -995,7 +995,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones()
drce->SetItems( zoneA, zoneB );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, conflict.first );
reportViolation( drce, conflict.first, layer );
}
}
}

View File

@ -111,7 +111,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD );
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, pt );
reportViolation( drcItem, pt, UNDEFINED_LAYER );
};
// Re-run courtyard tests to generate DRC_ITEMs
@ -128,7 +128,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_COURTYARD );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
else
{
@ -217,7 +217,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
}
drce->SetItems( fpA, fpB );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, F_CrtYd );
}
}
}
@ -246,7 +246,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
}
drce->SetItems( fpA, fpB );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, B_CrtYd );
}
}
}
@ -270,12 +270,17 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
const SHAPE_POLY_SET& front = footprint->GetPolyCourtyard( F_CrtYd );
const SHAPE_POLY_SET& back = footprint->GetPolyCourtyard( B_CrtYd );
if( ( front.OutlineCount() > 0 && front.Collide( hole, 0 ) )
|| ( back.OutlineCount() > 0 && back.Collide( hole, 0 ) ) )
if( front.OutlineCount() > 0 && front.Collide( hole, 0 ) )
{
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode );
drce->SetItems( pad, footprint );
reportViolation( drce, pad->GetPosition() );
reportViolation( drce, pad->GetPosition(), F_CrtYd );
}
else if( back.OutlineCount() > 0 && back.Collide( hole, 0 ) )
{
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode );
drce->SetItems( pad, footprint );
reportViolation( drce, pad->GetPosition(), B_CrtYd );
}
};

View File

@ -463,7 +463,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
drce->SetViolatingRule( maxUncoupledConstraint->GetParentRule() );
reportViolation( drce, ( *it.second.itemsP.begin() )->GetPosition() );
reportViolation( drce, ( *it.second.itemsP.begin() )->GetPosition(),
( *it.second.itemsP.begin() )->GetLayer() );
}
}
@ -497,7 +498,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
drcItem->SetViolatingRule( gapConstraint->GetParentRule() );
reportViolation( drcItem, cpair.parentP->GetPosition() );
reportViolation( drcItem, cpair.parentP->GetPosition(),
cpair.parentP->GetLayer() );
}
}
}

View File

@ -89,7 +89,7 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
}
};
@ -103,7 +103,7 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
{
std::shared_ptr<DRC_ITEM> drc = DRC_ITEM::Create( DRCE_TEXT_ON_EDGECUTS );
drc->SetItems( item );
reportViolation( drc, item->GetPosition() );
reportViolation( drc, item->GetPosition(), Edge_Cuts );
}
}

View File

@ -106,7 +106,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge( BOARD_ITEM* item, SHAPE*
drce->SetItems( edge->m_Uuid, item->m_Uuid );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, Edge_Cuts );
return false; // don't report violations with multiple edges; one is enough
}
}

View File

@ -180,7 +180,7 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkPad( PAD* aPad )
drcItem->SetItems( aPad );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, aPad->GetPosition() );
reportViolation( drcItem, aPad->GetPosition(), UNDEFINED_LAYER );
}
}
@ -248,7 +248,7 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkVia( PCB_VIA* via, bool aExceedMicro, boo
drcItem->SetItems( via );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition() );
reportViolation( drcItem, via->GetPosition(), UNDEFINED_LAYER );
}
}

View File

@ -288,7 +288,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
{
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_DRILLED_HOLES_COLOCATED );
drce->SetItems( aItem, aOther );
reportViolation( drce, (wxPoint) aHole->GetCenter() );
reportViolation( drce, (wxPoint) aHole->GetCenter(), UNDEFINED_LAYER );
}
}
else if( reportHole2Hole )
@ -315,7 +315,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
drce->SetItems( aItem, aOther );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) aHole->GetCenter() );
reportViolation( drce, (wxPoint) aHole->GetCenter(), UNDEFINED_LAYER );
}
}

View File

@ -447,7 +447,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
continue;
}
@ -458,7 +458,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
continue;
}
@ -492,7 +492,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
}
else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
{
@ -502,7 +502,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
}
}

View File

@ -136,7 +136,8 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkLengths( DRC_CONSTRAINT& aConstraint
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
reportViolation( drcItem, ( *ent.items.begin() )->GetPosition(),
( *ent.items.begin() )->GetLayer() );
}
}
}
@ -172,7 +173,8 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkews( DRC_CONSTRAINT& aConstraint,
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
reportViolation( drcItem, ( *ent.items.begin() )->GetPosition(),
( *ent.items.begin() )->GetLayer() );
}
}
}
@ -199,7 +201,8 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkViaCounts( DRC_CONSTRAINT& aConstrai
drcItem->SetViolatingRule( aConstraint.GetParentRule() );
reportViolation( drcItem, (*ent.items.begin() )->GetPosition() );
reportViolation( drcItem, ( *ent.items.begin() )->GetPosition(),
( *ent.items.begin() )->GetLayer() );
}
}
}

View File

@ -76,7 +76,7 @@ private:
void testItemAgainstZones( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer );
void testShapeLineChain( const SHAPE_LINE_CHAIN& aOutline, int aLineWidth,
void testShapeLineChain( const SHAPE_LINE_CHAIN& aOutline, int aLineWidth, PCB_LAYER_ID aLayer,
BOARD_ITEM* aParentItem, DRC_CONSTRAINT& aConstraint );
void testZoneLayer( ZONE* aZone, PCB_LAYER_ID aLayer, DRC_CONSTRAINT& aConstraint );
@ -297,7 +297,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
{
case SHAPE_T::POLY:
testShapeLineChain( shape->GetPolyShape().Outline( 0 ),
shape->GetWidth(), item, c );
shape->GetWidth(), layer, item, c );
break;
case SHAPE_T::BEZIER:
@ -309,7 +309,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
for( const wxPoint& pt : shape->GetBezierPoints() )
asPoly.Append( pt );
testShapeLineChain( asPoly, shape->GetWidth(), item, c );
testShapeLineChain( asPoly, shape->GetWidth(), layer, item, c );
break;
}
@ -333,7 +333,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
asPoly.Append( pt );
}
testShapeLineChain( asPoly, shape->GetWidth(), item, c );
testShapeLineChain( asPoly, shape->GetWidth(), layer, item, c );
break;
}
@ -359,7 +359,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testShapeLineChain( const SHAPE_LINE_CHAIN& aOutline,
int aLineWidth,
int aLineWidth, PCB_LAYER_ID aLayer,
BOARD_ITEM* aParentItem,
DRC_CONSTRAINT& aConstraint )
{
@ -495,7 +495,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testShapeLineChain( const SHAPE_LIN
drce->SetItems( aParentItem );
drce->SetViolatingRule( aConstraint.GetParentRule() );
reportViolation( drce, (wxPoint) collision.first );
reportViolation( drce, (wxPoint) collision.first, aLayer );
}
}
@ -542,7 +542,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testZoneLayer( ZONE* aZone, PCB_LAY
drce->SetItems( aZone );
drce->SetViolatingRule( aConstraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
}
@ -551,7 +551,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testZoneLayer( ZONE* aZone, PCB_LAY
for( int holeIdx = 0; holeIdx < fill.HoleCount( outlineIdx ); ++holeIdx )
{
testShapeLineChain( fill.Hole( outlineIdx, holeIdx ), 0, aZone, aConstraint );
testShapeLineChain( fill.Hole( outlineIdx, holeIdx ), 0, aLayer, aZone, aConstraint );
}
}
}
@ -592,7 +592,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* it
drce->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
}
}
@ -656,7 +656,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* it
drce->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
}
if( otherHoleShape && otherHoleShape->Collide( itemShape, clearance, &actual, &pos ) )
@ -672,7 +672,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* it
drce->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
}
}
}
@ -761,7 +761,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testItemAgainstZones( BOARD_ITEM* a
drce->SetItems( aItem, zone );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
@ -807,7 +807,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testItemAgainstZones( BOARD_ITEM* a
drce->SetItems( aItem, zone );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aLayer );
}
}
}

View File

@ -90,7 +90,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
drcItem->SetItems( itemA, itemB );
reportViolation( drcItem, pt );
reportViolation( drcItem, pt, Edge_Cuts );
errorHandled = true;
};
@ -114,7 +114,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( m_board );
reportViolation( drcItem, m_board->GetBoundingBox().Centre() );
reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
}
}
}
@ -201,7 +201,7 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, item->GetPosition(), UNDEFINED_LAYER );
}
return true;
@ -244,7 +244,7 @@ void DRC_TEST_PROVIDER_MISC::testAssertions()
+ c->GetName() + wxS( ")" ) );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
} );
return true;
@ -279,14 +279,15 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
if( !reportProgress( ii++, items, delta ) )
return false;
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item );
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( boardItem );
if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, boardItem->GetPosition(), boardItem->GetLayer() );
}
return true;
};
@ -321,7 +322,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( text );
reportViolation( drcItem, text->GetPosition() );
reportViolation( drcItem, text->GetPosition(), UNDEFINED_LAYER );
}
}
}

View File

@ -97,7 +97,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DUPLICATE_FOOTPRINT );
drcItem->SetItems( footprint, *ins.first );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
}
@ -119,7 +119,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_FOOTPRINT );
drcItem->SetErrorMessage( m_msg );
reportViolation( drcItem, wxPoint() );
reportViolation( drcItem, wxPoint(), UNDEFINED_LAYER );
}
else
{
@ -141,7 +141,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
else if( pcb_netname.IsEmpty() && !sch_net.GetNetName().IsEmpty() )
{
@ -151,7 +151,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
else if( pcb_netname != sch_net.GetNetName() )
{
@ -162,7 +162,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
}
@ -181,7 +181,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
}
}
@ -201,7 +201,7 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_EXTRA_FOOTPRINT );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition() );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
}
}

View File

@ -233,7 +233,7 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
drcItem->SetItems( aRefItem->parent, aTestItem->parent );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, (wxPoint) pos );
reportViolation( drcItem, (wxPoint) pos, aLayers.second );
*aCollisionDetected = true;
}

View File

@ -151,7 +151,7 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
{
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_COPPER_SLIVER );
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + layerDesc( layer ) );
reportViolation( drce, (wxPoint) pt );
reportViolation( drce, (wxPoint) pt, layer );
}
}
}

View File

@ -278,7 +278,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance()
drce->SetItems( item );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, layer );
}
}
@ -388,7 +388,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem,
drce->SetItems( aItem, other );
drce->SetViolatingRule( &m_bridgeRule );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aTargetLayer );
}
return true;
@ -453,7 +453,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones( BOARD_ITEM* aItem,
drce->SetItems( aItem, zone );
drce->SetViolatingRule( &m_bridgeRule );
reportViolation( drce, (wxPoint) pos );
reportViolation( drce, (wxPoint) pos, aTargetLayer );
}
}
}

View File

@ -156,7 +156,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
}
}
@ -207,7 +207,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, item->GetPosition() );
reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
}
}

View File

@ -146,7 +146,7 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, p0 );
reportViolation( drcItem, p0, item->GetLayer() );
}
return true;

View File

@ -136,7 +136,7 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run()
drcItem->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, via->GetPosition() );
reportViolation( drcItem, via->GetPosition(), via->GetLayer() );
}
return true;

View File

@ -170,7 +170,7 @@ bool DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run()
drce->SetItems( zone, pad );
drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, pad->GetPosition() );
reportViolation( drce, pad->GetPosition(), UNDEFINED_LAYER );
}
}
}

View File

@ -475,7 +475,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
engine->SetProgressReporter( nullptr );
engine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_MISSING_FOOTPRINT
|| aItem->GetErrorCode() == DRCE_DUPLICATE_FOOTPRINT

View File

@ -172,9 +172,10 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones
m_drcEngine->SetProgressReporter( aProgressReporter );
m_drcEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
PCB_MARKER* marker = new PCB_MARKER( aItem, aPos );
marker->SetLayer( aLayer );
commit.Add( marker );
} );

View File

@ -114,7 +114,7 @@ int runDRCProto( PROJECT_CONTEXT project, std::shared_ptr<KIGFX::VIEW_OVERLAY> a
drcEngine->SetProgressReporter( new CONSOLE_PROGRESS_REPORTER ( &consoleLog ) );
drcEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
// fixme
} );

View File

@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
PCB_MARKER temp( aItem, aPos );

View File

@ -304,7 +304,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase,
drcEngine.InitEngine( wxFileName() );
drcEngine.SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD

View File

@ -460,7 +460,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase,
drcEngine.InitEngine( wxFileName() );
drcEngine.SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD

View File

@ -69,7 +69,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR
bds.m_DRCSeverities[ DRCE_UNCONNECTED_ITEMS ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( bds.GetSeverity( aItem->GetErrorCode() ) == SEVERITY::RPT_SEVERITY_ERROR )
violations.push_back( *aItem );
@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
PCB_MARKER temp( aItem, aPos );

View File

@ -50,7 +50,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSolderMaskBridgingTest, DRC_REGRESSION_TEST_FIXTURE
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
PCB_MARKER temp( aItem, aPos );

View File

@ -171,7 +171,7 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_UNCONNECTED_ITEMS )
violations.push_back( *aItem );

View File

@ -98,7 +98,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE )
bds.m_DRCEngine->InitEngine( wxFileName() ); // Just to be sure to be sure
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_CLEARANCE )
{
@ -204,7 +204,7 @@ BOOST_FIXTURE_TEST_CASE( RegressionZoneFillTests, ZONE_FILL_TEST_FIXTURE )
std::vector<DRC_ITEM> violations;
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
[&]( const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos, PCB_LAYER_ID aLayer )
{
if( aItem->GetErrorCode() == DRCE_CLEARANCE )
violations.push_back( *aItem );