LibrePCB Developers Documentation
footprintpainter.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_FOOTPRINTPAINTER_H
21#define LIBREPCB_CORE_FOOTPRINTPAINTER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../export/graphicsexport.h"
27
28#include <QtCore>
29#include <QtGui>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class Circle;
37class Footprint;
38class FootprintPad;
39class Hole;
40class Polygon;
41class StrokeFont;
42class StrokeText;
43class Text;
44
45/*******************************************************************************
46 * Class FootprintPainter
47 ******************************************************************************/
48
55 struct ColorContent {
56 QList<QPainterPath> areas;
57 QList<Polygon> polygons;
58 QList<Circle> circles;
59 QList<Hole> holes;
60 QList<Hole> padHoles;
61 QList<Text> texts;
62 };
63
64public:
65 // Constructors / Destructor
66 FootprintPainter() = delete;
67 explicit FootprintPainter(const Footprint& footprint) noexcept;
68 FootprintPainter(const FootprintPainter& other) = delete;
69 ~FootprintPainter() noexcept;
70
71 // General Methods
72 void paint(QPainter& painter,
73 const GraphicsExportSettings& settings) const noexcept override;
74
75 // Operator Overloadings
76 FootprintPainter& operator=(const FootprintPainter& rhs) = delete;
77
78private: // Methods
79 void initContentByColor() const noexcept;
80
81private: // Data
84
89 QList<Hole> mHoles;
90
91 mutable QMutex mMutex;
92 mutable QHash<QString, ColorContent> mContentByColor;
93};
94
95/*******************************************************************************
96 * End of File
97 ******************************************************************************/
98
99} // namespace librepcb
100
101#endif
The Circle class.
Definition: circle.h:46
The Footprint class represents one footprint variant of a package.
Definition: footprint.h:55
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:55
Paints a librepcb::Footprint to a QPainter.
Definition: footprintpainter.h:54
FootprintPainter(const FootprintPainter &other)=delete
QMutex mMutex
Definition: footprintpainter.h:91
QHash< QString, ColorContent > mContentByColor
Definition: footprintpainter.h:92
QList< Polygon > mPolygons
Definition: footprintpainter.h:86
const StrokeFont & mStrokeFont
Definition: footprintpainter.h:83
QList< Hole > mHoles
Definition: footprintpainter.h:89
void initContentByColor() const noexcept
Definition: footprintpainter.cpp:137
QList< FootprintPad > mPads
Definition: footprintpainter.h:85
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition: footprintpainter.cpp:72
QList< Circle > mCircles
Definition: footprintpainter.h:87
QList< StrokeText > mStrokeTexts
Definition: footprintpainter.h:88
QFont mMonospaceFont
Definition: footprintpainter.h:82
~FootprintPainter() noexcept
Definition: footprintpainter.cpp:65
Settings for librepcb::GraphicsExport.
Definition: graphicsexportsettings.h:51
Base class for printing a page for librepcb::GraphicsExport.
Definition: graphicsexport.h:57
The Hole class.
Definition: hole.h:45
The Polygon class.
Definition: polygon.h:45
The StrokeFont class.
Definition: strokefont.h:56
The StrokeText class.
Definition: stroketext.h:51
Definition: occmodel.cpp:77
Definition: footprintpainter.h:55
QList< Polygon > polygons
Definition: footprintpainter.h:57
QList< Circle > circles
Definition: footprintpainter.h:58
QList< QPainterPath > areas
Definition: footprintpainter.h:56
QList< Hole > holes
Definition: footprintpainter.h:59
QList< Text > texts
Definition: footprintpainter.h:61
QList< Hole > padHoles
Definition: footprintpainter.h:60