LibrePCB Developers Documentation
Loading...
Searching...
No Matches
bgi_plane.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_PLANE_H
21#define LIBREPCB_EDITOR_BGI_PLANE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicslayer.h"
27
30
31#include <QtCore>
32#include <QtWidgets>
33
34#include <memory>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class NetSignal;
42class Path;
43class Polygon;
44
45namespace editor {
46
47/*******************************************************************************
48 * Class BGI_Plane
49 ******************************************************************************/
50
54class BGI_Plane final : public QGraphicsItem {
55public:
56 // Constructors / Destructor
57 BGI_Plane() = delete;
58 BGI_Plane(const BGI_Plane& other) = delete;
60 std::shared_ptr<const QSet<const NetSignal*>>
61 highlightedNetSignals) noexcept;
62 virtual ~BGI_Plane() noexcept;
63
64 // Getters
65
73 int getLineIndexAtPosition(const Point& pos) const noexcept;
74
79 QVector<int> getVertexIndicesAtPosition(const Point& pos) const noexcept;
80
81 // General Methods
82 BI_Plane& getPlane() noexcept { return mPlane; }
83
84 // Inherited from QGraphicsItem
85 QVariant itemChange(GraphicsItemChange change,
86 const QVariant& value) noexcept override;
87 QRectF boundingRect() const noexcept override {
88 return mBoundingRect +
91 }
92 QPainterPath shape() const noexcept override;
93 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
94 QWidget* widget = 0) noexcept override;
95
96 // Operator Overloadings
97 BGI_Plane& operator=(const BGI_Plane& rhs) = delete;
98
99private: // Methods
100 void planeEdited(const BI_Plane& obj, BI_Plane::Event event) noexcept;
101 void layerEdited(const GraphicsLayer& layer,
102 GraphicsLayer::Event event) noexcept;
103 void updateOutlineAndFragments() noexcept;
104 void updateLayer() noexcept;
105 void updateVisibility() noexcept;
106 void updateBoundingRectMargin() noexcept;
107
108private: // Data
109 // General Attributes
112 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
113
114 // Cached Attributes
118 QPainterPath mShape;
119 QPainterPath mOutline;
120 QVector<QPainterPath> mAreas;
127 QVector<VertexHandle> mVertexHandles;
128
129 // Slots
132};
133
134/*******************************************************************************
135 * End of File
136 ******************************************************************************/
137
138} // namespace editor
139} // namespace librepcb
140
141#endif
The BI_Plane class.
Definition bi_plane.h:52
The NetSignal class.
Definition netsignal.h:50
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The BGI_Plane class.
Definition bgi_plane.h:54
BI_Plane & mPlane
Definition bgi_plane.h:110
void updateBoundingRectMargin() noexcept
Definition bgi_plane.cpp:298
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition bgi_plane.h:112
QRectF boundingRect() const noexcept override
Definition bgi_plane.h:87
int getLineIndexAtPosition(const Point &pos) const noexcept
Definition bgi_plane.cpp:76
qreal mBoundingRectMarginPx
Definition bgi_plane.h:117
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition bgi_plane.cpp:119
QPainterPath mShape
Definition bgi_plane.h:118
std::shared_ptr< GraphicsLayer > mLayer
Definition bgi_plane.h:115
QPainterPath mOutline
Definition bgi_plane.h:119
void updateOutlineAndFragments() noexcept
Definition bgi_plane.cpp:239
qreal mVertexHandleRadiusPx
Definition bgi_plane.h:122
void planeEdited(const BI_Plane &obj, BI_Plane::Event event) noexcept
Definition bgi_plane.cpp:194
QPainterPath shape() const noexcept override
Definition bgi_plane.cpp:127
QVector< QPainterPath > mAreas
Definition bgi_plane.h:120
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_plane.h:131
qreal mLineWidthPx
Definition bgi_plane.h:121
const IF_GraphicsLayerProvider & mLayerProvider
Definition bgi_plane.h:111
QRectF mBoundingRect
Definition bgi_plane.h:116
BGI_Plane(const BGI_Plane &other)=delete
QVector< VertexHandle > mVertexHandles
Definition bgi_plane.h:127
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_plane.cpp:219
BI_Plane::OnEditedSlot mOnEditedSlot
Definition bgi_plane.h:130
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
Definition bgi_plane.cpp:142
QVector< int > getVertexIndicesAtPosition(const Point &pos) const noexcept
Definition bgi_plane.cpp:102
void updateVisibility() noexcept
Definition bgi_plane.cpp:293
void updateLayer() noexcept
Definition bgi_plane.cpp:275
virtual ~BGI_Plane() noexcept
Definition bgi_plane.cpp:69
BI_Plane & getPlane() noexcept
Definition bgi_plane.h:82
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
Definition occmodel.cpp:76
Definition uuid.h:186
qreal maxGlowRadiusPx
Definition bgi_plane.h:125
Point pos
Definition bgi_plane.h:124