LibrePCB Developers Documentation
hole.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_HOLE_H
21#define LIBREPCB_CORE_HOLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../geometry/path.h"
27#include "../serialization/serializableobjectlist.h"
28#include "../types/length.h"
29#include "../types/maskconfig.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38/*******************************************************************************
39 * Class Hole
40 ******************************************************************************/
41
45class Hole final {
46 Q_DECLARE_TR_FUNCTIONS(Hole)
47
48public:
49 // Signals
50 enum class Event {
51 UuidChanged,
52 DiameterChanged,
53 PathChanged,
54 StopMaskConfigChanged,
55 };
58
59 // Constructors / Destructor
60 Hole() = delete;
61 Hole(const Hole& other) noexcept;
62 Hole(const Uuid& uuid, const Hole& other) noexcept;
63 Hole(const Uuid& uuid, const PositiveLength& diameter,
64 const NonEmptyPath& path, const MaskConfig& stopMaskConfig) noexcept;
65 explicit Hole(const SExpression& node);
66 ~Hole() noexcept;
67
68 // Getters
69 const Uuid& getUuid() const noexcept { return mUuid; }
70 const PositiveLength& getDiameter() const noexcept { return mDiameter; }
71 const NonEmptyPath& getPath() const noexcept { return mPath; }
72 const MaskConfig& getStopMaskConfig() const noexcept {
73 return mStopMaskConfig;
74 }
75 bool isSlot() const noexcept;
76 bool isMultiSegmentSlot() const noexcept;
77 bool isCurvedSlot() const noexcept;
78 tl::optional<Length> getPreviewStopMaskOffset() const noexcept;
79
80 // Setters
81 bool setDiameter(const PositiveLength& diameter) noexcept;
82 bool setPath(const NonEmptyPath& path) noexcept;
83 bool setStopMaskConfig(const MaskConfig& config) noexcept;
84
85 // General Methods
86
92 void serialize(SExpression& root) const;
93
94 // Operator Overloadings
95 bool operator==(const Hole& rhs) const noexcept;
96 bool operator!=(const Hole& rhs) const noexcept { return !(*this == rhs); }
97 Hole& operator=(const Hole& rhs) noexcept;
98
99private: // Data
104};
105
106/*******************************************************************************
107 * Class HoleList
108 ******************************************************************************/
109
111 static constexpr const char* tagname = "hole";
112};
113using HoleList =
115
116/*******************************************************************************
117 * End of File
118 ******************************************************************************/
119
120} // namespace librepcb
121
122#endif
The Hole class.
Definition: hole.h:45
tl::optional< Length > getPreviewStopMaskOffset() const noexcept
Definition: hole.cpp:84
bool isSlot() const noexcept
Definition: hole.cpp:72
bool isMultiSegmentSlot() const noexcept
Definition: hole.cpp:76
const MaskConfig & getStopMaskConfig() const noexcept
Definition: hole.h:72
~Hole() noexcept
Definition: hole.cpp:65
bool setStopMaskConfig(const MaskConfig &config) noexcept
Definition: hole.cpp:120
Uuid mUuid
Definition: hole.h:100
Event
Definition: hole.h:50
NonEmptyPath mPath
Definition: hole.h:102
bool setPath(const NonEmptyPath &path) noexcept
Definition: hole.cpp:110
Signal< Hole, Event > onEdited
Definition: hole.h:56
Hole & operator=(const Hole &rhs) noexcept
Definition: hole.cpp:154
const PositiveLength & getDiameter() const noexcept
Definition: hole.h:70
MaskConfig mStopMaskConfig
Definition: hole.h:103
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: hole.cpp:134
const Uuid & getUuid() const noexcept
Definition: hole.h:69
bool isCurvedSlot() const noexcept
Definition: hole.cpp:80
PositiveLength mDiameter
Definition: hole.h:101
bool setDiameter(const PositiveLength &diameter) noexcept
Definition: hole.cpp:100
const NonEmptyPath & getPath() const noexcept
Definition: hole.h:71
Slot< Hole, Event > OnEditedSlot
Definition: hole.h:57
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition: maskconfig.h:45
The SExpression class.
Definition: sexpression.h:69
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:221
Definition: uuid.h:183
Definition: hole.h:110
static constexpr const char * tagname
Definition: hole.h:111