LibrePCB Developers Documentation
Loading...
Searching...
No Matches
graphicslayerlist.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_GRAPHICSLAYERLIST_H
21#define LIBREPCB_EDITOR_GRAPHICSLAYERLIST_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28/*******************************************************************************
29 * Namespace / Forward Declarations
30 ******************************************************************************/
31namespace librepcb {
32
33class Layer;
34class Theme;
35class WorkspaceSettings;
36
37namespace editor {
38
39class GraphicsLayer;
40
41/*******************************************************************************
42 * Class GraphicsLayerList
43 ******************************************************************************/
44
48class GraphicsLayerList final : public QObject {
49public:
50 // Constructors / Destructor
52 ~GraphicsLayerList() noexcept;
53
54 // Getters
55 std::shared_ptr<GraphicsLayer> get(const QString& name) noexcept;
56 std::shared_ptr<const GraphicsLayer> get(const QString& name) const noexcept;
57 std::shared_ptr<GraphicsLayer> get(const Layer& layer) noexcept;
58 std::shared_ptr<const GraphicsLayer> get(const Layer& layer) const noexcept;
59 std::shared_ptr<const GraphicsLayer> grabArea(
60 const Layer& outlineLayer) const noexcept;
61 const QList<std::shared_ptr<GraphicsLayer>>& all() const noexcept {
62 return mLayers;
63 }
64
65 // General Methods
66 void showTop() noexcept;
67 void showBottom() noexcept;
68 void showTopAndBottom() noexcept;
69 void showAll() noexcept;
70 void showNone() noexcept;
71
72 // Static Methods
73 static std::unique_ptr<GraphicsLayerList> previewLayers(
74 const WorkspaceSettings* ws) noexcept;
75 static std::unique_ptr<GraphicsLayerList> libraryLayers(
76 const WorkspaceSettings* ws) noexcept;
77 static std::unique_ptr<GraphicsLayerList> schematicLayers(
78 const WorkspaceSettings* ws) noexcept;
79 static std::unique_ptr<GraphicsLayerList> boardLayers(
80 const WorkspaceSettings* ws) noexcept;
81
82private:
83 GraphicsLayerList(const WorkspaceSettings* ws) noexcept;
84 void add(const Theme& theme, const QString& name,
85 bool visible = true) noexcept;
86 void reloadSettings() noexcept;
87 void setVisibleLayers(const QSet<QString>& layers) noexcept;
88 static QSet<QString> getCommonLayers() noexcept;
89 static QSet<QString> getTopLayers() noexcept;
90 static QSet<QString> getBottomLayers() noexcept;
91 static QSet<QString> getAllLayers() noexcept;
92
94 QList<std::shared_ptr<GraphicsLayer>> mLayers;
95};
96
97/*******************************************************************************
98 * End of File
99 ******************************************************************************/
100
101} // namespace editor
102} // namespace librepcb
103
104#endif
The Layer class provides all supported geometry layers.
Definition layer.h:42
Theme class as used by librepcb::WorkspaceSettingsItem_Themes.
Definition theme.h:44
Container for all workspace related settings.
Definition workspacesettings.h:60
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
void showAll() noexcept
Definition graphicslayerlist.cpp:109
QList< std::shared_ptr< GraphicsLayer > > mLayers
Definition graphicslayerlist.h:94
static QSet< QString > getCommonLayers() noexcept
Definition graphicslayerlist.cpp:383
void showTop() noexcept
Definition graphicslayerlist.cpp:97
void showTopAndBottom() noexcept
Definition graphicslayerlist.cpp:105
std::shared_ptr< GraphicsLayer > get(const QString &name) noexcept
Definition graphicslayerlist.cpp:58
static std::unique_ptr< GraphicsLayerList > boardLayers(const WorkspaceSettings *ws) noexcept
Definition graphicslayerlist.cpp:295
static QSet< QString > getBottomLayers() noexcept
Definition graphicslayerlist.cpp:410
static QSet< QString > getAllLayers() noexcept
void showNone() noexcept
Definition graphicslayerlist.cpp:115
void reloadSettings() noexcept
Definition graphicslayerlist.cpp:366
static std::unique_ptr< GraphicsLayerList > previewLayers(const WorkspaceSettings *ws) noexcept
Definition graphicslayerlist.cpp:121
QPointer< const WorkspaceSettings > mSettings
Definition graphicslayerlist.h:93
const QList< std::shared_ptr< GraphicsLayer > > & all() const noexcept
Definition graphicslayerlist.h:61
void setVisibleLayers(const QSet< QString > &layers) noexcept
Definition graphicslayerlist.cpp:377
static std::unique_ptr< GraphicsLayerList > schematicLayers(const WorkspaceSettings *ws) noexcept
Definition graphicslayerlist.cpp:270
~GraphicsLayerList() noexcept
Definition graphicslayerlist.cpp:51
static QSet< QString > getTopLayers() noexcept
Definition graphicslayerlist.cpp:396
void showBottom() noexcept
Definition graphicslayerlist.cpp:101
std::shared_ptr< const GraphicsLayer > grabArea(const Layer &outlineLayer) const noexcept
Definition graphicslayerlist.cpp:88
void add(const Theme &theme, const QString &name, bool visible=true) noexcept
Definition graphicslayerlist.cpp:356
static std::unique_ptr< GraphicsLayerList > libraryLayers(const WorkspaceSettings *ws) noexcept
Definition graphicslayerlist.cpp:198
Definition occmodel.cpp:77
Definition uuid.h:186