LibrePCB Developers Documentation
boardpolygondata.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_BOARDPOLYGONDATA_H
21#define LIBREPCB_CORE_BOARDPOLYGONDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../geometry/path.h"
27#include "../../types/uuid.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class Layer;
37
38/*******************************************************************************
39 * Class BoardPolygonData
40 ******************************************************************************/
41
45class BoardPolygonData final {
46public:
47 // Constructors / Destructor
48 BoardPolygonData() = delete;
49 BoardPolygonData(const BoardPolygonData& other) noexcept;
50 BoardPolygonData(const Uuid& uuid, const BoardPolygonData& other) noexcept;
51 BoardPolygonData(const Uuid& uuid, const Layer& layer,
52 const UnsignedLength& lineWidth, const Path& path, bool fill,
53 bool isGrabArea, bool locked) noexcept;
54 explicit BoardPolygonData(const SExpression& node);
55 ~BoardPolygonData() noexcept;
56
57 // Getters
58 const Uuid& getUuid() const noexcept { return mUuid; }
59 const Layer& getLayer() const noexcept { return *mLayer; }
60 const UnsignedLength& getLineWidth() const noexcept { return mLineWidth; }
61 const Path& getPath() const noexcept { return mPath; }
62 bool isFilled() const noexcept { return mIsFilled; }
63 bool isGrabArea() const noexcept { return mIsGrabArea; }
64 bool isLocked() const noexcept { return mLocked; }
65
66 // Setters
67 bool setLayer(const Layer& layer) noexcept;
68 bool setLineWidth(const UnsignedLength& width) noexcept;
69 bool setPath(const Path& path) noexcept;
70 bool setIsFilled(bool isFilled) noexcept;
71 bool setIsGrabArea(bool isGrabArea) noexcept;
72 bool setLocked(bool locked) noexcept;
73
74 // General Methods
75
81 void serialize(SExpression& root) const;
82
83 // Operator Overloadings
84 bool operator==(const BoardPolygonData& rhs) const noexcept;
85 bool operator!=(const BoardPolygonData& rhs) const noexcept {
86 return !(*this == rhs);
87 }
89
90private: // Data
92 const Layer* mLayer;
97 bool mLocked;
98};
99
100/*******************************************************************************
101 * End of File
102 ******************************************************************************/
103
104} // namespace librepcb
105
106#endif
The BoardPolygonData class.
Definition: boardpolygondata.h:45
bool setLineWidth(const UnsignedLength &width) noexcept
Definition: boardpolygondata.cpp:98
bool mLocked
Definition: boardpolygondata.h:97
bool isFilled() const noexcept
Definition: boardpolygondata.h:62
bool operator!=(const BoardPolygonData &rhs) const noexcept
Definition: boardpolygondata.h:85
const Path & getPath() const noexcept
Definition: boardpolygondata.h:61
UnsignedLength mLineWidth
Definition: boardpolygondata.h:93
Uuid mUuid
Definition: boardpolygondata.h:91
bool mIsGrabArea
Definition: boardpolygondata.h:96
const Layer & getLayer() const noexcept
Definition: boardpolygondata.h:59
bool mIsFilled
Definition: boardpolygondata.h:95
bool setPath(const Path &path) noexcept
Definition: boardpolygondata.cpp:107
bool isLocked() const noexcept
Definition: boardpolygondata.h:64
bool setIsGrabArea(bool isGrabArea) noexcept
Definition: boardpolygondata.cpp:125
BoardPolygonData & operator=(const BoardPolygonData &rhs)=default
bool setLayer(const Layer &layer) noexcept
Definition: boardpolygondata.cpp:89
const UnsignedLength & getLineWidth() const noexcept
Definition: boardpolygondata.h:60
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: boardpolygondata.cpp:147
~BoardPolygonData() noexcept
Definition: boardpolygondata.cpp:82
const Uuid & getUuid() const noexcept
Definition: boardpolygondata.h:58
bool operator==(const BoardPolygonData &rhs) const noexcept
Definition: boardpolygondata.cpp:164
const Layer * mLayer
Definition: boardpolygondata.h:92
Path mPath
Definition: boardpolygondata.h:94
bool setLocked(bool locked) noexcept
Definition: boardpolygondata.cpp:134
bool setIsFilled(bool isFilled) noexcept
Definition: boardpolygondata.cpp:116
bool isGrabArea() const noexcept
Definition: boardpolygondata.h:63
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The SExpression class.
Definition: sexpression.h:69
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, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696