LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardpainter.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_BOARDPAINTER_H
21#define LIBREPCB_CORE_BOARDPAINTER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../export/graphicsexport.h"
27#include "../../library/pkg/footprintpad.h"
28#include "../../types/alignment.h"
29#include "../../types/length.h"
30#include "../../utils/transform.h"
31
32#include <QtCore>
33#include <QtGui>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Board;
41class Circle;
42class Path;
43class Via;
44
45/*******************************************************************************
46 * Class BoardPainter
47 ******************************************************************************/
48
54class BoardPainter final : public GraphicsPagePainter {
61
62 struct ViaData {
68 std::optional<PositiveLength> stopMaskDiameterTop;
69 std::optional<PositiveLength> stopMaskDiameterBottom;
70 };
71
72 struct Pad {
74 QList<std::pair<const Layer*, PadGeometry>> layerGeometries;
75 QList<PadHole> holes;
76 };
77
85
91
101
109
110 struct Footprint {
112 QList<Pad> pads;
113 QList<PolygonData> polygons;
114 QList<Circle> circles;
115 QList<HoleData> holes;
116 };
117
118 struct Plane {
119 const Layer* layer;
120 QVector<Path> fragments;
121 };
122
124 QList<QPainterPath> areas;
125 QList<QPainterPath> thtPadAreas;
126 QList<QPainterPath> viaAreas;
127 QList<Trace> traces;
128 QList<PolygonData> polygons;
129 QList<Circle> circles;
130 QList<HoleData> holes;
131 QList<HoleData> padHoles;
132 QList<TextData> texts;
133 };
134
135public:
136 // Constructors / Destructor
137 BoardPainter() = delete;
138 explicit BoardPainter(const Board& board);
139 BoardPainter(const BoardPainter& other) = delete;
140 ~BoardPainter() noexcept;
141
142 // General Methods
143 void paint(QPainter& painter,
144 const GraphicsExportSettings& settings) const noexcept override;
145
146 // Operator Overloadings
147 BoardPainter& operator=(const BoardPainter& rhs) = delete;
148
149private: // Methods
150 void initContentByColor() const noexcept;
151
152private: // Data
154 QSet<const Layer*> mCopperLayers;
162
163 mutable QMutex mMutex;
164 mutable QHash<QString, ColorContent> mContentByColor;
165};
166
167/*******************************************************************************
168 * End of File
169 ******************************************************************************/
170
171} // namespace librepcb
172
173#endif
The Alignment class.
Definition alignment.h:115
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The Board class represents a PCB of a project and is always part of a circuit.
Definition board.h:73
Paints a librepcb::Board to a QPainter.
Definition boardpainter.h:54
QList< HoleData > mHoles
Definition boardpainter.h:161
QMutex mMutex
Definition boardpainter.h:163
QList< Plane > mPlanes
Definition boardpainter.h:158
QList< Footprint > mFootprints
Definition boardpainter.h:155
QHash< QString, ColorContent > mContentByColor
Definition boardpainter.h:164
~BoardPainter() noexcept
Definition boardpainter.cpp:134
void initContentByColor() const noexcept
Definition boardpainter.cpp:234
QList< PolygonData > mPolygons
Definition boardpainter.h:159
QSet< const Layer * > mCopperLayers
Definition boardpainter.h:154
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition boardpainter.cpp:141
BoardPainter(const BoardPainter &other)=delete
QList< ViaData > mVias
Definition boardpainter.h:156
QList< Trace > mTraces
Definition boardpainter.h:157
QFont mMonospaceFont
Definition boardpainter.h:153
QList< StrokeTextData > mStrokeTexts
Definition boardpainter.h:160
Settings for librepcb::GraphicsExport.
Definition graphicsexportsettings.h:51
Base class for printing a page for librepcb::GraphicsExport.
Definition graphicsexport.h:56
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:57
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Helper class to perform coordinate transformation with various types.
Definition transform.h:59
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition path.h:231
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition boardpainter.h:123
QList< PolygonData > polygons
Definition boardpainter.h:128
QList< QPainterPath > viaAreas
Drawn on Theme::Color::sBoardVias.
Definition boardpainter.h:126
QList< Trace > traces
Definition boardpainter.h:127
QList< QPainterPath > thtPadAreas
Drawn on Theme::Color::sBoardPads.
Definition boardpainter.h:125
QList< Circle > circles
Definition boardpainter.h:129
QList< HoleData > padHoles
Definition boardpainter.h:131
QList< TextData > texts
Definition boardpainter.h:132
QList< QPainterPath > areas
Definition boardpainter.h:124
QList< HoleData > holes
Definition boardpainter.h:130
Definition boardpainter.h:110
Transform transform
Definition boardpainter.h:111
QList< PolygonData > polygons
Definition boardpainter.h:113
QList< Circle > circles
Definition boardpainter.h:114
QList< HoleData > holes
Definition boardpainter.h:115
QList< Pad > pads
Definition boardpainter.h:112
Definition boardpainter.h:86
PositiveLength diameter
Definition boardpainter.h:87
std::optional< Length > stopMaskOffset
Definition boardpainter.h:89
NonEmptyPath path
Definition boardpainter.h:88
Definition boardpainter.h:72
QList< PadHole > holes
Definition boardpainter.h:75
Transform transform
Definition boardpainter.h:73
QList< std::pair< const Layer *, PadGeometry > > layerGeometries
Definition boardpainter.h:74
Definition boardpainter.h:118
QVector< Path > fragments
Definition boardpainter.h:120
const Layer * layer
Definition boardpainter.h:119
Definition boardpainter.h:78
UnsignedLength lineWidth
Definition boardpainter.h:81
bool grabArea
Definition boardpainter.h:83
bool filled
Definition boardpainter.h:82
Path path
Definition boardpainter.h:80
const Layer * layer
Definition boardpainter.h:79
Definition boardpainter.h:92
Alignment align
Definition boardpainter.h:99
QString text
Definition boardpainter.h:98
Transform transform
Definition boardpainter.h:93
QVector< Path > paths
Definition boardpainter.h:95
UnsignedLength strokeWidth
Definition boardpainter.h:97
PositiveLength height
Definition boardpainter.h:96
const Layer * layer
Definition boardpainter.h:94
Definition boardpainter.h:102
Alignment align
Definition boardpainter.h:106
QString text
Definition boardpainter.h:107
Angle rotation
Definition boardpainter.h:104
Point position
Definition boardpainter.h:103
PositiveLength height
Definition boardpainter.h:105
Definition boardpainter.h:55
Point endPosition
Definition boardpainter.h:58
Point startPosition
Definition boardpainter.h:57
const Layer * layer
Definition boardpainter.h:56
PositiveLength width
Definition boardpainter.h:59
Definition boardpainter.h:62
PositiveLength size
Definition boardpainter.h:64
const Layer * endLayer
Definition boardpainter.h:67
std::optional< PositiveLength > stopMaskDiameterTop
Definition boardpainter.h:68
PositiveLength drill
Definition boardpainter.h:65
const Layer * startLayer
Definition boardpainter.h:66
Point position
Definition boardpainter.h:63
std::optional< PositiveLength > stopMaskDiameterBottom
Definition boardpainter.h:69