LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bi_airwire.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_AIRWIRE_H
21 #define LIBREPCB_PROJECT_BI_AIRWIRE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../graphicsitems/bgi_airwire.h"
27 #include "bi_base.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace project {
36 
37 /*******************************************************************************
38  * Class BI_AirWire
39  ******************************************************************************/
40 
44 class BI_AirWire final : public BI_Base {
45  Q_OBJECT
46 
47 public:
48  // Constructors / Destructor
49  BI_AirWire() = delete;
50  BI_AirWire(const BI_AirWire& other) = delete;
51  BI_AirWire(Board& board, const NetSignal& netsignal, const Point& p1,
52  const Point& p2);
53  ~BI_AirWire() noexcept;
54 
55  // Getters
56  const NetSignal& getNetSignal() const noexcept { return mNetSignal; }
57  const Point& getP1() const noexcept { return mP1; }
58  const Point& getP2() const noexcept { return mP2; }
59  bool isVertical() const noexcept { return mP1 == mP2; }
60 
61  // General Methods
62  void addToBoard() override;
63  void removeFromBoard() override;
64 
65  // Inherited from BI_Base
66  Type_t getType() const noexcept override { return BI_Base::Type_t::AirWire; }
67  const Point& getPosition() const noexcept override { return mP1; }
68  bool getIsMirrored() const noexcept override { return false; }
69  QPainterPath getGrabAreaScenePx() const noexcept override;
70  void setSelected(bool selected) noexcept override;
71  bool isSelectable() const noexcept override;
72 
73  // Operator Overloadings
74  BI_AirWire& operator=(const BI_AirWire& rhs) = delete;
75 
76 private:
77  QScopedPointer<BGI_AirWire> mGraphicsItem;
78  QMetaObject::Connection mHighlightChangedConnection;
82 };
83 
84 /*******************************************************************************
85  * End of File
86  ******************************************************************************/
87 
88 } // namespace project
89 } // namespace librepcb
90 
91 #endif // LIBREPCB_PROJECT_BI_AIRWIRE_H
librepcb::project::BI_AirWire
Type_t getType() const noexceptoverride
Definition: bi_airwire.h:66
const Point & getPosition() const noexceptoverride
Definition: bi_airwire.h:67
const NetSignal & getNetSignal() const noexcept
Definition: bi_airwire.h:56
bool getIsMirrored() const noexceptoverride
Definition: bi_airwire.h:68
Type_t
Definition: bi_base.h:57
Point mP2
Definition: bi_airwire.h:81
void addToBoard() override
Definition: bi_airwire.cpp:52
~BI_AirWire() noexcept
Definition: bi_airwire.cpp:45
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
QPainterPath getGrabAreaScenePx() const noexceptoverride
Definition: bi_airwire.cpp:74
The BGI_AirWire class.
Definition: bgi_airwire.h:49
The Board Item Base (BI_Base) class.
Definition: bi_base.h:52
QMetaObject::Connection mHighlightChangedConnection
Definition: bi_airwire.h:78
QScopedPointer< BGI_AirWire > mGraphicsItem
Definition: bi_airwire.h:77
bool isVertical() const noexcept
Definition: bi_airwire.h:59
const NetSignal & mNetSignal
Definition: bi_airwire.h:79
void setSelected(bool selected) noexceptoverride
Definition: bi_airwire.cpp:78
The NetSignal class.
Definition: netsignal.h:56
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:83
bool isSelectable() const noexceptoverride
Definition: bi_airwire.cpp:83
const Point & getP2() const noexcept
Definition: bi_airwire.h:58
void removeFromBoard() override
Definition: bi_airwire.cpp:62
The BI_AirWire class.
Definition: bi_airwire.h:44
const Point & getP1() const noexcept
Definition: bi_airwire.h:57
Point mP1
Definition: bi_airwire.h:80