LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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_FOOTPRINTPAD_H
21#define LIBREPCB_CORE_FOOTPRINTPAD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../geometry/pad.h"
27#include "../../serialization/serializableobjectlist.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36/*******************************************************************************
37 * Class FootprintPad
38 ******************************************************************************/
39
43class FootprintPad final : public Pad {
44 Q_DECLARE_TR_FUNCTIONS(FootprintPad)
45
46public:
47 // Signals
69
70 // Constructors / Destructor
71 FootprintPad() = delete;
72 FootprintPad(const FootprintPad& other) noexcept;
73 FootprintPad(const Uuid& uuid, const FootprintPad& other) noexcept;
74 FootprintPad(const Uuid& uuid, const std::optional<Uuid>& pkgPadUuid,
75 const Point& pos, const Angle& rot, Shape shape,
76 const PositiveLength& width, const PositiveLength& height,
77 const UnsignedLimitedRatio& radius,
78 const Path& customShapeOutline, const MaskConfig& autoStopMask,
79 const MaskConfig& autoSolderPaste,
80 const UnsignedLength& copperClearance, ComponentSide side,
81 Function function, const PadHoleList& holes) noexcept;
82 explicit FootprintPad(const SExpression& node);
83 ~FootprintPad() noexcept;
84
85 // Getters
86 using Pad::getHoles;
87 PadHoleList& getHoles() noexcept { return mHoles; }
88 const std::optional<Uuid>& getPackagePadUuid() const noexcept {
89 return mPackagePadUuid;
90 }
91
92 // Setters
93 bool setPosition(const Point& pos) noexcept;
94 bool setRotation(const Angle& rot) noexcept;
95 bool setShape(Shape shape) noexcept;
96 bool setWidth(const PositiveLength& width) noexcept;
97 bool setHeight(const PositiveLength& height) noexcept;
98 bool setRadius(const UnsignedLimitedRatio& radius) noexcept;
99 bool setCustomShapeOutline(const Path& outline) noexcept;
100 bool setStopMaskConfig(const MaskConfig& config) noexcept;
101 bool setSolderPasteConfig(const MaskConfig& config) noexcept;
102 bool setCopperClearance(const UnsignedLength& clearance) noexcept;
103 bool setComponentSide(ComponentSide side) noexcept;
104 bool setFunction(Function function) noexcept;
105 bool setPackagePadUuid(const std::optional<Uuid>& pad) noexcept;
106
107 // General Methods
108
114 void serialize(SExpression& root) const;
115
116 // Operator Overloadings
117 bool operator==(const FootprintPad& rhs) const noexcept;
118 bool operator!=(const FootprintPad& rhs) const noexcept {
119 return !(*this == rhs);
120 }
121 FootprintPad& operator=(const FootprintPad& rhs) noexcept;
122
123private: // Methods
124 void holesEdited(const PadHoleList& list, int index,
125 const std::shared_ptr<const PadHole>& hole,
126 PadHoleList::Event event) noexcept;
127
128private: // Data
134 std::optional<Uuid> mPackagePadUuid;
135
136 // Slots
138};
139
140/*******************************************************************************
141 * Class FootprintPadList
142 ******************************************************************************/
143
145 static constexpr const char* tagname = "pad";
146};
150
151/*******************************************************************************
152 * End of File
153 ******************************************************************************/
154
155} // namespace librepcb
156
157#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The FootprintPad class represents a pad of a footprint.
Definition footprintpad.h:43
bool setRotation(const Angle &rot) noexcept
Definition footprintpad.cpp:90
bool setPosition(const Point &pos) noexcept
Definition footprintpad.cpp:80
bool setComponentSide(ComponentSide side) noexcept
Definition footprintpad.cpp:181
bool setShape(Shape shape) noexcept
Definition footprintpad.cpp:100
~FootprintPad() noexcept
Definition footprintpad.cpp:73
std::optional< Uuid > mPackagePadUuid
Definition footprintpad.h:134
bool setStopMaskConfig(const MaskConfig &config) noexcept
Definition footprintpad.cpp:150
bool setCopperClearance(const UnsignedLength &clearance) noexcept
Definition footprintpad.cpp:170
const std::optional< Uuid > & getPackagePadUuid() const noexcept
Definition footprintpad.h:88
Event
Definition footprintpad.h:48
PadHoleList & getHoles() noexcept
Definition footprintpad.h:87
bool setSolderPasteConfig(const MaskConfig &config) noexcept
Definition footprintpad.cpp:160
PadHoleList::OnEditedSlot mHolesEditedSlot
Definition footprintpad.h:137
bool setFunction(Function function) noexcept
Definition footprintpad.cpp:191
bool setHeight(const PositiveLength &height) noexcept
Definition footprintpad.cpp:120
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition footprintpad.cpp:215
bool setWidth(const PositiveLength &width) noexcept
Definition footprintpad.cpp:110
bool setRadius(const UnsignedLimitedRatio &radius) noexcept
Definition footprintpad.cpp:130
bool setCustomShapeOutline(const Path &outline) noexcept
Definition footprintpad.cpp:140
FootprintPad & operator=(const FootprintPad &rhs) noexcept
Definition footprintpad.cpp:248
bool operator!=(const FootprintPad &rhs) const noexcept
Definition footprintpad.h:118
bool operator==(const FootprintPad &rhs) const noexcept
Definition footprintpad.cpp:242
Signal< FootprintPad, Event > onEdited
Definition footprintpad.h:67
Slot< FootprintPad, Event > OnEditedSlot
Definition footprintpad.h:68
void holesEdited(const PadHoleList &list, int index, const std::shared_ptr< const PadHole > &hole, PadHoleList::Event event) noexcept
Definition footprintpad.cpp:274
bool setPackagePadUuid(const std::optional< Uuid > &pad) noexcept
Definition footprintpad.cpp:201
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition maskconfig.h:45
Base class for pads, extended in derived classes.
Definition pad.h:53
PadHoleList mHoles
If not empty, it's a THT pad.
Definition pad.h:156
ComponentSide
Definition pad.h:64
Function
Definition pad.h:69
Shape
Definition pad.h:58
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 SExpression class.
Definition sexpression.h:69
Slot< SerializableObjectList< PadHole, PadHoleListNameProvider, OnEditedArgs... >, int, const std::shared_ptr< const PadHole > &, Event > OnEditedSlot
Definition serializableobjectlist.h:136
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 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
Definition footprintpad.h:144
static constexpr const char * tagname
Definition footprintpad.h:145