LibrePCB Developers Documentation
bgi_zone.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_ZONE_H
21#define LIBREPCB_EDITOR_BGI_ZONE_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 PrimitiveZoneGraphicsItem;
40
41/*******************************************************************************
42 * Class BGI_Zone
43 ******************************************************************************/
44
48class BGI_Zone final : public QGraphicsItemGroup {
49public:
50 // Constructors / Destructor
51 BGI_Zone() = delete;
52 BGI_Zone(const BGI_Zone& other) = delete;
53 BGI_Zone(BI_Zone& zone, const IF_GraphicsLayerProvider& lp) noexcept;
54 virtual ~BGI_Zone() noexcept;
55
56 // General Methods
57 BI_Zone& getZone() noexcept { return mZone; }
59 return *mGraphicsItem;
60 }
61
69 int getLineIndexAtPosition(const Point& pos) const noexcept;
70
75 QVector<int> getVertexIndicesAtPosition(const Point& pos) const noexcept;
76
77 // Inherited from QGraphicsItem
78 QPainterPath shape() const noexcept override;
79
80 // Operator Overloadings
81 BGI_Zone& operator=(const BGI_Zone& rhs) = delete;
82
83private: // Methods
84 void zoneEdited(const BI_Zone& obj, BI_Zone::Event event) noexcept;
85 QVariant itemChange(GraphicsItemChange change,
86 const QVariant& value) noexcept override;
87 void updateZValue() noexcept;
88 void updateEditable() noexcept;
89
90private: // Data
93
94 // Slots
95 BI_Zone::OnEditedSlot mOnEditedSlot;
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace editor
103} // namespace librepcb
104
105#endif
The BI_Zone class.
Definition: bi_zone.h:46
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The BGI_Zone class.
Definition: bgi_zone.h:48
const PrimitiveZoneGraphicsItem & getGraphicsItem() const noexcept
Definition: bgi_zone.h:58
BI_Zone::OnEditedSlot mOnEditedSlot
Definition: bgi_zone.h:95
int getLineIndexAtPosition(const Point &pos) const noexcept
Definition: bgi_zone.cpp:68
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition: bgi_zone.cpp:85
virtual ~BGI_Zone() noexcept
Definition: bgi_zone.cpp:61
BGI_Zone(const BGI_Zone &other)=delete
void updateEditable() noexcept
Definition: bgi_zone.cpp:129
void zoneEdited(const BI_Zone &obj, BI_Zone::Event event) noexcept
Definition: bgi_zone.cpp:97
QPainterPath shape() const noexcept override
Definition: bgi_zone.cpp:81
QScopedPointer< PrimitiveZoneGraphicsItem > mGraphicsItem
Definition: bgi_zone.h:92
QVector< int > getVertexIndicesAtPosition(const Point &pos) const noexcept
Definition: bgi_zone.cpp:72
void updateZValue() noexcept
Definition: bgi_zone.cpp:121
BI_Zone & mZone
Definition: bgi_zone.h:91
BI_Zone & getZone() noexcept
Definition: bgi_zone.h:57
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
The PrimitiveZoneGraphicsItem class.
Definition: primitivezonegraphicsitem.h:51
Definition: occmodel.cpp:77