Marble

AbstractDataPluginModel.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <[email protected]>
9 //
10 
11 #ifndef MARBLE_ABSTRACTDATAPLUGINMODEL_H
12 #define MARBLE_ABSTRACTDATAPLUGINMODEL_H
13 
14 #include <QObject>
15 #include <QList>
16 #include <QHash>
17 
18 #include "marble_export.h"
19 
20 class QPoint;
21 class QUrl;
22 class QString;
23 class QStringList;
24 
25 namespace Marble
26 {
27 
28 class AbstractDataPluginModelPrivate;
29 class AbstractDataPluginItem;
30 class GeoDataLatLonAltBox;
31 class MarbleModel;
32 class ViewportParams;
33 
44 class MARBLE_EXPORT AbstractDataPluginModel : public QObject
45 {
46  Q_OBJECT
47 
49  Q_PROPERTY( QObject* favoritesModel READ favoritesModel CONSTANT )
50 
51  public:
52  explicit AbstractDataPluginModel( const QString& name, const MarbleModel *marbleModel, QObject *parent = nullptr );
53  ~AbstractDataPluginModel() override;
54 
55  const MarbleModel *marbleModel() const;
56 
64  QList<AbstractDataPluginItem*> items( const ViewportParams *viewport,
65  qint32 number = 10 );
66 
71  QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos );
72 
78  void setItemSettings(const QHash<QString, QVariant> &itemSettings);
79 
80  virtual void setFavoriteItems( const QStringList& list );
81  QStringList favoriteItems() const;
82 
83  void setFavoriteItemsOnly( bool favoriteOnly );
84  bool isFavoriteItemsOnly() const;
85 
86  QObject* favoritesModel();
87 
92  AbstractDataPluginItem *findItem( const QString& id ) const;
93 
97  bool itemExists( const QString& id ) const;
98 
99 public Q_SLOTS:
104  void addItemsToList( const QList<AbstractDataPluginItem*> &items );
105 
109  void addItemToList( AbstractDataPluginItem *item );
110 
114  void clear();
115 
116  protected:
122  virtual void getAdditionalItems( const GeoDataLatLonAltBox& box,
123  qint32 number = 10 ) = 0;
124 
129  virtual void getItem( const QString &id );
130 
136  virtual void parseFile( const QByteArray& file );
137 
145  void downloadItem( const QUrl& url, const QString& type, AbstractDataPluginItem *item );
146 
150  void downloadDescriptionFile( const QUrl& url );
151 
152  void registerItemProperties( const QMetaObject& item );
153 
154  private Q_SLOTS:
158  void handleChangedViewport();
159 
166  void processFinishedJob( const QString& relativeUrlString, const QString& id );
167 
171  void removeItem( QObject *item );
172 
173  void favoriteItemChanged( const QString& id, bool isFavorite );
174 
175  void scheduleItemSort();
176 
177  void themeChanged();
178 
179  Q_SIGNALS:
180  void itemsUpdated();
181  void favoriteItemsChanged( const QStringList& favoriteItems );
182  void favoriteItemsOnlyChanged();
183 
184  private:
185  AbstractDataPluginModelPrivate * const d;
186  friend class AbstractDataPluginModelPrivate;
187 };
188 
189 }
190 
191 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
An abstract data model (not based on QAbstractModel) for a AbstractDataPlugin.
A public class that controls what is visible in the viewport of a Marble map.
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:91
A class that defines a 3D bounding box for geographic data.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 23:37:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.