28#include <magic_enum.hpp>
30#include <unordered_map>
46#include <api/board/board_types.pb.h>
47#include <google/protobuf/any.pb.h>
107 return wxT(
"TUNING_STATUS" );
111void TUNING_STATUS_VIEW_ITEM::Show(
int nestLevel, std::ostream& os )
const {}
145 m_max = std::numeric_limits<double>::max();
154 m_chainMax = std::numeric_limits<double>::max();
199 gal->
Scale( { 1., 1. } );
211 int totalHeaderLines = scopeLines + 1;
212 int totalLines = totalHeaderLines + valueLines;
213 VECTOR2I size( glyphWidth * 38 + margin.
x * 2,
215 VECTOR2I offset( margin.
x * 2, -( size.
y + margin.
y * 2 ) );
217 if( drawingDropShadows )
222 gal->
SetStrokeColor( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
223 KIGFX::COLOR4D bgColor( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
232 COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
233 COLOR4D normal = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
237 double bg_h, bg_s, bg_l;
238 bg.
ToHSL( bg_h, bg_s, bg_l );
241 red.FromHSL( 0.0, 1.0, bg_l < 0.5 ? 0.7 : 0.3 );
242 green.FromHSL( 120.0, 1.0, bg_l < 0.5 ? 0.8 : 0.2 );
276 textPos.
x += glyphWidth * 18 + margin.
x;
277 font->
Draw( gal,
_(
"min" ), textPos, textAttrs, fontMetrics );
278 textPos.
x += glyphWidth * 7 + margin.
x;
279 font->
Draw( gal,
_(
"max" ), textPos, textAttrs, fontMetrics );
295 textPos.
x += glyphWidth * 18 + margin.
x;
296 font->
Draw( gal,
m_minText, textPos, textAttrs, fontMetrics );
297 textPos.
x += glyphWidth * 7 + margin.
x;
298 font->
Draw( gal,
m_maxText, textPos, textAttrs, fontMetrics );
309 textPos.
x += glyphWidth * 18 + margin.
x;
311 textPos.
x += glyphWidth * 7 + margin.
x;
321 if( aStr ==
"single" )
323 else if( aStr ==
"diff_pair" )
325 else if( aStr ==
"diff_pair_skew" )
329 wxFAIL_MSG( wxS(
"Unknown length tuning token" ) );
342 default: wxFAIL;
return "";
349 switch( aRouterMode )
361 if( aStr ==
"default" )
363 else if( aStr ==
"left" )
365 else if( aStr ==
"right" )
369 wxFAIL_MSG( wxS(
"Unknown length-tuning side token" ) );
382 default: wxFAIL;
return "";
389 if( aStr ==
"too_long" )
391 else if( aStr ==
"too_short" )
393 else if( aStr ==
"tuned" )
397 wxFAIL_MSG( wxS(
"Unknown tuning status token" ) );
410 default: wxFAIL;
return "";
419 double* aDelayIUOut )
426 padCount += fp->Pads().size();
515 bool hasConstraint =
false;
516 bool isTimeDomain =
false;
521 effectiveTarget = netConstraint.
GetValue();
523 hasConstraint =
true;
530 wxString chainName = netInfo ? netInfo->
GetNetChain() : wxString();
532 if( !chainName.IsEmpty() )
538 double bridgingDelayIU = 0.0;
544 long long bridgingIU = isTimeDomain ?
static_cast<long long>( bridgingDelayIU )
547 if( adjustedTarget.
HasMin() )
551 if( adjustedTarget.
HasOpt() )
555 if( adjustedTarget.
HasMax() )
573 constraint = netConstraint.
IsNull() ? chainConstraint : netConstraint;
588 else if( isTimeDomain )
596 const std::shared_ptr<TUNING_PROFILES> tuningParams =
609 if( !constraint.
IsNull() )
637 aCommit->
Add(
this );
663 centerlineOffsetEnd =
670 baseEnd.
A += centerlineOffsetEnd;
671 baseEnd.
B += centerlineOffsetEnd;
673 if( baseEnd.
A != baseEnd.
B )
692 auto getTimeDomainTuningEnabled = [
this, aBoard]()
694 const std::shared_ptr<TUNING_PROFILES> tuningParams =
715 &pnsItem,
nullptr, layer, &constraint ) )
733 m_settings.m_isTimeDomain = getTimeDomainTuningEnabled();
746 pnsCoupledItem.
SetParent( coupledTrack );
747 pnsCoupledItem.
SetNet( coupledNet );
752 &pnsItem, &pnsCoupledItem, layer, &constraint ) )
770 m_settings.m_isTimeDomain = getTimeDomainTuningEnabled();
777 &pnsItem, &pnsCoupledItem, layer, &constraint ) )
826 std::optional<SHAPE_LINE_CHAIN>& aBaseLine )
833 VECTOR2I startSnapPoint, endSnapPoint;
838 wxASSERT( startItem );
841 if( !startItem || !endItem )
849 wxASSERT(
chain.PointOnEdge( startSnapPoint, 40000 ) );
850 wxASSERT(
chain.PointOnEdge( endSnapPoint, 40000 ) );
856 chain.Split( startSnapPoint, endSnapPoint, pre, mid, post );
871 wxCHECK( track,
false );
887 return initBaseLine( aRouter, aPNSLayer, aBoard, coupledStart, coupledEnd, coupledNet,
922 VECTOR2I startSnapPoint, endSnapPoint;
925 aPNSLayer, startSnapPoint, endSnapPoint );
927 wxCHECK( pnsLine,
false );
932 pnsLine->CLine().
Split( startSnapPoint, endSnapPoint, pre, mid, post );
940 straightChain.
Append( pre );
941 straightChain.
Append( aBaseLine );
942 straightChain.
Append( post );
945 PNS::LINE straightLine( *pnsLine, straightChain );
986 const std::vector<GENERATOR_PNS_CHANGES>& allPnsChanges = aTool->
GetRouterChanges();
990 const std::set<BOARD_ITEM*> routerRemovedItems = pnsChanges.removedItems;
991 const std::set<BOARD_ITEM*> routerAddedItems = pnsChanges.addedItems;
999 item->ClearSelected();
1004 aCommit->
Add( item );
1037 if( lineWidth == 0 || li->Width() < lineWidth )
1038 lineWidth = li->Width();
1048 if( lineWidth == 0 )
1059 recoverLine.
SetNet( recoverNet );
1060 branch->
Add( recoverLine,
false );
1067 recoverLineCoupled.
SetLayer( aPNSLayer );
1068 recoverLineCoupled.
SetWidth( lineWidth );
1070 recoverLineCoupled.
SetNet( recoverCoupledNet );
1071 branch->
Add( recoverLineCoupled,
false );
1089 VECTOR2I startSnapPoint, endSnapPoint;
1092 aPNSLayer, startSnapPoint, endSnapPoint );
1106 pnsLine->CLine().
Split( startSnapPoint, endSnapPoint, pre, mid, post );
1108 straightChain.
Append( pre );
1109 straightChain.
Append( aBaseLine );
1110 straightChain.
Append( post );
1114 branch->
Remove( *pnsLine );
1127 m_end = endSnapPoint;
1134 newLineChain.
Append( pre );
1135 newLineChain.
Append( mid );
1136 newLineChain.
Append( post );
1148 straightChain.
Split( start,
end, pre, mid, post );
1150 newLineChain.
Append( pre );
1151 newLineChain.
Append( mid );
1152 newLineChain.
Append( post );
1176 branch->
Add( line,
false );
1239 auto hideRemovedItems = [&](
bool aHide )
1245 for(
BOARD_ITEM* item : pnsCommit.removedItems )
1247 if( view && withinBounds( item ) )
1248 view->
Hide( item, aHide, aHide );
1291 hideRemovedItems(
true );
1293 VECTOR2I startSnapPoint, endSnapPoint;
1300 wxASSERT( startItem );
1301 wxASSERT( endItem );
1303 if( !startItem || !endItem )
1308 if( !router->
StartRouting( startSnapPoint, startItem, pnslayer ) )
1328 m_trackWidth = dpPlacer->GetOriginPair().Dimensions().Width();
1329 m_diffPairGap = dpPlacer->GetOriginPair().Dimensions().Gap();
1372 bool forceFinish =
true;
1373 bool forceCommit =
false;
1375 router->
FixRoute(
m_end,
nullptr, forceFinish, forceCommit );
1394 const std::vector<GENERATOR_PNS_CHANGES>& pnsCommits = aTool->
GetRouterChanges();
1398 const std::set<BOARD_ITEM*> routerRemovedItems = pnsCommit.removedItems;
1399 const std::set<BOARD_ITEM*> routerAddedItems = pnsCommit.addedItems;
1412 view->
Hide( item,
false );
1430 if( !withinBounds( item ) )
1439 aCommit->
Add( item );
1441 if( withinBounds( item ) )
1463 for(
BOARD_ITEM* item : pnsCommit.removedItems )
1464 view->Hide( item,
false );
1489 base.
A += centerlineOffset;
1490 base.
B += centerlineOffset;
1500 VECTOR2I widthHandleOffset = ( base.
B - base.
A ).Perpendicular().Resize( amplitude );
1502 aPoints.
AddPoint( base.
A + widthHandleOffset );
1508 aPoints.
AddPoint( base.
A + spacingHandleOffset );
1529 base.
A += centerlineOffset;
1530 base.
B += centerlineOffset;
1548 int side = base.
Side( wHandle );
1584 base.
A += centerlineOffset;
1585 base.
B += centerlineOffset;
1595 VECTOR2I widthHandleOffset = ( base.
B - base.
A ).Perpendicular().Resize( amplitude );
1615 int clampedMaxAmplitude =
m_settings.m_maxAmplitude;
1616 int minAllowedAmplitude = 0;
1626 minAllowedAmplitude = baselineOffset +
correction;
1629 clampedMaxAmplitude = std::max( clampedMaxAmplitude, minAllowedAmplitude );
1647 chain.SetClosed(
true );
1752 size = std::max( size,
pcbIUScale.mmToIU( 0.05 ) );
1758 for(
int i = 0; i <
m_baseLine->SegmentCount(); i++ )
1781 for(
int i = 0; i <
chain.SegmentCount(); i++ )
1799 props.
set(
"corner_radius_percent",
m_settings.m_cornerRadiusPercentage );
1820 props.
set(
"override_custom_rules",
m_settings.m_overrideCustomRules );
1836 wxString tuningMode;
1837 aProps.
get_to(
"tuning_mode", tuningMode );
1841 aProps.
get_to(
"initial_side", side );
1845 aProps.
get_to(
"last_status", status );
1851 aProps.
get_to(
"corner_radius_percent",
m_settings.m_cornerRadiusPercentage );
1855 bool rounded =
false;
1856 aProps.
get_to(
"rounded", rounded );
1861 aProps.
get_to_iu(
"target_length", val );
1864 if( aProps.
get_to_iu(
"target_length_min", val ) )
1867 if( aProps.
get_to_iu(
"target_length_max", val ) )
1870 aProps.
get_to_iu(
"target_delay", val );
1873 if( aProps.
get_to_iu(
"target_delay_min", val ) )
1874 m_settings.m_targetLengthDelay.SetMin( val );
1876 if( aProps.
get_to_iu(
"target_delay_max", val ) )
1877 m_settings.m_targetLengthDelay.SetMax( val );
1881 aProps.
get_to_iu(
"target_skew", int_val );
1884 if( aProps.
get_to_iu(
"target_skew_min", int_val ) )
1887 if( aProps.
get_to_iu(
"target_skew_max", int_val ) )
1896 aProps.
get_to(
"override_custom_rules",
m_settings.m_overrideCustomRules );
1917 default:
return _(
"unknown" );
1941 TuningPattern pattern;
1943 pattern.mutable_id()->set_value(
m_Uuid.AsStdString() );
1949 TuningPatternSettings* settings = pattern.mutable_settings();
1952 settings->set_corner_radius_percent(
m_settings.m_cornerRadiusPercentage );
1953 settings->set_single_sided(
m_settings.m_singleSided );
1954 settings->mutable_max_amplitude()->set_value_nm(
pcbIUScale.IUToNm(
m_settings.m_maxAmplitude ) );
1955 settings->mutable_min_amplitude()->set_value_nm(
pcbIUScale.IUToNm(
m_settings.m_minAmplitude ) );
1958 pattern.set_target_mode(
m_settings.m_isTimeDomain ? TuningPatternTargetMode::TPTM_TIME_DOMAIN
1959 : TuningPatternTargetMode::TPTM_LENGTH );
1961 pattern.set_override_custom_rules(
m_settings.m_overrideCustomRules );
1967 TimeRange* range = pattern.mutable_target_skew_delay();
1970 range->set_min_as(
m_settings.m_targetSkewDelay.Min() );
1973 range->set_opt_as(
m_settings.m_targetSkewDelay.Opt() );
1976 range->set_max_as(
m_settings.m_targetSkewDelay.Max() );
1980 kiapi::common::types::MinOptMax* range = pattern.mutable_target_skew();
1983 range->set_min(
m_settings.m_targetSkew.Min() );
1986 range->set_opt(
m_settings.m_targetSkew.Opt() );
1989 range->set_max(
m_settings.m_targetSkew.Max() );
1994 TimeRange* range = pattern.mutable_target_delay();
1996 if(
m_settings.m_targetLengthDelay.HasMin() )
1997 range->set_min_as(
m_settings.m_targetLengthDelay.Min() );
1999 if(
m_settings.m_targetLengthDelay.HasOpt() )
2000 range->set_opt_as(
m_settings.m_targetLengthDelay.Opt() );
2002 if(
m_settings.m_targetLengthDelay.HasMax() )
2003 range->set_max_as(
m_settings.m_targetLengthDelay.Max() );
2007 kiapi::common::types::MinOptMax* range = pattern.mutable_target_length();
2010 range->set_min(
m_settings.m_targetLength.Min() );
2013 range->set_opt(
m_settings.m_targetLength.Opt() );
2016 range->set_max(
m_settings.m_targetLength.Max() );
2019 TuningPatternState* state = pattern.mutable_state();
2025 pattern.set_locked(
IsLocked() ? LockedState::LS_LOCKED : LockedState::LS_UNLOCKED );
2028 pattern.mutable_parent()->set_value(
board->m_Uuid.AsStdString() );
2031 pattern.add_members()->set_value( member->m_Uuid.AsStdString() );
2034 aContainer.PackFrom( pattern );
2043 TuningPattern pattern;
2045 if( !aContainer.UnpackTo( &pattern ) )
2059 const TuningPatternSettings& settings = pattern.settings();
2062 m_settings.m_cornerRadiusPercentage = settings.corner_radius_percent();
2063 m_settings.m_singleSided = settings.single_sided();
2067 m_settings.m_overrideCustomRules = pattern.override_custom_rules();
2069 switch( pattern.target_case() )
2071 case TuningPattern::kTargetLength:
2073 const kiapi::common::types::MinOptMax& range = pattern.target_length();
2077 if( range.has_opt() )
2080 if( range.has_min() )
2081 m_settings.m_targetLength.SetMin( range.min() );
2083 if( range.has_max() )
2084 m_settings.m_targetLength.SetMax( range.max() );
2089 case TuningPattern::kTargetDelay:
2091 const TimeRange& range = pattern.target_delay();
2095 if( range.has_opt_as() )
2096 m_settings.SetTargetLengthDelay( range.opt_as() );
2098 if( range.has_min_as() )
2099 m_settings.m_targetLengthDelay.SetMin( range.min_as() );
2101 if( range.has_max_as() )
2102 m_settings.m_targetLengthDelay.SetMax( range.max_as() );
2107 case TuningPattern::kTargetSkew:
2109 const kiapi::common::types::MinOptMax& range = pattern.target_skew();
2113 if( range.has_opt() )
2116 if( range.has_min() )
2117 m_settings.m_targetSkew.SetMin( range.min() );
2119 if( range.has_max() )
2120 m_settings.m_targetSkew.SetMax( range.max() );
2125 case TuningPattern::kTargetSkewDelay:
2127 const TimeRange& range = pattern.target_skew_delay();
2131 if( range.has_opt_as() )
2132 m_settings.SetTargetSkewDelay( range.opt_as() );
2134 if( range.has_min_as() )
2135 m_settings.m_targetSkewDelay.SetMin( range.min_as() );
2137 if( range.has_max_as() )
2138 m_settings.m_targetSkewDelay.SetMax( range.max_as() );
2143 case TuningPattern::TARGET_NOT_SET:
break;
2146 if( pattern.has_state() )
2148 const TuningPatternState& state = pattern.state();
2153 SetLocked( pattern.locked() == LockedState::LS_LOCKED );
2159 for(
const kiapi::common::types::KIID& memberId : pattern.members() )
2240 commit.
Push(
_(
"Edit Tuning Pattern" ) );
2247 bool aStatusItemsOnly )
2249 std::vector<EDA_ITEM*> previewItems;
2254 if( !aStatusItemsOnly )
2270 wxString netChainName;
2271 if(
board && !netName.IsEmpty() )
2277 netChainName = net->GetNetChain();
2282 if( !netName.IsEmpty() )
2284 if( !netChainName.IsEmpty() )
2285 scopeLine = wxString::Format(
_(
"%s | %s" ), netName, netChainName );
2287 scopeLine = netName;
2302 bool hasNetConstraint =
false;
2304 if(
board &&
board->GetDesignSettings().m_DRCEngine )
2312 if( tr->GetNet() &&
UnescapeString( tr->GetNet()->GetNetname() ) == netName )
2330 hasNetConstraint =
true;
2335 if( !hasNetConstraint )
2340 if( !netChainName.IsEmpty() &&
board &&
board->GetDesignSettings().m_DRCEngine )
2389 statusItem->
SetCurrent( 0.0,
_(
"current skew" ) );
2391 statusItem->
SetCurrent( 0.0,
_(
"current delay" ) );
2393 statusItem->
SetCurrent( 0.0,
_(
"current length" ) );
2397 double netVal =
m_settings.m_isTimeDomain ?
static_cast<double>( placer->TuningDelayResult() )
2398 :
static_cast<double>( placer->TuningLengthResult() );
2404 bool hasSignal =
false;
2405 if( !netChainName.IsEmpty() &&
board )
2407 double chainBoardLen = 0.0;
2408 double chainBoardDelay = 0.0;
2412 std::unordered_map<int, PCB_TRACK*> repByNet;
2417 repByNet.emplace( tr->GetNetCode(), tr );
2422 if( net->GetNetChain() != netChainName )
2425 auto it = repByNet.find( net->GetNetCode() );
2427 if( it != repByNet.end() && it->second )
2429 int cnt = 0;
double trk = 0, pd = 0, tDel = 0, pdDel = 0;
2430 std::tie( cnt, trk, pd, tDel, pdDel ) =
board->GetTrackLength( *it->second );
2431 chainBoardLen += trk + pd;
2432 chainBoardDelay += tDel + pdDel;
2437 double tuningDelta = 0.0;
2439 if( placer->HasBaseline() )
2442 ?
static_cast<double>( placer->TuningDelayDelta() )
2443 :
static_cast<double>( placer->TuningLengthDelta() );
2446 double sigVal = (
m_settings.m_isTimeDomain ? chainBoardDelay : chainBoardLen )
2450 double delayIU = 0.0;
2458 sigVal +=
static_cast<double>( bridging );
2461 sigStr = wxString::Format(
_(
"Chain: %s" ),
2468 previewItems.push_back( statusItem );
2471 return previewItems;
2476 std::vector<MSG_PANEL_ITEM>& aList )
2485 bool mixedWidth =
false;
2497 primaryItem = track;
2498 primaryNet = track->GetNet();
2500 else if( !coupledNet && track->GetNet() != primaryNet )
2502 coupledItem = track;
2503 coupledNet = track->GetNet();
2507 netclass = track->GetEffectiveNetClass();
2510 width = track->GetWidth();
2511 else if( width != track->GetWidth() )
2522 else if( primaryNet )
2528 aList.emplace_back(
_(
"Resolved Netclass" ),
2534 if( primaryNet && !primaryNet->
GetNetChain().IsEmpty() )
2535 aList.emplace_back(
_(
"Net Chain" ), primaryNet->
GetNetChain() );
2537 if( width && !mixedWidth )
2541 std::shared_ptr<DRC_ENGINE>& drcEngine =
board->GetDesignSettings().m_DRCEngine;
2548 double trackLen = 0.0;
2549 double lenPadToDie = 0.0;
2550 double trackDelay = 0.0;
2551 double delayPadToDie = 0.0;
2553 std::tie( count, trackLen, lenPadToDie, trackDelay, delayPadToDie ) =
board->GetTrackLength( *primaryItem );
2555 if( coupledItem && coupledItem->
GetNetCode() > 0 )
2557 double coupledLen = 0.0;
2558 double coupledLenPadToDie = 0.0;
2559 double coupledTrackDelay = 0.0;
2560 double doubledDelayPadToDie = 0.0;
2562 std::tie( count, coupledLen, coupledLenPadToDie, coupledTrackDelay, doubledDelayPadToDie ) =
2563 board->GetTrackLength( *coupledItem );
2565 if( trackDelay == 0.0 || coupledTrackDelay == 0.0 )
2573 _(
"Routed Delays" ),
2580 if( trackDelay == 0.0 )
2586 aList.emplace_back(
_(
"Routed Delay" ),
2591 if( lenPadToDie != 0 && delayPadToDie == 0.0 )
2594 aList.emplace_back(
_(
"Pad To Die Length" ), msg );
2597 aList.emplace_back(
_(
"Full Length" ), msg );
2599 else if( delayPadToDie > 0.0 )
2602 aList.emplace_back(
_(
"Pad To Die Delay" ), msg );
2605 aList.emplace_back(
_(
"Full Delay" ), msg );
2609 if( primaryNet && !primaryNet->
GetNetChain().IsEmpty() )
2612 double totalOtherLen = 0.0;
2613 double totalOtherDelay = 0.0;
2619 if( other->GetNetChain() != chainName || other == primaryNet )
2623 double oTrackLen = 0.0, oPadDieLen = 0.0, oTrackDelay = 0.0, oPadDieDelay = 0.0;
2629 if( tr->GetNetCode() == other->GetNetCode() ) { anyTrack = tr;
break; }
2635 std::tie( dummyCount, oTrackLen, oPadDieLen, oTrackDelay, oPadDieDelay ) =
2637 totalOtherLen += ( oTrackLen + oPadDieLen );
2638 totalOtherDelay += ( oTrackDelay + oPadDieDelay );
2644 if( trackDelay == 0.0 )
2646 double delayIUDummy = 0.0;
2648 aList.emplace_back(
_(
"Net Chain Full Length" ),
2650 + (
double) bridging ) );
2654 double bridgingDelayIU = 0.0;
2656 aList.emplace_back(
_(
"Net Chain Full Delay" ),
2672 aList.emplace_back( wxString::Format(
_(
"Target Skew: %s" ), msg ),
2673 wxString::Format(
_(
"(from tuning pattern properties)" ) ) );
2679 if( !msg.IsEmpty() )
2681 aList.emplace_back( wxString::Format(
_(
"Skew Constraints: %s" ), msg ),
2682 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2700 caption =
_(
"Target Delay: %s" );
2706 caption =
_(
"Target Length: %s" );
2710 aList.emplace_back( wxString::Format( caption, msg ),
2711 wxString::Format(
_(
"(from tuning pattern properties)" ) ) );
2717 wxString caption =
m_settings.m_isTimeDomain ?
_(
"Delay Constraints: %s" ) :
_(
"Length Constraints: %s" );
2719 if( !msg.IsEmpty() )
2721 aList.emplace_back( wxString::Format( caption, msg ),
2722 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2736#define HITTEST_THRESHOLD_PIXELS 5
2756 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
2782 auto applyCommonSettings =
2785 const auto origTargetLength = aPattern->GetSettings().m_targetLength;
2786 const auto origTargetLengthDelay = aPattern->GetSettings().m_targetLengthDelay;
2787 const auto origTargetSignalLength = aPattern->GetSettings().m_targetSignalLength;
2788 const auto origTargetSignalLengthDelay = aPattern->GetSettings().m_targetSignalLengthDelay;
2789 const auto origTargetSkew = aPattern->GetSettings().m_targetSkew;
2790 const bool origIsTimeDomain = aPattern->GetSettings().m_isTimeDomain;
2792 aPattern->GetSettings() = meanderSettings;
2796 aPattern->GetSettings().m_targetLengthDelay = origTargetLengthDelay;
2797 aPattern->GetSettings().m_targetSignalLength = origTargetSignalLength;
2798 aPattern->GetSettings().m_targetSignalLengthDelay = origTargetSignalLengthDelay;
2799 aPattern->GetSettings().m_targetSkew = origTargetSkew;
2800 aPattern->GetSettings().m_isTimeDomain = origIsTimeDomain;
2803 auto updateHoverStatus =
2806 std::unique_ptr<PCB_TUNING_PATTERN> dummyPattern;
2812 dummyPattern->SetPosition(
m_pickerItem->GetFocusPosition() );
2813 dummyPattern->SetEnd(
m_pickerItem->GetFocusPosition() );
2818 applyCommonSettings( dummyPattern.get() );
2820 dummyPattern->EditStart( generatorTool,
m_board,
nullptr );
2821 dummyPattern->Update( generatorTool,
m_board,
nullptr );
2825 for(
EDA_ITEM* item : dummyPattern->GetPreviewItems( generatorTool,
m_frame ) )
2840 auto updateTuningPattern =
2861 if( evt->IsCancelInteractive() || evt->IsActivate()
2887 guide.SetIncludeSecondary(
false );
2889 guide.SetIncludeSecondary(
true );
2891 guide.SetPreferredLayer(
m_frame->GetActiveLayer() );
2902 double min_dist_sq = std::numeric_limits<double>::max();
2904 for(
EDA_ITEM* candidate : collector )
2910 candidatePos =
static_cast<PCB_TRACK*
>( candidate )->GetCenter();
2912 else if( candidate->Type() ==
PCB_ARC_T )
2914 candidatePos =
static_cast<PCB_ARC*
>( candidate )->GetMid();
2917 double dist_sq = ( cursorPos - candidatePos ).SquaredEuclideanNorm();
2919 if( dist_sq < min_dist_sq )
2921 min_dist_sq = dist_sq;
2927 updateHoverStatus();
2936 updateTuningPattern();
2947 m_frame->ShowInfoBarWarning(
_(
"Unable to tune segments inside other tuning patterns." ) );
2962 int dummyClearance = std::numeric_limits<int>::max() / 2;
2967 if(
m_pickerItem->GetEffectiveShape()->Collide( cursorPos, dummyClearance, &dummyDist,
2986 commit.
Push(
_(
"Tune" ) );
3008 meanderSettings.
m_spacing = placer->MeanderSettings().m_spacing;
3010 updateTuningPattern();
3015 m_frame->ShowInfoBarWarning(
_(
"Select a track to tune first." ) );
3028 m_tuningPattern->SetMaxAmplitude( placer->MeanderSettings().m_maxAmplitude );
3029 meanderSettings.
m_maxAmplitude = placer->MeanderSettings().m_maxAmplitude;
3031 updateTuningPattern();
3036 m_frame->ShowInfoBarWarning(
_(
"Select a track to tune first." ) );
3062 updateTuningPattern();
3073 evt->SetPassEvent();
3082 controls->ForceCursorPosition(
false );
3089 m_frame->GetCanvas()->Refresh();
3121 if( layerEnum.
Choices().GetCount() == 0 )
3140 const wxString groupTechLayers =
_HKI(
"Technical Layers" );
3151 const wxString groupTab =
_HKI(
"Pattern Properties" );
3204 return pattern->GetSettings().m_isTimeDomain;
3209 auto isLengthIsSpaceDomain =
3212 return !isSkew( aItem ) && !isTimeDomain( aItem );
3215 auto isLengthIsTimeDomain =
3218 return !isSkew( aItem ) && isTimeDomain( aItem );
3221 auto isSkewIsSpaceDomain =
3224 return isSkew( aItem ) && !isTimeDomain( aItem );
3227 auto isSkewIsTimeDomain =
3230 return isSkew( aItem ) && isTimeDomain( aItem );
3277template <typename
T>
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
NETINFO_ITEM * GetNet() const
Return NETINFO_ITEM object for a given item.
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings
PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings
PNS::MEANDER_SETTINGS m_SkewMeanderSettings
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual wxString LayerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
std::tuple< int, double, double, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr void SetMaximum()
int GetCount() const
Return the number of objects in the list.
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
bool GetOption(OPTIONS option) const
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
The base class for create windows for drawing purpose.
std::unordered_set< EDA_ITEM * > m_items
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
std::unordered_set< EDA_ITEM * > m_deserializedItems
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFlags(EDA_ITEM_FLAGS aMask)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
EDA_ITEM_FLAGS GetFlags() const
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
void AddPoint(const EDIT_POINT &aPoint)
Add an EDIT_POINT.
EDIT_POINT & Point(unsigned int aIndex)
void SetGridConstraint(GRID_CONSTRAINT_TYPE aConstraint)
static const int POINT_SIZE
Single point size in pixels.
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
static const TOOL_EVENT SelectedItemsModified
Selected item had a property changed (except movement)
A general implementation of a COLLECTORS_GUIDE.
Used when the right click button is pressed, or when the select tool is in effect.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
A factory which returns an instance of a PCB_GENERATOR.
void Register(const wxString &aTypeStr, const wxString &aName, std::function< PCB_GENERATOR *(void)> aCreateFunc)
Associate a type string to display name and create function.
static GENERATORS_MGR & Instance()
Class that other classes need to inherit from, in order to be inspectable.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
Draw a string.
static const METRICS & Default()
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
void ToHSL(double &aOutHue, double &aOutSaturation, double &aOutLightness) const
Converts current color (stored in RGB) to HSL format.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void Restore()
Restore the context.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
virtual void Save()
Save the context.
A KIGFX::PREVIEW::DRAW_CONTEXT is a wrapper around a GAL and some other settings that makes it easy t...
void DrawLineDashed(const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDashStep, int aDashFill, bool aDeEmphasised)
Draw a dashed line on the current layer.
An interface for classes handling user events controlling the view behavior such as zooming,...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
void Hide(VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
Temporarily hide the item in the view (e.g.
bool CanCalculateLengthForDelay(const TUNING_PROFILE_GEOMETRY_CONTEXT &aCtx) const
Returns true if a track length can be derived from a delay in a specific geometry context.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
A collection of nets and the parameters used to route or test these nets.
const wxString GetHumanReadableName() const
Gets the consolidated name of this netclass (which may be an aggregate).
wxString GetTuningProfile() const
bool HasTuningProfile() const
Handle the data for a net.
const wxString & GetNetChain() const
const wxString & GetNetname() const
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION spacingDecrease
static TOOL_ACTION amplIncrease
static TOOL_ACTION amplDecrease
static TOOL_ACTION lengthTunerSettings
static TOOL_ACTION spacingIncrease
Common, abstract interface for edit frames.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
virtual void SetProperties(const STRING_ANY_MAP &aProps)
PCB_GENERATOR(BOARD_ITEM *aParent, PCB_LAYER_ID aLayer)
void SetPosition(const VECTOR2I &aPos) override
VECTOR2I GetPosition() const override
virtual const STRING_ANY_MAP GetProperties() const
void SetLocked(bool aLocked) override
void SetTargetSkew(int aValue)
bool initBaseLines(PNS::ROUTER *aRouter, int aPNSLayer, BOARD *aBoard)
const STRING_ANY_MAP GetProperties() const override
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void SetMinAmplitude(int aValue)
bool recoverBaseline(PNS::ROUTER *aRouter, int aPNSLayer)
void SetSpacing(int aValue)
static const wxString DISPLAY_NAME
size_t m_cachedBridgingPadCount
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
PNS::ROUTER_MODE GetPNSMode()
bool initBaseLine(PNS::ROUTER *aRouter, int aPNSLayer, BOARD *aBoard, VECTOR2I &aStart, VECTOR2I &aEnd, NETINFO_ITEM *aNet, std::optional< SHAPE_LINE_CHAIN > &aBaseLine)
void SetTargetSkewDelay(int aValue)
static wxString StatusMessage(PNS::MEANDER_PLACER_BASE::TUNING_STATUS aStatus)
PCB_TUNING_PATTERN(BOARD_ITEM *aParent=nullptr, PCB_LAYER_ID aLayer=F_Cu, LENGTH_TUNING_MODE aMode=LENGTH_TUNING_MODE::SINGLE)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetWidth(int aValue)
PNS::MEANDER_SIDE GetInitialSide() const
std::optional< int > GetLocalSolderMaskMargin() const
bool HasSolderMask() const
void SetInitialSide(PNS::MEANDER_SIDE aValue)
wxString GetFriendlyName() const override
void SetTargetDelay(std::optional< int > aValue)
LENGTH_TUNING_MODE GetTuningMode() const
void SetHasSolderMask(bool aVal)
std::optional< int > GetTargetDelay() const
std::vector< EDA_ITEM * > GetPreviewItems(GENERATOR_TOOL *aTool, PCB_BASE_EDIT_FRAME *aFrame, bool aStatusItemsOnly=false) override
int GetMinAmplitude() const
long long m_cachedBridgingLen
double m_cachedBridgingDelayIU
void EditStart(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
long long GetCachedBridgingLength(BOARD *aBoard, const wxString &aNetChain, double *aDelayIUOut)
void SetOverrideCustomRules(bool aOverride)
void SetRounded(bool aFlag)
LENGTH_TUNING_MODE m_tuningMode
static const wxString GENERATOR_TYPE
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
bool resetToBaseline(GENERATOR_TOOL *aTool, int aPNSLayer, SHAPE_LINE_CHAIN &aBaseLine, bool aPrimary)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
bool MakeEditPoints(EDIT_POINTS &points) const override
void SetCornerRadiusPercentage(int aValue)
PNS::MEANDER_PLACER_BASE::TUNING_STATUS m_tuningStatus
std::optional< SHAPE_LINE_CHAIN > m_baseLineCoupled
const BOARD * m_cachedBridgingBoardPtr
void SetProperties(const STRING_ANY_MAP &aProps) override
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
void Remove(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
bool UpdateFromEditPoints(EDIT_POINTS &aEditPoints) override
std::optional< SHAPE_LINE_CHAIN > m_baseLine
int GetMaxAmplitude() const
PNS::MEANDER_SETTINGS m_settings
wxString m_cachedBridgingSignal
void ShowPropertiesDialog(PCB_BASE_EDIT_FRAME *aEditFrame) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool Update(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void SetNetCode(int aNetCode)
bool UpdateEditPoints(EDIT_POINTS &aEditPoints) override
int GetTargetSkewDelay() const
void EditCancel(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
bool GetOverrideCustomRules() const
void SetMaxAmplitude(int aValue)
void SetSingleSided(bool aValue)
bool removeToBaseline(PNS::ROUTER *aRouter, int aPNSLayer, SHAPE_LINE_CHAIN &aBaseLine)
std::optional< int > GetTargetLength() const
void EditFinish(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
int GetCornerRadiusPercentage() const
SHAPE_LINE_CHAIN getOutline() const
void SetTargetLength(std::optional< int > aValue)
bool IsSingleSided() const
static PCB_TUNING_PATTERN * CreateNew(GENERATOR_TOOL *aTool, PCB_BASE_EDIT_FRAME *aFrame, BOARD_CONNECTED_ITEM *aStartItem, LENGTH_TUNING_MODE aMode)
int GetTargetSkew() const
Differential Pair length-matching/meandering tool.
Base class for PNS router board items.
virtual NET_HANDLE Net() const
void SetNet(NET_HANDLE aNet)
void SetLayer(int aLayer)
void SetParent(BOARD_ITEM *aParent)
bool OfKind(int aKindMask) const
virtual VECTOR2I Anchor(int n) const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
const SHAPE_LINE_CHAIN & CLine() const
SHAPE_LINE_CHAIN & Line()
Modifiable accessor to the underlying shape.
void SetWidth(int aWidth)
Set line width.
virtual int Width() const
bool ContainsLink(const LINKED_ITEM *aItem) const
Check if the segment aLink is a part of the line.
std::vector< LINKED_ITEM * > & Links()
Return the list of links from the owning node that constitute this line (or NULL if the line is not l...
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
virtual void UpdateSettings(const MEANDER_SETTINGS &aSettings)
TUNING_STATUS
Result of the length tuning operation.
virtual TUNING_STATUS TuningStatus() const =0
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
virtual const MEANDER_SETTINGS & MeanderSettings() const
Return the current meandering configuration.
virtual long long int TuningLengthResult() const =0
Return the resultant length or skew of the tuned traces.
Dimensions for the meandering algorithm.
void SetTargetLength(long long int aOpt)
bool m_isTimeDomain
Calculate tuning in the time domain.
void SetTargetLengthDelay(long long int aOpt)
MINOPTMAX< long long int > m_targetLength
Desired length of the tuned line/diff pair (this is in nm, so allow more than board width).
NETCLASS * m_netClass
The net class this meander pattern belongs to.
void SetTargetSignalLengthDelay(long long int aOpt)
void SetTargetSkew(int aOpt)
void SetTargetSignalLength(long long int aOpt)
int m_maxAmplitude
Maximum meandering amplitude.
bool m_overrideCustomRules
void SetTargetSkewDelay(int aOpt)
int m_spacing
Meandering period/spacing (see dialog picture for explanation).
Keep the router "world" - i.e.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
std::set< OBSTACLE > OBSTACLES
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=nullptr, bool aStopAtLockedJoints=false, bool aFollowLockedSegments=false, bool aAllowSegmentSizeMismatch=true)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
int QueryColliding(const ITEM *aItem, OBSTACLES &aObstacles, const COLLISION_SEARCH_OPTIONS &aOpts=COLLISION_SEARCH_OPTIONS()) const
Find items colliding (closer than clearance) with the item aItem.
ITEM * FindItemByParent(const BOARD_ITEM *aParent)
void Remove(ARC *aArc)
Remove an item from this branch.
virtual int GetPNSLayerFromBoardLayer(PCB_LAYER_ID aLayer) const =0
virtual void RemoveItem(ITEM *aItem)=0
virtual void AddItem(ITEM *aItem)=0
void SetMode(ROUTER_MODE aMode)
PLACEMENT_ALGO * Placer()
ROUTER_IFACE * GetInterface() const
RULE_RESOLVER * GetRuleResolver() const
bool RoutingInProgress() const
bool StartRouting(const VECTOR2I &aP, ITEM *aItem, int aLayer)
bool FixRoute(const VECTOR2I &aP, ITEM *aItem, bool aForceFinish, bool aForceCommit)
bool Move(const VECTOR2I &aP, ITEM *aItem)
virtual int Clearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true)=0
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const ITEM *aItemA, const ITEM *aItemB, int aLayer, CONSTRAINT *aConstraint)=0
void SetShape(SHAPE *shape)
void SetStartLayerFromPCBNew(PCB_LAYER_ID aLayer)
int GetPNSLayerFromBoardLayer(PCB_LAYER_ID aLayer) const override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false, int aFlags=0) override
void EraseView() override
wxString GetNetName(PNS::NET_HANDLE aNet) const override
std::shared_ptr< TUNING_PROFILES > & TuningProfileParameters()
virtual PROJECT_FILE & GetProjectFile() const
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
virtual void SetChoices(const wxPGChoices &aChoices)
Set the possible values for for the property.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
RAII class that sets an value at construction and resets it to the original value at destruction.
int LineDistance(const VECTOR2I &aP, bool aDetermineSide=false) const
Return the closest Euclidean distance between point aP and the line defined by the ends of segment (t...
int Side(const VECTOR2I &aP) const
Determine on which side of directed line passing via segment ends point aP lies.
bool PointOnEdge(const VECTOR2I &aP, int aAccuracy=0) const
Check if point aP lies on an edge or vertex of the line chain.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN Reverse() const
Reverse point order in the line chain.
int Split(const VECTOR2I &aP, bool aExact=false)
Insert the point aP belonging to one of the our segments, splitting the adjacent segment in two.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Simplify(int aTolerance=0)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
int SegmentCount() const
Return the number of segments in this line chain.
const VECTOR2I & CLastPoint() const
Return the last point in the line chain.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
bool OffsetLine(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, SHAPE_LINE_CHAIN &aLeft, SHAPE_LINE_CHAIN &aRight, bool aSimplify=false) const
Creates line chains aLeft and aRight offset to this line chain.
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void OffsetLineChain(const SHAPE_LINE_CHAIN &aLine, int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify)
Perform offsetting of a line chain.
int OutlineCount() const
Return the number of outlines in the set.
A name/value tuple with unique names and wxAny values.
void set_iu(const std::string &aKey, const T &aVar)
bool get_to(const std::string &aKey, T &aVar) const
std::optional< T > get_opt(const std::string &aKey) const
void set(const std::string &aKey, const T &aVar)
bool get_to_iu(const std::string &aKey, T &aVar) const
GR_TEXT_H_ALIGN_T m_Halign
void SetIsTimeDomain(const bool aIsTimeDomain)
void SetCurrent(const double aCurrent, const wxString &aLabel)
wxString GetClass() const override
Return the class name.
VECTOR2I GetPosition() const override
void SetScopeLine(const wxString &aLine)
void SetMinMax(const double aMin, const double aMax)
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
void SetChainMinMax(const double aMin, const double aMax)
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
TUNING_STATUS_VIEW_ITEM(PCB_BASE_EDIT_FRAME *aFrame)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetNetAndSignalValues(const wxString &aNetVal, const wxString &aSignalVal, bool aHasSignal)
void SetPosition(const VECTOR2I &aPos) override
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
wxString MessageTextFromMinOptMax(const MINOPTMAX< int > &aValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
PCB_TUNING_PATTERN * m_pattern
UNLOCKER(PCB_TUNING_PATTERN *aPattern)
@ ROUND_ALL_CORNERS
All angles are rounded.
@ NET_CHAIN_LENGTH_CONSTRAINT
#define IS_NEW
New item, just created.
#define IN_EDIT
Item currently edited.
EDA_DATA_TYPE
The type of unit.
a few functions useful in geometry calculations.
PCB_LAYER_ID
A quick note on layer IDs:
KICOMMON_API wxString MessageTextFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
TEXT_DIMS GetConstantGlyphHeight(KIGFX::GAL *aGal, int aRelativeSize=0)
Set the GAL glyph height to a constant scaled value, so that it always looks the same on screen.
Push and Shove diff pair dimensions (gap) settings dialog.
MEANDER_SIDE
Initial side the meander is placed on.
@ PNS_MODE_TUNE_DIFF_PAIR
@ PNS_MODE_TUNE_DIFF_PAIR_SKEW
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
std::tuple< double, double > BoardChainBridging(const BOARD *aBoard, const wxString &aNetChain, const double aDefaultBridgeUnitDelay)
Compute both the chain bridging length and its associated propagation delay (in internal delay IU,...
int SubtractBridgingClamped(int aValue, long long aDelta)
Saturating subtract for bridge-adjusting MINOPTMAX<int> bounds without overflow when the delta is in ...
Class to handle a set of BOARD_ITEMs.
static PNS::MEANDER_SIDE sideFromString(const std::string &aStr)
static LENGTH_TUNING_MODE tuningFromString(const std::string &aStr)
static std::string tuningToString(const LENGTH_TUNING_MODE aTuning)
static struct PCB_TUNING_PATTERN_DESC _PCB_TUNING_PATTERN_DESC
static LENGTH_TUNING_MODE fromPNSMode(PNS::ROUTER_MODE aRouterMode)
static PNS::MEANDER_PLACER_BASE::TUNING_STATUS statusFromString(const std::string &aStr)
static std::string sideToString(const PNS::MEANDER_SIDE aValue)
static std::string statusToString(const PNS::MEANDER_PLACER_BASE::TUNING_STATUS aStatus)
static GENERATORS_MGR::REGISTER< PCB_TUNING_PATTERN > registerMe
static std::optional< PNS::LINE > getPNSLine(const VECTOR2I &aStart, const VECTOR2I &aEnd, PNS::ROUTER *router, int layer, VECTOR2I &aStartOut, VECTOR2I &aEndOut)
static REGISTER_LEGACY_TUNING_PATTERN< PCB_TUNING_PATTERN > registerMeToo
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define NO_SETTER(owner, type)
Macro to define read-only fields (no setter method available)
#define ENUM_TO_WXANY(type)
@ PT_DEFAULT
Default property for a given type.
@ PT_SIZE
Size expressed in distance units (mm/inch)
@ PT_NET
Net selection property.
@ PT_TIME
Time expressed in ps.
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
constexpr double correction
#define HITTEST_THRESHOLD_PIXELS
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
PCB_TUNING_PATTERN_DESC()
bool m_useClearanceEpsilon
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
static VECTOR2I SnapToNearestTrack(const VECTOR2I &aP, BOARD *aBoard, NETINFO_ITEM *aNet, PCB_TRACK **aNearestTrack)
static LINKED_ITEM * PickSegment(ROUTER *aRouter, const VECTOR2I &aWhere, int aLayer, VECTOR2I &aPointOut, const SHAPE_LINE_CHAIN &aBaseline=SHAPE_LINE_CHAIN())
Hold an object colliding with another object, along with some useful data about the collision.
REGISTER_LEGACY_TUNING_PATTERN()
A data structure to contain basic geometry data which can affect signal propagation calculations.
int64_t DiffPairCouplingGap
The gap between coupled tracks.
const NETCLASS * NetClass
The net class this track belongs to.
int64_t Width
The width (in internal units) of the track.
bool IsDiffPairCoupled
Whether this track or via is a member of a coupled differential pair.
PCB_LAYER_ID Layer
The layer this track is on.
Represents a single line in the tuning profile configuration grid.
bool m_EnableTimeDomainTuning
const SHAPE_LINE_CHAIN chain
double DEG2RAD(double deg)
@ NOT_USED
the 3d code uses this value
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D