LibrePCB Developers Documentation
bi_via.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_VIA_H
21#define LIBREPCB_CORE_BI_VIA_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../geometry/via.h"
27#include "./bi_netline.h"
28#include "bi_base.h"
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class BI_Via
39 ******************************************************************************/
40
44class BI_Via final : public BI_Base, public BI_NetLineAnchor {
45 Q_OBJECT
46
47public:
48 // Signals
49 enum class Event {
50 LayersChanged,
51 PositionChanged,
52 SizeChanged,
53 DrillDiameterChanged,
54 NetSignalNameChanged,
55 StopMaskDiametersChanged,
56 };
59
60 // Constructors / Destructor
61 BI_Via() = delete;
62 BI_Via(const BI_Via& other) = delete;
63 BI_Via(BI_NetSegment& netsegment, const Via& via);
64 ~BI_Via() noexcept;
65
66 // Getters
67 BI_NetSegment& getNetSegment() const noexcept { return mNetSegment; }
68 const Point& getPosition() const noexcept override {
69 return mVia.getPosition();
70 }
71 const Via& getVia() const noexcept { return mVia; }
72 const Uuid& getUuid() const noexcept { return mVia.getUuid(); }
73 const PositiveLength& getDrillDiameter() const noexcept {
74 return mVia.getDrillDiameter();
75 }
76 const PositiveLength& getSize() const noexcept { return mVia.getSize(); }
77 const tl::optional<PositiveLength>& getStopMaskDiameterTop() const noexcept {
79 }
80 const tl::optional<PositiveLength>& getStopMaskDiameterBottom()
81 const noexcept {
83 }
84 bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
85 tl::optional<std::pair<const Layer*, const Layer*> > getDrillLayerSpan()
86 const noexcept;
87 TraceAnchor toTraceAnchor() const noexcept override;
88
89 // Setters
90 void setLayers(const Layer& from, const Layer& to);
91 void setPosition(const Point& position) noexcept;
92 void setSize(const PositiveLength& size) noexcept;
93 void setDrillDiameter(const PositiveLength& diameter) noexcept;
94 void setExposureConfig(const MaskConfig& config) noexcept;
95
96 // General Methods
97 void addToBoard() override;
98 void removeFromBoard() override;
99
100 // Inherited from BI_NetLineAnchor
101 void registerNetLine(BI_NetLine& netline) override;
102 void unregisterNetLine(BI_NetLine& netline) override;
103 const QSet<BI_NetLine*>& getNetLines() const noexcept override {
104 return mRegisteredNetLines;
105 }
106
107 // Operator Overloadings
108 BI_Via& operator=(const BI_Via& rhs) = delete;
109 bool operator==(const BI_Via& rhs) noexcept { return (this == &rhs); }
110 bool operator!=(const BI_Via& rhs) noexcept { return (this != &rhs); }
111
112private: // Methods
113 void updateStopMaskDiameters() noexcept;
114
115private: // Data
118 QMetaObject::Connection mNetSignalNameChangedConnection;
119
120 // Cached Attributes
123
124 // Registered Elements
126};
127
128/*******************************************************************************
129 * End of File
130 ******************************************************************************/
131
132} // namespace librepcb
133
134#endif
The Board Item Base (BI_Base) class.
Definition: bi_base.h:45
Definition: bi_netline.h:46
The BI_NetLine class.
Definition: bi_netline.h:71
The BI_NetSegment class.
Definition: bi_netsegment.h:52
The BI_Via class.
Definition: bi_via.h:44
void setSize(const PositiveLength &size) noexcept
Definition: bi_via.cpp:129
~BI_Via() noexcept
Definition: bi_via.cpp:57
const Point & getPosition() const noexcept override
Definition: bi_via.h:68
BI_Via(const BI_Via &other)=delete
tl::optional< PositiveLength > mStopMaskDiameterBottom
Definition: bi_via.h:122
void removeFromBoard() override
Definition: bi_via.cpp:169
Signal< BI_Via, Event > onEdited
Definition: bi_via.h:57
bool operator!=(const BI_Via &rhs) noexcept
Definition: bi_via.h:110
void setDrillDiameter(const PositiveLength &diameter) noexcept
Definition: bi_via.cpp:137
Via mVia
Definition: bi_via.h:116
bool isUsed() const noexcept
Definition: bi_via.h:84
void updateStopMaskDiameters() noexcept
Definition: bi_via.cpp:206
Event
Definition: bi_via.h:49
void setExposureConfig(const MaskConfig &config) noexcept
Definition: bi_via.cpp:145
tl::optional< std::pair< const Layer *, const Layer * > > getDrillLayerSpan() const noexcept
Definition: bi_via.cpp:64
const PositiveLength & getDrillDiameter() const noexcept
Definition: bi_via.h:73
tl::optional< PositiveLength > mStopMaskDiameterTop
Definition: bi_via.h:121
const PositiveLength & getSize() const noexcept
Definition: bi_via.h:76
const QSet< BI_NetLine * > & getNetLines() const noexcept override
Definition: bi_via.h:103
bool operator==(const BI_Via &rhs) noexcept
Definition: bi_via.h:109
BI_NetSegment & mNetSegment
Definition: bi_via.h:117
Slot< BI_Via, Event > OnEditedSlot
Definition: bi_via.h:58
void registerNetLine(BI_NetLine &netline) override
Definition: bi_via.cpp:184
QSet< BI_NetLine * > mRegisteredNetLines
Definition: bi_via.h:125
BI_Via & operator=(const BI_Via &rhs)=delete
void setLayers(const Layer &from, const Layer &to)
Definition: bi_via.cpp:94
const Uuid & getUuid() const noexcept
Definition: bi_via.h:72
QMetaObject::Connection mNetSignalNameChangedConnection
Definition: bi_via.h:118
void unregisterNetLine(BI_NetLine &netline) override
Definition: bi_via.cpp:199
void addToBoard() override
Definition: bi_via.cpp:155
BI_NetSegment & getNetSegment() const noexcept
Definition: bi_via.h:67
const tl::optional< PositiveLength > & getStopMaskDiameterBottom() const noexcept
Definition: bi_via.h:80
TraceAnchor toTraceAnchor() const noexcept override
Definition: bi_via.cpp:86
void setPosition(const Point &position) noexcept
Definition: bi_via.cpp:116
const Via & getVia() const noexcept
Definition: bi_via.h:71
const tl::optional< PositiveLength > & getStopMaskDiameterTop() const noexcept
Definition: bi_via.h:77
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition: maskconfig.h:45
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
The TraceAnchor class.
Definition: trace.h:46
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The Via class represents a via of a board.
Definition: via.h:52
const PositiveLength & getDrillDiameter() const noexcept
Definition: via.h:85
const PositiveLength & getSize() const noexcept
Definition: via.h:84
const Point & getPosition() const noexcept
Definition: via.h:83
const Uuid & getUuid() const noexcept
Definition: via.h:80
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
Definition: uuid.h:183