LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_PROJECT_BOARDSELECTIONQUERY_H
21 #define LIBREPCB_PROJECT_BOARDSELECTIONQUERY_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 #include <librepcb/common/uuid.h>
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace project {
36 
37 class BI_Device;
38 class BI_Footprint;
39 class BI_FootprintPad;
40 class BI_Via;
41 class BI_NetSegment;
42 class BI_NetLine;
43 class BI_NetPoint;
44 class BI_Plane;
45 class BI_Polygon;
46 class BI_StrokeText;
47 class BI_Hole;
48 
49 /*******************************************************************************
50  * Class BoardSelectionQuery
51  ******************************************************************************/
52 
56 class BoardSelectionQuery final : public QObject {
57  Q_OBJECT
58 
59 public:
60  // Constructors / Destructor
61  BoardSelectionQuery() = delete;
62  BoardSelectionQuery(const BoardSelectionQuery& other) = delete;
63  BoardSelectionQuery(const QMap<Uuid, BI_Device*>& deviceInstances,
64  const QList<BI_NetSegment*>& netsegments,
65  const QList<BI_Plane*>& planes,
66  const QList<BI_Polygon*>& polygons,
67  const QList<BI_StrokeText*>& strokeTexts,
68  const QList<BI_Hole*>& holes, QObject* parent = nullptr);
69  ~BoardSelectionQuery() noexcept;
70 
71  // Getters
72  const QSet<BI_Device*>& getDeviceInstances() const noexcept {
74  }
75  const QSet<BI_NetPoint*>& getNetPoints() const noexcept {
76  return mResultNetPoints;
77  }
78  const QSet<BI_NetLine*>& getNetLines() const noexcept {
79  return mResultNetLines;
80  }
81  const QSet<BI_Via*>& getVias() const noexcept { return mResultVias; }
82  const QSet<BI_Plane*>& getPlanes() const noexcept { return mResultPlanes; }
83  const QSet<BI_Polygon*>& getPolygons() const noexcept {
84  return mResultPolygons;
85  }
86  const QSet<BI_StrokeText*>& getStrokeTexts() const noexcept {
87  return mResultStrokeTexts;
88  }
89  const QSet<BI_Hole*>& getHoles() const noexcept { return mResultHoles; }
90  int getResultCount() const noexcept;
91  bool isResultEmpty() const noexcept { return (getResultCount() == 0); }
92 
93  // General Methods
95  void addSelectedVias() noexcept;
96  void addSelectedNetPoints() noexcept;
97  void addSelectedNetLines() noexcept;
98  void addSelectedPlanes() noexcept;
99  void addSelectedPolygons() noexcept;
100  void addSelectedBoardStrokeTexts() noexcept;
101  void addSelectedFootprintStrokeTexts() noexcept;
102  void addSelectedHoles() noexcept;
103  void addNetPointsOfNetLines() noexcept;
104 
105  // Operator Overloadings
106  BoardSelectionQuery& operator=(const BoardSelectionQuery& rhs) = delete;
107 
108 private:
109  // references to the Board object
110  const QMap<Uuid, BI_Device*>& mDevices;
111  const QList<BI_NetSegment*>& mNetSegments;
112  const QList<BI_Plane*>& mPlanes;
113  const QList<BI_Polygon*>& mPolygons;
114  const QList<BI_StrokeText*>& mStrokeTexts;
115  const QList<BI_Hole*>& mHoles;
116 
117  // query result
126 };
127 
128 /*******************************************************************************
129  * End of File
130  ******************************************************************************/
131 
132 } // namespace project
133 } // namespace librepcb
134 
135 #endif // LIBREPCB_PROJECT_BOARDSELECTIONQUERY_H
QSet< BI_Hole * > mResultHoles
Definition: boardselectionquery.h:125
void addSelectedHoles() noexcept
Definition: boardselectionquery.cpp:155
const QList< BI_StrokeText * > & mStrokeTexts
Definition: boardselectionquery.h:114
const QSet< BI_Hole * > & getHoles() const noexcept
Definition: boardselectionquery.h:89
The BI_NetPoint class.
Definition: bi_netpoint.h:48
const QList< BI_NetSegment * > & mNetSegments
Definition: boardselectionquery.h:111
QSet< BI_Polygon * > mResultPolygons
Definition: boardselectionquery.h:123
The BI_StrokeText class.
Definition: bi_stroketext.h:56
QSet< BI_Plane * > mResultPlanes
Definition: boardselectionquery.h:122
void addSelectedNetLines() noexcept
Definition: boardselectionquery.cpp:111
const QMap< Uuid, BI_Device * > & mDevices
Definition: boardselectionquery.h:110
The BoardSelectionQuery class.
Definition: boardselectionquery.h:56
~BoardSelectionQuery() noexcept
Definition: boardselectionquery.cpp:65
const QList< BI_Polygon * > & mPolygons
Definition: boardselectionquery.h:113
QSet< BI_StrokeText * > mResultStrokeTexts
Definition: boardselectionquery.h:124
void addSelectedBoardStrokeTexts() noexcept
Definition: boardselectionquery.cpp:137
const QSet< BI_Via * > & getVias() const noexcept
Definition: boardselectionquery.h:81
const QSet< BI_StrokeText * > & getStrokeTexts() const noexcept
Definition: boardselectionquery.h:86
QSet< BI_Via * > mResultVias
Definition: boardselectionquery.h:121
QSet< BI_NetPoint * > mResultNetPoints
Definition: boardselectionquery.h:119
const QSet< BI_NetPoint * > & getNetPoints() const noexcept
Definition: boardselectionquery.h:75
The BI_Plane class.
Definition: bi_plane.h:56
void addSelectedPlanes() noexcept
Definition: boardselectionquery.cpp:121
bool isResultEmpty() const noexcept
Definition: boardselectionquery.h:91
The BI_NetSegment class.
Definition: bi_netsegment.h:59
void addNetPointsOfNetLines() noexcept
Definition: boardselectionquery.cpp:163
const QSet< BI_NetLine * > & getNetLines() const noexcept
Definition: boardselectionquery.h:78
void addDeviceInstancesOfSelectedFootprints() noexcept
Definition: boardselectionquery.cpp:83
The BI_Polygon class.
Definition: bi_polygon.h:59
QSet< BI_Device * > mResultDeviceInstances
Definition: boardselectionquery.h:118
The BI_Hole class.
Definition: bi_hole.h:52
int getResultCount() const noexcept
Definition: boardselectionquery.cpp:72
const QSet< BI_Polygon * > & getPolygons() const noexcept
Definition: boardselectionquery.h:83
const QSet< BI_Plane * > & getPlanes() const noexcept
Definition: boardselectionquery.h:82
void addSelectedPolygons() noexcept
Definition: boardselectionquery.cpp:129
void addSelectedNetPoints() noexcept
Definition: boardselectionquery.cpp:101
The BI_Device class.
Definition: bi_device.h:62
const QList< BI_Plane * > & mPlanes
Definition: boardselectionquery.h:112
void addSelectedVias() noexcept
Definition: boardselectionquery.cpp:91
QSet< BI_NetLine * > mResultNetLines
Definition: boardselectionquery.h:120
const QSet< BI_Device * > & getDeviceInstances() const noexcept
Definition: boardselectionquery.h:72
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The BI_NetLine class.
Definition: bi_netline.h:74
The BI_Via class.
Definition: bi_via.h:49
void addSelectedFootprintStrokeTexts() noexcept
Definition: boardselectionquery.cpp:145
const QList< BI_Hole * > & mHoles
Definition: boardselectionquery.h:115