LibrePCB Developers Documentation
Loading...
Searching...
No Matches
pickplacedata.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_PICKPLACEDATA_H
21#define LIBREPCB_CORE_PICKPLACEDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/angle.h"
27#include "../types/point.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36/*******************************************************************************
37 * Class PickPlaceDataItem
38 ******************************************************************************/
39
46class PickPlaceDataItem final {
47 Q_DECLARE_TR_FUNCTIONS(PickPlaceDataItem)
48
49public:
50 enum class BoardSide {
51 Top,
52 Bottom,
53 };
54
55 // ATTENTION: When modifying items, adjust PickPlaceCsvWriter and
56 // PickPlaceOutputJob as well!
57 enum class Type : int {
58 Tht,
59 Smt,
60 Mixed,
61 Fiducial,
62 Other,
63 };
64
65 // Constructors / Destructor
67 PickPlaceDataItem(const QString& designator, const QString& value,
68 const QString& deviceName, const QString& packageName,
69 const Point& position, const Angle& rotation,
70 BoardSide boardSide, Type type, bool mount) noexcept
71 : mDesignator(designator),
72 mValue(value),
73 mDeviceName(deviceName),
74 mPackageName(packageName),
75 mPosition(position),
76 mRotation(rotation),
77 mBoardSide(boardSide),
78 mType(type),
79 mMount(mount) {}
80 PickPlaceDataItem(const PickPlaceDataItem& other) noexcept
81 : mDesignator(other.mDesignator),
82 mValue(other.mValue),
83 mDeviceName(other.mDeviceName),
84 mPackageName(other.mPackageName),
85 mPosition(other.mPosition),
86 mRotation(other.mRotation),
87 mBoardSide(other.mBoardSide),
88 mType(other.mType),
89 mMount(other.mMount) {}
90 ~PickPlaceDataItem() noexcept {}
91
92 // Getters
93 const QString& getDesignator() const noexcept { return mDesignator; }
94 const QString& getValue() const noexcept { return mValue; }
95 const QString& getDeviceName() const noexcept { return mDeviceName; }
96 const QString& getPackageName() const noexcept { return mPackageName; }
97 const Point& getPosition() const noexcept { return mPosition; }
98 const Angle& getRotation() const noexcept { return mRotation; }
99 BoardSide getBoardSide() const noexcept { return mBoardSide; }
100 Type getType() const noexcept { return mType; }
101 bool isMount() const noexcept { return mMount; }
102
103 // Setters
104 void setDesignator(const QString& value) noexcept { mDesignator = value; }
105
106 // Operator Overloadings
109 mValue = rhs.mValue;
110 mDeviceName = rhs.mDeviceName;
111 mPackageName = rhs.mPackageName;
112 mPosition = rhs.mPosition;
113 mRotation = rhs.mRotation;
114 mBoardSide = rhs.mBoardSide;
115 mType = rhs.mType;
116 mMount = rhs.mMount;
117 return *this;
118 }
119
120private:
121 QString mDesignator;
122 QString mValue;
123 QString mDeviceName;
129 bool mMount;
130};
131
132/*******************************************************************************
133 * Class PickPlaceData
134 ******************************************************************************/
135
140class PickPlaceData final {
141 Q_DECLARE_TR_FUNCTIONS(PickPlaceData)
142
143public:
144 // Constructors / Destructor
145 PickPlaceData() = delete;
146 PickPlaceData(const PickPlaceData& other) noexcept = delete;
147 PickPlaceData(const QString& projectName, const QString& projectVersion,
148 const QString& boardName) noexcept;
149 ~PickPlaceData() noexcept;
150
151 // Getters
152 const QString& getProjectName() const noexcept { return mProjectName; }
153 const QString& getProjectVersion() const noexcept { return mProjectVersion; }
154 const QString& getBoardName() const noexcept { return mBoardName; }
155 const QList<PickPlaceDataItem>& getItems() const noexcept { return mItems; }
156
157 // General Methods
158 void addItem(const PickPlaceDataItem& item) noexcept;
159
160 // Operator Overloadings
161 PickPlaceData& operator=(const PickPlaceData& rhs) noexcept = delete;
162
163private:
166 QString mBoardName;
167 QList<PickPlaceDataItem> mItems;
168};
169
170/*******************************************************************************
171 * Non-Member Functions
172 ******************************************************************************/
173
174inline std::size_t qHash(PickPlaceDataItem::Type key,
175 std::size_t seed = 0) noexcept {
176 return ::qHash(static_cast<int>(key), seed);
177}
178
179/*******************************************************************************
180 * End of File
181 ******************************************************************************/
182
183} // namespace librepcb
184
185#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The librepcb::PickPlaceData class represents the content of a pick&place file.
Definition pickplacedata.h:140
const QString & getBoardName() const noexcept
Definition pickplacedata.h:154
QString mProjectVersion
Definition pickplacedata.h:165
PickPlaceData(const PickPlaceData &other) noexcept=delete
const QList< PickPlaceDataItem > & getItems() const noexcept
Definition pickplacedata.h:155
const QString & getProjectName() const noexcept
Definition pickplacedata.h:152
~PickPlaceData() noexcept
Definition pickplacedata.cpp:47
PickPlaceData & operator=(const PickPlaceData &rhs) noexcept=delete
const QString & getProjectVersion() const noexcept
Definition pickplacedata.h:153
void addItem(const PickPlaceDataItem &item) noexcept
Definition pickplacedata.cpp:54
QList< PickPlaceDataItem > mItems
Definition pickplacedata.h:167
QString mBoardName
Definition pickplacedata.h:166
QString mProjectName
Definition pickplacedata.h:164
The librepcb::PickPlaceDataItem class represents one item of a pick&place file.
Definition pickplacedata.h:46
const Angle & getRotation() const noexcept
Definition pickplacedata.h:98
Type
Definition pickplacedata.h:57
@ Other
Anything special, e.g. mechanical parts.
@ Mixed
Mixed THT/SMT package.
@ Fiducial
No package to mount, just a fiducial.
const QString & getPackageName() const noexcept
Definition pickplacedata.h:96
BoardSide getBoardSide() const noexcept
Definition pickplacedata.h:99
void setDesignator(const QString &value) noexcept
Definition pickplacedata.h:104
QString mPackageName
Definition pickplacedata.h:124
BoardSide
Definition pickplacedata.h:50
BoardSide mBoardSide
Definition pickplacedata.h:127
PickPlaceDataItem(const PickPlaceDataItem &other) noexcept
Definition pickplacedata.h:80
Type getType() const noexcept
Definition pickplacedata.h:100
bool mMount
False means "do not mount".
Definition pickplacedata.h:129
const QString & getDesignator() const noexcept
Definition pickplacedata.h:93
QString mValue
Definition pickplacedata.h:122
Angle mRotation
Definition pickplacedata.h:126
const QString & getValue() const noexcept
Definition pickplacedata.h:94
const Point & getPosition() const noexcept
Definition pickplacedata.h:97
QString mDeviceName
Definition pickplacedata.h:123
const QString & getDeviceName() const noexcept
Definition pickplacedata.h:95
QString mDesignator
Definition pickplacedata.h:121
bool isMount() const noexcept
Definition pickplacedata.h:101
PickPlaceDataItem & operator=(const PickPlaceDataItem &rhs) noexcept
Definition pickplacedata.h:107
~PickPlaceDataItem() noexcept
Definition pickplacedata.h:90
Point mPosition
Definition pickplacedata.h:125
Type mType
Definition pickplacedata.h:128
PickPlaceDataItem(const QString &designator, const QString &value, const QString &deviceName, const QString &packageName, const Point &position, const Angle &rotation, BoardSide boardSide, Type type, bool mount) noexcept
Definition pickplacedata.h:67
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Definition occmodel.cpp:76
std::size_t qHash(const AttributeKey &key, std::size_t seed=0) noexcept
Definition attributekey.h:118