LibrePCB Developers Documentation
bgi_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_EDITOR_BGI_NETPOINT_H
21#define LIBREPCB_EDITOR_BGI_NETPOINT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicslayer.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39/*******************************************************************************
40 * Class BGI_NetPoint
41 ******************************************************************************/
42
46class BGI_NetPoint final : public QGraphicsItem {
47public:
48 // Constructors / Destructor
49 BGI_NetPoint() = delete;
50 BGI_NetPoint(const BGI_NetPoint& other) = delete;
51 BGI_NetPoint(BI_NetPoint& netpoint,
52 const IF_GraphicsLayerProvider& lp) noexcept;
53 virtual ~BGI_NetPoint() noexcept;
54
55 // General Methods
56 BI_NetPoint& getNetPoint() noexcept { return mNetPoint; }
57
58 // Inherited from QGraphicsItem
59 QRectF boundingRect() const noexcept override { return mBoundingRect; }
60 QPainterPath shape() const noexcept override;
61 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
62 QWidget* widget) noexcept override;
63
64 // Operator Overloadings
65 BGI_NetPoint& operator=(const BGI_NetPoint& rhs) = delete;
66
67private: // Methods
68 void netPointEdited(const BI_NetPoint& obj,
69 BI_NetPoint::Event event) noexcept;
70 void layerEdited(const GraphicsLayer& layer,
71 GraphicsLayer::Event event) noexcept;
72 void updateLayer() noexcept;
73 void updatePosition() noexcept;
74 void updateDiameter() noexcept;
75 void updateNetSignalName() noexcept;
76 void updateVisibility() noexcept;
77
78private: // Data
79 // General Attributes
82 std::shared_ptr<GraphicsLayer> mLayer;
83
84 // Cached Attributes
86 QPainterPath mShape;
87
88 // Slots
91};
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace editor
98} // namespace librepcb
99
100#endif
The BI_NetPoint class.
Definition: bi_netpoint.h:46
The BGI_NetPoint class.
Definition: bgi_netpoint.h:46
QRectF boundingRect() const noexcept override
Definition: bgi_netpoint.h:59
BI_NetPoint::OnEditedSlot mOnEditedSlot
Definition: bgi_netpoint.h:89
void updatePosition() noexcept
Definition: bgi_netpoint.cpp:146
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition: bgi_netpoint.cpp:74
QPainterPath mShape
Definition: bgi_netpoint.h:86
std::shared_ptr< GraphicsLayer > mLayer
Definition: bgi_netpoint.h:82
BI_NetPoint & mNetPoint
Definition: bgi_netpoint.h:80
QPainterPath shape() const noexcept override
Definition: bgi_netpoint.cpp:70
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition: bgi_netpoint.h:90
BGI_NetPoint(const BGI_NetPoint &other)=delete
const IF_GraphicsLayerProvider & mLayerProvider
Definition: bgi_netpoint.h:81
BI_NetPoint & getNetPoint() noexcept
Definition: bgi_netpoint.h:56
QRectF mBoundingRect
Definition: bgi_netpoint.h:85
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition: bgi_netpoint.cpp:109
virtual ~BGI_NetPoint() noexcept
Definition: bgi_netpoint.cpp:63
void netPointEdited(const BI_NetPoint &obj, BI_NetPoint::Event event) noexcept
Definition: bgi_netpoint.cpp:86
void updateVisibility() noexcept
Definition: bgi_netpoint.cpp:166
void updateLayer() noexcept
Definition: bgi_netpoint.cpp:129
void updateNetSignalName() noexcept
Definition: bgi_netpoint.cpp:162
void updateDiameter() noexcept
Definition: bgi_netpoint.cpp:150
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