LibrePCB Developers Documentation
boardselectionquery.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_BOARDSELECTIONQUERY_H
21#define LIBREPCB_EDITOR_BOARDSELECTIONQUERY_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28/*******************************************************************************
29 * Namespace / Forward Declarations
30 ******************************************************************************/
31namespace librepcb {
32
33class BI_Device;
34class BI_FootprintPad;
35class BI_Hole;
36class BI_NetLine;
37class BI_NetPoint;
38class BI_NetSegment;
39class BI_Plane;
40class BI_Polygon;
41class BI_StrokeText;
42class BI_Via;
43class BI_Zone;
44class Uuid;
45
46namespace editor {
47
48class BoardGraphicsScene;
49
50/*******************************************************************************
51 * Class BoardSelectionQuery
52 ******************************************************************************/
53
57class BoardSelectionQuery final : public QObject {
58 Q_OBJECT
59
60public:
61 // Types
63 QSet<BI_Via*> vias;
64 QSet<BI_NetPoint*> netpoints;
65 QSet<BI_NetLine*> netlines;
66 };
67
68 // Constructors / Destructor
72 bool includeLockedItems,
73 QObject* parent = nullptr);
74 ~BoardSelectionQuery() noexcept;
75
76 // Getters
77 const QSet<BI_Device*>& getDeviceInstances() const noexcept {
79 }
80 const QSet<BI_NetPoint*>& getNetPoints() const noexcept {
81 return mResultNetPoints;
82 }
83 const QSet<BI_NetLine*>& getNetLines() const noexcept {
84 return mResultNetLines;
85 }
86 const QSet<BI_Via*>& getVias() const noexcept { return mResultVias; }
87 const QSet<BI_Plane*>& getPlanes() const noexcept { return mResultPlanes; }
88 const QSet<BI_Zone*>& getZones() const noexcept { return mResultZones; }
89 const QSet<BI_Polygon*>& getPolygons() const noexcept {
90 return mResultPolygons;
91 }
92 const QSet<BI_StrokeText*>& getStrokeTexts() const noexcept {
93 return mResultStrokeTexts;
94 }
95 const QSet<BI_Hole*>& getHoles() const noexcept { return mResultHoles; }
96
106 QHash<BI_NetSegment*, NetSegmentItems> getNetSegmentItems() const noexcept;
107 int getResultCount() const noexcept;
108 bool isResultEmpty() const noexcept { return (getResultCount() == 0); }
109
110 // General Methods
112 void addSelectedVias() noexcept;
113 void addSelectedNetPoints() noexcept;
114 void addSelectedNetLines() noexcept;
115 void addSelectedPlanes() noexcept;
116 void addSelectedZones() noexcept;
117 void addSelectedPolygons() noexcept;
118 void addSelectedBoardStrokeTexts() noexcept;
119 void addSelectedFootprintStrokeTexts() noexcept;
120 void addSelectedHoles() noexcept;
130 void addNetPointsOfNetLines(bool onlyIfAllNetLinesSelected = false) noexcept;
131
132 // Operator Overloadings
133 BoardSelectionQuery& operator=(const BoardSelectionQuery& rhs) = delete;
134
135private: // Data
138
139 // query result
149};
150
151/*******************************************************************************
152 * End of File
153 ******************************************************************************/
154
155} // namespace editor
156} // namespace librepcb
157
158#endif
The BI_Device class.
Definition: bi_device.h:57
The BI_Hole class.
Definition: bi_hole.h:46
The BI_NetLine class.
Definition: bi_netline.h:71
The BI_NetPoint class.
Definition: bi_netpoint.h:46
The BI_Plane class.
Definition: bi_plane.h:52
The BI_Polygon class.
Definition: bi_polygon.h:46
The BI_StrokeText class.
Definition: bi_stroketext.h:49
The BI_Via class.
Definition: bi_via.h:44
The BI_Zone class.
Definition: bi_zone.h:46
The BoardGraphicsScene class.
Definition: boardgraphicsscene.h:77
The BoardSelectionQuery class.
Definition: boardselectionquery.h:57
const QSet< BI_Plane * > & getPlanes() const noexcept
Definition: boardselectionquery.h:87
void addSelectedBoardStrokeTexts() noexcept
Definition: boardselectionquery.cpp:167
const QSet< BI_NetLine * > & getNetLines() const noexcept
Definition: boardselectionquery.h:83
QSet< BI_Hole * > mResultHoles
Definition: boardselectionquery.h:148
BoardSelectionQuery(const BoardSelectionQuery &other)=delete
const QSet< BI_NetPoint * > & getNetPoints() const noexcept
Definition: boardselectionquery.h:80
QSet< BI_Device * > mResultDeviceInstances
Definition: boardselectionquery.h:140
void addSelectedPlanes() noexcept
Definition: boardselectionquery.cpp:137
void addSelectedNetPoints() noexcept
Definition: boardselectionquery.cpp:119
void addNetPointsOfNetLines(bool onlyIfAllNetLinesSelected=false) noexcept
Add net points of the selected net lines.
Definition: boardselectionquery.cpp:197
void addSelectedFootprintStrokeTexts() noexcept
Definition: boardselectionquery.cpp:177
bool isResultEmpty() const noexcept
Definition: boardselectionquery.h:108
QSet< BI_Zone * > mResultZones
Definition: boardselectionquery.h:145
void addSelectedPolygons() noexcept
Definition: boardselectionquery.cpp:157
BoardGraphicsScene & mScene
Definition: boardselectionquery.h:136
void addSelectedNetLines() noexcept
Definition: boardselectionquery.cpp:128
const QSet< BI_Device * > & getDeviceInstances() const noexcept
Definition: boardselectionquery.h:77
const QSet< BI_StrokeText * > & getStrokeTexts() const noexcept
Definition: boardselectionquery.h:92
QSet< BI_Polygon * > mResultPolygons
Definition: boardselectionquery.h:146
const QSet< BI_Polygon * > & getPolygons() const noexcept
Definition: boardselectionquery.h:89
QSet< BI_StrokeText * > mResultStrokeTexts
Definition: boardselectionquery.h:147
QSet< BI_NetLine * > mResultNetLines
Definition: boardselectionquery.h:142
void addSelectedHoles() noexcept
Definition: boardselectionquery.cpp:187
const QSet< BI_Hole * > & getHoles() const noexcept
Definition: boardselectionquery.h:95
int getResultCount() const noexcept
Definition: boardselectionquery.cpp:90
QSet< BI_NetPoint * > mResultNetPoints
Definition: boardselectionquery.h:141
QSet< BI_Plane * > mResultPlanes
Definition: boardselectionquery.h:144
~BoardSelectionQuery() noexcept
Definition: boardselectionquery.cpp:68
QHash< BI_NetSegment *, NetSegmentItems > getNetSegmentItems() const noexcept
Get vias, net points and net lines grouped by net segment.
Definition: boardselectionquery.cpp:76
void addDeviceInstancesOfSelectedFootprints() noexcept
Definition: boardselectionquery.cpp:101
QSet< BI_Via * > mResultVias
Definition: boardselectionquery.h:143
const bool mIncludeLockedItems
Definition: boardselectionquery.h:137
const QSet< BI_Via * > & getVias() const noexcept
Definition: boardselectionquery.h:86
const QSet< BI_Zone * > & getZones() const noexcept
Definition: boardselectionquery.h:88
void addSelectedZones() noexcept
Definition: boardselectionquery.cpp:147
void addSelectedVias() noexcept
Definition: boardselectionquery.cpp:111
Definition: occmodel.cpp:77
Definition: boardselectionquery.h:62
QSet< BI_NetPoint * > netpoints
Definition: boardselectionquery.h:64
QSet< BI_NetLine * > netlines
Definition: boardselectionquery.h:65
QSet< BI_Via * > vias
Definition: boardselectionquery.h:63