LibrePCB Developers Documentation
bgi_footprintpad.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_EDITOR_BGI_FOOTPRINTPAD_H
21 #define LIBREPCB_EDITOR_BGI_FOOTPRINTPAD_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "bgi_device.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 #include <memory>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 
40 class NetSignal;
41 
42 namespace editor {
43 
44 class IF_GraphicsLayerProvider;
45 class PrimitiveFootprintPadGraphicsItem;
46 
47 /*******************************************************************************
48  * Class BGI_FootprintPad
49  ******************************************************************************/
50 
54 class BGI_FootprintPad final : public QGraphicsItemGroup {
55 public:
56  // Constructors / Destructor
57  BGI_FootprintPad() = delete;
58  BGI_FootprintPad(const BGI_FootprintPad& other) = delete;
59  BGI_FootprintPad(BI_FootprintPad& pad, std::weak_ptr<BGI_Device> deviceItem,
60  const IF_GraphicsLayerProvider& lp,
61  std::shared_ptr<const QSet<const NetSignal*>>
62  highlightedNetSignals) noexcept;
63  virtual ~BGI_FootprintPad() noexcept;
64 
65  // General Methods
66  BI_FootprintPad& getPad() noexcept { return mPad; }
67  const std::weak_ptr<BGI_Device>& getDeviceGraphicsItem() noexcept {
68  return mDeviceGraphicsItem;
69  }
70  void updateHighlightedNetSignals() noexcept;
71 
72  // Inherited from QGraphicsItem
73  QPainterPath shape() const noexcept override;
74 
75  // Operator Overloadings
76  BGI_FootprintPad& operator=(const BGI_FootprintPad& rhs) = delete;
77 
78 private: // Methods
79  void padEdited(const BI_FootprintPad& obj,
80  BI_FootprintPad::Event event) noexcept;
81  void deviceGraphicsItemEdited(const BGI_Device& obj,
82  BGI_Device::Event event) noexcept;
83  virtual QVariant itemChange(GraphicsItemChange change,
84  const QVariant& value) noexcept override;
85  void updateLayer() noexcept;
86  void updateHightlighted(bool selected) noexcept;
87 
88 private: // Data
90  std::weak_ptr<BGI_Device> mDeviceGraphicsItem;
91  std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
92  QScopedPointer<PrimitiveFootprintPadGraphicsItem> mGraphicsItem;
93 
94  // Slots
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace editor
104 } // namespace librepcb
105 
106 #endif
Event
Definition: bgi_device.h:60
Definition: occmodel.cpp:77
QScopedPointer< PrimitiveFootprintPadGraphicsItem > mGraphicsItem
Definition: bgi_footprintpad.h:92
BI_FootprintPad::OnEditedSlot mOnPadEditedSlot
Definition: bgi_footprintpad.h:95
virtual ~BGI_FootprintPad() noexcept
Definition: bgi_footprintpad.cpp:75
BGI_FootprintPad & operator=(const BGI_FootprintPad &rhs)=delete
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition: bgi_footprintpad.h:91
void updateHightlighted(bool selected) noexcept
Definition: bgi_footprintpad.cpp:155
const std::weak_ptr< BGI_Device > & getDeviceGraphicsItem() noexcept
Definition: bgi_footprintpad.h:67
void padEdited(const BI_FootprintPad &obj, BI_FootprintPad::Event event) noexcept
Definition: bgi_footprintpad.cpp:107
BI_FootprintPad & getPad() noexcept
Definition: bgi_footprintpad.h:66
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:111
The BGI_Device class.
Definition: bgi_device.h:57
BGI_Device::OnEditedSlot mOnDeviceEditedSlot
Definition: bgi_footprintpad.h:96
void updateHighlightedNetSignals() noexcept
Definition: bgi_footprintpad.cpp:82
The BGI_FootprintPad class.
Definition: bgi_footprintpad.h:54
QPainterPath shape() const noexcept override
Definition: bgi_footprintpad.cpp:90
void deviceGraphicsItemEdited(const BGI_Device &obj, BGI_Device::Event event) noexcept
Definition: bgi_footprintpad.cpp:135
Event
Definition: bi_footprintpad.h:53
BI_FootprintPad & mPad
Definition: bgi_footprintpad.h:89
std::weak_ptr< BGI_Device > mDeviceGraphicsItem
Definition: bgi_footprintpad.h:90
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: bgi_footprintpad.cpp:95
void updateLayer() noexcept
Definition: bgi_footprintpad.cpp:142
The BI_FootprintPad class.
Definition: bi_footprintpad.h:48