LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sgi_netline.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_SGI_NETLINE_H
21 #define LIBREPCB_PROJECT_SGI_NETLINE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "sgi_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 SI_NetLine;
41 
42 /*******************************************************************************
43  * Class SGI_NetLine
44  ******************************************************************************/
45 
49 class SGI_NetLine final : public SGI_Base {
50 public:
51  // Constructors / Destructor
52  explicit SGI_NetLine(SI_NetLine& netline) noexcept;
53  ~SGI_NetLine() noexcept;
54 
55  // General Methods
56  void updateCacheAndRepaint() noexcept;
57 
58  // Inherited from QGraphicsItem
59  QRectF boundingRect() const { return mBoundingRect; }
60  QPainterPath shape() const { return mShape; }
61  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
62  QWidget* widget);
63 
64 private:
65  // make some methods inaccessible...
66  SGI_NetLine() = delete;
67  SGI_NetLine(const SGI_NetLine& other) = delete;
68  SGI_NetLine& operator=(const SGI_NetLine& rhs) = delete;
69 
70  // Private Methods
71  GraphicsLayer* getLayer(const QString& name) const noexcept;
72 
73  // Attributes
76 
77  // Cached Attributes
78  QLineF mLineF;
79  QRectF mBoundingRect;
80  QPainterPath mShape;
81 };
82 
83 /*******************************************************************************
84  * End of File
85  ******************************************************************************/
86 
87 } // namespace project
88 } // namespace librepcb
89 
90 #endif // LIBREPCB_PROJECT_SGI_NETLINE_H
QPainterPath shape() const
Definition: sgi_netline.h:60
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:54
QLineF mLineF
Definition: sgi_netline.h:78
void updateCacheAndRepaint() noexcept
Definition: sgi_netline.cpp:65
QPainterPath mShape
Definition: sgi_netline.h:80
QRectF mBoundingRect
Definition: sgi_netline.h:79
SI_NetLine & mNetLine
Definition: sgi_netline.h:74
SGI_NetLine & operator=(const SGI_NetLine &rhs)=delete
The Schematic Graphics Item Base (SGI_Base) class.
Definition: sgi_base.h:44
GraphicsLayer * getLayer(const QString &name) const noexcept
Definition: sgi_netline.cpp:134
GraphicsLayer * mLayer
Definition: sgi_netline.h:75
~SGI_NetLine() noexcept
Definition: sgi_netline.cpp:58
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: sgi_netline.cpp:90
QRectF boundingRect() const
Definition: sgi_netline.h:59
The SI_NetLine class.
Definition: si_netline.h:64
The SGI_NetLine class.
Definition: sgi_netline.h:49