LibrePCB Developers Documentation
Loading...
Searching...
No Matches
bi_pad.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_PAD_H
21#define LIBREPCB_CORE_BI_PAD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/path.h"
27#include "../boardpaddata.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 FootprintPad;
40class PackagePad;
41
42/*******************************************************************************
43 * Class BI_Pad
44 ******************************************************************************/
45
49class BI_Pad final : public BI_Base, public BI_NetLineAnchor {
50 Q_OBJECT
51
52public:
53 // Signals
78
79 // Constructors / Destructor
80 BI_Pad() = delete;
81 BI_Pad(const BI_Pad& other) = delete;
91 BI_Pad(BI_NetSegment& netsegment, const BoardPadData& properties);
101 BI_Pad(BI_Device& device, const Uuid& padUuid);
102 ~BI_Pad() noexcept;
103
104 // Getters
105 BI_NetSegment* getNetSegment() const noexcept { return mNetSegment; }
106 BI_Device* getDevice() const noexcept { return mDevice; }
107 const PackagePad* getLibPackagePad() const noexcept { return mPackagePad; }
111 NetSignal* getNetSignal() const noexcept;
112 const BoardPadData& getProperties() const noexcept { return mProperties; }
113 const Uuid& getUuid() const noexcept { return mProperties.getUuid(); }
114
120 const Point& getPosition() const noexcept override { return mPosition; }
121
127 const Angle& getRotation() const noexcept { return mRotation; }
128
134 bool getMirrored() const noexcept { return mMirrored; }
135
136 Pad::ComponentSide getComponentSide() const noexcept;
137 const Layer& getSolderLayer() const noexcept;
138 bool isOnLayer(const Layer& layer) const noexcept;
139 const QString& getText() const noexcept { return mText; }
140 bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
141 const QHash<const Layer*, QList<PadGeometry>>& getGeometries()
142 const noexcept {
143 return mGeometries;
144 }
145 TraceAnchor toTraceAnchor() const noexcept override;
146
147 // Setters
148 void setPosition(const Point& position) noexcept;
149 void setRotation(const Angle& rotation) noexcept;
150 void setShape(Pad::Shape shape) noexcept;
151 void setWidth(const PositiveLength& width) noexcept;
152 void setHeight(const PositiveLength& height) noexcept;
153 void setRadius(const UnsignedLimitedRatio& radius) noexcept;
154 void setCustomShapeOutline(const Path& outline) noexcept;
155 void setStopMaskConfig(const MaskConfig& config) noexcept;
156 void setSolderPasteConfig(const MaskConfig& config) noexcept;
157 void setCopperClearance(const UnsignedLength& clearance) noexcept;
158 void setComponentSideAndHoles(Pad::ComponentSide side,
159 const PadHoleList& holes);
160 void setFunction(Pad::Function function) noexcept;
161 void setLocked(bool locked) noexcept;
162
163 // General Methods
164 void addToBoard() override;
165 void removeFromBoard() override;
166
167 // Inherited from BI_NetLineAnchor
168 void registerNetLine(BI_NetLine& netline) override;
169 void unregisterNetLine(BI_NetLine& netline) override;
170 const QSet<BI_NetLine*>& getNetLines() const noexcept override {
171 return mRegisteredNetLines;
172 }
173
174 // Operator Overloadings
175 BI_Pad& operator=(const BI_Pad& rhs) = delete;
176
177private: // Methods
178 void deviceEdited(const BI_Device& obj, BI_Device::Event event) noexcept;
179 void netSignalChanged(NetSignal* from, NetSignal* to);
180 void updateTransform() noexcept;
181 void updateText() noexcept;
182 void updateGeometries() noexcept;
183 void invalidatePlanes() noexcept;
184 QString getLibraryDeviceName() const noexcept;
185 QString getComponentInstanceName() const noexcept;
186 QString getPadNameOrUuid() const noexcept;
187 QString getNetSignalName() const noexcept;
189 QList<PadGeometry> getGeometryOnLayer(const Layer& layer) const noexcept;
191 const Layer& layer) const noexcept;
192 bool isConnectedOnLayer(const Layer& layer) const noexcept;
193
194private: // Data
199
204
209
215
221
231
232 // Cached Properties
236 QString mText;
237 QHash<const Layer*, QList<PadGeometry>> mGeometries;
238
239 // Registered Elements
241
242 // Slots
244};
245
246/*******************************************************************************
247 * End of File
248 ******************************************************************************/
249
250} // namespace librepcb
251
252#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
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
Definition bi_netline.h:46
The BI_NetLine class.
Definition bi_netline.h:71
The BI_NetSegment class.
Definition bi_netsegment.h:53
A pad in a board (either standalone or from a footprint)
Definition bi_pad.h:49
void netSignalChanged(NetSignal *from, NetSignal *to)
Definition bi_pad.cpp:420
void setFunction(Pad::Function function) noexcept
Definition bi_pad.cpp:300
bool getMirrored() const noexcept
Get the absolute mirror state of the pad (global scene coordinates)
Definition bi_pad.h:134
Slot< BI_Pad, Event > OnEditedSlot
Definition bi_pad.h:77
void setRadius(const UnsignedLimitedRatio &radius) noexcept
Definition bi_pad.cpp:224
void setStopMaskConfig(const MaskConfig &config) noexcept
Definition bi_pad.cpp:242
void setShape(Pad::Shape shape) noexcept
Definition bi_pad.cpp:197
const Angle & getRotation() const noexcept
Get the absolute rotation of the pad (global scene coordinates)
Definition bi_pad.h:127
const Point & getPosition() const noexcept override
Get the absolute position of the pad (global scene coordinates)
Definition bi_pad.h:120
void updateText() noexcept
Definition bi_pad.cpp:471
void setComponentSideAndHoles(Pad::ComponentSide side, const PadHoleList &holes)
Definition bi_pad.cpp:269
ComponentSignalInstance * getComponentSignalInstance() const noexcept
Definition bi_pad.h:108
BI_NetSegment * mNetSegment
Definition bi_pad.h:198
const FootprintPad * mFootprintPad
Definition bi_pad.h:208
void removeFromBoard() override
Definition bi_pad.cpp:332
Pad::ComponentSide getComponentSide() const noexcept
Definition bi_pad.cpp:138
BI_Pad(const BI_Pad &other)=delete
QString getNetSignalName() const noexcept
Definition bi_pad.cpp:545
bool isConnectedOnLayer(const Layer &layer) const noexcept
Definition bi_pad.cpp:666
BI_Device * mDevice
Definition bi_pad.h:203
const PackagePad * getLibPackagePad() const noexcept
Definition bi_pad.h:107
QHash< const Layer *, QList< PadGeometry > > mGeometries
Definition bi_pad.h:237
BI_NetSegment * getNetSegment() const noexcept
Definition bi_pad.h:105
ComponentSignalInstance * mComponentSignalInstance
Definition bi_pad.h:220
bool isUsed() const noexcept
Definition bi_pad.h:140
Event
Definition bi_pad.h:54
void setWidth(const PositiveLength &width) noexcept
Definition bi_pad.cpp:206
QList< PadGeometry > getGeometryOnLayer(const Layer &layer) const noexcept
Definition bi_pad.cpp:565
NetSignal * getNetSignal() const noexcept
Definition bi_pad.cpp:128
QString mText
Definition bi_pad.h:236
QString getPadNameOrUuid() const noexcept
Definition bi_pad.cpp:541
const QSet< BI_NetLine * > & getNetLines() const noexcept override
Definition bi_pad.h:170
void invalidatePlanes() noexcept
Definition bi_pad.cpp:524
const Layer & getSolderLayer() const noexcept
Definition bi_pad.cpp:148
void updateTransform() noexcept
Definition bi_pad.cpp:434
const QString & getText() const noexcept
Definition bi_pad.h:139
QString getComponentInstanceName() const noexcept
Definition bi_pad.cpp:537
~BI_Pad() noexcept
Definition bi_pad.cpp:120
BI_Pad & operator=(const BI_Pad &rhs)=delete
Angle mRotation
Definition bi_pad.h:234
const BoardPadData & getProperties() const noexcept
Definition bi_pad.h:112
bool isOnLayer(const Layer &layer) const noexcept
Definition bi_pad.cpp:160
void registerNetLine(BI_NetLine &netline) override
Definition bi_pad.cpp:344
void setSolderPasteConfig(const MaskConfig &config) noexcept
Definition bi_pad.cpp:251
void deviceEdited(const BI_Device &obj, BI_Device::Event event) noexcept
Definition bi_pad.cpp:399
QSet< BI_NetLine * > mRegisteredNetLines
Definition bi_pad.h:240
BoardPadData mProperties
Definition bi_pad.h:230
void setRotation(const Angle &rotation) noexcept
Definition bi_pad.cpp:189
const Uuid & getUuid() const noexcept
Definition bi_pad.h:113
void unregisterNetLine(BI_NetLine &netline) override
Definition bi_pad.cpp:387
UnsignedLength getSizeForMaskOffsetCalculaton() const noexcept
Definition bi_pad.cpp:553
void setCustomShapeOutline(const Path &outline) noexcept
Definition bi_pad.cpp:233
void updateGeometries() noexcept
Definition bi_pad.cpp:503
void addToBoard() override
Definition bi_pad.cpp:320
Signal< BI_Pad, Event > onEdited
Definition bi_pad.h:76
const PackagePad * mPackagePad
Definition bi_pad.h:214
BI_Device * getDevice() const noexcept
Definition bi_pad.h:106
TraceAnchor toTraceAnchor() const noexcept override
Definition bi_pad.cpp:168
void setHeight(const PositiveLength &height) noexcept
Definition bi_pad.cpp:215
BI_Device::OnEditedSlot mOnDeviceEditedSlot
Definition bi_pad.h:243
void setLocked(bool locked) noexcept
Definition bi_pad.cpp:308
bool mMirrored
Definition bi_pad.h:235
Point mPosition
Definition bi_pad.h:233
void setCopperClearance(const UnsignedLength &clearance) noexcept
Definition bi_pad.cpp:260
void setPosition(const Point &position) noexcept
Definition bi_pad.cpp:181
QString getLibraryDeviceName() const noexcept
Definition bi_pad.cpp:532
const QHash< const Layer *, QList< PadGeometry > > & getGeometries() const noexcept
Definition bi_pad.h:141
QList< PadGeometry > getGeometryOnCopperLayer(const Layer &layer) const noexcept
Definition bi_pad.cpp:613
The BoardPadData class represents a pad in a board.
Definition boardpaddata.h:43
The ComponentSignalInstance class.
Definition componentsignalinstance.h:49
The FootprintPad class represents a pad of a footprint.
Definition footprintpad.h:43
The Layer class provides all supported geometry layers.
Definition layer.h:42
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition maskconfig.h:45
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
Base class for pads, extended in derived classes.
Definition pad.h:53
ComponentSide
Definition pad.h:64
const Uuid & getUuid() const noexcept
Definition pad.h:96
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition path.h:59
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The Slot class is used to receive signals from non-QObject derived classes.
Definition signalslot.h:170
The TraceAnchor class.
Definition trace.h:45
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
type_safe::constrained_type< Ratio, UnsignedLimitedRatioConstraint, UnsignedLimitedRatioVerifier > UnsignedLimitedRatio
Definition ratio.h:376