2004-03-26 17:42:11 +00:00
|
|
|
/***************************************************************************
|
|
|
|
qgsgrassplugin.h - GRASS menu
|
|
|
|
-------------------
|
|
|
|
begin : March, 2004
|
|
|
|
copyright : (C) 2004 by Radim Blazek
|
|
|
|
email : blazek@itc.it
|
|
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
/* $Id$ */
|
|
|
|
#ifndef QGSGRASSPLUGIN_H
|
|
|
|
#define QGSGRASSPLUGIN_H
|
|
|
|
#include "../qgisplugin.h"
|
|
|
|
#include <qwidget.h>
|
2004-08-04 15:22:49 +00:00
|
|
|
#include <qpen.h>
|
2004-03-26 17:42:11 +00:00
|
|
|
|
|
|
|
#include "../../src/qgisapp.h"
|
|
|
|
|
2005-05-09 19:19:56 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2005-03-16 13:35:52 +00:00
|
|
|
class QgsGrassTools;
|
|
|
|
|
2004-03-26 17:42:11 +00:00
|
|
|
/**
|
|
|
|
* \class QgsGrassPlugin
|
|
|
|
* \brief OpenModeller plugin for QGIS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class QgsGrassPlugin:public QObject, public QgisPlugin
|
|
|
|
{
|
|
|
|
Q_OBJECT public:
|
|
|
|
/**
|
|
|
|
* Constructor for a plugin. The QgisApp and QgisIface pointers are passed by
|
|
|
|
* QGIS when it attempts to instantiate the plugin.
|
|
|
|
* @param qgis Pointer to the QgisApp object
|
|
|
|
* @param qI Pointer to the QgisIface object.
|
|
|
|
*/
|
|
|
|
QgsGrassPlugin(QgisApp * , QgisIface * );
|
|
|
|
/**
|
|
|
|
* Virtual function to return the name of the plugin. The name will be used when presenting a list
|
|
|
|
* of installable plugins to the user
|
|
|
|
*/
|
|
|
|
virtual QString name();
|
|
|
|
/**
|
|
|
|
* Virtual function to return the version of the plugin.
|
|
|
|
*/
|
|
|
|
virtual QString version();
|
|
|
|
/**
|
|
|
|
* Virtual function to return a description of the plugins functions
|
|
|
|
*/
|
|
|
|
virtual QString description();
|
|
|
|
/**
|
|
|
|
* Return the plugin type
|
|
|
|
*/
|
|
|
|
virtual int type();
|
|
|
|
//! Destructor
|
|
|
|
virtual ~ QgsGrassPlugin();
|
|
|
|
|
2004-08-04 15:22:49 +00:00
|
|
|
//! Get Region Pen
|
|
|
|
QPen & regionPen(void);
|
|
|
|
//! Set Region Pen
|
|
|
|
void setRegionPen(QPen &);
|
|
|
|
|
2004-03-26 17:42:11 +00:00
|
|
|
public slots:
|
2004-11-12 13:55:19 +00:00
|
|
|
//! init the gui
|
|
|
|
virtual void initGui();
|
2004-05-25 14:13:16 +00:00
|
|
|
//! Show the dialog box for new vector
|
|
|
|
void addVector();
|
|
|
|
//! Show the dialog box for new raster
|
|
|
|
void addRaster();
|
2004-07-12 15:25:37 +00:00
|
|
|
//! Start vector editing
|
|
|
|
void edit();
|
2004-03-26 17:42:11 +00:00
|
|
|
//! unload the plugin
|
|
|
|
void unload();
|
|
|
|
//! show the help document
|
|
|
|
void help();
|
2004-08-04 15:22:49 +00:00
|
|
|
//! Display current region
|
|
|
|
void displayRegion(QPainter *painter);
|
2005-03-04 12:02:49 +00:00
|
|
|
//! Switch region on/off
|
|
|
|
void switchRegion(bool on);
|
2004-08-04 15:22:49 +00:00
|
|
|
//! Change region
|
|
|
|
void changeRegion(void);
|
2005-03-04 12:02:49 +00:00
|
|
|
//! Post render
|
|
|
|
void postRender(QPainter *);
|
2005-03-16 13:35:52 +00:00
|
|
|
//! Open tools
|
|
|
|
void openTools(void);
|
2005-09-27 09:43:08 +00:00
|
|
|
//! Create new mapset
|
|
|
|
void newMapset();
|
|
|
|
//! Open existing mapset
|
|
|
|
void openMapset();
|
|
|
|
//! Close mapset
|
|
|
|
void closeMapset();
|
|
|
|
//! Current mapset changed (opened/closed)
|
|
|
|
void mapsetChanged();
|
2005-09-27 16:14:53 +00:00
|
|
|
//! Create new vector
|
|
|
|
void newVector();
|
2004-03-26 17:42:11 +00:00
|
|
|
|
|
|
|
private:
|
2005-02-03 05:54:43 +00:00
|
|
|
//! Check if given directory contains a GRASS installation
|
|
|
|
static bool isValidGrassBaseDir(QString const gisBase);
|
|
|
|
|
2004-03-26 17:42:11 +00:00
|
|
|
//! Name of the plugin
|
|
|
|
QString pluginNameQString;
|
|
|
|
//! Version
|
|
|
|
QString pluginVersionQString;
|
|
|
|
//! Descrption of the plugin
|
|
|
|
QString pluginDescriptionQString;
|
|
|
|
//! Plugin type as defined in QgisPlugin::PLUGINTYPE
|
|
|
|
int pluginType;
|
|
|
|
//! Id of the plugin's menu. Used for unloading
|
2005-05-09 19:19:56 +00:00
|
|
|
std::vector<int> menuId;
|
2004-03-26 17:42:11 +00:00
|
|
|
//! Pointer to our toolbar
|
|
|
|
QToolBar *toolBarPointer;
|
|
|
|
//! Pionter to QGIS main application object
|
|
|
|
QgisApp *qgisMainWindowPointer;
|
|
|
|
//! Pointer to the QGIS interface object
|
|
|
|
QgisIface *qGisInterface;
|
2004-08-04 15:22:49 +00:00
|
|
|
//! Pointer to canvas
|
|
|
|
QgsMapCanvas *mCanvas;
|
|
|
|
|
|
|
|
//! Pointer to Display region acction
|
|
|
|
QAction *mRegionAction;
|
|
|
|
//! Region width
|
|
|
|
QPen mRegionPen;
|
2005-03-16 13:35:52 +00:00
|
|
|
//! GRASS tools
|
|
|
|
QgsGrassTools *mTools;
|
2005-09-27 09:43:08 +00:00
|
|
|
|
|
|
|
// Actions
|
|
|
|
QAction *mOpenMapsetAction;
|
|
|
|
QAction *mNewMapsetAction;
|
|
|
|
QAction *mCloseMapsetAction;
|
|
|
|
QAction *mAddVectorAction;
|
|
|
|
QAction *mAddRasterAction;
|
|
|
|
QAction *mOpenToolsAction;
|
|
|
|
QAction *mEditRegionAction;
|
|
|
|
QAction *mEditAction;
|
2005-09-27 16:14:53 +00:00
|
|
|
QAction *mNewVectorAction;
|
2004-03-26 17:42:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QGSGRASSPLUGIN_H
|