LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgi_via.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_VIA_H
21 #define LIBREPCB_PROJECT_BGI_VIA_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_Via;
41 
42 /*******************************************************************************
43  * Class BGI_Via
44  ******************************************************************************/
45 
49 class BGI_Via final : public BGI_Base {
50 public:
51  // Constructors / Destructor
52  explicit BGI_Via(BI_Via& via) noexcept;
53  ~BGI_Via() 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 noexcept { return mShape; }
64  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
65  QWidget* widget);
66 
67 private:
68  // make some methods inaccessible...
69  BGI_Via() = delete;
70  BGI_Via(const BGI_Via& other) = delete;
71  BGI_Via& operator=(const BGI_Via& rhs) = delete;
72 
73  // Private Methods
74  GraphicsLayer* getLayer(const QString& name) const noexcept;
75 
76  // General Attributes
81 
82  // Cached Attributes
84  QPainterPath mShape;
85  QPainterPath mCopper;
86  QPainterPath mStopMask;
87  QPainterPath mCreamMask;
88  QRectF mBoundingRect;
89  QFont mFont;
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace project
97 } // namespace librepcb
98 
99 #endif // LIBREPCB_PROJECT_BGI_VIA_H
BI_Via & mVia
Definition: bgi_via.h:77
QPainterPath mShape
Definition: bgi_via.h:84
GraphicsLayer * mTopStopMaskLayer
Definition: bgi_via.h:79
~BGI_Via() noexcept
Definition: bgi_via.cpp:62
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition: graphicslayer.h:50
QFont mFont
Definition: bgi_via.h:89
GraphicsLayer * mViaLayer
Definition: bgi_via.h:78
GraphicsLayer * getLayer(const QString &name) const noexcept
Definition: bgi_via.cpp:158
void updateCacheAndRepaint() noexcept
Definition: bgi_via.cpp:77
The Board Graphics Item Base (BGI_Base) class.
Definition: bgi_base.h:44
QRectF boundingRect() const
Definition: bgi_via.h:62
QPainterPath shape() const noexcept
Definition: bgi_via.h:63
bool mDrawStopMask
Definition: bgi_via.h:83
QPainterPath mCreamMask
Definition: bgi_via.h:87
The BGI_Via class.
Definition: bgi_via.h:49
BGI_Via & operator=(const BGI_Via &rhs)=delete
QPainterPath mStopMask
Definition: bgi_via.h:86
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: bgi_via.cpp:105
QRectF mBoundingRect
Definition: bgi_via.h:88
The BI_Via class.
Definition: bi_via.h:49
bool isSelectable() const noexcept
Definition: bgi_via.cpp:69
QPainterPath mCopper
Definition: bgi_via.h:85
GraphicsLayer * mBottomStopMaskLayer
Definition: bgi_via.h:80