LibrePCB Developers Documentation
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 PrimitivePathGraphicsItem;
45
46/*******************************************************************************
47 * Class BGI_Via
48 ******************************************************************************/
49
53class BGI_Via final : public QGraphicsItem {
54 Q_DECLARE_TR_FUNCTIONS(BGI_Via)
55
56public:
57 // Constructors / Destructor
58 BGI_Via() = delete;
59 BGI_Via(const BGI_Via& other) = delete;
61 std::shared_ptr<const QSet<const NetSignal*>>
62 highlightedNetSignals) noexcept;
63 virtual ~BGI_Via() noexcept;
64
65 // General Methods
66 BI_Via& getVia() noexcept { return mVia; }
67
68 // Inherited from QGraphicsItem
69 QRectF boundingRect() const noexcept override { return mBoundingRect; }
70 QPainterPath shape() const noexcept override;
71 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
72 QWidget* widget) noexcept override;
73
74 // Operator Overloadings
75 BGI_Via& operator=(const BGI_Via& rhs) = delete;
76
77private: // Methods
78 void viaEdited(const BI_Via& obj, BI_Via::Event event) noexcept;
79 void layerEdited(const GraphicsLayer& layer,
80 GraphicsLayer::Event event) noexcept;
81 virtual QVariant itemChange(GraphicsItemChange change,
82 const QVariant& value) noexcept override;
83 void updatePosition() noexcept;
84 void updateShapes() noexcept;
85 void updateToolTip() noexcept;
86 void updateText() noexcept;
87 void updateTextHeight() noexcept;
88 void updateVisibility() noexcept;
89 void attachToCopperLayers() noexcept;
90
91private: // Data
92 // General Attributes
95 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
96 std::shared_ptr<GraphicsLayer> mViaLayer;
100
102 QVector<std::shared_ptr<GraphicsLayer>> mBlindBuriedCopperLayers;
103
104 // Cached Attributes
105 QPainterPath mShape;
106 QPainterPath mCopper;
107 QPainterPath mStopMaskTop;
108 QPainterPath mStopMaskBottom;
110 QString mText;
111
112 // Slots
113 BI_Via::OnEditedSlot mOnEditedSlot;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124#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:53
void updateShapes() noexcept
Definition: bgi_via.cpp:222
virtual ~BGI_Via() noexcept
Definition: bgi_via.cpp:92
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: bgi_via.h:95
QRectF boundingRect() const noexcept override
Definition: bgi_via.h:69
void updateText() noexcept
Definition: bgi_via.cpp:262
void updatePosition() noexcept
Definition: bgi_via.cpp:218
void updateTextHeight() noexcept
Definition: bgi_via.cpp:275
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: bgi_via.cpp:155
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) noexcept override
Definition: bgi_via.cpp:103
QScopedPointer< PrimitivePathGraphicsItem > mTextGraphicsItem
Definition: bgi_via.h:99
void attachToCopperLayers() noexcept
Definition: bgi_via.cpp:304
BI_Via::OnEditedSlot mOnEditedSlot
Definition: bgi_via.h:113
QPainterPath mShape
Definition: bgi_via.h:105
BI_Via & getVia() noexcept
Definition: bgi_via.h:66
void updateToolTip() noexcept
Definition: bgi_via.cpp:243
std::shared_ptr< GraphicsLayer > mViaLayer
Definition: bgi_via.h:96
void viaEdited(const BI_Via &obj, BI_Via::Event event) noexcept
Definition: bgi_via.cpp:167
QPainterPath shape() const noexcept override
Definition: bgi_via.cpp:99
QString mText
Definition: bgi_via.h:110
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition: bgi_via.h:114
QPainterPath mStopMaskBottom
Definition: bgi_via.h:108
std::shared_ptr< GraphicsLayer > mTopStopMaskLayer
Definition: bgi_via.h:97
const IF_GraphicsLayerProvider & mLayerProvider
Definition: bgi_via.h:94
QPainterPath mStopMaskTop
Definition: bgi_via.h:107
QRectF mBoundingRect
Definition: bgi_via.h:109
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition: bgi_via.cpp:197
QPainterPath mCopper
Definition: bgi_via.h:106
QVector< std::shared_ptr< GraphicsLayer > > mBlindBuriedCopperLayers
Copper layers for blind- and buried vias (empty for through-hole vias)
Definition: bgi_via.h:102
void updateVisibility() noexcept
Definition: bgi_via.cpp:284
BGI_Via(const BGI_Via &other)=delete
BI_Via & mVia
Definition: bgi_via.h:93
std::shared_ptr< GraphicsLayer > mBottomStopMaskLayer
Definition: bgi_via.h:98
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 PrimitivePathGraphicsItem class.
Definition: primitivepathgraphicsitem.h:50
Definition: occmodel.cpp:77