KiCad PCB EDA Suite
PNS::SIZES_SETTINGS Class Reference

#include <pns_sizes_settings.h>

Public Member Functions

 SIZES_SETTINGS ()
 
 ~SIZES_SETTINGS ()
 
void Init (BOARD *aBoard, ITEM *aStartItem=NULL, int aNet=-1)
 
void ImportCurrent (BOARD_DESIGN_SETTINGS &aSettings)
 
void ClearLayerPairs ()
 
void AddLayerPair (int aL1, int aL2)
 
int TrackWidth () const
 
void SetTrackWidth (int aWidth)
 
int DiffPairWidth () const
 
int DiffPairGap () const
 
int DiffPairViaGap () const
 
bool DiffPairViaGapSameAsTraceGap () const
 
void SetDiffPairWidth (int aWidth)
 
void SetDiffPairGap (int aGap)
 
void SetDiffPairViaGapSameAsTraceGap (bool aEnable)
 
void SetDiffPairViaGap (int aGap)
 
int ViaDiameter () const
 
void SetViaDiameter (int aDiameter)
 
int ViaDrill () const
 
void SetViaDrill (int aDrill)
 
OPT< int > PairedLayer (int aLayerId)
 
int GetLayerTop () const
 
int GetLayerBottom () const
 
void SetViaType (VIATYPE_T aViaType)
 
VIATYPE_T ViaType () const
 

Private Member Functions

int inheritTrackWidth (ITEM *aItem)
 

Private Attributes

int m_trackWidth
 
int m_diffPairWidth
 
int m_diffPairGap
 
int m_diffPairViaGap
 
int m_viaDiameter
 
int m_viaDrill
 
bool m_diffPairViaGapSameAsTraceGap
 
VIATYPE_T m_viaType
 
std::map< int, int > m_layerPairs
 

Detailed Description

Definition at line 37 of file pns_sizes_settings.h.

Constructor & Destructor Documentation

◆ SIZES_SETTINGS()

PNS::SIZES_SETTINGS::SIZES_SETTINGS ( )
inline

Definition at line 40 of file pns_sizes_settings.h.

◆ ~SIZES_SETTINGS()

PNS::SIZES_SETTINGS::~SIZES_SETTINGS ( )
inline

Definition at line 51 of file pns_sizes_settings.h.

51 {};

Member Function Documentation

◆ AddLayerPair()

void PNS::SIZES_SETTINGS::AddLayerPair ( int  aL1,
int  aL2 
)

Definition at line 156 of file pns_sizes_settings.cpp.

157 {
158  int top = std::min( aL1, aL2 );
159  int bottom = std::max( aL1, aL2 );
160 
161  m_layerPairs[bottom] = top;
162  m_layerPairs[top] = bottom;
163 }
std::map< int, int > m_layerPairs
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85

References m_layerPairs, max, and min.

Referenced by ROUTER_TOOL::onViaCommand().

◆ ClearLayerPairs()

void PNS::SIZES_SETTINGS::ClearLayerPairs ( )

Definition at line 150 of file pns_sizes_settings.cpp.

151 {
152  m_layerPairs.clear();
153 }
std::map< int, int > m_layerPairs

References m_layerPairs.

Referenced by ROUTER_TOOL::onViaCommand().

◆ DiffPairGap()

◆ DiffPairViaGap()

◆ DiffPairViaGapSameAsTraceGap()

bool PNS::SIZES_SETTINGS::DiffPairViaGapSameAsTraceGap ( ) const
inline

◆ DiffPairWidth()

◆ GetLayerBottom()

int PNS::SIZES_SETTINGS::GetLayerBottom ( ) const

Definition at line 187 of file pns_sizes_settings.cpp.

188 {
189  if( m_layerPairs.empty() )
190  return B_Cu;
191  else
192  return m_layerPairs.begin()->second;
193 }
std::map< int, int > m_layerPairs

References B_Cu, and m_layerPairs.

Referenced by PNS::DIFF_PAIR_PLACER::makeVia(), and PNS::LINE_PLACER::makeVia().

◆ GetLayerTop()

int PNS::SIZES_SETTINGS::GetLayerTop ( ) const

Definition at line 178 of file pns_sizes_settings.cpp.

179 {
180  if( m_layerPairs.empty() )
181  return F_Cu;
182  else
183  return m_layerPairs.begin()->first;
184 }
std::map< int, int > m_layerPairs

References F_Cu, and m_layerPairs.

Referenced by PNS::DIFF_PAIR_PLACER::makeVia(), PNS::LINE_PLACER::makeVia(), and ROUTER_TOOL::switchLayerOnViaPlacement().

◆ ImportCurrent()

void PNS::SIZES_SETTINGS::ImportCurrent ( BOARD_DESIGN_SETTINGS aSettings)

Definition at line 166 of file pns_sizes_settings.cpp.

167 {
168  m_trackWidth = aSettings.GetCurrentTrackWidth();
169  m_viaDiameter = aSettings.GetCurrentViaSize();
170  m_viaDrill = aSettings.GetCurrentViaDrill();
171 
173  m_diffPairGap = aSettings.GetCurrentDiffPairGap();
175 }
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
int GetCurrentDiffPairGap() const
Function GetCurrentDiffPairGap.
int GetCurrentDiffPairWidth() const
Function GetCurrentDiffPairWidth.
int GetCurrentViaSize() const
Function GetCurrentViaSize.
int GetCurrentDiffPairViaGap() const
Function GetCurrentDiffPairViaGap.

References BOARD_DESIGN_SETTINGS::GetCurrentDiffPairGap(), BOARD_DESIGN_SETTINGS::GetCurrentDiffPairViaGap(), BOARD_DESIGN_SETTINGS::GetCurrentDiffPairWidth(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), m_diffPairGap, m_diffPairViaGap, m_diffPairWidth, m_trackWidth, m_viaDiameter, and m_viaDrill.

Referenced by ROUTER_TOOL::onTrackViaSizeChanged().

◆ inheritTrackWidth()

int PNS::SIZES_SETTINGS::inheritTrackWidth ( ITEM aItem)
private

Definition at line 32 of file pns_sizes_settings.cpp.

33 {
34  VECTOR2I p;
35 
36  assert( aItem->Owner() != NULL );
37 
38  switch( aItem->Kind() )
39  {
40  case ITEM::VIA_T:
41  p = static_cast<VIA*>( aItem )->Pos();
42  break;
43 
44  case ITEM::SOLID_T:
45  p = static_cast<SOLID*>( aItem )->Pos();
46  break;
47 
48  case ITEM::SEGMENT_T:
49  return static_cast<SEGMENT*>( aItem )->Width();
50 
51  default:
52  return 0;
53  }
54 
55  JOINT* jt = static_cast<NODE*>( aItem->Owner() )->FindJoint( p, aItem );
56 
57  assert( jt != NULL );
58 
59  int mval = INT_MAX;
60 
61 
62  ITEM_SET linkedSegs = jt->Links();
63  linkedSegs.ExcludeItem( aItem ).FilterKinds( ITEM::SEGMENT_T );
64 
65  for( ITEM* item : linkedSegs.Items() )
66  {
67  int w = static_cast<SEGMENT*>( item )->Width();
68  mval = std::min( w, mval );
69  }
70 
71  return ( mval == INT_MAX ? 0 : mval );
72 }
#define min(a, b)
Definition: auxiliary.h:85

References PNS::ITEM_SET::ExcludeItem(), PNS::ITEM_SET::FilterKinds(), PNS::ITEM_SET::Items(), PNS::ITEM::Kind(), PNS::JOINT::Links(), min, PNS::ITEM::Owner(), PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by Init().

◆ Init()

void PNS::SIZES_SETTINGS::Init ( BOARD aBoard,
ITEM aStartItem = NULL,
int  aNet = -1 
)

Definition at line 75 of file pns_sizes_settings.cpp.

76 {
78 
79  NETCLASSPTR netClass;
80  int net = aNet;
81 
82  if( aStartItem )
83  net = aStartItem->Net();
84 
85  if( net >= 0 )
86  {
87  NETINFO_ITEM* ni = aBoard->FindNet( net );
88 
89  if( ni )
90  {
91  wxString netClassName = ni->GetClassName();
92  netClass = bds.m_NetClasses.Find( netClassName );
93  }
94  }
95 
96  if( !netClass )
97  netClass = bds.GetDefault();
98 
99  m_trackWidth = 0;
100 
101  if( bds.m_UseConnectedTrackWidth && aStartItem != NULL )
102  {
103  m_trackWidth = inheritTrackWidth( aStartItem );
104  }
105 
106  if( !m_trackWidth && ( bds.UseNetClassTrack() && netClass != NULL ) ) // netclass value
107  {
108  m_trackWidth = netClass->GetTrackWidth();
109  }
110 
111  if( !m_trackWidth )
112  {
114  }
115 
116  if( bds.UseNetClassVia() && netClass != NULL ) // netclass value
117  {
118  m_viaDiameter = netClass->GetViaDiameter();
119  m_viaDrill = netClass->GetViaDrill();
120  }
121  else
122  {
125  }
126 
127  if( bds.UseNetClassDiffPair() && netClass != NULL )
128  {
129  m_diffPairWidth = netClass->GetDiffPairWidth();
130  m_diffPairGap = netClass->GetDiffPairGap();
131  m_diffPairViaGap = netClass->GetDiffPairViaGap();
132  }
133  else if( bds.UseCustomDiffPairDimensions() )
134  {
138  }
139  else
140  {
144  }
145 
146  m_layerPairs.clear();
147 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
bool UseNetClassTrack() const
Function UseNetClassTrack returns true if netclass values should be used to obtain appropriate track ...
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:141
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
bool UseNetClassDiffPair() const
Function UseNetClassDiffPair returns true if netclass values should be used to obtain appropriate dif...
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
void UseCustomDiffPairDimensions(bool aEnabled)
Function UseCustomDiffPairDimensions Enables/disables custom differential pair dimensions.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
int GetCustomDiffPairWidth()
Function GetCustomDiffPairWidth.
bool UseNetClassVia() const
Function UseNetClassVia returns true if netclass values should be used to obtain appropriate via size...
int inheritTrackWidth(ITEM *aItem)
int GetCurrentViaSize() const
Function GetCurrentViaSize.
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
std::map< int, int > m_layerPairs
NETCLASSPTR GetDefault() const
Function GetDefault.
int GetCustomDiffPairViaGap()
Function GetCustomDiffPairViaGap.
unsigned GetDiffPairIndex() const
Function GetDiffPairIndex.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:131
int GetCustomDiffPairGap()
Function GetCustomDiffPairGap.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References NETCLASSES::Find(), BOARD::FindNet(), NETINFO_ITEM::GetClassName(), BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD_DESIGN_SETTINGS::GetCustomDiffPairGap(), BOARD_DESIGN_SETTINGS::GetCustomDiffPairViaGap(), BOARD_DESIGN_SETTINGS::GetCustomDiffPairWidth(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetDiffPairIndex(), inheritTrackWidth(), BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, m_diffPairGap, m_diffPairViaGap, m_diffPairWidth, m_layerPairs, BOARD_DESIGN_SETTINGS::m_NetClasses, m_trackWidth, BOARD_DESIGN_SETTINGS::m_UseConnectedTrackWidth, m_viaDiameter, m_viaDrill, PNS::ITEM::Net(), BOARD_DESIGN_SETTINGS::UseCustomDiffPairDimensions(), BOARD_DESIGN_SETTINGS::UseNetClassDiffPair(), BOARD_DESIGN_SETTINGS::UseNetClassTrack(), and BOARD_DESIGN_SETTINGS::UseNetClassVia().

Referenced by ROUTER_TOOL::prepareInteractive().

◆ PairedLayer()

OPT<int> PNS::SIZES_SETTINGS::PairedLayer ( int  aLayerId)
inline

Definition at line 85 of file pns_sizes_settings.h.

86  {
87  if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
88  return OPT<int>();
89 
90  return m_layerPairs[aLayerId];
91  }
std::map< int, int > m_layerPairs
boost::optional< T > OPT
Definition: optional.h:7

References m_layerPairs.

Referenced by ROUTER_TOOL::switchLayerOnViaPlacement().

◆ SetDiffPairGap()

void PNS::SIZES_SETTINGS::SetDiffPairGap ( int  aGap)
inline

◆ SetDiffPairViaGap()

void PNS::SIZES_SETTINGS::SetDiffPairViaGap ( int  aGap)
inline

◆ SetDiffPairViaGapSameAsTraceGap()

void PNS::SIZES_SETTINGS::SetDiffPairViaGapSameAsTraceGap ( bool  aEnable)
inline

◆ SetDiffPairWidth()

void PNS::SIZES_SETTINGS::SetDiffPairWidth ( int  aWidth)
inline

◆ SetTrackWidth()

void PNS::SIZES_SETTINGS::SetTrackWidth ( int  aWidth)
inline

Definition at line 60 of file pns_sizes_settings.h.

60 { m_trackWidth = aWidth; }

References m_trackWidth.

◆ SetViaDiameter()

void PNS::SIZES_SETTINGS::SetViaDiameter ( int  aDiameter)
inline

Definition at line 80 of file pns_sizes_settings.h.

80 { m_viaDiameter = aDiameter; }

References m_viaDiameter.

Referenced by ROUTER_TOOL::onViaCommand().

◆ SetViaDrill()

void PNS::SIZES_SETTINGS::SetViaDrill ( int  aDrill)
inline

Definition at line 83 of file pns_sizes_settings.h.

83 { m_viaDrill = aDrill; }

References m_viaDrill.

Referenced by ROUTER_TOOL::onViaCommand().

◆ SetViaType()

void PNS::SIZES_SETTINGS::SetViaType ( VIATYPE_T  aViaType)
inline

Definition at line 96 of file pns_sizes_settings.h.

96 { m_viaType = aViaType; }

References m_viaType.

Referenced by ROUTER_TOOL::onViaCommand().

◆ TrackWidth()

int PNS::SIZES_SETTINGS::TrackWidth ( ) const
inline

Definition at line 59 of file pns_sizes_settings.h.

59 { return m_trackWidth; }

References m_trackWidth.

Referenced by PNS::LINE_PLACER::initPlacement().

◆ ViaDiameter()

int PNS::SIZES_SETTINGS::ViaDiameter ( ) const
inline

◆ ViaDrill()

int PNS::SIZES_SETTINGS::ViaDrill ( ) const
inline

Definition at line 82 of file pns_sizes_settings.h.

82 { return m_viaDrill; }

References m_viaDrill.

Referenced by PNS::DIFF_PAIR_PLACER::makeVia(), and PNS::LINE_PLACER::makeVia().

◆ ViaType()

VIATYPE_T PNS::SIZES_SETTINGS::ViaType ( ) const
inline

Definition at line 97 of file pns_sizes_settings.h.

97 { return m_viaType; }

References m_viaType.

Referenced by PNS::DIFF_PAIR_PLACER::makeVia(), and PNS::LINE_PLACER::makeVia().

Member Data Documentation

◆ m_diffPairGap

int PNS::SIZES_SETTINGS::m_diffPairGap
private

◆ m_diffPairViaGap

int PNS::SIZES_SETTINGS::m_diffPairViaGap
private

Definition at line 106 of file pns_sizes_settings.h.

Referenced by DiffPairViaGap(), ImportCurrent(), Init(), and SetDiffPairViaGap().

◆ m_diffPairViaGapSameAsTraceGap

bool PNS::SIZES_SETTINGS::m_diffPairViaGapSameAsTraceGap
private

◆ m_diffPairWidth

int PNS::SIZES_SETTINGS::m_diffPairWidth
private

Definition at line 104 of file pns_sizes_settings.h.

Referenced by DiffPairWidth(), ImportCurrent(), Init(), and SetDiffPairWidth().

◆ m_layerPairs

std::map<int, int> PNS::SIZES_SETTINGS::m_layerPairs
private

◆ m_trackWidth

int PNS::SIZES_SETTINGS::m_trackWidth
private

Definition at line 103 of file pns_sizes_settings.h.

Referenced by ImportCurrent(), Init(), SetTrackWidth(), and TrackWidth().

◆ m_viaDiameter

int PNS::SIZES_SETTINGS::m_viaDiameter
private

Definition at line 107 of file pns_sizes_settings.h.

Referenced by ImportCurrent(), Init(), SetViaDiameter(), and ViaDiameter().

◆ m_viaDrill

int PNS::SIZES_SETTINGS::m_viaDrill
private

Definition at line 108 of file pns_sizes_settings.h.

Referenced by ImportCurrent(), Init(), SetViaDrill(), and ViaDrill().

◆ m_viaType

VIATYPE_T PNS::SIZES_SETTINGS::m_viaType
private

Definition at line 112 of file pns_sizes_settings.h.

Referenced by SetViaType(), and ViaType().


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