LibrePCB Developers Documentation
bi_plane.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_BI_PLANE_H
21#define LIBREPCB_CORE_BI_PLANE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../exceptions.h"
27#include "../../../geometry/path.h"
28#include "../../../types/uuid.h"
29#include "bi_base.h"
30
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Board;
41class Layer;
42class NetSignal;
43class Project;
44
45/*******************************************************************************
46 * Class BI_Plane
47 ******************************************************************************/
48
52class BI_Plane final : public BI_Base {
53 Q_OBJECT
54
55public:
56 // Signals
57 enum class Event {
58 OutlineChanged,
59 LayerChanged,
60 IsLockedChanged,
61 VisibilityChanged,
62 FragmentsChanged,
63 };
66
67 // Types
68 enum class ConnectStyle {
69 None,
70 ThermalRelief,
71 Solid,
72 };
73
74 // Constructors / Destructor
75 BI_Plane() = delete;
76 BI_Plane(const BI_Plane& other) = delete;
77 BI_Plane(Board& board, const Uuid& uuid, const Layer& layer,
78 NetSignal* netsignal, const Path& outline);
79 ~BI_Plane() noexcept;
80
81 // Getters
82 const Uuid& getUuid() const noexcept { return mUuid; }
83 const Layer& getLayer() const noexcept { return *mLayer; }
84 NetSignal* getNetSignal() const noexcept { return mNetSignal; }
85 const UnsignedLength& getMinWidth() const noexcept { return mMinWidth; }
86 const UnsignedLength& getMinClearance() const noexcept {
87 return mMinClearance;
88 }
89 bool getKeepIslands() const noexcept { return mKeepIslands; }
90 int getPriority() const noexcept { return mPriority; }
91 ConnectStyle getConnectStyle() const noexcept { return mConnectStyle; }
92 const PositiveLength& getThermalGap() const noexcept { return mThermalGap; }
93 const PositiveLength& getThermalSpokeWidth() const noexcept {
94 return mThermalSpokeWidth;
95 }
96 const Path& getOutline() const noexcept { return mOutline; }
97 const QVector<Path>& getFragments() const noexcept { return mFragments; }
98 bool isLocked() const noexcept { return mLocked; }
99 bool isVisible() const noexcept { return mIsVisible; }
100
101 // Setters
102 void setOutline(const Path& outline) noexcept;
103 void setLayer(const Layer& layer) noexcept;
104 void setNetSignal(NetSignal* netsignal);
105 void setMinWidth(const UnsignedLength& minWidth) noexcept;
106 void setMinClearance(const UnsignedLength& minClearance) noexcept;
107 void setConnectStyle(ConnectStyle style) noexcept;
108 void setThermalGap(const PositiveLength& gap) noexcept;
109 void setThermalSpokeWidth(const PositiveLength& width) noexcept;
110 void setPriority(int priority) noexcept;
111 void setKeepIslands(bool keep) noexcept;
112 void setLocked(bool locked) noexcept;
113 void setVisible(bool visible) noexcept;
114 void setCalculatedFragments(const QVector<Path>& fragments) noexcept;
115
116 // General Methods
117 void addToBoard() override;
118 void removeFromBoard() override;
119
125 void serialize(SExpression& root) const;
126
127 // Operator Overloadings
128 BI_Plane& operator=(const BI_Plane& rhs) = delete;
129
130private: // Data
132 const Layer* mLayer;
143 bool mIsVisible; // volatile, not saved to file
144
145 QVector<Path> mFragments;
146};
147
148/*******************************************************************************
149 * End of File
150 ******************************************************************************/
151
152} // namespace librepcb
153
154#endif
The Board Item Base (BI_Base) class.
Definition: bi_base.h:45
The BI_Plane class.
Definition: bi_plane.h:52
bool mLocked
Definition: bi_plane.h:142
const QVector< Path > & getFragments() const noexcept
Definition: bi_plane.h:97
PositiveLength mThermalSpokeWidth
Definition: bi_plane.h:141
BI_Plane & operator=(const BI_Plane &rhs)=delete
bool mKeepIslands
Definition: bi_plane.h:137
void removeFromBoard() override
Definition: bi_plane.cpp:199
int getPriority() const noexcept
Definition: bi_plane.h:90
Signal< BI_Plane, Event > onEdited
Definition: bi_plane.h:64
void setKeepIslands(bool keep) noexcept
Definition: bi_plane.cpp:150
void setLayer(const Layer &layer) noexcept
Definition: bi_plane.cpp:78
const UnsignedLength & getMinWidth() const noexcept
Definition: bi_plane.h:85
NetSignal * mNetSignal
Optional (nullptr = no net)
Definition: bi_plane.h:133
Uuid mUuid
Definition: bi_plane.h:131
int mPriority
Definition: bi_plane.h:138
const PositiveLength & getThermalSpokeWidth() const noexcept
Definition: bi_plane.h:93
Event
Definition: bi_plane.h:57
NetSignal * getNetSignal() const noexcept
Definition: bi_plane.h:84
const UnsignedLength & getMinClearance() const noexcept
Definition: bi_plane.h:86
void setCalculatedFragments(const QVector< Path > &fragments) noexcept
Definition: bi_plane.cpp:171
const Layer & getLayer() const noexcept
Definition: bi_plane.h:83
void setThermalGap(const PositiveLength &gap) noexcept
Definition: bi_plane.cpp:129
BI_Plane(const BI_Plane &other)=delete
PositiveLength mThermalGap
Definition: bi_plane.h:140
bool isLocked() const noexcept
Definition: bi_plane.h:98
QVector< Path > mFragments
Definition: bi_plane.h:145
~BI_Plane() noexcept
Definition: bi_plane.cpp:63
Path mOutline
Definition: bi_plane.h:134
Slot< BI_Plane, Event > OnEditedSlot
Definition: bi_plane.h:65
void setNetSignal(NetSignal *netsignal)
Definition: bi_plane.cpp:87
const PositiveLength & getThermalGap() const noexcept
Definition: bi_plane.h:92
void setPriority(int priority) noexcept
Definition: bi_plane.cpp:143
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: bi_plane.cpp:213
const Uuid & getUuid() const noexcept
Definition: bi_plane.h:82
void setVisible(bool visible) noexcept
Definition: bi_plane.cpp:164
void addToBoard() override
Definition: bi_plane.cpp:185
const Layer * mLayer
Mandatory (never nullptr)
Definition: bi_plane.h:132
void setConnectStyle(ConnectStyle style) noexcept
Definition: bi_plane.cpp:122
const Path & getOutline() const noexcept
Definition: bi_plane.h:96
bool getKeepIslands() const noexcept
Definition: bi_plane.h:89
UnsignedLength mMinClearance
Definition: bi_plane.h:136
void setMinWidth(const UnsignedLength &minWidth) noexcept
Definition: bi_plane.cpp:108
void setLocked(bool locked) noexcept
Definition: bi_plane.cpp:157
UnsignedLength mMinWidth
Definition: bi_plane.h:135
void setMinClearance(const UnsignedLength &minClearance) noexcept
Definition: bi_plane.cpp:115
ConnectStyle mConnectStyle
Definition: bi_plane.h:139
bool mIsVisible
Definition: bi_plane.h:143
void setOutline(const Path &outline) noexcept
Definition: bi_plane.cpp:70
ConnectStyle getConnectStyle() const noexcept
Definition: bi_plane.h:91
bool isVisible() const noexcept
Definition: bi_plane.h:99
ConnectStyle
Definition: bi_plane.h:68
void setThermalSpokeWidth(const PositiveLength &width) noexcept
Definition: bi_plane.cpp:136
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Layer class provides all supported geometry layers.
Definition: layer.h:40
The NetSignal class.
Definition: netsignal.h:50
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 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< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696