LibrePCB Developers Documentation
Loading...
Searching...
No Matches
si_busjunction.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_BUSJUNCTION_H
21#define LIBREPCB_CORE_SI_BUSJUNCTION_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/junction.h"
27#include "./si_busline.h"
28#include "./si_netline.h"
29#include "si_base.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38/*******************************************************************************
39 * Class SI_BusJunction
40 ******************************************************************************/
41
45class SI_BusJunction final : public SI_Base, public SI_NetLineAnchor {
46 Q_OBJECT
47
48public:
49 // Signals
50 enum class Event {
54 };
57
58 // Constructors / Destructor
59 SI_BusJunction() = delete;
60 SI_BusJunction(const SI_BusJunction& other) = delete;
61 SI_BusJunction(SI_BusSegment& segment, const Uuid& uuid,
62 const Point& position);
63 ~SI_BusJunction() noexcept;
64
65 // Getters
66 const Uuid& getUuid() const noexcept { return mJunction.getUuid(); }
67 const Point& getPosition() const noexcept override {
68 return mJunction.getPosition();
69 }
70 const Junction& getJunction() const noexcept { return mJunction; }
71 bool isVisibleJunction() const noexcept;
72 SI_BusSegment& getBusSegment() const noexcept { return mSegment; }
73 bool isUsed() const noexcept;
74 bool isOpen() const noexcept override;
75
76 // Setters
77 void setPosition(const Point& position) noexcept;
78
79 // General Methods
80 void addToSchematic() override;
81 void removeFromSchematic() override;
84 const QSet<SI_BusLine*>& getBusLines() const noexcept {
86 }
87
88 // Inherited from SI_NetLineAnchor
89 void registerNetLine(SI_NetLine& netline) override;
90 void unregisterNetLine(SI_NetLine& netline) override;
91 const QSet<SI_NetLine*>& getNetLines() const noexcept override {
93 }
94 NetLineAnchor toNetLineAnchor() const noexcept override;
95
96 // Operator Overloadings
97 SI_BusJunction& operator=(const SI_BusJunction& rhs) = delete;
98 bool operator==(const SI_BusJunction& rhs) noexcept { return (this == &rhs); }
99 bool operator!=(const SI_BusJunction& rhs) noexcept { return (this != &rhs); }
100
101private:
102 // Attributes
105
106 // Registered Elements
107 QSet<SI_BusLine*> mRegisteredBusLines;
108 QSet<SI_NetLine*> mRegisteredNetLines;
109};
110
111/*******************************************************************************
112 * End of File
113 ******************************************************************************/
114
115} // namespace librepcb
116
117#endif
The Junction class represents the connection point between netlines or traces.
Definition junction.h:47
const Point & getPosition() const noexcept
Definition junction.h:69
const Uuid & getUuid() const noexcept
Definition junction.h:68
The NetLineAnchor class.
Definition netline.h:43
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_BusJunction class.
Definition si_busjunction.h:45
void unregisterBusLine(SI_BusLine &l)
Definition si_busjunction.cpp:114
SI_BusJunction(const SI_BusJunction &other)=delete
const Point & getPosition() const noexcept override
Definition si_busjunction.h:67
SI_BusSegment & mSegment
Definition si_busjunction.h:103
void unregisterNetLine(SI_NetLine &netline) override
Definition si_busjunction.cpp:134
QSet< SI_NetLine * > mRegisteredNetLines
all registered netlines
Definition si_busjunction.h:108
void registerNetLine(SI_NetLine &netline) override
Definition si_busjunction.cpp:124
bool isUsed() const noexcept
Definition si_busjunction.cpp:61
NetLineAnchor toNetLineAnchor() const noexcept override
Definition si_busjunction.cpp:144
Event
Definition si_busjunction.h:50
~SI_BusJunction() noexcept
Definition si_busjunction.cpp:50
void registerBusLine(SI_BusLine &l)
Definition si_busjunction.cpp:103
const QSet< SI_NetLine * > & getNetLines() const noexcept override
Definition si_busjunction.h:91
const Junction & getJunction() const noexcept
Definition si_busjunction.h:70
bool isOpen() const noexcept override
Definition si_busjunction.cpp:65
void removeFromSchematic() override
Definition si_busjunction.cpp:96
Junction mJunction
Definition si_busjunction.h:104
const QSet< SI_BusLine * > & getBusLines() const noexcept
Definition si_busjunction.h:84
QSet< SI_BusLine * > mRegisteredBusLines
all registered netlines
Definition si_busjunction.h:107
void addToSchematic() override
Definition si_busjunction.cpp:89
Signal< SI_BusJunction, Event > onEdited
Definition si_busjunction.h:55
bool operator!=(const SI_BusJunction &rhs) noexcept
Definition si_busjunction.h:99
const Uuid & getUuid() const noexcept
Definition si_busjunction.h:66
SI_BusSegment & getBusSegment() const noexcept
Definition si_busjunction.h:72
void setPosition(const Point &position) noexcept
Definition si_busjunction.cpp:73
bool isVisibleJunction() const noexcept
Definition si_busjunction.cpp:57
Slot< SI_BusJunction, Event > OnEditedSlot
Definition si_busjunction.h:56
The SI_BusLine class.
Definition si_busline.h:47
The SI_BusSegment class.
Definition si_bussegment.h:52
Definition si_netline.h:43
The SI_NetLine class.
Definition si_netline.h:64
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