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

PNS::SIZES_SETTINGS::SIZES_SETTINGS ( )
inline

Definition at line 40 of file pns_sizes_settings.h.

PNS::SIZES_SETTINGS::~SIZES_SETTINGS ( )
inline

Definition at line 51 of file pns_sizes_settings.h.

References AddLayerPair(), ClearLayerPairs(), ImportCurrent(), and Init().

51 {};

Member Function Documentation

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

Definition at line 156 of file pns_sizes_settings.cpp.

References m_layerPairs, max, and min.

Referenced by ROUTER_TOOL::onViaCommand(), and ~SIZES_SETTINGS().

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
void PNS::SIZES_SETTINGS::ClearLayerPairs ( )

Definition at line 150 of file pns_sizes_settings.cpp.

References m_layerPairs.

Referenced by ROUTER_TOOL::onViaCommand(), and ~SIZES_SETTINGS().

151 {
152  m_layerPairs.clear();
153 }
std::map< int, int > m_layerPairs
bool PNS::SIZES_SETTINGS::DiffPairViaGapSameAsTraceGap ( ) const
inline
int PNS::SIZES_SETTINGS::GetLayerBottom ( ) const

Definition at line 187 of file pns_sizes_settings.cpp.

References B_Cu, and m_layerPairs.

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

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
int PNS::SIZES_SETTINGS::GetLayerTop ( ) const

Definition at line 178 of file pns_sizes_settings.cpp.

References F_Cu, and m_layerPairs.

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

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
void PNS::SIZES_SETTINGS::ImportCurrent ( BOARD_DESIGN_SETTINGS aSettings)

Definition at line 166 of file pns_sizes_settings.cpp.

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(), and ~SIZES_SETTINGS().

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

Definition at line 32 of file pns_sizes_settings.cpp.

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(), and ViaType().

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
void PNS::SIZES_SETTINGS::Init ( BOARD aBoard,
ITEM aStartItem = NULL,
int  aNet = -1 
)

Definition at line 75 of file pns_sizes_settings.cpp.

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(), and ~SIZES_SETTINGS().

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 }
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:146
NETCLASSPTR GetDefault() const
Function GetDefault.
bool UseNetClassDiffPair() const
Function UseNetClassDiffPair returns true if netclass values should be used to obtain appropriate dif...
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:135
void UseCustomDiffPairDimensions(bool aEnabled)
Function UseCustomDiffPairDimensions Enables/disables custom differential pair dimensions.
int GetCurrentViaSize() const
Function GetCurrentViaSize.
int GetCustomDiffPairWidth()
Function GetCustomDiffPairWidth.
bool UseNetClassTrack() const
Function UseNetClassTrack returns true if netclass values should be used to obtain appropriate track ...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
int inheritTrackWidth(ITEM *aItem)
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
std::map< int, int > m_layerPairs
unsigned GetDiffPairIndex() const
Function GetDiffPairIndex.
int GetCustomDiffPairViaGap()
Function GetCustomDiffPairViaGap.
bool UseNetClassVia() const
Function UseNetClassVia returns true if netclass values should be used to obtain appropriate via size...
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
int GetCustomDiffPairGap()
Function GetCustomDiffPairGap.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
OPT<int> PNS::SIZES_SETTINGS::PairedLayer ( int  aLayerId)
inline

Definition at line 85 of file pns_sizes_settings.h.

References GetLayerBottom(), GetLayerTop(), and m_layerPairs.

Referenced by ROUTER_TOOL::switchLayerOnViaPlacement().

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
void PNS::SIZES_SETTINGS::SetDiffPairGap ( int  aGap)
inline
void PNS::SIZES_SETTINGS::SetDiffPairViaGap ( int  aGap)
inline
void PNS::SIZES_SETTINGS::SetDiffPairViaGapSameAsTraceGap ( bool  aEnable)
inline
void PNS::SIZES_SETTINGS::SetDiffPairWidth ( int  aWidth)
inline
void PNS::SIZES_SETTINGS::SetTrackWidth ( int  aWidth)
inline

Definition at line 60 of file pns_sizes_settings.h.

References m_trackWidth.

60 { m_trackWidth = aWidth; }
void PNS::SIZES_SETTINGS::SetViaDiameter ( int  aDiameter)
inline

Definition at line 80 of file pns_sizes_settings.h.

References m_viaDiameter.

Referenced by ROUTER_TOOL::onViaCommand().

80 { m_viaDiameter = aDiameter; }
void PNS::SIZES_SETTINGS::SetViaDrill ( int  aDrill)
inline

Definition at line 83 of file pns_sizes_settings.h.

References m_viaDrill.

Referenced by ROUTER_TOOL::onViaCommand().

83 { m_viaDrill = aDrill; }
void PNS::SIZES_SETTINGS::SetViaType ( VIATYPE_T  aViaType)
inline

Definition at line 96 of file pns_sizes_settings.h.

References m_viaType.

Referenced by ROUTER_TOOL::onViaCommand().

96 { m_viaType = aViaType; }
int PNS::SIZES_SETTINGS::TrackWidth ( ) const
inline
int PNS::SIZES_SETTINGS::ViaDiameter ( ) const
inline
int PNS::SIZES_SETTINGS::ViaDrill ( ) const
inline

Definition at line 82 of file pns_sizes_settings.h.

References m_viaDrill.

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

82 { return m_viaDrill; }
VIATYPE_T PNS::SIZES_SETTINGS::ViaType ( ) const
inline

Definition at line 97 of file pns_sizes_settings.h.

References inheritTrackWidth(), and m_viaType.

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

97 { return m_viaType; }

Member Data Documentation

int PNS::SIZES_SETTINGS::m_diffPairGap
private
int PNS::SIZES_SETTINGS::m_diffPairViaGap
private

Definition at line 106 of file pns_sizes_settings.h.

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

bool PNS::SIZES_SETTINGS::m_diffPairViaGapSameAsTraceGap
private
int PNS::SIZES_SETTINGS::m_diffPairWidth
private

Definition at line 104 of file pns_sizes_settings.h.

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

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

Definition at line 103 of file pns_sizes_settings.h.

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

int PNS::SIZES_SETTINGS::m_viaDiameter
private

Definition at line 107 of file pns_sizes_settings.h.

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

int PNS::SIZES_SETTINGS::m_viaDrill
private

Definition at line 108 of file pns_sizes_settings.h.

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

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: