LibrePCB Developers Documentation
schematicpainter.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_SCHEMATICPAINTER_H
21 #define LIBREPCB_CORE_SCHEMATICPAINTER_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../export/graphicsexport.h"
27 #include "../../types/alignment.h"
28 #include "../../types/length.h"
29 #include "../../utils/transform.h"
30 
31 #include <QtCore>
32 #include <QtGui>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 
39 class Circle;
40 class Path;
41 class Polygon;
42 class Schematic;
43 class Text;
44 
45 /*******************************************************************************
46  * Class SchematicPainter
47  ******************************************************************************/
48 
54 class SchematicPainter final : public GraphicsPagePainter {
55  struct Pin {
59  QString name;
60  QString numbers;
67  };
68 
69  struct Line {
73  };
74 
75  struct Label {
78  bool mirrored;
79  QString text;
80  };
81 
82  struct Symbol {
84  QList<Pin> pins;
85  QList<Polygon> polygons;
86  QList<Circle> circles;
87  };
88 
89 public:
90  // Constructors / Destructor
91  SchematicPainter() = delete;
92  explicit SchematicPainter(const Schematic& schematic,
93  bool thumbnail = false) noexcept;
94  SchematicPainter(const SchematicPainter& other) = delete;
95  ~SchematicPainter() noexcept;
96 
97  // General Methods
98  void paint(QPainter& painter,
99  const GraphicsExportSettings& settings) const noexcept override;
100 
101  // Operator Overloadings
102  SchematicPainter& operator=(const SchematicPainter& rhs) = delete;
103 
104 private: // Data
107  QList<Symbol> mSymbols;
109  QList<Line> mNetLines;
112  QList<Text> mTexts;
113 };
114 
115 /*******************************************************************************
116  * End of File
117  ******************************************************************************/
118 
119 } // namespace librepcb
120 
121 #endif
Point position
Definition: schematicpainter.h:76
QList< Polygon > mPolygons
Definition: schematicpainter.h:111
Definition: schematicpainter.h:69
QString name
Definition: schematicpainter.h:59
QString text
Definition: schematicpainter.h:79
The Alignment class.
Definition: alignment.h:115
Definition: occmodel.cpp:77
Helper class to perform coordinate transformation with various types.
Definition: transform.h:59
Point namePosition
Definition: schematicpainter.h:61
QString numbers
Definition: schematicpainter.h:60
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
QList< Pin > pins
Definition: schematicpainter.h:84
QList< Symbol > mSymbols
Definition: schematicpainter.h:107
Point endPosition
Definition: schematicpainter.h:71
Point startPosition
Definition: schematicpainter.h:70
Angle nameRotation
Definition: schematicpainter.h:62
Definition: schematicpainter.h:55
QFont mDefaultFont
Definition: schematicpainter.h:105
Alignment numbersAlignment
Definition: schematicpainter.h:66
The Schematic class represents one schematic page of a project and is always part of a circuit...
Definition: schematic.h:74
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
Paints a librepcb::Schematic to a QPainter.
Definition: schematicpainter.h:54
Settings for librepcb::GraphicsExport.
Definition: graphicsexportsettings.h:51
QList< Circle > circles
Definition: schematicpainter.h:86
Point position
Definition: schematicpainter.h:56
QList< Line > mNetLines
Definition: schematicpainter.h:109
UnsignedLength length
Definition: schematicpainter.h:58
PositiveLength nameHeight
Definition: schematicpainter.h:63
bool mirrored
Definition: schematicpainter.h:78
Angle rotation
Definition: schematicpainter.h:77
Definition: schematicpainter.h:75
Angle rotation
Definition: schematicpainter.h:57
Transform transform
Definition: schematicpainter.h:83
QList< Polygon > polygons
Definition: schematicpainter.h:85
QList< Label > mNetLabels
Definition: schematicpainter.h:110
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
Alignment nameAlignment
Definition: schematicpainter.h:64
The Text class.
Definition: text.h:48
Point numbersPosition
Definition: schematicpainter.h:65
QList< Point > mJunctions
Definition: schematicpainter.h:108
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition: schematicpainter.cpp:133
The Polygon class.
Definition: polygon.h:45
UnsignedLength width
Definition: schematicpainter.h:72
Base class for printing a page for librepcb::GraphicsExport.
Definition: graphicsexport.h:57
Definition: schematicpainter.h:82
QList< Text > mTexts
Definition: schematicpainter.h:112
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
QFont mNetLabelFont
Definition: schematicpainter.h:106