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  ******************************************************************************/
34 namespace librepcb {
35 
36 class Circle;
37 class Footprint;
38 class FootprintPad;
39 class Hole;
40 class Polygon;
41 class StrokeFont;
42 class StrokeText;
43 class Text;
44 
45 /*******************************************************************************
46  * Class FootprintPainter
47  ******************************************************************************/
48 
54 class FootprintPainter final : public GraphicsPagePainter {
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 
64 public:
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 
78 private: // Methods
79  void initContentByColor() const noexcept;
80 
81 private: // Data
84 
87  QList<Circle> mCircles;
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
const StrokeFont & mStrokeFont
Definition: footprintpainter.h:83
Definition: occmodel.cpp:77
The Hole class.
Definition: hole.h:45
The StrokeText class.
Definition: stroketext.h:51
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:55
QHash< QString, ColorContent > mContentByColor
Definition: footprintpainter.h:92
QMutex mMutex
Definition: footprintpainter.h:91
The Footprint class represents one footprint variant of a package.
Definition: footprint.h:55
QList< Text > texts
Definition: footprintpainter.h:61
QList< FootprintPad > mPads
Definition: footprintpainter.h:85
QList< Hole > mHoles
Definition: footprintpainter.h:89
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition: footprintpainter.cpp:72
Settings for librepcb::GraphicsExport.
Definition: graphicsexportsettings.h:51
void initContentByColor() const noexcept
Definition: footprintpainter.cpp:137
QList< Circle > circles
Definition: footprintpainter.h:58
QList< Hole > padHoles
Definition: footprintpainter.h:60
QFont mMonospaceFont
Definition: footprintpainter.h:82
Definition: footprintpainter.h:55
The Circle class.
Definition: circle.h:46
QList< Polygon > mPolygons
Definition: footprintpainter.h:86
QList< Hole > holes
Definition: footprintpainter.h:59
QList< StrokeText > mStrokeTexts
Definition: footprintpainter.h:88
Paints a librepcb::Footprint to a QPainter.
Definition: footprintpainter.h:54
QList< Polygon > polygons
Definition: footprintpainter.h:57
~FootprintPainter() noexcept
Definition: footprintpainter.cpp:65
The Polygon class.
Definition: polygon.h:45
QList< Circle > mCircles
Definition: footprintpainter.h:87
The StrokeFont class.
Definition: strokefont.h:56
Base class for printing a page for librepcb::GraphicsExport.
Definition: graphicsexport.h:57
QList< QPainterPath > areas
Definition: footprintpainter.h:56