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

« back to all changes in this revision

Viewing changes to src/qgisiface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Halasz
  • Date: 2004-12-21 09:46:27 UTC
  • Revision ID: james.westby@ubuntu.com-20041221094627-r9lb6mlz2o3yp8gn
Tags: upstream-0.6.0
ImportĀ upstreamĀ versionĀ 0.6.0

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,v 1.24 2004/11/17 16:27:01 mcoletti Exp $ */
 
19
#include <iostream>
 
20
#include <qstring.h>
 
21
#include <qmenubar.h>
 
22
#include "qgisinterface.h"
 
23
#include "qgisapp.h"
 
24
#include "qgsmaplayer.h"
 
25
 
 
26
QgisIface::QgisIface(QgisApp * _qgis, const char *name):qgis(_qgis)
 
27
{
 
28
 
 
29
}
 
30
 
 
31
QgisIface::~QgisIface()
 
32
{
 
33
}
 
34
 
 
35
void QgisIface::zoomFull()
 
36
{
 
37
  qgis->zoomFull();
 
38
}
 
39
 
 
40
void QgisIface::zoomPrevious()
 
41
{
 
42
  qgis->zoomPrevious();
 
43
}
 
44
 
 
45
void QgisIface::zoomActiveLayer()
 
46
{
 
47
  qgis->zoomToLayerExtent();
 
48
}
 
49
 
 
50
bool QgisIface::addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)
 
51
{
 
52
  qgis->addVectorLayer(vectorLayerPath, baseName, providerKey);
 
53
  //TODO fix this so it returns something meaningfull
 
54
  return true;
 
55
}
 
56
 
 
57
bool QgisIface::addRasterLayer(QString rasterLayerPath)
 
58
{
 
59
  return qgis->addRasterLayer(rasterLayerPath);
 
60
}
 
61
 
 
62
bool QgisIface::addRasterLayer(QgsRasterLayer * theRasterLayer, bool theForceRenderFlag)
 
63
{
 
64
  return qgis->addRasterLayer(theRasterLayer, theForceRenderFlag);
 
65
}
 
66
 
 
67
bool QgisIface::addProject(QString theProjectName)
 
68
{
 
69
  return qgis->addProject(theProjectName);
 
70
}
 
71
 
 
72
void QgisIface::newProject(bool thePromptToSaveFlag)
 
73
{
 
74
  qgis->fileNew(thePromptToSaveFlag);
 
75
}
 
76
 
 
77
QgsMapLayer *QgisIface::activeLayer()
 
78
{
 
79
  return qgis->activeLayer();
 
80
}
 
81
 
 
82
QString QgisIface::activeLayerSource()
 
83
{
 
84
  return qgis->activeLayerSource();
 
85
}
 
86
/*
 
87
int QgisIface::oldAddMenu(QString menuText, QPopupMenu * menu)
 
88
{
 
89
  QMenuBar *mainMenu = qgis->menuBar();
 
90
  // get the index of the help menu 
 
91
#ifdef QGISDEBUG
 
92
  std::cout << "Menu item count is : " << mainMenu->count() << std::endl;
 
93
#endif
 
94
  return mainMenu->insertItem(menuText, menu, -1, mainMenu->count() - 1);
 
95
}
 
96
*/
 
97
 
 
98
int QgisIface::addMenu(QString menuText, QPopupMenu * menu)
 
99
{
 
100
  // add the menu to the master Plugins menu
 
101
  return qgis->addPluginMenu(menuText, menu);
 
102
}
 
103
int QgisIface::addToolBarIcon(QAction * qAction)
 
104
{
 
105
  // add the menu to the master Plugins menu
 
106
  return qgis->addPluginToolBarIcon(qAction);
 
107
}
 
108
void QgisIface::removeToolBarIcon(QAction *qAction)
 
109
{
 
110
  qgis->removePluginToolBarIcon(qAction);
 
111
}
 
112
void QgisIface::openURL(QString url, bool useQgisDocDirectory)
 
113
{
 
114
  qgis->openURL(url, useQgisDocDirectory);
 
115
}
 
116
 
 
117
std::map<QString, int> QgisIface::menuMapByName()
 
118
{
 
119
  return qgis->menuMapByName();
 
120
}
 
121
 
 
122
std::map<int, QString> QgisIface::menuMapById()
 
123
{
 
124
  return qgis->menuMapById();
 
125
}
 
126
  
 
127
QgsMapCanvas * QgisIface::getMapCanvas()
 
128
{
 
129
  return qgis->getMapCanvas();
 
130
}
 
131
 
 
132
QgsMapLayerRegistry * QgisIface::getLayerRegistry() 
 
133
{
 
134
  return qgis->getLayerRegistry();
 
135
}
 
136
 
 
137
 
 
138
QgisApp * 
 
139
QgisIface::app()
 
140
{
 
141
    return qgis;
 
142
} // QgisIface::app()