LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
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 std::optional<PositiveLength>& getDrillDiameter() const noexcept {
74 return mVia.getDrillDiameter();
75 }
76 PositiveLength getAutoDrillDiameter() const noexcept;
77 const PositiveLength& getActualDrillDiameter() const noexcept {
79 }
80 const std::optional<PositiveLength>& getSize() const noexcept {
81 return mVia.getSize();
82 }
83 const PositiveLength& getActualSize() const noexcept { return mActualSize; }
84 const std::optional<PositiveLength>& getStopMaskDiameterTop() const noexcept {
86 }
87 const std::optional<PositiveLength>& getStopMaskDiameterBottom()
88 const noexcept {
90 }
91 bool isUsed() const noexcept { return (mRegisteredNetLines.count() > 0); }
92 std::optional<std::pair<const Layer*, const Layer*> > getDrillLayerSpan()
93 const noexcept;
94 TraceAnchor toTraceAnchor() const noexcept override;
95
96 // Setters
97 void setLayers(const Layer& from, const Layer& to);
98 void setPosition(const Point& position) noexcept;
99 void setDrillAndSize(const std::optional<PositiveLength>& drill,
100 const std::optional<PositiveLength>& size);
101 void setExposureConfig(const MaskConfig& config) noexcept;
102
103 // General Methods
104 void addToBoard() override;
105 void removeFromBoard() override;
106
107 // Inherited from BI_NetLineAnchor
108 void registerNetLine(BI_NetLine& netline) override;
109 void unregisterNetLine(BI_NetLine& netline) override;
110 const QSet<BI_NetLine*>& getNetLines() const noexcept override {
111 return mRegisteredNetLines;
112 }
113
114 // Operator Overloadings
115 BI_Via& operator=(const BI_Via& rhs) = delete;
116 bool operator==(const BI_Via& rhs) noexcept { return (this == &rhs); }
117 bool operator!=(const BI_Via& rhs) noexcept { return (this != &rhs); }
118
119private: // Methods
120 void updateActualDrillAndSize() noexcept;
121 void updateStopMaskDiameters() noexcept;
122
123private: // Data
126 QList<QMetaObject::Connection> mConnections;
127
128 // Cached Attributes
133
134 // Registered Elements
136};
137
138/*******************************************************************************
139 * End of File
140 ******************************************************************************/
141
142} // namespace librepcb
143
144#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:53
The BI_Via class.
Definition bi_via.h:44
std::optional< std::pair< const Layer *, const Layer * > > getDrillLayerSpan() const noexcept
Definition bi_via.cpp:72
~BI_Via() noexcept
Definition bi_via.cpp:56
const Point & getPosition() const noexcept override
Definition bi_via.h:68
BI_Via(const BI_Via &other)=delete
const std::optional< PositiveLength > & getStopMaskDiameterTop() const noexcept
Definition bi_via.h:84
void removeFromBoard() override
Definition bi_via.cpp:178
void setDrillAndSize(const std::optional< PositiveLength > &drill, const std::optional< PositiveLength > &size)
Definition bi_via.cpp:137
void updateActualDrillAndSize() noexcept
Definition bi_via.cpp:214
const std::optional< PositiveLength > & getDrillDiameter() const noexcept
Definition bi_via.h:73
Signal< BI_Via, Event > onEdited
Definition bi_via.h:57
bool operator!=(const BI_Via &rhs) noexcept
Definition bi_via.h:117
Via mVia
Definition bi_via.h:124
bool isUsed() const noexcept
Definition bi_via.h:91
void updateStopMaskDiameters() noexcept
Definition bi_via.cpp:230
Event
Definition bi_via.h:49
PositiveLength mActualSize
Definition bi_via.h:130
void setExposureConfig(const MaskConfig &config) noexcept
Definition bi_via.cpp:147
PositiveLength mActualDrillDiameter
Definition bi_via.h:129
const PositiveLength & getActualSize() const noexcept
Definition bi_via.h:83
const PositiveLength & getActualDrillDiameter() const noexcept
Definition bi_via.h:77
std::optional< PositiveLength > mStopMaskDiameterTop
Definition bi_via.h:131
const QSet< BI_NetLine * > & getNetLines() const noexcept override
Definition bi_via.h:110
PositiveLength getAutoDrillDiameter() const noexcept
Definition bi_via.cpp:63
bool operator==(const BI_Via &rhs) noexcept
Definition bi_via.h:116
const std::optional< PositiveLength > & getStopMaskDiameterBottom() const noexcept
Definition bi_via.h:87
const std::optional< PositiveLength > & getSize() const noexcept
Definition bi_via.h:80
BI_NetSegment & mNetSegment
Definition bi_via.h:125
Slot< BI_Via, Event > OnEditedSlot
Definition bi_via.h:58
void registerNetLine(BI_NetLine &netline) override
Definition bi_via.cpp:192
QList< QMetaObject::Connection > mConnections
Definition bi_via.h:126
QSet< BI_NetLine * > mRegisteredNetLines
Definition bi_via.h:135
BI_Via & operator=(const BI_Via &rhs)=delete
void setLayers(const Layer &from, const Layer &to)
Definition bi_via.cpp:102
const Uuid & getUuid() const noexcept
Definition bi_via.h:72
void unregisterNetLine(BI_NetLine &netline) override
Definition bi_via.cpp:207
void addToBoard() override
Definition bi_via.cpp:157
BI_NetSegment & getNetSegment() const noexcept
Definition bi_via.h:67
TraceAnchor toTraceAnchor() const noexcept override
Definition bi_via.cpp:94
std::optional< PositiveLength > mStopMaskDiameterBottom
Definition bi_via.h:132
void setPosition(const Point &position) noexcept
Definition bi_via.cpp:124
const Via & getVia() const noexcept
Definition bi_via.h:71
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:78
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 TraceAnchor class.
Definition trace.h:45
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The Via class represents a via of a board.
Definition via.h:55
const std::optional< PositiveLength > & getDrillDiameter() const noexcept
Definition via.h:86
const std::optional< PositiveLength > & getSize() const noexcept
Definition via.h:89
const Point & getPosition() const noexcept
Definition via.h:85
const Uuid & getUuid() const noexcept
Definition via.h:82
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186