LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
66
67 // Types
68 enum class ConnectStyle {
69 None,
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& getMinClearanceToCopper() const noexcept {
88 }
89 const UnsignedLength& getMinClearanceToBoard() const noexcept {
91 }
92 const UnsignedLength& getMinClearanceToNpth() const noexcept {
94 }
95 bool getKeepIslands() const noexcept { return mKeepIslands; }
96 int getPriority() const noexcept { return mPriority; }
97 ConnectStyle getConnectStyle() const noexcept { return mConnectStyle; }
98 const PositiveLength& getThermalGap() const noexcept { return mThermalGap; }
99 const PositiveLength& getThermalSpokeWidth() const noexcept {
100 return mThermalSpokeWidth;
101 }
102 const Path& getOutline() const noexcept { return mOutline; }
103 const QVector<Path>& getFragments() const noexcept { return mFragments; }
104 bool isLocked() const noexcept { return mLocked; }
105 bool isVisible() const noexcept { return mIsVisible; }
106
107 // Setters
108 void setOutline(const Path& outline) noexcept;
109 void setLayer(const Layer& layer) noexcept;
110 void setNetSignal(NetSignal* netsignal);
111 void setMinWidth(const UnsignedLength& minWidth) noexcept;
112 void setMinClearanceToCopper(const UnsignedLength& minClearance) noexcept;
113 void setMinClearanceToBoard(const UnsignedLength& minClearance) noexcept;
114 void setMinClearanceToNpth(const UnsignedLength& minClearance) noexcept;
115 void setConnectStyle(ConnectStyle style) noexcept;
116 void setThermalGap(const PositiveLength& gap) noexcept;
117 void setThermalSpokeWidth(const PositiveLength& width) noexcept;
118 void setPriority(int priority) noexcept;
119 void setKeepIslands(bool keep) noexcept;
120 void setLocked(bool locked) noexcept;
121 void setVisible(bool visible) noexcept;
122 void setCalculatedFragments(const QVector<Path>& fragments) noexcept;
123
124 // General Methods
125 void addToBoard() override;
126 void removeFromBoard() override;
127
133 void serialize(SExpression& root) const;
134
135 // Operator Overloadings
136 BI_Plane& operator=(const BI_Plane& rhs) = delete;
137
138private: // Data
140 const Layer* mLayer;
153 bool mIsVisible; // volatile, not saved to file
154
155 QVector<Path> mFragments;
156};
157
158/*******************************************************************************
159 * End of File
160 ******************************************************************************/
161
162} // namespace librepcb
163
164#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:152
const QVector< Path > & getFragments() const noexcept
Definition bi_plane.h:103
PositiveLength mThermalSpokeWidth
Definition bi_plane.h:151
BI_Plane & operator=(const BI_Plane &rhs)=delete
bool mKeepIslands
Definition bi_plane.h:147
void removeFromBoard() override
Definition bi_plane.cpp:218
int getPriority() const noexcept
Definition bi_plane.h:96
Signal< BI_Plane, Event > onEdited
Definition bi_plane.h:64
void setKeepIslands(bool keep) noexcept
Definition bi_plane.cpp:169
void setLayer(const Layer &layer) noexcept
Definition bi_plane.cpp:80
const UnsignedLength & getMinWidth() const noexcept
Definition bi_plane.h:85
NetSignal * mNetSignal
Optional (nullptr = no net)
Definition bi_plane.h:141
Uuid mUuid
Definition bi_plane.h:139
int mPriority
Definition bi_plane.h:148
const PositiveLength & getThermalSpokeWidth() const noexcept
Definition bi_plane.h:99
Event
Definition bi_plane.h:57
void setMinClearanceToCopper(const UnsignedLength &minClearance) noexcept
Definition bi_plane.cpp:117
void setMinClearanceToBoard(const UnsignedLength &minClearance) noexcept
Definition bi_plane.cpp:125
NetSignal * getNetSignal() const noexcept
Definition bi_plane.h:84
void setCalculatedFragments(const QVector< Path > &fragments) noexcept
Definition bi_plane.cpp:190
const Layer & getLayer() const noexcept
Definition bi_plane.h:83
void setThermalGap(const PositiveLength &gap) noexcept
Definition bi_plane.cpp:148
BI_Plane(const BI_Plane &other)=delete
PositiveLength mThermalGap
Definition bi_plane.h:150
const UnsignedLength & getMinClearanceToCopper() const noexcept
Definition bi_plane.h:86
bool isLocked() const noexcept
Definition bi_plane.h:104
UnsignedLength mMinClearanceToNpth
Definition bi_plane.h:146
const UnsignedLength & getMinClearanceToBoard() const noexcept
Definition bi_plane.h:89
QVector< Path > mFragments
Definition bi_plane.h:155
~BI_Plane() noexcept
Definition bi_plane.cpp:65
Path mOutline
Definition bi_plane.h:142
UnsignedLength mMinClearanceToCopper
Definition bi_plane.h:144
Slot< BI_Plane, Event > OnEditedSlot
Definition bi_plane.h:65
void setNetSignal(NetSignal *netsignal)
Definition bi_plane.cpp:89
const PositiveLength & getThermalGap() const noexcept
Definition bi_plane.h:98
void setMinClearanceToNpth(const UnsignedLength &minClearance) noexcept
Definition bi_plane.cpp:133
void setPriority(int priority) noexcept
Definition bi_plane.cpp:162
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition bi_plane.cpp:232
const Uuid & getUuid() const noexcept
Definition bi_plane.h:82
void setVisible(bool visible) noexcept
Definition bi_plane.cpp:183
void addToBoard() override
Definition bi_plane.cpp:204
const Layer * mLayer
Mandatory (never nullptr)
Definition bi_plane.h:140
const UnsignedLength & getMinClearanceToNpth() const noexcept
Definition bi_plane.h:92
void setConnectStyle(ConnectStyle style) noexcept
Definition bi_plane.cpp:141
const Path & getOutline() const noexcept
Definition bi_plane.h:102
bool getKeepIslands() const noexcept
Definition bi_plane.h:95
UnsignedLength mMinClearanceToBoard
Definition bi_plane.h:145
void setMinWidth(const UnsignedLength &minWidth) noexcept
Definition bi_plane.cpp:110
void setLocked(bool locked) noexcept
Definition bi_plane.cpp:176
UnsignedLength mMinWidth
Definition bi_plane.h:143
ConnectStyle mConnectStyle
Definition bi_plane.h:149
bool mIsVisible
Definition bi_plane.h:153
void setOutline(const Path &outline) noexcept
Definition bi_plane.cpp:72
ConnectStyle getConnectStyle() const noexcept
Definition bi_plane.h:97
bool isVisible() const noexcept
Definition bi_plane.h:105
ConnectStyle
Definition bi_plane.h:68
@ ThermalRelief
Add thermal spokes to connect pads to plane.
@ None
Do not connect pads to plane.
@ Solid
Completely connect pads to plane.
void setThermalSpokeWidth(const PositiveLength &width) noexcept
Definition bi_plane.cpp:155
The Board class represents a PCB of a project and is always part of a circuit.
Definition board.h:74
The Layer class provides all supported geometry layers.
Definition layer.h:42
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:59
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:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694