Horizon
pns_sizes_settings.h
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2014 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __PNS_SIZES_SETTINGS_H
23 #define __PNS_SIZES_SETTINGS_H
24 
25 #include <map>
26 #include <core/optional.h>
27 
28 //#include "pcb_track.h" // for VIATYPE_T
29 #include "viatype.h"
30 
31 #include "wx_compat.h"
32 
33 
34 class BOARD;
35 class BOARD_DESIGN_SETTINGS;
36 
37 namespace PNS {
38 
39 class ITEM;
40 
42 {
43 public:
44  SIZES_SETTINGS() :
45  m_minClearance( 0 ),
46  m_trackWidth( 155000 ),
47  m_trackWidthIsExplicit( true ),
48  m_viaType( VIATYPE::THROUGH ),
49  m_viaDiameter( 600000 ),
50  m_viaDrill( 250000 ),
51  m_diffPairWidth( 125000 ),
52  m_diffPairGap( 180000 ),
53  m_diffPairViaGap( 180000 ),
54  m_diffPairViaGapSameAsTraceGap( true ),
55  m_holeToHole( 0 ),
56  m_widthSource()
57  {};
58 
59  ~SIZES_SETTINGS() {};
60 
61  void ClearLayerPairs();
62  void AddLayerPair( int aL1, int aL2 );
63 
64  int MinClearance() const { return m_minClearance; }
65  void SetMinClearance( int aClearance ) { m_minClearance = aClearance; }
66 
67  int TrackWidth() const { return m_trackWidth; }
68  void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
69 
70  bool TrackWidthIsExplicit() const { return m_trackWidthIsExplicit; }
71  void SetTrackWidthIsExplicit( bool aIsExplicit ) { m_trackWidthIsExplicit = aIsExplicit; }
72 
73  int DiffPairWidth() const { return m_diffPairWidth; }
74  int DiffPairGap() const { return m_diffPairGap; }
75 
76  int DiffPairViaGap() const
77  {
78  return m_diffPairViaGapSameAsTraceGap ? m_diffPairGap : m_diffPairViaGap;
79  }
80 
81  bool DiffPairViaGapSameAsTraceGap() const { return m_diffPairViaGapSameAsTraceGap; }
82 
83  void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; }
84  void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; }
85  void SetDiffPairViaGapSameAsTraceGap ( bool aEnable ) { m_diffPairViaGapSameAsTraceGap = aEnable; }
86  void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; }
87 
88  int ViaDiameter() const { return m_viaDiameter; }
89  void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
90 
91  int ViaDrill() const { return m_viaDrill; }
92  void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
93 
94  OPT<int> PairedLayer( int aLayerId )
95  {
96  if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
97  return OPT<int>();
98 
99  return m_layerPairs[aLayerId];
100  }
101 
102  int GetLayerTop() const;
103  int GetLayerBottom() const;
104 
105  void SetHoleToHole( int aHoleToHole ) { m_holeToHole = aHoleToHole; }
106  int GetHoleToHole() const { return m_holeToHole; }
107 
108  void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
109  VIATYPE ViaType() const { return m_viaType; }
110 
111  wxString GetWidthSource() const { return m_widthSource; }
112  void SetWidthSource( const wxString& aSource ) { m_widthSource = aSource; }
113 
114 private:
115  int m_minClearance;
116  int m_trackWidth;
117  bool m_trackWidthIsExplicit;
118 
119  VIATYPE m_viaType;
120  int m_viaDiameter;
121  int m_viaDrill;
122 
123  int m_diffPairWidth;
124  int m_diffPairGap;
125  int m_diffPairViaGap;
126  bool m_diffPairViaGapSameAsTraceGap;
127 
128  int m_holeToHole;
129 
130  std::map<int, int> m_layerPairs;
131 
132  wxString m_widthSource;
133 };
134 
135 }
136 
137 #endif // __PNS_SIZES_SETTINGS_H
Definition: pns_sizes_settings.h:42
Definition: wx_compat.h:13