Marble

GeoDataTreeModel.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Thibaut Gridel <tgridel@free.fr>
4//
5
6#ifndef MARBLE_GEODATATREEMODEL_H
7#define MARBLE_GEODATATREEMODEL_H
8
9#include "marble_export.h"
10
11#include <QAbstractItemModel>
12
14
15namespace Marble
16{
17class GeoDataObject;
18class GeoDataDocument;
19class GeoDataFeature;
20class GeoDataContainer;
21class GeoDataTourPrimitive;
22
23
24/**
25 * @short The representation of GeoData in a model
26 * This class represents all available data given by kml-data files.
27 */
28class MARBLE_EXPORT GeoDataTreeModel : public QAbstractItemModel
29{
30 Q_OBJECT
31
32 public:
33
34 /**
35 * Creates a new GeoDataTreeModel.
36 *
37 * @param parent The parent object.
38 */
39 explicit GeoDataTreeModel( QObject *parent = nullptr );
40
41 /**
42 * Destroys the GeoDataModel.
43 */
44 ~GeoDataTreeModel() override;
45
46 /**
47 * Return the number of Items in the Model.
48 */
49 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
50
51 QVariant headerData(int section, Qt::Orientation orientation,
52 int role = Qt::DisplayRole) const override;
53
54 QHash<int, QByteArray> roleNames() const override;
55
56 QVariant data(const QModelIndex &index, int role) const override;
57
58 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
59
60 QModelIndex index(const GeoDataObject *object) const;
61
62 QModelIndex parent(const QModelIndex &index) const override;
63
64 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
65
66 Qt::ItemFlags flags(const QModelIndex &index) const override;
67
68 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
69
70 QItemSelectionModel *selectionModel();
71
72 GeoDataDocument *rootDocument();
73
74public Q_SLOTS:
75
76 /**
77 * Sets the root document to use. This replaces previously loaded data, if any.
78 * @param document The new root document. Ownership retains with the caller,
79 * i.e. GeoDataTreeModel will not delete the passed document at its destruction.
80 */
81 void setRootDocument( GeoDataDocument *document );
82
83 int addFeature( GeoDataContainer *parent, GeoDataFeature *feature, int row = -1 );
84
85 bool removeFeature( GeoDataContainer *parent, int index );
86
87 int removeFeature(GeoDataFeature *feature);
88
89 void updateFeature( GeoDataFeature *feature );
90
91 int addDocument( GeoDataDocument *document );
92
93 void removeDocument( int index );
94
95 void removeDocument( GeoDataDocument* document );
96
97 int addTourPrimitive( const QModelIndex &parent, GeoDataTourPrimitive *primitive, int row = -1 );
98 bool removeTourPrimitive( const QModelIndex &parent, int index );
99 bool swapTourPrimitives( const QModelIndex &parent, int indexA, int indexB );
100
101Q_SIGNALS:
102 /// insert and remove row don't trigger any signal that proxies forward
103 /// this signal will refresh geometry layer and placemark layout
104 void removed( GeoDataObject *object );
105 void added( GeoDataObject *object );
106 private:
107 Q_DISABLE_COPY( GeoDataTreeModel )
108 class Private;
109 Private* const d;
110};
111
112}
113
114#endif // MARBLE_GEODATATREEMODEL_H
A base class that can hold GeoDataFeatures.
A container for Features, Styles and in the future Schemas.
A base class for all geodata features.
A base class for all geodata objects.
The representation of GeoData in a model This class represents all available data given by kml-data f...
void removed(GeoDataObject *object)
insert and remove row don't trigger any signal that proxies forward this signal will refresh geometry...
Binds a QML item to a specific geodetic location in screen coordinates.
DisplayRole
typedef ItemFlags
Orientation
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.