LibrePCB Developers Documentation
Loading...
Searching...
No Matches
si_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_SI_NETLABEL_H
21#define LIBREPCB_CORE_SI_NETLABEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/netlabel.h"
27#include "../../../utils/signalslot.h"
28#include "si_base.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Circuit;
38class SI_NetSegment;
39class Schematic;
40
41/*******************************************************************************
42 * Class SI_NetLabel
43 ******************************************************************************/
44
48class SI_NetLabel final : public SI_Base {
49 Q_OBJECT
50
51public:
52 // Signals
62
63 // Constructors / Destructor
64 SI_NetLabel() = delete;
65 SI_NetLabel(const SI_NetLabel& other) = delete;
66 explicit SI_NetLabel(SI_NetSegment& segment, const NetLabel& label);
67 ~SI_NetLabel() noexcept;
68
69 // Getters
70 const Uuid& getUuid() const noexcept { return mNetLabel.getUuid(); }
71 const Point& getPosition() const noexcept { return mNetLabel.getPosition(); }
72 const Angle& getRotation() const noexcept { return mNetLabel.getRotation(); }
73 bool getMirrored() const noexcept { return mNetLabel.getMirrored(); }
74 const Point& getAnchorPosition() const noexcept { return mAnchorPosition; }
75 const NetLabel& getNetLabel() const noexcept { return mNetLabel; }
76 SI_NetSegment& getNetSegment() const noexcept { return mNetSegment; }
77
78 // Setters
79 void setPosition(const Point& position) noexcept;
80 void setRotation(const Angle& rotation) noexcept;
81 void setMirrored(const bool mirrored) noexcept;
82
83 // General Methods
84 void addToSchematic() override;
85 void removeFromSchematic() override;
86 void updateAnchor() noexcept;
87
88 // Operator Overloadings
89 SI_NetLabel& operator=(const SI_NetLabel& rhs) = delete;
90
91private:
92 // General
93 QMetaObject::Connection mNameChangedConnection;
94
95 // Attributes
98
99 // Cached Attributes
101};
102
103/*******************************************************************************
104 * End of File
105 ******************************************************************************/
106
107} // namespace librepcb
108
109#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
const Point & getPosition() const noexcept
Definition netlabel.h:72
const Uuid & getUuid() const noexcept
Definition netlabel.h:71
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The Schematic Item Base (SI_Base) class.
Definition si_base.h:45
The SI_NetLabel class.
Definition si_netlabel.h:48
bool getMirrored() const noexcept
Definition si_netlabel.h:73
const Angle & getRotation() const noexcept
Definition si_netlabel.h:72
SI_NetLabel(const SI_NetLabel &other)=delete
Signal< SI_NetLabel, Event > onEdited
Definition si_netlabel.h:60
void setMirrored(const bool mirrored) noexcept
Definition si_netlabel.cpp:72
Point mAnchorPosition
Definition si_netlabel.h:100
NetLabel mNetLabel
Definition si_netlabel.h:97
Event
Definition si_netlabel.h:53
QMetaObject::Connection mNameChangedConnection
Definition si_netlabel.h:93
void removeFromSchematic() override
Definition si_netlabel.cpp:92
SI_NetSegment & mNetSegment
Definition si_netlabel.h:96
void addToSchematic() override
Definition si_netlabel.cpp:82
const NetLabel & getNetLabel() const noexcept
Definition si_netlabel.h:75
const Point & getPosition() const noexcept
Definition si_netlabel.h:71
Slot< SI_NetLabel, Event > OnEditedSlot
Definition si_netlabel.h:61
void setRotation(const Angle &rotation) noexcept
Definition si_netlabel.cpp:66
const Uuid & getUuid() const noexcept
Definition si_netlabel.h:70
const Point & getAnchorPosition() const noexcept
Definition si_netlabel.h:74
void updateAnchor() noexcept
Definition si_netlabel.cpp:100
~SI_NetLabel() noexcept
Definition si_netlabel.cpp:52
SI_NetSegment & getNetSegment() const noexcept
Definition si_netlabel.h:76
void setPosition(const Point &position) noexcept
Definition si_netlabel.cpp:59
The SI_NetSegment class.
Definition si_netsegment.h:55
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:77