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 OriginCrossGraphicsItem;
45class PrimitiveCircleGraphicsItem;
46class PrimitiveHoleGraphicsItem;
47class PrimitivePathGraphicsItem;
48class PrimitiveZoneGraphicsItem;
49
50/*******************************************************************************
51 * Class BGI_Device
52 ******************************************************************************/
53
57class BGI_Device final : public QGraphicsItemGroup {
58public:
59 // Signals
60 enum class Event {
63 };
66
67 // Constructors / Destructor
68 BGI_Device() = delete;
69 BGI_Device(const BGI_Device& other) = delete;
70 BGI_Device(BI_Device& device, const IF_GraphicsLayerProvider& lp) noexcept;
71 virtual ~BGI_Device() noexcept;
72
73 // General Methods
74 BI_Device& getDevice() noexcept { return mDevice; }
75
76 // Inherited from QGraphicsItem
77 QPainterPath shape() const noexcept override;
78
79 // Operator Overloadings
80 BGI_Device& operator=(const BGI_Device& rhs) = delete;
81
82private: // Methods
83 void deviceEdited(const BI_Device& obj, BI_Device::Event event) noexcept;
84 void layerEdited(const GraphicsLayer& layer,
85 GraphicsLayer::Event event) noexcept;
86 virtual QVariant itemChange(GraphicsItemChange change,
87 const QVariant& value) noexcept override;
88 void updatePosition() noexcept;
89 void updateRotationAndMirrored() noexcept;
90 void updateBoardSide() noexcept;
91 void updateHoleStopMaskOffsets() noexcept;
92 void updateZoneLayers() noexcept;
93 std::shared_ptr<GraphicsLayer> getLayer(const Layer& layer) const noexcept;
94
95private: // Data
104 QPainterPath mShape;
105
106 // Slots
109};
110
111/*******************************************************************************
112 * End of File
113 ******************************************************************************/
114
115} // namespace editor
116} // namespace librepcb
117
118#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:57
void updateBoardSide() noexcept
Definition bgi_device.cpp:216
BI_Device & mDevice
Definition bgi_device.h:96
std::shared_ptr< OriginCrossGraphicsItem > mOriginCrossGraphicsItem
Definition bgi_device.h:99
QVector< std::shared_ptr< PrimitiveHoleGraphicsItem > > mHoleGraphicsItems
Definition bgi_device.h:103
void updatePosition() noexcept
Definition bgi_device.cpp:204
QVector< std::shared_ptr< PrimitivePathGraphicsItem > > mPolygonGraphicsItems
Definition bgi_device.h:101
std::shared_ptr< GraphicsLayer > mGrabAreaLayer
Definition bgi_device.h:98
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:102
QPainterPath mShape
Definition bgi_device.h:104
void updateHoleStopMaskOffsets() noexcept
Definition bgi_device.cpp:279
virtual ~BGI_Device() noexcept
Definition bgi_device.cpp:119
Event
Definition bgi_device.h:60
QPainterPath shape() const noexcept override
Definition bgi_device.cpp:126
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_device.h:108
const IF_GraphicsLayerProvider & mLayerProvider
Definition bgi_device.h:97
BGI_Device(const BGI_Device &other)=delete
void updateRotationAndMirrored() noexcept
Definition bgi_device.cpp:209
BI_Device::OnEditedSlot mOnEditedSlot
Definition bgi_device.h:107
Signal< BGI_Device, Event > onEdited
Definition bgi_device.h:64
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_device.cpp:165
QVector< std::shared_ptr< PrimitiveCircleGraphicsItem > > mCircleGraphicsItems
Definition bgi_device.h:100
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:65
BI_Device & getDevice() noexcept
Definition bgi_device.h:74
std::shared_ptr< GraphicsLayer > getLayer(const Layer &layer) const noexcept
Definition bgi_device.cpp:317
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 IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition graphicslayer.h:111
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:76
Definition uuid.h:186