LibrePCB Developers Documentation
schematicselectionquery.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_SCHEMATICSELECTIONQUERY_H
21#define LIBREPCB_EDITOR_SCHEMATICSELECTIONQUERY_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28/*******************************************************************************
29 * Namespace / Forward Declarations
30 ******************************************************************************/
31namespace librepcb {
32
33class SI_NetLabel;
34class SI_NetLine;
35class SI_NetPoint;
36class SI_NetSegment;
37class SI_Polygon;
38class SI_Symbol;
39class SI_SymbolPin;
40class SI_Text;
41class Uuid;
42
43namespace editor {
44
45class SchematicGraphicsScene;
46
47/*******************************************************************************
48 * Class SchematicSelectionQuery
49 ******************************************************************************/
50
54class SchematicSelectionQuery final : public QObject {
55 Q_OBJECT
56
57public:
58 // Types
60 QSet<SI_NetPoint*> netpoints;
61 QSet<SI_NetLine*> netlines;
62 QSet<SI_NetLabel*> netlabels;
63 };
64
65 // Constructors / Destructor
69 QObject* parent = nullptr);
70 ~SchematicSelectionQuery() noexcept;
71
72 // Getters
73 const QSet<SI_Symbol*>& getSymbols() const noexcept { return mResultSymbols; }
74 const QSet<SI_NetPoint*>& getNetPoints() const noexcept {
75 return mResultNetPoints;
76 }
77 const QSet<SI_NetLine*>& getNetLines() const noexcept {
78 return mResultNetLines;
79 }
80 const QSet<SI_NetLabel*>& getNetLabels() const noexcept {
81 return mResultNetLabels;
82 }
83 const QSet<SI_Polygon*>& getPolygons() const noexcept {
84 return mResultPolygons;
85 }
86 const QSet<SI_Text*>& getTexts() const noexcept { return mResultTexts; }
87
97 QHash<SI_NetSegment*, NetSegmentItems> getNetSegmentItems() const noexcept;
98 int getResultCount() const noexcept;
99 bool isResultEmpty() const noexcept { return (getResultCount() == 0); }
100
101 // General Methods
102 void addSelectedSymbols() noexcept;
103 void addSelectedNetPoints() noexcept;
104 void addSelectedNetLines() noexcept;
105 void addSelectedNetLabels() noexcept;
106 void addSelectedPolygons() noexcept;
107 void addSelectedSchematicTexts() noexcept;
108 void addSelectedSymbolTexts() noexcept;
118 void addNetPointsOfNetLines(bool onlyIfAllNetLinesSelected = false) noexcept;
119 void addNetLinesOfSymbolPins() noexcept;
120
121 // Operator Overloadings
123 delete;
124
125private: // Data
127
128 // query result
135};
136
137/*******************************************************************************
138 * End of File
139 ******************************************************************************/
140
141} // namespace editor
142} // namespace librepcb
143
144#endif
The SI_NetLabel class.
Definition: si_netlabel.h:49
The SI_NetLine class.
Definition: si_netline.h:65
The SI_NetPoint class.
Definition: si_netpoint.h:44
The SI_Polygon class represents a polygon in a schematic.
Definition: si_polygon.h:47
The SI_Symbol class.
Definition: si_symbol.h:54
The SI_Text class represents a text label in a schematic.
Definition: si_text.h:48
The SchematicGraphicsScene class.
Definition: schematicgraphicsscene.h:67
The SchematicSelectionQuery class.
Definition: schematicselectionquery.h:54
const QSet< SI_NetPoint * > & getNetPoints() const noexcept
Definition: schematicselectionquery.h:74
SchematicGraphicsScene & mScene
Definition: schematicselectionquery.h:126
QSet< SI_Polygon * > mResultPolygons
Definition: schematicselectionquery.h:133
QSet< SI_Symbol * > mResultSymbols
Definition: schematicselectionquery.h:129
const QSet< SI_Symbol * > & getSymbols() const noexcept
Definition: schematicselectionquery.h:73
void addSelectedNetPoints() noexcept
Definition: schematicselectionquery.cpp:102
void addNetPointsOfNetLines(bool onlyIfAllNetLinesSelected=false) noexcept
Add net points of the selected net lines.
Definition: schematicselectionquery.cpp:156
void addSelectedNetLabels() noexcept
Definition: schematicselectionquery.cpp:120
QHash< SI_NetSegment *, NetSegmentItems > getNetSegmentItems() const noexcept
Get net points, net lines and net labels grouped by net segment.
Definition: schematicselectionquery.cpp:69
QSet< SI_Text * > mResultTexts
Definition: schematicselectionquery.h:134
void addNetLinesOfSymbolPins() noexcept
Definition: schematicselectionquery.cpp:174
bool isResultEmpty() const noexcept
Definition: schematicselectionquery.h:99
QSet< SI_NetLabel * > mResultNetLabels
Definition: schematicselectionquery.h:132
const QSet< SI_NetLabel * > & getNetLabels() const noexcept
Definition: schematicselectionquery.h:80
void addSelectedPolygons() noexcept
Definition: schematicselectionquery.cpp:129
void addSelectedSchematicTexts() noexcept
Definition: schematicselectionquery.cpp:138
~SchematicSelectionQuery() noexcept
Definition: schematicselectionquery.cpp:61
void addSelectedNetLines() noexcept
Definition: schematicselectionquery.cpp:111
const QSet< SI_Polygon * > & getPolygons() const noexcept
Definition: schematicselectionquery.h:83
const QSet< SI_Text * > & getTexts() const noexcept
Definition: schematicselectionquery.h:86
void addSelectedSymbolTexts() noexcept
Definition: schematicselectionquery.cpp:147
SchematicSelectionQuery(const SchematicSelectionQuery &other)=delete
const QSet< SI_NetLine * > & getNetLines() const noexcept
Definition: schematicselectionquery.h:77
QSet< SI_NetLine * > mResultNetLines
Definition: schematicselectionquery.h:131
int getResultCount() const noexcept
Definition: schematicselectionquery.cpp:83
QSet< SI_NetPoint * > mResultNetPoints
Definition: schematicselectionquery.h:130
void addSelectedSymbols() noexcept
Definition: schematicselectionquery.cpp:93
Definition: occmodel.cpp:77
Definition: schematicselectionquery.h:59
QSet< SI_NetLabel * > netlabels
Definition: schematicselectionquery.h:62
QSet< SI_NetPoint * > netpoints
Definition: schematicselectionquery.h:60
QSet< SI_NetLine * > netlines
Definition: schematicselectionquery.h:61