LibrePCB Developers Documentation
Loading...
Searching...
No Matches
bgi_device.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_DEVICE_H
21#define LIBREPCB_EDITOR_BGI_DEVICE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicslayer.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41
42namespace editor {
43
44class GraphicsLayerList;
45class OriginCrossGraphicsItem;
46class PrimitiveCircleGraphicsItem;
47class PrimitiveHoleGraphicsItem;
48class PrimitivePathGraphicsItem;
49class PrimitiveZoneGraphicsItem;
50
51/*******************************************************************************
52 * Class BGI_Device
53 ******************************************************************************/
54
58class BGI_Device final : public QGraphicsItemGroup {
59public:
60 // Signals
61 enum class Event {
64 };
67
68 // Constructors / Destructor
69 BGI_Device() = delete;
70 BGI_Device(const BGI_Device& other) = delete;
71 BGI_Device(BI_Device& device, const GraphicsLayerList& layers) noexcept;
72 virtual ~BGI_Device() noexcept;
73
74 // General Methods
75 BI_Device& getDevice() noexcept { return mDevice; }
76
77 // Inherited from QGraphicsItem
78 QPainterPath shape() const noexcept override;
79
80 // Operator Overloadings
81 BGI_Device& operator=(const BGI_Device& rhs) = delete;
82
83private: // Methods
84 void deviceEdited(const BI_Device& obj, BI_Device::Event event) noexcept;
85 void layerEdited(const GraphicsLayer& layer,
86 GraphicsLayer::Event event) noexcept;
87 virtual QVariant itemChange(GraphicsItemChange change,
88 const QVariant& value) noexcept override;
89 void updatePosition() noexcept;
90 void updateRotationAndMirrored() noexcept;
91 void updateBoardSide() noexcept;
92 void updateHoleStopMaskOffsets() noexcept;
93 void updateZoneLayers() noexcept;
94 std::shared_ptr<const GraphicsLayer> getLayer(
95 const Layer& layer) const noexcept;
96
97private: // Data
100 std::shared_ptr<const GraphicsLayer> mGrabAreaLayer;
106 QPainterPath mShape;
107
108 // Slots
111};
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117} // namespace editor
118} // namespace librepcb
119
120#endif
The BI_Device class.
Definition bi_device.h:57
The Layer class provides all supported geometry layers.
Definition layer.h:42
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 BGI_Device class.
Definition bgi_device.h:58
void updateBoardSide() noexcept
Definition bgi_device.cpp:216
BI_Device & mDevice
Definition bgi_device.h:98
std::shared_ptr< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition bgi_device.h:101
QVector< std::shared_ptr< PrimitiveHoleGraphicsItem > > mHoleGraphicsItems
Definition bgi_device.h:105
void updatePosition() noexcept
Definition bgi_device.cpp:204
QVector< std::shared_ptr< PrimitivePathGraphicsItem > > mPolygonGraphicsItems
Definition bgi_device.h:103
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition bgi_device.cpp:183
QVector< std::shared_ptr< PrimitiveZoneGraphicsItem > > mZoneGraphicsItems
Definition bgi_device.h:104
QPainterPath mShape
Definition bgi_device.h:106
void updateHoleStopMaskOffsets() noexcept
Definition bgi_device.cpp:279
virtual ~BGI_Device() noexcept
Definition bgi_device.cpp:119
Event
Definition bgi_device.h:61
const GraphicsLayerList & mLayers
Definition bgi_device.h:99
QPainterPath shape() const noexcept override
Definition bgi_device.cpp:126
std::shared_ptr< const GraphicsLayer > mGrabAreaLayer
Definition bgi_device.h:100
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_device.h:110
BGI_Device(const BGI_Device &other)=delete
void updateRotationAndMirrored() noexcept
Definition bgi_device.cpp:209
BI_Device::OnEditedSlot mOnEditedSlot
Definition bgi_device.h:109
Signal< BGI_Device, Event > onEdited
Definition bgi_device.h:65
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_device.cpp:165
QVector< std::shared_ptr< PrimitiveCircleGraphicsItem > > mCircleGraphicsItems
Definition bgi_device.h:102
void deviceEdited(const BI_Device &obj, BI_Device::Event event) noexcept
Definition bgi_device.cpp:138
Slot< BGI_Device, Event > OnEditedSlot
Definition bgi_device.h:66
std::shared_ptr< const GraphicsLayer > getLayer(const Layer &layer) const noexcept
Definition bgi_device.cpp:317
BI_Device & getDevice() noexcept
Definition bgi_device.h:75
void updateZoneLayers() noexcept
Definition bgi_device.cpp:292
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The OriginCrossGraphicsItem class.
Definition origincrossgraphicsitem.h:50
The PrimitiveCircleGraphicsItem class.
Definition primitivecirclegraphicsitem.h:49
Independent graphical representation of a librepcb::Hole.
Definition primitiveholegraphicsitem.h:53
The PrimitivePathGraphicsItem class.
Definition primitivepathgraphicsitem.h:50
The PrimitiveZoneGraphicsItem class.
Definition primitivezonegraphicsitem.h:51
Definition occmodel.cpp:77
Definition uuid.h:186