23 #ifndef __PNS_DIFF_PAIR_H 24 #define __PNS_DIFF_PAIR_H 28 #include <geometry/shape.h> 29 #include <geometry/shape_line_chain.h> 34 #include "ranged_num.h" 52 int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE,
54 : m_anchorP( aAnchorP ),
55 m_anchorN( aAnchorN ),
56 m_isDiagonal( aIsDiagonal ),
57 m_allowedEntryAngles( aAllowedEntryAngles ),
58 m_priority( aPriority )
60 m_hasEntryLines =
false;
77 const VECTOR2I& AnchorP()
const {
return m_anchorP; }
79 const VECTOR2I& AnchorN()
const {
return m_anchorN; }
99 void SetPriority(
int aPriority)
101 m_priority = aPriority;
108 m_hasEntryLines =
true;
117 bool HasEntryLines ()
const 119 return m_hasEntryLines;
124 bool m_hasEntryLines;
127 int m_allowedEntryAngles;
140 m_primP( NULL ), m_primN( NULL ) {};
150 const VECTOR2I& AnchorP()
const {
return m_anchorP; }
151 const VECTOR2I& AnchorN()
const {
return m_anchorN; }
155 ITEM* PrimP()
const {
return m_primP; }
156 ITEM* PrimN()
const {
return m_primN; }
158 bool Directional()
const;
168 printf(
"-- Prim-P %p anchor [%d, %d]\n", m_primP, m_anchorP.x, m_anchorP.y );
169 printf(
"-- Prim-N %p anchor [%d, %d]\n", m_primN, m_anchorN.x, m_anchorN.y );
190 m_gap( aGap ), m_viaGap( aGap )
197 void SetGap(
int aGap )
208 void SetFitVias(
bool aEnable,
int aDiameter = 0,
int aViaGap = -1 )
211 m_viaDiameter = aDiameter;
219 void BuildForCursor(
const VECTOR2I& aCursorPos );
220 void BuildOrthoProjections(
DP_GATEWAYS &aEntries,
const VECTOR2I& aCursorPos,
int aOrthoScore );
221 void BuildGeneric(
const VECTOR2I& p0_p,
const VECTOR2I& p0_n,
bool aBuildEntries =
false,
bool aViaMode =
false );
226 std::vector<DP_GATEWAY>& Gateways()
231 const std::vector<DP_GATEWAY>& CGateways()
const 236 void FilterByOrientation(
int aAngleMask,
DIRECTION_45 aRefOrientation );
255 std::vector<DP_GATEWAY> m_gateways;
270 const SEG& aCoupledN,
const SEG& aParentN,
int aIndexN ) :
271 coupledP( aCoupledP ),
272 coupledN( aCoupledN ),
287 typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
297 m_maxUncoupledLength = 0;
305 m_gapConstraint = aGap;
313 m_maxUncoupledLength = 0;
323 m_gapConstraint = aGap;
331 m_maxUncoupledLength = 0;
341 m_gapConstraint = aGap;
342 m_net_p = aLineP.
Net();
343 m_net_n = aLineN.
Net();
344 m_p = aLineP.
CLine();
345 m_n = aLineN.
CLine();
351 m_maxUncoupledLength = 0;
355 static inline bool ClassOf(
const ITEM* aItem )
357 return aItem && DIFF_PAIR_T == aItem->
Kind();
384 void SetNets(
int aP,
int aN )
390 void SetWidth(
int aWidth )
395 int Width()
const {
return m_width; }
397 void SetGap(
int aGap )
408 void AppendVias(
const VIA &aViaP,
const VIA& aViaN )
420 bool EndsWithVias()
const 437 if( !m_line_p.IsLinked() )
438 updateLine( m_line_p, m_p, m_net_p, m_via_p );
445 if( !m_line_n.IsLinked() )
446 updateLine( m_line_n, m_n, m_net_n, m_via_n );
453 double CoupledLength()
const;
454 double TotalLength()
const;
455 double CoupledLengthFactor()
const;
458 void CoupledSegmentPairs( COUPLED_SEGMENTS_VEC& aPairs )
const;
468 m_n.Append( aOther.m_n );
469 m_p.Append( aOther.m_p );
474 return ( m_n.SegmentCount() == 0 ) || ( m_p.SegmentCount() == 0 );
481 bool CheckConnectionAngle(
const DIFF_PAIR &aOther,
int allowedAngles )
const;
482 int CoupledLength(
const SEG& aP,
const SEG& aN )
const;
488 return m_gapConstraint;
500 aLine.AppendVia( aVia );
504 LINE m_line_p, m_line_n;
505 VIA m_via_p, m_via_n;
508 int m_net_p, m_net_n;
512 int m_maxUncoupledLength;
const SHAPE_LINE_CHAIN & CLine() const
Const accessor to the underlying shape
Definition: pns_line.h:123
Class ITEM.
Definition: pns_item.h:54
void SetLayer(int aLayer)
Function SetLayer()
Definition: pns_item.h:198
Definition: pns_line.h:60
void SetWidth(int aWidth)
Sets line width
Definition: pns_line.h:153
void SetNet(int aNet)
Function SetNet()
Definition: pns_item.h:168
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Assigns a shape to the line (a polyline/line chain)
Definition: pns_line.h:105
int Net() const
Function Net()
Definition: pns_item.h:178
Class DIRECTION_45.
Definition: direction45.h:33
int AllowedAngles() const
Function AllowedAngles()
Definition: pns_diff_pair.h:87
bool IsDiagonal() const
Function IsDiagonal()
Definition: pns_diff_pair.h:72
DIFF_PAIR * Clone() const override
Function Clone()
Definition: pns_diff_pair.h:360
Class DIFF_PAIR.
Definition: pns_diff_pair.h:265
Class DP_PRIMITIVE_PAIR.
Definition: pns_diff_pair.h:136
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:47
Definition: pns_diff_pair.h:268
PnsKind Kind() const
Function Kind()
Definition: pns_item.h:121
int Priority() const
Function Priority()
Definition: pns_diff_pair.h:94
Class DP_GATEWAYS.
Definition: pns_diff_pair.h:186
Definition: pns_algo_base.cpp:26
Class DP_GATEWAY.
Definition: pns_diff_pair.h:47