LibrePCB Developers Documentation
Loading...
Searching...
No Matches
bgi_via.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_VIA_H
21#define LIBREPCB_EDITOR_BGI_VIA_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
44class GraphicsLayerList;
45class PrimitivePathGraphicsItem;
46
47/*******************************************************************************
48 * Class BGI_Via
49 ******************************************************************************/
50
54class BGI_Via final : public QGraphicsItem {
55 Q_DECLARE_TR_FUNCTIONS(BGI_Via)
56
57public:
58 // Constructors / Destructor
59 BGI_Via() = delete;
60 BGI_Via(const BGI_Via& other) = delete;
61 BGI_Via(BI_Via& via, const GraphicsLayerList& layers,
62 std::shared_ptr<const QSet<const NetSignal*>>
63 highlightedNetSignals) noexcept;
64 virtual ~BGI_Via() noexcept;
65
66 // General Methods
67 BI_Via& getVia() noexcept { return mVia; }
68
69 // Inherited from QGraphicsItem
70 QRectF boundingRect() const noexcept override { return mBoundingRect; }
71 QPainterPath shape() const noexcept override;
72 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
73 QWidget* widget) noexcept override;
74
75 // Operator Overloadings
76 BGI_Via& operator=(const BGI_Via& rhs) = delete;
77
78private: // Methods
79 void viaEdited(const BI_Via& obj, BI_Via::Event event) noexcept;
80 void layerEdited(const GraphicsLayer& layer,
81 GraphicsLayer::Event event) noexcept;
82 virtual QVariant itemChange(GraphicsItemChange change,
83 const QVariant& value) noexcept override;
84 void updatePosition() noexcept;
85 void updateShapes() noexcept;
86 void updateToolTip() noexcept;
87 void updateText() noexcept;
88 void updateTextHeight() noexcept;
89 void updateVisibility() noexcept;
90 void attachToCopperLayers() noexcept;
91
92private: // Data
93 // General Attributes
96 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
97 std::shared_ptr<const GraphicsLayer> mViaLayer;
101
103 QVector<std::shared_ptr<const GraphicsLayer>> mBlindBuriedCopperLayers;
104
105 // Cached Attributes
106 QPainterPath mShape;
107 QPainterPath mCopper;
108 QPainterPath mStopMaskTop;
109 QPainterPath mStopMaskBottom;
111 QString mText;
112
113 // Slots
114 BI_Via::OnEditedSlot mOnEditedSlot;
116};
117
118/*******************************************************************************
119 * End of File
120 ******************************************************************************/
121
122} // namespace editor
123} // namespace librepcb
124
125#endif
The BI_Via class.
Definition bi_via.h:44
The NetSignal class.
Definition netsignal.h:50
The BGI_Via class.
Definition bgi_via.h:54
void updateShapes() noexcept
Definition bgi_via.cpp:223
virtual ~BGI_Via() noexcept
Definition bgi_via.cpp:93
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition bgi_via.h:96
QRectF boundingRect() const noexcept override
Definition bgi_via.h:70
void updateText() noexcept
Definition bgi_via.cpp:263
std::shared_ptr< const GraphicsLayer > mViaLayer
Definition bgi_via.h:97
void updatePosition() noexcept
Definition bgi_via.cpp:219
void updateTextHeight() noexcept
Definition bgi_via.cpp:276
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition bgi_via.cpp:156
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition bgi_via.cpp:104
QScopedPointer< PrimitivePathGraphicsItem > mTextGraphicsItem
Definition bgi_via.h:100
void attachToCopperLayers() noexcept
Definition bgi_via.cpp:305
BI_Via::OnEditedSlot mOnEditedSlot
Definition bgi_via.h:114
QPainterPath mShape
Definition bgi_via.h:106
BI_Via & getVia() noexcept
Definition bgi_via.h:67
void updateToolTip() noexcept
Definition bgi_via.cpp:244
std::shared_ptr< const GraphicsLayer > mBottomStopMaskLayer
Definition bgi_via.h:99
std::shared_ptr< const GraphicsLayer > mTopStopMaskLayer
Definition bgi_via.h:98
void viaEdited(const BI_Via &obj, BI_Via::Event event) noexcept
Definition bgi_via.cpp:168
const GraphicsLayerList & mLayers
Definition bgi_via.h:95
QPainterPath shape() const noexcept override
Definition bgi_via.cpp:100
QString mText
Definition bgi_via.h:111
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_via.h:115
QPainterPath mStopMaskBottom
Definition bgi_via.h:109
QPainterPath mStopMaskTop
Definition bgi_via.h:108
QRectF mBoundingRect
Definition bgi_via.h:110
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_via.cpp:198
QVector< std::shared_ptr< const GraphicsLayer > > mBlindBuriedCopperLayers
Copper layers for blind- and buried vias (empty for through-hole vias)
Definition bgi_via.h:103
QPainterPath mCopper
Definition bgi_via.h:107
void updateVisibility() noexcept
Definition bgi_via.cpp:285
BGI_Via(const BGI_Via &other)=delete
BI_Via & mVia
Definition bgi_via.h:94
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The PrimitivePathGraphicsItem class.
Definition primitivepathgraphicsitem.h:50
Definition occmodel.cpp:77
Definition uuid.h:186