LibrePCB Developers Documentation
Loading...
Searching...
No Matches
sgi_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_EDITOR_SGI_NETLINE_H
21#define LIBREPCB_EDITOR_SGI_NETLINE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class NetSignal;
39
40namespace editor {
41
42class GraphicsLayer;
43class GraphicsLayerList;
44
45/*******************************************************************************
46 * Class SGI_NetLine
47 ******************************************************************************/
48
52class SGI_NetLine final : public QGraphicsItem {
53public:
54 // Constructors / Destructor
55 SGI_NetLine() = delete;
56 SGI_NetLine(const SGI_NetLine& other) = delete;
57 SGI_NetLine(SI_NetLine& netline, const GraphicsLayerList& layers,
58 std::shared_ptr<const QSet<const NetSignal*>>
59 highlightedNetSignals) noexcept;
60 virtual ~SGI_NetLine() noexcept;
61
62 // General Methods
63 SI_NetLine& getNetLine() noexcept { return mNetLine; }
64
65 // Inherited from QGraphicsItem
66 QRectF boundingRect() const noexcept override { return mBoundingRect; }
67 QPainterPath shape() const noexcept override;
68 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
69 QWidget* widget) noexcept override;
70
71 // Operator Overloadings
72 SGI_NetLine& operator=(const SGI_NetLine& rhs) = delete;
73
74private: // Methods
75 void netLineEdited(const SI_NetLine& obj, SI_NetLine::Event event) noexcept;
76 void updatePositions() noexcept;
77 void updateNetSignalName() noexcept;
78 std::shared_ptr<GraphicsLayer> getLayer(const QString& name) const noexcept;
79
80private: // Data
82 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
83 std::shared_ptr<const GraphicsLayer> mLayer;
84
85 // Cached Attributes
86 QLineF mLineF;
88 QPainterPath mShape;
89
90 // Slots
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
The NetSignal class.
Definition netsignal.h:50
The SI_NetLine class.
Definition si_netline.h:64
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The SGI_NetLine class.
Definition sgi_netline.h:52
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition sgi_netline.h:82
virtual ~SGI_NetLine() noexcept
Definition sgi_netline.cpp:66
QRectF boundingRect() const noexcept override
Definition sgi_netline.h:66
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition sgi_netline.cpp:77
QPainterPath mShape
Definition sgi_netline.h:88
SI_NetLine::OnEditedSlot mOnNetLineEditedSlot
Definition sgi_netline.h:91
std::shared_ptr< GraphicsLayer > getLayer(const QString &name) const noexcept
QPainterPath shape() const noexcept override
Definition sgi_netline.cpp:73
void updatePositions() noexcept
Definition sgi_netline.cpp:118
SI_NetLine & getNetLine() noexcept
Definition sgi_netline.h:63
std::shared_ptr< const GraphicsLayer > mLayer
Definition sgi_netline.h:83
QRectF mBoundingRect
Definition sgi_netline.h:87
SGI_NetLine(const SGI_NetLine &other)=delete
void netLineEdited(const SI_NetLine &obj, SI_NetLine::Event event) noexcept
Definition sgi_netline.cpp:101
SI_NetLine & mNetLine
Definition sgi_netline.h:81
QLineF mLineF
Definition sgi_netline.h:86
void updateNetSignalName() noexcept
Definition sgi_netline.cpp:134
Definition occmodel.cpp:77
Definition uuid.h:186