LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgi_footprint.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_FOOTPRINT_H
21 #define LIBREPCB_PROJECT_BGI_FOOTPRINT_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 StrokeText;
37 class GraphicsLayer;
38 
39 namespace library {
40 class Footprint;
41 }
42 
43 namespace project {
44 
45 class BI_Footprint;
46 
47 /*******************************************************************************
48  * Class BGI_Footprint
49  ******************************************************************************/
50 
57 class BGI_Footprint final : public BGI_Base {
58 public:
59  // Constructors / Destructor
60  explicit BGI_Footprint(BI_Footprint& footprint) noexcept;
61  ~BGI_Footprint() noexcept;
62 
63  // Getters
64  bool isSelectable() const noexcept;
65 
66  // General Methods
67  void updateCacheAndRepaint() noexcept;
68 
69  // Inherited from QGraphicsItem
70  QRectF boundingRect() const noexcept { return mBoundingRect; }
71  QPainterPath shape() const noexcept { return mShape; }
72  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
73  QWidget* widget = 0);
74 
75 private:
76  // make some methods inaccessible...
77  BGI_Footprint() = delete;
78  BGI_Footprint(const BGI_Footprint& other) = delete;
79  BGI_Footprint& operator=(const BGI_Footprint& rhs) = delete;
80 
81  // Private Methods
82  GraphicsLayer* getLayer(QString name) const noexcept;
83 
84  // General Attributes
87 
88  // Cached Attributes
89  QRectF mBoundingRect;
90  QPainterPath mShape;
91 };
92 
93 /*******************************************************************************
94  * End of File
95  ******************************************************************************/
96 
97 } // namespace project
98 } // namespace librepcb
99 
100 #endif // LIBREPCB_PROJECT_BGI_FOOTPRINT_H
QRectF mBoundingRect
Definition: bgi_footprint.h:89
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:54
GraphicsLayer * getLayer(QString name) const noexcept
Definition: bgi_footprint.cpp:251
BGI_Footprint & operator=(const BGI_Footprint &rhs)=delete
The BGI_Footprint class.
Definition: bgi_footprint.h:57
~BGI_Footprint() noexcept
Definition: bgi_footprint.cpp:55
const library::Footprint & mLibFootprint
Definition: bgi_footprint.h:86
The BI_Footprint class.
Definition: bi_footprint.h:60
The Board Graphics Item Base (BGI_Base) class.
Definition: bgi_base.h:44
bool isSelectable() const noexcept
Definition: bgi_footprint.cpp:62
void updateCacheAndRepaint() noexcept
Definition: bgi_footprint.cpp:71
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: bgi_footprint.cpp:123
QRectF boundingRect() const noexcept
Definition: bgi_footprint.h:70
QPainterPath mShape
Definition: bgi_footprint.h:90
QPainterPath shape() const noexcept
Definition: bgi_footprint.h:71
The Footprint class represents one footprint variant of a package.
Definition: footprint.h:61
BI_Footprint & mFootprint
Definition: bgi_footprint.h:85