Marble

MarblePlacemarkModel.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5//
6
7//
8// MarblePlacemarkModel exposes the model for Placemarks
9//
10
11#ifndef MARBLE_MARBLEPLACEMARKMODEL_H
12#define MARBLE_MARBLEPLACEMARKMODEL_H
13
14#include <QAbstractListModel>
15#include <QModelIndex>
16
17#include "marble_export.h"
18
19namespace Marble
20{
21
22class GeoDataCoordinates;
23class GeoDataPlacemark;
24
25/**
26 * This class represents a model of all place marks which
27 * are currently available through a given PlacemarkManager.
28 */
29class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
30{
31 friend class PlacemarkManager;
32
33 Q_OBJECT
34
35 Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
36
37public:
38 /**
39 * The roles of the place marks.
40 */
41 enum Roles {
42 GeoTypeRole = Qt::UserRole + 1, ///< The geo type (e.g. city or mountain)
43 DescriptionRole, ///< The description
44 CoordinateRole, ///< The GeoDataCoordinates coordinate
45 PopulationRole, ///< The population
46 AreaRole, ///< The area size
47 CountryCodeRole, ///< The country code
48 StateRole, ///< The state
49 VisualCategoryRole, ///< The category
50 StyleRole, ///< The style
51 PopularityIndexRole, ///< The popularity index
52 PopularityRole, ///< The popularity
53 ObjectPointerRole, ///< The pointer to a specific object
54 GmtRole, ///< The Greenwich Mean Time
55 DstRole, ///< The Daylight Saving Time
56 GeometryRole, ///< The GeoDataGeometry geometry
57 LongitudeRole, ///< The longitude in degree (for use in QML)
58 LatitudeRole, ///< The latitude in degree (for use in QML)
59 IconPathRole ///< Path to the image, if known
60 };
61
62 /**
63 * Creates a new place mark model.
64 *
65 * @param parent The parent object.
66 */
67 explicit MarblePlacemarkModel(QObject *parent = nullptr);
68
69 /**
70 * Destroys the place mark model.
71 */
72 ~MarblePlacemarkModel() override;
73
74 void setPlacemarkContainer(QList<GeoDataPlacemark *> *container);
75
76 /**
77 * Return the number of Placemarks in the Model.
78 */
79 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
80 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
81
82 /**
83 * Return the supported role names
84 */
85 QHash<int, QByteArray> roleNames() const override;
86
87 /**
88 * Return the data according to the index.
89 *
90 * @param index the index of the data
91 * @param role which part of the data to return. @see Roles
92 */
93 QVariant data(const QModelIndex &index, int role) const override;
94
95 QModelIndexList approxMatch(const QModelIndex &start,
96 int role,
97 const QVariant &value,
98 int hits = 1,
100
101 /**
102 * This method is used by the PlacemarkManager to add new
103 * place marks to the model.
104 */
105 void addPlacemarks(int start, int length);
106
107 /**
108 * This method is used by the PlacemarkManager to remove
109 * place marks from the model.
110 */
111 void removePlacemarks(const QString &containerName, int start, int length);
112
113Q_SIGNALS:
114 void countChanged();
115
116private:
117 Q_DISABLE_COPY(MarblePlacemarkModel)
118 class Private;
119 Private *const d;
120 QHash<int, QByteArray> m_roleNames;
121};
122
123}
124
125#endif
This class represents a model of all place marks which are currently available through a given Placem...
Roles
The roles of the place marks.
@ GmtRole
The Greenwich Mean Time.
@ LongitudeRole
The longitude in degree (for use in QML)
@ PopularityIndexRole
The popularity index.
@ DstRole
The Daylight Saving Time.
@ LatitudeRole
The latitude in degree (for use in QML)
@ ObjectPointerRole
The pointer to a specific object.
@ GeometryRole
The GeoDataGeometry geometry.
@ CoordinateRole
The GeoDataCoordinates coordinate.
Q_SCRIPTABLE Q_NOREPLY void start()
Binds a QML item to a specific geodetic location in screen coordinates.
UserRole
typedef MatchFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.