LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bi_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_BI_FOOTPRINTPAD_H
21 #define LIBREPCB_PROJECT_BI_FOOTPRINTPAD_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../graphicsitems/bgi_footprintpad.h"
27 #include "./bi_netline.h"
28 #include "bi_base.h"
29 
31 
32 #include <QtCore>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 
39 namespace library {
40 class FootprintPad;
41 class ComponentSignal;
42 } // namespace library
43 
44 namespace project {
45 
46 class BI_Footprint;
47 class ComponentSignalInstance;
48 
49 /*******************************************************************************
50  * Class BI_FootprintPad
51  ******************************************************************************/
52 
56 class BI_FootprintPad final : public BI_Base, public BI_NetLineAnchor {
57  Q_OBJECT
58 
59 public:
60  // Constructors / Destructor
61  BI_FootprintPad() = delete;
62  BI_FootprintPad(const BI_FootprintPad& other) = delete;
63  BI_FootprintPad(BI_Footprint& footprint, const Uuid& padUuid);
65 
66  // Getters
67  const Uuid& getLibPadUuid() const noexcept;
68  QString getDisplayText() const noexcept;
69  const Angle& getRotation() const noexcept { return mRotation; }
70  BI_Footprint& getFootprint() const noexcept { return mFootprint; }
71  QString getLayerName() const noexcept;
72  bool isOnLayer(const QString& layerName) const noexcept;
73  const library::FootprintPad& getLibPad() const noexcept {
74  return *mFootprintPad;
75  }
78  }
79  NetSignal* getCompSigInstNetSignal() const noexcept;
80  bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
81  bool isSelectable() const noexcept override;
82  Path getOutline(const Length& expansion = Length(0)) const noexcept;
83  Path getSceneOutline(const Length& expansion = Length(0)) const noexcept;
84 
85  // General Methods
86  void addToBoard() override;
87  void removeFromBoard() override;
88  void updatePosition() noexcept;
89 
90  // Inherited from BI_Base
91  Type_t getType() const noexcept override {
93  }
94  const Point& getPosition() const noexcept override { return mPosition; }
95  bool getIsMirrored() const noexcept override;
96  QPainterPath getGrabAreaScenePx() const noexcept override;
97  void setSelected(bool selected) noexcept override;
98 
99  // Inherited from BI_NetLineAnchor
100  void registerNetLine(BI_NetLine& netline) override;
101  void unregisterNetLine(BI_NetLine& netline) override;
102  const QSet<BI_NetLine*>& getNetLines() const noexcept override {
103  return mRegisteredNetLines;
104  }
105 
106  // Operator Overloadings
107  BI_FootprintPad& operator=(const BI_FootprintPad& rhs) = delete;
108 
109 private slots:
110 
113 
114 private:
115  void updateGraphicsItemTransform() noexcept;
116 
117  // General
119  const library::FootprintPad* mFootprintPad;
120  const library::PackagePad* mPackagePad;
122  QMetaObject::Connection mHighlightChangedConnection;
123 
124  // Misc
128 
129  // Registered Elements
131 };
132 
133 /*******************************************************************************
134  * End of File
135  ******************************************************************************/
136 
137 } // namespace project
138 } // namespace librepcb
139 
140 #endif // LIBREPCB_PROJECT_BI_FOOTPRINTPAD_H
ComponentSignalInstance * mComponentSignalInstance
Definition: bi_footprintpad.h:121
void componentSignalInstanceNetSignalChanged(NetSignal *from, NetSignal *to)
Definition: bi_footprintpad.cpp:225
const library::PackagePad * mPackagePad
Definition: bi_footprintpad.h:120
void removeFromBoard() override
Definition: bi_footprintpad.cpp:144
void addToBoard() override
Definition: bi_footprintpad.cpp:133
Path getSceneOutline(const Length &expansion=Length(0)) const noexcept
Definition: bi_footprintpad.cpp:213
QSet< BI_NetLine * > mRegisteredNetLines
Definition: bi_footprintpad.h:130
bool isSelectable() const noexceptoverride
Definition: bi_footprintpad.cpp:200
QString getLayerName() const noexcept
Definition: bi_footprintpad.cpp:105
Type_t
Definition: bi_base.h:57
const Uuid & getLibPadUuid() const noexcept
Definition: bi_footprintpad.cpp:92
void unregisterNetLine(BI_NetLine &netline) override
Definition: bi_footprintpad.cpp:171
bool isUsed() const noexcept
Definition: bi_footprintpad.h:80
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
void updateGraphicsItemTransform() noexcept
Definition: bi_footprintpad.cpp:244
Point mPosition
Definition: bi_footprintpad.h:125
BI_Footprint & mFootprint
Definition: bi_footprintpad.h:118
BI_Footprint & getFootprint() const noexcept
Definition: bi_footprintpad.h:70
QString getDisplayText() const noexcept
Definition: bi_footprintpad.cpp:96
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
The BI_Footprint class.
Definition: bi_footprint.h:57
bool getIsMirrored() const noexceptoverride
Definition: bi_footprintpad.cpp:192
NetSignal * getCompSigInstNetSignal() const noexcept
Definition: bi_footprintpad.cpp:121
The BGI_FootprintPad class.
Definition: bgi_footprintpad.h:54
The BI_FootprintPad class.
Definition: bi_footprintpad.h:56
void registerNetLine(BI_NetLine &netline) override
Definition: bi_footprintpad.cpp:155
ComponentSignalInstance * getComponentSignalInstance() const noexcept
Definition: bi_footprintpad.h:76
The Board Item Base (BI_Base) class.
Definition: bi_base.h:52
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
Angle mRotation
Definition: bi_footprintpad.h:126
const library::FootprintPad & getLibPad() const noexcept
Definition: bi_footprintpad.h:73
const Point & getPosition() const noexceptoverride
Definition: bi_footprintpad.h:94
void updatePosition() noexcept
Definition: bi_footprintpad.cpp:179
The Path class represents a list of vertices connected by straight lines or circular arc segments...
Definition: path.h:53
const library::FootprintPad * mFootprintPad
Definition: bi_footprintpad.h:119
Definition: bi_netline.h:51
librepcb::project::BI_FootprintPad
void setSelected(bool selected) noexceptoverride
Definition: bi_footprintpad.cpp:204
const QSet< BI_NetLine * > & getNetLines() const noexceptoverride
Definition: bi_footprintpad.h:102
bool isOnLayer(const QString &layerName) const noexcept
Definition: bi_footprintpad.cpp:112
QScopedPointer< BGI_FootprintPad > mGraphicsItem
Definition: bi_footprintpad.h:127
QMetaObject::Connection mHighlightChangedConnection
Definition: bi_footprintpad.h:122
The NetSignal class.
Definition: netsignal.h:56
const Angle & getRotation() const noexcept
Definition: bi_footprintpad.h:69
The ComponentSignalInstance class.
Definition: componentsignalinstance.h:61
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Type_t getType() const noexceptoverride
Definition: bi_footprintpad.h:91
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:82
~BI_FootprintPad()
Definition: bi_footprintpad.cpp:83
void footprintAttributesChanged()
Definition: bi_footprintpad.cpp:221
Path getOutline(const Length &expansion=Length(0)) const noexcept
Definition: bi_footprintpad.cpp:209
The BI_NetLine class.
Definition: bi_netline.h:74
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:51
QPainterPath getGrabAreaScenePx() const noexceptoverride
Definition: bi_footprintpad.cpp:196
BI_FootprintPad & operator=(const BI_FootprintPad &rhs)=delete