00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <iostream>
00021 #include <QFileInfo>
00022 #include <QString>
00023 #include <QMenu>
00024
00025 #include "qgisappinterface.h"
00026 #include "qgisapp.h"
00027 #include "qgsmaplayer.h"
00028 #include "qgsmaplayerregistry.h"
00029 #include "qgsmapcanvas.h"
00030 #include "qgslegend.h"
00031
00032 QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
00033 : qgis( _qgis )
00034 {
00035
00036 connect( qgis->legend(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
00037 this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
00038
00039 }
00040
00041 QgisAppInterface::~QgisAppInterface()
00042 {
00043 }
00044
00045 void QgisAppInterface::zoomFull()
00046 {
00047 qgis->zoomFull();
00048 }
00049
00050 void QgisAppInterface::zoomToPrevious()
00051 {
00052 qgis->zoomToPrevious();
00053 }
00054
00055 void QgisAppInterface::zoomToActiveLayer()
00056 {
00057 qgis->zoomToLayerExtent();
00058 }
00059
00060 QgsVectorLayer* QgisAppInterface::addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey )
00061 {
00062 if ( baseName.isEmpty() )
00063 {
00064 QFileInfo fi( vectorLayerPath );
00065 baseName = fi.completeBaseName();
00066 }
00067 return qgis->addVectorLayer( vectorLayerPath, baseName, providerKey );
00068 }
00069
00070 QgsRasterLayer* QgisAppInterface::addRasterLayer( QString rasterLayerPath, QString baseName )
00071 {
00072 if ( baseName.isEmpty() )
00073 {
00074 QFileInfo fi( rasterLayerPath );
00075 baseName = fi.completeBaseName();
00076 }
00077 return qgis->addRasterLayer( rasterLayerPath, baseName );
00078 }
00079
00080 QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey,
00081 const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs )
00082 {
00083 return qgis->addRasterLayer( url, baseName, providerKey, layers, styles, format, crs );
00084 }
00085
00086
00087 bool QgisAppInterface::addProject( QString theProjectName )
00088 {
00089 return qgis->addProject( theProjectName );
00090 }
00091
00092 void QgisAppInterface::newProject( bool thePromptToSaveFlag )
00093 {
00094 qgis->fileNew( thePromptToSaveFlag );
00095 }
00096
00097 QgsMapLayer *QgisAppInterface::activeLayer()
00098 {
00099 return qgis->activeLayer();
00100 }
00101
00102 void QgisAppInterface::addPluginToMenu( QString name, QAction* action )
00103 {
00104 qgis->addPluginToMenu( name, action );
00105 }
00106
00107 void QgisAppInterface::removePluginMenu( QString name, QAction* action )
00108 {
00109 qgis->removePluginMenu( name, action );
00110 }
00111
00112 int QgisAppInterface::addToolBarIcon( QAction * qAction )
00113 {
00114
00115 return qgis->addPluginToolBarIcon( qAction );
00116 }
00117 void QgisAppInterface::removeToolBarIcon( QAction *qAction )
00118 {
00119 qgis->removePluginToolBarIcon( qAction );
00120 }
00121 QToolBar* QgisAppInterface::addToolBar( QString name )
00122 {
00123 return qgis->addToolBar( name );
00124 }
00125
00126 void QgisAppInterface::openURL( QString url, bool useQgisDocDirectory )
00127 {
00128 qgis->openURL( url, useQgisDocDirectory );
00129 }
00130
00131 QgsMapCanvas * QgisAppInterface::mapCanvas()
00132 {
00133 return qgis->mapCanvas();
00134 }
00135
00136 QWidget * QgisAppInterface::mainWindow()
00137 {
00138 return qgis;
00139 }
00140
00141 void QgisAppInterface::addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget )
00142 {
00143 qgis->addDockWidget( area, dockwidget );
00144 }
00145
00146 void QgisAppInterface::refreshLegend( QgsMapLayer *l )
00147 {
00148 if ( l && qgis && qgis->legend() )
00149 {
00150 qgis->legend()->refreshLayerSymbology( l->getLayerID() );
00151 }
00152 }
00153
00154 void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
00155 void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }
00156
00158 QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
00159 QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }
00160 QMenu *QgisAppInterface::viewMenu() { return qgis->viewMenu(); }
00161 QMenu *QgisAppInterface::layerMenu() { return qgis->layerMenu(); }
00162 QMenu *QgisAppInterface::settingsMenu() { return qgis->settingsMenu(); }
00163 QMenu *QgisAppInterface::pluginMenu() { return qgis->pluginMenu(); }
00164 QMenu *QgisAppInterface::firstRightStandardMenu() { return qgis->firstRightStandardMenu(); }
00165 QMenu *QgisAppInterface::windowMenu() { return qgis->windowMenu(); }
00166 QMenu *QgisAppInterface::helpMenu() { return qgis->helpMenu(); }
00167
00169 QToolBar *QgisAppInterface::fileToolBar() { return qgis->fileToolBar(); }
00170 QToolBar *QgisAppInterface::layerToolBar() { return qgis->layerToolBar(); }
00171 QToolBar *QgisAppInterface::mapNavToolToolBar() { return qgis->mapNavToolToolBar(); }
00172 QToolBar *QgisAppInterface::digitizeToolBar() { return qgis->digitizeToolBar(); }
00173 QToolBar *QgisAppInterface::attributesToolBar() { return qgis->attributesToolBar(); }
00174 QToolBar *QgisAppInterface::pluginToolBar() { return qgis->pluginToolBar(); }
00175 QToolBar *QgisAppInterface::helpToolBar() { return qgis->helpToolBar(); }
00176
00178 QAction *QgisAppInterface::actionNewProject() { return qgis->actionNewProject(); }
00179 QAction *QgisAppInterface::actionOpenProject() { return qgis->actionOpenProject(); }
00180 QAction *QgisAppInterface::actionFileSeparator1() { return qgis->actionFileSeparator1(); }
00181 QAction *QgisAppInterface::actionSaveProject() { return qgis->actionSaveProject(); }
00182 QAction *QgisAppInterface::actionSaveProjectAs() { return qgis->actionSaveProjectAs(); }
00183 QAction *QgisAppInterface::actionSaveMapAsImage() { return qgis->actionSaveMapAsImage(); }
00184 QAction *QgisAppInterface::actionFileSeparator2() { return qgis->actionFileSeparator2(); }
00185 QAction *QgisAppInterface::actionProjectProperties() { return qgis->actionProjectProperties(); }
00186 QAction *QgisAppInterface::actionFileSeparator3() { return qgis->actionFileSeparator3(); }
00187 QAction *QgisAppInterface::actionPrintComposer() { return qgis->actionPrintComposer(); }
00188 QAction *QgisAppInterface::actionFileSeparator4() { return qgis->actionFileSeparator4(); }
00189 QAction *QgisAppInterface::actionExit() { return qgis->actionExit(); }
00190
00192 QAction *QgisAppInterface::actionCutFeatures() { return qgis->actionCutFeatures(); }
00193 QAction *QgisAppInterface::actionCopyFeatures() { return qgis->actionCopyFeatures(); }
00194 QAction *QgisAppInterface::actionPasteFeatures() { return qgis->actionPasteFeatures(); }
00195 QAction *QgisAppInterface::actionEditSeparator1() { return qgis->actionEditSeparator1(); }
00196 QAction *QgisAppInterface::actionCapturePoint() { return qgis->actionCapturePoint(); }
00197 QAction *QgisAppInterface::actionCaptureLine() { return qgis->actionCaptureLine(); }
00198 QAction *QgisAppInterface::actionCapturePologon() { return qgis->actionCapturePologon(); }
00199 QAction *QgisAppInterface::actionDeleteSelected() { return qgis->actionDeleteSelected(); }
00200 QAction *QgisAppInterface::actionMoveFeature() { return qgis->actionMoveFeature(); }
00201 QAction *QgisAppInterface::actionSplitFeatures() { return qgis->actionSplitFeatures(); }
00202 QAction *QgisAppInterface::actionAddVertex() { return qgis->actionAddVertex(); }
00203 QAction *QgisAppInterface::actionDelerteVertex() { return qgis->actionDelerteVertex(); }
00204 QAction *QgisAppInterface::actioMoveVertex() { return qgis->actioMoveVertex(); }
00205 QAction *QgisAppInterface::actionAddRing() { return qgis->actionAddRing(); }
00206 QAction *QgisAppInterface::actionAddIsland() { return qgis->actionAddIsland(); }
00207 QAction *QgisAppInterface::actionEditSeparator2() { return qgis->actionEditSeparator2(); }
00208
00210 QAction *QgisAppInterface::actionPan() { return qgis->actionPan(); }
00211 QAction *QgisAppInterface::actionZoomIn() { return qgis->actionZoomIn(); }
00212 QAction *QgisAppInterface::actionZoomOut() { return qgis->actionZoomOut(); }
00213 QAction *QgisAppInterface::actionSelect() { return qgis->actionSelect(); }
00214 QAction *QgisAppInterface::actionIdentify() { return qgis->actionIdentify(); }
00215 QAction *QgisAppInterface::actionMeasure() { return qgis->actionMeasure(); }
00216 QAction *QgisAppInterface::actionMeasureArea() { return qgis->actionMeasureArea(); }
00217 QAction *QgisAppInterface::actionViewSeparator1() { return qgis->actionViewSeparator1(); }
00218 QAction *QgisAppInterface::actionZoomFullExtent() { return qgis->actionZoomFullExtent(); }
00219 QAction *QgisAppInterface::actionZoomToLayer() { return qgis->actionZoomToLayer(); }
00220 QAction *QgisAppInterface::actionZoomToSelected() { return qgis->actionZoomToSelected(); }
00221 QAction *QgisAppInterface::actionZoomLast() { return qgis->actionZoomLast(); }
00222 QAction *QgisAppInterface::actionZoomActualSize() { return qgis->actionZoomActualSize(); }
00223 QAction *QgisAppInterface::actionViewSeparator2() { return qgis->actionViewSeparator2(); }
00224 QAction *QgisAppInterface::actionMapTips() { return qgis->actionMapTips(); }
00225 QAction *QgisAppInterface::actionNewBookmark() { return qgis->actionNewBookmark(); }
00226 QAction *QgisAppInterface::actionShowBookmarks() { return qgis->actionShowBookmarks(); }
00227 QAction *QgisAppInterface::actionDraw() { return qgis->actionDraw(); }
00228 QAction *QgisAppInterface::actionViewSeparator3() { return qgis->actionViewSeparator3(); }
00229
00231 QAction *QgisAppInterface::actionNewVectorLayer() { return qgis->actionNewVectorLayer(); }
00232 QAction *QgisAppInterface::actionAddOgrLayer() { return qgis->actionAddOgrLayer(); }
00233 QAction *QgisAppInterface::actionAddRasterLayer() { return qgis->actionAddRasterLayer(); }
00234 QAction *QgisAppInterface::actionAddPgLayer() { return qgis->actionAddPgLayer(); }
00235 QAction *QgisAppInterface::actionAddWmsLayer() { return qgis->actionAddWmsLayer(); }
00236 QAction *QgisAppInterface::actionLayerSeparator1() { return qgis->actionLayerSeparator1(); }
00237 QAction *QgisAppInterface::actionOpenTable() { return qgis->actionOpenTable(); }
00238 QAction *QgisAppInterface::actionToggleEditing() { return qgis->actionToggleEditing(); }
00239 QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); }
00240 QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return qgis->actionLayerSelectionSaveAs(); }
00241 QAction *QgisAppInterface::actionRemoveLayer() { return qgis->actionRemoveLayer(); }
00242 QAction *QgisAppInterface::actionLayerProperties() { return qgis->actionLayerProperties(); }
00243 QAction *QgisAppInterface::actionLayerSeparator2() { return qgis->actionLayerSeparator2(); }
00244 QAction *QgisAppInterface::actionAddToOverview() { return qgis->actionAddToOverview(); }
00245 QAction *QgisAppInterface::actionAddAllToOverview() { return qgis->actionAddAllToOverview(); }
00246 QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRemoveAllFromOverview(); }
00247 QAction *QgisAppInterface::actionLayerSeparator3() { return qgis->actionLayerSeparator3(); }
00248 QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
00249 QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }
00250
00252 QAction *QgisAppInterface::actionManagePlugins() { return qgis->actionManagePlugins(); }
00253 QAction *QgisAppInterface::actionPluginSeparator1() { return qgis->actionPluginSeparator1(); }
00254 QAction *QgisAppInterface::actionPluginListSeparator() { return qgis->actionPluginListSeparator(); }
00255 QAction *QgisAppInterface::actionPluginSeparator2() { return qgis->actionPluginSeparator2(); }
00256 QAction *QgisAppInterface::actionPluginPythonSeparator() { return qgis->actionPluginPythonSeparator(); }
00257 QAction *QgisAppInterface::actionShowPythonDialog() { return qgis->actionShowPythonDialog(); }
00258
00260 QAction *QgisAppInterface::actionToggleFullScreen() { return qgis->actionToggleFullScreen(); }
00261 QAction *QgisAppInterface::actionSettingsSeparator1() { return qgis->actionSettingsSeparator1(); }
00262 QAction *QgisAppInterface::actionOptions() { return qgis->actionOptions(); }
00263 QAction *QgisAppInterface::actionCustomProjection() { return qgis->actionCustomProjection(); }
00264
00266 QAction *QgisAppInterface::actionHelpContents() { return qgis->actionHelpContents(); }
00267 QAction *QgisAppInterface::actionHelpSeparator1() { return qgis->actionHelpSeparator1(); }
00268 QAction *QgisAppInterface::actionQgisHomePage() { return qgis->actionQgisHomePage(); }
00269 QAction *QgisAppInterface::actionCheckQgisVersion() { return qgis->actionCheckQgisVersion(); }
00270 QAction *QgisAppInterface::actionHelpSeparator2() { return qgis->actionHelpSeparator2(); }
00271 QAction *QgisAppInterface::actionAbout() { return qgis->actionAbout(); }