LibrePCB Developers Documentation
boarddesignrulecheckdata.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (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 <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_BOARDDESIGNRULECHECKDATA_H
21#define LIBREPCB_CORE_BOARDDESIGNRULECHECKDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/padgeometry.h"
27#include "../../../geometry/zone.h"
28#include "../../../types/uuid.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Board;
39class Layer;
40
41/*******************************************************************************
42 * Class BoardDesignRuleCheckData
43 ******************************************************************************/
44
49 struct Junction {
52 qsizetype traces;
53 };
54 struct Trace {
59 const Layer* layer;
60 };
61 struct Via {
68 tl::optional<std::pair<const Layer*, const Layer*>> drillLayerSpan;
70 bool isBlind;
71 tl::optional<PositiveLength> stopMaskDiameterTop;
72 tl::optional<PositiveLength> stopMaskDiameterBot;
73 };
74 struct Segment {
76 tl::optional<Uuid> net;
77 QString netName; // Empty if no net.
78 QHash<Uuid, Junction> junctions;
79 QList<Trace> traces;
80 QHash<Uuid, Via> vias;
81 };
84 tl::optional<Uuid> device; // If it's a pad.
85 tl::optional<Uuid> pad; // If it's a pad.
86 tl::optional<Uuid> segment; // If it's a junction or via.
87 tl::optional<Uuid> junction; // If it's a junction.
88 tl::optional<Uuid> via; // If it's a via.
89 };
90 struct AirWire {
93 QString netName; // Always valid.
94 };
95 struct Plane {
97 tl::optional<Uuid> net;
98 QString netName; // Empty if no net.
99 const Layer* layer;
102 QVector<Path> fragments;
103 };
104 struct Polygon {
106 const Layer* layer;
108 bool filled;
110 };
111 struct Circle {
115 const Layer* layer;
117 bool filled;
118 };
119 struct StrokeText {
123 bool mirror;
124 const Layer* layer;
127 QVector<Path> paths;
128 };
129 struct Hole {
133 tl::optional<Length> stopMaskOffset;
134 };
135 struct Zone {
137 QSet<const Layer*> boardLayers; // Only set for board zones!
138 librepcb::Zone::Layers footprintLayers; // Only set for device zones!
139 librepcb::Zone::Rules rules;
141 };
142 struct Pad {
144 QString libPkgPadName; // Empty if not connected to a package pad.
145 Point position; // Absolute transform.
146 Angle rotation; // Absolute transform.
147 bool mirror; // Absolute transform.
148 QList<Hole> holes;
149 QHash<const Layer*, QList<PadGeometry>> geometries;
150 QSet<const Layer*> layersWithTraces; // Layers where traces are connected.
152 tl::optional<Uuid> net;
153 QString netName; // Empty if no net.
154 };
155 struct Device {
160 bool mirror;
161 QHash<Uuid, Pad> pads; // With absolute transform.
162 QList<Polygon> polygons; // From library footprint.
163 QList<Circle> circles; // From library footprint.
164 QList<StrokeText> strokeTexts; // With absolute transform.
165 QList<Hole> holes; // From library footprint.
166 QList<Zone> zones; // From library footprint.
167 };
168
169 // NOTE: We create a `const` copy of this structure for each thread to
170 // ensure thread-safety. For the implicitly shared Qt containers this is
171 // a lightweight operation.
173 bool quick = false;
174 QSet<const Layer*> copperLayers; // All board copper layers.
175 QVector<const Layer*> silkscreenLayersTop;
176 QVector<const Layer*> silkscreenLayersBot;
177 QHash<Uuid, Segment> segments;
178 QList<Plane> planes;
179 QList<Polygon> polygons;
180 QList<StrokeText> strokeTexts;
181 QList<Hole> holes;
182 QList<Zone> zones;
183 QHash<Uuid, Device> devices;
184 QList<AirWire> airWires;
185 QMap<Uuid, QString> unplacedComponents; // UUID and name.
186
187 // Constructors / Destructor
188 BoardDesignRuleCheckData(const Board& board,
189 const BoardDesignRuleCheckSettings& drcSettings,
190 bool quickCheck) noexcept;
191};
192
193/*******************************************************************************
194 * End of File
195 ******************************************************************************/
196
197} // namespace librepcb
198
199#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The BoardDesignRuleCheckSettings class.
Definition: boarddesignrulechecksettings.h:44
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:222
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: boarddesignrulecheckdata.h:82
tl::optional< Uuid > via
Definition: boarddesignrulecheckdata.h:88
tl::optional< Uuid > pad
Definition: boarddesignrulecheckdata.h:85
tl::optional< Uuid > junction
Definition: boarddesignrulecheckdata.h:87
Point position
Definition: boarddesignrulecheckdata.h:83
tl::optional< Uuid > device
Definition: boarddesignrulecheckdata.h:84
tl::optional< Uuid > segment
Definition: boarddesignrulecheckdata.h:86
Definition: boarddesignrulecheckdata.h:90
QString netName
Definition: boarddesignrulecheckdata.h:93
AirWireAnchor p1
Definition: boarddesignrulecheckdata.h:91
AirWireAnchor p2
Definition: boarddesignrulecheckdata.h:92
Definition: boarddesignrulecheckdata.h:111
UnsignedLength lineWidth
Definition: boarddesignrulecheckdata.h:116
Point center
Definition: boarddesignrulecheckdata.h:113
bool filled
Definition: boarddesignrulecheckdata.h:117
Uuid uuid
Definition: boarddesignrulecheckdata.h:112
PositiveLength diameter
Definition: boarddesignrulecheckdata.h:114
const Layer * layer
Definition: boarddesignrulecheckdata.h:115
Definition: boarddesignrulecheckdata.h:155
bool mirror
Definition: boarddesignrulecheckdata.h:160
QList< Zone > zones
Definition: boarddesignrulecheckdata.h:166
Uuid uuid
Definition: boarddesignrulecheckdata.h:156
Angle rotation
Definition: boarddesignrulecheckdata.h:159
QList< Polygon > polygons
Definition: boarddesignrulecheckdata.h:162
QString cmpInstanceName
Definition: boarddesignrulecheckdata.h:157
QList< Circle > circles
Definition: boarddesignrulecheckdata.h:163
QList< Hole > holes
Definition: boarddesignrulecheckdata.h:165
Point position
Definition: boarddesignrulecheckdata.h:158
QList< StrokeText > strokeTexts
Definition: boarddesignrulecheckdata.h:164
QHash< Uuid, Pad > pads
Definition: boarddesignrulecheckdata.h:161
Definition: boarddesignrulecheckdata.h:129
Uuid uuid
Definition: boarddesignrulecheckdata.h:130
tl::optional< Length > stopMaskOffset
Definition: boarddesignrulecheckdata.h:133
PositiveLength diameter
Definition: boarddesignrulecheckdata.h:131
NonEmptyPath path
Definition: boarddesignrulecheckdata.h:132
Definition: boarddesignrulecheckdata.h:49
Uuid uuid
Definition: boarddesignrulecheckdata.h:50
qsizetype traces
Definition: boarddesignrulecheckdata.h:52
Point position
Definition: boarddesignrulecheckdata.h:51
Definition: boarddesignrulecheckdata.h:142
UnsignedLength copperClearance
Definition: boarddesignrulecheckdata.h:151
bool mirror
Definition: boarddesignrulecheckdata.h:147
QString libPkgPadName
Definition: boarddesignrulecheckdata.h:144
tl::optional< Uuid > net
Definition: boarddesignrulecheckdata.h:152
QString netName
Definition: boarddesignrulecheckdata.h:153
Uuid uuid
Definition: boarddesignrulecheckdata.h:143
Angle rotation
Definition: boarddesignrulecheckdata.h:146
QHash< const Layer *, QList< PadGeometry > > geometries
Definition: boarddesignrulecheckdata.h:149
QList< Hole > holes
Definition: boarddesignrulecheckdata.h:148
Point position
Definition: boarddesignrulecheckdata.h:145
QSet< const Layer * > layersWithTraces
Definition: boarddesignrulecheckdata.h:150
Definition: boarddesignrulecheckdata.h:95
tl::optional< Uuid > net
Definition: boarddesignrulecheckdata.h:97
QString netName
Definition: boarddesignrulecheckdata.h:98
Uuid uuid
Definition: boarddesignrulecheckdata.h:96
QVector< Path > fragments
Definition: boarddesignrulecheckdata.h:102
Path outline
Definition: boarddesignrulecheckdata.h:101
UnsignedLength minWidth
Definition: boarddesignrulecheckdata.h:100
const Layer * layer
Definition: boarddesignrulecheckdata.h:99
Definition: boarddesignrulecheckdata.h:104
UnsignedLength lineWidth
Definition: boarddesignrulecheckdata.h:107
bool filled
Definition: boarddesignrulecheckdata.h:108
Uuid uuid
Definition: boarddesignrulecheckdata.h:105
Path path
Definition: boarddesignrulecheckdata.h:109
const Layer * layer
Definition: boarddesignrulecheckdata.h:106
Definition: boarddesignrulecheckdata.h:74
QHash< Uuid, Via > vias
Definition: boarddesignrulecheckdata.h:80
tl::optional< Uuid > net
Definition: boarddesignrulecheckdata.h:76
QString netName
Definition: boarddesignrulecheckdata.h:77
Uuid uuid
Definition: boarddesignrulecheckdata.h:75
QList< Trace > traces
Definition: boarddesignrulecheckdata.h:79
QHash< Uuid, Junction > junctions
Definition: boarddesignrulecheckdata.h:78
Definition: boarddesignrulecheckdata.h:119
bool mirror
Definition: boarddesignrulecheckdata.h:123
Uuid uuid
Definition: boarddesignrulecheckdata.h:120
Angle rotation
Definition: boarddesignrulecheckdata.h:122
QVector< Path > paths
Definition: boarddesignrulecheckdata.h:127
UnsignedLength strokeWidth
Definition: boarddesignrulecheckdata.h:125
Point position
Definition: boarddesignrulecheckdata.h:121
PositiveLength height
Definition: boarddesignrulecheckdata.h:126
const Layer * layer
Definition: boarddesignrulecheckdata.h:124
Definition: boarddesignrulecheckdata.h:54
Uuid uuid
Definition: boarddesignrulecheckdata.h:55
Point endPosition
Definition: boarddesignrulecheckdata.h:57
Point startPosition
Definition: boarddesignrulecheckdata.h:56
const Layer * layer
Definition: boarddesignrulecheckdata.h:59
PositiveLength width
Definition: boarddesignrulecheckdata.h:58
Definition: boarddesignrulecheckdata.h:61
PositiveLength size
Definition: boarddesignrulecheckdata.h:64
tl::optional< PositiveLength > stopMaskDiameterTop
Definition: boarddesignrulecheckdata.h:71
Uuid uuid
Definition: boarddesignrulecheckdata.h:62
bool isBlind
Definition: boarddesignrulecheckdata.h:70
const Layer * endLayer
Definition: boarddesignrulecheckdata.h:67
bool isBuried
Definition: boarddesignrulecheckdata.h:69
tl::optional< std::pair< const Layer *, const Layer * > > drillLayerSpan
Definition: boarddesignrulecheckdata.h:68
const Layer * startLayer
Definition: boarddesignrulecheckdata.h:66
Point position
Definition: boarddesignrulecheckdata.h:63
tl::optional< PositiveLength > stopMaskDiameterBot
Definition: boarddesignrulecheckdata.h:72
PositiveLength drillDiameter
Definition: boarddesignrulecheckdata.h:65
Definition: boarddesignrulecheckdata.h:135
QSet< const Layer * > boardLayers
Definition: boarddesignrulecheckdata.h:137
librepcb::Zone::Layers footprintLayers
Definition: boarddesignrulecheckdata.h:138
Uuid uuid
Definition: boarddesignrulecheckdata.h:136
Path outline
Definition: boarddesignrulecheckdata.h:140
librepcb::Zone::Rules rules
Definition: boarddesignrulecheckdata.h:139
Input data structure for librepcb::BoardDesignRuleCheck.
Definition: boarddesignrulecheckdata.h:48
QVector< const Layer * > silkscreenLayersTop
Definition: boarddesignrulecheckdata.h:175
QVector< const Layer * > silkscreenLayersBot
Definition: boarddesignrulecheckdata.h:176
QList< Zone > zones
Definition: boarddesignrulecheckdata.h:182
QMap< Uuid, QString > unplacedComponents
Definition: boarddesignrulecheckdata.h:185
QHash< Uuid, Segment > segments
Definition: boarddesignrulecheckdata.h:177
QList< Plane > planes
Definition: boarddesignrulecheckdata.h:178
QSet< const Layer * > copperLayers
Definition: boarddesignrulecheckdata.h:174
QList< Polygon > polygons
Definition: boarddesignrulecheckdata.h:179
QList< AirWire > airWires
Definition: boarddesignrulecheckdata.h:184
BoardDesignRuleCheckData(const Board &board, const BoardDesignRuleCheckSettings &drcSettings, bool quickCheck) noexcept
Definition: boarddesignrulecheckdata.cpp:61
QList< Hole > holes
Definition: boarddesignrulecheckdata.h:181
QHash< Uuid, Device > devices
Definition: boarddesignrulecheckdata.h:183
QList< StrokeText > strokeTexts
Definition: boarddesignrulecheckdata.h:180
bool quick
Definition: boarddesignrulecheckdata.h:173
BoardDesignRuleCheckSettings settings
Definition: boarddesignrulecheckdata.h:172