129 |
129 |
#include "qgsrectangle.h"
|
130 |
130 |
#include "qgsrenderer.h"
|
131 |
131 |
#include "qgsserversourceselect.h"
|
|
132 |
#include "qgstabwidget.h"
|
132 |
133 |
#include "qgsvectordataprovider.h"
|
133 |
134 |
#include "qgsvectorlayer.h"
|
134 |
135 |
#include "ogr/qgsopenvectorlayerdialog.h"
|
... | ... | |
306 |
307 |
// constructor starts here
|
307 |
308 |
QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
|
308 |
309 |
: QMainWindow( parent, fl ),
|
|
310 |
mLegendDock( NULL ),
|
|
311 |
mOverviewDock( NULL ),
|
|
312 |
mMapCanvas( NULL ),
|
|
313 |
mMapLegend( NULL ),
|
|
314 |
mOverviewMapCursor( NULL ),
|
309 |
315 |
mSplash( splash ),
|
310 |
316 |
mComposer( 0 ),
|
311 |
317 |
mPythonConsole( NULL ),
|
... | ... | |
344 |
350 |
createMenus();
|
345 |
351 |
createToolBars();
|
346 |
352 |
createStatusBar();
|
347 |
|
createCanvas();
|
|
353 |
createTabWidget();
|
|
354 |
twCreateNewTab();
|
348 |
355 |
mMapCanvas->freeze();
|
349 |
356 |
createLegend();
|
350 |
357 |
createOverview();
|
351 |
358 |
createMapTips();
|
|
359 |
createActionsExt();
|
352 |
360 |
readSettings();
|
353 |
361 |
updateRecentProjectPaths();
|
354 |
362 |
|
... | ... | |
449 |
457 |
delete mInternalClipboard;
|
450 |
458 |
delete mQgisInterface;
|
451 |
459 |
|
452 |
|
delete mMapTools.mZoomIn;
|
453 |
|
delete mMapTools.mZoomOut;
|
454 |
|
delete mMapTools.mPan;
|
455 |
|
delete mMapTools.mIdentify;
|
456 |
|
delete mMapTools.mMeasureDist;
|
457 |
|
delete mMapTools.mMeasureArea;
|
458 |
|
delete mMapTools.mCapturePoint;
|
459 |
|
delete mMapTools.mCaptureLine;
|
460 |
|
delete mMapTools.mCapturePolygon;
|
461 |
|
delete mMapTools.mMoveFeature;
|
462 |
|
delete mMapTools.mSplitFeatures;
|
463 |
|
delete mMapTools.mSelect;
|
464 |
|
delete mMapTools.mVertexAdd;
|
465 |
|
delete mMapTools.mVertexMove;
|
466 |
|
delete mMapTools.mVertexDelete;
|
467 |
|
delete mMapTools.mAddRing;
|
468 |
|
delete mMapTools.mAddIsland;
|
|
460 |
// call delete for all items from the lists
|
|
461 |
qDeleteAll(mMapCanvasList);
|
|
462 |
qDeleteAll(mMapOverviewCanvasList);
|
|
463 |
qDeleteAll(mMapLegendList);
|
|
464 |
qDeleteAll(mMapToolsList);
|
469 |
465 |
|
|
466 |
// remove all items from the lists
|
|
467 |
mMapCanvasList.clear();
|
|
468 |
mMapOverviewCanvasList.clear();
|
|
469 |
mMapLegendList.clear();
|
|
470 |
mMapToolsList.clear();
|
|
471 |
|
470 |
472 |
delete mPythonConsole;
|
471 |
473 |
delete mPythonUtils;
|
472 |
474 |
|
... | ... | |
536 |
538 |
mActionNewProject->setStatusTip( tr( "New Project" ) );
|
537 |
539 |
connect( mActionNewProject, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
|
538 |
540 |
|
|
541 |
mActionNewTab = new QAction( getThemeIcon( "mActionNewTab.png" ), tr( "&New Tab" ), this );
|
|
542 |
// mActionNewTab->setShortcut( tr( "Ctrl+T", "New Tab" ) );
|
|
543 |
mActionNewTab->setShortcut( QKeySequence::AddTab );
|
|
544 |
mActionNewTab->setStatusTip( tr( "New Tab" ) );
|
|
545 |
connect( mActionNewTab, SIGNAL( triggered() ), this, SLOT( twCreateNewTab() ) );
|
|
546 |
|
|
547 |
mActionCloseTab = new QAction( getThemeIcon( "mActionCloseTab.png" ), tr( "&Close Tab" ), this );
|
|
548 |
// mActionCloseTab->setShortcut( tr( "Ctrl+W", "Close Tab" ) );
|
|
549 |
mActionCloseTab->setShortcut( QKeySequence::Close );
|
|
550 |
mActionCloseTab->setStatusTip( tr( "Close Tab" ) );
|
|
551 |
connect( mActionCloseTab, SIGNAL( triggered() ), this, SLOT( twCloseTab() ) );
|
|
552 |
|
539 |
553 |
mActionOpenProject = new QAction( getThemeIcon( "mActionFileOpen.png" ), tr( "&Open Project..." ), this );
|
540 |
554 |
mActionOpenProject->setShortcut( tr( "Ctrl+O", "Open a Project" ) );
|
541 |
555 |
mActionOpenProject->setStatusTip( tr( "Open a Project" ) );
|
... | ... | |
937 |
951 |
connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );
|
938 |
952 |
}
|
939 |
953 |
|
|
954 |
void QgisApp::createActionsExt()
|
|
955 |
{
|
|
956 |
// create actions that helps user to navigate in tabs
|
|
957 |
QAction *myActionNextTab = new QAction(this);
|
|
958 |
// myActionNextTab->setShortcut(tr("Ctrl+PgDown", "Goto next tab"));
|
|
959 |
myActionNextTab->setShortcut(QKeySequence::NextChild);
|
|
960 |
connect(myActionNextTab, SIGNAL(triggered()), mTabWidget, SLOT(nextTab()));
|
|
961 |
addAction(myActionNextTab);
|
|
962 |
|
|
963 |
QAction *myActionPreviousTab = new QAction(this);
|
|
964 |
// myActionPrevTab->setShortcut(tr("Ctrl+PgUp", "Goto previous tab"));
|
|
965 |
myActionPreviousTab->setShortcut(QKeySequence::PreviousChild);
|
|
966 |
connect(myActionPreviousTab, SIGNAL(triggered()), mTabWidget, SLOT(previousTab()));
|
|
967 |
addAction(myActionPreviousTab);
|
|
968 |
}
|
|
969 |
|
940 |
970 |
void QgisApp::showPythonDialog()
|
941 |
971 |
{
|
942 |
972 |
if ( !mPythonUtils || !mPythonUtils->isEnabled() )
|
... | ... | |
1023 |
1053 |
mFileMenu = menuBar()->addMenu( tr( "&File" ) );
|
1024 |
1054 |
|
1025 |
1055 |
mFileMenu->addAction( mActionNewProject );
|
|
1056 |
mFileMenu->addAction(mActionNewTab);
|
1026 |
1057 |
mFileMenu->addAction( mActionOpenProject );
|
1027 |
1058 |
mRecentProjectsMenu = mFileMenu->addMenu( tr( "&Open Recent Projects" ) );
|
1028 |
1059 |
// Connect once for the entire submenu.
|
... | ... | |
1044 |
1075 |
mFileMenu->addAction( mActionPrintComposer );
|
1045 |
1076 |
mActionFileSeparator4 = mFileMenu->addSeparator();
|
1046 |
1077 |
|
|
1078 |
mFileMenu->addAction(mActionCloseTab);
|
1047 |
1079 |
mFileMenu->addAction( mActionExit );
|
1048 |
1080 |
|
1049 |
1081 |
// Edit Menu
|
... | ... | |
1449 |
1481 |
QgsApplication::setThemeName( theThemeName );
|
1450 |
1482 |
//QgsDebugMsg("Setting theme to \n" + theThemeName);
|
1451 |
1483 |
mActionNewProject->setIcon( getThemeIcon( "/mActionFileNew.png" ) );
|
|
1484 |
mActionNewTab->setIcon( getThemeIcon( "/mActionNewTab.png" ) );
|
1452 |
1485 |
mActionOpenProject->setIcon( getThemeIcon( "/mActionFileOpen.png" ) );
|
1453 |
1486 |
mActionSaveProject->setIcon( getThemeIcon( "/mActionFileSave.png" ) );
|
1454 |
1487 |
mActionSaveProjectAs->setIcon( getThemeIcon( "/mActionFileSaveAs.png" ) );
|
1455 |
1488 |
mActionPrintComposer->setIcon( getThemeIcon( "/mActionFilePrint.png" ) );
|
1456 |
1489 |
mActionSaveMapAsImage->setIcon( getThemeIcon( "/mActionSaveMapAsImage.png" ) );
|
|
1490 |
mActionCloseTab->setIcon( getThemeIcon( "/mActionCloseTab.png" ) );
|
1457 |
1491 |
mActionExit->setIcon( getThemeIcon( "/mActionFileExit.png" ) );
|
1458 |
1492 |
mActionAddOgrLayer->setIcon( getThemeIcon( "/mActionAddOgrLayer.png" ) );
|
1459 |
1493 |
mActionAddRasterLayer->setIcon( getThemeIcon( "/mActionAddRasterLayer.png" ) );
|
... | ... | |
1516 |
1550 |
emit currentThemeChanged( theThemeName );
|
1517 |
1551 |
}
|
1518 |
1552 |
|
|
1553 |
void QgisApp::resetupConnections(QgsMapCanvas *thePrevMapCanvas, QgsLegend *thePrevMapLegend,
|
|
1554 |
QgsMapCanvas *theNewMapCanvas, QgsLegend *theNewMapLegend)
|
|
1555 |
{
|
|
1556 |
if (thePrevMapCanvas && thePrevMapLegend)
|
|
1557 |
{
|
|
1558 |
// disconnect map layer registry signals to legend
|
|
1559 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
|
|
1560 |
thePrevMapLegend, SLOT( removeLayer( QString ) ) );
|
|
1561 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ),
|
|
1562 |
thePrevMapLegend, SLOT( removeAll() ) );
|
|
1563 |
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ),
|
|
1564 |
thePrevMapLegend, SLOT( addLayer( QgsMapLayer * ) ) );
|
|
1565 |
disconnect( thePrevMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
|
|
1566 |
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) );
|
|
1567 |
|
|
1568 |
//signal when mouse moved over window (coords display in status bar)
|
|
1569 |
disconnect( thePrevMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) );
|
|
1570 |
disconnect( thePrevMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) );
|
|
1571 |
disconnect( thePrevMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) );
|
|
1572 |
disconnect( thePrevMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) );
|
|
1573 |
disconnect( thePrevMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) );
|
|
1574 |
disconnect( thePrevMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) );
|
|
1575 |
disconnect( thePrevMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) );
|
|
1576 |
disconnect( thePrevMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) );
|
|
1577 |
disconnect( thePrevMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ),
|
|
1578 |
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
|
|
1579 |
|
|
1580 |
disconnect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), thePrevMapCanvas, SLOT( setRenderFlag( bool ) ) );
|
|
1581 |
}
|
|
1582 |
|
|
1583 |
if (theNewMapCanvas && theNewMapLegend)
|
|
1584 |
{
|
|
1585 |
// connect map layer registry signals to legend
|
|
1586 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
|
|
1587 |
theNewMapLegend, SLOT( removeLayer( QString ) ) );
|
|
1588 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ),
|
|
1589 |
theNewMapLegend, SLOT( removeAll() ) );
|
|
1590 |
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ),
|
|
1591 |
theNewMapLegend, SLOT( addLayer( QgsMapLayer * ) ) );
|
|
1592 |
connect( theNewMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
|
|
1593 |
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) );
|
|
1594 |
|
|
1595 |
|
|
1596 |
//signal when mouse moved over window (coords display in status bar)
|
|
1597 |
connect( theNewMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) );
|
|
1598 |
connect( theNewMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) );
|
|
1599 |
connect( theNewMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) );
|
|
1600 |
connect( theNewMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) );
|
|
1601 |
connect( theNewMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) );
|
|
1602 |
connect( theNewMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) );
|
|
1603 |
connect( theNewMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) );
|
|
1604 |
connect( theNewMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) );
|
|
1605 |
connect( theNewMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ),
|
|
1606 |
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
|
|
1607 |
|
|
1608 |
connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), theNewMapCanvas, SLOT( setRenderFlag( bool ) ) );
|
|
1609 |
}
|
|
1610 |
}
|
|
1611 |
|
1519 |
1612 |
void QgisApp::setupConnections()
|
1520 |
1613 |
{
|
1521 |
1614 |
// connect the "cleanup" slot
|
1522 |
1615 |
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveWindowState() ) );
|
1523 |
|
//connect the legend, mapcanvas and overview canvas to the registry
|
|
1616 |
// connect the legend, mapcanvas and overview canvas to the registry
|
1524 |
1617 |
|
1525 |
|
// connect map layer registry signals to legend
|
1526 |
|
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
|
1527 |
|
mMapLegend, SLOT( removeLayer( QString ) ) );
|
1528 |
|
connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ),
|
1529 |
|
mMapLegend, SLOT( removeAll() ) );
|
1530 |
|
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ),
|
1531 |
|
mMapLegend, SLOT( addLayer( QgsMapLayer * ) ) );
|
1532 |
|
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
|
1533 |
|
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) );
|
1534 |
|
|
1535 |
|
|
1536 |
|
//signal when mouse moved over window (coords display in status bar)
|
1537 |
|
connect( mMapCanvas, SIGNAL( xyCoordinates( QgsPoint & ) ), this, SLOT( showMouseCoordinate( QgsPoint & ) ) );
|
1538 |
|
connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) );
|
1539 |
|
connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) );
|
1540 |
|
connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) );
|
1541 |
|
connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) );
|
1542 |
|
connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) );
|
1543 |
|
connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) );
|
1544 |
|
connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) );
|
1545 |
|
connect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ),
|
1546 |
|
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
|
1547 |
|
|
1548 |
|
connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), mMapCanvas, SLOT( setRenderFlag( bool ) ) );
|
1549 |
1618 |
//
|
1550 |
1619 |
// Do we really need this ??? - its already connected to the esc key...TS
|
1551 |
1620 |
//
|
... | ... | |
1555 |
1624 |
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
|
1556 |
1625 |
this, SLOT( oldProjectVersionWarning( QString ) ) );
|
1557 |
1626 |
|
|
1627 |
// do something when current tab in tab widget was switched or moved
|
|
1628 |
connect( mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(twCurrentTabChanged(int)));
|
|
1629 |
connect( mTabWidget, SIGNAL(tabMoved(int,int)), this, SLOT(twCurrentTabMoved(int, int)));
|
|
1630 |
|
|
1631 |
// close a current tab when the close button on a tab is clicked
|
|
1632 |
connect( mTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(twCloseTab(int)));
|
1558 |
1633 |
}
|
1559 |
|
void QgisApp::createCanvas()
|
|
1634 |
|
|
1635 |
void QgisApp::twCurrentTabChanged(int index)
|
1560 |
1636 |
{
|
|
1637 |
// get new map canvas and legend from lists
|
|
1638 |
QgsMapCanvas *pNewMapCanvas = mMapCanvasList.at(index);
|
|
1639 |
QgsLegend *pNewMapLegend = mMapLegendList.at(index);
|
|
1640 |
|
|
1641 |
// do nothing if new map canvas and legend is current
|
|
1642 |
if (pNewMapCanvas == mMapCanvas && pNewMapLegend == mMapLegend) return;
|
|
1643 |
|
|
1644 |
// setup connections for new map canvas and legend selected in a tab
|
|
1645 |
// and disconnect connections for previous map canvas and legend
|
|
1646 |
if (pNewMapCanvas && pNewMapLegend)
|
|
1647 |
{
|
|
1648 |
resetupConnections(mMapCanvas, mMapLegend, pNewMapCanvas, pNewMapLegend);
|
|
1649 |
}
|
|
1650 |
|
|
1651 |
// set new map canvas, overview, legend and tools for a selected tab
|
|
1652 |
mMapCanvas = pNewMapCanvas;
|
|
1653 |
mMapLegend = pNewMapLegend;
|
|
1654 |
mMapOverviewCanvas = mMapOverviewCanvasList.at(index);
|
|
1655 |
mMapTools = mMapToolsList.at(index);
|
|
1656 |
|
|
1657 |
// enable overview canvas for map canvas
|
|
1658 |
mMapCanvas->enableOverviewMode( mMapOverviewCanvas );
|
|
1659 |
// set map tool for map canvas
|
|
1660 |
mMapCanvas->setMapTool( mMapToolsList.at(index)->currentTool );
|
|
1661 |
|
|
1662 |
// put new map legend in legend dock widget and new overview canvas to overview dock
|
|
1663 |
if (mLegendDock && mOverviewDock)
|
|
1664 |
{
|
|
1665 |
mLegendDock->setWidget(mMapLegend);
|
|
1666 |
mOverviewDock->setWidget(mMapOverviewCanvas);
|
|
1667 |
}
|
|
1668 |
}
|
|
1669 |
|
|
1670 |
void QgisApp::twCurrentTabMoved(int from, int to)
|
|
1671 |
{
|
|
1672 |
// do appropriated procedures to change an index of the current tab to new one
|
|
1673 |
twCurrentTabChanged(to);
|
|
1674 |
|
|
1675 |
// do the swap in lists
|
|
1676 |
mMapCanvasList.swap(from, to);
|
|
1677 |
mMapOverviewCanvasList.swap(from,to);
|
|
1678 |
mMapLegendList.swap(from, to);
|
|
1679 |
mMapToolsList.swap(from, to);
|
|
1680 |
}
|
|
1681 |
|
|
1682 |
void QgisApp::twCreateNewTab()
|
|
1683 |
{
|
|
1684 |
// countOfTabs counts all numbers of created tabs and put it in a name of a new tab
|
|
1685 |
static int countOfTabs = 1;
|
|
1686 |
|
|
1687 |
// create map canvas and add it to the tab widget
|
|
1688 |
QgsMapCanvas *myMapCanvas = createMapCanvasWithTools();
|
|
1689 |
myMapCanvas->setObjectName( "theMapCanvas" );
|
|
1690 |
mTabWidget->addTab(myMapCanvas, tr("Canvas %1").arg(countOfTabs++));
|
|
1691 |
|
|
1692 |
// set canvas color in map canvas
|
|
1693 |
int myRedInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorRedPart", 255 );
|
|
1694 |
int myGreenInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorGreenPart", 255 );
|
|
1695 |
int myBlueInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorBluePart", 255 );
|
|
1696 |
QColor myColor = QColor( myRedInt, myGreenInt, myBlueInt );
|
|
1697 |
myMapCanvas->setCanvasColor( myColor ); // this is fill colour before rendering onto canvas
|
|
1698 |
|
|
1699 |
// create map legend for map canvas
|
|
1700 |
QgsLegend *myMapLegend = new QgsLegend( NULL, "theMapLegend" );
|
|
1701 |
myMapLegend->setObjectName( "theMapLegend" );
|
|
1702 |
myMapLegend->setMapCanvas( myMapCanvas );
|
|
1703 |
|
|
1704 |
// add the toggle editing action also to legend such that right click menu and button show the same state
|
|
1705 |
myMapLegend->setToggleEditingAction( mActionToggleEditing );
|
|
1706 |
myMapLegend->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas."
|
|
1707 |
"Click on the check box to turn a layer on or off. Double click on a layer"
|
|
1708 |
"in the legend to customize its appearance and set other properties." ) );
|
|
1709 |
|
|
1710 |
// create overview canvas
|
|
1711 |
QgsMapOverviewCanvas* myMapOverviewCanvas = new QgsMapOverviewCanvas( NULL, myMapCanvas );
|
|
1712 |
myMapOverviewCanvas->setWhatsThis( tr( "Map overview canvas. This canvas can be used to display a locator map"
|
|
1713 |
"that shows the current extent of the map canvas. The current extent is shown as"
|
|
1714 |
"a red rectangle. Any layer on the map can be added to the overview canvas." ) );
|
|
1715 |
|
|
1716 |
// set cursor in overview canvas
|
|
1717 |
if (!mOverviewMapCursor)
|
|
1718 |
{
|
|
1719 |
QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
|
|
1720 |
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
|
|
1721 |
|
|
1722 |
//set upper left corner as hot spot - this is better when extent marker is small; hand won't cover the marker
|
|
1723 |
mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 0, 0 );
|
|
1724 |
}
|
|
1725 |
myMapOverviewCanvas->setCursor( *mOverviewMapCursor );
|
|
1726 |
|
|
1727 |
// append map canvas, overview canvas and legend to list
|
|
1728 |
mMapCanvasList.append(myMapCanvas);
|
|
1729 |
mMapOverviewCanvasList.append(myMapOverviewCanvas);
|
|
1730 |
mMapLegendList.append(myMapLegend);
|
|
1731 |
|
|
1732 |
// set map canvas and map tools for new tab
|
|
1733 |
twCurrentTabChanged(mTabWidget->currentIndex());
|
|
1734 |
}
|
|
1735 |
|
|
1736 |
void QgisApp::twCloseTab()
|
|
1737 |
{
|
|
1738 |
// close the current tab
|
|
1739 |
twCloseTab(mTabWidget->currentIndex());
|
|
1740 |
}
|
|
1741 |
|
|
1742 |
void QgisApp::twCloseTab(int index)
|
|
1743 |
{
|
|
1744 |
// do nothing when we have an one tab
|
|
1745 |
if (mTabWidget->count() == 1) return;
|
|
1746 |
|
|
1747 |
// remove current tab
|
|
1748 |
mTabWidget->removeTab(index);
|
|
1749 |
|
|
1750 |
QgsMapCanvas *ptmpMapCanvas = mMapCanvasList[index];
|
|
1751 |
QgsLegend *ptmpMapLegend = mMapLegendList[index];
|
|
1752 |
|
|
1753 |
// disconnect the connetions relative to the map canvas and legend at index *index*
|
|
1754 |
resetupConnections(ptmpMapCanvas, ptmpMapLegend, NULL, NULL);
|
|
1755 |
|
|
1756 |
// free memory allocated by tems corresponding to the current tab
|
|
1757 |
delete mMapToolsList[index];
|
|
1758 |
delete mMapOverviewCanvasList[index];
|
|
1759 |
delete ptmpMapLegend;
|
|
1760 |
delete ptmpMapCanvas;
|
|
1761 |
|
|
1762 |
// set the pointers to NULL
|
|
1763 |
mMapCanvas = NULL;
|
|
1764 |
mMapOverviewCanvas = NULL;
|
|
1765 |
mMapLegend = NULL;
|
|
1766 |
mMapTools = NULL;
|
|
1767 |
|
|
1768 |
// remove corresponding to current tab map canvas, overview canvas, map legend and map tools
|
|
1769 |
mMapCanvasList.removeAt(index);
|
|
1770 |
mMapOverviewCanvasList.removeAt(index);
|
|
1771 |
mMapLegendList.removeAt(index);
|
|
1772 |
mMapToolsList.removeAt(index);
|
|
1773 |
|
|
1774 |
// *update* the current tab
|
|
1775 |
twCurrentTabChanged(mTabWidget->currentIndex());
|
|
1776 |
}
|
|
1777 |
|
|
1778 |
void QgisApp::createTabWidget()
|
|
1779 |
{
|
|
1780 |
// create the main tab widget
|
|
1781 |
mTabWidget = new QgsTabWidget(this);
|
|
1782 |
mTabWidget->setTabPosition(QTabWidget::East);
|
|
1783 |
mTabWidget->setTabsClosable(true);
|
|
1784 |
mTabWidget->setMovable(true);
|
|
1785 |
setCentralWidget( mTabWidget );
|
|
1786 |
}
|
|
1787 |
|
|
1788 |
QgsMapCanvas * QgisApp::createMapCanvasWithTools()
|
|
1789 |
{
|
1561 |
1790 |
// "theMapCanvas" used to find this canonical instance later
|
1562 |
|
mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" );
|
1563 |
|
mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector "
|
|
1791 |
QgsMapCanvas *myMapCanvas = new QgsMapCanvas( this, "theMapCanvas" );
|
|
1792 |
myMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector "
|
1564 |
1793 |
"layers are displayed when added to the map" ) );
|
1565 |
1794 |
|
1566 |
|
setCentralWidget( mMapCanvas );
|
1567 |
1795 |
// set the focus to the map canvas
|
1568 |
|
mMapCanvas->setFocus();
|
|
1796 |
myMapCanvas->setFocus();
|
1569 |
1797 |
|
1570 |
1798 |
// create tools
|
1571 |
|
mMapTools.mZoomIn = new QgsMapToolZoom( mMapCanvas, FALSE /* zoomIn */ );
|
1572 |
|
mMapTools.mZoomIn->setAction( mActionZoomIn );
|
1573 |
|
mMapTools.mZoomOut = new QgsMapToolZoom( mMapCanvas, TRUE /* zoomOut */ );
|
1574 |
|
mMapTools.mZoomOut->setAction( mActionZoomOut );
|
1575 |
|
mMapTools.mPan = new QgsMapToolPan( mMapCanvas );
|
1576 |
|
mMapTools.mPan->setAction( mActionPan );
|
1577 |
|
mMapTools.mIdentify = new QgsMapToolIdentify( mMapCanvas );
|
1578 |
|
mMapTools.mIdentify->setAction( mActionIdentify );
|
1579 |
|
mMapTools.mMeasureDist = new QgsMeasureTool( mMapCanvas, FALSE /* area */ );
|
1580 |
|
mMapTools.mMeasureDist->setAction( mActionMeasure );
|
1581 |
|
mMapTools.mMeasureArea = new QgsMeasureTool( mMapCanvas, TRUE /* area */ );
|
1582 |
|
mMapTools.mMeasureArea->setAction( mActionMeasureArea );
|
1583 |
|
mMapTools.mCapturePoint = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CapturePoint );
|
1584 |
|
mMapTools.mCapturePoint->setAction( mActionCapturePoint );
|
|
1799 |
mMapTools = new Tools();
|
|
1800 |
|
|
1801 |
mMapTools->mZoomIn = new QgsMapToolZoom( myMapCanvas, FALSE /* zoomIn */ );
|
|
1802 |
mMapTools->mZoomIn->setAction( mActionZoomIn );
|
|
1803 |
mMapTools->mZoomOut = new QgsMapToolZoom( myMapCanvas, TRUE /* zoomOut */ );
|
|
1804 |
mMapTools->mZoomOut->setAction( mActionZoomOut );
|
|
1805 |
mMapTools->mPan = new QgsMapToolPan( myMapCanvas );
|
|
1806 |
mMapTools->mPan->setAction( mActionPan );
|
|
1807 |
mMapTools->mIdentify = new QgsMapToolIdentify( myMapCanvas );
|
|
1808 |
mMapTools->mIdentify->setAction( mActionIdentify );
|
|
1809 |
mMapTools->mMeasureDist = new QgsMeasureTool( myMapCanvas, FALSE /* area */ );
|
|
1810 |
mMapTools->mMeasureDist->setAction( mActionMeasure );
|
|
1811 |
mMapTools->mMeasureArea = new QgsMeasureTool( myMapCanvas, TRUE /* area */ );
|
|
1812 |
mMapTools->mMeasureArea->setAction( mActionMeasureArea );
|
|
1813 |
mMapTools->mCapturePoint = new QgsMapToolAddFeature( myMapCanvas, QgsMapToolCapture::CapturePoint );
|
|
1814 |
mMapTools->mCapturePoint->setAction( mActionCapturePoint );
|
1585 |
1815 |
mActionCapturePoint->setVisible( false );
|
1586 |
|
mMapTools.mCaptureLine = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CaptureLine );
|
1587 |
|
mMapTools.mCaptureLine->setAction( mActionCaptureLine );
|
|
1816 |
mMapTools->mCaptureLine = new QgsMapToolAddFeature( myMapCanvas, QgsMapToolCapture::CaptureLine );
|
|
1817 |
mMapTools->mCaptureLine->setAction( mActionCaptureLine );
|
1588 |
1818 |
mActionCaptureLine->setVisible( false );
|
1589 |
|
mMapTools.mCapturePolygon = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CapturePolygon );
|
1590 |
|
mMapTools.mCapturePolygon->setAction( mActionCapturePolygon );
|
|
1819 |
mMapTools->mCapturePolygon = new QgsMapToolAddFeature( myMapCanvas, QgsMapToolCapture::CapturePolygon );
|
|
1820 |
mMapTools->mCapturePolygon->setAction( mActionCapturePolygon );
|
1591 |
1821 |
mActionCapturePolygon->setVisible( false );
|
1592 |
|
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
|
1593 |
|
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
|
1594 |
|
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
|
1595 |
|
mMapTools.mSplitFeatures->setAction( mActionSplitFeatures );
|
1596 |
|
mMapTools.mSelect = new QgsMapToolSelect( mMapCanvas );
|
1597 |
|
mMapTools.mSelect->setAction( mActionSelect );
|
1598 |
|
mMapTools.mVertexAdd = new QgsMapToolAddVertex( mMapCanvas );
|
1599 |
|
mMapTools.mVertexAdd->setAction( mActionAddVertex );
|
1600 |
|
mMapTools.mVertexMove = new QgsMapToolMoveVertex( mMapCanvas );
|
1601 |
|
mMapTools.mVertexMove->setAction( mActionMoveVertex );
|
1602 |
|
mMapTools.mVertexDelete = new QgsMapToolDeleteVertex( mMapCanvas );
|
1603 |
|
mMapTools.mVertexDelete->setAction( mActionDeleteVertex );
|
1604 |
|
mMapTools.mAddRing = new QgsMapToolAddRing( mMapCanvas );
|
1605 |
|
mMapTools.mAddRing->setAction( mActionAddRing );
|
1606 |
|
mMapTools.mAddIsland = new QgsMapToolAddIsland( mMapCanvas );
|
|
1822 |
mMapTools->mMoveFeature = new QgsMapToolMoveFeature( myMapCanvas );
|
|
1823 |
mMapTools->mMoveFeature->setAction( mActionMoveFeature );
|
|
1824 |
mMapTools->mSplitFeatures = new QgsMapToolSplitFeatures( myMapCanvas );
|
|
1825 |
mMapTools->mSplitFeatures->setAction( mActionSplitFeatures );
|
|
1826 |
mMapTools->mSelect = new QgsMapToolSelect( myMapCanvas );
|
|
1827 |
mMapTools->mSelect->setAction( mActionSelect );
|
|
1828 |
mMapTools->mVertexAdd = new QgsMapToolAddVertex( myMapCanvas );
|
|
1829 |
mMapTools->mVertexAdd->setAction( mActionAddVertex );
|
|
1830 |
mMapTools->mVertexMove = new QgsMapToolMoveVertex( myMapCanvas );
|
|
1831 |
mMapTools->mVertexMove->setAction( mActionMoveVertex );
|
|
1832 |
mMapTools->mVertexDelete = new QgsMapToolDeleteVertex( myMapCanvas );
|
|
1833 |
mMapTools->mVertexDelete->setAction( mActionDeleteVertex );
|
|
1834 |
mMapTools->mAddRing = new QgsMapToolAddRing( myMapCanvas );
|
|
1835 |
mMapTools->mAddRing->setAction( mActionAddRing );
|
|
1836 |
mMapTools->mAddIsland = new QgsMapToolAddIsland( myMapCanvas );
|
|
1837 |
|
|
1838 |
// set a current map tool
|
|
1839 |
mMapTools->currentTool = mMapTools->mPan;
|
|
1840 |
|
1607 |
1841 |
//ensure that non edit tool is initialised or we will get crashes in some situations
|
1608 |
|
mNonEditMapTool = mMapTools.mPan;
|
|
1842 |
mNonEditMapTool = mMapTools->mPan;
|
|
1843 |
|
|
1844 |
// append map tools to list
|
|
1845 |
mMapToolsList.append(mMapTools);
|
|
1846 |
|
|
1847 |
return myMapCanvas;
|
1609 |
1848 |
}
|
1610 |
1849 |
|
1611 |
1850 |
void QgisApp::createOverview()
|
1612 |
1851 |
{
|
1613 |
|
// overview canvas
|
1614 |
|
QgsMapOverviewCanvas* overviewCanvas = new QgsMapOverviewCanvas( NULL, mMapCanvas );
|
1615 |
|
overviewCanvas->setWhatsThis( tr( "Map overview canvas. This canvas can be used to display a locator map that shows the current extent of the map canvas. The current extent is shown as a red rectangle. Any layer on the map can be added to the overview canvas." ) );
|
1616 |
|
|
1617 |
|
QBitmap overviewPanBmp = QBitmap::fromData( QSize( 16, 16 ), pan_bits );
|
1618 |
|
QBitmap overviewPanBmpMask = QBitmap::fromData( QSize( 16, 16 ), pan_mask_bits );
|
1619 |
|
mOverviewMapCursor = new QCursor( overviewPanBmp, overviewPanBmpMask, 0, 0 ); //set upper left corner as hot spot - this is better when extent marker is small; hand won't cover the marker
|
1620 |
|
overviewCanvas->setCursor( *mOverviewMapCursor );
|
1621 |
|
// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
|
1622 |
|
// myOverviewLayout->addWidget(overviewCanvas);
|
1623 |
|
// overviewFrame->setLayout(myOverviewLayout);
|
1624 |
1852 |
mOverviewDock = new QDockWidget( tr( "Overview" ), this );
|
1625 |
1853 |
mOverviewDock->setObjectName( "Overview" );
|
1626 |
1854 |
mOverviewDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
1627 |
|
mOverviewDock->setWidget( overviewCanvas );
|
|
1855 |
mOverviewDock->setWidget( mMapOverviewCanvas );
|
1628 |
1856 |
addDockWidget( Qt::LeftDockWidgetArea, mOverviewDock );
|
1629 |
1857 |
// add to the Panel submenu
|
1630 |
1858 |
mPanelMenu->addAction( mOverviewDock->toggleViewAction() );
|
1631 |
1859 |
|
1632 |
|
mMapCanvas->enableOverviewMode( overviewCanvas );
|
1633 |
|
|
1634 |
1860 |
// moved here to set anti aliasing to both map canvas and overview
|
1635 |
1861 |
QSettings mySettings;
|
1636 |
1862 |
mMapCanvas->enableAntiAliasing( mySettings.value( "/qgis/enable_anti_aliasing", false ).toBool() );
|
... | ... | |
1659 |
1885 |
mMapCanvas->refresh();
|
1660 |
1886 |
}
|
1661 |
1887 |
|
|
1888 |
void QgisApp::addTabWidget( QWidget *page, const QString &label )
|
|
1889 |
{
|
|
1890 |
mTabWidget->addTab( page, label );
|
|
1891 |
}
|
|
1892 |
|
|
1893 |
void QgisApp::addTabWidget( QWidget *page, const QIcon &icon, const QString &label )
|
|
1894 |
{
|
|
1895 |
mTabWidget->addTab( page, icon, label );
|
|
1896 |
}
|
|
1897 |
|
|
1898 |
void QgisApp::insertTabWidget( int index, QWidget *page, const QString &label )
|
|
1899 |
{
|
|
1900 |
mTabWidget->insertTab( index, page, label );
|
|
1901 |
}
|
|
1902 |
|
|
1903 |
void QgisApp::insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label )
|
|
1904 |
{
|
|
1905 |
mTabWidget->insertTab( index, page, icon, label );
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
void QgisApp::removeTabWidget( int index )
|
|
1909 |
{
|
|
1910 |
mTabWidget->removeTab( index );
|
|
1911 |
}
|
|
1912 |
|
1662 |
1913 |
QToolBar *QgisApp::addToolBar( QString name )
|
1663 |
1914 |
{
|
1664 |
1915 |
QToolBar *toolBar = QMainWindow::addToolBar( name );
|
... | ... | |
1669 |
1920 |
|
1670 |
1921 |
void QgisApp::createLegend()
|
1671 |
1922 |
{
|
1672 |
|
//legend
|
1673 |
|
mMapLegend = new QgsLegend( NULL, "theMapLegend" );
|
1674 |
|
mMapLegend->setObjectName( "theMapLegend" );
|
1675 |
|
mMapLegend->setMapCanvas( mMapCanvas );
|
1676 |
|
|
1677 |
|
//add the toggle editing action also to legend such that right click menu and button show the same state
|
1678 |
|
mMapLegend->setToggleEditingAction( mActionToggleEditing );
|
1679 |
|
|
1680 |
|
mMapLegend->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas. Click on the check box to turn a layer on or off. Double click on a layer in the legend to customize its appearance and set other properties." ) );
|
1681 |
1923 |
mLegendDock = new QDockWidget( tr( "Layers" ), this );
|
1682 |
1924 |
mLegendDock->setObjectName( "Legend" );
|
1683 |
1925 |
mLegendDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
... | ... | |
2960 |
3202 |
mMapCanvas->mapRenderer()->setProjectionsEnabled( FALSE );
|
2961 |
3203 |
|
2962 |
3204 |
// set the initial map tool
|
2963 |
|
mMapCanvas->setMapTool( mMapTools.mPan );
|
2964 |
|
mNonEditMapTool = mMapTools.mPan; // signals are not yet setup to catch this
|
|
3205 |
mMapCanvas->setMapTool( mMapTools->mPan );
|
|
3206 |
mNonEditMapTool = mMapTools->mPan; // signals are not yet setup to catch this
|
2965 |
3207 |
} // QgisApp::fileNew(bool thePromptToSaveFlag)
|
2966 |
3208 |
|
2967 |
3209 |
|
... | ... | |
3703 |
3945 |
// showMaxmized() is a work-around. Turn off rendering for this as it
|
3704 |
3946 |
// would otherwise cause two re-renders of the map, which can take a
|
3705 |
3947 |
// long time.
|
3706 |
|
bool renderFlag = mapCanvas()->renderFlag();
|
3707 |
|
mapCanvas()->setRenderFlag( false );
|
|
3948 |
bool renderFlag = mMapCanvas->renderFlag();
|
|
3949 |
mMapCanvas->setRenderFlag( false );
|
3708 |
3950 |
showNormal();
|
3709 |
3951 |
showMaximized();
|
3710 |
|
mapCanvas()->setRenderFlag( renderFlag );
|
|
3952 |
mMapCanvas->setRenderFlag( renderFlag );
|
3711 |
3953 |
mPrevScreenModeMaximized = false;
|
3712 |
3954 |
}
|
3713 |
3955 |
else
|
... | ... | |
3802 |
4044 |
{
|
3803 |
4045 |
QgsDebugMsg( "hiding all layers!" );
|
3804 |
4046 |
|
3805 |
|
legend()->selectAll( false );
|
|
4047 |
mMapLegend->selectAll( false );
|
3806 |
4048 |
}
|
3807 |
4049 |
|
3808 |
4050 |
|
... | ... | |
3811 |
4053 |
{
|
3812 |
4054 |
QgsDebugMsg( "Showing all layers!" );
|
3813 |
4055 |
|
3814 |
|
legend()->selectAll( true );
|
|
4056 |
mMapLegend->selectAll( true );
|
3815 |
4057 |
}
|
3816 |
4058 |
|
3817 |
4059 |
|
... | ... | |
3819 |
4061 |
{
|
3820 |
4062 |
QgsDebugMsg( "Setting map tool to zoomIn" );
|
3821 |
4063 |
|
3822 |
|
mMapCanvas->setMapTool( mMapTools.mZoomIn );
|
|
4064 |
mMapCanvas->setMapTool( mMapTools->mZoomIn );
|
3823 |
4065 |
|
3824 |
4066 |
// notify the project we've made a change
|
3825 |
4067 |
QgsProject::instance()->dirty( true );
|
... | ... | |
3828 |
4070 |
|
3829 |
4071 |
void QgisApp::zoomOut()
|
3830 |
4072 |
{
|
3831 |
|
mMapCanvas->setMapTool( mMapTools.mZoomOut );
|
|
4073 |
mMapCanvas->setMapTool( mMapTools->mZoomOut );
|
3832 |
4074 |
|
3833 |
4075 |
// notify the project we've made a change
|
3834 |
4076 |
QgsProject::instance()->dirty( true );
|
... | ... | |
3844 |
4086 |
|
3845 |
4087 |
void QgisApp::pan()
|
3846 |
4088 |
{
|
3847 |
|
mMapCanvas->setMapTool( mMapTools.mPan );
|
|
4089 |
mMapCanvas->setMapTool( mMapTools->mPan );
|
3848 |
4090 |
}
|
3849 |
4091 |
|
3850 |
4092 |
void QgisApp::zoomFull()
|
... | ... | |
3878 |
4120 |
|
3879 |
4121 |
void QgisApp::identify()
|
3880 |
4122 |
{
|
3881 |
|
mMapCanvas->setMapTool( mMapTools.mIdentify );
|
|
4123 |
mMapCanvas->setMapTool( mMapTools->mIdentify );
|
3882 |
4124 |
}
|
3883 |
4125 |
|
3884 |
4126 |
void QgisApp::measure()
|
3885 |
4127 |
{
|
3886 |
|
mMapCanvas->setMapTool( mMapTools.mMeasureDist );
|
|
4128 |
mMapCanvas->setMapTool( mMapTools->mMeasureDist );
|
3887 |
4129 |
}
|
3888 |
4130 |
|
3889 |
4131 |
void QgisApp::measureArea()
|
3890 |
4132 |
{
|
3891 |
|
mMapCanvas->setMapTool( mMapTools.mMeasureArea );
|
|
4133 |
mMapCanvas->setMapTool( mMapTools->mMeasureArea );
|
3892 |
4134 |
}
|
3893 |
4135 |
|
3894 |
4136 |
void QgisApp::attributeTable()
|
... | ... | |
3971 |
4213 |
|
3972 |
4214 |
void QgisApp::moveFeature()
|
3973 |
4215 |
{
|
3974 |
|
mMapCanvas->setMapTool( mMapTools.mMoveFeature );
|
|
4216 |
mMapCanvas->setMapTool( mMapTools->mMoveFeature );
|
3975 |
4217 |
}
|
3976 |
4218 |
|
3977 |
4219 |
void QgisApp::splitFeatures()
|
3978 |
4220 |
{
|
3979 |
|
mMapCanvas->setMapTool( mMapTools.mSplitFeatures );
|
|
4221 |
mMapCanvas->setMapTool( mMapTools->mSplitFeatures );
|
3980 |
4222 |
}
|
3981 |
4223 |
|
3982 |
4224 |
void QgisApp::capturePoint()
|
... | ... | |
3987 |
4229 |
}
|
3988 |
4230 |
|
3989 |
4231 |
// set current map tool to select
|
3990 |
|
mMapCanvas->setMapTool( mMapTools.mCapturePoint );
|
|
4232 |
mMapCanvas->setMapTool( mMapTools->mCapturePoint );
|
3991 |
4233 |
}
|
3992 |
4234 |
|
3993 |
4235 |
void QgisApp::captureLine()
|
... | ... | |
3997 |
4239 |
return;
|
3998 |
4240 |
}
|
3999 |
4241 |
|
4000 |
|
mMapCanvas->setMapTool( mMapTools.mCaptureLine );
|
|
4242 |
mMapCanvas->setMapTool( mMapTools->mCaptureLine );
|
4001 |
4243 |
}
|
4002 |
4244 |
|
4003 |
4245 |
void QgisApp::capturePolygon()
|
... | ... | |
4006 |
4248 |
{
|
4007 |
4249 |
return;
|
4008 |
4250 |
}
|
4009 |
|
mMapCanvas->setMapTool( mMapTools.mCapturePolygon );
|
|
4251 |
mMapCanvas->setMapTool( mMapTools->mCapturePolygon );
|
4010 |
4252 |
}
|
4011 |
4253 |
|
4012 |
4254 |
void QgisApp::select()
|
4013 |
4255 |
{
|
4014 |
|
mMapCanvas->setMapTool( mMapTools.mSelect );
|
|
4256 |
mMapCanvas->setMapTool( mMapTools->mSelect );
|
4015 |
4257 |
}
|
4016 |
4258 |
|
4017 |
4259 |
|
... | ... | |
4021 |
4263 |
{
|
4022 |
4264 |
return;
|
4023 |
4265 |
}
|
4024 |
|
mMapCanvas->setMapTool( mMapTools.mVertexAdd );
|
|
4266 |
mMapCanvas->setMapTool( mMapTools->mVertexAdd );
|
4025 |
4267 |
|
4026 |
4268 |
}
|
4027 |
4269 |
|
... | ... | |
4031 |
4273 |
{
|
4032 |
4274 |
return;
|
4033 |
4275 |
}
|
4034 |
|
mMapCanvas->setMapTool( mMapTools.mVertexMove );
|
|
4276 |
mMapCanvas->setMapTool( mMapTools->mVertexMove );
|
4035 |
4277 |
}
|
4036 |
4278 |
|
4037 |
4279 |
void QgisApp::addRing()
|
... | ... | |
4040 |
4282 |
{
|
4041 |
4283 |
return;
|
4042 |
4284 |
}
|
4043 |
|
mMapCanvas->setMapTool( mMapTools.mAddRing );
|
|
4285 |
mMapCanvas->setMapTool( mMapTools->mAddRing );
|
4044 |
4286 |
}
|
4045 |
4287 |
|
4046 |
4288 |
void QgisApp::addIsland()
|
... | ... | |
4049 |
4291 |
{
|
4050 |
4292 |
return;
|
4051 |
4293 |
}
|
4052 |
|
mMapCanvas->setMapTool( mMapTools.mAddIsland );
|
|
4294 |
mMapCanvas->setMapTool( mMapTools->mAddIsland );
|
4053 |
4295 |
}
|
4054 |
4296 |
|
4055 |
4297 |
|
... | ... | |
4059 |
4301 |
{
|
4060 |
4302 |
return;
|
4061 |
4303 |
}
|
4062 |
|
mMapCanvas->setMapTool( mMapTools.mVertexDelete );
|
|
4304 |
mMapCanvas->setMapTool( mMapTools->mVertexDelete );
|
4063 |
4305 |
}
|
4064 |
4306 |
|
4065 |
4307 |
|
... | ... | |
4937 |
5179 |
|
4938 |
5180 |
void QgisApp::mapToolChanged( QgsMapTool *tool )
|
4939 |
5181 |
{
|
4940 |
|
if ( tool && !tool->isEditTool() )
|
|
5182 |
if ( tool )
|
4941 |
5183 |
{
|
4942 |
|
mNonEditMapTool = tool;
|
|
5184 |
if ( !tool->isEditTool() )
|
|
5185 |
{
|
|
5186 |
mNonEditMapTool = tool;
|
|
5187 |
}
|
|
5188 |
mMapTools->currentTool = tool;
|
4943 |
5189 |
}
|
4944 |
5190 |
}
|
4945 |
5191 |
|
... | ... | |
4994 |
5240 |
// coordinates with the aim of always having enough decimal places
|
4995 |
5241 |
// to show the difference in position between adjacent pixels.
|
4996 |
5242 |
// Also avoid taking the log of 0.
|
4997 |
|
if ( mapCanvas()->mapUnitsPerPixel() != 0.0 )
|
4998 |
|
dp = static_cast<int>( ceil( -1.0 * log10( mapCanvas()->mapUnitsPerPixel() ) ) );
|
|
5243 |
if ( mMapCanvas->mapUnitsPerPixel() != 0.0 )
|
|
5244 |
dp = static_cast<int>( ceil( -1.0 * log10( mMapCanvas->mapUnitsPerPixel() ) ) );
|
4999 |
5245 |
}
|
5000 |
5246 |
else
|
5001 |
5247 |
dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" );
|
... | ... | |
5822 |
6068 |
return QPixmap( myDefaultPath );
|
5823 |
6069 |
}
|
5824 |
6070 |
}
|
|
6071 |
|
|
6072 |
QgisApp::Tools::~Tools()
|
|
6073 |
{
|
|
6074 |
delete mZoomIn;
|
|
6075 |
delete mZoomOut;
|
|
6076 |
delete mPan;
|
|
6077 |
delete mIdentify;
|
|
6078 |
delete mMeasureDist;
|
|
6079 |
delete mMeasureArea;
|
|
6080 |
delete mCapturePoint;
|
|
6081 |
delete mCaptureLine;
|
|
6082 |
delete mCapturePolygon;
|
|
6083 |
delete mMoveFeature;
|
|
6084 |
delete mSplitFeatures;
|
|
6085 |
delete mSelect;
|
|
6086 |
delete mVertexAdd;
|
|
6087 |
delete mVertexMove;
|
|
6088 |
delete mVertexDelete;
|
|
6089 |
delete mAddRing;
|
|
6090 |
delete mAddIsland;
|
|
6091 |
}
|