KiCad PCB EDA Suite
PNS::MEANDER_PLACER_BASE Class Referenceabstract

Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code. More...

#include <pns_meander_placer_base.h>

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

Public Types

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

Public Member Functions

 MEANDER_PLACER_BASE (ROUTER *aRouter)
 
virtual ~MEANDER_PLACER_BASE ()
 
virtual const wxString TuningInfo (EDA_UNITS aUnits) const =0
 Return a string describing the status and length of the tuned traces. More...
 
virtual TUNING_STATUS TuningStatus () const =0
 Return the tuning status (too short, too long, etc.) of the trace(s) being tuned. 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 int Clearance ()
 Return the clearance of the track(s) being length tuned. More...
 
virtual const MEANDER_SETTINGSMeanderSettings () const
 Return the current meandering configuration. More...
 
virtual void UpdateSettings (const MEANDER_SETTINGS &aSettings)
 
virtual bool CheckFit (MEANDER_SHAPE *aShape)
 Checks if it's OK to place the shape aShape (i.e. More...
 
int GetTotalPadToDieLength (const LINE &aLine) const
 
virtual bool Start (const VECTOR2I &aP, ITEM *aStartItem)=0
 Function Start() More...
 
virtual bool Move (const VECTOR2I &aP, ITEM *aEndItem)=0
 Function Move() More...
 
virtual bool FixRoute (const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false)=0
 Function FixRoute() More...
 
virtual bool UnfixRoute ()
 
virtual bool CommitPlacement ()
 
virtual bool AbortPlacement ()
 
virtual bool HasPlacedAnything () const
 
virtual bool ToggleVia (bool aEnabled)
 Function ToggleVia() More...
 
virtual bool IsPlacingVia () const
 Function IsPlacingVia() More...
 
virtual bool SetLayer (int aLayer)
 Function SetLayer() More...
 
virtual const ITEM_SET Traces ()=0
 Function Traces() More...
 
virtual const VECTOR2ICurrentStart () const =0
 Function CurrentStart() More...
 
virtual const VECTOR2ICurrentEnd () const =0
 Function CurrentEnd() More...
 
virtual const std::vector< int > CurrentNets () const =0
 Function CurrentNets() More...
 
virtual int CurrentLayer () const =0
 Function CurrentLayer() More...
 
virtual NODECurrentNode (bool aLoopsRemoved=false) const =0
 Function CurrentNode() 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 SOLID *aStartPad, const SOLID *aEndPad) 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
 
SOLIDm_startPad_p
 
SOLIDm_endPad_p
 
SOLIDm_startPad_n
 
SOLIDm_endPad_n
 
DEBUG_DECORATORm_debugDecorator
 
ROUTERm_router
 
LOGGERm_logger
 

Detailed Description

Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code.

Definition at line 45 of file pns_meander_placer_base.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

◆ MEANDER_PLACER_BASE()

PNS::MEANDER_PLACER_BASE::MEANDER_PLACER_BASE ( ROUTER aRouter)

Definition at line 30 of file pns_meander_placer_base.cpp.

30 :
31 PLACEMENT_ALGO( aRouter )
32{
33 m_world = nullptr;
36 m_startPad_n = nullptr;
37 m_startPad_p = nullptr;
38 m_endPad_n = nullptr;
39 m_endPad_p = nullptr;
40}
int m_currentWidth
Meander settings.
int m_padToDieLength
Width of the meandered trace(s).
NODE * m_world
Total length added by pad to die size.
PLACEMENT_ALGO(ROUTER *aRouter)

References m_currentWidth, m_endPad_n, m_endPad_p, m_padToDieLength, m_startPad_n, m_startPad_p, and m_world.

◆ ~MEANDER_PLACER_BASE()

PNS::MEANDER_PLACER_BASE::~MEANDER_PLACER_BASE ( )
virtual

Definition at line 43 of file pns_meander_placer_base.cpp.

44{
45}

Member Function Documentation

◆ AbortPlacement()

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

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

Definition at line 85 of file pns_placement_algo.h.

85{ return false; };

◆ AmplitudeStep()

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

Increase/decreases the current meandering amplitude by one step.

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

Definition at line 48 of file pns_meander_placer_base.cpp.

49{
51 a = std::max( a, m_settings.m_minAmplitude );
52
54}
MEANDER_SETTINGS m_settings
The current end point.
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:77
int m_step
Length PadToDie.
Definition: pns_meander.h:86
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:80

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

◆ CheckFit()

virtual bool PNS::MEANDER_PLACER_BASE::CheckFit ( MEANDER_SHAPE aShape)
inlinevirtual

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 in PNS::DP_MEANDER_PLACER, and PNS::MEANDER_PLACER.

Definition at line 110 of file pns_meander_placer_base.h.

111 {
112 return false;
113 }

Referenced by PNS::MEANDER_SHAPE::Fit().

◆ Clearance()

int PNS::MEANDER_PLACER_BASE::Clearance ( )
virtual

Return the clearance of the track(s) being length tuned.

Returns
clearance value in internal units

Definition at line 66 of file pns_meander_placer_base.cpp.

67{
68 // Assumption: All tracks are part of the same net class.
69 // It shouldn't matter which track we pick. They should all have the same clearance if
70 // they are part of the same net class. Therefore, pick the first one on the list.
71 ITEM* itemToCheck = Traces().CItems().front().item;
72 PNS::CONSTRAINT constraint;
73
75 nullptr, CurrentLayer(), &constraint );
76
77 wxCHECK_MSG( constraint.m_Value.HasMin(), m_currentWidth, wxT( "No minimum clearance?" ) );
78
79 return constraint.m_Value.Min();
80}
T Min() const
Definition: minoptmax.h:33
bool HasMin() const
Definition: minoptmax.h:37
ROUTER * Router() const
Return current router settings.
Definition: pns_algo_base.h:54
const ENTRIES & CItems() const
Definition: pns_itemset.h:136
virtual const ITEM_SET Traces()=0
Function Traces()
virtual int CurrentLayer() const =0
Function CurrentLayer()
RULE_RESOLVER * GetRuleResolver() const
Definition: pns_router.h:172
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const PNS::ITEM *aItemA, const PNS::ITEM *aItemB, int aLayer, PNS::CONSTRAINT *aConstraint)=0
MINOPTMAX< int > m_Value
Definition: pns_node.h:70

References PNS::ITEM_SET::CItems(), PNS::CT_CLEARANCE, PNS::PLACEMENT_ALGO::CurrentLayer(), PNS::ROUTER::GetRuleResolver(), MINOPTMAX< T >::HasMin(), m_currentWidth, PNS::CONSTRAINT::m_Value, MINOPTMAX< T >::Min(), PNS::RULE_RESOLVER::QueryConstraint(), PNS::ALGO_BASE::Router(), and PNS::PLACEMENT_ALGO::Traces().

Referenced by PNS::MEANDER_SHAPE::spacing(), and SpacingStep().

◆ CommitPlacement()

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

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

Definition at line 83 of file pns_placement_algo.h.

83{ return false; };

◆ compareWithTolerance()

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

Compare aValue against aExpected with given tolerance.

Definition at line 249 of file pns_meander_placer_base.cpp.

251{
252 if( aValue < aExpected - aTolerance )
253 return -1;
254 else if( aValue > aExpected + aTolerance )
255 return 1;
256 else
257 return 0;
258}

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

◆ CurrentEnd()

virtual const VECTOR2I & PNS::PLACEMENT_ALGO::CurrentEnd ( ) const
pure virtualinherited

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.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by PNS::ROUTER::Finish(), and ROUTER_TOOL::performRouting().

◆ CurrentLayer()

virtual int PNS::PLACEMENT_ALGO::CurrentLayer ( ) const
pure virtualinherited

Function CurrentLayer()

Returns the layer of currently routed track.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by Clearance().

◆ CurrentNets()

virtual const std::vector< int > PNS::PLACEMENT_ALGO::CurrentNets ( ) const
pure virtualinherited

Function CurrentNets()

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

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

◆ CurrentNode()

virtual NODE * PNS::PLACEMENT_ALGO::CurrentNode ( bool  aLoopsRemoved = false) const
pure virtualinherited

Function CurrentNode()

Returns the most recent board state.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

◆ CurrentStart()

virtual const VECTOR2I & PNS::PLACEMENT_ALGO::CurrentStart ( ) const
pure virtualinherited

Function CurrentStart()

Returns the current start of the line(s) being placed/tuned.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by ROUTER_TOOL::performRouting().

◆ 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 
)
protected

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 89 of file pns_meander_placer_base.cpp.

92{
93 VECTOR2I cp ( aCursorPos );
94
95 if( cp == aTuneStart ) // we don't like tuning segments with 0 length
96 {
97 int idx = aOrigin.FindSegment( cp );
98
99 if( idx >= 0 )
100 {
101 const SEG& s = aOrigin.CSegment( idx );
102 cp += ( s.B - s.A ).Resize( 2 );
103 }
104 else
105 {
106 cp += VECTOR2I( 2, 5 ); // some arbitrary value that is not 45 degrees oriented
107 }
108 }
109
110 VECTOR2I n = aOrigin.NearestPoint( cp, false );
111 VECTOR2I m = aOrigin.NearestPoint( aTuneStart, false );
112
113 SHAPE_LINE_CHAIN l( aOrigin );
114 l.Split( n );
115 l.Split( m );
116
117 int i_start = l.Find( m );
118 int i_end = l.Find( n );
119
120 if( i_start > i_end )
121 {
122 l = l.Reverse();
123 i_start = l.Find( m );
124 i_end = l.Find( n );
125 }
126
127 aPre = l.Slice( 0, i_start );
128 aPost = l.Slice( i_end, -1 );
129 aTuned = l.Slice( i_start, i_end );
130
131 aTuned.Simplify();
132}
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Search for segment containing point aP.
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Return a subset of this line chain containing the [start_index, end_index] range of points.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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 PNS::DP_MEANDER_PLACER::Move().

◆ Dbg()

DEBUG_DECORATOR * PNS::ALGO_BASE::Dbg ( ) const
inlineinherited

◆ FixRoute()

virtual bool PNS::PLACEMENT_ALGO::FixRoute ( const VECTOR2I aP,
ITEM aEndItem,
bool  aForceFinish = false 
)
pure virtualinherited

Function FixRoute()

Commits the currently routed items 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 case, the track is only committed if Settings.CanViolateDRC() is on.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::LINE_PLACER, PNS::DP_MEANDER_PLACER, and PNS::MEANDER_PLACER.

◆ FlipPosture()

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

Function FlipPosture()

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

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

Definition at line 167 of file pns_placement_algo.h.

168 {
169 }

◆ 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::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 198 of file pns_placement_algo.h.

199 {
200 }

◆ getSnappedStartPoint()

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

Definition at line 261 of file pns_meander_placer_base.cpp.

262{
263 if( aStartItem->Kind() == ITEM::SEGMENT_T )
264 {
265 return static_cast<SEGMENT*>( aStartItem )->Seg().NearestPoint( aStartPoint );
266 }
267 else
268 {
269 wxASSERT( aStartItem->Kind() == ITEM::ARC_T );
270 ARC* arc = static_cast<ARC*>( aStartItem );
271
272 if( ( VECTOR2I( arc->Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
273 ( VECTOR2I( arc->Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
274 {
275 return arc->Anchor( 0 );
276 }
277 else
278 {
279 return arc->Anchor( 1 );
280 }
281 }
282}
@ SEGMENT_T
Definition: pns_item.h:66

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

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

◆ GetTotalPadToDieLength()

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

Definition at line 205 of file pns_meander_placer_base.cpp.

206{
207 int length = 0;
208 JOINT start;
209 JOINT end;
210
211 m_world->FindLineEnds( aLine, start, end );
212
213 // Extract the length of the pad to die for start and end pads
214 for( auto& link : start.LinkList() )
215 {
216 if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
217 {
218 // If there are overlapping pads, choose the first with a non-zero length
219 if( solid->GetPadToDie() > 0 )
220 {
221 length += solid->GetPadToDie();
222 break;
223 }
224 }
225 }
226
227 for( auto& link : end.LinkList() )
228 {
229 if( const SOLID* solid = dynamic_cast<const SOLID*>( link.item ) )
230 {
231 if( solid->GetPadToDie() > 0 )
232 {
233 length += solid->GetPadToDie();
234 break;
235 }
236 }
237 }
238
239 return length;
240}
void FindLineEnds(const LINE &aLine, JOINT &aA, JOINT &aB)
Destroy all child nodes. Applicable only to the root node.
Definition: pns_node.cpp:1069

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

◆ HasPlacedAnything()

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

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

Definition at line 87 of file pns_placement_algo.h.

87{ return false; }

Referenced by ROUTER_TOOL::performRouting().

◆ 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::DIFF_PAIR_PLACER, and PNS::LINE_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 SOLID aStartPad,
const SOLID aEndPad 
) const
protected

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

Parameters
aLine
Returns
Pointer to world to search colliding items.

If there is a start pad but the pad's layers do not overlap the first track layer, then there must be a fanout via on the line. If there isn't, we still need to have the via back to the pad, so count the distance in the line tuning

Definition at line 285 of file pns_meander_placer_base.cpp.

286{
287 long long int total = 0;
288
289 if( aLine.Empty() )
290 return 0;
291
292 const ITEM* start_item = aLine[0];
293 const ITEM* end_item = aLine[aLine.Size() - 1];
294 bool start_via = false;
295 bool end_via = false;
296
297
303 start_via = aStartPad && ( !aStartPad->LayersOverlap( start_item ) );
304 end_via = aEndPad && ( !aEndPad->LayersOverlap( end_item ) );
305
306 for( int idx = 0; idx < aLine.Size(); idx++ )
307 {
308 const ITEM* item = aLine[idx];
309
310 if( const LINE* l = dyn_cast<const LINE*>( item ) )
311 {
312 total += l->CLine().Length();
313 }
314 else if( item->OfKind( ITEM::VIA_T ) && idx > 0 && idx < aLine.Size() - 1 )
315 {
316 int layerPrev = aLine[idx - 1]->Layer();
317 int layerNext = aLine[idx + 1]->Layer();
318
319 if( layerPrev != layerNext )
320 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
321 }
322 }
323
324 if( start_via )
325 {
326 int layerPrev = aStartPad->Layer();
327 int layerNext = start_item->Layer();
328
329 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
330 }
331
332 if( end_via )
333 {
334 int layerPrev = end_item->Layer();
335 int layerNext = aEndPad->Layer();
336
337 total += m_router->GetInterface()->StackupHeight( layerPrev, layerNext );
338 }
339
340 return total;
341}
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::ITEM_SET::Empty(), PNS::ROUTER::GetInterface(), PNS::ITEM::Layer(), PNS::ITEM::LayersOverlap(), PNS::ALGO_BASE::m_router, PNS::ITEM::OfKind(), PNS::ITEM_SET::Size(), PNS::ROUTER_IFACE::StackupHeight(), and PNS::ITEM::VIA_T.

Referenced by PNS::DP_MEANDER_PLACER::origPathLength(), PNS::MEANDER_PLACER::origPathLength(), PNS::MEANDER_SKEW_PLACER::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 nullptr;
37}

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

◆ MeanderSettings()

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

Return the current meandering configuration.

Returns
the settings

Definition at line 243 of file pns_meander_placer_base.cpp.

244{
245 return m_settings;
246}

References m_settings.

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

◆ Move()

virtual bool PNS::PLACEMENT_ALGO::Move ( const VECTOR2I aP,
ITEM aEndItem 
)
pure virtualinherited

Function Move()

Moves the end of the currently routed primtive(s) to the point aP, taking aEndItem as the anchor (if not NULL). (unless NULL).

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, PNS::MEANDER_PLACER, and PNS::MEANDER_SKEW_PLACER.

◆ 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 }

References PNS::ALGO_BASE::m_debugDecorator.

Referenced by PNS::SHOVE::onCollidingSolid(), 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::DIFF_PAIR_PLACER, and PNS::LINE_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::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 189 of file pns_placement_algo.h.

190 {
191 }

◆ Settings()

◆ SpacingStep()

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

Increase/decrease the current meandering spacing by one step.

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

Definition at line 57 of file pns_meander_placer_base.cpp.

58{
59 int s = m_settings.m_spacing + aSign * m_settings.m_step;
60 s = std::max( s, m_currentWidth + Clearance() );
61
63}
virtual int Clearance()
Return the clearance of the track(s) being length tuned.
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:83

References Clearance(), m_currentWidth, m_settings, PNS::MEANDER_SETTINGS::m_spacing, and PNS::MEANDER_SETTINGS::m_step.

◆ Start()

virtual bool PNS::PLACEMENT_ALGO::Start ( const VECTOR2I aP,
ITEM aStartItem 
)
pure virtualinherited

Function Start()

Starts placement/drag operation at point aP, taking item aStartItem as anchor (unless NULL).

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, PNS::MEANDER_PLACER, and PNS::MEANDER_SKEW_PLACER.

◆ 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::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 94 of file pns_placement_algo.h.

95 {
96 return false;
97 }

◆ Traces()

virtual const ITEM_SET PNS::PLACEMENT_ALGO::Traces ( )
pure virtualinherited

Function Traces()

Returns all routed/tuned traces.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by Clearance().

◆ tuneLineLength()

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

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

Definition at line 135 of file pns_meander_placer_base.cpp.

136{
137 long long int remaining = aElongation;
138 bool finished = false;
139
140 for( MEANDER_SHAPE* m : aTuned.Meanders() )
141 {
142 if( m->Type() != MT_CORNER && m->Type() != MT_ARC )
143 {
144 if( remaining >= 0 )
145 remaining -= m->MaxTunableLength() - m->BaselineLength();
146
147 if( remaining < 0 )
148 {
149 if( !finished )
150 {
151 MEANDER_TYPE newType;
152
153 if( m->Type() == MT_START || m->Type() == MT_SINGLE )
154 newType = MT_SINGLE;
155 else
156 newType = MT_FINISH;
157
158 m->SetType( newType );
159 m->Recalculate();
160
161 finished = true;
162 }
163 else
164 {
165 m->MakeEmpty();
166 }
167 }
168 }
169 }
170
171 remaining = aElongation;
172 int meanderCount = 0;
173
174 for( MEANDER_SHAPE* m : aTuned.Meanders() )
175 {
176 if( m->Type() != MT_CORNER && m->Type() != MT_ARC && m->Type() != MT_EMPTY )
177 {
178 if(remaining >= 0)
179 {
180 remaining -= m->MaxTunableLength() - m->BaselineLength();
181 meanderCount ++;
182 }
183 }
184 }
185
186 long long int balance = 0;
187
188 if( meanderCount )
189 balance = -remaining / meanderCount;
190
191 if( balance >= 0 )
192 {
193 for( MEANDER_SHAPE* m : aTuned.Meanders() )
194 {
195 if( m->Type() != MT_CORNER && m->Type() != MT_ARC && m->Type() != MT_EMPTY )
196 {
197 m->Resize( std::max( m->Amplitude() - balance / 2,
198 (long long int) m_settings.m_minAmplitude ) );
199 }
200 }
201 }
202}
MEANDER_TYPE
Shapes of available meanders.
Definition: pns_meander.h:37
@ MT_ARC
Definition: pns_meander.h:45
@ MT_START
Definition: pns_meander.h:39
@ MT_FINISH
Definition: pns_meander.h:40
@ MT_EMPTY
Definition: pns_meander.h:46
@ MT_CORNER
Definition: pns_meander.h:44
@ MT_SINGLE
Definition: pns_meander.h:38

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

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

◆ TuningInfo()

virtual const wxString PNS::MEANDER_PLACER_BASE::TuningInfo ( EDA_UNITS  aUnits) const
pure virtual

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

Implemented in PNS::DP_MEANDER_PLACER, PNS::MEANDER_PLACER, and PNS::MEANDER_SKEW_PLACER.

Referenced by PNS_TUNE_STATUS_POPUP::UpdateStatus().

◆ TuningStatus()

virtual TUNING_STATUS PNS::MEANDER_PLACER_BASE::TuningStatus ( ) const
pure virtual

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

Implemented in PNS::DP_MEANDER_PLACER, and PNS::MEANDER_PLACER.

Referenced by PNS_TUNE_STATUS_POPUP::UpdateStatus().

◆ 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)
virtual

Definition at line 83 of file pns_meander_placer_base.cpp.

84{
85 m_settings = aSettings;
86}

References m_settings.

Referenced by LENGTH_TUNER_TOOL::meanderSettingsDialog(), and LENGTH_TUNER_TOOL::performTuning().

◆ 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::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 178 of file pns_placement_algo.h.

179 {
180 }

◆ VisibleViewArea()

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

Definition at line 40 of file pns_algo_base.cpp.

41{
42 return m_router->VisibleViewArea();
43}
const BOX2I & VisibleViewArea() const
Definition: pns_router.h:213

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

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

Member Data Documentation

◆ m_currentEnd

◆ m_currentWidth

int PNS::MEANDER_PLACER_BASE::m_currentWidth
protected

◆ 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_endPad_n

◆ m_endPad_p

◆ 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_padToDieLength

◆ m_router

◆ m_settings

◆ m_startPad_n

◆ m_startPad_p

◆ m_world


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