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 "../class_track.h" // for VIATYPE_T
29
30class BOARD;
31class BOARD_DESIGN_SETTINGS;
32
33namespace PNS {
34
35class ITEM;
36
38
39public:
41 m_trackWidth( 155000 ),
42 m_diffPairWidth( 125000 ),
43 m_diffPairGap( 180000 ),
44 m_diffPairViaGap( 180000 ),
45 m_viaDiameter( 600000 ),
46 m_viaDrill( 250000 ),
47 m_diffPairViaGapSameAsTraceGap( true ),
48 m_widthFromRules( false),
49 m_viaType( VIA_THROUGH )
50 {};
51
52 ~SIZES_SETTINGS() {};
53
54 void ClearLayerPairs();
55 void AddLayerPair( int aL1, int aL2 );
56
57 int TrackWidth() const { return m_trackWidth; }
58 void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
59
60 int DiffPairWidth() const { return m_diffPairWidth; }
61 int DiffPairGap() const { return m_diffPairGap; }
62
63 int DiffPairViaGap() const {
64 if( m_diffPairViaGapSameAsTraceGap )
65 return m_diffPairGap;
66 else
67 return m_diffPairViaGap;
68 }
69
70 bool DiffPairViaGapSameAsTraceGap() const { return m_diffPairViaGapSameAsTraceGap; }
71 bool WidthFromRules() const { return m_widthFromRules; }
72
73 void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; }
74 void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; }
75 void SetDiffPairViaGapSameAsTraceGap ( bool aEnable ) { m_diffPairViaGapSameAsTraceGap = aEnable; }
76 void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; }
77
78 void SetWidthFromRules( int aEnable ) { m_widthFromRules = aEnable; }
79
80 int ViaDiameter() const { return m_viaDiameter; }
81 void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
82
83 int ViaDrill() const { return m_viaDrill; }
84 void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
85
86 OPT<int> PairedLayer( int aLayerId )
87 {
88 if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
89 return OPT<int>();
90
91 return m_layerPairs[aLayerId];
92 }
93
94 int GetLayerTop() const;
95 int GetLayerBottom() const;
96
97 void SetViaType( VIATYPE_T aViaType ) { m_viaType = aViaType; }
98 VIATYPE_T ViaType() const { return m_viaType; }
99
100private:
101
102 int inheritTrackWidth( ITEM* aItem );
103
104 int m_trackWidth;
105 int m_diffPairWidth;
106 int m_diffPairGap;
107 int m_diffPairViaGap;
108 int m_viaDiameter;
109 int m_viaDrill;
110
111 bool m_diffPairViaGapSameAsTraceGap;
112 bool m_widthFromRules;
113
114 VIATYPE_T m_viaType;
115
116 std::map<int, int> m_layerPairs;
117};
118
119}
120
121#endif // __PNS_SIZES_SETTINGS_H
Class ITEM.
Definition: pns_item.h:55
Definition: pns_sizes_settings.h:37