LibrePCB Developers Documentation
Loading...
Searching...
No Matches
netlabel.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_NETLABEL_H
21#define LIBREPCB_CORE_NETLABEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../serialization/serializableobjectlist.h"
27#include "../types/angle.h"
28#include "../types/point.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class NetLabel
39 ******************************************************************************/
40
47class NetLabel final {
48 Q_DECLARE_TR_FUNCTIONS(NetLabel)
49
50public:
51 // Signals
60
61 // Constructors / Destructor
62 NetLabel() = delete;
63 NetLabel(const NetLabel& other) noexcept;
64 NetLabel(const Uuid& uuid, const NetLabel& other) noexcept;
65 NetLabel(const Uuid& uuid, const Point& position, const Angle& rotation,
66 bool mirrored) noexcept;
67 explicit NetLabel(const SExpression& node);
68 ~NetLabel() noexcept;
69
70 // Getters
71 const Uuid& getUuid() const noexcept { return mUuid; }
72 const Point& getPosition() const noexcept { return mPosition; }
73 const Angle& getRotation() const noexcept { return mRotation; }
74 bool getMirrored() const noexcept { return mMirrored; }
75
76 // Setters
77 bool setUuid(const Uuid& uuid) noexcept;
78 bool setPosition(const Point& position) noexcept;
79 bool setRotation(const Angle& rotation) noexcept;
80 bool setMirrored(const bool mirrored) noexcept;
81
82 // General Methods
83
89 void serialize(SExpression& root) const;
90
91 // Operator Overloadings
92 bool operator==(const NetLabel& rhs) const noexcept;
93 bool operator!=(const NetLabel& rhs) const noexcept {
94 return !(*this == rhs);
95 }
96 NetLabel& operator=(const NetLabel& rhs) noexcept;
97
98private: // Data
103};
104
105/*******************************************************************************
106 * Class NetLabelList
107 ******************************************************************************/
108
110 static constexpr const char* tagname = "label";
111};
114
115/*******************************************************************************
116 * End of File
117 ******************************************************************************/
118
119} // namespace librepcb
120
121#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The NetLabel class represents a net text label of a schematic.
Definition netlabel.h:47
bool getMirrored() const noexcept
Definition netlabel.h:74
const Angle & getRotation() const noexcept
Definition netlabel.h:73
bool operator==(const NetLabel &rhs) const noexcept
Definition netlabel.cpp:130
bool setPosition(const Point &position) noexcept
Definition netlabel.cpp:83
Uuid mUuid
Definition netlabel.h:99
Event
Definition netlabel.h:52
bool operator!=(const NetLabel &rhs) const noexcept
Definition netlabel.h:93
~NetLabel() noexcept
Definition netlabel.cpp:66
Angle mRotation
Definition netlabel.h:101
const Point & getPosition() const noexcept
Definition netlabel.h:72
NetLabel & operator=(const NetLabel &rhs) noexcept
Definition netlabel.cpp:138
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition netlabel.cpp:117
Slot< NetLabel, Event > OnEditedSlot
Definition netlabel.h:59
const Uuid & getUuid() const noexcept
Definition netlabel.h:71
Signal< NetLabel, Event > onEdited
Definition netlabel.h:58
bool setRotation(const Angle &rotation) noexcept
Definition netlabel.cpp:93
bool setMirrored(const bool mirrored) noexcept
Definition netlabel.cpp:103
bool mMirrored
Definition netlabel.h:102
bool setUuid(const Uuid &uuid) noexcept
Definition netlabel.cpp:73
Point mPosition
Definition netlabel.h:100
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The SExpression class.
Definition sexpression.h:69
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The Slot class is used to receive signals from non-QObject derived classes.
Definition signalslot.h:170
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
Definition occmodel.cpp:76
Definition netlabel.h:109
static constexpr const char * tagname
Definition netlabel.h:110