~ubuntu-branches/ubuntu/quantal/qgis/quantal

« back to all changes in this revision

Viewing changes to src/plugins/grass/qgsgrassmodel.h

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                              qgsgrasstree.h 
 
3
                             -------------------
 
4
    begin                : February, 2006
 
5
    copyright            : (C) 2006 by Radim Blazek
 
6
    email                : radim.blazek@gmail.com
 
7
 ***************************************************************************/
 
8
/***************************************************************************
 
9
 *                                                                         *
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 ***************************************************************************/
 
16
#ifndef QGSGRASSMODEL_H
 
17
#define QGSGRASSMODEL_H
 
18
 
 
19
class QCloseEvent;
 
20
class QString;
 
21
class QDomNode;
 
22
class QDomElement;
 
23
class QModelIndex;
 
24
class QVariant;
 
25
 
 
26
#include <QTreeWidget>
 
27
#include <QAbstractItemModel>
 
28
#include <QIcon>
 
29
 
 
30
class QgsGrassModelItem;
 
31
 
 
32
 
 
33
/*! \class QgsGrassModel
 
34
 *  \brief Model representing GRASS location structure.
 
35
 */
 
36
class QgsGrassModel: public QAbstractItemModel
 
37
{
 
38
    Q_OBJECT;
 
39
 
 
40
public:
 
41
    //! Constructor
 
42
    QgsGrassModel ( QObject * parent = 0 );
 
43
    //! Destructor
 
44
    ~QgsGrassModel();
 
45
 
 
46
    //! Item types
 
47
    enum ItemType { None, Gisbase, Location, Mapset, Rasters, Vectors, Raster,
 
48
                Vector, VectorLayer, Regions, Region };
 
49
 
 
50
    //! Set GISBASE and LOCATION_NAME
 
51
    void setLocation ( const QString &gisbase, const QString &location );
 
52
 
 
53
    // Refresh populated node
 
54
    void refresh();
 
55
    
 
56
    // Refresh item
 
57
    void refreshItem(QgsGrassModelItem *item) ;
 
58
 
 
59
    // Remove items missing in the list
 
60
    void removeItems ( QgsGrassModelItem *item, QStringList list ) ;
 
61
    
 
62
    // Add items missing in children
 
63
    void addItems ( QgsGrassModelItem *item, QStringList list, int type ) ;
 
64
 
 
65
    //! Item type
 
66
    int itemType(const QModelIndex &index) const;
 
67
    
 
68
    //! Item URI if it is a map 
 
69
    QString uri(const QModelIndex &index) const;
 
70
 
 
71
    // Index 
 
72
    QModelIndex index ( QgsGrassModelItem *item ) ;
 
73
 
 
74
    // Name
 
75
    QString itemName(const QModelIndex &index);
 
76
 
 
77
    // Item mapset (raster and vector)
 
78
    QString itemMapset(const QModelIndex &index);
 
79
 
 
80
    // Item map (raster and vector)
 
81
    QString itemMap(const QModelIndex &index);
 
82
 
 
83
    // Get info in HTML format
 
84
    QString itemInfo(const QModelIndex &index);
 
85
 
 
86
    // Reimplemented QAbstractItemModel methods 
 
87
    QModelIndex index ( int row, int column, 
 
88
               const QModelIndex & parent = QModelIndex() ) const;
 
89
 
 
90
    QModelIndex parent ( const QModelIndex & index ) const;
 
91
 
 
92
    int rowCount ( const QModelIndex & parent ) const;
 
93
 
 
94
    int columnCount ( const QModelIndex & parent ) const;
 
95
 
 
96
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 
97
 
 
98
    QVariant headerData(int section, Qt::Orientation orientation,
 
99
                           int role = Qt::DisplayRole) const;
 
100
    Qt::ItemFlags flags(const QModelIndex &index) const;
 
101
 
 
102
private:
 
103
    //! Current GISBASE
 
104
    QString mGisbase;
 
105
 
 
106
    //! Current LOCATION_NAME
 
107
    QString mLocation;
 
108
 
 
109
    //! Root node for current location
 
110
    QgsGrassModelItem *mRoot; 
 
111
 
 
112
    //! Icons
 
113
    QIcon mIconDirectory;
 
114
    QIcon mIconFile;
 
115
    QIcon mIconRasterLayer;
 
116
    QIcon mIconVectorLayer;
 
117
    QIcon mIconPointLayer;
 
118
    QIcon mIconLineLayer;
 
119
    QIcon mIconPolygonLayer;
 
120
};
 
121
 
 
122
#endif // QGSGRASSMODEL_H