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