LibrePCB Developers Documentation
bgi_polygon.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_POLYGON_H
21#define LIBREPCB_EDITOR_BGI_POLYGON_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30#include <QtWidgets>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36namespace editor {
37
38class IF_GraphicsLayerProvider;
39class PolygonGraphicsItem;
40
41/*******************************************************************************
42 * Class BGI_Polygon
43 ******************************************************************************/
44
48class BGI_Polygon final : public QGraphicsItemGroup {
49public:
50 // Constructors / Destructor
51 BGI_Polygon() = delete;
52 BGI_Polygon(const BGI_Polygon& other) = delete;
53 BGI_Polygon(BI_Polygon& polygon, const IF_GraphicsLayerProvider& lp) noexcept;
54 virtual ~BGI_Polygon() noexcept;
55
56 // General Methods
57 BI_Polygon& getPolygon() noexcept { return mPolygon; }
58 const PolygonGraphicsItem& getGraphicsItem() const noexcept {
59 return *mGraphicsItem;
60 }
61
62 // Inherited from QGraphicsItem
63 QPainterPath shape() const noexcept override;
64
65 // Operator Overloadings
66 BGI_Polygon& operator=(const BGI_Polygon& rhs) = delete;
67
68private: // Methods
69 void polygonEdited(const BI_Polygon& obj, BI_Polygon::Event event) noexcept;
70 QVariant itemChange(GraphicsItemChange change,
71 const QVariant& value) noexcept override;
72 void updateZValue() noexcept;
73 void updateEditable() noexcept;
74
75private: // Data
79
80 // Slots
82};
83
84/*******************************************************************************
85 * End of File
86 ******************************************************************************/
87
88} // namespace editor
89} // namespace librepcb
90
91#endif
The BI_Polygon class.
Definition: bi_polygon.h:46
The Polygon class.
Definition: polygon.h:45
The BGI_Polygon class.
Definition: bgi_polygon.h:48
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: bgi_polygon.cpp:70
QScopedPointer< PolygonGraphicsItem > mGraphicsItem
Definition: bgi_polygon.h:78
BGI_Polygon(const BGI_Polygon &other)=delete
void updateEditable() noexcept
Definition: bgi_polygon.cpp:117
QPainterPath shape() const noexcept override
Definition: bgi_polygon.cpp:66
const PolygonGraphicsItem & getGraphicsItem() const noexcept
Definition: bgi_polygon.h:58
void polygonEdited(const BI_Polygon &obj, BI_Polygon::Event event) noexcept
Definition: bgi_polygon.cpp:82
virtual ~BGI_Polygon() noexcept
Definition: bgi_polygon.cpp:59
BI_Polygon & getPolygon() noexcept
Definition: bgi_polygon.h:57
BI_Polygon & mPolygon
Definition: bgi_polygon.h:76
BI_Polygon::OnEditedSlot mOnEditedSlot
Definition: bgi_polygon.h:81
Polygon mPolygonObj
Definition: bgi_polygon.h:77
void updateZValue() noexcept
Definition: bgi_polygon.cpp:111
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The PolygonGraphicsItem class.
Definition: polygongraphicsitem.h:48
Definition: occmodel.cpp:77