LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgi_footprintpad.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_FOOTPRINTPAD_H
21 #define LIBREPCB_PROJECT_BGI_FOOTPRINTPAD_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 library {
39 class FootprintPad;
40 class PackagePad;
41 } // namespace library
42 
43 namespace project {
44 
45 class BI_FootprintPad;
46 
47 /*******************************************************************************
48  * Class BGI_FootprintPad
49  ******************************************************************************/
50 
54 class BGI_FootprintPad final : public BGI_Base {
55 public:
56  // Constructors / Destructor
57  explicit BGI_FootprintPad(BI_FootprintPad& pad) noexcept;
58  ~BGI_FootprintPad() noexcept;
59 
60  // Getters
61  bool isSelectable() const noexcept;
62 
63  // General Methods
64  void updateCacheAndRepaint() noexcept;
65 
66  // Inherited from QGraphicsItem
67  QRectF boundingRect() const noexcept { return mBoundingRect; }
68  QPainterPath shape() const noexcept { return mShape; }
69  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
70  QWidget* widget = 0);
71 
72 private:
73  // make some methods inaccessible...
74  BGI_FootprintPad() = delete;
75  BGI_FootprintPad(const BGI_FootprintPad& other) = delete;
76  BGI_FootprintPad& operator=(const BGI_FootprintPad& rhs) = delete;
77 
78  // Private Methods
79  GraphicsLayer* getLayer(QString name) const noexcept;
80 
81  // General Attributes
84 
85  // Cached Attributes
91  QPainterPath mShape;
92  QPainterPath mCopper;
93  QPainterPath mStopMask;
94  QPainterPath mCreamMask;
95  QRectF mBoundingRect;
96  QFont mFont;
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace project
104 } // namespace librepcb
105 
106 #endif // LIBREPCB_PROJECT_BGI_FOOTPRINTPAD_H
GraphicsLayer * mTopStopMaskLayer
Definition: bgi_footprintpad.h:87
QRectF boundingRect() const noexcept
Definition: bgi_footprintpad.h:67
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:50
BI_FootprintPad & mPad
Definition: bgi_footprintpad.h:82
QPainterPath mCreamMask
Definition: bgi_footprintpad.h:94
bool isSelectable() const noexcept
Definition: bgi_footprintpad.cpp:77
QFont mFont
Definition: bgi_footprintpad.h:96
~BGI_FootprintPad() noexcept
Definition: bgi_footprintpad.cpp:70
const library::FootprintPad & mLibPad
Definition: bgi_footprintpad.h:83
GraphicsLayer * getLayer(QString name) const noexcept
Definition: bgi_footprintpad.cpp:208
GraphicsLayer * mBottomCreamMaskLayer
Definition: bgi_footprintpad.h:90
QPainterPath shape() const noexcept
Definition: bgi_footprintpad.h:68
GraphicsLayer * mBottomStopMaskLayer
Definition: bgi_footprintpad.h:88
GraphicsLayer * mPadLayer
Definition: bgi_footprintpad.h:86
The BGI_FootprintPad class.
Definition: bgi_footprintpad.h:54
The BI_FootprintPad class.
Definition: bi_footprintpad.h:56
The Board Graphics Item Base (BGI_Base) class.
Definition: bgi_base.h:44
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: bgi_footprintpad.cpp:137
QPainterPath mStopMask
Definition: bgi_footprintpad.h:93
GraphicsLayer * mTopCreamMaskLayer
Definition: bgi_footprintpad.h:89
QPainterPath mShape
Definition: bgi_footprintpad.h:91
QPainterPath mCopper
Definition: bgi_footprintpad.h:92
BGI_FootprintPad & operator=(const BGI_FootprintPad &rhs)=delete
QRectF mBoundingRect
Definition: bgi_footprintpad.h:95
void updateCacheAndRepaint() noexcept
Definition: bgi_footprintpad.cpp:85