LibrePCB Developers Documentation
Loading...
Searching...
No Matches
si_buslabel.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_BUSLABEL_H
21#define LIBREPCB_CORE_SI_BUSLABEL_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_BusSegment;
39class Schematic;
40
41/*******************************************************************************
42 * Class SI_BusLabel
43 ******************************************************************************/
44
48class SI_BusLabel final : public SI_Base {
49 Q_OBJECT
50
51public:
52 // Signals
62
63 // Constructors / Destructor
64 SI_BusLabel() = delete;
65 SI_BusLabel(const SI_BusLabel& other) = delete;
66 explicit SI_BusLabel(SI_BusSegment& segment, const NetLabel& label);
67 ~SI_BusLabel() 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_BusSegment& getBusSegment() const noexcept { return mSegment; }
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_BusLabel& operator=(const SI_BusLabel& 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_BusLabel class.
Definition si_buslabel.h:48
bool getMirrored() const noexcept
Definition si_buslabel.h:73
const Angle & getRotation() const noexcept
Definition si_buslabel.h:72
SI_BusSegment & mSegment
Definition si_buslabel.h:96
void setMirrored(const bool mirrored) noexcept
Definition si_buslabel.cpp:72
Point mAnchorPosition
Definition si_buslabel.h:100
NetLabel mNetLabel
Definition si_buslabel.h:97
~SI_BusLabel() noexcept
Definition si_buslabel.cpp:52
Event
Definition si_buslabel.h:53
QMetaObject::Connection mNameChangedConnection
Definition si_buslabel.h:93
void removeFromSchematic() override
Definition si_buslabel.cpp:92
SI_BusLabel(const SI_BusLabel &other)=delete
void addToSchematic() override
Definition si_buslabel.cpp:82
const NetLabel & getNetLabel() const noexcept
Definition si_buslabel.h:75
Signal< SI_BusLabel, Event > onEdited
Definition si_buslabel.h:60
Slot< SI_BusLabel, Event > OnEditedSlot
Definition si_buslabel.h:61
const Point & getPosition() const noexcept
Definition si_buslabel.h:71
void setRotation(const Angle &rotation) noexcept
Definition si_buslabel.cpp:66
const Uuid & getUuid() const noexcept
Definition si_buslabel.h:70
const Point & getAnchorPosition() const noexcept
Definition si_buslabel.h:74
SI_BusSegment & getBusSegment() const noexcept
Definition si_buslabel.h:76
void updateAnchor() noexcept
Definition si_buslabel.cpp:100
void setPosition(const Point &position) noexcept
Definition si_buslabel.cpp:59
The SI_BusSegment class.
Definition si_bussegment.h:52
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