23#ifndef __PNS_DIFF_PAIR_H
24#define __PNS_DIFF_PAIR_H
46 DP_DIMENSIONS(
int aWidth = 0,
int aGap = 0,
int aViaGap = 0,
int aViaDiameter = 0,
int aMinClearance = 0 ) :
69 const wxString
Format()
const;
90 const wxString aName = wxT(
"" ) ) :
142 const wxString
GetName()
const;
190 std::optional<DP_GATEWAY>
Extend(
int aLength );
191 std::optional<DP_GATEWAY>
AddTurns(
bool aSide,
bool a90Deg,
bool aLeft,
bool aWiggle );
323 bool aBuildEntries =
false,
bool aViaMode =
false );
351 gw.SetDimensions( aDims );
390 const SEG& aCoupledN,
const SEG& aParentN,
int aIndexN ) :
497 m_n = std::move( aOther.m_n );
498 m_p = std::move( aOther.m_p );
499 m_line_n = std::move( aOther.m_line_n );
500 m_line_p = std::move( aOther.m_line_p );
622 bool aUseGapConstraint =
true,
623 const std::optional<DP_GAP_CONSTRAINT>& aOverrideGapConstraint = std::optional<DP_GAP_CONSTRAINT>() )
const;
639 return (
m_n.SegmentCount() == 0 ) || (
m_p.SegmentCount() == 0 );
645 bool BuildInitial(
const DP_GATEWAY& aEntry,
const DP_GATEWAY& aTarget,
bool aPrefDiagonal,
bool aFitVias,
float& aBestCouplingRatio,
float& aAspectRatio );
653 return m_dims.GapConstraint();
Represent route directions & corner angles in a 45-degree metric.
Basic class for a differential pair.
bool CheckConnectionAngle(const DIFF_PAIR &aOther, int allowedAngles) const
void AppendVias(const VIA &aViaP, const VIA &aViaN)
const SHAPE_LINE_CHAIN & CN() const
DIRECTION_45 DirP(bool aEnd) const
DP_PRIMITIVE_PAIR EndingPrimitives()
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
double CoupledLength() const
void Append(const DIFF_PAIR &aOther)
void SetLines(const LINE &aP, const LINE &aN)
void SetDimensions(const DP_DIMENSIONS &aDims)
void SetViaDiameter(int aDiameter)
const DP_DIMENSIONS & Dimensions() const
DIFF_PAIR(const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
bool BuildInitial(const DP_GATEWAY &aEntry, const DP_GATEWAY &aTarget, bool aPrefDiagonal, bool aFitVias, float &aBestCouplingRatio, float &aAspectRatio)
void updateLine(LINE &aLine, const SHAPE_LINE_CHAIN &aShape, NET_HANDLE aNet, const VIA &aVia)
int GuessMostLikelyGap() const
double TotalLength() const
void SetViaDrill(int aDrill)
virtual void ClearLinks() override
Return the number of segments that were assembled together to form this line.
void SetShape(const DIFF_PAIR &aPair)
void SetShape(const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, bool aSwapLanes=false)
DIFF_PAIR(const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
bool EndsWithVias() const
DIFF_PAIR(const LINE &aLineP, const LINE &aLineN, const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
DIFF_PAIR & operator=(const DIFF_PAIR &aOther)
DIFF_PAIR * Clone() const override
Return a deep copy of the item.
std::optional< DP_PRIMITIVE_PAIR > BuildMidpairIntersection(PNS::SEGMENT *aStartSeg, const VECTOR2I &aP)
static bool ClassOf(const ITEM *aItem)
DIRECTION_45 getDirection(bool aIsP, bool aEnd) const
static constexpr int DP_PARALLELITY_THRESHOLD
void SetNets(NET_HANDLE aP, NET_HANDLE aN)
DIFF_PAIR(const DIFF_PAIR &aOther)
DIFF_PAIR & operator=(DIFF_PAIR &&aOther) noexcept
const SHAPE_LINE_CHAIN & CP() const
void CoupledSegmentPairs(COUPLED_SEGMENTS_VEC &aPairs, bool aUseGapConstraint=true, const std::optional< DP_GAP_CONSTRAINT > &aOverrideGapConstraint=std::optional< DP_GAP_CONSTRAINT >()) const
DIRECTION_45 DirN(bool aEnd) const
const DP_GAP_CONSTRAINT GapConstraint() const
void SetMinClearance(int aClearance)
const wxString Format() const
void SetGapConstraint(const DP_GAP_CONSTRAINT &aGapConstraint)
DP_DIMENSIONS(int aWidth=0, int aGap=0, int aViaGap=0, int aViaDiameter=0, int aMinClearance=0)
DP_GAP_CONSTRAINT m_gapConstraint
const DP_GAP_CONSTRAINT & GapConstraint() const
A set of gateways calculated for the cursor or starting/ending primitive pair.
void BuildForCursor(const VECTOR2I &aCursorPos, int aDirectionMask=-1)
DP_GATEWAYS(const DP_DIMENSIONS &aDims=DP_DIMENSIONS())
void BuildGeneric(const VECTOR2I &p0_p, const VECTOR2I &p0_n, int aColinearityThreshold=0, bool aBuildEntries=false, bool aViaMode=false)
void BuildFromPrimitivePair(const DP_PRIMITIVE_PAIR &aPair, bool aPreferDiagonal)
void FilterByOrientation(int aDirectionMask)
void buildEntries(DP_GATEWAY &aGw, const VECTOR2I &p0_p, const VECTOR2I &p0_n)
void addGateway(DP_GATEWAY &aGw, const wxString &name=wxT(""), bool aAddTurns=false)
std::vector< DP_GATEWAY > & Gateways()
bool checkDiagonalAlignment(const VECTOR2I &a, const VECTOR2I &b) const
void SetFitVias(bool aEnable)
void BuildOrthoProjections(DP_GATEWAYS &aEntries, const VECTOR2I &aCursorPos, int aOrthoScore)
void buildDpContinuation(const DP_PRIMITIVE_PAIR &aPair, bool aIsDiagonal)
void buildFromPads(const DP_PRIMITIVE_PAIR &aPair)
std::vector< DP_GATEWAY > m_gateways
const std::vector< DP_GATEWAY > & CGateways() const
void SetDimensions(const DP_DIMENSIONS &aDims)
std::vector< FIT_RESULT > FitGateways(DP_GATEWAYS &aEntry, DP_GATEWAYS &aTarget, bool aFitVias)
Define a "gateway" for routing a differential pair - e.g.
SHAPE_LINE_CHAIN m_entryP
bool HasPrimaryDirection() const
std::optional< DP_GATEWAY > AddTurns(bool aSide, bool a90Deg, bool aLeft, bool aWiggle)
const DP_DIMENSIONS & Dimensions() const
void SetName(const wxString &aName)
const SHAPE_LINE_CHAIN & EntryP() const
bool HasEntryLines() const
int AllowedAngles() const
DP_GATEWAY(const VECTOR2I &aAnchorP, const VECTOR2I &aAnchorN, bool aIsDiagonal, int aAllowedEntryAngles=DIRECTION_45::ANG_OBTUSE, int aPriority=0, int aDirectionMask=0, const wxString aName=wxT(""))
const VECTOR2I & AnchorN() const
void SetAnchors(const VECTOR2I &aP, const VECTOR2I &aN)
int PrimaryDirectionMask() const
SHAPE_LINE_CHAIN m_entryN
void AddPrimaryDirection(DIRECTION_45 aPrimDir)
DIRECTION_45 DirN() const
DIRECTION_45 DirP() const
void SetDimensions(const DP_DIMENSIONS &aDims)
void SetEntryLines(const SHAPE_LINE_CHAIN &aEntryP, const SHAPE_LINE_CHAIN &aEntryN)
const VECTOR2I & AnchorP() const
const SHAPE_LINE_CHAIN & EntryN() const
const DIFF_PAIR Entry() const
std::optional< DP_GATEWAY > Extend(int aLength)
void SetPrimaryDirection(DIRECTION_45 aPrimDir)
const wxString GetName() const
void SetDirections(DIRECTION_45 dP, DIRECTION_45 dN)
void SetPriority(int aPriority)
Store starting/ending primitives (pads, vias or segments) for a differential pair.
DIRECTION_45 DirN() const
const VECTOR2I & AnchorN() const
DIRECTION_45 FixedDirection() const
std::optional< DIRECTION_45 > m_fixedDirection
bool HasFixedDirection() const
static constexpr double DP_ASSUME_PRIMS_COLINEAR_FACTOR
const VECTOR2I & AnchorP() const
int GetMinDimension() const
void SetIsMidtrace(bool aMidtrace)
void SetFixedDirection(DIRECTION_45 aDir)
DIRECTION_45 anchorDirection(const ITEM *aItem, const VECTOR2I &aP) const
void CursorOrientation(const VECTOR2I &aCursorPos, VECTOR2I &aMidpoint, VECTOR2I &aDirection) const
bool HasDefinedGap() const
DP_PRIMITIVE_PAIR & operator=(const DP_PRIMITIVE_PAIR &aOther)
void SetName(const wxString &aName)
const wxString & GetName() const
void SetPrimitives(ITEM *aPrimP, ITEM *aPrimN)
std::optional< int > m_gap
void SetAnchors(const VECTOR2I &aAnchorP, const VECTOR2I &aAnchorN)
DIRECTION_45 DirP() const
virtual HOLE * Clone() const override
Return a deep copy of the item.
Base class for PNS router board items.
BOARD_ITEM * m_sourceItem
void SetSourceItem(BOARD_ITEM *aSourceItem)
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
void SetNet(NET_HANDLE aNet)
void SetLayer(int aLayer)
void SetParent(BOARD_ITEM *aParent)
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Return the shape of the line.
const SHAPE_LINE_CHAIN & CLine() const
void AppendVia(const VIA &aVia)
void SetWidth(int aWidth)
Return line width.
std::vector< LINKED_ITEM * > m_links
LINK_HOLDER(PnsKind aKind)
Add a reference to an item registered in a NODE that is a part of this line.
virtual HOLE * Hole() const override
static constexpr int ALL_LAYERS
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Push and Shove diff pair dimensions (gap) settings dialog.
MINOPTMAX< int > DP_GAP_CONSTRAINT
COUPLED_SEGMENTS(const SEG &aCoupledP, const SEG &aParentP, int aIndexP, const SEG &aCoupledN, const SEG &aParentN, int aIndexN)
VECTOR2< int32_t > VECTOR2I