LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardzonedata.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_BOARDZONEDATA_H
21#define LIBREPCB_CORE_BOARDZONEDATA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../geometry/zone.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class Layer;
36
37/*******************************************************************************
38 * Class BoardZoneData
39 ******************************************************************************/
40
44class BoardZoneData final {
45public:
46 // Constructors / Destructor
47 BoardZoneData() = delete;
48 BoardZoneData(const BoardZoneData& other) noexcept;
49 BoardZoneData(const Uuid& uuid, const BoardZoneData& other) noexcept;
50 BoardZoneData(const Uuid& uuid, const QSet<const Layer*>& layers,
51 Zone::Rules rules, const Path& outline, bool locked) noexcept;
52 explicit BoardZoneData(const SExpression& node);
53 ~BoardZoneData() noexcept;
54
55 // Getters
56 const Uuid& getUuid() const noexcept { return mUuid; }
57 const QSet<const Layer*>& getLayers() const noexcept { return mLayers; }
58 Zone::Rules getRules() const noexcept { return mRules; }
59 const Path& getOutline() const noexcept { return mOutline; }
60 bool isLocked() const noexcept { return mLocked; }
61
62 // Setters
63 bool setLayers(const QSet<const Layer*>& layers);
64 bool setRules(Zone::Rules rules) noexcept;
65 bool setOutline(const Path& outline) noexcept;
66 bool setLocked(bool locked) noexcept;
67
68 // General Methods
69
75 void serialize(SExpression& root) const;
76
77 // Operator Overloadings
78 bool operator==(const BoardZoneData& rhs) const noexcept;
79 bool operator!=(const BoardZoneData& rhs) const noexcept {
80 return !(*this == rhs);
81 }
82 BoardZoneData& operator=(const BoardZoneData& rhs) = default;
83
84private: // Methods
85 void checkLayers(const QSet<const Layer*>& layers);
86
87private: // Data
89 QSet<const Layer*> mLayers;
90 Zone::Rules mRules;
92 bool mLocked;
93};
94
95/*******************************************************************************
96 * End of File
97 ******************************************************************************/
98
99} // namespace librepcb
100
101#endif
The BoardZoneData class.
Definition boardzonedata.h:44
bool setLayers(const QSet< const Layer * > &layers)
Definition boardzonedata.cpp:95
bool mLocked
Definition boardzonedata.h:92
bool setOutline(const Path &outline) noexcept
Definition boardzonedata.cpp:114
const QSet< const Layer * > & getLayers() const noexcept
Definition boardzonedata.h:57
bool setRules(Zone::Rules rules) noexcept
Definition boardzonedata.cpp:105
bool operator!=(const BoardZoneData &rhs) const noexcept
Definition boardzonedata.h:79
Zone::Rules getRules() const noexcept
Definition boardzonedata.h:58
Uuid mUuid
Definition boardzonedata.h:88
BoardZoneData & operator=(const BoardZoneData &rhs)=default
Zone::Rules mRules
Definition boardzonedata.h:90
bool isLocked() const noexcept
Definition boardzonedata.h:60
Path mOutline
Definition boardzonedata.h:91
~BoardZoneData() noexcept
Definition boardzonedata.cpp:88
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition boardzonedata.cpp:136
QSet< const Layer * > mLayers
Definition boardzonedata.h:89
const Uuid & getUuid() const noexcept
Definition boardzonedata.h:56
void checkLayers(const QSet< const Layer * > &layers)
Definition boardzonedata.cpp:171
bool operator==(const BoardZoneData &rhs) const noexcept
Definition boardzonedata.cpp:158
const Path & getOutline() const noexcept
Definition boardzonedata.h:59
bool setLocked(bool locked) noexcept
Definition boardzonedata.cpp:123
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition path.h:57
The SExpression class.
Definition sexpression.h:69
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
Definition occmodel.cpp:76