Marble

BookmarkManager.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Gaurav Gupta <1989.gaurav@googlemail.com>
4// SPDX-FileCopyrightText: 2012 Thibaut Gridel <tgridel@free.fr>
5//
6
7#ifndef MARBLE_BOOKMARKMANAGER_H
8#define MARBLE_BOOKMARKMANAGER_H
9
10#include "MarbleGlobal.h"
11#include <QList>
12#include <QObject>
13
14class QString;
15
16namespace Marble
17{
18
19class BookmarkManagerPrivate;
20class GeoDataContainer;
21class GeoDataDocument;
22class GeoDataPlacemark;
23class GeoDataCoordinates;
24class GeoDataFolder;
25class GeoDataTreeModel;
26class StyleBuilder;
27/**
28 * This class is responsible for loading the
29 * book mark objects from the files and various
30 * book mark operations
31 */
32
33class MARBLE_EXPORT BookmarkManager : public QObject
34{
35 Q_OBJECT
36
37public:
38 explicit BookmarkManager(GeoDataTreeModel *treeModel, QObject *parent = nullptr);
39
40 ~BookmarkManager() override;
41
42 /**
43 * @brief load bookmark file as GeoDataDocument and return true
44 * if loaded successfully else false
45 * @param relativeFilePath relative path of bookmark file
46 */
47 bool loadFile(const QString &relativeFilePath);
48
49 /**
50 * @brief return bookmark file path
51 */
52 QString bookmarkFile() const;
53
54 /**
55 * @brief add bookmark in a folder
56 * @param bookmark bookmark to be added
57 * @param folder folder to add bookmark to
58 */
59 void addBookmark(GeoDataContainer *folder, const GeoDataPlacemark &bookmark);
60
61 void updateBookmark(GeoDataPlacemark *bookmark);
62
63 void removeBookmark(GeoDataPlacemark *bookmark);
64
65 /**
66 * @brief checks all the bookmarks in container recursively and returns
67 * pointer to the one having the same coordinate as the provided
68 */
69 GeoDataPlacemark *bookmarkAt(GeoDataContainer *container, const GeoDataCoordinates &coordinate);
70
71 GeoDataDocument *document();
72 const GeoDataDocument *document() const;
73
74 bool showBookmarks() const;
75
76 /**
77 * @brief return Vector of folders
78 */
79 QList<GeoDataFolder *> folders() const;
80
81 /**
82 * @brief add a folder
83 * @param container geodata container
84 * @param name name of folder to be created
85 * @return pointer to the newly added folder
86 */
87 GeoDataFolder *addNewBookmarkFolder(GeoDataContainer *container, const QString &name);
88
89 void renameBookmarkFolder(GeoDataFolder *folder, const QString &name);
90
91 void removeBookmarkFolder(GeoDataFolder *folder);
92
93 /**
94 * @brief checks that there is at least one folder
95 */
96
97 void ensureDefaultFolder();
98
99 /**
100 * @brief remove all folders and bookmarks except default folder
101 */
102 void removeAllBookmarks();
103
104 /**
105 * @since 0.26.0
106 */
107 void setStyleBuilder(const StyleBuilder *styleBuilder);
108
109public Q_SLOTS:
110 void setShowBookmarks(bool visible);
111
112Q_SIGNALS:
113 /** One or more bookmarks were added or removed */
115
116private:
117 friend class BookmarkManagerDialog;
118
119 /**
120 * @brief updates bookmark file and return true if updated successfully
121 */
122 bool updateBookmarkFile();
123
124 static GeoDataDocument *openFile(const QString &fileName);
125
126 BookmarkManagerPrivate *const d;
127};
128
129}
130
131#endif
This class is responsible for loading the book mark objects from the files and various book mark oper...
void bookmarksChanged()
One or more bookmarks were added or removed.
A base class that can hold GeoDataFeatures.
A 3d point representation.
A container for Features, Styles and in the future Schemas.
A container that is used to arrange other GeoDataFeatures.
a class representing a point of interest on the map
The representation of GeoData in a model This class represents all available data given by kml-data f...
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:50:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.