KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drill_span.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
24
25#ifndef DRILL_SPAN_H
26#define DRILL_SPAN_H
27
28#include <utility>
29
30#include <layer_ids.h>
31
32
33// hole attribute, mainly to identify vias and pads and add this info as comment
34// in NC drill files
36{
37 HOLE_UNKNOWN, // uninitialized type
38 HOLE_VIA_THROUGH, // a via hole (always plated) from top to bottom
39 HOLE_VIA_BURIED, // a via hole (always plated) not through hole
40 HOLE_VIA_BACKDRILL, // a via hole created by a backdrill operation
41 HOLE_PAD, // a plated or not plated pad hole
42 HOLE_PAD_CASTELLATED, // a plated castelleted pad hole
43 HOLE_PAD_PRESSFIT, // a plated press-fit pad hole
44 HOLE_MECHANICAL // a mechanical pad (provided, not used)
45};
46
47
48typedef std::pair<PCB_LAYER_ID, PCB_LAYER_ID> DRILL_LAYER_PAIR;
49
50
52{
54 {
57 m_IsBackdrill = false;
58 m_IsNonPlatedFile = false;
59 }
60
61 DRILL_SPAN( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, bool aIsBackdrill,
62 bool aIsNonPlated )
63 {
64 m_StartLayer = aStartLayer;
65 m_EndLayer = aEndLayer;
66 m_IsBackdrill = aIsBackdrill;
67 m_IsNonPlatedFile = aIsNonPlated;
68 }
69
71 {
72 // B_Cu (id=2) is numerically less than inner layers (id>=4), but is physically
73 // at the bottom of the stack. Use IsCopperLayerLowerThan for correct ordering.
75 }
76
81
83 {
84 return m_StartLayer;
85 }
86
88 {
89 return m_EndLayer;
90 }
91
93 {
95 }
96
97 bool operator==( const DRILL_SPAN& aOther ) const
98 {
99 // Compares the stored layers, not Top/Bottom, so a span and its reverse stay distinct
100 return m_StartLayer == aOther.m_StartLayer && m_EndLayer == aOther.m_EndLayer
101 && m_IsBackdrill == aOther.m_IsBackdrill
103 }
104
105 bool operator!=( const DRILL_SPAN& aOther ) const { return !( *this == aOther ); }
106
107 bool operator<( const DRILL_SPAN& aOther ) const
108 {
109 if( TopLayer() != aOther.TopLayer() )
110 return TopLayer() < aOther.TopLayer();
111
112 if( BottomLayer() != aOther.BottomLayer() )
113 return BottomLayer() < aOther.BottomLayer();
114
115 if( m_IsBackdrill != aOther.m_IsBackdrill )
116 return m_IsBackdrill && !aOther.m_IsBackdrill;
117
119 return m_IsNonPlatedFile && !aOther.m_IsNonPlatedFile;
120
121 if( m_StartLayer != aOther.m_StartLayer )
122 return m_StartLayer < aOther.m_StartLayer;
123
124 return m_EndLayer < aOther.m_EndLayer;
125 }
126
131};
132
133#endif // DRILL_SPAN_H
HOLE_ATTRIBUTE
Definition drill_span.h:36
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
Definition drill_span.h:48
bool IsCopperLayerLowerThan(PCB_LAYER_ID aLayerA, PCB_LAYER_ID aLayerB)
Return true if copper aLayerA is placed lower than aLayerB, false otherwise.
Definition layer_ids.h:850
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ B_Cu
Definition layer_ids.h:61
@ F_Cu
Definition layer_ids.h:60
DRILL_LAYER_PAIR Pair() const
Definition drill_span.h:92
DRILL_SPAN(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, bool aIsBackdrill, bool aIsNonPlated)
Definition drill_span.h:61
PCB_LAYER_ID DrillEndLayer() const
Definition drill_span.h:87
bool operator!=(const DRILL_SPAN &aOther) const
Definition drill_span.h:105
PCB_LAYER_ID m_EndLayer
Definition drill_span.h:128
PCB_LAYER_ID TopLayer() const
Definition drill_span.h:70
PCB_LAYER_ID DrillStartLayer() const
Definition drill_span.h:82
PCB_LAYER_ID BottomLayer() const
Definition drill_span.h:77
PCB_LAYER_ID m_StartLayer
Definition drill_span.h:127
bool m_IsNonPlatedFile
Definition drill_span.h:130
bool operator==(const DRILL_SPAN &aOther) const
Definition drill_span.h:97
bool m_IsBackdrill
Definition drill_span.h:129
bool operator<(const DRILL_SPAN &aOther) const
Definition drill_span.h:107