Fix copy/paste error and some formatting issues.

This commit is contained in:
Jeff Young 2020-10-27 10:47:44 +00:00
parent c44855a647
commit 776ea35040
1 changed files with 47 additions and 58 deletions

View File

@ -20,7 +20,6 @@
#include <common.h> #include <common.h>
#include <class_board.h> #include <class_board.h>
#include <class_pad.h>
#include <class_track.h> #include <class_track.h>
#include <drc/drc_engine.h> #include <drc/drc_engine.h>
@ -30,13 +29,11 @@
#include <drc/drc_length_report.h> #include <drc/drc_length_report.h>
#include <drc/drc_rtree.h> #include <drc/drc_rtree.h>
#include <geometry/shape.h>
#include <geometry/shape_segment.h> #include <geometry/shape_segment.h>
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <connectivity/from_to_cache.h> #include <connectivity/from_to_cache.h>
#include <pcb_expr_evaluator.h>
/* /*
Differential pair gap/coupling test. Differential pair gap/coupling test.
@ -148,14 +145,7 @@ struct DIFF_PAIR_KEY
else if( netN > b.netN ) else if( netN > b.netN )
return false; return false;
else else
{ return parentRule < b.parentRule;
if( parentRule < b.parentRule )
return true;
else
{
return false;
}
}
} }
} }
@ -185,7 +175,7 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree
{ {
for( BOARD_CONNECTED_ITEM* itemP : aDp.itemsP ) for( BOARD_CONNECTED_ITEM* itemP : aDp.itemsP )
{ {
auto sp = dyn_cast<TRACK*>( itemP ); TRACK* sp = dyn_cast<TRACK*>( itemP );
OPT<DIFF_PAIR_COUPLED_SEGMENTS> bestCoupled; OPT<DIFF_PAIR_COUPLED_SEGMENTS> bestCoupled;
int bestGap = std::numeric_limits<int>::max(); int bestGap = std::numeric_limits<int>::max();
@ -230,7 +220,8 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree
if( bestCoupled ) if( bestCoupled )
{ {
printf("Best-gap %d\n", bestGap ); printf("Best-gap %d\n", bestGap );
auto excludeSelf = [&] ( BOARD_ITEM *aItem ) auto excludeSelf =
[&] ( BOARD_ITEM *aItem )
{ {
if( aItem == bestCoupled->parentN || aItem == bestCoupled->parentP ) if( aItem == bestCoupled->parentN || aItem == bestCoupled->parentP )
{ {
@ -260,7 +251,6 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree
{ {
aDp.coupled.push_back( *bestCoupled ); aDp.coupled.push_back( *bestCoupled );
} }
} }
} }
} }
@ -438,26 +428,26 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
if ( val.HasMax() && totalUncoupled > val.Max() ) if ( val.HasMax() && totalUncoupled > val.Max() )
{ {
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG ); auto drce = DRC_ITEM::Create( DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG );
wxString msg =
drcItem->GetErrorText() + " (" + maxUncoupledConstraint->GetParentRule()->m_Name + " ";
msg += wxString::Format( _( "maximum uncoupled length: %s; actual: %s)" ), m_msg = wxString::Format( _( "(%s maximum uncoupled length: %s; actual: %s)" ),
maxUncoupledConstraint->GetParentRule()->m_Name,
MessageTextFromValue( userUnits(), val.Max() ), MessageTextFromValue( userUnits(), val.Max() ),
MessageTextFromValue( userUnits(), totalUncoupled ) ); MessageTextFromValue( userUnits(), totalUncoupled ) );
drcItem->SetErrorMessage( msg ); drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + m_msg );
for( auto offendingTrack : it.second.itemsP ) for( BOARD_CONNECTED_ITEM* offendingTrack : it.second.itemsP )
drcItem->AddItem( offendingTrack ); drce->AddItem( offendingTrack );
for( auto offendingTrack : it.second.itemsN )
drcItem->AddItem( offendingTrack ); for( BOARD_CONNECTED_ITEM* offendingTrack : it.second.itemsN )
drce->AddItem( offendingTrack );
uncoupledViolation = true; uncoupledViolation = true;
drcItem->SetViolatingRule( maxUncoupledConstraint->GetParentRule() ); drce->SetViolatingRule( maxUncoupledConstraint->GetParentRule() );
reportViolation( drcItem, (*it.second.itemsP.begin())->GetPosition() ); reportViolation( drce, (*it.second.itemsP.begin())->GetPosition() );
} }
} }
@ -468,24 +458,23 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
if( !cpair.couplingOK ) if( !cpair.couplingOK )
{ {
auto val = gapConstraint->GetValue(); auto val = gapConstraint->GetValue();
auto drcItem = DRC_ITEM::Create( DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE ); m_msg = drcItem->GetErrorText() + " (" + gapConstraint->GetParentRule()->m_Name + " ";
wxString msg =
drcItem->GetErrorText() + " (" + maxUncoupledConstraint->GetParentRule()->m_Name + " ";
if( val.HasMin() ) if( val.HasMin() )
msg += wxString::Format( _( "minimum gap: %s; " ), m_msg += wxString::Format( _( "minimum gap: %s; " ),
MessageTextFromValue( userUnits(), val.Min() ) ); MessageTextFromValue( userUnits(), val.Min() ) );
if( val.HasMax() ) if( val.HasMax() )
msg += wxString::Format( _( "maximum gap: %s; " ), m_msg += wxString::Format( _( "maximum gap: %s; " ),
MessageTextFromValue( userUnits(), val.Max() ) ); MessageTextFromValue( userUnits(), val.Max() ) );
msg += wxString::Format( _( "actual: %s)" ), m_msg += wxString::Format( _( "actual: %s)" ),
MessageTextFromValue( userUnits(), cpair.computedGap ) ); MessageTextFromValue( userUnits(), cpair.computedGap ) );
drcItem->SetErrorMessage( msg ); drcItem->SetErrorMessage( m_msg );
drcItem->AddItem( cpair.parentP ); drcItem->AddItem( cpair.parentP );
drcItem->AddItem( cpair.parentN ); drcItem->AddItem( cpair.parentN );