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(); PCB_LAYER_ID principalLayer = item->GetLayer();
LSET violationLayers; 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; m_errorLimits[ aItem->GetErrorCode() ] -= 1;
if( m_violationHandler ) if( m_violationHandler )
m_violationHandler( aItem, aPos ); m_violationHandler( aItem, aPos, aMarkerLayer );
if( m_reporter ) if( m_reporter )
{ {

View File

@ -65,7 +65,7 @@ class DRC_CONSTRAINT;
typedef typedef
std::function<void( const std::shared_ptr<DRC_ITEM>& aItem, 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; } 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 ReportProgress( double aProgress );
bool ReportPhase( const wxString& aMessage ); bool ReportPhase( const wxString& aMessage );
void ReportAux( const wxString& aStr ); 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, void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr<DRC_ITEM>& item,
const wxPoint& aMarkerPos ) const wxPoint& aMarkerPos, PCB_LAYER_ID aMarkerLayer )
{ {
if( item->GetViolatingRule() ) if( item->GetViolatingRule() )
accountCheck( item->GetViolatingRule() ); accountCheck( item->GetViolatingRule() );
item->SetViolatingTest( this ); 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 ); const std::function<bool(BOARD_ITEM*)>& aFunc );
virtual void reportAux( wxString fmt, ... ); 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 reportProgress( int aCount, int aSize, int aDelta );
virtual bool reportPhase( const wxString& aStageName ); virtual bool reportPhase( const wxString& aStageName );

View File

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

View File

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

View File

@ -291,7 +291,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drcItem->SetItems( track, other ); drcItem->SetItems( track, other );
drcItem->SetViolatingRule( constraint.GetParentRule() ); drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, (wxPoint) intersection.get() ); reportViolation( drcItem, (wxPoint) intersection.get(), layer );
return m_drcEngine->GetReportAllTrackErrors(); return m_drcEngine->GetReportAllTrackErrors();
} }
@ -312,7 +312,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drce->SetItems( track, other ); drce->SetItems( track, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, layer );
if( !m_drcEngine->GetReportAllTrackErrors() ) if( !m_drcEngine->GetReportAllTrackErrors() )
return false; return false;
@ -360,7 +360,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
drce->SetItems( track, other ); drce->SetItems( track, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, layer );
if( !m_drcEngine->GetReportAllTrackErrors() ) if( !m_drcEngine->GetReportAllTrackErrors() )
return false; return false;
@ -446,7 +446,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
drce->SetItems( aItem, aZone ); drce->SetItems( aItem, aZone );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( aItem, aZone );
drce->SetViolatingRule( constraint.GetParentRule() ); 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, bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* padShape,
PCB_LAYER_ID layer, PCB_LAYER_ID aLayer,
BOARD_ITEM* other ) BOARD_ITEM* other )
{ {
bool testClearance = !m_drcEngine->IsErrorLimitExceeded( DRCE_CLEARANCE ); 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 ) if( other->Type() == PCB_VIA_T )
otherVia = static_cast<PCB_VIA*>( other ); otherVia = static_cast<PCB_VIA*>( other );
if( !IsCopperLayer( layer ) ) if( !IsCopperLayer( aLayer ) )
testClearance = false; testClearance = false;
// A NPTH has no cylinder, but it may still have pads on some layers // 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; testClearance = false;
if( otherPad && otherPad->GetAttribute() == PAD_ATTRIB::NPTH && !otherPad->FlashLayer( layer ) ) if( otherPad && otherPad->GetAttribute() == PAD_ATTRIB::NPTH && !otherPad->FlashLayer( aLayer ) )
testClearance = false; testClearance = false;
// Track clearances are tested in testTrackClearances() // 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 ) if( !testClearance && !testShorting && !testHoles )
return false; 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; DRC_CONSTRAINT constraint;
int clearance; int clearance;
int actual; 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->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + m_msg );
drce->SetItems( pad, otherPad ); drce->SetItems( pad, otherPad );
reportViolation( drce, otherPad->GetPosition() ); reportViolation( drce, otherPad->GetPosition(), aLayer );
} }
return true; return true;
@ -662,7 +662,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( testClearance ) if( testClearance )
{ {
constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, pad, other, layer ); constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, pad, other, aLayer );
clearance = constraint.GetValue().Min(); clearance = constraint.GetValue().Min();
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE && clearance > 0 ) 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->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations testHoles = false; // No need for multiple violations
} }
} }
@ -689,14 +689,14 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
if( testHoles ) 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(); clearance = constraint.GetValue().Min();
if( constraint.GetSeverity() == RPT_SEVERITY_IGNORE ) if( constraint.GetSeverity() == RPT_SEVERITY_IGNORE )
testHoles = false; 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(), if( clearance > 0 && padShape->Collide( otherPad->GetEffectiveHoleShape(),
std::max( 0, clearance - m_drcEpsilon ), 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->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations 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(), if( clearance >= 0 && otherShape->Collide( pad->GetEffectiveHoleShape(),
std::max( 0, clearance - m_drcEpsilon ), 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->SetItems( pad, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, aLayer );
testHoles = false; // No need for multiple violations testHoles = false; // No need for multiple violations
} }
} }
if( testHoles && otherVia && otherVia->IsOnLayer( layer ) ) if( testHoles && otherVia && otherVia->IsOnLayer( aLayer ) )
{ {
pos = otherVia->GetPosition(); pos = otherVia->GetPosition();
otherShape.reset( new SHAPE_SEGMENT( pos, pos, otherVia->GetDrill() ) ); 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->SetItems( pad, otherVia );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( zoneA, zoneB );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( zoneB, zoneA );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( zoneA, zoneB );
drce->SetViolatingRule( constraint.GetParentRule() ); 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD );
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
drcItem->SetItems( footprint ); drcItem->SetItems( footprint );
reportViolation( drcItem, pt ); reportViolation( drcItem, pt, UNDEFINED_LAYER );
}; };
// Re-run courtyard tests to generate DRC_ITEMs // 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_COURTYARD );
drcItem->SetItems( footprint ); drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition() ); reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
} }
else else
{ {
@ -217,7 +217,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
} }
drce->SetItems( fpA, fpB ); 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 ); 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& front = footprint->GetPolyCourtyard( F_CrtYd );
const SHAPE_POLY_SET& back = footprint->GetPolyCourtyard( B_CrtYd ); const SHAPE_POLY_SET& back = footprint->GetPolyCourtyard( B_CrtYd );
if( ( front.OutlineCount() > 0 && front.Collide( hole, 0 ) ) if( front.OutlineCount() > 0 && front.Collide( hole, 0 ) )
|| ( back.OutlineCount() > 0 && back.Collide( hole, 0 ) ) )
{ {
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode );
drce->SetItems( pad, footprint ); 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() ); 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() ); 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->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() ); 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 ); std::shared_ptr<DRC_ITEM> drc = DRC_ITEM::Create( DRCE_TEXT_ON_EDGECUTS );
drc->SetItems( item ); 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->SetItems( edge->m_Uuid, item->m_Uuid );
drce->SetViolatingRule( constraint.GetParentRule() ); 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 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->SetItems( aPad );
drcItem->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( via );
drcItem->SetViolatingRule( constraint.GetParentRule() ); 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 ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_DRILLED_HOLES_COLOCATED );
drce->SetItems( aItem, aOther ); drce->SetItems( aItem, aOther );
reportViolation( drce, (wxPoint) aHole->GetCenter() ); reportViolation( drce, (wxPoint) aHole->GetCenter(), UNDEFINED_LAYER );
} }
} }
else if( reportHole2Hole ) else if( reportHole2Hole )
@ -315,7 +315,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
drce->SetItems( aItem, aOther ); drce->SetItems( aItem, aOther );
drce->SetViolatingRule( constraint.GetParentRule() ); 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 ); libName );
drcItem->SetErrorMessage( msg ); drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint ); drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() ); reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
continue; continue;
} }
@ -458,7 +458,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName ); libName );
drcItem->SetErrorMessage( msg ); drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint ); drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() ); reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
continue; continue;
} }
@ -492,7 +492,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName ); libName );
drcItem->SetErrorMessage( msg ); drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint ); drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter() ); reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
} }
else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) ) else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
{ {
@ -502,7 +502,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
libName ); libName );
drcItem->SetErrorMessage( msg ); drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint ); 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() ); 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() ); 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() ); 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 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 ); BOARD_ITEM* aParentItem, DRC_CONSTRAINT& aConstraint );
void testZoneLayer( ZONE* aZone, PCB_LAYER_ID aLayer, 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: case SHAPE_T::POLY:
testShapeLineChain( shape->GetPolyShape().Outline( 0 ), testShapeLineChain( shape->GetPolyShape().Outline( 0 ),
shape->GetWidth(), item, c ); shape->GetWidth(), layer, item, c );
break; break;
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
@ -309,7 +309,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
for( const wxPoint& pt : shape->GetBezierPoints() ) for( const wxPoint& pt : shape->GetBezierPoints() )
asPoly.Append( pt ); asPoly.Append( pt );
testShapeLineChain( asPoly, shape->GetWidth(), item, c ); testShapeLineChain( asPoly, shape->GetWidth(), layer, item, c );
break; break;
} }
@ -333,7 +333,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
asPoly.Append( pt ); asPoly.Append( pt );
} }
testShapeLineChain( asPoly, shape->GetWidth(), item, c ); testShapeLineChain( asPoly, shape->GetWidth(), layer, item, c );
break; break;
} }
@ -359,7 +359,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run()
void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testShapeLineChain( const SHAPE_LINE_CHAIN& aOutline, void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testShapeLineChain( const SHAPE_LINE_CHAIN& aOutline,
int aLineWidth, int aLineWidth, PCB_LAYER_ID aLayer,
BOARD_ITEM* aParentItem, BOARD_ITEM* aParentItem,
DRC_CONSTRAINT& aConstraint ) DRC_CONSTRAINT& aConstraint )
{ {
@ -495,7 +495,7 @@ void DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::testShapeLineChain( const SHAPE_LIN
drce->SetItems( aParentItem ); drce->SetItems( aParentItem );
drce->SetViolatingRule( aConstraint.GetParentRule() ); 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->SetItems( aZone );
drce->SetViolatingRule( aConstraint.GetParentRule() ); 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 ) 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->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() ); drce->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, layer );
} }
if( otherHoleShape && otherHoleShape->Collide( itemShape, clearance, &actual, &pos ) ) 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->SetItems( item, other );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( aItem, zone );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( aItem, zone );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
drcItem->SetItems( itemA, itemB ); drcItem->SetItems( itemA, itemB );
reportViolation( drcItem, pt ); reportViolation( drcItem, pt, Edge_Cuts );
errorHandled = true; errorHandled = true;
}; };
@ -114,7 +114,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( m_board ); 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->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
drcItem->SetItems( item ); drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() ); reportViolation( drcItem, item->GetPosition(), UNDEFINED_LAYER );
} }
return true; return true;
@ -244,7 +244,7 @@ void DRC_TEST_PROVIDER_MISC::testAssertions()
+ c->GetName() + wxS( ")" ) ); + c->GetName() + wxS( ")" ) );
drcItem->SetItems( item ); drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() ); reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
} ); } );
return true; return true;
@ -279,14 +279,15 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
if( !reportProgress( ii++, items, delta ) ) if( !reportProgress( ii++, items, delta ) )
return false; 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( "*${*}*" ) ) ) if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{ {
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE ); std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( item ); drcItem->SetItems( item );
reportViolation( drcItem, item->GetPosition() ); reportViolation( drcItem, boardItem->GetPosition(), boardItem->GetLayer() );
} }
return true; return true;
}; };
@ -321,7 +322,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
drcItem->SetItems( text ); 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DUPLICATE_FOOTPRINT );
drcItem->SetItems( footprint, *ins.first ); 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_FOOTPRINT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
reportViolation( drcItem, wxPoint() ); reportViolation( drcItem, wxPoint(), UNDEFINED_LAYER );
} }
else 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); drcItem->SetItems( pad );
reportViolation( drcItem, footprint->GetPosition() ); reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
} }
else if( pcb_netname.IsEmpty() && !sch_net.GetNetName().IsEmpty() ) 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); drcItem->SetItems( pad );
reportViolation( drcItem, footprint->GetPosition() ); reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
} }
else if( pcb_netname != sch_net.GetNetName() ) 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( footprint ); 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 ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_EXTRA_FOOTPRINT );
drcItem->SetItems( 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->SetItems( aRefItem->parent, aTestItem->parent );
drcItem->SetViolatingRule( constraint.GetParentRule() ); drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, (wxPoint) pos ); reportViolation( drcItem, (wxPoint) pos, aLayers.second );
*aCollisionDetected = true; *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 ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_COPPER_SLIVER );
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + layerDesc( layer ) ); 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->SetItems( item );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( aItem, other );
drce->SetViolatingRule( &m_bridgeRule ); drce->SetViolatingRule( &m_bridgeRule );
reportViolation( drce, (wxPoint) pos ); reportViolation( drce, (wxPoint) pos, aTargetLayer );
} }
return true; return true;
@ -453,7 +453,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones( BOARD_ITEM* aItem,
drce->SetItems( aItem, zone ); drce->SetItems( aItem, zone );
drce->SetViolatingRule( &m_bridgeRule ); 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->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() ); 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->SetItems( item );
drcItem->SetViolatingRule( constraint.GetParentRule() ); drcItem->SetViolatingRule( constraint.GetParentRule() );
reportViolation( drcItem, p0 ); reportViolation( drcItem, p0, item->GetLayer() );
} }
return true; return true;

View File

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

View File

@ -170,7 +170,7 @@ bool DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run()
drce->SetItems( zone, pad ); drce->SetItems( zone, pad );
drce->SetViolatingRule( constraint.GetParentRule() ); 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->SetProgressReporter( nullptr );
engine->SetViolationHandler( 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 if( aItem->GetErrorCode() == DRCE_MISSING_FOOTPRINT
|| aItem->GetErrorCode() == DRCE_DUPLICATE_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->SetProgressReporter( aProgressReporter );
m_drcEngine->SetViolationHandler( 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 ); PCB_MARKER* marker = new PCB_MARKER( aItem, aPos );
marker->SetLayer( aLayer );
commit.Add( marker ); 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->SetProgressReporter( new CONSOLE_PROGRESS_REPORTER ( &consoleLog ) );
drcEngine->SetViolationHandler( 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 // fixme
} ); } );

View File

@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler( 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 ); PCB_MARKER temp( aItem, aPos );

View File

@ -304,7 +304,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase,
drcEngine.InitEngine( wxFileName() ); drcEngine.InitEngine( wxFileName() );
drcEngine.SetViolationHandler( 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 if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD || aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD

View File

@ -460,7 +460,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase,
drcEngine.InitEngine( wxFileName() ); drcEngine.InitEngine( wxFileName() );
drcEngine.SetViolationHandler( 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 if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS
|| aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD || 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_DRCSeverities[ DRCE_UNCONNECTED_ITEMS ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCEngine->SetViolationHandler( 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 ) if( bds.GetSeverity( aItem->GetErrorCode() ) == SEVERITY::RPT_SEVERITY_ERROR )
violations.push_back( *aItem ); violations.push_back( *aItem );
@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler( 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 ); 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(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler( 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 ); 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(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
bds.m_DRCEngine->SetViolationHandler( 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 ) if( aItem->GetErrorCode() == DRCE_UNCONNECTED_ITEMS )
violations.push_back( *aItem ); 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->InitEngine( wxFileName() ); // Just to be sure to be sure
bds.m_DRCEngine->SetViolationHandler( 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 ) if( aItem->GetErrorCode() == DRCE_CLEARANCE )
{ {
@ -204,7 +204,7 @@ BOOST_FIXTURE_TEST_CASE( RegressionZoneFillTests, ZONE_FILL_TEST_FIXTURE )
std::vector<DRC_ITEM> violations; std::vector<DRC_ITEM> violations;
bds.m_DRCEngine->SetViolationHandler( 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 ) if( aItem->GetErrorCode() == DRCE_CLEARANCE )
violations.push_back( *aItem ); violations.push_back( *aItem );