91 "net for length tuning. Make sure the names of the nets belonging " 92 "to a differential pair end with either _N/_P or +/-." ) );
131 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
132 totalP += l->CLine().Length();
138 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
139 totalN += l->CLine().Length();
142 return std::max( totalP, totalN );
184 tuned.SetShape( tunedP, tunedN );
186 tuned.CoupledSegmentPairs( coupledSegments );
188 if( coupledSegments.size() == 0 )
200 int offset = ( tuned.Gap() + tuned.Width() ) / 2;
209 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
215 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
219 int curIndexP = 0, curIndexN = 0;
227 while( sp.indexP >= curIndexP )
233 while( sp.indexN >= curIndexN )
242 while( curIndexP < tunedP.PointCount() )
245 while( curIndexN < tunedN.PointCount() )
259 m_lastLength = dpLen - std::max( tunedP.Length(), tunedN.Length() );
272 tunedP.Append( m->CLine( 0 ) );
273 tunedN.Append( m->CLine( 1 ) );
277 m_lastLength += std::max( tunedP.Length(), tunedN.Length() );
354 int w = aShape->
Width();
394 status =
_(
"Too long: " );
397 status =
_(
"Too short: " );
400 status =
_(
"Tuned: " );
int GetTotalPadToDieLength(const LINE &aLine) const
Base class for PNS router board items.
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
ROUTER * Router() const
Return current router settings.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
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 a...
bool CheckSelfIntersections(MEANDER_SHAPE *aShape, int aClearance)
Check if the given shape is intersecting with any other meander in the current line.
Keep the router "world" - i.e.
virtual void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType=0, int aWidth=0, const std::string aName="")
The geometry of a single meander.
Implementation of conversion functions that require both schematic and board internal units.
const std::vector< int > CurrentNets() const override
Function CurrentNets()
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 DIFF_PAIR AssembleDiffPair(SEGMENT *aStart)
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.
TUNING_STATUS m_lastStatus
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
VECTOR2I m_currentStart
Current world state.
SHAPE_LINE_CHAIN m_finalShapeN
void Add(const LINE &aLine)
long long int m_lastLength
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
TUNING_STATUS
< Result of the length tuning operation
int m_currentWidth
Meander settings.
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
bool Start(const VECTOR2I &aP, ITEM *aStartItem) override
Start routing a single track at point aP, taking item aStartItem as anchor (unless NULL).
void Remove(ARC *aArc)
Remove an item from this branch.
bool CheckFit(MEANDER_SHAPE *aShape) override
Checks if it's OK to place the shape aShape (i.e.
void SetWidth(int aWidth)
Set the line width.
bool pairOrientation(const DIFF_PAIR::COUPLED_SEGMENTS &aPair)
const SEG baselineSegment(const DIFF_PAIR::COUPLED_SEGMENTS &aCoupledSegs)
const ITEM_SET Traces() override
Function Traces()
const VECTOR2I & CurrentEnd() const override
Function CurrentEnd()
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
NODE * CurrentNode(bool aLoopsRemoved=false) const override
Return the most recent world state.
const ITEM_SET AssembleTrivialPath(ITEM *aStart)
long long int origPathLength() const
Current routing start point (end of tail, beginning of head).
LINKED_ITEM * m_initialSegment
std::vector< MEANDER_SHAPE * > & Meanders()
NODE * m_world
Total length added by pad to die size.
const SHAPE_LINE_CHAIN & CLine(int aShape) const
DEBUG_DECORATOR * Dbg() const
void SetFailureReason(const wxString &aReason)
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...
SHAPE_LINE_CHAIN m_finalShapeP
int SegmentCount() const
Function SegmentCount()
virtual void AddSegment(SEG aS, int aColor, const std::string aName="")
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
Pointer to world to search colliding items.
Represent a set of meanders fitted over a single or two lines.
bool AbortPlacement() override
int m_padToDieLenth
Width of the meandered trace(s).
const SHAPE_LINE_CHAIN & CP() const
const wxString TuningInfo(EDA_UNITS aUnits) const override
Return a string describing the status and length of the tuned traces.
TUNING_STATUS TuningStatus() const override
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
MEANDER_SETTINGS m_settings
The current end point.
int m_lengthTolerance
Number of line segments for arc approximation.
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.
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
bool OfKind(int aKindMask) const
Return true if the item's type matches the mask aKindMask.
long long int m_targetLength
Type of corners for the meandered line.
const ENTRIES & CItems() const
LINKED_ITEM * GetLink(int aIndex) const
Erase the linking information. Used to detach the line from the owning node.
void Clear()
Function Clear() Removes all points from the line chain.
int m_spacing
Amplitude/spacing adjustment step.
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).
int CurrentLayer() const override
Function CurrentLayer()
DP_MEANDER_PLACER(ROUTER *aRouter)
bool HasPlacedAnything() const override
Push and Shove diff pair dimensions (gap) settings dialog.
void SetBaselineOffset(int aOffset)
Set the parallel offset between the base segment and the meandered line.
bool CommitPlacement() override
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
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.
const LAYER_RANGE & Layers() const
int Side(const VECTOR2I &aP) const
Determine on which side of directed line passing via segment ends point aP lies.