LibrePCB Developers Documentation
sgi_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_SGI_NETPOINT_H
21#define LIBREPCB_EDITOR_SGI_NETPOINT_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_NetPoint
44 ******************************************************************************/
45
49class SGI_NetPoint final : public QGraphicsItem {
50public:
51 // Constructors / Destructor
52 SGI_NetPoint() = delete;
53 SGI_NetPoint(const SGI_NetPoint& other) = delete;
55 std::shared_ptr<const QSet<const NetSignal*>>
56 highlightedNetSignals) noexcept;
57 virtual ~SGI_NetPoint() noexcept;
58
59 // General Methods
60 SI_NetPoint& getNetPoint() noexcept { return mNetPoint; }
61
62 // Inherited from QGraphicsItem
63 QRectF boundingRect() const { return sBoundingRect; }
64 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
65 QWidget* widget);
66
67 // Operator Overloadings
68 SGI_NetPoint& operator=(const SGI_NetPoint& rhs) = delete;
69
70private: // Methods
71 void netPointEdited(const SI_NetPoint& obj,
72 SI_NetPoint::Event event) noexcept;
73 void updatePosition() noexcept;
74 void updateJunction() noexcept;
75 void updateNetName() noexcept;
76
77private: // Data
79 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
80 std::shared_ptr<GraphicsLayer> mLayer;
81
82 // Cached Attributes
85
86 // Slots
88
89 // Static Stuff
90 static QRectF sBoundingRect;
91};
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace editor
98} // namespace librepcb
99
100#endif
The NetSignal class.
Definition: netsignal.h:50
The SI_NetPoint class.
Definition: si_netpoint.h:44
Event
Definition: si_netpoint.h:49
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_NetPoint class.
Definition: sgi_netpoint.h:49
SGI_NetPoint(const SGI_NetPoint &other)=delete
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: sgi_netpoint.h:79
void updateNetName() noexcept
Definition: sgi_netpoint.cpp:138
void updatePosition() noexcept
Definition: sgi_netpoint.cpp:124
void netPointEdited(const SI_NetPoint &obj, SI_NetPoint::Event event) noexcept
Definition: sgi_netpoint.cpp:104
std::shared_ptr< GraphicsLayer > mLayer
Definition: sgi_netpoint.h:80
SI_NetPoint & mNetPoint
Definition: sgi_netpoint.h:78
SGI_NetPoint & operator=(const SGI_NetPoint &rhs)=delete
bool mIsOpenLineEnd
Definition: sgi_netpoint.h:84
void updateJunction() noexcept
Definition: sgi_netpoint.cpp:128
virtual ~SGI_NetPoint() noexcept
Definition: sgi_netpoint.cpp:71
SI_NetPoint & getNetPoint() noexcept
Definition: sgi_netpoint.h:60
SI_NetPoint::OnEditedSlot mOnEditedSlot
Definition: sgi_netpoint.h:87
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: sgi_netpoint.cpp:78
static QRectF sBoundingRect
Definition: sgi_netpoint.h:90
QRectF boundingRect() const
Definition: sgi_netpoint.h:63
bool mIsVisibleJunction
Definition: sgi_netpoint.h:83
Definition: occmodel.cpp:77