LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
39class GraphicsLayerList;
40
41/*******************************************************************************
42 * Class BGI_NetPoint
43 ******************************************************************************/
44
48class BGI_NetPoint final : public QGraphicsItem {
49public:
50 // Constructors / Destructor
51 BGI_NetPoint() = delete;
52 BGI_NetPoint(const BGI_NetPoint& other) = delete;
53 BGI_NetPoint(BI_NetPoint& netpoint, const GraphicsLayerList& layers) noexcept;
54 virtual ~BGI_NetPoint() noexcept;
55
56 // General Methods
57 BI_NetPoint& getNetPoint() noexcept { return mNetPoint; }
58
59 // Inherited from QGraphicsItem
60 QRectF boundingRect() const noexcept override { return mBoundingRect; }
61 QPainterPath shape() const noexcept override;
62 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
63 QWidget* widget) noexcept override;
64
65 // Operator Overloadings
66 BGI_NetPoint& operator=(const BGI_NetPoint& rhs) = delete;
67
68private: // Methods
69 void netPointEdited(const BI_NetPoint& obj,
70 BI_NetPoint::Event event) noexcept;
71 void layerEdited(const GraphicsLayer& layer,
72 GraphicsLayer::Event event) noexcept;
73 void updateLayer() noexcept;
74 void updatePosition() noexcept;
75 void updateDiameter() noexcept;
76 void updateNetSignalName() noexcept;
77 void updateVisibility() noexcept;
78
79private: // Data
80 // General Attributes
83 std::shared_ptr<const GraphicsLayer> mLayer;
84
85 // Cached Attributes
87 QPainterPath mShape;
88
89 // Slots
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
The BI_NetPoint class.
Definition bi_netpoint.h:46
The BGI_NetPoint class.
Definition bgi_netpoint.h:48
QRectF boundingRect() const noexcept override
Definition bgi_netpoint.h:60
BI_NetPoint::OnEditedSlot mOnEditedSlot
Definition bgi_netpoint.h:90
void updatePosition() noexcept
Definition bgi_netpoint.cpp:147
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition bgi_netpoint.cpp:75
QPainterPath mShape
Definition bgi_netpoint.h:87
BI_NetPoint & mNetPoint
Definition bgi_netpoint.h:81
const GraphicsLayerList & mLayers
Definition bgi_netpoint.h:82
QPainterPath shape() const noexcept override
Definition bgi_netpoint.cpp:71
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_netpoint.h:91
BGI_NetPoint(const BGI_NetPoint &other)=delete
std::shared_ptr< const GraphicsLayer > mLayer
Definition bgi_netpoint.h:83
BI_NetPoint & getNetPoint() noexcept
Definition bgi_netpoint.h:57
QRectF mBoundingRect
Definition bgi_netpoint.h:86
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_netpoint.cpp:110
virtual ~BGI_NetPoint() noexcept
Definition bgi_netpoint.cpp:64
void netPointEdited(const BI_NetPoint &obj, BI_NetPoint::Event event) noexcept
Definition bgi_netpoint.cpp:87
void updateVisibility() noexcept
Definition bgi_netpoint.cpp:167
void updateLayer() noexcept
Definition bgi_netpoint.cpp:130
void updateNetSignalName() noexcept
Definition bgi_netpoint.cpp:163
void updateDiameter() noexcept
Definition bgi_netpoint.cpp:151
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
Definition occmodel.cpp:77
Definition uuid.h:186