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_CORE_BI_FOOTPRINTPAD_H
21#define LIBREPCB_CORE_BI_FOOTPRINTPAD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/path.h"
27#include "../../../library/pkg/footprintpad.h"
28#include "bi_device.h"
29#include "bi_netline.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class ComponentSignalInstance;
39class PackagePad;
40
41/*******************************************************************************
42 * Class BI_FootprintPad
43 ******************************************************************************/
44
48class BI_FootprintPad final : public BI_Base, public BI_NetLineAnchor {
49 Q_OBJECT
50
51public:
52 // Signals
53 enum class Event {
54 PositionChanged,
55 RotationChanged,
56 MirroredChanged,
57 TextChanged,
58 GeometriesChanged,
59 };
62
63 // Constructors / Destructor
64 BI_FootprintPad() = delete;
65 BI_FootprintPad(const BI_FootprintPad& other) = delete;
66 BI_FootprintPad(BI_Device& device, const Uuid& padUuid);
68
69 // Getters
70
76 const Point& getPosition() const noexcept override { return mPosition; }
77
83 const Angle& getRotation() const noexcept { return mRotation; }
84
90 bool getMirrored() const noexcept { return mMirrored; }
91
92 const QString& getText() const noexcept { return mText; }
93
94 const Uuid& getLibPadUuid() const noexcept;
95 BI_Device& getDevice() const noexcept { return mDevice; }
97 const Layer& getSmtLayer() const noexcept;
98 bool isOnLayer(const Layer& layer) const noexcept;
99 const FootprintPad& getLibPad() const noexcept { return *mFootprintPad; }
100 const PackagePad* getLibPackagePad() const noexcept { return mPackagePad; }
103 }
104 NetSignal* getCompSigInstNetSignal() const noexcept;
105 bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
106 const QHash<const Layer*, QList<PadGeometry>>& getGeometries()
107 const noexcept {
108 return mGeometries;
109 }
110 TraceAnchor toTraceAnchor() const noexcept override;
111
112 // General Methods
113 void addToBoard() override;
114 void removeFromBoard() override;
115
116 // Inherited from BI_NetLineAnchor
117 void registerNetLine(BI_NetLine& netline) override;
118 void unregisterNetLine(BI_NetLine& netline) override;
119 const QSet<BI_NetLine*>& getNetLines() const noexcept override {
120 return mRegisteredNetLines;
121 }
122
123 // Operator Overloadings
125
126private: // Methods
127 void deviceEdited(const BI_Device& obj, BI_Device::Event event) noexcept;
128 void netSignalChanged(NetSignal* from, NetSignal* to);
129 void updateTransform() noexcept;
130 void updateText() noexcept;
131 void updateGeometries() noexcept;
132 void invalidatePlanes() noexcept;
133 QString getLibraryDeviceName() const noexcept;
134 QString getComponentInstanceName() const noexcept;
135 QString getPadNameOrUuid() const noexcept;
136 QString getNetSignalName() const noexcept;
138 QList<PadGeometry> getGeometryOnLayer(const Layer& layer) const noexcept;
140 const Layer& layer) const noexcept;
141 bool isConnectedOnLayer(const Layer& layer) const noexcept;
142
143private: // Data
146
151
156
157 // Cached Properties
161 QString mText;
162 QHash<const Layer*, QList<PadGeometry>> mGeometries;
163
164 // Registered Elements
166
167 // Slots
169};
170
171/*******************************************************************************
172 * End of File
173 ******************************************************************************/
174
175} // namespace librepcb
176
177#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Board Item Base (BI_Base) class.
Definition: bi_base.h:45
The BI_Device class.
Definition: bi_device.h:57
Event
Definition: bi_device.h:62
The BI_FootprintPad class.
Definition: bi_footprintpad.h:48
void netSignalChanged(NetSignal *from, NetSignal *to)
Definition: bi_footprintpad.cpp:244
bool getMirrored() const noexcept
Get the absolute mirror state of the pad (global scene coordinates)
Definition: bi_footprintpad.h:90
const Angle & getRotation() const noexcept
Get the absolute rotation of the pad (global scene coordinates)
Definition: bi_footprintpad.h:83
BI_Device & mDevice
Definition: bi_footprintpad.h:144
const Point & getPosition() const noexcept override
Get the absolute position of the pad (global scene coordinates)
Definition: bi_footprintpad.h:76
void updateText() noexcept
Definition: bi_footprintpad.cpp:289
ComponentSignalInstance * getComponentSignalInstance() const noexcept
Definition: bi_footprintpad.h:101
const FootprintPad * mFootprintPad
Definition: bi_footprintpad.h:145
void removeFromBoard() override
Definition: bi_footprintpad.cpp:161
QString getNetSignalName() const noexcept
Definition: bi_footprintpad.cpp:361
bool isConnectedOnLayer(const Layer &layer) const noexcept
Definition: bi_footprintpad.cpp:487
const PackagePad * getLibPackagePad() const noexcept
Definition: bi_footprintpad.h:100
QHash< const Layer *, QList< PadGeometry > > mGeometries
Definition: bi_footprintpad.h:162
ComponentSignalInstance * mComponentSignalInstance
Definition: bi_footprintpad.h:155
bool isUsed() const noexcept
Definition: bi_footprintpad.h:105
Event
Definition: bi_footprintpad.h:53
const Layer & getSmtLayer() const noexcept
Definition: bi_footprintpad.cpp:118
QList< PadGeometry > getGeometryOnLayer(const Layer &layer) const noexcept
Definition: bi_footprintpad.cpp:382
QString mText
Definition: bi_footprintpad.h:161
FootprintPad::ComponentSide getComponentSide() const noexcept
Definition: bi_footprintpad.cpp:107
QString getPadNameOrUuid() const noexcept
Definition: bi_footprintpad.cpp:356
~BI_FootprintPad()
Definition: bi_footprintpad.cpp:95
const QSet< BI_NetLine * > & getNetLines() const noexcept override
Definition: bi_footprintpad.h:119
void invalidatePlanes() noexcept
Definition: bi_footprintpad.cpp:340
BI_FootprintPad(const BI_FootprintPad &other)=delete
void updateTransform() noexcept
Definition: bi_footprintpad.cpp:263
const QString & getText() const noexcept
Definition: bi_footprintpad.h:92
QString getComponentInstanceName() const noexcept
Definition: bi_footprintpad.cpp:352
Angle mRotation
Definition: bi_footprintpad.h:159
bool isOnLayer(const Layer &layer) const noexcept
Definition: bi_footprintpad.cpp:124
Signal< BI_FootprintPad, Event > onEdited
Definition: bi_footprintpad.h:60
void registerNetLine(BI_NetLine &netline) override
Definition: bi_footprintpad.cpp:173
void deviceEdited(const BI_Device &obj, BI_Device::Event event) noexcept
Definition: bi_footprintpad.cpp:223
QSet< BI_NetLine * > mRegisteredNetLines
Definition: bi_footprintpad.h:165
void unregisterNetLine(BI_NetLine &netline) override
Definition: bi_footprintpad.cpp:211
UnsignedLength getSizeForMaskOffsetCalculaton() const noexcept
Definition: bi_footprintpad.cpp:369
void updateGeometries() noexcept
Definition: bi_footprintpad.cpp:319
BI_FootprintPad & operator=(const BI_FootprintPad &rhs)=delete
void addToBoard() override
Definition: bi_footprintpad.cpp:149
const FootprintPad & getLibPad() const noexcept
Definition: bi_footprintpad.h:99
const PackagePad * mPackagePad
Definition: bi_footprintpad.h:150
TraceAnchor toTraceAnchor() const noexcept override
Definition: bi_footprintpad.cpp:140
NetSignal * getCompSigInstNetSignal() const noexcept
Definition: bi_footprintpad.cpp:132
BI_Device & getDevice() const noexcept
Definition: bi_footprintpad.h:95
BI_Device::OnEditedSlot mOnDeviceEditedSlot
Definition: bi_footprintpad.h:168
bool mMirrored
Definition: bi_footprintpad.h:160
Point mPosition
Definition: bi_footprintpad.h:158
const Uuid & getLibPadUuid() const noexcept
Definition: bi_footprintpad.cpp:103
QString getLibraryDeviceName() const noexcept
Definition: bi_footprintpad.cpp:348
const QHash< const Layer *, QList< PadGeometry > > & getGeometries() const noexcept
Definition: bi_footprintpad.h:106
Slot< BI_FootprintPad, Event > OnEditedSlot
Definition: bi_footprintpad.h:61
QList< PadGeometry > getGeometryOnCopperLayer(const Layer &layer) const noexcept
Definition: bi_footprintpad.cpp:432
Definition: bi_netline.h:46
The BI_NetLine class.
Definition: bi_netline.h:71
The ComponentSignalInstance class.
Definition: componentsignalinstance.h:49
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:55
ComponentSide
Definition: footprintpad.h:66
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The NetSignal class.
Definition: netsignal.h:50
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:47
The PadGeometry class describes the shape of a pad.
Definition: padgeometry.h:46
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
The TraceAnchor class.
Definition: trace.h:46
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696