LibrePCB Developers Documentation
bgi_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_BGI_NETLINE_H
21#define LIBREPCB_EDITOR_BGI_NETLINE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicslayer.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class NetSignal;
41
42namespace editor {
43
44/*******************************************************************************
45 * Class BGI_NetLine
46 ******************************************************************************/
47
51class BGI_NetLine final : public QGraphicsItem {
52public:
53 // Constructors / Destructor
54 BGI_NetLine() = delete;
55 BGI_NetLine(const BGI_NetLine& other) = delete;
57 std::shared_ptr<const QSet<const NetSignal*>>
58 highlightedNetSignals) noexcept;
59 virtual ~BGI_NetLine() noexcept;
60
61 // General Methods
62 BI_NetLine& getNetLine() noexcept { return mNetLine; }
63
64 // Inherited from QGraphicsItem
65 QRectF boundingRect() const noexcept override { return mBoundingRect; }
66 QPainterPath shape() const noexcept override;
67 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
68 QWidget* widget) noexcept override;
69
70 // Operator Overloadings
71 BGI_NetLine& operator=(const BGI_NetLine& rhs) = delete;
72
73private: // Methods
74 void netLineEdited(const BI_NetLine& obj, BI_NetLine::Event event) noexcept;
75 void layerEdited(const GraphicsLayer& layer,
76 GraphicsLayer::Event event) noexcept;
77 void updateLine() noexcept;
78 void updateLayer() noexcept;
79 void updateNetSignalName() noexcept;
80 void updateVisibility() noexcept;
81
82private: // Data
83 // Attributes
86 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
87 std::shared_ptr<GraphicsLayer> mLayer;
88
89 // Cached Attributes
90 QLineF mLineF;
92 QPainterPath mShape;
93
94 // Slots
97};
98
99/*******************************************************************************
100 * End of File
101 ******************************************************************************/
102
103} // namespace editor
104} // namespace librepcb
105
106#endif
The BI_NetLine class.
Definition: bi_netline.h:71
The NetSignal class.
Definition: netsignal.h:50
The BGI_NetLine class.
Definition: bgi_netline.h:51
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: bgi_netline.h:86
QRectF boundingRect() const noexcept override
Definition: bgi_netline.h:65
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition: bgi_netline.cpp:77
QPainterPath mShape
Definition: bgi_netline.h:92
std::shared_ptr< GraphicsLayer > mLayer
Definition: bgi_netline.h:87
void updateLine() noexcept
Definition: bgi_netline.cpp:143
void netLineEdited(const BI_NetLine &obj, BI_NetLine::Event event) noexcept
Definition: bgi_netline.cpp:99
QPainterPath shape() const noexcept override
Definition: bgi_netline.cpp:73
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition: bgi_netline.h:96
const IF_GraphicsLayerProvider & mLayerProvider
Definition: bgi_netline.h:85
QRectF mBoundingRect
Definition: bgi_netline.h:91
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition: bgi_netline.cpp:123
BI_NetLine & getNetLine() noexcept
Definition: bgi_netline.h:62
QLineF mLineF
Definition: bgi_netline.h:90
virtual ~BGI_NetLine() noexcept
Definition: bgi_netline.cpp:66
BI_NetLine & mNetLine
Definition: bgi_netline.h:84
void updateVisibility() noexcept
Definition: bgi_netline.cpp:177
void updateLayer() noexcept
Definition: bgi_netline.cpp:159
void updateNetSignalName() noexcept
Definition: bgi_netline.cpp:173
BI_NetLine::OnEditedSlot mOnNetLineEditedSlot
Definition: bgi_netline.h:95
BGI_NetLine(const BGI_NetLine &other)=delete
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
Definition: occmodel.cpp:77