LibrePCB Developers Documentation
bi_hole.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_HOLE_H
21 #define LIBREPCB_CORE_BI_HOLE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../../utils/signalslot.h"
27 #include "../boardholedata.h"
28 #include "bi_base.h"
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 class Board;
38 
39 /*******************************************************************************
40  * Class BI_Hole
41  ******************************************************************************/
42 
46 class BI_Hole final : public BI_Base {
47  Q_OBJECT
48 
49 public:
50  // Signals
51  enum class Event {
55  };
58 
59  // Constructors / Destructor
60  BI_Hole() = delete;
61  BI_Hole(const BI_Hole& other) = delete;
62  BI_Hole(Board& board, const BoardHoleData& data);
63  ~BI_Hole() noexcept;
64 
65  // Getters
66  const BoardHoleData& getData() const noexcept { return mData; }
67  const tl::optional<Length>& getStopMaskOffset() const noexcept {
68  return mStopMaskOffset;
69  }
70 
71  // Setters
72  bool setDiameter(const PositiveLength& diameter) noexcept;
73  bool setPath(const NonEmptyPath& path) noexcept;
74  bool setStopMaskConfig(const MaskConfig& config) noexcept;
75  bool setLocked(bool locked) noexcept;
76 
77  // General Methods
78  void addToBoard() override;
79  void removeFromBoard() override;
80 
81  // Operator Overloadings
82  BI_Hole& operator=(const BI_Hole& rhs) = delete;
83 
84 private: // Methods
85  void updateStopMaskOffset() noexcept;
86 
87 private: // Data
89 
90  // Cached Attributes
91  tl::optional<Length> mStopMaskOffset;
92 };
93 
94 /*******************************************************************************
95  * End of File
96  ******************************************************************************/
97 
98 } // namespace librepcb
99 
100 #endif
void addToBoard() override
Definition: bi_hole.cpp:96
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition: maskconfig.h:45
BI_Hole & operator=(const BI_Hole &rhs)=delete
void updateStopMaskOffset() noexcept
Definition: bi_hole.cpp:116
Definition: occmodel.cpp:77
The BI_Hole class.
Definition: bi_hole.h:46
bool setStopMaskConfig(const MaskConfig &config) noexcept
Definition: bi_hole.cpp:75
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:221
bool setLocked(bool locked) noexcept
Definition: bi_hole.cpp:84
Slot< BI_Hole, Event > OnEditedSlot
Definition: bi_hole.h:57
BoardHoleData mData
Definition: bi_hole.h:88
Event
Definition: bi_hole.h:51
Signal< BI_Hole, Event > onEdited
Definition: bi_hole.h:56
The Board Item Base (BI_Base) class.
Definition: bi_base.h:45
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
~BI_Hole() noexcept
Definition: bi_hole.cpp:47
The BoardHoleData class.
Definition: boardholedata.h:45
tl::optional< Length > mStopMaskOffset
Definition: bi_hole.h:91
const tl::optional< Length > & getStopMaskOffset() const noexcept
Definition: bi_hole.h:67
bool setPath(const NonEmptyPath &path) noexcept
Definition: bi_hole.cpp:65
const BoardHoleData & getData() const noexcept
Definition: bi_hole.h:66
bool setDiameter(const PositiveLength &diameter) noexcept
Definition: bi_hole.cpp:54
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
void removeFromBoard() override
Definition: bi_hole.cpp:104