LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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 ******************************************************************************/
37namespace librepcb {
38
39class Circle;
40class Image;
41class Path;
42class Polygon;
43class Schematic;
44class Text;
45
46/*******************************************************************************
47 * Class SchematicPainter
48 ******************************************************************************/
49
69
75
76 struct Label {
80 QString text;
81 };
82
83 struct Symbol {
85 QList<Pin> pins;
86 QList<Polygon> polygons;
87 QList<Circle> circles;
88 QList<Image> images;
89 // Note: QPixmap is only allowed in the GUI thread so we have to use QImage.
90 QHash<QString, QImage> imageFiles;
91 };
92
93public:
94 // Constructors / Destructor
95 SchematicPainter() = delete;
96 explicit SchematicPainter(const Schematic& schematic, QStringList* errors,
97 bool thumbnail = false) noexcept;
98 SchematicPainter(const SchematicPainter& other) = delete;
99 ~SchematicPainter() noexcept;
100
101 // General Methods
102 void paint(QPainter& painter,
103 const GraphicsExportSettings& settings) const noexcept override;
104
105 // Operator Overloadings
106 SchematicPainter& operator=(const SchematicPainter& rhs) = delete;
107
108private: // Data
119 QList<Text> mTexts;
121 // Note: QPixmap is only allowed in the GUI thread so we have to use QImage.
122 QHash<QString, QImage> mImageFiles;
123};
124
125/*******************************************************************************
126 * End of File
127 ******************************************************************************/
128
129} // namespace librepcb
130
131#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
Settings for librepcb::GraphicsExport.
Definition graphicsexportsettings.h:51
Base class for printing a page for librepcb::GraphicsExport.
Definition graphicsexport.h:56
The Image class.
Definition image.h:49
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The Polygon class.
Definition polygon.h:45
The Schematic class represents one schematic page of a project and is always part of a circuit.
Definition schematic.h:81
Paints a librepcb::Schematic to a QPainter.
Definition schematicpainter.h:55
QList< Symbol > mSymbols
Definition schematicpainter.h:111
QList< Label > mNetLabels
Definition schematicpainter.h:117
QFont mDefaultFont
Definition schematicpainter.h:109
QList< Point > mNetJunctions
Definition schematicpainter.h:115
QList< Label > mBusLabels
Definition schematicpainter.h:114
QList< Polygon > mPolygons
Definition schematicpainter.h:118
QList< Line > mNetLines
Definition schematicpainter.h:116
QList< Text > mTexts
Definition schematicpainter.h:119
QList< Image > mImages
Definition schematicpainter.h:120
void paint(QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
Draw page content on a QPainter.
Definition schematicpainter.cpp:207
QList< Point > mBusJunctions
Definition schematicpainter.h:112
QFont mNetLabelFont
Definition schematicpainter.h:110
QList< Line > mBusLines
Definition schematicpainter.h:113
QHash< QString, QImage > mImageFiles
Definition schematicpainter.h:122
The Text class.
Definition text.h:48
Helper class to perform coordinate transformation with various types.
Definition transform.h:59
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition schematicpainter.h:76
QString text
Definition schematicpainter.h:80
Angle rotation
Definition schematicpainter.h:78
bool mirrored
Definition schematicpainter.h:79
Point position
Definition schematicpainter.h:77
Definition schematicpainter.h:70
UnsignedLength width
Definition schematicpainter.h:73
Point endPosition
Definition schematicpainter.h:72
Point startPosition
Definition schematicpainter.h:71
Definition schematicpainter.h:56
Alignment numbersAlignment
Definition schematicpainter.h:67
QString numbers
Definition schematicpainter.h:61
PositiveLength nameHeight
Definition schematicpainter.h:64
UnsignedLength length
Definition schematicpainter.h:59
Angle rotation
Definition schematicpainter.h:58
Angle nameRotation
Definition schematicpainter.h:63
Point numbersPosition
Definition schematicpainter.h:66
Point namePosition
Definition schematicpainter.h:62
Alignment nameAlignment
Definition schematicpainter.h:65
QString name
Definition schematicpainter.h:60
Point position
Definition schematicpainter.h:57
Definition schematicpainter.h:83
Transform transform
Definition schematicpainter.h:84
QHash< QString, QImage > imageFiles
Definition schematicpainter.h:90
QList< Image > images
Definition schematicpainter.h:88
QList< Pin > pins
Definition schematicpainter.h:85
QList< Polygon > polygons
Definition schematicpainter.h:86
QList< Circle > circles
Definition schematicpainter.h:87