1
/***************************************************************************
3
Interface class for accessing exposed functions
6
copyright : (C) 2002 by Gary E.Sherman
7
email : sherman at mrcc dot com
8
***************************************************************************/
10
/***************************************************************************
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
17
***************************************************************************/
18
/* $Id: qgisiface.cpp 5450 2006-05-14 04:54:03Z g_j_m $ */
23
#include "qgisinterface.h"
25
#include "qgsmaplayer.h"
26
#include "qgsmapcanvas.h"
27
#include "qgslegend.h"
29
QgisIface::QgisIface(QgisApp * _qgis, const char *name):qgis(_qgis)
31
connect ( qgis->legend(), SIGNAL(currentLayerChanged(QgsMapLayer *)),
32
this, SLOT(emitCurrentLayerChanged(QgsMapLayer *)) );
36
QgisIface::~QgisIface()
40
void QgisIface::zoomFull()
45
void QgisIface::zoomPrevious()
50
void QgisIface::zoomActiveLayer()
52
qgis->zoomToLayerExtent();
55
bool QgisIface::addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)
57
qgis->addVectorLayer(vectorLayerPath, baseName, providerKey);
58
//TODO fix this so it returns something meaningfull
62
bool QgisIface::addRasterLayer(QString rasterLayerPath)
64
return qgis->addRasterLayer( QStringList(rasterLayerPath) );
67
bool QgisIface::addRasterLayer(QgsRasterLayer * theRasterLayer, bool theForceRenderFlag)
69
return qgis->addRasterLayer(theRasterLayer, theForceRenderFlag);
72
bool QgisIface::addProject(QString theProjectName)
74
return qgis->addProject(theProjectName);
77
void QgisIface::newProject(bool thePromptToSaveFlag)
79
qgis->fileNew(thePromptToSaveFlag);
82
QgsMapLayer *QgisIface::activeLayer()
84
return qgis->activeLayer();
87
QString QgisIface::activeLayerSource()
89
return qgis->activeLayerSource();
92
void QgisIface::addPluginMenu(QString name, QAction* action)
94
qgis->addPluginMenu(name, action);
97
void QgisIface::removePluginMenu(QString name, QAction* action)
99
qgis->removePluginMenu(name, action);
102
int QgisIface::addToolBarIcon(QAction * qAction)
104
// add the menu to the master Plugins menu
105
return qgis->addPluginToolBarIcon(qAction);
107
void QgisIface::removeToolBarIcon(QAction *qAction)
109
qgis->removePluginToolBarIcon(qAction);
111
void QgisIface::openURL(QString url, bool useQgisDocDirectory)
113
qgis->openURL(url, useQgisDocDirectory);
116
std::map<QString, int> QgisIface::menuMapByName()
118
return qgis->menuMapByName();
121
std::map<int, QString> QgisIface::menuMapById()
123
return qgis->menuMapById();
126
QgsMapCanvas * QgisIface::getMapCanvas()
128
return qgis->getMapCanvas();
131
QgsMapLayerRegistry * QgisIface::getLayerRegistry()
133
return qgis->getLayerRegistry();
141
} // QgisIface::app()
143
void QgisIface::emitCurrentLayerChanged ( QgsMapLayer * layer )
145
emit currentLayerChanged ( layer );