LibrePCB Developers Documentation
boardstroketextdata.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_BOARDSTROKETEXTDATA_H
21#define LIBREPCB_CORE_BOARDSTROKETEXTDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../types/alignment.h"
27#include "../../types/angle.h"
28#include "../../types/length.h"
29#include "../../types/point.h"
30#include "../../types/stroketextspacing.h"
31#include "../../types/uuid.h"
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41
42/*******************************************************************************
43 * Class BoardStrokeTextData
44 ******************************************************************************/
45
50public:
51 // Constructors / Destructor
53 BoardStrokeTextData(const BoardStrokeTextData& other) noexcept;
54 BoardStrokeTextData(const Uuid& uuid,
55 const BoardStrokeTextData& other) noexcept;
56 BoardStrokeTextData(const Uuid& uuid, const Layer& layer, const QString& text,
57 const Point& pos, const Angle& rotation,
58 const PositiveLength& height,
59 const UnsignedLength& strokeWidth,
60 const StrokeTextSpacing& letterSpacing,
61 const StrokeTextSpacing& lineSpacing,
62 const Alignment& align, bool mirrored, bool autoRotate,
63 bool locked);
64 explicit BoardStrokeTextData(const SExpression& node);
65 ~BoardStrokeTextData() noexcept;
66
67 // Getters
68 const Uuid& getUuid() const noexcept { return mUuid; }
69 const Layer& getLayer() const noexcept { return *mLayer; }
70 const Point& getPosition() const noexcept { return mPosition; }
71 const Angle& getRotation() const noexcept { return mRotation; }
72 const PositiveLength& getHeight() const noexcept { return mHeight; }
73 const UnsignedLength& getStrokeWidth() const noexcept { return mStrokeWidth; }
74 const StrokeTextSpacing& getLetterSpacing() const noexcept {
75 return mLetterSpacing;
76 }
77 const StrokeTextSpacing& getLineSpacing() const noexcept {
78 return mLineSpacing;
79 }
80 const Alignment& getAlign() const noexcept { return mAlign; }
81 bool getMirrored() const noexcept { return mMirrored; }
82 bool getAutoRotate() const noexcept { return mAutoRotate; }
83 bool isLocked() const noexcept { return mLocked; }
84 const QString& getText() const noexcept { return mText; }
85
86 // Setters
87 bool setUuid(const Uuid& uuid) noexcept;
88 bool setLayer(const Layer& layer) noexcept;
89 bool setText(const QString& text) noexcept;
90 bool setPosition(const Point& pos) noexcept;
91 bool setRotation(const Angle& rotation) noexcept;
92 bool setHeight(const PositiveLength& height) noexcept;
93 bool setStrokeWidth(const UnsignedLength& strokeWidth) noexcept;
94 bool setLetterSpacing(const StrokeTextSpacing& spacing) noexcept;
95 bool setLineSpacing(const StrokeTextSpacing& spacing) noexcept;
96 bool setAlign(const Alignment& align) noexcept;
97 bool setMirrored(bool mirrored) noexcept;
98 bool setAutoRotate(bool autoRotate) noexcept;
99 bool setLocked(bool locked) noexcept;
100
101 // General Methods
102
108 void serialize(SExpression& root) const;
109
110 // Operator Overloadings
111 bool operator==(const BoardStrokeTextData& rhs) const noexcept;
112 bool operator!=(const BoardStrokeTextData& rhs) const noexcept {
113 return !(*this == rhs);
114 }
116
117private: // Data
119 const Layer* mLayer;
120 QString mText;
131};
132
133/*******************************************************************************
134 * End of File
135 ******************************************************************************/
136
137} // namespace librepcb
138
139#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:78
The BoardStrokeTextData class.
Definition: boardstroketextdata.h:49
bool operator==(const BoardStrokeTextData &rhs) const noexcept
Definition: boardstroketextdata.cpp:267
bool mLocked
Definition: boardstroketextdata.h:130
bool getMirrored() const noexcept
Definition: boardstroketextdata.h:81
bool setText(const QString &text) noexcept
Definition: boardstroketextdata.cpp:136
const Angle & getRotation() const noexcept
Definition: boardstroketextdata.h:71
bool setPosition(const Point &pos) noexcept
Definition: boardstroketextdata.cpp:145
bool setLineSpacing(const StrokeTextSpacing &spacing) noexcept
Definition: boardstroketextdata.cpp:192
bool getAutoRotate() const noexcept
Definition: boardstroketextdata.h:82
Uuid mUuid
Definition: boardstroketextdata.h:118
UnsignedLength mStrokeWidth
Definition: boardstroketextdata.h:124
const PositiveLength & getHeight() const noexcept
Definition: boardstroketextdata.h:72
QString mText
Definition: boardstroketextdata.h:120
const Layer & getLayer() const noexcept
Definition: boardstroketextdata.h:69
BoardStrokeTextData & operator=(const BoardStrokeTextData &rhs)=default
bool setLetterSpacing(const StrokeTextSpacing &spacing) noexcept
Definition: boardstroketextdata.cpp:182
bool isLocked() const noexcept
Definition: boardstroketextdata.h:83
const Alignment & getAlign() const noexcept
Definition: boardstroketextdata.h:80
const QString & getText() const noexcept
Definition: boardstroketextdata.h:84
bool setStrokeWidth(const UnsignedLength &strokeWidth) noexcept
Definition: boardstroketextdata.cpp:172
Angle mRotation
Definition: boardstroketextdata.h:122
bool setLayer(const Layer &layer) noexcept
Definition: boardstroketextdata.cpp:127
bool mAutoRotate
Definition: boardstroketextdata.h:129
bool setHeight(const PositiveLength &height) noexcept
Definition: boardstroketextdata.cpp:163
bool setMirrored(bool mirrored) noexcept
Definition: boardstroketextdata.cpp:211
const Point & getPosition() const noexcept
Definition: boardstroketextdata.h:70
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: boardstroketextdata.cpp:242
const StrokeTextSpacing & getLineSpacing() const noexcept
Definition: boardstroketextdata.h:77
PositiveLength mHeight
Definition: boardstroketextdata.h:123
const Uuid & getUuid() const noexcept
Definition: boardstroketextdata.h:68
const StrokeTextSpacing & getLetterSpacing() const noexcept
Definition: boardstroketextdata.h:74
Alignment mAlign
Definition: boardstroketextdata.h:127
bool setRotation(const Angle &rotation) noexcept
Definition: boardstroketextdata.cpp:154
const Layer * mLayer
Definition: boardstroketextdata.h:119
StrokeTextSpacing mLineSpacing
Definition: boardstroketextdata.h:126
~BoardStrokeTextData() noexcept
Definition: boardstroketextdata.cpp:111
const UnsignedLength & getStrokeWidth() const noexcept
Definition: boardstroketextdata.h:73
bool setLocked(bool locked) noexcept
Definition: boardstroketextdata.cpp:229
bool operator!=(const BoardStrokeTextData &rhs) const noexcept
Definition: boardstroketextdata.h:112
bool setAutoRotate(bool autoRotate) noexcept
Definition: boardstroketextdata.cpp:220
bool mMirrored
Definition: boardstroketextdata.h:128
bool setUuid(const Uuid &uuid) noexcept
Definition: boardstroketextdata.cpp:118
Point mPosition
Definition: boardstroketextdata.h:121
bool setAlign(const Alignment &align) noexcept
Definition: boardstroketextdata.cpp:202
StrokeTextSpacing mLetterSpacing
Definition: boardstroketextdata.h:125
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The SExpression class.
Definition: sexpression.h:69
Represents the letter- or line spacing configuration of a stroke text.
Definition: stroketextspacing.h:44
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696