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 <QObject>
11#include <QVector>
12#include "MarbleGlobal.h"
13
14class QString;
15
16namespace Marble
17{
18
19 class BookmarkManagerPrivate;
20 class GeoDataContainer;
21 class GeoDataDocument;
22 class GeoDataPlacemark;
23 class GeoDataCoordinates;
24 class GeoDataFolder;
25 class GeoDataTreeModel;
26 class 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
37 public:
38
39 explicit BookmarkManager( GeoDataTreeModel *treeModel, QObject *parent = nullptr );
40
41 ~BookmarkManager() override;
42
43 /**
44 * @brief load bookmark file as GeoDataDocument and return true
45 * if loaded successfully else false
46 * @param relativeFilePath relative path of bookmark file
47 */
48 bool loadFile( const QString &relativeFilePath );
49
50 /**
51 * @brief return bookmark file path
52 */
53 QString bookmarkFile() const;
54
55 /**
56 * @brief add bookmark in a folder
57 * @param bookmark bookmark to be added
58 * @param folder folder to add bookmark to
59 */
60 void addBookmark( GeoDataContainer *folder, const GeoDataPlacemark &bookmark ) ;
61
62 void updateBookmark( GeoDataPlacemark *bookmark );
63
64 void removeBookmark( GeoDataPlacemark *bookmark );
65
66 /**
67 * @brief checks all the bookmarks in container recursively and returns
68 * pointer to the one having the same coordinate as the provided
69 */
70 GeoDataPlacemark* bookmarkAt(GeoDataContainer *container, const GeoDataCoordinates &coordinate);
71
72 GeoDataDocument * document();
73 const GeoDataDocument * document() const;
74
75 bool showBookmarks() const;
76
77 /**
78 * @brief return Vector of folders
79 */
80 QVector<GeoDataFolder*> folders() const;
81
82 /**
83 * @brief add a folder
84 * @param container geodata container
85 * @param name name of folder to be created
86 * @return pointer to the newly added folder
87 */
88 GeoDataFolder* addNewBookmarkFolder( GeoDataContainer *container, const QString &name );
89
90 void renameBookmarkFolder( GeoDataFolder *folder, const QString &name );
91
92 void removeBookmarkFolder( GeoDataFolder *folder );
93
94 /**
95 * @brief checks that there is at least one folder
96 */
97
98 void ensureDefaultFolder();
99
100 /**
101 * @brief remove all folders and bookmarks except default folder
102 */
103 void removeAllBookmarks();
104
105 /**
106 * @since 0.26.0
107 */
108 void setStyleBuilder(const StyleBuilder* styleBuilder);
109
110public Q_SLOTS:
111 void setShowBookmarks( bool visible );
112
113Q_SIGNALS:
114 /** One or more bookmarks were added or removed */
116
117 private:
118 friend class BookmarkManagerDialog;
119
120 /**
121 * @brief updates bookmark file and return true if updated successfully
122 */
123 bool updateBookmarkFile();
124
125 static GeoDataDocument* openFile( const QString& fileName );
126
127 BookmarkManagerPrivate* const d;
128
129};
130
131}
132
133
134#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 Tue Mar 26 2024 11:18:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.