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 {
37namespace editor {
38
39class GraphicsLayer;
40class IF_GraphicsLayerProvider;
41
42/*******************************************************************************
43 * Class SGI_NetLine
44 ******************************************************************************/
45
49class SGI_NetLine final : public QGraphicsItem {
50public:
51 // Constructors / Destructor
52 SGI_NetLine() = delete;
53 SGI_NetLine(const SGI_NetLine& other) = delete;
55 std::shared_ptr<const QSet<const NetSignal*>>
56 highlightedNetSignals) noexcept;
57 virtual ~SGI_NetLine() noexcept;
58
59 // General Methods
60 SI_NetLine& getNetLine() noexcept { return mNetLine; }
61
62 // Inherited from QGraphicsItem
63 QRectF boundingRect() const noexcept override { return mBoundingRect; }
64 QPainterPath shape() const noexcept override;
65 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
66 QWidget* widget) noexcept override;
67
68 // Operator Overloadings
69 SGI_NetLine& operator=(const SGI_NetLine& rhs) = delete;
70
71private: // Methods
72 void netLineEdited(const SI_NetLine& obj, SI_NetLine::Event event) noexcept;
73 void updatePositions() noexcept;
74 void updateNetSignalName() noexcept;
75 std::shared_ptr<GraphicsLayer> getLayer(const QString& name) const noexcept;
76
77private: // Data
79 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
80 std::shared_ptr<GraphicsLayer> mLayer;
81
82 // Cached Attributes
83 QLineF mLineF;
85 QPainterPath mShape;
86
87 // Slots
89};
90
91/*******************************************************************************
92 * End of File
93 ******************************************************************************/
94
95} // namespace editor
96} // namespace librepcb
97
98#endif
The NetSignal class.
Definition netsignal.h:50
The SI_NetLine class.
Definition si_netline.h:65
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition graphicslayer.h:111
The SGI_NetLine class.
Definition sgi_netline.h:49
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition sgi_netline.h:79
virtual ~SGI_NetLine() noexcept
Definition sgi_netline.cpp:65
QRectF boundingRect() const noexcept override
Definition sgi_netline.h:63
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition sgi_netline.cpp:76
QPainterPath mShape
Definition sgi_netline.h:85
SI_NetLine::OnEditedSlot mOnNetLineEditedSlot
Definition sgi_netline.h:88
std::shared_ptr< GraphicsLayer > mLayer
Definition sgi_netline.h:80
std::shared_ptr< GraphicsLayer > getLayer(const QString &name) const noexcept
QPainterPath shape() const noexcept override
Definition sgi_netline.cpp:72
void updatePositions() noexcept
Definition sgi_netline.cpp:116
SI_NetLine & getNetLine() noexcept
Definition sgi_netline.h:60
QRectF mBoundingRect
Definition sgi_netline.h:84
SGI_NetLine(const SGI_NetLine &other)=delete
void netLineEdited(const SI_NetLine &obj, SI_NetLine::Event event) noexcept
Definition sgi_netline.cpp:99
SI_NetLine & mNetLine
Definition sgi_netline.h:78
QLineF mLineF
Definition sgi_netline.h:83
void updateNetSignalName() noexcept
Definition sgi_netline.cpp:132
Definition occmodel.cpp:76
Definition uuid.h:186