LibrePCB Developers Documentation
Loading...
Searching...
No Matches
footprint.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_FOOTPRINT_H
21#define LIBREPCB_CORE_FOOTPRINT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../geometry/circle.h"
27#include "../../geometry/hole.h"
28#include "../../geometry/polygon.h"
29#include "../../geometry/stroketext.h"
30#include "../../geometry/zone.h"
31#include "../../serialization/serializablekeyvaluemap.h"
32#include "../../serialization/serializableobjectlist.h"
33#include "footprintpad.h"
34
35#include <QtCore>
36
37/*******************************************************************************
38 * Namespace / Forward Declarations
39 ******************************************************************************/
40namespace librepcb {
41
42/*******************************************************************************
43 * Class Footprint
44 ******************************************************************************/
45
55class Footprint final {
56 Q_DECLARE_TR_FUNCTIONS(Footprint)
57
58public:
59 // Signals
76
77 // Constructors / Destructor
78 Footprint() = delete;
79 Footprint(const Footprint& other) noexcept;
80 Footprint(const Uuid& uuid, const ElementName& name_en_US,
81 const QString& description_en_US);
82 explicit Footprint(const SExpression& node);
83 ~Footprint() noexcept;
84
85 // Getters: General
86 const Uuid& getUuid() const noexcept { return mUuid; }
87 LocalizedNameMap& getNames() noexcept { return mNames; }
88 const LocalizedNameMap& getNames() const noexcept { return mNames; }
90 const LocalizedDescriptionMap& getDescriptions() const noexcept {
91 return mDescriptions;
92 }
93 const Point3D& getModelPosition() const noexcept { return mModelPosition; }
94 const Angle3D& getModelRotation() const noexcept { return mModelRotation; }
95 const QSet<Uuid>& getModels() const noexcept { return mModels; }
96
97 // Getters: Geometry
98 const FootprintPadList& getPads() const noexcept { return mPads; }
99 FootprintPadList& getPads() noexcept { return mPads; }
100 const PolygonList& getPolygons() const noexcept { return mPolygons; }
101 PolygonList& getPolygons() noexcept { return mPolygons; }
102 const CircleList& getCircles() const noexcept { return mCircles; }
103 CircleList& getCircles() noexcept { return mCircles; }
104 const StrokeTextList& getStrokeTexts() const noexcept { return mStrokeTexts; }
106 const ZoneList& getZones() const noexcept { return mZones; }
107 ZoneList& getZones() noexcept { return mZones; }
108 const HoleList& getHoles() const noexcept { return mHoles; }
109 HoleList& getHoles() noexcept { return mHoles; }
110
111 // Setters: General
112 bool setModelPosition(const Point3D& position) noexcept;
113 bool setModelRotation(const Angle3D& rotation) noexcept;
114 bool setModels(const QSet<Uuid>& models) noexcept;
115
116 // General Methods
117
123 void serialize(SExpression& root) const;
124
125 // Operator Overloadings
126 bool operator==(const Footprint& rhs) const noexcept;
127 bool operator!=(const Footprint& rhs) const noexcept {
128 return !(*this == rhs);
129 }
130 Footprint& operator=(const Footprint& rhs) noexcept;
131
132private: // Methods
133 void namesEdited(const LocalizedNameMap& names, const QString& key,
134 LocalizedNameMap::Event event) noexcept;
136 const QString& key,
137 LocalizedDescriptionMap::Event event) noexcept;
138 void padsEdited(const FootprintPadList& list, int index,
139 const std::shared_ptr<const FootprintPad>& pad,
140 FootprintPadList::Event event) noexcept;
141 void polygonsEdited(const PolygonList& list, int index,
142 const std::shared_ptr<const Polygon>& polygon,
143 PolygonList::Event event) noexcept;
144 void circlesEdited(const CircleList& list, int index,
145 const std::shared_ptr<const Circle>& circle,
146 CircleList::Event event) noexcept;
147 void strokeTextsEdited(const StrokeTextList& list, int index,
148 const std::shared_ptr<const StrokeText>& text,
149 StrokeTextList::Event event) noexcept;
150 void zonesEdited(const ZoneList& list, int index,
151 const std::shared_ptr<const Zone>& zone,
152 ZoneList::Event event) noexcept;
153 void holesEdited(const HoleList& list, int index,
154 const std::shared_ptr<const Hole>& hole,
155 HoleList::Event event) noexcept;
156
157private: // Data
163 QSet<Uuid> mModels;
170
171 // Slots
180};
181
182/*******************************************************************************
183 * Class FootprintList
184 ******************************************************************************/
185
187 static constexpr const char* tagname = "footprint";
188};
192
193/*******************************************************************************
194 * End of File
195 ******************************************************************************/
196
197} // namespace librepcb
198
199#endif
The Footprint class represents one footprint variant of a package.
Definition footprint.h:55
LocalizedNameMap::OnEditedSlot mNamesEditedSlot
Definition footprint.h:172
HoleList & getHoles() noexcept
Definition footprint.h:109
const LocalizedNameMap & getNames() const noexcept
Definition footprint.h:88
bool setModelPosition(const Point3D &position) noexcept
Definition footprint.cpp:145
const FootprintPadList & getPads() const noexcept
Definition footprint.h:98
FootprintPadList & getPads() noexcept
Definition footprint.h:99
Point3D mModelPosition
Definition footprint.h:161
const Angle3D & getModelRotation() const noexcept
Definition footprint.h:94
ZoneList & getZones() noexcept
Definition footprint.h:107
PolygonList & getPolygons() noexcept
Definition footprint.h:101
CircleList mCircles
Definition footprint.h:166
bool setModelRotation(const Angle3D &rotation) noexcept
Definition footprint.cpp:155
void circlesEdited(const CircleList &list, int index, const std::shared_ptr< const Circle > &circle, CircleList::Event event) noexcept
Definition footprint.cpp:297
FootprintPadList::OnEditedSlot mPadsEditedSlot
Definition footprint.h:174
const Point3D & getModelPosition() const noexcept
Definition footprint.h:93
StrokeTextList::OnEditedSlot mStrokeTextsEditedSlot
Definition footprint.h:177
bool operator!=(const Footprint &rhs) const noexcept
Definition footprint.h:127
Uuid mUuid
Definition footprint.h:158
const PolygonList & getPolygons() const noexcept
Definition footprint.h:100
Event
Definition footprint.h:60
bool operator==(const Footprint &rhs) const noexcept
Definition footprint.cpp:221
ZoneList::OnEditedSlot mZonesEditedSlot
Definition footprint.h:178
const HoleList & getHoles() const noexcept
Definition footprint.h:108
const ZoneList & getZones() const noexcept
Definition footprint.h:106
ZoneList mZones
Definition footprint.h:168
void holesEdited(const HoleList &list, int index, const std::shared_ptr< const Hole > &hole, HoleList::Event event) noexcept
Definition footprint.cpp:327
LocalizedDescriptionMap mDescriptions
Definition footprint.h:160
void zonesEdited(const ZoneList &list, int index, const std::shared_ptr< const Zone > &zone, ZoneList::Event event) noexcept
Definition footprint.cpp:317
const CircleList & getCircles() const noexcept
Definition footprint.h:102
QSet< Uuid > mModels
Definition footprint.h:163
Slot< Footprint, Event > OnEditedSlot
Definition footprint.h:75
LocalizedDescriptionMap::OnEditedSlot mDescriptionsEditedSlot
Definition footprint.h:173
const QSet< Uuid > & getModels() const noexcept
Definition footprint.h:95
PolygonList::OnEditedSlot mPolygonsEditedSlot
Definition footprint.h:175
CircleList::OnEditedSlot mCirclesEditedSlot
Definition footprint.h:176
Footprint & operator=(const Footprint &rhs) noexcept
Definition footprint.cpp:237
Signal< Footprint, Event > onEdited
Definition footprint.h:74
LocalizedNameMap mNames
Definition footprint.h:159
PolygonList mPolygons
Definition footprint.h:165
void polygonsEdited(const PolygonList &list, int index, const std::shared_ptr< const Polygon > &polygon, PolygonList::Event event) noexcept
Definition footprint.cpp:287
FootprintPadList mPads
Definition footprint.h:164
StrokeTextList & getStrokeTexts() noexcept
Definition footprint.h:105
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition footprint.cpp:179
~Footprint() noexcept
Definition footprint.cpp:138
CircleList & getCircles() noexcept
Definition footprint.h:103
const LocalizedDescriptionMap & getDescriptions() const noexcept
Definition footprint.h:90
const StrokeTextList & getStrokeTexts() const noexcept
Definition footprint.h:104
void descriptionsEdited(const LocalizedDescriptionMap &names, const QString &key, LocalizedDescriptionMap::Event event) noexcept
Definition footprint.cpp:268
const Uuid & getUuid() const noexcept
Definition footprint.h:86
HoleList mHoles
Definition footprint.h:169
void namesEdited(const LocalizedNameMap &names, const QString &key, LocalizedNameMap::Event event) noexcept
Definition footprint.cpp:260
LocalizedDescriptionMap & getDescriptions() noexcept
Definition footprint.h:89
bool setModels(const QSet< Uuid > &models) noexcept
Definition footprint.cpp:165
void strokeTextsEdited(const StrokeTextList &list, int index, const std::shared_ptr< const StrokeText > &text, StrokeTextList::Event event) noexcept
Definition footprint.cpp:307
HoleList::OnEditedSlot mHolesEditedSlot
Definition footprint.h:179
LocalizedNameMap & getNames() noexcept
Definition footprint.h:87
void padsEdited(const FootprintPadList &list, int index, const std::shared_ptr< const FootprintPad > &pad, FootprintPadList::Event event) noexcept
Definition footprint.cpp:277
StrokeTextList mStrokeTexts
Definition footprint.h:167
Angle3D mModelRotation
Definition footprint.h:162
The SExpression class.
Definition sexpression.h:69
Slot< SerializableKeyValueMap< LocalizedNameMapPolicy >, const QString &, Event > OnEditedSlot
Definition serializablekeyvaluemap.h:67
Event
Definition serializablekeyvaluemap.h:61
Slot< SerializableObjectList< FootprintPad, FootprintPadListNameProvider, OnEditedArgs... >, int, const std::shared_ptr< const FootprintPad > &, 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:76
std::tuple< Length, Length, Length > Point3D
Definition length.h:987
std::tuple< Angle, Angle, Angle > Angle3D
Definition angle.h:458
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition elementname.h:84
Definition footprint.h:186
static constexpr const char * tagname
Definition footprint.h:187