Horizon
Loading...
Searching...
No Matches
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 <optional>
27
28//#include "pcb_track.h" // for VIATYPE_T
29#include "viatype.h"
30
31#include "wx_compat.h"
32
33
34class BOARD;
35class BOARD_DESIGN_SETTINGS;
36
37namespace PNS {
38
39class ITEM;
40
42{
43public:
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_viaDefinition( -1 ),
52 m_diffPairWidth( 125000 ),
53 m_diffPairGap( 180000 ),
54 m_diffPairViaGap( 180000 ),
55 m_diffPairViaGapSameAsTraceGap( true ),
56 m_holeToHole( 0 ),
57 m_widthSource()
58 {};
59
60 ~SIZES_SETTINGS() {};
61
62 void ClearLayerPairs();
63 void AddLayerPair( int aL1, int aL2 );
64
65 int MinClearance() const { return m_minClearance; }
66 void SetMinClearance( int aClearance ) { m_minClearance = aClearance; }
67
68 int TrackWidth() const { return m_trackWidth; }
69 void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
70
71 bool TrackWidthIsExplicit() const { return m_trackWidthIsExplicit; }
72 void SetTrackWidthIsExplicit( bool aIsExplicit ) { m_trackWidthIsExplicit = aIsExplicit; }
73
74 int DiffPairWidth() const { return m_diffPairWidth; }
75 int DiffPairGap() const { return m_diffPairGap; }
76
77 int DiffPairViaGap() const
78 {
79 return m_diffPairViaGapSameAsTraceGap ? m_diffPairGap : m_diffPairViaGap;
80 }
81
82 bool DiffPairViaGapSameAsTraceGap() const { return m_diffPairViaGapSameAsTraceGap; }
83
84 void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; }
85 void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; }
86 void SetDiffPairViaGapSameAsTraceGap ( bool aEnable ) { m_diffPairViaGapSameAsTraceGap = aEnable; }
87 void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; }
88
89 int ViaDiameter() const { return m_viaDiameter; }
90 void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
91
92 int ViaDrill() const { return m_viaDrill; }
93 void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
94
95 int ViaDefinition() const { return m_viaDefinition; }
96 void SetViaDefinition( int aDef ) { m_viaDefinition = aDef; }
97
98 std::optional<int> PairedLayer( int aLayerId )
99 {
100 if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
101 return std::optional<int>();
102
103 return m_layerPairs[aLayerId];
104 }
105
106 int GetLayerTop() const;
107 int GetLayerBottom() const;
108
109 void SetHoleToHole( int aHoleToHole ) { m_holeToHole = aHoleToHole; }
110 int GetHoleToHole() const { return m_holeToHole; }
111
112 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
113 VIATYPE ViaType() const { return m_viaType; }
114
115 wxString GetWidthSource() const { return m_widthSource; }
116 void SetWidthSource( const wxString& aSource ) { m_widthSource = aSource; }
117
118private:
119 int m_minClearance;
120 int m_trackWidth;
121 bool m_trackWidthIsExplicit;
122
123 VIATYPE m_viaType;
124 int m_viaDiameter;
125 int m_viaDrill;
126 int m_viaDefinition;
127
128 int m_diffPairWidth;
129 int m_diffPairGap;
130 int m_diffPairViaGap;
131 bool m_diffPairViaGapSameAsTraceGap;
132
133 int m_holeToHole;
134
135 std::map<int, int> m_layerPairs;
136
137 wxString m_widthSource;
138};
139
140}
141
142#endif // __PNS_SIZES_SETTINGS_H
Definition pns_sizes_settings.h:42
Definition wx_compat.h:13