LibrePCB Developers Documentation
bgi_airwire.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_AIRWIRE_H
21 #define LIBREPCB_EDITOR_BGI_AIRWIRE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../../graphics/graphicslayer.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 #include <memory>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class BI_AirWire;
39 class NetSignal;
40 
41 namespace editor {
42 
43 class GraphicsLayer;
44 class IF_GraphicsLayerProvider;
45 
46 /*******************************************************************************
47  * Class BGI_AirWire
48  ******************************************************************************/
49 
53 class BGI_AirWire final : public QGraphicsItem {
54 public:
55  // Constructors / Destructor
56  BGI_AirWire() = delete;
57  BGI_AirWire(const BGI_AirWire& other) = delete;
59  std::shared_ptr<const QSet<const NetSignal*>>
60  highlightedNetSignals) noexcept;
61  virtual ~BGI_AirWire() noexcept;
62 
63  // General Methods
64  BI_AirWire& getAirWire() noexcept { return mAirWire; }
65 
66  // Inherited from QGraphicsItem
67  QRectF boundingRect() const { return mBoundingRect; }
68  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
69  QWidget* widget);
70 
71  // Operator Overloadings
72  BGI_AirWire& operator=(const BGI_AirWire& rhs) = delete;
73 
74 private: // Methods
75  void layerEdited(const GraphicsLayer& layer,
76  GraphicsLayer::Event event) noexcept;
77 
78 private: // Data
80  std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
81  std::shared_ptr<GraphicsLayer> mLayer;
82 
83  // Cached Attributes
84  QVector<QLineF> mLines;
85  QRectF mBoundingRect;
86 
87  // Slots
89 };
90 
91 /*******************************************************************************
92  * End of File
93  ******************************************************************************/
94 
95 } // namespace editor
96 } // namespace librepcb
97 
98 #endif
QRectF mBoundingRect
Definition: bgi_airwire.h:85
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: bgi_airwire.h:80
The BGI_AirWire class.
Definition: bgi_airwire.h:53
Definition: occmodel.cpp:77
The BI_AirWire class.
Definition: bi_airwire.h:45
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition: bgi_airwire.h:88
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:53
QRectF boundingRect() const
Definition: bgi_airwire.h:67
virtual ~BGI_AirWire() noexcept
Definition: bgi_airwire.cpp:80
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:111
BI_AirWire & mAirWire
Definition: bgi_airwire.h:79
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: bgi_airwire.cpp:87
BI_AirWire & getAirWire() noexcept
Definition: bgi_airwire.h:64
std::shared_ptr< GraphicsLayer > mLayer
Definition: bgi_airwire.h:81
QVector< QLineF > mLines
Definition: bgi_airwire.h:84
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition: bgi_airwire.cpp:114
Event
Definition: graphicslayer.h:58
BGI_AirWire & operator=(const BGI_AirWire &rhs)=delete