~ubuntu-branches/ubuntu/hardy/qgis/hardy

« back to all changes in this revision

Viewing changes to src/gui/qgisiface.cpp

  • 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
                          qgsiface.cpp
 
3
                          Interface class for accessing exposed functions
 
4
                          in QgisApp
 
5
                             -------------------
 
6
    copyright            : (C) 2002 by Gary E.Sherman
 
7
    email                : sherman at mrcc dot com
 
8
 ***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *                                                                         *
 
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.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
/* $Id: qgisiface.cpp 5450 2006-05-14 04:54:03Z g_j_m $ */
 
19
#include <iostream>
 
20
#include <QString>
 
21
#include <QMenu>
 
22
 
 
23
#include "qgisinterface.h"
 
24
#include "qgisapp.h"
 
25
#include "qgsmaplayer.h"
 
26
#include "qgsmapcanvas.h"
 
27
#include "qgslegend.h"
 
28
 
 
29
QgisIface::QgisIface(QgisApp * _qgis, const char *name):qgis(_qgis)
 
30
{
 
31
    connect ( qgis->legend(), SIGNAL(currentLayerChanged(QgsMapLayer *)),
 
32
              this, SLOT(emitCurrentLayerChanged(QgsMapLayer *)) );
 
33
 
 
34
}
 
35
 
 
36
QgisIface::~QgisIface()
 
37
{
 
38
}
 
39
 
 
40
void QgisIface::zoomFull()
 
41
{
 
42
  qgis->zoomFull();
 
43
}
 
44
 
 
45
void QgisIface::zoomPrevious()
 
46
{
 
47
  qgis->zoomPrevious();
 
48
}
 
49
 
 
50
void QgisIface::zoomActiveLayer()
 
51
{
 
52
  qgis->zoomToLayerExtent();
 
53
}
 
54
 
 
55
bool QgisIface::addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)
 
56
{
 
57
  qgis->addVectorLayer(vectorLayerPath, baseName, providerKey);
 
58
  //TODO fix this so it returns something meaningfull
 
59
  return true;
 
60
}
 
61
 
 
62
bool QgisIface::addRasterLayer(QString rasterLayerPath)
 
63
{
 
64
  return qgis->addRasterLayer( QStringList(rasterLayerPath) );
 
65
}
 
66
 
 
67
bool QgisIface::addRasterLayer(QgsRasterLayer * theRasterLayer, bool theForceRenderFlag)
 
68
{
 
69
  return qgis->addRasterLayer(theRasterLayer, theForceRenderFlag);
 
70
}
 
71
 
 
72
bool QgisIface::addProject(QString theProjectName)
 
73
{
 
74
  return qgis->addProject(theProjectName);
 
75
}
 
76
 
 
77
void QgisIface::newProject(bool thePromptToSaveFlag)
 
78
{
 
79
  qgis->fileNew(thePromptToSaveFlag);
 
80
}
 
81
 
 
82
QgsMapLayer *QgisIface::activeLayer()
 
83
{
 
84
  return qgis->activeLayer();
 
85
}
 
86
 
 
87
QString QgisIface::activeLayerSource()
 
88
{
 
89
  return qgis->activeLayerSource();
 
90
}
 
91
 
 
92
void QgisIface::addPluginMenu(QString name, QAction* action)
 
93
{
 
94
  qgis->addPluginMenu(name, action);
 
95
}
 
96
 
 
97
void QgisIface::removePluginMenu(QString name, QAction* action)
 
98
{
 
99
  qgis->removePluginMenu(name, action);
 
100
}
 
101
 
 
102
int QgisIface::addToolBarIcon(QAction * qAction)
 
103
{
 
104
  // add the menu to the master Plugins menu
 
105
  return qgis->addPluginToolBarIcon(qAction);
 
106
}
 
107
void QgisIface::removeToolBarIcon(QAction *qAction)
 
108
{
 
109
  qgis->removePluginToolBarIcon(qAction);
 
110
}
 
111
void QgisIface::openURL(QString url, bool useQgisDocDirectory)
 
112
{
 
113
  qgis->openURL(url, useQgisDocDirectory);
 
114
}
 
115
 
 
116
std::map<QString, int> QgisIface::menuMapByName()
 
117
{
 
118
  return qgis->menuMapByName();
 
119
}
 
120
 
 
121
std::map<int, QString> QgisIface::menuMapById()
 
122
{
 
123
  return qgis->menuMapById();
 
124
}
 
125
  
 
126
QgsMapCanvas * QgisIface::getMapCanvas()
 
127
{
 
128
  return qgis->getMapCanvas();
 
129
}
 
130
 
 
131
QgsMapLayerRegistry * QgisIface::getLayerRegistry() 
 
132
{
 
133
  return qgis->getLayerRegistry();
 
134
}
 
135
 
 
136
 
 
137
QgisApp * 
 
138
QgisIface::app()
 
139
{
 
140
    return qgis;
 
141
} // QgisIface::app()
 
142
 
 
143
void QgisIface::emitCurrentLayerChanged ( QgsMapLayer * layer )
 
144
{
 
145
    emit currentLayerChanged ( layer );
 
146
}