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();
204 gal->
Scale( { 1., 1. } );
216 int totalHeaderLines = scopeLines + 1;
217 int totalLines = totalHeaderLines + valueLines;
218 VECTOR2I size( glyphWidth * 38 + margin.
x * 2,
220 VECTOR2I offset( margin.
x * 2, -( size.
y + margin.
y * 2 ) );
222 if( drawingDropShadows )
227 gal->
SetStrokeColor( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
228 KIGFX::COLOR4D bgColor( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
237 COLOR4D bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
238 COLOR4D normal = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
242 double bg_h, bg_s, bg_l;
243 bg.
ToHSL( bg_h, bg_s, bg_l );
246 red.FromHSL( 0.0, 1.0, bg_l < 0.5 ? 0.7 : 0.3 );
247 green.FromHSL( 120.0, 1.0, bg_l < 0.5 ? 0.8 : 0.2 );
281 textPos.
x += glyphWidth * 18 + margin.
x;
282 font->
Draw( gal,
_(
"min" ), textPos, textAttrs, fontMetrics );
283 textPos.
x += glyphWidth * 7 + margin.
x;
284 font->
Draw( gal,
_(
"max" ), textPos, textAttrs, fontMetrics );
300 textPos.
x += glyphWidth * 18 + margin.
x;
301 font->
Draw( gal,
m_minText, textPos, textAttrs, fontMetrics );
302 textPos.
x += glyphWidth * 7 + margin.
x;
303 font->
Draw( gal,
m_maxText, textPos, textAttrs, fontMetrics );
314 textPos.
x += glyphWidth * 18 + margin.
x;
316 textPos.
x += glyphWidth * 7 + margin.
x;
326 if( aStr ==
"single" )
328 else if( aStr ==
"diff_pair" )
330 else if( aStr ==
"diff_pair_skew" )
334 wxFAIL_MSG( wxS(
"Unknown length tuning token" ) );
347 default: wxFAIL;
return "";
354 switch( aRouterMode )
366 if( aStr ==
"default" )
368 else if( aStr ==
"left" )
370 else if( aStr ==
"right" )
374 wxFAIL_MSG( wxS(
"Unknown length-tuning side token" ) );
387 default: wxFAIL;
return "";
394 if( aStr ==
"too_long" )
396 else if( aStr ==
"too_short" )
398 else if( aStr ==
"tuned" )
402 wxFAIL_MSG( wxS(
"Unknown tuning status token" ) );
415 default: wxFAIL;
return "";
424 double* aDelayIUOut )
431 padCount += fp->Pads().size();
523 bool hasConstraint =
false;
524 bool isTimeDomain =
false;
529 effectiveTarget = netConstraint.
GetValue();
531 hasConstraint =
true;
538 wxString chainName = netInfo ? netInfo->
GetNetChain() : wxString();
540 if( !chainName.IsEmpty() )
546 double bridgingDelayIU = 0.0;
552 long long bridgingIU = isTimeDomain ?
static_cast<long long>( bridgingDelayIU )
555 if( adjustedTarget.
HasMin() )
559 if( adjustedTarget.
HasOpt() )
563 if( adjustedTarget.
HasMax() )
584 constraint = netConstraint.
IsNull() ? chainConstraint : netConstraint;
599 else if( isTimeDomain )
607 const std::shared_ptr<TUNING_PROFILES> tuningParams =
620 if( !constraint.
IsNull() )
670 if( aIncludeTargets )
682 const auto origTargetLength =
m_settings.m_targetLength;
683 const auto origTargetLengthDelay =
m_settings.m_targetLengthDelay;
684 const auto origTargetSignalLength =
m_settings.m_targetSignalLength;
685 const auto origTargetSignalLengthDelay =
m_settings.m_targetSignalLengthDelay;
686 const auto origTargetSkew =
m_settings.m_targetSkew;
687 const auto origTargetSkewDelay =
m_settings.m_targetSkewDelay;
688 const bool origIsTimeDomain =
m_settings.m_isTimeDomain;
694 m_settings.m_targetSignalLength = origTargetSignalLength;
695 m_settings.m_targetSignalLengthDelay = origTargetSignalLengthDelay;
701 m_settings.m_targetLengthDelay = origTargetLengthDelay;
703 m_settings.m_targetSkewDelay = origTargetSkewDelay;
718 aCommit->
Add(
this );
744 centerlineOffsetEnd =
751 baseEnd.
A += centerlineOffsetEnd;
752 baseEnd.
B += centerlineOffsetEnd;
754 if( baseEnd.
A != baseEnd.
B )
773 auto getTimeDomainTuningEnabled = [
this, aBoard]()
775 const std::shared_ptr<TUNING_PROFILES> tuningParams =
796 &pnsItem,
nullptr, layer, &constraint ) )
814 m_settings.m_isTimeDomain = getTimeDomainTuningEnabled();
827 pnsCoupledItem.
SetParent( coupledTrack );
828 pnsCoupledItem.
SetNet( coupledNet );
833 &pnsItem, &pnsCoupledItem, layer, &constraint ) )
851 m_settings.m_isTimeDomain = getTimeDomainTuningEnabled();
858 &pnsItem, &pnsCoupledItem, layer, &constraint ) )
907 std::optional<SHAPE_LINE_CHAIN>& aBaseLine )
914 VECTOR2I startSnapPoint, endSnapPoint;
919 wxASSERT( startItem );
922 if( !startItem || !endItem )
930 wxASSERT(
chain.PointOnEdge( startSnapPoint, 40000 ) );
931 wxASSERT(
chain.PointOnEdge( endSnapPoint, 40000 ) );
937 chain.Split( startSnapPoint, endSnapPoint, pre, mid, post );
952 wxCHECK( track,
false );
968 return initBaseLine( aRouter, aPNSLayer, aBoard, coupledStart, coupledEnd, coupledNet,
1003 VECTOR2I startSnapPoint, endSnapPoint;
1006 aPNSLayer, startSnapPoint, endSnapPoint );
1008 wxCHECK( pnsLine,
false );
1013 pnsLine->CLine().
Split( startSnapPoint, endSnapPoint, pre, mid, post );
1021 straightChain.
Append( pre );
1022 straightChain.
Append( aBaseLine );
1023 straightChain.
Append( post );
1026 PNS::LINE straightLine( *pnsLine, straightChain );
1058 bool success =
true;
1069 const std::vector<GENERATOR_PNS_CHANGES>& allPnsChanges = aTool->
GetRouterChanges();
1073 const std::set<BOARD_ITEM*> routerRemovedItems = pnsChanges.removedItems;
1074 const std::set<BOARD_ITEM*> routerAddedItems = pnsChanges.addedItems;
1082 item->ClearSelected();
1087 aCommit->
Add( item );
1122 if( lineWidth == 0 || li->Width() < lineWidth )
1123 lineWidth = li->Width();
1133 if( lineWidth == 0 )
1144 recoverLine.
SetNet( recoverNet );
1145 branch->
Add( recoverLine,
false );
1152 recoverLineCoupled.
SetLayer( aPNSLayer );
1153 recoverLineCoupled.
SetWidth( lineWidth );
1155 recoverLineCoupled.
SetNet( recoverCoupledNet );
1156 branch->
Add( recoverLineCoupled,
false );
1174 VECTOR2I startSnapPoint, endSnapPoint;
1177 aPNSLayer, startSnapPoint, endSnapPoint );
1191 pnsLine->CLine().
Split( startSnapPoint, endSnapPoint, pre, mid, post );
1193 straightChain.
Append( pre );
1194 straightChain.
Append( aBaseLine );
1195 straightChain.
Append( post );
1199 branch->
Remove( *pnsLine );
1212 m_end = endSnapPoint;
1219 newLineChain.
Append( pre );
1220 newLineChain.
Append( mid );
1221 newLineChain.
Append( post );
1233 straightChain.
Split( start,
end, pre, mid, post );
1235 newLineChain.
Append( pre );
1236 newLineChain.
Append( mid );
1237 newLineChain.
Append( post );
1261 branch->
Add( line,
false );
1324 auto hideRemovedItems = [&](
bool aHide )
1330 for(
BOARD_ITEM* item : pnsCommit.removedItems )
1332 if( view && withinBounds( item ) )
1333 view->
Hide( item, aHide, aHide );
1376 hideRemovedItems(
true );
1378 VECTOR2I startSnapPoint, endSnapPoint;
1385 wxASSERT( startItem );
1386 wxASSERT( endItem );
1388 if( !startItem || !endItem )
1393 if( !router->
StartRouting( startSnapPoint, startItem, pnslayer ) )
1413 m_trackWidth = dpPlacer->GetOriginPair().Dimensions().Width();
1414 m_diffPairGap = dpPlacer->GetOriginPair().Dimensions().Gap();
1460 bool forceFinish =
true;
1461 bool forceCommit =
false;
1463 router->
FixRoute(
m_end,
nullptr, forceFinish, forceCommit );
1482 const std::vector<GENERATOR_PNS_CHANGES>& pnsCommits = aTool->
GetRouterChanges();
1486 const std::set<BOARD_ITEM*> routerRemovedItems = pnsCommit.removedItems;
1487 const std::set<BOARD_ITEM*> routerAddedItems = pnsCommit.addedItems;
1500 view->
Hide( item,
false );
1518 if( !withinBounds( item ) )
1520 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1529 aCommit->
Add( item );
1531 if( withinBounds( item ) )
1558 for(
BOARD_ITEM* item : pnsCommit.removedItems )
1559 view->Hide( item,
false );
1585 base.
A += centerlineOffset;
1586 base.
B += centerlineOffset;
1596 VECTOR2I widthHandleOffset = ( base.
B - base.
A ).Perpendicular().Resize( amplitude );
1598 aPoints.
AddPoint( base.
A + widthHandleOffset );
1604 aPoints.
AddPoint( base.
A + spacingHandleOffset );
1625 base.
A += centerlineOffset;
1626 base.
B += centerlineOffset;
1644 int side = base.
Side( wHandle );
1680 base.
A += centerlineOffset;
1681 base.
B += centerlineOffset;
1691 VECTOR2I widthHandleOffset = ( base.
B - base.
A ).Perpendicular().Resize( amplitude );
1711 int clampedMaxAmplitude =
m_settings.m_maxAmplitude;
1712 int minAllowedAmplitude = 0;
1722 minAllowedAmplitude = baselineOffset +
correction;
1725 clampedMaxAmplitude = std::max( clampedMaxAmplitude, minAllowedAmplitude );
1743 chain.SetClosed(
true );
1846 std::vector<const SHAPE_LINE_CHAIN*> baseLines = { &*
m_baseLine };
1854 auto isMeanderPoint =
1859 int64_t nearestDistSq = std::numeric_limits<int64_t>::max();
1863 VECTOR2I pt = line->NearestPoint( aPt );
1864 int64_t distSq = ( aPt - pt ).SquaredEuclideanNorm();
1866 if( distSq < nearestDistSq )
1870 nearestDistSq = distSq;
1874 return nearestDistSq > halfWidth * halfWidth && nearestPt != nearestLine->
CPoint( 0 )
1885 if( isMeanderPoint( track->
GetStart() ) || isMeanderPoint( track->
GetEnd() ) )
1904 size = std::max( size,
pcbIUScale.mmToIU( 0.05 ) );
1910 for(
int i = 0; i <
m_baseLine->SegmentCount(); i++ )
1933 for(
int i = 0; i <
chain.SegmentCount(); i++ )
1951 props.
set(
"corner_radius_percent",
m_settings.m_cornerRadiusPercentage );
1972 props.
set(
"override_custom_rules",
m_settings.m_overrideCustomRules );
1988 wxString tuningMode;
1989 aProps.
get_to(
"tuning_mode", tuningMode );
1993 aProps.
get_to(
"initial_side", side );
1997 aProps.
get_to(
"last_status", status );
2003 aProps.
get_to(
"corner_radius_percent",
m_settings.m_cornerRadiusPercentage );
2007 bool rounded =
false;
2008 aProps.
get_to(
"rounded", rounded );
2013 aProps.
get_to_iu(
"target_length", val );
2016 if( aProps.
get_to_iu(
"target_length_min", val ) )
2019 if( aProps.
get_to_iu(
"target_length_max", val ) )
2022 aProps.
get_to_iu(
"target_delay", val );
2025 if( aProps.
get_to_iu(
"target_delay_min", val ) )
2026 m_settings.m_targetLengthDelay.SetMin( val );
2028 if( aProps.
get_to_iu(
"target_delay_max", val ) )
2029 m_settings.m_targetLengthDelay.SetMax( val );
2033 aProps.
get_to_iu(
"target_skew", int_val );
2036 if( aProps.
get_to_iu(
"target_skew_min", int_val ) )
2039 if( aProps.
get_to_iu(
"target_skew_max", int_val ) )
2048 aProps.
get_to(
"override_custom_rules",
m_settings.m_overrideCustomRules );
2069 default:
return _(
"unknown" );
2093 TuningPattern pattern;
2095 pattern.mutable_id()->set_value(
m_Uuid.AsStdString() );
2101 TuningPatternSettings* settings = pattern.mutable_settings();
2104 settings->set_corner_radius_percent(
m_settings.m_cornerRadiusPercentage );
2105 settings->set_single_sided(
m_settings.m_singleSided );
2106 settings->mutable_max_amplitude()->set_value_nm(
pcbIUScale.IUToNm(
m_settings.m_maxAmplitude ) );
2107 settings->mutable_min_amplitude()->set_value_nm(
pcbIUScale.IUToNm(
m_settings.m_minAmplitude ) );
2110 pattern.set_target_mode(
m_settings.m_isTimeDomain ? TuningPatternTargetMode::TPTM_TIME_DOMAIN
2111 : TuningPatternTargetMode::TPTM_LENGTH );
2113 pattern.set_override_custom_rules(
m_settings.m_overrideCustomRules );
2119 TimeRange* range = pattern.mutable_target_skew_delay();
2122 range->set_min_as(
m_settings.m_targetSkewDelay.Min() );
2125 range->set_opt_as(
m_settings.m_targetSkewDelay.Opt() );
2128 range->set_max_as(
m_settings.m_targetSkewDelay.Max() );
2132 kiapi::common::types::MinOptMax* range = pattern.mutable_target_skew();
2135 range->set_min(
m_settings.m_targetSkew.Min() );
2138 range->set_opt(
m_settings.m_targetSkew.Opt() );
2141 range->set_max(
m_settings.m_targetSkew.Max() );
2146 TimeRange* range = pattern.mutable_target_delay();
2148 if(
m_settings.m_targetLengthDelay.HasMin() )
2149 range->set_min_as(
m_settings.m_targetLengthDelay.Min() );
2151 if(
m_settings.m_targetLengthDelay.HasOpt() )
2152 range->set_opt_as(
m_settings.m_targetLengthDelay.Opt() );
2154 if(
m_settings.m_targetLengthDelay.HasMax() )
2155 range->set_max_as(
m_settings.m_targetLengthDelay.Max() );
2159 kiapi::common::types::MinOptMax* range = pattern.mutable_target_length();
2162 range->set_min(
m_settings.m_targetLength.Min() );
2165 range->set_opt(
m_settings.m_targetLength.Opt() );
2168 range->set_max(
m_settings.m_targetLength.Max() );
2171 TuningPatternState* state = pattern.mutable_state();
2177 pattern.set_locked(
IsLocked() ? LockedState::LS_LOCKED : LockedState::LS_UNLOCKED );
2180 pattern.mutable_parent()->set_value(
board->m_Uuid.AsStdString() );
2183 pattern.add_members()->set_value( member->m_Uuid.AsStdString() );
2186 aContainer.PackFrom( pattern );
2195 TuningPattern pattern;
2197 if( !aContainer.UnpackTo( &pattern ) )
2211 const TuningPatternSettings& settings = pattern.settings();
2214 m_settings.m_cornerRadiusPercentage = settings.corner_radius_percent();
2215 m_settings.m_singleSided = settings.single_sided();
2219 m_settings.m_overrideCustomRules = pattern.override_custom_rules();
2221 switch( pattern.target_case() )
2223 case TuningPattern::kTargetLength:
2225 const kiapi::common::types::MinOptMax& range = pattern.target_length();
2229 if( range.has_opt() )
2232 if( range.has_min() )
2233 m_settings.m_targetLength.SetMin( range.min() );
2235 if( range.has_max() )
2236 m_settings.m_targetLength.SetMax( range.max() );
2241 case TuningPattern::kTargetDelay:
2243 const TimeRange& range = pattern.target_delay();
2247 if( range.has_opt_as() )
2248 m_settings.SetTargetLengthDelay( range.opt_as() );
2250 if( range.has_min_as() )
2251 m_settings.m_targetLengthDelay.SetMin( range.min_as() );
2253 if( range.has_max_as() )
2254 m_settings.m_targetLengthDelay.SetMax( range.max_as() );
2259 case TuningPattern::kTargetSkew:
2261 const kiapi::common::types::MinOptMax& range = pattern.target_skew();
2265 if( range.has_opt() )
2268 if( range.has_min() )
2269 m_settings.m_targetSkew.SetMin( range.min() );
2271 if( range.has_max() )
2272 m_settings.m_targetSkew.SetMax( range.max() );
2277 case TuningPattern::kTargetSkewDelay:
2279 const TimeRange& range = pattern.target_skew_delay();
2283 if( range.has_opt_as() )
2284 m_settings.SetTargetSkewDelay( range.opt_as() );
2286 if( range.has_min_as() )
2287 m_settings.m_targetSkewDelay.SetMin( range.min_as() );
2289 if( range.has_max_as() )
2290 m_settings.m_targetSkewDelay.SetMax( range.max_as() );
2295 case TuningPattern::TARGET_NOT_SET:
break;
2298 if( pattern.has_state() )
2300 const TuningPatternState& state = pattern.state();
2305 SetLocked( pattern.locked() == LockedState::LS_LOCKED );
2311 for(
const kiapi::common::types::KIID& memberId : pattern.members() )
2392 commit.
Push(
_(
"Edit Tuning Pattern" ) );
2398 bool aStatusItemsOnly )
2400 std::vector<EDA_ITEM*> previewItems;
2405 if( !aStatusItemsOnly )
2425 wxString netChainName;
2427 if(
board && !netName.IsEmpty() )
2433 netChainName = net->GetNetChain();
2439 if( !netName.IsEmpty() )
2441 if( !netChainName.IsEmpty() )
2442 scopeLine = wxString::Format(
_(
"%s | %s" ), netName, netChainName );
2444 scopeLine = netName;
2460 bool hasNetConstraint =
false;
2462 if(
board &&
board->GetDesignSettings().m_DRCEngine )
2471 if( tr->GetNet() &&
UnescapeString( tr->GetNet()->GetNetname() ) == netName )
2488 hasNetConstraint =
true;
2493 if( !hasNetConstraint )
2498 if( !netChainName.IsEmpty() &&
board &&
board->GetDesignSettings().m_DRCEngine )
2545 statusItem->
SetCurrent( 0.0,
_(
"current skew" ) );
2547 statusItem->
SetCurrent( 0.0,
_(
"current delay" ) );
2549 statusItem->
SetCurrent( 0.0,
_(
"current length" ) );
2553 double netVal =
m_settings.m_isTimeDomain ?
static_cast<double>( placer->TuningDelayResult() )
2554 :
static_cast<double>( placer->TuningLengthResult() );
2560 bool hasSignal =
false;
2562 if( !netChainName.IsEmpty() &&
board )
2564 double chainBoardLen = 0.0;
2565 double chainBoardDelay = 0.0;
2569 std::unordered_map<int, PCB_TRACK*> repByNet;
2574 repByNet.emplace( tr->GetNetCode(), tr );
2579 if( net->GetNetChain() != netChainName )
2582 auto it = repByNet.find( net->GetNetCode() );
2584 if( it != repByNet.end() && it->second )
2586 int cnt = 0;
double trk = 0, pd = 0, tDel = 0, pdDel = 0;
2587 std::tie( cnt, trk, pd, tDel, pdDel ) =
board->GetTrackLength( *it->second );
2588 chainBoardLen += trk + pd;
2589 chainBoardDelay += tDel + pdDel;
2594 double tuningDelta = 0.0;
2596 if( placer->HasBaseline() )
2598 tuningDelta =
m_settings.m_isTimeDomain ?
static_cast<double>( placer->TuningDelayDelta() )
2599 :
static_cast<double>( placer->TuningLengthDelta() );
2602 double sigVal = (
m_settings.m_isTimeDomain ? chainBoardDelay : chainBoardLen )
2606 double delayIU = 0.0;
2614 sigVal +=
static_cast<double>( bridging );
2617 sigStr = wxString::Format(
_(
"Chain: %s" ), aFrame->
MessageTextFromValue( sigVal,
true, unitType ) );
2623 previewItems.push_back( statusItem );
2626 return previewItems;
2639 bool mixedWidth =
false;
2651 primaryItem = track;
2652 primaryNet = track->GetNet();
2654 else if( !coupledNet && track->GetNet() != primaryNet )
2656 coupledItem = track;
2657 coupledNet = track->GetNet();
2661 netclass = track->GetEffectiveNetClass();
2663 if( track->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
2666 width = track->GetWidth();
2667 else if( width != track->GetWidth() )
2679 else if( primaryNet )
2685 aList.emplace_back(
_(
"Resolved Netclass" ),
2691 if( primaryNet && !primaryNet->
GetNetChain().IsEmpty() )
2692 aList.emplace_back(
_(
"Net Chain" ), primaryNet->
GetNetChain() );
2694 if( width && !mixedWidth )
2705 double trackLen = 0.0;
2706 double lenPadToDie = 0.0;
2707 double trackDelay = 0.0;
2708 double delayPadToDie = 0.0;
2710 std::tie( count, trackLen, lenPadToDie, trackDelay, delayPadToDie ) =
board->GetTrackLength( *primaryItem );
2712 if( coupledItem && coupledItem->
GetNetCode() > 0 )
2714 double coupledLen = 0.0;
2715 double coupledLenPadToDie = 0.0;
2716 double coupledTrackDelay = 0.0;
2717 double doubledDelayPadToDie = 0.0;
2719 std::tie( count, coupledLen, coupledLenPadToDie, coupledTrackDelay, doubledDelayPadToDie ) =
2720 board->GetTrackLength( *coupledItem );
2722 if( trackDelay == 0.0 || coupledTrackDelay == 0.0 )
2730 aList.emplace_back(
_(
"Routed Delays" ),
2738 if( trackDelay == 0.0 )
2744 aList.emplace_back(
_(
"Routed Delay" ),
2749 if( lenPadToDie != 0 && delayPadToDie == 0.0 )
2752 aList.emplace_back(
_(
"Pad To Die Length" ), msg );
2755 aList.emplace_back(
_(
"Full Length" ), msg );
2757 else if( delayPadToDie > 0.0 )
2760 aList.emplace_back(
_(
"Pad To Die Delay" ), msg );
2763 aList.emplace_back(
_(
"Full Delay" ), msg );
2767 if( primaryNet && !primaryNet->
GetNetChain().IsEmpty() )
2770 double totalOtherLen = 0.0;
2771 double totalOtherDelay = 0.0;
2778 if( other->GetNetChain() != chainName || other == primaryNet )
2782 double oTrackLen = 0.0, oPadDieLen = 0.0, oTrackDelay = 0.0, oPadDieDelay = 0.0;
2789 if( tr->GetNetCode() == other->GetNetCode() )
2800 std::tie( dummyCount, oTrackLen, oPadDieLen, oTrackDelay, oPadDieDelay ) =
2802 totalOtherLen += ( oTrackLen + oPadDieLen );
2803 totalOtherDelay += ( oTrackDelay + oPadDieDelay );
2809 if( trackDelay == 0.0 )
2811 double delayIUDummy = 0.0;
2813 aList.emplace_back(
_(
"Net Chain Full Length" ),
2815 + (
double) bridging ) );
2819 double bridgingDelayIU = 0.0;
2821 aList.emplace_back(
_(
"Net Chain Full Delay" ),
2837 aList.emplace_back( wxString::Format(
_(
"Target Skew: %s" ), msg ),
2838 wxString::Format(
_(
"(from tuning pattern properties)" ) ) );
2844 if( !msg.IsEmpty() )
2846 aList.emplace_back( wxString::Format(
_(
"Skew Constraints: %s" ), msg ),
2847 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2865 caption =
_(
"Target Delay: %s" );
2871 caption =
_(
"Target Length: %s" );
2875 aList.emplace_back( wxString::Format( caption, msg ),
2876 wxString::Format(
_(
"(from tuning pattern properties)" ) ) );
2882 wxString caption =
m_settings.m_isTimeDomain ?
_(
"Delay Constraints: %s" ) :
_(
"Length Constraints: %s" );
2884 if( !msg.IsEmpty() )
2886 aList.emplace_back( wxString::Format( caption, msg ),
2887 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2901#define HITTEST_THRESHOLD_PIXELS 5
2921 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
2942 aPattern->ApplyToolSettings( meanderSettings );
2945 auto updateHoverStatus =
2948 std::unique_ptr<PCB_TUNING_PATTERN> dummyPattern;
2953 dummyPattern->SetPosition(
m_pickerItem->GetFocusPosition() );
2954 dummyPattern->SetEnd(
m_pickerItem->GetFocusPosition() );
2959 applyCommonSettings( dummyPattern.get() );
2961 dummyPattern->EditStart( generatorTool,
m_board,
nullptr );
2962 dummyPattern->Update( generatorTool,
m_board,
nullptr );
2966 for(
EDA_ITEM* item : dummyPattern->GetPreviewItems( generatorTool,
m_frame ) )
2981 auto updateTuningPattern =
3002 if( evt->IsCancelInteractive() || evt->IsActivate()
3028 guide.SetIncludeSecondary(
false );
3030 guide.SetIncludeSecondary(
true );
3032 guide.SetPreferredLayer(
m_frame->GetActiveLayer() );
3043 double min_dist_sq = std::numeric_limits<double>::max();
3045 for(
EDA_ITEM* candidate : collector )
3051 candidatePos =
static_cast<PCB_TRACK*
>( candidate )->GetCenter();
3053 else if( candidate->Type() ==
PCB_ARC_T )
3055 candidatePos =
static_cast<PCB_ARC*
>( candidate )->GetMid();
3058 double dist_sq = ( cursorPos - candidatePos ).SquaredEuclideanNorm();
3060 if( dist_sq < min_dist_sq )
3062 min_dist_sq = dist_sq;
3068 updateHoverStatus();
3077 updateTuningPattern();
3088 m_frame->ShowInfoBarWarning(
_(
"Unable to tune segments inside other tuning patterns." ) );
3103 int dummyClearance = std::numeric_limits<int>::max() / 2;
3108 if(
m_pickerItem->GetEffectiveShape()->Collide( cursorPos, dummyClearance, &dummyDist,
3128 if( updated && placer && !placer->HasMeanders() )
3135 router->SyncWorld();
3137 std::set<BOARD_ITEM*> routerItems;
3141 routerItems.insert( changes.addedItems.begin(), changes.addedItems.end() );
3151 m_frame->ShowInfoBarWarning( wxString::Format(
_(
"No tuning pattern added: no meanders were "
3152 "needed or would fit (%s)." ),
3158 commit.
Push(
_(
"Tune" ) );
3181 meanderSettings.
m_spacing = placer->MeanderSettings().m_spacing;
3184 updateTuningPattern();
3189 m_frame->ShowInfoBarWarning(
_(
"Select a track to tune first." ) );
3202 m_tuningPattern->SetMaxAmplitude( placer->MeanderSettings().m_maxAmplitude );
3203 meanderSettings.
m_maxAmplitude = placer->MeanderSettings().m_maxAmplitude;
3206 updateTuningPattern();
3211 m_frame->ShowInfoBarWarning(
_(
"Select a track to tune first." ) );
3250 meanderSettings = dlgSettings;
3255 if( !manualTargets )
3268 updateTuningPattern();
3279 evt->SetPassEvent();
3288 controls->ForceCursorPosition(
false );
3295 m_frame->GetCanvas()->Refresh();
3327 if( layerEnum.
Choices().GetCount() == 0 )
3346 const wxString groupTechLayers =
_HKI(
"Technical Layers" );
3357 const wxString groupTab =
_HKI(
"Pattern Properties" );
3410 return pattern->GetSettings().m_isTimeDomain;
3415 auto isLengthIsSpaceDomain =
3418 return !isSkew( aItem ) && !isTimeDomain( aItem );
3421 auto isLengthIsTimeDomain =
3424 return !isSkew( aItem ) && isTimeDomain( aItem );
3427 auto isSkewIsSpaceDomain =
3430 return isSkew( aItem ) && !isTimeDomain( aItem );
3433 auto isSkewIsTimeDomain =
3436 return isSkew( aItem ) && isTimeDomain( aItem );
3483template <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.
void Revert() override
Revert the commit by restoring the modified items state.
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()
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
Design Rule Checker object that performs all the DRC tests.
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)
KICAD_T Type() const
Returns the type of object.
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
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
void SetLocked(bool aLocked) override
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual void SetWidth(int aWidth)
virtual int GetWidth() const
void SetTargetSkew(int aValue)
bool initBaseLines(PNS::ROUTER *aRouter, int aPNSLayer, BOARD *aBoard)
const STRING_ANY_MAP GetProperties() const override
void ApplyToolSettings(const PNS::MEANDER_SETTINGS &aToolSettings)
Adopt the tuning tool's working settings.
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
bool HasMeanders() const
True when any member track leaves the baseline between its end caps, or there is no baseline.
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)
static PNS::MEANDER_SETTINGS & DefaultSettings(BOARD_DESIGN_SETTINGS &aBds, LENGTH_TUNING_MODE aMode)
The per-mode tool defaults stored on the board.
static void StoreDefaults(BOARD_DESIGN_SETTINGS &aBds, LENGTH_TUNING_MODE aMode, const PNS::MEANDER_SETTINGS &aSettings, bool aIncludeTargets)
Remember the tool's settings as the per-mode default for the next activation.
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.
int m_minAmplitude
Minimum meandering amplitude.
void SetTargetLength(long long int aOpt)
bool m_isTimeDomain
Calculate tuning in the time domain.
int m_cornerRadiusPercentage
Rounding percentage (0 - 100).
bool m_singleSided
Place meanders on one side.
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)
MINOPTMAX< int > m_targetSkew
Target skew value for diff pair de-skewing.
MEANDER_STYLE m_cornerStyle
Type of corners for the meandered line.
MINOPTMAX< int > m_targetSkewDelay
Target skew value for diff pair de-skewing.
int m_maxAmplitude
Maximum meandering amplitude.
bool m_overrideCustomRules
MINOPTMAX< long long int > m_targetLengthDelay
Desired propagation delay of the tuned line.
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