LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_PROJECT_BI_HOLE_H
21 #define LIBREPCB_PROJECT_BI_HOLE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "bi_base.h"
27 
30 
31 #include <QtCore>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class HoleGraphicsItem;
39 
40 namespace project {
41 
42 class Project;
43 class Board;
44 
45 /*******************************************************************************
46  * Class BI_Hole
47  ******************************************************************************/
48 
52 class BI_Hole final : public BI_Base, public SerializableObject {
53  Q_OBJECT
54 
55 public:
56  // Constructors / Destructor
57  BI_Hole() = delete;
58  BI_Hole(const BI_Hole& other) = delete;
59  BI_Hole(Board& board, const BI_Hole& other);
60  BI_Hole(Board& board, const SExpression& node);
61  BI_Hole(Board& board, const Hole& hole);
62  ~BI_Hole() noexcept;
63 
64  // Getters
65  Hole& getHole() noexcept { return *mHole; }
66  const Hole& getHole() const noexcept { return *mHole; }
67  const Uuid& getUuid() const
68  noexcept; // convenience function, e.g. for template usage
69  bool isSelectable() const noexcept override;
70 
71  // General Methods
72  void addToBoard() override;
73  void removeFromBoard() override;
74 
76  void serialize(SExpression& root) const override;
77 
78  // Inherited from BI_Base
79  Type_t getType() const noexcept override { return BI_Base::Type_t::Hole; }
80  const Point& getPosition() const noexcept override;
81  bool getIsMirrored() const noexcept override { return false; }
82  QPainterPath getGrabAreaScenePx() const noexcept override;
83  void setSelected(bool selected) noexcept override;
84 
85  // Operator Overloadings
86  BI_Hole& operator=(const BI_Hole& rhs) = delete;
87 
88 private: // Methods
89  void init();
90 
91 private: // Data
92  QScopedPointer<Hole> mHole;
94 };
95 
96 /*******************************************************************************
97  * End of File
98  ******************************************************************************/
99 
100 } // namespace project
101 } // namespace librepcb
102 
103 #endif // LIBREPCB_PROJECT_BI_HOLE_H
bool getIsMirrored() const noexceptoverride
Definition: bi_hole.h:81
const Point & getPosition() const noexceptoverride
Definition: bi_hole.cpp:94
The Hole class.
Definition: hole.h:46
void addToBoard() override
Definition: bi_hole.cpp:72
QScopedPointer< HoleGraphicsItem > mGraphicsItem
Definition: bi_hole.h:93
Type_t
Definition: bi_base.h:57
const Hole & getHole() const noexcept
Definition: bi_hole.h:66
The HoleGraphicsItem class is the graphical representation of a librepcb::Hole.
Definition: holegraphicsitem.h:48
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:43
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
The BI_Hole class.
Definition: bi_hole.h:52
void init()
Definition: bi_hole.cpp:59
bool isSelectable() const noexceptoverride
Definition: bi_hole.cpp:106
The Board Item Base (BI_Base) class.
Definition: bi_base.h:52
~BI_Hole() noexcept
Definition: bi_hole.cpp:63
QPainterPath getGrabAreaScenePx() const noexceptoverride
Definition: bi_hole.cpp:98
void removeFromBoard() override
Definition: bi_hole.cpp:79
Hole & getHole() noexcept
Definition: bi_hole.h:65
Type_t getType() const noexceptoverride
Definition: bi_hole.h:79
void setSelected(bool selected) noexceptoverride
Definition: bi_hole.cpp:112
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:83
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
const Uuid & getUuid() const noexcept
Definition: bi_hole.cpp:102
The SExpression class.
Definition: sexpression.h:57
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: bi_hole.cpp:86
QScopedPointer< Hole > mHole
Definition: bi_hole.h:92
librepcb::project::BI_Hole