LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_PROJECT_BGI_AIRWIRE_H
21 #define LIBREPCB_PROJECT_BGI_AIRWIRE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "bgi_base.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class GraphicsLayer;
37 
38 namespace project {
39 
40 class BI_AirWire;
41 
42 /*******************************************************************************
43  * Class BGI_AirWire
44  ******************************************************************************/
45 
49 class BGI_AirWire final : public BGI_Base {
50 public:
51  // Constructors / Destructor
52  explicit BGI_AirWire(BI_AirWire& airwire) noexcept;
53  ~BGI_AirWire() noexcept;
54 
55  // Getters
56  bool isSelectable() const noexcept;
57 
58  // General Methods
59  void updateCacheAndRepaint() noexcept;
60 
61  // Inherited from QGraphicsItem
62  QRectF boundingRect() const { return mBoundingRect; }
63  QPainterPath shape() const { return mShape; }
64  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
65  QWidget* widget);
66 
67 private:
68  // make some methods inaccessible...
69  BGI_AirWire() = delete;
70  BGI_AirWire(const BGI_AirWire& other) = delete;
71  BGI_AirWire& operator=(const BGI_AirWire& rhs) = delete;
72 
73  // Private Methods
74  GraphicsLayer* getLayer(const QString& name) const noexcept;
75 
76  // Attributes
79 
80  // Cached Attributes
81  QVector<QLineF> mLines;
82  QRectF mBoundingRect;
83  QPainterPath mShape;
84 };
85 
86 /*******************************************************************************
87  * End of File
88  ******************************************************************************/
89 
90 } // namespace project
91 } // namespace librepcb
92 
93 #endif // LIBREPCB_PROJECT_BGI_AIRWIRE_H
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:54
BGI_AirWire & operator=(const BGI_AirWire &rhs)=delete
QVector< QLineF > mLines
Definition: bgi_airwire.h:81
QRectF boundingRect() const
Definition: bgi_airwire.h:62
bool isSelectable() const noexcept
Definition: bgi_airwire.cpp:58
BI_AirWire & mAirWire
Definition: bgi_airwire.h:77
GraphicsLayer * getLayer(const QString &name) const noexcept
Definition: bgi_airwire.cpp:133
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: bgi_airwire.cpp:94
QRectF mBoundingRect
Definition: bgi_airwire.h:82
The Board Graphics Item Base (BGI_Base) class.
Definition: bgi_base.h:44
The BGI_AirWire class.
Definition: bgi_airwire.h:49
~BGI_AirWire() noexcept
Definition: bgi_airwire.cpp:51
void updateCacheAndRepaint() noexcept
Definition: bgi_airwire.cpp:66
QPainterPath shape() const
Definition: bgi_airwire.h:63
QPainterPath mShape
Definition: bgi_airwire.h:83
The BI_AirWire class.
Definition: bi_airwire.h:44
GraphicsLayer * mLayer
Definition: bgi_airwire.h:78