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
15#include <QAbstractListModel>
16#include <QModelIndex>
17
18#include "marble_export.h"
19
20namespace Marble
21{
22
23class GeoDataCoordinates;
24class GeoDataPlacemark;
25
26/**
27 * This class represents a model of all place marks which
28 * are currently available through a given PlacemarkManager.
29 */
30class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
31{
32 friend class PlacemarkManager;
33
34 Q_OBJECT
35
36 Q_PROPERTY( int count READ rowCount NOTIFY countChanged )
37
38 public:
39 /**
40 * The roles of the place marks.
41 */
42 enum Roles
43 {
44 GeoTypeRole = Qt::UserRole + 1, ///< The geo type (e.g. city or mountain)
45 DescriptionRole, ///< The description
46 CoordinateRole, ///< The GeoDataCoordinates coordinate
47 PopulationRole, ///< The population
48 AreaRole, ///< The area size
49 CountryCodeRole, ///< The country code
50 StateRole, ///< The state
51 VisualCategoryRole, ///< The category
52 StyleRole, ///< The style
53 PopularityIndexRole, ///< The popularity index
54 PopularityRole, ///< The popularity
55 ObjectPointerRole, ///< The pointer to a specific object
56 GmtRole, ///< The Greenwich Mean Time
57 DstRole, ///< The Daylight Saving Time
58 GeometryRole, ///< The GeoDataGeometry geometry
59 LongitudeRole, ///< The longitude in degree (for use in QML)
60 LatitudeRole, ///< The latitude in degree (for use in QML)
61 IconPathRole ///< Path to the image, if known
62 };
63
64 /**
65 * Creates a new place mark model.
66 *
67 * @param parent The parent object.
68 */
69 explicit MarblePlacemarkModel( QObject *parent = nullptr );
70
71 /**
72 * Destroys the place mark model.
73 */
74 ~MarblePlacemarkModel() override;
75
76 void setPlacemarkContainer( QVector<GeoDataPlacemark*> *container );
77
78 /**
79 * Return the number of Placemarks in the Model.
80 */
81 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
82 int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
83
84 /**
85 * Return the supported role names
86 */
87 QHash<int, QByteArray> roleNames() const override;
88
89 /**
90 * Return the data according to the index.
91 *
92 * @param index the index of the data
93 * @param role which part of the data to return. @see Roles
94 */
95 QVariant data( const QModelIndex &index, int role ) const override;
96
97 QModelIndexList approxMatch( const QModelIndex &start, int role,
98 const QVariant &value, 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,
106 int length );
107
108 /**
109 * This method is used by the PlacemarkManager to remove
110 * place marks from the model.
111 */
112 void removePlacemarks( const QString &containerName,
113 int start,
114 int length );
115
116Q_SIGNALS:
117 void countChanged();
118
119 private:
120
121 Q_DISABLE_COPY( MarblePlacemarkModel )
122 class Private;
123 Private* const d;
124 QHash<int, QByteArray> m_roleNames;
125};
126
127}
128
129#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 Fri May 24 2024 11:50:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.