1
/***************************************************************************
5
copyright : (C) 2005 by Radim Blazek
7
***************************************************************************/
8
/***************************************************************************
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. *
15
***************************************************************************/
16
#ifndef QGSGRASSMODULE_H
17
#define QGSGRASSMODULE_H
33
#include <qgroupbox.h>
34
#include <qvgroupbox.h>
35
#include <qcheckbox.h>
38
// Must be here, so that it is included to moc file
39
#include "../../src/qgisapp.h"
40
#include "../../src/qgisiface.h"
42
class QgsGrassProvider;
44
class QgsGrassModuleItem;
45
#include "qgsgrassmodulebase.h"
47
/*! \class QgsGrassModule
48
* \brief Interface to GRASS modules.
51
class QgsGrassModule: public QgsGrassModuleBase
57
QgsGrassModule ( QgsGrassTools *tools, QgisApp *qgisApp, QgisIface *iface,
58
QString path, QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
63
//! Returns module label for module description path
64
static QString label ( QString path );
66
/** \brief Returns pixmap representing the module
67
* \param path module path without .qgm extension
69
static QPixmap pixmap ( QString path, int height );
71
//! Find element in GRASS module description by key, if not found, returned element is null
72
static QDomNode nodeByKey ( QDomElement gDocElem, QString key );
74
//! Returns pointer to QGIS interface
75
QgisIface *qgisIface();
77
//! Returns pointer to QGIS application
81
//! Run the module with current options
84
//! Close the module tab
87
//! Running process finished
90
//! Read module's standard output
93
//! Read module's standard error
100
//! Pointer to the QGIS interface object
103
//! Pointer to canvas
104
QgsMapCanvas *mCanvas;
106
//! Pointer to GRASS Tools
107
QgsGrassTools *mTools;
109
//! Module definition file path (.qgm file)
112
//! Name of module executable
115
//! Path to module executable
122
std::vector<QgsGrassModuleItem*> mItems;
124
//! Running GRASS module
131
/*! \class QgsGrassModuleItem
132
* \brief GRASS module option
134
class QgsGrassModuleItem
137
/*! \brief Constructor
138
* \param qdesc option element in QGIS module description XML file
139
* \param gdesc GRASS module XML description file
140
* \param gnode option node in GRASS module XML description file
142
QgsGrassModuleItem ( QgsGrassModule *module, QString key,
143
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode );
146
virtual ~QgsGrassModuleItem();
148
//! Is the item hidden
151
//! Retruns list of options which will be passed to module
152
virtual QStringList options();
156
//! Pointer to GRASS module
157
QgsGrassModule *mModule;
159
//! Option key, for flags without '-'
162
//! GRASS description
163
QString mDescription;
165
//! Hidden option or displayed
168
//! Predefined answer from config
174
/*! \class QgsGrassModuleOption
175
* \brief GRASS option
177
class QgsGrassModuleOption: public QVGroupBox, public QgsGrassModuleItem
182
/*! \brief Constructor
183
* \param qdesc option element in QGIS module description XML file
184
* \param gdesc GRASS module XML description file
186
QgsGrassModuleOption ( QgsGrassModule *module, QString key,
187
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
188
QWidget * parent = 0 );
191
~QgsGrassModuleOption();
194
enum ControlType { LineEdit, ComboBox, SpinBox, CheckBoxes };
196
//! Retruns list of options which will be passed to module
197
virtual QStringList options();
202
ControlType mControlType;
205
QComboBox *mComboBox;
207
//! Vector of values for combobox
208
std::vector<QString> mValues;
211
std::vector<QCheckBox*> mCheckBoxes;
214
QLineEdit *mLineEdit;
217
/*! \class QgsGrassModuleFlag
220
class QgsGrassModuleFlag: public QCheckBox, public QgsGrassModuleItem
225
/*! \brief Constructor
226
* \param qdesc option element in QGIS module description XML file
227
* \param gdesc GRASS module XML description file
229
QgsGrassModuleFlag ( QgsGrassModule *module, QString key,
230
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
231
QWidget * parent = 0 );
234
~QgsGrassModuleFlag();
235
//! Retruns list of options which will be passed to module
236
virtual QStringList options();
240
/*! \class QgsGrassModuleInput
241
* \brief Class representing raster or vector module input
243
class QgsGrassModuleInput: public QVGroupBox, public QgsGrassModuleItem
248
/*! \brief Constructor
249
* \param qdesc option element in QGIS module description XML file
250
* \param gdesc GRASS module XML description file
252
QgsGrassModuleInput ( QgsGrassModule *module, QString key,
253
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
254
QWidget * parent = 0 );
257
~QgsGrassModuleInput();
259
enum Type { Vector, Raster };
261
//! Retruns list of options which will be passed to module
262
virtual QStringList options();
265
//! Fill combobox with currently available maps in QGIS canvas
266
void updateQgisLayers();
272
//! Vector type mask read from option defined by "typeoption" tag, used for QGIS layers in combo
273
// + type mask defined in configuration fil
276
//! Name of vector type option associated with this input
277
QString mVectorTypeOption;
279
//! Name of vector layer option associated with this input
280
QString mVectorLayerOption;
282
//! Combobox for QGIS layers
283
QComboBox *mLayerComboBox;
285
//! Vector of map@mapset in the combobox
286
std::vector<QString> mMaps;
288
//! Type of vector in the combobox
289
std::vector<QString> mVectorTypes;
291
//! Layers of vector in the combobox
292
std::vector<QString> mVectorLayers;
294
//! The imput map will be updated -> must be from current mapset
297
#endif // QGSGRASSMODULE_H