LibrePCB Developers Documentation
Loading...
Searching...
No Matches
si_netline.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_NETLINE_H
21#define LIBREPCB_CORE_SI_NETLINE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/netline.h"
27#include "si_base.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class SI_NetLine;
37class SI_NetSegment;
38
39/*******************************************************************************
40 * Class SI_NetLineAnchor
41 ******************************************************************************/
42
44public:
45 SI_NetLineAnchor() noexcept = default;
46 virtual ~SI_NetLineAnchor() noexcept = default;
47
48 virtual void registerNetLine(SI_NetLine& netline) = 0;
49 virtual void unregisterNetLine(SI_NetLine& netline) = 0;
50 virtual const QSet<SI_NetLine*>& getNetLines() const noexcept = 0;
51 virtual const Point& getPosition() const noexcept = 0;
52 virtual bool isOpen() const noexcept = 0;
53
54 virtual NetLineAnchor toNetLineAnchor() const noexcept = 0;
55};
56
57/*******************************************************************************
58 * Class SI_NetLine
59 ******************************************************************************/
60
64class SI_NetLine final : public SI_Base {
65 Q_OBJECT
66
67public:
68 // Signals
69 enum class Event {
70 PositionsChanged,
71 NetSignalNameChanged,
72 };
75
76 // Constructors / Destructor
77 SI_NetLine() = delete;
78 SI_NetLine(const SI_NetLine& other) = delete;
79 SI_NetLine(SI_NetSegment& segment, const Uuid& uuid, SI_NetLineAnchor& a,
80 SI_NetLineAnchor& b, const UnsignedLength& width);
81 ~SI_NetLine() noexcept;
82
83 // Getters
84 SI_NetSegment& getNetSegment() const noexcept { return mNetSegment; }
85 const NetLine& getNetLine() const noexcept { return mNetLine; }
86 const Uuid& getUuid() const noexcept { return mNetLine.getUuid(); }
87 const UnsignedLength& getWidth() const noexcept {
88 return mNetLine.getWidth();
89 }
90 SI_NetLineAnchor& getP1() const noexcept { return *mP1; }
91 SI_NetLineAnchor& getP2() const noexcept { return *mP2; }
92 SI_NetLineAnchor* getOtherPoint(
93 const SI_NetLineAnchor& firstPoint) const noexcept;
94
95 // Setters
96 void setWidth(const UnsignedLength& width) noexcept;
97
98 // General Methods
99 void addToSchematic() override;
100 void removeFromSchematic() override;
101 void updatePositions() noexcept;
102
103 // Operator Overloadings
104 SI_NetLine& operator=(const SI_NetLine& rhs) = delete;
105
106private: // Data
107 SI_NetSegment& mNetSegment;
108 NetLine mNetLine;
109
110 // References
113};
114
115/*******************************************************************************
116 * End of File
117 ******************************************************************************/
118
119} // namespace librepcb
120
121#endif
The NetLineAnchor class.
Definition netline.h:43
The NetLine class represents a net line within a schematic.
Definition netline.h:128
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
SI_NetLineAnchor() noexcept=default
virtual void registerNetLine(SI_NetLine &netline)=0
virtual void unregisterNetLine(SI_NetLine &netline)=0
virtual bool isOpen() const noexcept=0
virtual const Point & getPosition() const noexcept=0
virtual NetLineAnchor toNetLineAnchor() const noexcept=0
virtual const QSet< SI_NetLine * > & getNetLines() const noexcept=0
The SI_NetLine class.
Definition si_netline.h:64
SI_NetLine(const SI_NetLine &other)=delete
Event
Definition si_netline.h:69
const UnsignedLength & getWidth() const noexcept
Definition si_netline.h:87
const Uuid & getUuid() const noexcept
Definition si_netline.h:86
Signal< SI_NetLine, Event > onEdited
Definition si_netline.h:73
SI_NetLineAnchor & getP1() const noexcept
Definition si_netline.h:90
SI_NetLineAnchor & getP2() const noexcept
Definition si_netline.h:91
Slot< SI_NetLine, Event > OnEditedSlot
Definition si_netline.h:74
const NetLine & getNetLine() const noexcept
Definition si_netline.h:85
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
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694