LibrePCB Developers Documentation
Loading...
Searching...
No Matches
circle.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_CIRCLE_H
21#define LIBREPCB_CORE_CIRCLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../serialization/serializableobjectlist.h"
27#include "../types/length.h"
28#include "../types/point.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Layer;
38
39/*******************************************************************************
40 * Class Circle
41 ******************************************************************************/
42
46class Circle final {
47 Q_DECLARE_TR_FUNCTIONS(Circle)
48
49public:
50 // Signals
62
63 // Constructors / Destructor
64 Circle() = delete;
65 Circle(const Circle& other) noexcept;
66 Circle(const Uuid& uuid, const Circle& other) noexcept;
67 Circle(const Uuid& uuid, const Layer& layer, const UnsignedLength& lineWidth,
68 bool fill, bool isGrabArea, const Point& center,
69 const PositiveLength& diameter) noexcept;
70 explicit Circle(const SExpression& node);
71 ~Circle() noexcept;
72
73 // Getters
74 const Uuid& getUuid() const noexcept { return mUuid; }
75 const Layer& getLayer() const noexcept { return *mLayer; }
76 const UnsignedLength& getLineWidth() const noexcept { return mLineWidth; }
77 bool isFilled() const noexcept { return mIsFilled; }
78 bool isGrabArea() const noexcept { return mIsGrabArea; }
79 const Point& getCenter() const noexcept { return mCenter; }
80 const PositiveLength& getDiameter() const noexcept { return mDiameter; }
81
82 // Setters
83 bool setLayer(const Layer& layer) noexcept;
84 bool setLineWidth(const UnsignedLength& width) noexcept;
85 bool setIsFilled(bool isFilled) noexcept;
86 bool setIsGrabArea(bool isGrabArea) noexcept;
87 bool setCenter(const Point& center) noexcept;
88 bool setDiameter(const PositiveLength& dia) noexcept;
89
90 // General Methods
91
97 void serialize(SExpression& root) const;
98
99 // Operator Overloadings
100 bool operator==(const Circle& rhs) const noexcept;
101 bool operator!=(const Circle& rhs) const noexcept { return !(*this == rhs); }
102 Circle& operator=(const Circle& rhs) noexcept;
103
104private: // Data
106 const Layer* mLayer;
112};
113
114/*******************************************************************************
115 * Class CircleList
116 ******************************************************************************/
117
119 static constexpr const char* tagname = "circle";
120};
123
124/*******************************************************************************
125 * End of File
126 ******************************************************************************/
127
128} // namespace librepcb
129
130#endif
The Circle class.
Definition circle.h:46
bool setLineWidth(const UnsignedLength &width) noexcept
Definition circle.cpp:92
Circle & operator=(const Circle &rhs) noexcept
Definition circle.cpp:173
bool isFilled() const noexcept
Definition circle.h:77
bool setDiameter(const PositiveLength &dia) noexcept
Definition circle.cpp:132
UnsignedLength mLineWidth
Definition circle.h:107
Uuid mUuid
Definition circle.h:105
Event
Definition circle.h:51
bool mIsGrabArea
Definition circle.h:109
const Layer & getLayer() const noexcept
Definition circle.h:75
bool operator!=(const Circle &rhs) const noexcept
Definition circle.h:101
bool mIsFilled
Definition circle.h:108
bool setIsGrabArea(bool isGrabArea) noexcept
Definition circle.cpp:112
const PositiveLength & getDiameter() const noexcept
Definition circle.h:80
bool operator==(const Circle &rhs) const noexcept
Definition circle.cpp:162
bool setLayer(const Layer &layer) noexcept
Definition circle.cpp:82
const UnsignedLength & getLineWidth() const noexcept
Definition circle.h:76
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition circle.cpp:146
const Uuid & getUuid() const noexcept
Definition circle.h:74
Signal< Circle, Event > onEdited
Definition circle.h:60
const Point & getCenter() const noexcept
Definition circle.h:79
Point mCenter
Definition circle.h:110
const Layer * mLayer
Definition circle.h:106
PositiveLength mDiameter
Definition circle.h:111
~Circle() noexcept
Definition circle.cpp:75
Slot< Circle, Event > OnEditedSlot
Definition circle.h:61
bool setIsFilled(bool isFilled) noexcept
Definition circle.cpp:102
bool isGrabArea() const noexcept
Definition circle.h:78
bool setCenter(const Point &center) noexcept
Definition circle.cpp:122
The Layer class provides all supported geometry layers.
Definition layer.h:42
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
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
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition circle.h:118
static constexpr const char * tagname
Definition circle.h:119