LibrePCB Developers Documentation
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);
64  ~BI_FootprintPad();
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  }
77  return mComponentSignalInstance;
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  TraceAnchor toTraceAnchor() const noexcept override;
85 
86  // General Methods
87  void addToBoard() override;
88  void removeFromBoard() override;
89  void updatePosition() noexcept;
90 
91  // Inherited from BI_Base
92  Type_t getType() const noexcept override {
93  return BI_Base::Type_t::FootprintPad;
94  }
95  const Point& getPosition() const noexcept override { return mPosition; }
96  bool getIsMirrored() const noexcept override;
97  QPainterPath getGrabAreaScenePx() const noexcept override;
98  void setSelected(bool selected) noexcept override;
99 
100  // Inherited from BI_NetLineAnchor
101  void registerNetLine(BI_NetLine& netline) override;
102  void unregisterNetLine(BI_NetLine& netline) override;
103  const QSet<BI_NetLine*>& getNetLines() const noexcept override {
104  return mRegisteredNetLines;
105  }
106 
107  // Operator Overloadings
108  BI_FootprintPad& operator=(const BI_FootprintPad& rhs) = delete;
109 
110 private slots:
111 
112  void footprintAttributesChanged();
113  void componentSignalInstanceNetSignalChanged(NetSignal* from, NetSignal* to);
114 
115 private:
116  void updateGraphicsItemTransform() noexcept;
117 
118  // General
123  QMetaObject::Connection mHighlightChangedConnection;
124  QMetaObject::Connection mNetSignalNameChangedConnection;
125 
126  // Misc
129  QScopedPointer<BGI_FootprintPad> mGraphicsItem;
130 
131  // Registered Elements
132  QSet<BI_NetLine*> mRegisteredNetLines;
133 };
134 
135 /*******************************************************************************
136  * End of File
137  ******************************************************************************/
138 
139 } // namespace project
140 } // namespace librepcb
141 
142 #endif // LIBREPCB_PROJECT_BI_FOOTPRINTPAD_H
const QSet< BI_NetLine * > & getNetLines() const noexcept override
Definition: bi_footprintpad.h:103
ComponentSignalInstance * mComponentSignalInstance
Definition: bi_footprintpad.h:122
const library::PackagePad * mPackagePad
Definition: bi_footprintpad.h:121
QSet< BI_NetLine * > mRegisteredNetLines
Definition: bi_footprintpad.h:132
Definition: airwiresbuilder.cpp:32
const Point & getPosition() const noexcept override
Definition: bi_footprintpad.h:95
The TraceAnchor class.
Definition: trace.h:47
Type_t
Definition: bi_base.h:57
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
Type_t getType() const noexcept override
Definition: bi_footprintpad.h:92
Point mPosition
Definition: bi_footprintpad.h:127
BI_Footprint & mFootprint
Definition: bi_footprintpad.h:119
BI_Footprint & getFootprint() const noexcept
Definition: bi_footprintpad.h:70
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
The BI_FootprintPad class.
Definition: bi_footprintpad.h:56
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:128
const library::FootprintPad & getLibPad() const noexcept
Definition: bi_footprintpad.h:73
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:120
Definition: bi_netline.h:51
QScopedPointer< BGI_FootprintPad > mGraphicsItem
Definition: bi_footprintpad.h:129
QMetaObject::Connection mNetSignalNameChangedConnection
Definition: bi_footprintpad.h:124
QMetaObject::Connection mHighlightChangedConnection
Definition: bi_footprintpad.h:123
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
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:82
The BI_NetLine class.
Definition: bi_netline.h:76
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:51