LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardpaddata.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_BOARDPADDATA_H
21#define LIBREPCB_CORE_BOARDPADDATA_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 BoardPadData
38 ******************************************************************************/
39
43class BoardPadData final : public Pad {
44 Q_DECLARE_TR_FUNCTIONS(BoardPadData)
45
46public:
47 // Signals
69
70 // Constructors / Destructor
71 BoardPadData() = delete;
72 BoardPadData(const BoardPadData& other) noexcept;
73 BoardPadData(const Uuid& uuid, const BoardPadData& other) noexcept;
74 BoardPadData(const Uuid& uuid, const Point& pos, const Angle& rot,
75 Shape shape, const PositiveLength& width,
76 const PositiveLength& height, const UnsignedLimitedRatio& radius,
77 const Path& customShapeOutline, const MaskConfig& autoStopMask,
78 const MaskConfig& autoSolderPaste,
79 const UnsignedLength& copperClearance, ComponentSide side,
80 Function function, const PadHoleList& holes,
81 bool locked) noexcept;
82 explicit BoardPadData(const SExpression& node);
83 ~BoardPadData() noexcept;
84
85 // Getters
86 using Pad::getHoles;
87 PadHoleList& getHoles() noexcept { return mHoles; }
88 bool isLocked() const noexcept { return mLocked; }
89
90 // Setters
91 bool setPosition(const Point& pos) noexcept;
92 bool setRotation(const Angle& rot) noexcept;
93 bool setShape(Shape shape) noexcept;
94 bool setWidth(const PositiveLength& width) noexcept;
95 bool setHeight(const PositiveLength& height) noexcept;
96 bool setRadius(const UnsignedLimitedRatio& radius) noexcept;
97 bool setCustomShapeOutline(const Path& outline) noexcept;
98 bool setStopMaskConfig(const MaskConfig& config) noexcept;
99 bool setSolderPasteConfig(const MaskConfig& config) noexcept;
100 bool setCopperClearance(const UnsignedLength& clearance) noexcept;
101 bool setComponentSide(ComponentSide side) noexcept;
102 bool setFunction(Function function) noexcept;
103 bool setLocked(bool locked) noexcept;
104
105 // General Methods
106
112 void serialize(SExpression& root) const;
113
114 // Operator Overloadings
115 bool operator==(const BoardPadData& rhs) const noexcept;
116 bool operator!=(const BoardPadData& rhs) const noexcept {
117 return !(*this == rhs);
118 }
119 BoardPadData& operator=(const BoardPadData& rhs) noexcept;
120
121private: // Methods
122 void holesEdited(const PadHoleList& list, int index,
123 const std::shared_ptr<const PadHole>& hole,
124 PadHoleList::Event event) noexcept;
125
126private: // Data
128
129 // Slots
131};
132
133/*******************************************************************************
134 * Class BoardPadDataList
135 ******************************************************************************/
136
138 static constexpr const char* tagname = "pad";
139};
143
144/*******************************************************************************
145 * End of File
146 ******************************************************************************/
147
148} // namespace librepcb
149
150#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The BoardPadData class represents a pad in a board.
Definition boardpaddata.h:43
bool mLocked
Definition boardpaddata.h:127
bool setRotation(const Angle &rot) noexcept
Definition boardpaddata.cpp:89
bool operator==(const BoardPadData &rhs) const noexcept
Definition boardpaddata.cpp:241
bool setPosition(const Point &pos) noexcept
Definition boardpaddata.cpp:79
bool setComponentSide(ComponentSide side) noexcept
Definition boardpaddata.cpp:180
bool setShape(Shape shape) noexcept
Definition boardpaddata.cpp:99
~BoardPadData() noexcept
Definition boardpaddata.cpp:72
bool setStopMaskConfig(const MaskConfig &config) noexcept
Definition boardpaddata.cpp:149
bool setCopperClearance(const UnsignedLength &clearance) noexcept
Definition boardpaddata.cpp:169
Event
Definition boardpaddata.h:48
PadHoleList & getHoles() noexcept
Definition boardpaddata.h:87
bool operator!=(const BoardPadData &rhs) const noexcept
Definition boardpaddata.h:116
bool setSolderPasteConfig(const MaskConfig &config) noexcept
Definition boardpaddata.cpp:159
PadHoleList::OnEditedSlot mHolesEditedSlot
Definition boardpaddata.h:130
bool isLocked() const noexcept
Definition boardpaddata.h:88
bool setFunction(Function function) noexcept
Definition boardpaddata.cpp:190
Slot< BoardPadData, Event > OnEditedSlot
Definition boardpaddata.h:68
bool setHeight(const PositiveLength &height) noexcept
Definition boardpaddata.cpp:119
Signal< BoardPadData, Event > onEdited
Definition boardpaddata.h:67
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition boardpaddata.cpp:214
bool setWidth(const PositiveLength &width) noexcept
Definition boardpaddata.cpp:109
bool setRadius(const UnsignedLimitedRatio &radius) noexcept
Definition boardpaddata.cpp:129
BoardPadData & operator=(const BoardPadData &rhs) noexcept
Definition boardpaddata.cpp:247
bool setCustomShapeOutline(const Path &outline) noexcept
Definition boardpaddata.cpp:139
bool setLocked(bool locked) noexcept
Definition boardpaddata.cpp:200
void holesEdited(const PadHoleList &list, int index, const std::shared_ptr< const PadHole > &hole, PadHoleList::Event event) noexcept
Definition boardpaddata.cpp:273
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 boardpaddata.h:137
static constexpr const char * tagname
Definition boardpaddata.h:138