blob: 3a9c5d67dc8736af9fc94cb4c3e27c12077c461b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Thibaut Gridel <tgridel@free.fr>
//
#ifndef MARBLE_GEODATATREEMODEL_H
#define MARBLE_GEODATATREEMODEL_H
// -> does not appear to be needed #include "marble_export.h"
#include <QtCore/QAbstractItemModel>
namespace Marble
{
class GeoDataObject;
class GeoDataDocument;
class GeoDataFeature;
class GeoDataContainer;
/**
* @short The representation of GeoData in a model
* This class represents all available data given by kml-data files.
*/
class MARBLE_EXPORT GeoDataTreeModel : public QAbstractItemModel
{
Q_OBJECT
public:
/**
* Creates a new GeoDataTreeModel.
*
* @param parent The parent object.
*/
explicit GeoDataTreeModel( QObject *parent = 0 );
/**
* Destroys the GeoDataModel.
*/
~GeoDataTreeModel();
virtual bool hasChildren( const QModelIndex &parent ) const;
/**
* Return the number of Items in the Model.
*/
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QVariant data( const QModelIndex &index, int role ) const;
QModelIndex index( int row, int column,
const QModelIndex &parent = QModelIndex() ) const;
QModelIndex index( GeoDataObject* object );
QModelIndex parent( const QModelIndex &index ) const;
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
Qt::ItemFlags flags ( const QModelIndex & index ) const;
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
void reset() { QAbstractItemModel::reset(); }
public Q_SLOTS:
/**
* Sets the root document to use. This replaces previously loaded data, if any.
* @param document The new root document. Ownership retains with the caller,
* i.e. GeoDataTreeModel will not delete the passed document at its destruction.
*/
void setRootDocument( GeoDataDocument *document );
GeoDataDocument* rootDocument();
int addFeature( GeoDataContainer *parent, GeoDataFeature *feature );
bool removeFeature( GeoDataContainer *parent, int index );
bool removeFeature( GeoDataFeature *feature );
void updateFeature( GeoDataFeature *feature );
int addDocument( GeoDataDocument *document );
void removeDocument( int index );
void removeDocument( GeoDataDocument* document );
void update();
Q_SIGNALS:
/// insert and remove row don't trigger any signal that proxies forward
/// this signal will refresh geometry layer and placemark layout
void removed( GeoDataObject *object );
void added( GeoDataObject *object );
private:
Q_DISABLE_COPY( GeoDataTreeModel )
class Private;
Private* const d;
};
}
#endif // MARBLE_GEODATATREEMODEL_H
|