KiCad PCB EDA Suite
PNS::DP_MEANDER_PLACER Class Reference

Differential Pair length-matching/meandering tool. More...

#include <pns_dp_meander_placer.h>

Inheritance diagram for PNS::DP_MEANDER_PLACER:
PNS::MEANDER_PLACER_BASE PNS::PLACEMENT_ALGO PNS::ALGO_BASE

Public Types

enum  TUNING_STATUS { TOO_SHORT = 0, TOO_LONG, TUNED }
 < Result of the length tuning operation More...
 

Public Member Functions

 DP_MEANDER_PLACER (ROUTER *aRouter)
 
 ~DP_MEANDER_PLACER ()
 
bool Start (const VECTOR2I &aP, ITEM *aStartItem) override
 Start routing a single track at point aP, taking item aStartItem as anchor (unless NULL). More...
 
bool Move (const VECTOR2I &aP, ITEM *aEndItem) override
 Move the end of the currently routed trace to the point aP, taking aEndItem as anchor (if not NULL). More...
 
bool FixRoute (const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
 Commit the currently routed track to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided). More...
 
bool CommitPlacement () override
 
bool AbortPlacement () override
 
bool HasPlacedAnything () const override
 
const LINE Trace () const
 
NODECurrentNode (bool aLoopsRemoved=false) const override
 Return the most recent world state. More...
 
const ITEM_SET Traces () override
 Function Traces() More...
 
const VECTOR2ICurrentEnd () const override
 Function CurrentEnd() More...
 
const std::vector< int > CurrentNets () const override
 Function CurrentNets() More...
 
int CurrentLayer () const override
 Function CurrentLayer() More...
 
long long int totalLength ()
 
const wxString TuningInfo (EDA_UNITS aUnits) const override
 Return a string describing the status and length of the tuned traces. More...
 
TUNING_STATUS TuningStatus () const override
 Return the tuning status (too short, too long, etc.) of the trace(s) being tuned. More...
 
bool CheckFit (MEANDER_SHAPE *aShape) override
 Checks if it's OK to place the shape aShape (i.e. More...
 
virtual void AmplitudeStep (int aSign)
 Increase/decreases the current meandering amplitude by one step. More...
 
virtual void SpacingStep (int aSign)
 Increase/decrease the current meandering spacing by one step. More...
 
virtual const MEANDER_SETTINGSMeanderSettings () const
 Return the current meandering configuration. More...
 
virtual void UpdateSettings (const MEANDER_SETTINGS &aSettings)
 
int GetTotalPadToDieLength (const LINE &aLine) const
 
virtual bool UnfixRoute ()
 
virtual bool ToggleVia (bool aEnabled)
 Function ToggleVia() More...
 
virtual bool IsPlacingVia () const
 Function IsPlacingVia() More...
 
virtual bool SetLayer (int aLayer)
 Function SetLayer() More...
 
virtual void FlipPosture ()
 Function FlipPosture() More...
 
virtual void UpdateSizes (const SIZES_SETTINGS &aSizes)
 Function UpdateSizes() More...
 
virtual void SetOrthoMode (bool aOrthoMode)
 Function SetOrthoMode() More...
 
virtual void GetModifiedNets (std::vector< int > &aNets) const
 Function GetModifiedNets. More...
 
ROUTERRouter () const
 Return current router settings. More...
 
ROUTING_SETTINGSSettings () const
 Return the logger object, allowing to dump geometry to a file. More...
 
virtual LOGGERLogger ()
 
void SetLogger (LOGGER *aLogger)
 
void SetDebugDecorator (DEBUG_DECORATOR *aDecorator)
 Assign a debug decorator allowing this algo to draw extra graphics for visual debugging. More...
 
DEBUG_DECORATORDbg () const
 
const BOX2IVisibleViewArea () const
 

Protected Member Functions

void cutTunedLine (const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
 Extract the part of a track to be meandered, depending on the starting point and the cursor position. More...
 
void tuneLineLength (MEANDERED_LINE &aTuned, long long int aElongation)
 Take a set of meanders in aTuned and tunes their length to extend the original line length by aElongation. More...
 
int compareWithTolerance (long long int aValue, long long int aExpected, long long int aTolerance=0) const
 Compare aValue against aExpected with given tolerance. More...
 
VECTOR2I getSnappedStartPoint (LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
 
long long int lineLength (const ITEM_SET &aLine) const
 Calculate the total length of the line represented by an item set (tracks and vias) More...
 

Protected Attributes

NODEm_world
 Total length added by pad to die size. More...
 
int m_padToDieLength
 Width of the meandered trace(s). More...
 
int m_currentWidth
 Meander settings. More...
 
MEANDER_SETTINGS m_settings
 The current end point. More...
 
VECTOR2I m_currentEnd
 
DEBUG_DECORATORm_debugDecorator
 
ROUTERm_router
 
LOGGERm_logger
 

Private Member Functions

void meanderSegment (const SEG &aBase)
 
const SEG baselineSegment (const DIFF_PAIR::COUPLED_SEGMENTS &aCoupledSegs)
 
bool pairOrientation (const DIFF_PAIR::COUPLED_SEGMENTS &aPair)
 
void setWorld (NODE *aWorld)
 
void release ()
 
long long int origPathLength () const
 Current routing start point (end of tail, beginning of head). More...
 

Private Attributes

VECTOR2I m_currentStart
 Current world state. More...
 
NODEm_currentNode
 
DIFF_PAIR m_originPair
 
DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments
 
LINE m_currentTraceN
 
LINE m_currentTraceP
 
ITEM_SET m_tunedPath
 
ITEM_SET m_tunedPathP
 
ITEM_SET m_tunedPathN
 
SHAPE_LINE_CHAIN m_finalShapeP
 
SHAPE_LINE_CHAIN m_finalShapeN
 
MEANDERED_LINE m_result
 
LINKED_ITEMm_initialSegment
 
long long int m_lastLength
 
int m_padToDieP
 
int m_padToDieN
 
TUNING_STATUS m_lastStatus
 

Friends

class MEANDER_SHAPE
 

Detailed Description

Differential Pair length-matching/meandering tool.

Definition at line 48 of file pns_dp_meander_placer.h.

Member Enumeration Documentation

◆ TUNING_STATUS

< Result of the length tuning operation

Enumerator
TOO_SHORT 
TOO_LONG 
TUNED 

Definition at line 49 of file pns_meander_placer_base.h.

Constructor & Destructor Documentation

◆ DP_MEANDER_PLACER()

PNS::DP_MEANDER_PLACER::DP_MEANDER_PLACER ( ROUTER aRouter)

Definition at line 36 of file pns_dp_meander_placer.cpp.

36  :
37  MEANDER_PLACER_BASE( aRouter )
38 {
39  m_world = NULL;
41 
42  m_padToDieP = 0;
43  m_padToDieN = 0;
44 
45  // Init temporary variables (do not leave uninitialized members)
47  m_lastLength = 0;
49 }
#define NULL
NODE * m_world
Total length added by pad to die size.

References m_currentNode, m_initialSegment, m_lastLength, m_lastStatus, m_padToDieN, m_padToDieP, PNS::MEANDER_PLACER_BASE::m_world, NULL, and PNS::MEANDER_PLACER_BASE::TOO_SHORT.

◆ ~DP_MEANDER_PLACER()

PNS::DP_MEANDER_PLACER::~DP_MEANDER_PLACER ( )

Definition at line 52 of file pns_dp_meander_placer.cpp.

53 {
54 }

Member Function Documentation

◆ AbortPlacement()

bool PNS::DP_MEANDER_PLACER::AbortPlacement ( )
overridevirtual

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 317 of file pns_dp_meander_placer.cpp.

318 {
320  return true;
321 }
void KillChildren()
Definition: pns_node.cpp:1369
NODE * m_world
Total length added by pad to die size.

References PNS::NODE::KillChildren(), and PNS::MEANDER_PLACER_BASE::m_world.

◆ AmplitudeStep()

void PNS::MEANDER_PLACER_BASE::AmplitudeStep ( int  aSign)
virtualinherited

Increase/decreases the current meandering amplitude by one step.

Parameters
aSigndirection (negative = decrease, positive = increase).

Definition at line 44 of file pns_meander_placer_base.cpp.

45 {
46  int a = m_settings.m_maxAmplitude + aSign * m_settings.m_step;
47  a = std::max( a, m_settings.m_minAmplitude );
48 
50 }
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:76
int m_step
Length PadToDie.
Definition: pns_meander.h:82
MEANDER_SETTINGS m_settings
The current end point.
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:78

References PNS::MEANDER_SETTINGS::m_maxAmplitude, PNS::MEANDER_SETTINGS::m_minAmplitude, PNS::MEANDER_PLACER_BASE::m_settings, and PNS::MEANDER_SETTINGS::m_step.

◆ baselineSegment()

const SEG PNS::DP_MEANDER_PLACER::baselineSegment ( const DIFF_PAIR::COUPLED_SEGMENTS aCoupledSegs)
private

Definition at line 150 of file pns_dp_meander_placer.cpp.

151 {
152  const VECTOR2I a( ( aCoupledSegs.coupledP.A + aCoupledSegs.coupledN.A ) / 2 );
153  const VECTOR2I b( ( aCoupledSegs.coupledP.B + aCoupledSegs.coupledN.B ) / 2 );
154 
155  return SEG( a, b );
156 }
Definition: seg.h:40

References SEG::A, SEG::B, PNS::DIFF_PAIR::COUPLED_SEGMENTS::coupledN, and PNS::DIFF_PAIR::COUPLED_SEGMENTS::coupledP.

Referenced by Move().

◆ CheckFit()

bool PNS::DP_MEANDER_PLACER::CheckFit ( MEANDER_SHAPE aShape)
overridevirtual

Checks if it's OK to place the shape aShape (i.e.

if it doesn't cause DRC violations or collide with other meanders).

Parameters
aShapethe shape to check.
Returns
true if the shape fits.

Reimplemented from PNS::MEANDER_PLACER_BASE.

Definition at line 341 of file pns_dp_meander_placer.cpp.

342 {
343  LINE l1( m_originPair.PLine(), aShape->CLine( 0 ) );
344  LINE l2( m_originPair.NLine(), aShape->CLine( 1 ) );
345 
346  if( m_currentNode->CheckColliding( &l1 ) )
347  return false;
348 
349  if( m_currentNode->CheckColliding( &l2 ) )
350  return false;
351 
352  int w = aShape->Width();
353  int clearance = w + m_settings.m_spacing;
354 
355  return m_result.CheckSelfIntersections( aShape, clearance );
356 }
const SHAPE_LINE_CHAIN & CLine() const
Definition: pns_line.h:137
bool CheckSelfIntersections(MEANDER_SHAPE *aShape, int aClearance)
Check if the given shape is intersecting with any other meander in the current line.
MEANDER_SETTINGS m_settings
The current end point.
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
Definition: pns_node.cpp:433
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:80

References PNS::NODE::CheckColliding(), PNS::MEANDERED_LINE::CheckSelfIntersections(), PNS::MEANDER_SHAPE::CLine(), m_currentNode, m_originPair, m_result, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_spacing, PNS::DIFF_PAIR::NLine(), PNS::DIFF_PAIR::PLine(), and PNS::MEANDER_SHAPE::Width().

◆ CommitPlacement()

bool PNS::DP_MEANDER_PLACER::CommitPlacement ( )
overridevirtual

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 331 of file pns_dp_meander_placer.cpp.

332 {
333  if( m_currentNode )
335 
337  return true;
338 }
ROUTER * Router() const
Return current router settings.
Definition: pns_algo_base.h:54
void CommitRouting()
Definition: pns_router.cpp:694
#define NULL

References PNS::ROUTER::CommitRouting(), m_currentNode, NULL, and PNS::ALGO_BASE::Router().

Referenced by FixRoute().

◆ compareWithTolerance()

int PNS::MEANDER_PLACER_BASE::compareWithTolerance ( long long int  aValue,
long long int  aExpected,
long long int  aTolerance = 0 
) const
protectedinherited

Compare aValue against aExpected with given tolerance.

Definition at line 228 of file pns_meander_placer_base.cpp.

230 {
231  if( aValue < aExpected - aTolerance )
232  return -1;
233  else if( aValue > aExpected + aTolerance )
234  return 1;
235  else
236  return 0;
237 }

Referenced by PNS::MEANDER_PLACER::doMove(), and Move().

◆ CurrentEnd()

const VECTOR2I & PNS::DP_MEANDER_PLACER::CurrentEnd ( ) const
overridevirtual

Function CurrentEnd()

Returns the current end of the line(s) being placed/tuned. It may not be equal to the cursor position due to collisions.

Implements PNS::PLACEMENT_ALGO.

Definition at line 373 of file pns_dp_meander_placer.cpp.

374 {
375  return m_currentEnd;
376 }

References PNS::MEANDER_PLACER_BASE::m_currentEnd.

◆ CurrentLayer()

int PNS::DP_MEANDER_PLACER::CurrentLayer ( ) const
overridevirtual

Function CurrentLayer()

Returns the layer of currently routed track.

Implements PNS::PLACEMENT_ALGO.

Definition at line 379 of file pns_dp_meander_placer.cpp.

380 {
381  return m_initialSegment->Layers().Start();
382 }
int Start() const
Definition: pns_layerset.h:82
const LAYER_RANGE & Layers() const
Definition: pns_item.h:152

References PNS::ITEM::Layers(), m_initialSegment, and LAYER_RANGE::Start().

◆ CurrentNets()

const std::vector< int > PNS::DP_MEANDER_PLACER::CurrentNets ( ) const
overridevirtual

Function CurrentNets()

Returns the net code(s) of currently routed track(s).

Implements PNS::PLACEMENT_ALGO.

Definition at line 420 of file pns_dp_meander_placer.cpp.

421 {
422  std::vector<int> rv;
423  rv.push_back( m_originPair.NetP() );
424  rv.push_back( m_originPair.NetN() );
425  return rv;
426 }
int NetP() const
int NetN() const

References m_originPair, PNS::DIFF_PAIR::NetN(), and PNS::DIFF_PAIR::NetP().

◆ CurrentNode()

NODE * PNS::DP_MEANDER_PLACER::CurrentNode ( bool  aLoopsRemoved = false) const
overridevirtual

Return the most recent world state.

Implements PNS::PLACEMENT_ALGO.

Definition at line 63 of file pns_dp_meander_placer.cpp.

64 {
65  if( !m_currentNode )
66  return m_world;
67 
68  return m_currentNode;
69 }
NODE * m_world
Total length added by pad to die size.

References m_currentNode, and PNS::MEANDER_PLACER_BASE::m_world.

◆ cutTunedLine()

void PNS::MEANDER_PLACER_BASE::cutTunedLine ( const SHAPE_LINE_CHAIN aOrigin,
const VECTOR2I aTuneStart,
const VECTOR2I aCursorPos,
SHAPE_LINE_CHAIN aPre,
SHAPE_LINE_CHAIN aTuned,
SHAPE_LINE_CHAIN aPost 
)
protectedinherited

Extract the part of a track to be meandered, depending on the starting point and the cursor position.

Parameters
aOriginthe original line.
aTuneStartpoint where we start meandering (start click coordinates).
aCursorPoscurrent cursor position.
aPrepart before the beginning of meanders.
aTunedpart to be meandered.
aPostpart after the end of meanders.

Definition at line 68 of file pns_meander_placer_base.cpp.

71 {
72  VECTOR2I cp ( aCursorPos );
73 
74  if( cp == aTuneStart ) // we don't like tuning segments with 0 length
75  {
76  int idx = aOrigin.FindSegment( cp );
77 
78  if( idx >= 0 )
79  {
80  const SEG& s = aOrigin.CSegment( idx );
81  cp += (s.B - s.A).Resize(2);
82  }
83  else
84  {
85  cp += VECTOR2I (2, 5); // some arbitrary value that is not 45 degrees oriented
86  }
87  }
88 
89  VECTOR2I n = aOrigin.NearestPoint( cp, false );
90  VECTOR2I m = aOrigin.NearestPoint( aTuneStart, false );
91 
92  SHAPE_LINE_CHAIN l( aOrigin );
93  l.Split( n );
94  l.Split( m );
95 
96  int i_start = l.Find( m );
97  int i_end = l.Find( n );
98 
99  if( i_start > i_end )
100  {
101  l = l.Reverse();
102  i_start = l.Find( m );
103  i_end = l.Find( n );
104  }
105 
106  aPre = l.Slice( 0, i_start );
107  aPost = l.Slice( i_end, -1 );
108  aTuned = l.Slice( i_start, i_end );
109 
110  aTuned.Simplify();
111 }
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Function Simplify()
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Function FindSegment()
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Finds a point on the line chain that is closest to point aP.
Definition: seg.h:40
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References SEG::A, SEG::B, SHAPE_LINE_CHAIN::CSegment(), SHAPE_LINE_CHAIN::Find(), SHAPE_LINE_CHAIN::FindSegment(), SHAPE_LINE_CHAIN::NearestPoint(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), and SHAPE_LINE_CHAIN::Split().

Referenced by PNS::MEANDER_PLACER::doMove(), and Move().

◆ Dbg()

◆ FixRoute()

bool PNS::DP_MEANDER_PLACER::FixRoute ( const VECTOR2I aP,
ITEM aEndItem,
bool  aForceFinish = false 
)
overridevirtual

Commit the currently routed track to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided).

Returns
true if route has been committed. May return false if the routing result is violating design rules. In such cases, the track is only committed if Settings.CanViolateDRC() is on.

Implements PNS::PLACEMENT_ALGO.

Definition at line 303 of file pns_dp_meander_placer.cpp.

304 {
307 
308  m_currentNode->Add( lP );
309  m_currentNode->Add( lN );
310 
311  CommitPlacement();
312 
313  return true;
314 }
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
Definition: pns_node.cpp:621

References PNS::NODE::Add(), CommitPlacement(), m_currentNode, m_finalShapeN, m_finalShapeP, m_originPair, PNS::DIFF_PAIR::NLine(), and PNS::DIFF_PAIR::PLine().

◆ FlipPosture()

virtual void PNS::PLACEMENT_ALGO::FlipPosture ( )
inlinevirtualinherited

Function FlipPosture()

Toggles the current posture (straight/diagonal) of the trace head.

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 160 of file pns_placement_algo.h.

161  {
162  }

◆ GetModifiedNets()

virtual void PNS::PLACEMENT_ALGO::GetModifiedNets ( std::vector< int > &  aNets) const
inlinevirtualinherited

Function GetModifiedNets.

Returns the net codes of all currently routed trace(s)

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 191 of file pns_placement_algo.h.

192  {
193  }

◆ getSnappedStartPoint()

VECTOR2I PNS::MEANDER_PLACER_BASE::getSnappedStartPoint ( LINKED_ITEM aStartItem,
VECTOR2I  aStartPoint 
)
protectedinherited

Definition at line 240 of file pns_meander_placer_base.cpp.

241 {
242  if( aStartItem->Kind() == ITEM::SEGMENT_T )
243  {
244  return static_cast<SEGMENT*>( aStartItem )->Seg().NearestPoint( aStartPoint );
245  }
246  else
247  {
248  wxASSERT( aStartItem->Kind() == ITEM::ARC_T );
249  ARC* arc = static_cast<ARC*>( aStartItem );
250 
251  if( ( VECTOR2I( arc->Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
252  ( VECTOR2I( arc->Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
253  {
254  return arc->Anchor( 0 );
255  }
256  else
257  {
258  return arc->Anchor( 1 );
259  }
260  }
261 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623

References PNS::ITEM::ARC_T, PNS::ITEM::Kind(), and PNS::ITEM::SEGMENT_T.

Referenced by PNS::MEANDER_SKEW_PLACER::Start(), PNS::MEANDER_PLACER::Start(), and Start().

◆ GetTotalPadToDieLength()

int PNS::MEANDER_PLACER_BASE::GetTotalPadToDieLength ( const LINE aLine) const
inherited

Definition at line 184 of file pns_meander_placer_base.cpp.

185 {
186  int length = 0;
187  JOINT start;
188  JOINT end;
189 
190  m_world->FindLineEnds( aLine, start, end );
191 
192  // Extract the length of the pad to die for start and end pads
193  for( auto& link : start.LinkList() )
194  {
195  if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
196  {
197  // If there are overlapping pads, choose the first with a non-zero length
198  if( solid->GetPadToDie() > 0 )
199  {
200  length += solid->GetPadToDie();
201  break;
202  }
203  }
204  }
205 
206  for( auto& link : end.LinkList() )
207  {
208  if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
209  {
210  if( solid->GetPadToDie() > 0 )
211  {
212  length += solid->GetPadToDie();
213  break;
214  }
215  }
216  }
217 
218  return length;
219 }
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Destroy all child nodes. Applicable only to the root node.
Definition: pns_node.cpp:1013
NODE * m_world
Total length added by pad to die size.

References PNS::NODE::FindLineEnds(), PNS::JOINT::LinkList(), and PNS::MEANDER_PLACER_BASE::m_world.

◆ HasPlacedAnything()

bool PNS::DP_MEANDER_PLACER::HasPlacedAnything ( ) const
overridevirtual

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 324 of file pns_dp_meander_placer.cpp.

325 {
326  return m_originPair.CP().SegmentCount() > 0 ||
327  m_originPair.CN().SegmentCount() > 0;
328 }
const SHAPE_LINE_CHAIN & CN() const
int SegmentCount() const
Function SegmentCount()
const SHAPE_LINE_CHAIN & CP() const

References PNS::DIFF_PAIR::CN(), PNS::DIFF_PAIR::CP(), m_originPair, and SHAPE_LINE_CHAIN::SegmentCount().

◆ IsPlacingVia()

virtual bool PNS::PLACEMENT_ALGO::IsPlacingVia ( ) const
inlinevirtualinherited

Function IsPlacingVia()

Returns true if the placer is placing a via (or more vias).

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 104 of file pns_placement_algo.h.

105  {
106  return false;
107  }

◆ lineLength()

long long int PNS::MEANDER_PLACER_BASE::lineLength ( const ITEM_SET aLine) const
protectedinherited

Calculate the total length of the line represented by an item set (tracks and vias)

Parameters
aLine@returnPointer to world to search colliding items.

Definition at line 264 of file pns_meander_placer_base.cpp.

265 {
266  long long int total = 0;
267 
268  for( int idx = 0; idx < aLine.Size(); idx++ )
269  {
270  const ITEM* item = aLine[idx];
271 
272  if( const LINE* l = dyn_cast<const LINE*>( item ) )
273  {
274  total += l->CLine().Length();
275  }
276  else if( item->OfKind( ITEM::VIA_T ) && idx > 0 && idx < aLine.Size() - 1 )
277  {
278  int layerPrev = aLine[idx - 1]->Layer();
279  int layerNext = aLine[idx + 1]->Layer();
280 
281  if( layerPrev != layerNext )
282  total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
283  }
284  }
285 
286  return total;
287 }
ROUTER * m_router
Definition: pns_algo_base.h:87
virtual int StackupHeight(int aFirstLayer, int aSecondLayer) const =0
ROUTER_IFACE * GetInterface() const
Definition: pns_router.h:210

References PNS::ROUTER::GetInterface(), PNS::ALGO_BASE::m_router, PNS::ITEM::OfKind(), PNS::ITEM_SET::Size(), PNS::ROUTER_IFACE::StackupHeight(), and PNS::ITEM::VIA_T.

Referenced by PNS::MEANDER_SKEW_PLACER::origPathLength(), PNS::MEANDER_PLACER::origPathLength(), origPathLength(), and PNS::MEANDER_SKEW_PLACER::Start().

◆ Logger()

LOGGER * PNS::ALGO_BASE::Logger ( )
virtualinherited

Reimplemented in PNS::SHOVE.

Definition at line 34 of file pns_algo_base.cpp.

35 {
36  return NULL;
37 }
#define NULL

References NULL.

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), PNS::DRAGGER::Start(), and PNS::DRAGGER::tryWalkaround().

◆ meanderSegment()

void PNS::DP_MEANDER_PLACER::meanderSegment ( const SEG aBase)
private

◆ MeanderSettings()

const MEANDER_SETTINGS & PNS::MEANDER_PLACER_BASE::MeanderSettings ( ) const
virtualinherited

Return the current meandering configuration.

Returns
the settings

Definition at line 222 of file pns_meander_placer_base.cpp.

223 {
224  return m_settings;
225 }
MEANDER_SETTINGS m_settings
The current end point.

References PNS::MEANDER_PLACER_BASE::m_settings.

Referenced by PNS::MEANDER_SHAPE::makeMiterShape(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), PNS::MEANDER_SHAPE::Settings(), and PNS::MEANDERED_LINE::Settings().

◆ Move()

bool PNS::DP_MEANDER_PLACER::Move ( const VECTOR2I aP,
ITEM aEndItem 
)
overridevirtual

Move the end of the currently routed trace to the point aP, taking aEndItem as anchor (if not NULL).

Implements PNS::PLACEMENT_ALGO.

Definition at line 169 of file pns_dp_meander_placer.cpp.

170 {
171 // return false;
172 
173  DIFF_PAIR::COUPLED_SEGMENTS_VEC coupledSegments;
174 
175  if( m_currentNode )
176  delete m_currentNode;
177 
179 
180  SHAPE_LINE_CHAIN preP, tunedP, postP;
181  SHAPE_LINE_CHAIN preN, tunedN, postN;
182 
183  cutTunedLine( m_originPair.CP(), m_currentStart, aP, preP, tunedP, postP );
184  cutTunedLine( m_originPair.CN(), m_currentStart, aP, preN, tunedN, postN );
185 
186  DIFF_PAIR tuned( m_originPair );
187 
188  tuned.SetShape( tunedP, tunedN );
189 
190  tuned.CoupledSegmentPairs( coupledSegments );
191 
192  if( coupledSegments.size() == 0 )
193  return false;
194 
195  m_result = MEANDERED_LINE( this, true );
196  m_result.SetWidth( tuned.Width() );
197 
198  int offset = ( tuned.Gap() + tuned.Width() ) / 2;
199 
200  if( pairOrientation( coupledSegments[0] ) )
201  offset *= -1;
202 
203  m_result.SetBaselineOffset( offset );
204 
205  for( const ITEM* item : m_tunedPathP.CItems() )
206  {
207  if( const LINE* l = dyn_cast<const LINE*>( item ) )
208  PNS_DBG( Dbg(), AddLine, l->CLine(), YELLOW, 10000, "tuned-path-p" );
209  }
210 
211  for( const ITEM* item : m_tunedPathN.CItems() )
212  {
213  if( const LINE* l = dyn_cast<const LINE*>( item ) )
214  PNS_DBG( Dbg(), AddLine, l->CLine(), YELLOW, 10000, "tuned-path-n" );
215  }
216 
217  int curIndexP = 0, curIndexN = 0;
218 
219  for( const DIFF_PAIR::COUPLED_SEGMENTS& sp : coupledSegments )
220  {
221  SEG base = baselineSegment( sp );
222 
223  PNS_DBG( Dbg(), AddSegment, base, GREEN, "dp-baseline" );
224 
225  while( sp.indexP >= curIndexP )
226  {
227  m_result.AddCorner( tunedP.CPoint( curIndexP ), tunedN.CPoint( curIndexN ) );
228  curIndexP++;
229  }
230 
231  while( sp.indexN >= curIndexN )
232  {
233  m_result.AddCorner( tunedP.CPoint( sp.indexP ), tunedN.CPoint( curIndexN ) );
234  curIndexN++;
235  }
236 
237  m_result.MeanderSegment( base );
238  }
239 
240  while( curIndexP < tunedP.PointCount() )
241  m_result.AddCorner( tunedP.CPoint( curIndexP++ ), tunedN.CPoint( curIndexN ) );
242 
243  while( curIndexN < tunedN.PointCount() )
244  m_result.AddCorner( tunedP.CPoint( -1 ), tunedN.CPoint( curIndexN++ ) );
245 
246  long long int dpLen = origPathLength();
247 
249 
251  {
253  m_lastLength = dpLen;
254  }
255  else
256  {
257  m_lastLength = dpLen - std::max( tunedP.Length(), tunedN.Length() );
259  }
260 
261  if( m_lastStatus != TOO_LONG )
262  {
263  tunedP.Clear();
264  tunedN.Clear();
265 
266  for( MEANDER_SHAPE* m : m_result.Meanders() )
267  {
268  if( m->Type() != MT_EMPTY )
269  {
270  tunedP.Append( m->CLine( 0 ) );
271  tunedN.Append( m->CLine( 1 ) );
272  }
273  }
274 
275  m_lastLength += std::max( tunedP.Length(), tunedN.Length() );
276 
278 
279  if( comp > 0 )
281  else if( comp < 0 )
283  else
285  }
286 
288  m_finalShapeP.Append( preP );
289  m_finalShapeP.Append( tunedP );
290  m_finalShapeP.Append( postP );
292 
294  m_finalShapeN.Append( preN );
295  m_finalShapeN.Append( tunedN );
296  m_finalShapeN.Append( postN );
298 
299  return true;
300 }
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Function Simplify()
void AddCorner(const VECTOR2I &aA, const VECTOR2I &aB=VECTOR2I(0, 0))
Create a dummy meander shape representing a line corner.
const SHAPE_LINE_CHAIN & CN() const
void MeanderSegment(const SEG &aSeg, int aBaseIndex=0)
Fit maximum amplitude meanders on a given segment and adds to the current line.
Definition: pns_meander.cpp:45
VECTOR2I m_currentStart
Current world state.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
Definition: pns_node.cpp:127
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetWidth(int aWidth)
Set the line width.
Definition: pns_meander.h:420
bool pairOrientation(const DIFF_PAIR::COUPLED_SEGMENTS &aPair)
const SEG baselineSegment(const DIFF_PAIR::COUPLED_SEGMENTS &aCoupledSegs)
Definition: color4d.h:67
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
long long int origPathLength() const
Current routing start point (end of tail, beginning of head).
std::vector< MEANDER_SHAPE * > & Meanders()
Definition: pns_meander.h:442
Definition: color4d.h:57
NODE * m_world
Total length added by pad to die size.
#define PNS_DBG(dbg, method,...)
DEBUG_DECORATOR * Dbg() const
Definition: pns_algo_base.h:78
void tuneLineLength(MEANDERED_LINE &aTuned, long long int aElongation)
Take a set of meanders in aTuned and tunes their length to extend the original line length by aElonga...
Definition: seg.h:40
const SHAPE_LINE_CHAIN & CP() const
MEANDER_SETTINGS m_settings
The current end point.
int m_lengthTolerance
Target skew value for diff pair de-skewing.
Definition: pns_meander.h:92
SHAPE_LINE_CHAIN.
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
long long int m_targetLength
Type of corners for the meandered line.
Definition: pns_meander.h:86
const ENTRIES & CItems() const
Definition: pns_itemset.h:139
void Clear()
Function Clear() Removes all points from the line chain.
void SetBaselineOffset(int aOffset)
Set the parallel offset between the base segment and the meandered line.
Definition: pns_meander.h:434
void cutTunedLine(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
Extract the part of a track to be meandered, depending on the starting point and the cursor position.

References PNS::MEANDERED_LINE::AddCorner(), SHAPE_LINE_CHAIN::Append(), baselineSegment(), PNS::NODE::Branch(), PNS::ITEM_SET::CItems(), SHAPE_LINE_CHAIN::Clear(), PNS::DIFF_PAIR::CN(), PNS::MEANDER_PLACER_BASE::compareWithTolerance(), PNS::DIFF_PAIR::CP(), PNS::MEANDER_PLACER_BASE::cutTunedLine(), PNS::ALGO_BASE::Dbg(), GREEN, m_currentNode, m_currentStart, m_finalShapeN, m_finalShapeP, m_lastLength, m_lastStatus, PNS::MEANDER_SETTINGS::m_lengthTolerance, m_originPair, m_result, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_targetLength, m_tunedPathN, m_tunedPathP, PNS::MEANDER_PLACER_BASE::m_world, PNS::MEANDERED_LINE::Meanders(), PNS::MEANDERED_LINE::MeanderSegment(), PNS::MT_EMPTY, origPathLength(), pairOrientation(), PNS_DBG, PNS::MEANDERED_LINE::SetBaselineOffset(), PNS::MEANDERED_LINE::SetWidth(), SHAPE_LINE_CHAIN::Simplify(), PNS::MEANDER_PLACER_BASE::TOO_LONG, PNS::MEANDER_PLACER_BASE::TOO_SHORT, PNS::MEANDER_PLACER_BASE::TUNED, PNS::MEANDER_PLACER_BASE::tuneLineLength(), and YELLOW.

◆ origPathLength()

long long int PNS::DP_MEANDER_PLACER::origPathLength ( ) const
private

Current routing start point (end of tail, beginning of head).

Definition at line 142 of file pns_dp_meander_placer.cpp.

143 {
144  long long int totalP = m_padToDieLength + lineLength( m_tunedPathP );
145  long long int totalN = m_padToDieLength + lineLength( m_tunedPathN );
146  return std::max( totalP, totalN );
147 }
int m_padToDieLength
Width of the meandered trace(s).
long long int lineLength(const ITEM_SET &aLine) const
Calculate the total length of the line represented by an item set (tracks and vias)

References PNS::MEANDER_PLACER_BASE::lineLength(), PNS::MEANDER_PLACER_BASE::m_padToDieLength, m_tunedPathN, and m_tunedPathP.

Referenced by Move().

◆ pairOrientation()

bool PNS::DP_MEANDER_PLACER::pairOrientation ( const DIFF_PAIR::COUPLED_SEGMENTS aPair)
private

Definition at line 159 of file pns_dp_meander_placer.cpp.

160 {
161  VECTOR2I midp = ( aPair.coupledP.A + aPair.coupledN.A ) / 2;
162 
163  //DrawDebugPoint(midp, 6);
164 
165  return aPair.coupledP.Side( midp ) > 0;
166 }

References SEG::A, PNS::DIFF_PAIR::COUPLED_SEGMENTS::coupledN, PNS::DIFF_PAIR::COUPLED_SEGMENTS::coupledP, and SEG::Side().

Referenced by Move().

◆ release()

void PNS::DP_MEANDER_PLACER::release ( )
private

Definition at line 137 of file pns_dp_meander_placer.cpp.

138 {
139 }

◆ Router()

◆ SetDebugDecorator()

void PNS::ALGO_BASE::SetDebugDecorator ( DEBUG_DECORATOR aDecorator)
inlineinherited

Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.

Definition at line 73 of file pns_algo_base.h.

74  {
75  m_debugDecorator = aDecorator;
76  }
DEBUG_DECORATOR * m_debugDecorator
Definition: pns_algo_base.h:86

References PNS::ALGO_BASE::m_debugDecorator.

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), PNS::SHOVE::SHOVE(), and PNS::DRAGGER::tryWalkaround().

◆ SetLayer()

virtual bool PNS::PLACEMENT_ALGO::SetLayer ( int  aLayer)
inlinevirtualinherited

Function SetLayer()

Sets the current routing layer.

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 114 of file pns_placement_algo.h.

115  {
116  return false;
117  }

◆ SetLogger()

void PNS::ALGO_BASE::SetLogger ( LOGGER aLogger)
inlineinherited

Definition at line 65 of file pns_algo_base.h.

66  {
67  m_logger = aLogger;
68  }
LOGGER * m_logger
Definition: pns_algo_base.h:88

References PNS::ALGO_BASE::m_logger.

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), and PNS::DRAGGER::tryWalkaround().

◆ SetOrthoMode()

virtual void PNS::PLACEMENT_ALGO::SetOrthoMode ( bool  aOrthoMode)
inlinevirtualinherited

Function SetOrthoMode()

Forces the router to place a straight 90/45 degree trace (with the end as near to the cursor as possible) instead of a standard 135 degree two-segment bend.

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 182 of file pns_placement_algo.h.

183  {
184  }

◆ Settings()

◆ setWorld()

void PNS::DP_MEANDER_PLACER::setWorld ( NODE aWorld)
private

◆ SpacingStep()

void PNS::MEANDER_PLACER_BASE::SpacingStep ( int  aSign)
virtualinherited

Increase/decrease the current meandering spacing by one step.

Parameters
aSigndirection (negative = decrease, positive = increase).

Definition at line 53 of file pns_meander_placer_base.cpp.

54 {
55  int s = m_settings.m_spacing + aSign * m_settings.m_step;
56  s = std::max( s, 2 * m_currentWidth );
57 
59 }
int m_currentWidth
Meander settings.
int m_step
Length PadToDie.
Definition: pns_meander.h:82
MEANDER_SETTINGS m_settings
The current end point.
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:80

References PNS::MEANDER_PLACER_BASE::m_currentWidth, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_spacing, and PNS::MEANDER_SETTINGS::m_step.

◆ Start()

bool PNS::DP_MEANDER_PLACER::Start ( const VECTOR2I aP,
ITEM aStartItem 
)
overridevirtual

Start routing a single track at point aP, taking item aStartItem as anchor (unless NULL).

Implements PNS::PLACEMENT_ALGO.

Definition at line 72 of file pns_dp_meander_placer.cpp.

73 {
74  if( !aStartItem || !aStartItem->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) )
75  {
76  Router()->SetFailureReason( _( "Please select a track whose length you want to tune." ) );
77  return false;
78  }
79 
80  m_initialSegment = static_cast<LINKED_ITEM*>( aStartItem );
81  m_currentNode = nullptr;
83 
84  m_world = Router()->GetWorld()->Branch();
85 
86  TOPOLOGY topo( m_world );
87 
88  if( !topo.AssembleDiffPair( m_initialSegment, m_originPair ) )
89  {
90  Router()->SetFailureReason( _( "Unable to find complementary differential pair "
91  "net for length tuning. Make sure the names of the nets belonging "
92  "to a differential pair end with either _N/_P or +/-." ) );
93  return false;
94  }
95 
96  if( m_originPair.Gap() < 0 )
97  m_originPair.SetGap( Router()->Sizes().DiffPairGap() );
98 
99  if( !m_originPair.PLine().SegmentCount() ||
101  return false;
102 
103  SOLID* padA = nullptr;
104  SOLID* padB = nullptr;
105 
106  m_tunedPathP = topo.AssembleTuningPath( m_originPair.PLine().GetLink( 0 ), &padA, &padB );
107 
108  m_padToDieP = 0;
109 
110  if( padA )
111  m_padToDieP += padA->GetPadToDie();
112 
113  if( padB )
114  m_padToDieP += padB->GetPadToDie();
115 
116  m_tunedPathN = topo.AssembleTuningPath( m_originPair.NLine().GetLink( 0 ), &padA, &padB );
117 
118  m_padToDieN = 0;
119 
120  if( padA )
121  m_padToDieN += padA->GetPadToDie();
122 
123  if( padB )
124  m_padToDieN += padB->GetPadToDie();
125 
127 
130 
132 
133  return true;
134 }
ROUTER * Router() const
Return current router settings.
Definition: pns_algo_base.h:54
int Gap() const
int SegmentCount() const
Definition: pns_line.h:139
int Width() const
VECTOR2I m_currentStart
Current world state.
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
Definition: pns_node.cpp:127
int m_currentWidth
Meander settings.
void Remove(ARC *aArc)
Remove an item from this branch.
Definition: pns_node.cpp:810
int m_padToDieLength
Width of the meandered trace(s).
void SetGap(int aGap)
NODE * m_world
Total length added by pad to die size.
void SetFailureReason(const wxString &aReason)
Definition: pns_router.h:205
#define _(s)
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
NODE * GetWorld() const
Definition: pns_router.h:153

References _, PNS::ITEM::ARC_T, PNS::TOPOLOGY::AssembleDiffPair(), PNS::TOPOLOGY::AssembleTuningPath(), PNS::NODE::Branch(), PNS::DIFF_PAIR::Gap(), PNS::LINK_HOLDER::GetLink(), PNS::SOLID::GetPadToDie(), PNS::MEANDER_PLACER_BASE::getSnappedStartPoint(), PNS::ROUTER::GetWorld(), m_currentNode, m_currentStart, PNS::MEANDER_PLACER_BASE::m_currentWidth, m_initialSegment, m_originPair, PNS::MEANDER_PLACER_BASE::m_padToDieLength, m_padToDieN, m_padToDieP, m_tunedPathN, m_tunedPathP, PNS::MEANDER_PLACER_BASE::m_world, PNS::DIFF_PAIR::NLine(), PNS::ITEM::OfKind(), PNS::DIFF_PAIR::PLine(), PNS::NODE::Remove(), PNS::ALGO_BASE::Router(), PNS::ITEM::SEGMENT_T, PNS::LINE::SegmentCount(), PNS::ROUTER::SetFailureReason(), PNS::DIFF_PAIR::SetGap(), and PNS::DIFF_PAIR::Width().

◆ ToggleVia()

virtual bool PNS::PLACEMENT_ALGO::ToggleVia ( bool  aEnabled)
inlinevirtualinherited

Function ToggleVia()

Enables/disables a via at the end of currently routed trace.

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 94 of file pns_placement_algo.h.

95  {
96  return false;
97  }

◆ totalLength()

long long int PNS::DP_MEANDER_PLACER::totalLength ( )

◆ Trace()

const LINE PNS::DP_MEANDER_PLACER::Trace ( ) const

Definition at line 57 of file pns_dp_meander_placer.cpp.

58 {
59  return m_currentTraceP;
60 }

References m_currentTraceP.

◆ Traces()

const ITEM_SET PNS::DP_MEANDER_PLACER::Traces ( )
overridevirtual

Function Traces()

Returns all routed/tuned traces.

Implements PNS::PLACEMENT_ALGO.

Definition at line 359 of file pns_dp_meander_placer.cpp.

360 {
363 
364  ITEM_SET traces;
365 
366  traces.Add( &m_currentTraceP );
367  traces.Add( &m_currentTraceN );
368 
369  return traces;
370 }

References PNS::ITEM_SET::Add(), m_currentTraceN, m_currentTraceP, m_finalShapeN, m_finalShapeP, m_originPair, PNS::DIFF_PAIR::NLine(), and PNS::DIFF_PAIR::PLine().

◆ tuneLineLength()

void PNS::MEANDER_PLACER_BASE::tuneLineLength ( MEANDERED_LINE aTuned,
long long int  aElongation 
)
protectedinherited

Take a set of meanders in aTuned and tunes their length to extend the original line length by aElongation.

Definition at line 114 of file pns_meander_placer_base.cpp.

115 {
116  long long int remaining = aElongation;
117  bool finished = false;
118 
119  for( MEANDER_SHAPE* m : aTuned.Meanders() )
120  {
121  if( m->Type() != MT_CORNER )
122  {
123  if( remaining >= 0 )
124  remaining -= m->MaxTunableLength() - m->BaselineLength();
125 
126  if( remaining < 0 )
127  {
128  if( !finished )
129  {
130  MEANDER_TYPE newType;
131 
132  if( m->Type() == MT_START || m->Type() == MT_SINGLE )
133  newType = MT_SINGLE;
134  else
135  newType = MT_FINISH;
136 
137  m->SetType( newType );
138  m->Recalculate();
139 
140  finished = true;
141  }
142  else
143  {
144  m->MakeEmpty();
145  }
146  }
147  }
148  }
149 
150  remaining = aElongation;
151  int meanderCount = 0;
152 
153  for( MEANDER_SHAPE* m : aTuned.Meanders() )
154  {
155  if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
156  {
157  if(remaining >= 0)
158  {
159  remaining -= m->MaxTunableLength() - m->BaselineLength();
160  meanderCount ++;
161  }
162  }
163  }
164 
165  long long int balance = 0;
166 
167  if( meanderCount )
168  balance = -remaining / meanderCount;
169 
170  if( balance >= 0 )
171  {
172  for( MEANDER_SHAPE* m : aTuned.Meanders() )
173  {
174  if( m->Type() != MT_CORNER && m->Type() != MT_EMPTY )
175  {
176  m->Resize( std::max( m->Amplitude() - balance / 2,
177  (long long int) m_settings.m_minAmplitude ) );
178  }
179  }
180  }
181 }
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:76
MEANDER_TYPE
Shapes of available meanders.
Definition: pns_meander.h:37
MEANDER_SETTINGS m_settings
The current end point.

References PNS::MEANDER_SETTINGS::m_minAmplitude, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDERED_LINE::Meanders(), PNS::MT_CORNER, PNS::MT_EMPTY, PNS::MT_FINISH, PNS::MT_SINGLE, and PNS::MT_START.

Referenced by PNS::MEANDER_PLACER::doMove(), and Move().

◆ TuningInfo()

const wxString PNS::DP_MEANDER_PLACER::TuningInfo ( EDA_UNITS  aUnits) const
overridevirtual

Return a string describing the status and length of the tuned traces.

Implements PNS::MEANDER_PLACER_BASE.

Definition at line 385 of file pns_dp_meander_placer.cpp.

386 {
387  wxString status;
388 
389  switch( m_lastStatus )
390  {
391  case TOO_LONG:
392  status = _( "Too long: " );
393  break;
394  case TOO_SHORT:
395  status = _("Too short: " );
396  break;
397  case TUNED:
398  status = _( "Tuned: " );
399  break;
400  default:
401  return _( "?" );
402  }
403 
404  status += ::MessageTextFromValue( aUnits, m_lastLength );
405  status += "/";
406  status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength );
407  status += " (gap: ";
408  status += ::MessageTextFromValue( aUnits, m_originPair.Gap() );
409  status += ")";
410 
411  return status;
412 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:103
int Gap() const
#define _(s)
MEANDER_SETTINGS m_settings
The current end point.
long long int m_targetLength
Type of corners for the meandered line.
Definition: pns_meander.h:86

References _, PNS::DIFF_PAIR::Gap(), m_lastLength, m_lastStatus, m_originPair, PNS::MEANDER_PLACER_BASE::m_settings, PNS::MEANDER_SETTINGS::m_targetLength, MessageTextFromValue(), PNS::MEANDER_PLACER_BASE::TOO_LONG, PNS::MEANDER_PLACER_BASE::TOO_SHORT, and PNS::MEANDER_PLACER_BASE::TUNED.

◆ TuningStatus()

DP_MEANDER_PLACER::TUNING_STATUS PNS::DP_MEANDER_PLACER::TuningStatus ( ) const
overridevirtual

Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.

Implements PNS::MEANDER_PLACER_BASE.

Definition at line 415 of file pns_dp_meander_placer.cpp.

416 {
417  return m_lastStatus;
418 }

References m_lastStatus.

◆ UnfixRoute()

virtual bool PNS::PLACEMENT_ALGO::UnfixRoute ( )
inlinevirtualinherited

Reimplemented in PNS::LINE_PLACER.

Definition at line 81 of file pns_placement_algo.h.

81 { return false; };

◆ UpdateSettings()

void PNS::MEANDER_PLACER_BASE::UpdateSettings ( const MEANDER_SETTINGS aSettings)
virtualinherited

Definition at line 62 of file pns_meander_placer_base.cpp.

63 {
64  m_settings = aSettings;
65 }
MEANDER_SETTINGS m_settings
The current end point.

References PNS::MEANDER_PLACER_BASE::m_settings.

Referenced by LENGTH_TUNER_TOOL::meanderSettingsDialog().

◆ UpdateSizes()

virtual void PNS::PLACEMENT_ALGO::UpdateSizes ( const SIZES_SETTINGS aSizes)
inlinevirtualinherited

Function UpdateSizes()

Performs on-the-fly update of the width, via diameter & drill size from a settings class. Used to dynamically change these parameters as the track is routed.

Reimplemented in PNS::LINE_PLACER, and PNS::DIFF_PAIR_PLACER.

Definition at line 171 of file pns_placement_algo.h.

172  {
173  }

◆ VisibleViewArea()

const BOX2I & PNS::ALGO_BASE::VisibleViewArea ( ) const
inherited

Definition at line 39 of file pns_algo_base.cpp.

40 {
41  return m_router->VisibleViewArea();
42 }
ROUTER * m_router
Definition: pns_algo_base.h:87
const BOX2I & VisibleViewArea() const
Definition: pns_router.h:220

References PNS::ALGO_BASE::m_router, and PNS::ROUTER::VisibleViewArea().

Referenced by PNS::DRAGGER::optimizeAndUpdateDraggedLine(), and PNS::SHOVE::runOptimizer().

Friends And Related Function Documentation

◆ MEANDER_SHAPE

friend class MEANDER_SHAPE
friend

Definition at line 110 of file pns_dp_meander_placer.h.

Member Data Documentation

◆ m_coupledSegments

DIFF_PAIR::COUPLED_SEGMENTS_VEC PNS::DP_MEANDER_PLACER::m_coupledSegments
private

Definition at line 132 of file pns_dp_meander_placer.h.

◆ m_currentEnd

VECTOR2I PNS::MEANDER_PLACER_BASE::m_currentEnd
protectedinherited

◆ m_currentNode

NODE* PNS::DP_MEANDER_PLACER::m_currentNode
private

◆ m_currentStart

VECTOR2I PNS::DP_MEANDER_PLACER::m_currentStart
private

Current world state.

Definition at line 126 of file pns_dp_meander_placer.h.

Referenced by Move(), and Start().

◆ m_currentTraceN

LINE PNS::DP_MEANDER_PLACER::m_currentTraceN
private

Definition at line 134 of file pns_dp_meander_placer.h.

Referenced by Traces().

◆ m_currentTraceP

LINE PNS::DP_MEANDER_PLACER::m_currentTraceP
private

Definition at line 134 of file pns_dp_meander_placer.h.

Referenced by Trace(), and Traces().

◆ m_currentWidth

int PNS::MEANDER_PLACER_BASE::m_currentWidth
protectedinherited

◆ m_debugDecorator

DEBUG_DECORATOR* PNS::ALGO_BASE::m_debugDecorator
protectedinherited

Definition at line 86 of file pns_algo_base.h.

Referenced by PNS::ALGO_BASE::Dbg(), and PNS::ALGO_BASE::SetDebugDecorator().

◆ m_finalShapeN

SHAPE_LINE_CHAIN PNS::DP_MEANDER_PLACER::m_finalShapeN
private

Definition at line 137 of file pns_dp_meander_placer.h.

Referenced by FixRoute(), Move(), and Traces().

◆ m_finalShapeP

SHAPE_LINE_CHAIN PNS::DP_MEANDER_PLACER::m_finalShapeP
private

Definition at line 137 of file pns_dp_meander_placer.h.

Referenced by FixRoute(), Move(), and Traces().

◆ m_initialSegment

LINKED_ITEM* PNS::DP_MEANDER_PLACER::m_initialSegment
private

Definition at line 139 of file pns_dp_meander_placer.h.

Referenced by CurrentLayer(), DP_MEANDER_PLACER(), and Start().

◆ m_lastLength

long long int PNS::DP_MEANDER_PLACER::m_lastLength
private

Definition at line 141 of file pns_dp_meander_placer.h.

Referenced by DP_MEANDER_PLACER(), Move(), and TuningInfo().

◆ m_lastStatus

TUNING_STATUS PNS::DP_MEANDER_PLACER::m_lastStatus
private

Definition at line 144 of file pns_dp_meander_placer.h.

Referenced by DP_MEANDER_PLACER(), Move(), TuningInfo(), and TuningStatus().

◆ m_logger

LOGGER* PNS::ALGO_BASE::m_logger
protectedinherited

Definition at line 88 of file pns_algo_base.h.

Referenced by PNS::ALGO_BASE::SetLogger().

◆ m_originPair

DIFF_PAIR PNS::DP_MEANDER_PLACER::m_originPair
private

◆ m_padToDieLength

int PNS::MEANDER_PLACER_BASE::m_padToDieLength
protectedinherited

◆ m_padToDieN

int PNS::DP_MEANDER_PLACER::m_padToDieN
private

Definition at line 143 of file pns_dp_meander_placer.h.

Referenced by DP_MEANDER_PLACER(), and Start().

◆ m_padToDieP

int PNS::DP_MEANDER_PLACER::m_padToDieP
private

Definition at line 142 of file pns_dp_meander_placer.h.

Referenced by DP_MEANDER_PLACER(), and Start().

◆ m_result

MEANDERED_LINE PNS::DP_MEANDER_PLACER::m_result
private

Definition at line 138 of file pns_dp_meander_placer.h.

Referenced by CheckFit(), and Move().

◆ m_router

◆ m_settings

◆ m_tunedPath

ITEM_SET PNS::DP_MEANDER_PLACER::m_tunedPath
private

Definition at line 135 of file pns_dp_meander_placer.h.

◆ m_tunedPathN

ITEM_SET PNS::DP_MEANDER_PLACER::m_tunedPathN
private

Definition at line 135 of file pns_dp_meander_placer.h.

Referenced by Move(), origPathLength(), and Start().

◆ m_tunedPathP

ITEM_SET PNS::DP_MEANDER_PLACER::m_tunedPathP
private

Definition at line 135 of file pns_dp_meander_placer.h.

Referenced by Move(), origPathLength(), and Start().

◆ m_world


The documentation for this class was generated from the following files: