1
/***************************************************************************
2
qgisapp.h - description
4
begin : Sat Jun 22 2002
5
copyright : (C) 2002 by Gary E.Sherman
6
email : sherman at mrcc.com
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
41
class QgisAppInterface;
44
class QgsComposerView;
55
class QgsProviderRegistry;
56
class QgsPythonDialog;
65
#include <QMainWindow>
67
#include <QAbstractSocket>
70
#include "qgsconfig.h"
71
#include "qgsfeature.h"
75
* \brief Main window for the Qgis application
77
class QgisApp : public QMainWindow
82
QgisApp( QSplashScreen *splash, QWidget * parent = 0, Qt::WFlags fl = Qt::Window );
86
* Add a vector layer to the canvas, returns pointer to it
88
QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey );
90
/** \brief overloaded vesion of the privat addLayer method that takes a list of
91
* file names instead of prompting user with a dialog.
92
@param enc encoding type for the layer
93
@param dataSourceType type of ogr datasource
94
@returns true if successfully added layer
96
bool addVectorLayers( QStringList const & theLayerQStringList, const QString& enc, const QString dataSourceType );
98
/** overloaded vesion of the private addRasterLayer()
99
Method that takes a list of file names instead of prompting
101
@returns true if successfully added layer(s)
103
bool addRasterLayers( QStringList const & theLayerQStringList, bool guiWarning = true );
105
/** Open a raster layer using the Raster Data Provider.
106
* Note this is included to support WMS layers only at this stage,
107
* GDAL layer support via a Provider is not yet implemented.
109
QgsRasterLayer* addRasterLayer( QString const & rasterLayerPath,
110
QString const & baseName,
111
QString const & providerKey,
112
QStringList const & layers,
113
QStringList const & styles,
114
QString const & format,
115
QString const & crs );
117
/** open a raster layer for the given file
118
@returns false if unable to open a raster layer for rasterFile
120
This is essentially a simplified version of the above
122
QgsRasterLayer* addRasterLayer( QString const & rasterFile, QString const & baseName, bool guiWarning = true );
124
/** Add a 'pre-made' map layer to the project */
125
void addMapLayer( QgsMapLayer *theMapLayer );
127
/** Set the extents of the map canvas */
128
void setExtent( QgsRectangle theRect );
129
//! Remove all layers from the map and legend - reimplements same method from qgisappbase
130
void removeAllLayers();
131
/** Open a raster or vector file; ignore other files.
132
Used to process a commandline argument or OpenDocument AppleEvent.
133
@returns true if the file is successfully opened
135
bool openLayer( const QString & fileName );
136
/** Open the specified project file; prompt to save previous project if necessary.
137
Used to process a commandline argument or OpenDocument AppleEvent.
139
void openProject( const QString & fileName );
140
/** opens a qgis project file
141
@returns false if unable to open the project
143
bool addProject( QString projectFile );
144
//!Overloaded version of the private function with same name that takes the imagename as a parameter
145
void saveMapAsImage( QString, QPixmap * );
146
/** Get the mapcanvas object from the app */
147
QgsMapCanvas * mapCanvas() { return mMapCanvas; };
149
//! Set theme (icons)
150
void setTheme( QString themeName = "default" );
151
//! Setup the toolbar popup menus for a given theme
152
void setupToolbarPopups( QString themeName );
153
//! Returns a pointer to the internal clipboard
154
QgsClipboard * clipboard();
156
/** Setup the proxy settings from the QSettings environment.
157
* This is not called by default in the constructor. Rather,
158
* the application must explicitly call setupProx(). If
159
* you write your own application and wish to explicitly
160
* set up your own proxy rather, you should e.g.
161
* QNetworkProxy proxy;
162
* proxy.setType(QNetworkProxy::Socks5Proxy);
163
* proxy.setHostName("proxy.example.com");
164
* proxy.setPort(1080);
165
* proxy.setUser("username");
166
* proxy.setPassword("password");
167
* QNetworkProxy::setApplicationProxy(proxy);
169
* (as documented in Qt documentation.
173
static QgisApp *instance() { return smInstance; }
175
//! Helper to get a theme icon. It will fall back to the
176
//default theme if the active theme does not have the required
178
static QIcon getThemeIcon( const QString theName );
179
//! Helper to get a theme icon as a pixmap. It will fall back to the
180
//default theme if the active theme does not have the required
182
static QPixmap getThemePixmap( const QString theName );
184
/** Add a dock widget to the main window. Overloaded from QMainWindow.
185
* After adding the dock widget to the ui (by delegating to the QMainWindow
186
* parent class, it will also add it to the View menu list of docks.*/
187
void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget );
188
/** Add a toolbar to the main window. Overloaded from QMainWindow.
189
* After adding the toolbar to the ui (by delegating to the QMainWindow
190
* parent class, it will also add it to the View menu list of toolbars.*/
191
QToolBar *addToolBar( QString name );
193
/** Add window to Window menu. The action title is the window title
194
* and the action should raise, unminimize and activate the window. */
195
void addWindow( QAction *action );
196
/** Remove window from Window menu. Calling this is necessary only for
197
* windows which are hidden rather than deleted when closed. */
198
void removeWindow( QAction *action );
200
/**Returns the print composers*/
201
QSet<QgsComposer*> printComposers() const {return mPrintComposers;}
202
/**Creates a new composer and returns a pointer to it*/
203
QgsComposer* createNewComposer();
204
/**Deletes a composer and removes entry from Set*/
205
void deleteComposer( QgsComposer* c );
208
//! Actions to be inserted in menus and toolbars
209
QAction *actionNewProject() { return mActionNewProject; }
210
QAction *actionOpenProject() { return mActionOpenProject; }
211
QAction *actionFileSeparator1() { return mActionFileSeparator1; }
212
QAction *actionSaveProject() { return mActionSaveProject; }
213
QAction *actionSaveProjectAs() { return mActionSaveProjectAs; }
214
QAction *actionSaveMapAsImage() { return mActionSaveMapAsImage; }
215
QAction *actionFileSeparator2() { return mActionFileSeparator2; }
216
QAction *actionProjectProperties() { return mActionProjectProperties; }
217
QAction *actionFileSeparator3() { return mActionFileSeparator3; }
218
QAction *actionNewPrintComposer() { return mActionNewPrintComposer; }
219
QAction *actionFileSeparator4() { return mActionFileSeparator4; }
220
QAction *actionExit() { return mActionExit; }
222
QAction *actionCutFeatures() { return mActionCutFeatures; }
223
QAction *actionCopyFeatures() { return mActionCopyFeatures; }
224
QAction *actionPasteFeatures() { return mActionPasteFeatures; }
225
QAction *actionEditSeparator1() { return mActionEditSeparator1; }
226
QAction *actionCapturePoint() { return mActionCapturePoint; }
227
QAction *actionCaptureLine() { return mActionCaptureLine; }
228
QAction *actionCapturePolygon() { return mActionCapturePolygon; }
229
QAction *actionDeleteSelected() { return mActionDeleteSelected; }
230
QAction *actionMoveFeature() { return mActionMoveFeature; }
231
QAction *actionSplitFeatures() { return mActionSplitFeatures; }
232
//These three tools are deprecated - use node tool rather...
233
//QAction *actionAddVertex() { return mActionAddVertex; }
234
//QAction *actionDeleteVertex() { return mActionDeleteVertex; }
235
//QAction *actionMoveVertex() { return mActionMoveVertex; }
236
QAction *actionAddRing() { return mActionAddRing; }
237
QAction *actionAddIsland() { return mActionAddIsland; }
238
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
239
QAction *actionDeleteRing() { return mActionDeleteRing; }
240
QAction *actionDeletePart() { return mActionDeletePart; }
241
QAction *actionNodeTool() { return mActionNodeTool; }
242
QAction *actionEditSeparator2() { return mActionEditSeparator2; }
244
QAction *actionPan() { return mActionPan; }
245
QAction *actionZoomIn() { return mActionZoomIn; }
246
QAction *actionZoomOut() { return mActionZoomOut; }
247
QAction *actionSelect() { return mActionSelect; }
248
QAction *actionIdentify() { return mActionIdentify; }
249
QAction *actionMeasure() { return mActionMeasure; }
250
QAction *actionMeasureArea() { return mActionMeasureArea; }
251
QAction *actionViewSeparator1() { return mActionViewSeparator1; }
252
QAction *actionZoomFullExtent() { return mActionZoomFullExtent; }
253
QAction *actionZoomToLayer() { return mActionZoomToLayer; }
254
QAction *actionZoomToSelected() { return mActionZoomToSelected; }
255
QAction *actionZoomLast() { return mActionZoomLast; }
256
QAction *actionZoomNext() { return mActionZoomNext; }
257
QAction *actionZoomActualSize() { return mActionZoomActualSize; }
258
QAction *actionViewSeparator2() { return mActionViewSeparator2; }
259
QAction *actionMapTips() { return mActionMapTips; }
260
QAction *actionNewBookmark() { return mActionNewBookmark; }
261
QAction *actionShowBookmarks() { return mActionShowBookmarks; }
262
QAction *actionDraw() { return mActionDraw; }
263
QAction *actionViewSeparator3() { return mActionViewSeparator3; }
265
QAction *actionNewVectorLayer() { return mActionNewVectorLayer; }
266
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
267
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
268
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
269
QAction *actionAddSpatiaLiteLayer() { return mActionAddSpatiaLiteLayer; };
270
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
271
QAction *actionLayerSeparator1() { return mActionLayerSeparator1; }
272
QAction *actionOpenTable() { return mActionOpenTable; }
273
QAction *actionToggleEditing() { return mActionToggleEditing; }
274
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
275
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
276
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
277
QAction *actionLayerProperties() { return mActionLayerProperties; }
278
QAction *actionLayerSeparator2() { return mActionLayerSeparator2; }
279
QAction *actionAddToOverview() { return mActionAddToOverview; }
280
QAction *actionAddAllToOverview() { return mActionAddAllToOverview; }
281
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
282
QAction *actionLayerSeparator3() { return mActionLayerSeparator3; }
283
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
284
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
286
QAction *actionManagePlugins() { return mActionManagePlugins; }
287
QAction *actionPluginSeparator1() { return mActionPluginSeparator1; }
288
QAction *actionPluginListSeparator() { return mActionPluginSeparator1; }
289
QAction *actionPluginSeparator2() { return mActionPluginSeparator2; }
290
QAction *actionPluginPythonSeparator() { return mActionPluginSeparator2; }
291
QAction *actionShowPythonDialog() { return mActionShowPythonDialog; }
293
QAction *actionToggleFullScreen() { return mActionToggleFullScreen; }
294
QAction *actionSettingsSeparator1() { return mActionSettingsSeparator1; }
295
QAction *actionOptions() { return mActionOptions; }
296
QAction *actionCustomProjection() { return mActionCustomProjection; }
297
QAction *actionConfigureShortcuts() { return mActionConfigureShortcuts; }
300
QAction *actionWindowMinimize() { return mActionWindowMinimize; }
301
QAction *actionWindowZoom() { return mActionWindowZoom; }
302
QAction *actionWindowSeparator1() { return mActionWindowSeparator1; }
303
QAction *actionWindowAllToFront() { return mActionWindowAllToFront; }
304
QAction *actionWindowSeparator2() { return mActionWindowSeparator2; }
307
QAction *actionHelpContents() { return mActionHelpContents; }
308
QAction *actionHelpSeparator1() { return mActionHelpSeparator1; }
309
QAction *actionQgisHomePage() { return mActionQgisHomePage; }
310
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
311
QAction *actionHelpSeparator2() { return mActionHelpSeparator2; }
312
QAction *actionAbout() { return mActionAbout; }
315
QMenu *fileMenu() { return mFileMenu; }
316
QMenu *editMenu() { return mEditMenu; }
317
QMenu *viewMenu() { return mViewMenu; }
318
QMenu *layerMenu() { return mLayerMenu; }
319
QMenu *settingsMenu() { return mSettingsMenu; }
320
QMenu *pluginMenu() { return mPluginMenu; }
322
QMenu *firstRightStandardMenu() { return mWindowMenu; }
323
QMenu *windowMenu() { return mWindowMenu; }
325
QMenu *firstRightStandardMenu() { return mHelpMenu; }
326
QMenu *windowMenu() { return NULL; }
328
QMenu *printComposersMenu() {return mPrintComposersMenu;}
329
QMenu *helpMenu() { return mHelpMenu; }
332
/** Get a reference to a toolbar. Mainly intended
333
* to be used by plugins that want to specifically add
334
* an icon into the file toolbar for consistency e.g.
335
* addWFS and GPS plugins.
337
QToolBar *fileToolBar() { return mFileToolBar; }
338
QToolBar *layerToolBar() { return mLayerToolBar; }
339
QToolBar *mapNavToolToolBar() { return mMapNavToolBar; }
340
QToolBar *digitizeToolBar() { return mDigitizeToolBar; }
341
QToolBar *advancedDigitizeToolBar() { return mAdvancedDigitizeToolBar; }
342
QToolBar *attributesToolBar() { return mAttributesToolBar; }
343
QToolBar *pluginToolBar() { return mPluginToolBar; }
344
QToolBar *helpToolBar() { return mHelpToolBar; }
347
void runPythonString( const QString &expr );
350
//! Zoom to full extent
352
//! Zoom to the previous extent
353
void zoomToPrevious();
354
//! Zoom to the forward extent
356
//! Zoom to selected features
357
void zoomToSelected();
359
void updateUndoActions();
361
//! cuts selected features on the active layer to the clipboard
363
\param layerContainingSelection The layer that the selection will be taken from
364
(defaults to the active layer on the legend)
366
void editCut( QgsMapLayer * layerContainingSelection = 0 );
367
//! copies selected features on the active layer to the clipboard
369
\param layerContainingSelection The layer that the selection will be taken from
370
(defaults to the active layer on the legend)
372
void editCopy( QgsMapLayer * layerContainingSelection = 0 );
373
//! copies features on the clipboard to the active layer
375
\param destinationLayer The layer that the clipboard will be pasted to
376
(defaults to the active layer on the legend)
378
void editPaste( QgsMapLayer * destinationLayer = 0 );
380
void loadOGRSublayers( QString layertype, QString uri, QStringList list );
382
/**Deletes the selected attributes for the currently selected vector layer*/
383
void deleteSelected( QgsMapLayer *layer = 0 );
387
//! Handle state changes (WindowTitleChange)
388
virtual void changeEvent( QEvent * event );
389
//! Have some control over closing of the application
390
virtual void closeEvent( QCloseEvent * event );
392
virtual void dragEnterEvent( QDragEnterEvent * event );
393
virtual void dropEvent( QDropEvent * event );
395
//! reimplements widget keyPress event so we can check if cancel was pressed
396
virtual void keyPressEvent( QKeyEvent * event );
401
//! Add a raster layer to the map (will prompt user for file name using dlg )
402
void addRasterLayer();
403
//#ifdef HAVE_POSTGRESQL
404
//! Add a databaselayer to the map
405
void addDatabaseLayer();
407
//#ifdef HAVE_SPATIALITE
408
//! Add a SpatiaLite layer to the map
409
void addSpatiaLiteLayer();
411
/** toggles whether the current selected layer is in overview or not */
413
//! Slot to show the map coordinate position of the mouse cursor
414
void showMouseCoordinate( const QgsPoint & );
415
//! Slot to show current map scale;
416
void showScale( double theScale );
417
//! Slot to handle user scale input;
419
//! Slot to handle user center input;
421
//! Remove a layer from the map and legend
423
//! zoom to extent of layer
424
void zoomToLayerExtent();
425
//! zoom to actual size of raster layer
426
void zoomActualSize();
428
void showPluginManager();
429
//! load python support if possible
430
void loadPythonSupport();
431
//! Find the QMenu with the given name (ie the user visible text on the menu item)
432
QMenu* getPluginMenu( QString menuName );
433
//! Add the action to the submenu with the given name under the plugin menu
434
void addPluginToMenu( QString name, QAction* action );
435
//! Remove the action to the submenu with the given name under the plugin menu
436
void removePluginMenu( QString name, QAction* action );
437
//! Add an icon to the plugin toolbar
438
int addPluginToolBarIcon( QAction * qAction );
439
//! Remove an icon from the plugin toolbar
440
void removePluginToolBarIcon( QAction *qAction );
441
//! Save window state
442
void saveWindowState();
443
//! Restore the window and toolbar state
444
void restoreWindowState();
445
//! Save project. Returns true if the user selected a file to save to, false if not.
449
//! Open the project file corresponding to the
450
//! text)= of the given action.
451
void openProject( QAction *action );
452
//! Save the map view as an image - user is prompted for image name using a dialog
453
void saveMapAsImage();
456
//! Create a new project
458
//! As above but allows forcing without prompt
459
void fileNew( bool thePromptToSaveFlag );
460
//! Create a new empty vector layer
461
void newVectorLayer();
462
//! Print the current map view frame
463
void newPrintComposer();
464
void showComposerManager();
465
//! Add all loaded layers into the overview - overides qgisappbase method
466
void addAllToOverview();
467
//! Remove all loaded layers from the overview - overides qgisappbase method
468
void removeAllFromOverview();
469
//reimplements method from base (gui) class
470
void hideAllLayers();
471
//reimplements method from base (gui) class
472
void showAllLayers();
473
// TODO: remove exportMapServer declaration once the mapserver export plugin is complete
476
//! Export current view as a mapserver map file
477
void exportMapServer();
479
//! Return pointer to the active layer
480
QgsMapLayer *activeLayer();
481
//! set the active layer
482
bool setActiveLayer( QgsMapLayer * );
483
//! Open the help contents in a browser
485
//! Open the QGIS homepage in users browser
486
void helpQgisHomePage();
487
//! Open a url in the users configured browser
488
void openURL( QString url, bool useQgisDocDirectory = true );
489
//! Check qgis version against the qgis version server
490
void checkQgisVersion();
491
//!Invoke the custom projection dialog
492
void customProjection();
493
//! configure shortcuts
494
void configureShortcuts();
495
//! options dialog slot
497
//! Whats-this help slot
499
void socketConnected();
500
void socketConnectionClosed();
501
void socketReadyRead();
502
void socketError( QAbstractSocket::SocketError e );
503
//! Set project properties, including map untis
504
void projectProperties();
505
//! Open project properties dialog and show the projections tab
506
void projectPropertiesProjections();
507
/* void urlData(); */
508
//! Show the spatial bookmarks dialog
509
void showBookmarks();
510
//! Create a new spatial bookmark
512
//! activates the capture point tool
514
//! activates the capture line tool
516
//! activates the capture polygon tool
517
void capturePolygon();
518
//! activates the move feature tool
520
//! activates the reshape features tool
521
void reshapeFeatures();
522
//! activates the split features tool
523
void splitFeatures();
524
//! activates the add vertex tool
526
//! activates the move vertex tool
528
//! activates the delete vertex tool
530
//! activates the add ring tool
532
//! activates the add island tool
534
//! simplifies feature
535
void simplifyFeature();
536
//! deletes ring in polygon
538
//! deletes part of polygon
540
//! merges the selected features together
541
void mergeSelectedFeatures();
542
//! provides operations with nodes
544
//! activates the rotate points tool
545
void rotatePointSymbols();
547
//! activates the selection tool
550
//! deselect features from all layers
553
//! refresh map canvas
554
void refreshMapCanvas();
555
//! returns pointer to map legend
556
QgsLegend *legend() { return mMapLegend; }
558
//! starts/stops editing mode of the current layer
559
void toggleEditing();
562
void mapToolChanged( QgsMapTool *tool );
564
/** Activates or deactivates actions depending on the current maplayer type.
565
Is called from the legend when the current legend item has changed*/
566
void activateDeactivateLayerRelatedActions( QgsMapLayer* layer );
568
void showProgress( int theProgress, int theTotalSteps );
569
void extentsViewToggled( bool theFlag );
571
void showStatusMessage( QString theMessage );
572
void updateMouseCoordinatePrecision();
573
void hasCrsTransformEnabled( bool theFlag );
574
void destinationSrsChanged();
576
//! Add a vector layer to the map
577
void addVectorLayer();
580
//! Add a WMS layer to the map
582
//! Set map tool to Zoom out
584
//! Set map tool to Zoom in
586
//! Set map tool to pan
588
//! Identify feature(s) on the currently selected layer
595
//! show the attribute table for the currently selected layer
596
void attributeTable();
598
//! starts/stops editing mode of a layer
599
void toggleEditing( QgsMapLayer *layer );
601
//! save current vector layer
602
void saveAsShapefile();
603
void saveSelectionAsShapefile();
605
//! open the properties dialog for the currently selected layer
606
void layerProperties();
608
//! show python console
609
void showPythonDialog();
611
//! Shows a warning when an old project file is read.
612
void oldProjectVersionWarning( QString );
614
//! Toggle map tips on/off
615
void toggleMapTips();
620
//! Toggle full screen mode
621
void toggleFullScreen();
623
//! Set minimized mode of active window
624
void showActiveWindowMinimized();
626
//! Toggle maximized mode of active window
627
void toggleActiveWindowMaximized();
629
//! Raise, unminimize and activate this window
632
//! Bring forward all open windows
633
void bringAllToFront();
635
//! Stops rendering of the main map
636
void stopRendering();
638
void showStyleManagerV2();
641
void projectChanged( const QDomDocument & );
644
/** emitted when a key is pressed and we want non widget sublasses to be able
645
to pick up on this (e.g. maplayer) */
646
void keyPressed( QKeyEvent *e );
648
/** emitted when a project file is successfully read
650
This is useful for plug-ins that store properties with project files. A
651
plug-in can connect to this signal. When it is emitted, the plug-in
652
knows to then check the project properties for any relevant state.
655
/** emitted when starting an entirely new project
657
This is similar to projectRead(); plug-ins might want to be notified
658
that they're in a new project. Yes, projectRead() could have been
659
overloaded to be used in the case of new projects instead. However,
660
it's probably more semantically correct to have an entirely separate
661
signal for when this happens.
665
//! emitted when a new bookmark is added
666
void bookmarkAdded();
668
/** Signal emitted when the current theme is changed so plugins
669
* can change there tool button icons.
670
* @note This was added in QGIS 1.1
672
void currentThemeChanged( QString );
674
/**This signal is emitted when a new composer instance has been created
675
@note added in version 1.4*/
676
void composerAdded( QgsComposerView* v );
678
/**This signal is emitted before a new composer instance is going to be removed
679
@note added in version 1.4*/
680
void composerWillBeRemoved( QgsComposerView* v );
684
/** This method will open a dialog so the user can select the sublayers
687
void askUserForSublayers( QgsVectorLayer *layer );
688
/** Add a raster layer to the map (passed in as a ptr).
689
* It won't force a refresh.
691
bool addRasterLayer( QgsRasterLayer * theRasterLayer );
692
//@todo We should move these next two into vector layer class
693
/** This helper checks to see whether the file name appears to be a valid shape file name */
694
bool isValidShapeFileName( QString theFileNameQString );
695
/** Overloaded version of the above function provided for convenience that takes a qstring pointer */
696
bool isValidShapeFileName( QString * theFileNameQString );
697
/** add this file to the recently opened/saved projects list
698
* pass settings by reference since creating more than one
699
* instance simultaneously results in data loss.
701
void saveRecentProjectPath( QString projectPath, QSettings & settings );
702
//! Update file menu with the current list of recently accessed projects
703
void updateRecentProjectPaths();
704
//! Read Well Known Binary stream from PostGIS
705
//void readWKB(const char *, QStringList tables);
706
//! shows the paste-transformations dialog
707
void pasteTransformations();
708
//! check to see if file is dirty and if so, prompt the user th save it
710
/** Helper function to union several geometries together (used in function mergeSelectedFeatures)
711
@return 0 in case of error*/
712
QgsGeometry* unionGeometries( const QgsVectorLayer* vl, QgsFeatureList& featureList );
714
/**Deletes all the composer objects and clears mPrintComposers*/
715
void deletePrintComposers();
716
/**Creates the composer instances in a project file and adds them to the menu*/
717
bool loadComposersFromProject( const QString& projectFilePath );
719
/// QgisApp aren't copyable
720
QgisApp( QgisApp const & );
721
/// QgisApp aren't copyable
722
QgisApp & operator=( QgisApp const & );
725
void writeSettings();
726
void createActions();
727
void createActionGroups();
729
void createToolBars();
730
void createStatusBar();
731
void setupConnections();
733
void createOverview();
736
void createMapTips();
738
// toolbars ---------------------------------------
739
QToolBar *mFileToolBar;
740
QToolBar *mLayerToolBar;
741
QToolBar *mMapNavToolBar;
742
QToolBar *mDigitizeToolBar;
743
QToolBar *mAdvancedDigitizeToolBar;
744
QToolBar *mAttributesToolBar;
745
QToolBar *mPluginToolBar;
746
QToolBar *mHelpToolBar;
748
// actions for menus and toolbars -----------------
750
QAction *mActionNewProject;
751
QAction *mActionOpenProject;
752
QAction *mActionFileSeparator1;
753
QAction *mActionSaveProject;
754
QAction *mActionSaveProjectAs;
755
QAction *mActionSaveMapAsImage;
756
QAction *mActionFileSeparator2;
757
QAction *mActionProjectProperties;
758
QAction *mActionFileSeparator3;
759
QAction *mActionNewPrintComposer;
760
QAction *mActionShowComposerManager;
761
QAction *mActionFileSeparator4;
762
QAction *mActionExit;
764
QAction *mActionUndo;
765
QAction *mActionRedo;
766
QAction *mActionEditSeparator0;
767
QAction *mActionCutFeatures;
768
QAction *mActionCopyFeatures;
769
QAction *mActionPasteFeatures;
770
QAction *mActionEditSeparator1;
771
QAction *mActionCapturePoint;
772
QAction *mActionCaptureLine;
773
QAction *mActionCapturePolygon;
774
QAction *mActionDeleteSelected;
775
QAction *mActionMoveFeature;
776
QAction *mActionReshapeFeatures;
777
QAction *mActionSplitFeatures;
779
QAction *mActionAddVertex;
780
QAction *mActionDeleteVertex;
781
QAction *mActionMoveVertex;
783
QAction *mActionAddRing;
784
QAction *mActionAddIsland;
785
QAction *mActionEditSeparator2;
786
QAction *mActionSimplifyFeature;
787
QAction *mActionDeleteRing;
788
QAction *mActionDeletePart;
789
QAction *mActionMergeFeatures;
790
QAction *mActionNodeTool;
791
QAction *mActionRotatePointSymbols;
792
QAction *mActionEditSeparator3;
795
QAction *mActionZoomIn;
796
QAction *mActionZoomOut;
797
QAction *mActionSelect;
798
QAction *mActionDeselectAll;
799
QAction *mActionIdentify;
800
QAction *mActionMeasure;
801
QAction *mActionMeasureArea;
802
QAction *mActionViewSeparator1;
803
QAction *mActionZoomFullExtent;
804
QAction *mActionZoomToLayer;
805
QAction *mActionZoomToSelected;
806
QAction *mActionZoomLast;
807
QAction *mActionZoomNext;
808
QAction *mActionZoomActualSize;
809
QAction *mActionViewSeparator2;
810
QAction *mActionMapTips;
811
QAction *mActionNewBookmark;
812
QAction *mActionShowBookmarks;
813
QAction *mActionDraw;
814
QAction *mActionViewSeparator3;
816
QAction *mActionNewVectorLayer;
817
QAction *mActionAddOgrLayer;
818
QAction *mActionAddRasterLayer;
819
QAction *mActionAddPgLayer;
820
QAction *mActionAddSpatiaLiteLayer;
821
QAction *mActionAddWmsLayer;
822
QAction *mActionLayerSeparator1;
823
QAction *mActionOpenTable;
824
QAction *mActionToggleEditing;
825
QAction *mActionLayerSaveAs;
826
QAction *mActionLayerSelectionSaveAs;
827
QAction *mActionRemoveLayer;
828
QAction *mActionLayerProperties;
829
QAction *mActionLayerSeparator2;
830
QAction *mActionAddToOverview;
831
QAction *mActionAddAllToOverview;
832
QAction *mActionRemoveAllFromOverview;
833
QAction *mActionLayerSeparator3;
834
QAction *mActionHideAllLayers;
835
QAction *mActionShowAllLayers;
837
QAction *mActionManagePlugins;
838
QAction *mActionPluginSeparator1;
839
QAction *mActionPluginSeparator2;
840
QAction *mActionShowPythonDialog;
842
QAction *mActionToggleFullScreen;
843
QAction *mActionSettingsSeparator1;
844
QAction *mActionOptions;
845
QAction *mActionCustomProjection;
846
QAction *mActionConfigureShortcuts;
849
QAction *mActionWindowMinimize;
850
QAction *mActionWindowZoom;
851
QAction *mActionWindowSeparator1;
852
QAction *mActionWindowAllToFront;
853
QAction *mActionWindowSeparator2;
854
QActionGroup *mWindowActions;
857
QAction *mActionHelpContents;
858
QAction *mActionHelpSeparator1;
859
QAction *mActionQgisHomePage;
860
QAction *mActionCheckQgisVersion;
861
QAction *mActionHelpSeparator2;
862
QAction *mActionAbout;
864
QAction *mActionUseRendererV2;
865
QAction *mActionStyleManagerV2;
867
// action groups ----------------------------------
868
QActionGroup *mMapToolGroup;
870
// menus ------------------------------------------
873
QMenu *mRecentProjectsMenu;
878
QMenu *mSettingsMenu;
882
QMenu *mPrintComposersMenu;
885
// docks ------------------------------------------
886
QDockWidget *mLegendDock;
887
QDockWidget *mOverviewDock;
890
//! Window menu action to select this window
891
QAction *mWindowAction;
898
QgsMapTool* mZoomOut;
900
QgsMapTool* mIdentify;
901
QgsMapTool* mMeasureDist;
902
QgsMapTool* mMeasureArea;
903
QgsMapTool* mCapturePoint;
904
QgsMapTool* mCaptureLine;
905
QgsMapTool* mCapturePolygon;
906
QgsMapTool* mMoveFeature;
907
QgsMapTool* mReshapeFeatures;
908
QgsMapTool* mSplitFeatures;
910
QgsMapTool* mVertexAdd;
911
QgsMapTool* mVertexMove;
912
QgsMapTool* mVertexDelete;
913
QgsMapTool* mAddRing;
914
QgsMapTool* mAddIsland;
915
QgsMapTool* mSimplifyFeature;
916
QgsMapTool* mDeleteRing;
917
QgsMapTool* mDeletePart;
918
QgsMapTool* mNodeTool;
919
QgsMapTool* mRotatePointSymbolsTool;
922
QgsMapTool *mNonEditMapTool;
924
//! Widget that will live on the statusbar to display "scale 1:"
925
QLabel * mScaleLabel;
926
//! Widget that will live on the statusbar to display scale value
927
QLineEdit * mScaleEdit;
928
//! The validator for the mScaleEdit
929
QValidator * mScaleEditValidator;
930
//! Widget that will live on the statusbar to display "Coordinate / Extent"
931
QLabel * mCoordsLabel;
932
//! Widget that will live in the statusbar to display and edit coords
933
QLineEdit * mCoordsEdit;
934
//! The validator for the mCoordsEdit
935
QValidator * mCoordsEditValidator;
936
//! Widget that will live in the statusbar to show progress of operations
937
QProgressBar * mProgressBar;
938
//! Widget used to suppress rendering
939
QCheckBox * mRenderSuppressionCBox;
940
//! A toggle to switch between mouse coords and view extents display
941
QToolButton * mToggleExtentsViewButton;
942
//! Button used to stop rendering
943
QToolButton* mStopRenderButton;
944
//! Widget in status bar used to show status of on the fly projection
945
QToolButton * mOnTheFlyProjectionStatusButton;
948
//! Top level plugin menu
950
//! Popup menu for the map overview tools
951
QMenu *toolPopupOverviews;
952
//! Popup menu for the display tools
953
QMenu *toolPopupDisplay;
954
//! Popup menu for the capture tools
955
QMenu *toolPopupCapture;
957
QgsMapCanvas *mMapCanvas;
958
//! Table of contents (legend) for the map
959
QgsLegend *mMapLegend;
960
//! Cursor for the overview map
961
QCursor *mOverviewMapCursor;
964
//! Current map window extent in real-world coordinates
966
//! The previously selected non zoom map tool.
967
int mPreviousNonZoomMapTool;
968
//QCursor *mCursorZoomIn; //doesnt seem to be used anymore (TS)
969
QString mStartupPath;
970
//! full path name of the current map file (if it has been saved or loaded)
971
QString mFullPathName;
973
//! interface to QgisApp for plugins
974
QgisAppInterface *mQgisInterface;
975
friend class QgisAppInterface;
978
QString mVersionMessage;
979
QSplashScreen *mSplash;
981
QgsHelpViewer *mHelpViewer;
982
//! list of recently opened/saved project files
983
QStringList mRecentProjectPaths;
984
//! Print composers of this project, accessible by id string
985
QSet<QgsComposer*> mPrintComposers;
986
//! How to determine the number of decimal places used to
987
//! display the mouse position
988
bool mMousePrecisionAutomatic;
989
//! The number of decimal places to use if not automatic
990
unsigned int mMousePrecisionDecimalPlaces;
991
/** QGIS-internal vector feature clipboard */
992
QgsClipboard* mInternalClipboard;
993
//! Flag to indicate how the project properties dialog was summoned
994
bool mShowProjectionTab;
995
/** String containing supporting vector file formats
996
Suitable for a QFileDialog file filter. Build in ctor.
998
QString mVectorFileFilter;
999
/** String containing supporting raster file formats
1000
Suitable for a QFileDialog file filter. Build in ctor.
1002
QString mRasterFileFilter;
1004
/** Timer for map tips
1006
QTimer *mpMapTipsTimer;
1008
/** Point of last mouse position in map coordinates (used with MapTips)
1010
QgsPoint mLastMapPosition;
1014
QgsMapTip *mpMaptip;
1016
// Flag to indicate if maptips are on or off
1017
bool mMapTipsVisible;
1019
//!flag to indicate whether we are in fullscreen mode or not
1020
bool mFullScreenMode;
1022
//!flag to indicate that the previous screen mode was 'maximised'
1023
bool mPrevScreenModeMaximized;
1025
QgsPythonDialog* mPythonConsole;
1026
QgsPythonUtils* mPythonUtils;
1028
static QgisApp *smInstance;
1030
QgsUndoWidget* mUndoWidget;
1032
int mLastComposerId;