LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgi_plane.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_PLANE_H
21 #define LIBREPCB_PROJECT_BGI_PLANE_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 Path;
37 class Polygon;
38 class GraphicsLayer;
39 
40 namespace project {
41 
42 class BI_Plane;
43 
44 /*******************************************************************************
45  * Class BGI_Plane
46  ******************************************************************************/
47 
51 class BGI_Plane final : public BGI_Base {
52 public:
53  // Constructors / Destructor
54  explicit BGI_Plane(BI_Plane& plane) noexcept;
55  ~BGI_Plane() noexcept;
56 
57  // Getters
58  bool isSelectable() const noexcept;
59 
60  // General Methods
61  void updateCacheAndRepaint() noexcept;
62 
63  // Inherited from QGraphicsItem
64  QRectF boundingRect() const noexcept { return mBoundingRect; }
65  QPainterPath shape() const noexcept { return mShape; }
66  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
67  QWidget* widget = 0);
68 
69 private:
70  // make some methods inaccessible...
71  BGI_Plane() = delete;
72  BGI_Plane(const BGI_Plane& other) = delete;
73  BGI_Plane& operator=(const BGI_Plane& rhs) = delete;
74 
75  // Private Methods
76  GraphicsLayer* getLayer(QString name) const noexcept;
77 
78  // General Attributes
80 
81  // Cached Attributes
83  QRectF mBoundingRect;
84  QPainterPath mShape;
85  QPainterPath mOutline;
86  QVector<QPainterPath> mAreas;
87 };
88 
89 /*******************************************************************************
90  * End of File
91  ******************************************************************************/
92 
93 } // namespace project
94 } // namespace librepcb
95 
96 #endif // LIBREPCB_PROJECT_BGI_PLANE_H
~BGI_Plane() noexcept
Definition: bgi_plane.cpp:52
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:50
The BGI_Plane class.
Definition: bgi_plane.h:51
QVector< QPainterPath > mAreas
Definition: bgi_plane.h:86
BI_Plane & mPlane
Definition: bgi_plane.h:79
QRectF mBoundingRect
Definition: bgi_plane.h:83
QPainterPath shape() const noexcept
Definition: bgi_plane.h:65
The BI_Plane class.
Definition: bi_plane.h:53
QPainterPath mOutline
Definition: bgi_plane.h:85
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: bgi_plane.cpp:94
The Board Graphics Item Base (BGI_Base) class.
Definition: bgi_base.h:44
BGI_Plane & operator=(const BGI_Plane &rhs)=delete
QRectF boundingRect() const noexcept
Definition: bgi_plane.h:64
QPainterPath mShape
Definition: bgi_plane.h:84
bool isSelectable() const noexcept
Definition: bgi_plane.cpp:59
void updateCacheAndRepaint() noexcept
Definition: bgi_plane.cpp:67
GraphicsLayer * mLayer
Definition: bgi_plane.h:82
GraphicsLayer * getLayer(QString name) const noexcept
Definition: bgi_plane.cpp:139