Formatting cleanup.

This commit is contained in:
Jeff Young 2020-02-03 18:34:51 +00:00
parent f1b1c91961
commit fbeb0709ef
3 changed files with 27 additions and 19 deletions

View File

@ -73,7 +73,9 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
if( !is_ok && aBoard.GetDesignSettings().m_ProhibitOverlappingCourtyards ) if( !is_ok && aBoard.GetDesignSettings().m_ProhibitOverlappingCourtyards )
{ {
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker( auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
pos, footprint, DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT ) ); pos,
footprint,
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT ) );
HandleMarker( std::move( marker ) ); HandleMarker( std::move( marker ) );
success = false; success = false;
} }
@ -85,7 +87,9 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
&& footprint->GetPolyCourtyardBack().OutlineCount() == 0 && is_ok ) && footprint->GetPolyCourtyardBack().OutlineCount() == 0 && is_ok )
{ {
auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker( auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
pos, footprint, DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) ); pos,
footprint,
DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) );
HandleMarker( std::move( marker ) ); HandleMarker( std::move( marker ) );
success = false; success = false;
} }
@ -101,14 +105,14 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ ) for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ )
{ {
auto footprint = *it1; MODULE* footprint = *it1;
if( footprint->GetPolyCourtyardFront().OutlineCount() == 0 ) if( footprint->GetPolyCourtyardFront().OutlineCount() == 0 )
continue; // No courtyard defined continue; // No courtyard defined
for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ ) for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ )
{ {
auto candidate = *it2; MODULE* candidate = *it2;
if( candidate->GetPolyCourtyardFront().OutlineCount() == 0 ) if( candidate->GetPolyCourtyardFront().OutlineCount() == 0 )
continue; // No courtyard defined continue; // No courtyard defined
@ -117,8 +121,8 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
courtyard.Append( footprint->GetPolyCourtyardFront() ); courtyard.Append( footprint->GetPolyCourtyardFront() );
// Build the common area between footprint and the candidate: // Build the common area between footprint and the candidate:
courtyard.BooleanIntersection( courtyard.BooleanIntersection( candidate->GetPolyCourtyardFront(),
candidate->GetPolyCourtyardFront(), SHAPE_POLY_SET::PM_FAST ); SHAPE_POLY_SET::PM_FAST );
// If no overlap, courtyard is empty (no common area). // If no overlap, courtyard is empty (no common area).
// Therefore if a common polygon exists, this is a DRC error // Therefore if a common polygon exists, this is a DRC error
@ -126,8 +130,10 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
{ {
//Overlap between footprint and candidate //Overlap between footprint and candidate
auto& pos = courtyard.CVertex( 0, 0, -1 ); auto& pos = courtyard.CVertex( 0, 0, -1 );
auto marker = std::unique_ptr<MARKER_PCB>( auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
marker_factory.NewMarker( wxPoint( pos.x, pos.y ), footprint, candidate, (wxPoint) pos,
footprint,
candidate,
DRCE_OVERLAPPING_FOOTPRINTS ) ); DRCE_OVERLAPPING_FOOTPRINTS ) );
HandleMarker( std::move( marker ) ); HandleMarker( std::move( marker ) );
success = false; success = false;
@ -138,14 +144,14 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
// Test for overlapping on bottom layer: // Test for overlapping on bottom layer:
for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ ) for( auto it1 = aBoard.Modules().begin(); it1 != aBoard.Modules().end(); it1++ )
{ {
auto footprint = *it1; MODULE* footprint = *it1;
if( footprint->GetPolyCourtyardBack().OutlineCount() == 0 ) if( footprint->GetPolyCourtyardBack().OutlineCount() == 0 )
continue; // No courtyard defined continue; // No courtyard defined
for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ ) for( auto it2 = it1 + 1; it2 != aBoard.Modules().end(); it2++ )
{ {
auto candidate = *it2; MODULE* candidate = *it2;
if( candidate->GetPolyCourtyardBack().OutlineCount() == 0 ) if( candidate->GetPolyCourtyardBack().OutlineCount() == 0 )
continue; // No courtyard defined continue; // No courtyard defined
@ -154,8 +160,8 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
courtyard.Append( footprint->GetPolyCourtyardBack() ); courtyard.Append( footprint->GetPolyCourtyardBack() );
// Build the common area between footprint and the candidate: // Build the common area between footprint and the candidate:
courtyard.BooleanIntersection( courtyard.BooleanIntersection( candidate->GetPolyCourtyardBack(),
candidate->GetPolyCourtyardBack(), SHAPE_POLY_SET::PM_FAST ); SHAPE_POLY_SET::PM_FAST );
// If no overlap, courtyard is empty (no common area). // If no overlap, courtyard is empty (no common area).
// Therefore if a common polygon exists, this is a DRC error // Therefore if a common polygon exists, this is a DRC error
@ -163,8 +169,10 @@ bool DRC_COURTYARD_OVERLAP::RunDRC( BOARD& aBoard ) const
{ {
//Overlap between footprint and candidate //Overlap between footprint and candidate
auto& pos = courtyard.CVertex( 0, 0, -1 ); auto& pos = courtyard.CVertex( 0, 0, -1 );
auto marker = std::unique_ptr<MARKER_PCB>( auto marker = std::unique_ptr<MARKER_PCB>( marker_factory.NewMarker(
marker_factory.NewMarker( wxPoint( pos.x, pos.y ), footprint, candidate, (wxPoint) pos,
footprint,
candidate,
DRCE_OVERLAPPING_FOOTPRINTS ) ); DRCE_OVERLAPPING_FOOTPRINTS ) );
HandleMarker( std::move( marker ) ); HandleMarker( std::move( marker ) );
success = false; success = false;

View File

@ -468,7 +468,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
aMessages->Refresh(); aMessages->Refresh();
} }
doFootprintOverlappingDrc(); doOverlappingCourtyardsDrc();
} }
for( DRC_ITEM* footprintItem : m_footprints ) for( DRC_ITEM* footprintItem : m_footprints )
@ -1342,7 +1342,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
} }
void DRC::doFootprintOverlappingDrc() void DRC::doOverlappingCourtyardsDrc()
{ {
DRC_COURTYARD_OVERLAP drc_overlap( DRC_COURTYARD_OVERLAP drc_overlap(
m_markerFactory, [&]( MARKER_PCB* aMarker ) { addMarkerToPcb( aMarker ); } ); m_markerFactory, [&]( MARKER_PCB* aMarker ) { addMarkerToPcb( aMarker ); } );

View File

@ -340,7 +340,7 @@ private:
/** /**
* Test for footprint courtyard overlaps. * Test for footprint courtyard overlaps.
*/ */
void doFootprintOverlappingDrc(); void doOverlappingCourtyardsDrc();
//-----<single tests>---------------------------------------------- //-----<single tests>----------------------------------------------