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
47class GraphicsLayerList;
48
49/*******************************************************************************
50 * Class BGI_Plane
51 ******************************************************************************/
52
56class BGI_Plane final : public QGraphicsItem {
57public:
58 // Constructors / Destructor
59 BGI_Plane() = delete;
60 BGI_Plane(const BGI_Plane& other) = delete;
61 BGI_Plane(BI_Plane& plane, const GraphicsLayerList& layers,
62 std::shared_ptr<const QSet<const NetSignal*>>
63 highlightedNetSignals) noexcept;
64 virtual ~BGI_Plane() noexcept;
65
66 // Getters
67
75 int getLineIndexAtPosition(const Point& pos) const noexcept;
76
81 QVector<int> getVertexIndicesAtPosition(const Point& pos) const noexcept;
82
83 // General Methods
84 BI_Plane& getPlane() noexcept { return mPlane; }
85
86 // Inherited from QGraphicsItem
87 QVariant itemChange(GraphicsItemChange change,
88 const QVariant& value) noexcept override;
89 QRectF boundingRect() const noexcept override {
90 return mBoundingRect +
93 }
94 QPainterPath shape() const noexcept override;
95 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
96 QWidget* widget = 0) noexcept override;
97
98 // Operator Overloadings
99 BGI_Plane& operator=(const BGI_Plane& rhs) = delete;
100
101private: // Methods
102 void planeEdited(const BI_Plane& obj, BI_Plane::Event event) noexcept;
103 void layerEdited(const GraphicsLayer& layer,
104 GraphicsLayer::Event event) noexcept;
105 void updateOutlineAndFragments() noexcept;
106 void updateLayer() noexcept;
107 void updateVisibility() noexcept;
108 void updateBoundingRectMargin() noexcept;
109
110private: // Data
111 // General Attributes
114 std::shared_ptr<const QSet<const NetSignal*>> mHighlightedNetSignals;
115
116 // Cached Attributes
117 std::shared_ptr<const GraphicsLayer> mLayer;
120 QPainterPath mShape;
121 QPainterPath mOutline;
122 QVector<QPainterPath> mAreas;
129 QVector<VertexHandle> mVertexHandles;
130
131 // Slots
134};
135
136/*******************************************************************************
137 * End of File
138 ******************************************************************************/
139
140} // namespace editor
141} // namespace librepcb
142
143#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:56
BI_Plane & mPlane
Definition bgi_plane.h:112
void updateBoundingRectMargin() noexcept
Definition bgi_plane.cpp:299
std::shared_ptr< const QSet< const NetSignal * > > mHighlightedNetSignals
Definition bgi_plane.h:114
QRectF boundingRect() const noexcept override
Definition bgi_plane.h:89
int getLineIndexAtPosition(const Point &pos) const noexcept
Definition bgi_plane.cpp:77
qreal mBoundingRectMarginPx
Definition bgi_plane.h:119
QVariant itemChange(GraphicsItemChange change, const QVariant &value) noexcept override
Definition bgi_plane.cpp:120
QPainterPath mShape
Definition bgi_plane.h:120
QPainterPath mOutline
Definition bgi_plane.h:121
void updateOutlineAndFragments() noexcept
Definition bgi_plane.cpp:240
qreal mVertexHandleRadiusPx
Definition bgi_plane.h:124
void planeEdited(const BI_Plane &obj, BI_Plane::Event event) noexcept
Definition bgi_plane.cpp:195
const GraphicsLayerList & mLayers
Definition bgi_plane.h:113
QPainterPath shape() const noexcept override
Definition bgi_plane.cpp:128
QVector< QPainterPath > mAreas
Definition bgi_plane.h:122
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
Definition bgi_plane.h:133
qreal mLineWidthPx
Definition bgi_plane.h:123
std::shared_ptr< const GraphicsLayer > mLayer
Definition bgi_plane.h:117
QRectF mBoundingRect
Definition bgi_plane.h:118
BGI_Plane(const BGI_Plane &other)=delete
QVector< VertexHandle > mVertexHandles
Definition bgi_plane.h:129
void layerEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition bgi_plane.cpp:220
BI_Plane::OnEditedSlot mOnEditedSlot
Definition bgi_plane.h:132
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
Definition bgi_plane.cpp:143
QVector< int > getVertexIndicesAtPosition(const Point &pos) const noexcept
Definition bgi_plane.cpp:103
void updateVisibility() noexcept
Definition bgi_plane.cpp:294
void updateLayer() noexcept
Definition bgi_plane.cpp:276
virtual ~BGI_Plane() noexcept
Definition bgi_plane.cpp:70
BI_Plane & getPlane() noexcept
Definition bgi_plane.h:84
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
Definition occmodel.cpp:77
Definition uuid.h:186
qreal maxGlowRadiusPx
Definition bgi_plane.h:127
Point pos
Definition bgi_plane.h:126