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 HOLE_PAD_BACKDRILL // a pad hole created by a backdrill operation
46};
47
48
49typedef std::pair<PCB_LAYER_ID, PCB_LAYER_ID> DRILL_LAYER_PAIR;
50
51
53{
55 {
58 m_IsBackdrill = false;
59 m_IsNonPlatedFile = false;
60 }
61
62 DRILL_SPAN( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, bool aIsBackdrill,
63 bool aIsNonPlated )
64 {
65 m_StartLayer = aStartLayer;
66 m_EndLayer = aEndLayer;
67 m_IsBackdrill = aIsBackdrill;
68 m_IsNonPlatedFile = aIsNonPlated;
69 }
70
72 {
73 // B_Cu (id=2) is numerically less than inner layers (id>=4), but is physically
74 // at the bottom of the stack. Use IsCopperLayerLowerThan for correct ordering.
76 }
77
82
84 {
85 return m_StartLayer;
86 }
87
89 {
90 return m_EndLayer;
91 }
92
94 {
96 }
97
98 bool operator==( const DRILL_SPAN& aOther ) const
99 {
100 // Compares the stored layers, not Top/Bottom, so a span and its reverse stay distinct
101 return m_StartLayer == aOther.m_StartLayer && m_EndLayer == aOther.m_EndLayer
102 && m_IsBackdrill == aOther.m_IsBackdrill
104 }
105
106 bool operator!=( const DRILL_SPAN& aOther ) const { return !( *this == aOther ); }
107
108 bool operator<( const DRILL_SPAN& aOther ) const
109 {
110 if( TopLayer() != aOther.TopLayer() )
111 return TopLayer() < aOther.TopLayer();
112
113 if( BottomLayer() != aOther.BottomLayer() )
114 return BottomLayer() < aOther.BottomLayer();
115
116 if( m_IsBackdrill != aOther.m_IsBackdrill )
117 return m_IsBackdrill && !aOther.m_IsBackdrill;
118
120 return m_IsNonPlatedFile && !aOther.m_IsNonPlatedFile;
121
122 if( m_StartLayer != aOther.m_StartLayer )
123 return m_StartLayer < aOther.m_StartLayer;
124
125 return m_EndLayer < aOther.m_EndLayer;
126 }
127
132};
133
134#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:49
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:93
DRILL_SPAN(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, bool aIsBackdrill, bool aIsNonPlated)
Definition drill_span.h:62
PCB_LAYER_ID DrillEndLayer() const
Definition drill_span.h:88
bool operator!=(const DRILL_SPAN &aOther) const
Definition drill_span.h:106
PCB_LAYER_ID m_EndLayer
Definition drill_span.h:129
PCB_LAYER_ID TopLayer() const
Definition drill_span.h:71
PCB_LAYER_ID DrillStartLayer() const
Definition drill_span.h:83
PCB_LAYER_ID BottomLayer() const
Definition drill_span.h:78
PCB_LAYER_ID m_StartLayer
Definition drill_span.h:128
bool m_IsNonPlatedFile
Definition drill_span.h:131
bool operator==(const DRILL_SPAN &aOther) const
Definition drill_span.h:98
bool m_IsBackdrill
Definition drill_span.h:130
bool operator<(const DRILL_SPAN &aOther) const
Definition drill_span.h:108