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 144 of file pns_sizes_settings.cpp.

References m_layerPairs, max, and min.

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

145 {
146  int top = std::min( aL1, aL2 );
147  int bottom = std::max( aL1, aL2 );
148 
149  m_layerPairs[bottom] = top;
150  m_layerPairs[top] = bottom;
151 }
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 138 of file pns_sizes_settings.cpp.

References m_layerPairs.

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

139 {
140  m_layerPairs.clear();
141 }
std::map< int, int > m_layerPairs
int PNS::SIZES_SETTINGS::DiffPairViaGap ( ) const
inline
bool PNS::SIZES_SETTINGS::DiffPairViaGapSameAsTraceGap ( ) const
inline
int PNS::SIZES_SETTINGS::DiffPairWidth ( ) const
inline
int PNS::SIZES_SETTINGS::GetLayerBottom ( ) const

Definition at line 171 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().

172 {
173  if( m_layerPairs.empty() )
174  return B_Cu;
175  else
176  return m_layerPairs.begin()->second;
177 }
std::map< int, int > m_layerPairs
int PNS::SIZES_SETTINGS::GetLayerTop ( ) const

Definition at line 162 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().

163 {
164  if( m_layerPairs.empty() )
165  return F_Cu;
166  else
167  return m_layerPairs.begin()->first;
168 }
std::map< int, int > m_layerPairs
void PNS::SIZES_SETTINGS::ImportCurrent ( BOARD_DESIGN_SETTINGS aSettings)
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::GetDefault(), BOARD::GetDesignSettings(), inheritTrackWidth(), m_diffPairGap, 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::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  // Set the differential pair width/gap using netclass if selected
128  if( ( bds.UseNetClassTrack() && netClass != NULL ) )
129  {
130  m_diffPairWidth = netClass->GetDiffPairWidth();
131  m_diffPairGap = netClass->GetDiffPairGap();
132  }
133 
134  m_layerPairs.clear();
135 }
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:144
NETCLASSPTR GetDefault() const
Function GetDefault.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:131
int GetCurrentViaSize() const
Function GetCurrentViaSize.
bool m_UseConnectedTrackWidth
if true, when creating a new track starting on an existing track, use this track width ...
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:535
int inheritTrackWidth(ITEM *aItem)
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
std::map< int, int > m_layerPairs
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.
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
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

Definition at line 105 of file pns_sizes_settings.h.

Referenced by DiffPairGap(), DiffPairViaGap(), Init(), and SetDiffPairGap().

int PNS::SIZES_SETTINGS::m_diffPairViaGap
private

Definition at line 106 of file pns_sizes_settings.h.

Referenced by DiffPairViaGap(), 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(), 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: