LibrePCB Developers Documentation
Loading...
Searching...
No Matches
si_netpoint.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_NETPOINT_H
21#define LIBREPCB_CORE_SI_NETPOINT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/junction.h"
27#include "./si_netline.h"
28#include "si_base.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class SI_NetPoint
39 ******************************************************************************/
40
44class SI_NetPoint final : public SI_Base, public SI_NetLineAnchor {
45 Q_OBJECT
46
47public:
48 // Signals
56
57 // Constructors / Destructor
58 SI_NetPoint() = delete;
59 SI_NetPoint(const SI_NetPoint& other) = delete;
60 SI_NetPoint(SI_NetSegment& segment, const Uuid& uuid, const Point& position);
61 ~SI_NetPoint() noexcept;
62
63 // Getters
64 const Uuid& getUuid() const noexcept { return mJunction.getUuid(); }
65 const Point& getPosition() const noexcept override {
66 return mJunction.getPosition();
67 }
68 const Junction& getJunction() const noexcept { return mJunction; }
69 bool isVisibleJunction() const noexcept;
70 SI_NetSegment& getNetSegment() const noexcept { return mNetSegment; }
71 bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
72 bool isOpen() const noexcept override {
73 return mRegisteredNetLines.count() < 2;
74 }
75 NetLineAnchor toNetLineAnchor() const noexcept override;
76
77 // Setters
78 void setPosition(const Point& position) noexcept;
79
80 // General Methods
81 void addToSchematic() override;
82 void removeFromSchematic() override;
83
84 // Inherited from SI_NetLineAnchor
85 void registerNetLine(SI_NetLine& netline) override;
86 void unregisterNetLine(SI_NetLine& netline) override;
87 const QSet<SI_NetLine*>& getNetLines() const noexcept override {
89 }
90
91 // Operator Overloadings
92 SI_NetPoint& operator=(const SI_NetPoint& rhs) = delete;
93 bool operator==(const SI_NetPoint& rhs) noexcept { return (this == &rhs); }
94 bool operator!=(const SI_NetPoint& rhs) noexcept { return (this != &rhs); }
95
96private:
97 // Attributes
100
101 // Registered Elements
102 QSet<SI_NetLine*> mRegisteredNetLines;
103};
104
105/*******************************************************************************
106 * End of File
107 ******************************************************************************/
108
109} // namespace librepcb
110
111#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
Definition si_netline.h:43
The SI_NetLine class.
Definition si_netline.h:64
The SI_NetPoint class.
Definition si_netpoint.h:44
~SI_NetPoint() noexcept
Definition si_netpoint.cpp:49
const Point & getPosition() const noexcept override
Definition si_netpoint.h:65
bool operator!=(const SI_NetPoint &rhs) noexcept
Definition si_netpoint.h:94
void unregisterNetLine(SI_NetLine &netline) override
Definition si_netpoint.cpp:106
QSet< SI_NetLine * > mRegisteredNetLines
all registered netlines
Definition si_netpoint.h:102
void registerNetLine(SI_NetLine &netline) override
Definition si_netpoint.cpp:95
SI_NetPoint & operator=(const SI_NetPoint &rhs)=delete
bool isUsed() const noexcept
Definition si_netpoint.h:71
NetLineAnchor toNetLineAnchor() const noexcept override
Definition si_netpoint.cpp:60
Event
Definition si_netpoint.h:49
Slot< SI_NetPoint, Event > OnEditedSlot
Definition si_netpoint.h:55
const QSet< SI_NetLine * > & getNetLines() const noexcept override
Definition si_netpoint.h:87
const Junction & getJunction() const noexcept
Definition si_netpoint.h:68
bool isOpen() const noexcept override
Definition si_netpoint.h:72
void removeFromSchematic() override
Definition si_netpoint.cpp:88
Junction mJunction
Definition si_netpoint.h:99
SI_NetSegment & mNetSegment
Definition si_netpoint.h:98
Signal< SI_NetPoint, Event > onEdited
Definition si_netpoint.h:54
void addToSchematic() override
Definition si_netpoint.cpp:81
bool operator==(const SI_NetPoint &rhs) noexcept
Definition si_netpoint.h:93
const Uuid & getUuid() const noexcept
Definition si_netpoint.h:64
SI_NetPoint(const SI_NetPoint &other)=delete
SI_NetSegment & getNetSegment() const noexcept
Definition si_netpoint.h:70
void setPosition(const Point &position) noexcept
Definition si_netpoint.cpp:68
bool isVisibleJunction() const noexcept
Definition si_netpoint.cpp:56
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