mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
[FEATURE] allow setting CRS for multiple layers at once
git-svn-id: http://svn.osgeo.org/qgis/trunk@15352 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
e332633cd4
commit
f91642fc47
BIN
images/themes/default/mActionHelpAPI.png
Normal file
BIN
images/themes/default/mActionHelpAPI.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -33,7 +33,7 @@
|
|||||||
#include "qgsproject.h"
|
#include "qgsproject.h"
|
||||||
#include "qgsrasterlayer.h"
|
#include "qgsrasterlayer.h"
|
||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
#include "qgsprojectbadlayerguihandler.h"
|
#include "qgsgenericprojectionselector.h"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
@ -525,16 +525,16 @@ void QgsLegend::mouseDoubleClickEvent( QMouseEvent* e )
|
|||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
switch( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() )
|
switch ( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
QgisApp::instance()->layerProperties();
|
QgisApp::instance()->layerProperties();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
QgisApp::instance()->attributeTable();
|
QgisApp::instance()->attributeTable();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +558,6 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
|
|||||||
{
|
{
|
||||||
theMenu.addAction( tr( "&Make to toplevel item" ), this, SLOT( makeToTopLevelItem() ) );
|
theMenu.addAction( tr( "&Make to toplevel item" ), this, SLOT( makeToTopLevelItem() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( li->type() == QgsLegendItem::LEGEND_GROUP )
|
else if ( li->type() == QgsLegendItem::LEGEND_GROUP )
|
||||||
{
|
{
|
||||||
@ -567,6 +566,9 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
|
|||||||
|
|
||||||
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ),
|
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ),
|
||||||
tr( "&Remove" ), this, SLOT( legendGroupRemove() ) );
|
tr( "&Remove" ), this, SLOT( legendGroupRemove() ) );
|
||||||
|
|
||||||
|
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ),
|
||||||
|
tr( "&Set group CRS" ), this, SLOT( legendGroupSetCRS() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( li->type() == QgsLegendItem::LEGEND_LAYER || li->type() == QgsLegendItem::LEGEND_GROUP )
|
if ( li->type() == QgsLegendItem::LEGEND_LAYER || li->type() == QgsLegendItem::LEGEND_GROUP )
|
||||||
@ -739,6 +741,30 @@ void QgsLegend::legendGroupRemove()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsLegend::legendGroupSetCRS()
|
||||||
|
{
|
||||||
|
if ( !mMapCanvas || mMapCanvas->isDrawing() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this );
|
||||||
|
mySelector->setMessage();
|
||||||
|
if ( mySelector->exec() )
|
||||||
|
{
|
||||||
|
QgsCoordinateReferenceSystem crs( mySelector->selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );
|
||||||
|
|
||||||
|
QgsLegendGroup* lg = dynamic_cast<QgsLegendGroup *>( currentItem() );
|
||||||
|
setGroupCRS( lg, crs );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete mySelector;
|
||||||
|
}
|
||||||
|
|
||||||
void QgsLegend::removeGroup( QgsLegendGroup *lg )
|
void QgsLegend::removeGroup( QgsLegendGroup *lg )
|
||||||
{
|
{
|
||||||
if ( !mMapCanvas || mMapCanvas->isDrawing() )
|
if ( !mMapCanvas || mMapCanvas->isDrawing() )
|
||||||
@ -766,6 +792,36 @@ void QgsLegend::removeGroup( QgsLegendGroup *lg )
|
|||||||
adjustIconSize();
|
adjustIconSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsLegend::setGroupCRS( QgsLegendGroup *lg, const QgsCoordinateReferenceSystem &crs )
|
||||||
|
{
|
||||||
|
if ( !mMapCanvas || mMapCanvas->isDrawing() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the legend layers first
|
||||||
|
QTreeWidgetItem * child = lg->child( 0 );
|
||||||
|
while ( child )
|
||||||
|
{
|
||||||
|
QgsLegendLayer *cl = dynamic_cast<QgsLegendLayer *>( child );
|
||||||
|
QgsLegendGroup *cg = dynamic_cast<QgsLegendGroup *>( child );
|
||||||
|
|
||||||
|
if ( cl )
|
||||||
|
{
|
||||||
|
cl->layer()->setCrs( crs );
|
||||||
|
}
|
||||||
|
else if ( cg )
|
||||||
|
{
|
||||||
|
setGroupCRS( cg, crs );
|
||||||
|
}
|
||||||
|
|
||||||
|
child = lg->child( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
delete lg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QgsLegend::moveLayer( QgsMapLayer *ml, int groupIndex )
|
void QgsLegend::moveLayer( QgsMapLayer *ml, int groupIndex )
|
||||||
{
|
{
|
||||||
if ( !ml )
|
if ( !ml )
|
||||||
@ -999,20 +1055,11 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
|
|||||||
{
|
{
|
||||||
bool isOpen;
|
bool isOpen;
|
||||||
QgsLegendLayer* currentLayer = readLayerFromXML( childelem, isOpen );
|
QgsLegendLayer* currentLayer = readLayerFromXML( childelem, isOpen );
|
||||||
|
|
||||||
bool ignorePressed = QgsProjectBadLayerGuiHandler::mIgnore;
|
|
||||||
|
|
||||||
if ( !currentLayer )
|
if ( !currentLayer )
|
||||||
{
|
{
|
||||||
if( ignorePressed == true )
|
continue;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add to tree - either as a top-level node or a child of a group
|
// add to tree - either as a top-level node or a child of a group
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
@ -1920,3 +1967,32 @@ void QgsLegend::removeSelectedLayers()
|
|||||||
if ( renderFlagState )
|
if ( renderFlagState )
|
||||||
mMapCanvas->setRenderFlag( true );
|
mMapCanvas->setRenderFlag( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsLegend::setCRSForSelectedLayers( const QgsCoordinateReferenceSystem &crs )
|
||||||
|
{
|
||||||
|
// Turn off rendering to improve speed.
|
||||||
|
bool renderFlagState = mMapCanvas->renderFlag();
|
||||||
|
if ( renderFlagState )
|
||||||
|
mMapCanvas->setRenderFlag( false );
|
||||||
|
|
||||||
|
foreach( QTreeWidgetItem * item, selectedItems() )
|
||||||
|
{
|
||||||
|
QgsLegendGroup* lg = dynamic_cast<QgsLegendGroup *>( item );
|
||||||
|
if ( lg )
|
||||||
|
{
|
||||||
|
setGroupCRS( lg, crs );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsLegendLayer *ll = dynamic_cast<QgsLegendLayer *>( item );
|
||||||
|
if ( ll && ll->layer() )
|
||||||
|
{
|
||||||
|
ll->layer()->setCrs( crs );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn on rendering (if it was on previously)
|
||||||
|
if ( renderFlagState )
|
||||||
|
mMapCanvas->setRenderFlag( true );
|
||||||
|
}
|
||||||
|
@ -34,6 +34,7 @@ class QDomElement;
|
|||||||
class QDomNode;
|
class QDomNode;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
class QgsCoordinateReferenceSystem;
|
||||||
|
|
||||||
//Information about relationship between groups and layers
|
//Information about relationship between groups and layers
|
||||||
//key: group name (or null strings for single layers without groups)
|
//key: group name (or null strings for single layers without groups)
|
||||||
@ -266,6 +267,9 @@ class QgsLegend : public QTreeWidget
|
|||||||
/** Remove selected layers */
|
/** Remove selected layers */
|
||||||
void removeSelectedLayers();
|
void removeSelectedLayers();
|
||||||
|
|
||||||
|
/** Set CRS for selected layers */
|
||||||
|
void setCRSForSelectedLayers( const QgsCoordinateReferenceSystem &crs );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/*!Event handler for mouse movements.
|
/*!Event handler for mouse movements.
|
||||||
@ -362,8 +366,12 @@ class QgsLegend : public QTreeWidget
|
|||||||
void handleRightClickEvent( QTreeWidgetItem* item, const QPoint& position );
|
void handleRightClickEvent( QTreeWidgetItem* item, const QPoint& position );
|
||||||
/**Removes the current legend group*/
|
/**Removes the current legend group*/
|
||||||
void legendGroupRemove();
|
void legendGroupRemove();
|
||||||
|
/**Set the CRS of the current legend group*/
|
||||||
|
void legendGroupSetCRS();
|
||||||
/**Removes a legend group and its layers*/
|
/**Removes a legend group and its layers*/
|
||||||
void removeGroup( QgsLegendGroup * lg );
|
void removeGroup( QgsLegendGroup * lg );
|
||||||
|
/**Removes a legend group and its layers*/
|
||||||
|
void setGroupCRS( QgsLegendGroup * lg, const QgsCoordinateReferenceSystem &crs );
|
||||||
/**Sets all listview items to open*/
|
/**Sets all listview items to open*/
|
||||||
void expandAll();
|
void expandAll();
|
||||||
/**Sets all listview items to closed*/
|
/**Sets all listview items to closed*/
|
||||||
|
@ -432,6 +432,9 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
|
|||||||
// remove from canvas
|
// remove from canvas
|
||||||
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
|
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
|
||||||
|
|
||||||
|
// remove from canvas
|
||||||
|
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );
|
||||||
|
|
||||||
theMenu.addSeparator();
|
theMenu.addSeparator();
|
||||||
|
|
||||||
if ( lyr->type() == QgsMapLayer::VectorLayer )
|
if ( lyr->type() == QgsMapLayer::VectorLayer )
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
#include "qgspluginmetadata.h"
|
#include "qgspluginmetadata.h"
|
||||||
#include "qgspluginregistry.h"
|
#include "qgspluginregistry.h"
|
||||||
#include "qgspoint.h"
|
#include "qgspoint.h"
|
||||||
#include "qgsprojectbadlayerguihandler.h"
|
#include "qgshandlebadlayers.h"
|
||||||
#include "qgsproject.h"
|
#include "qgsproject.h"
|
||||||
#include "qgsprojectproperties.h"
|
#include "qgsprojectproperties.h"
|
||||||
#include "qgsproviderregistry.h"
|
#include "qgsproviderregistry.h"
|
||||||
@ -506,7 +506,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
|
|||||||
QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );
|
QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );
|
||||||
|
|
||||||
// set handler for missing layers (will be owned by QgsProject)
|
// set handler for missing layers (will be owned by QgsProject)
|
||||||
QgsProject::instance()->setBadLayerHandler( new QgsProjectBadLayerGuiHandler() );
|
QgsProject::instance()->setBadLayerHandler( new QgsHandleBadLayersHandler() );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Set the background color for toolbox and overview as they default to
|
// Set the background color for toolbox and overview as they default to
|
||||||
@ -1125,6 +1125,12 @@ void QgisApp::createActions()
|
|||||||
connect( mActionRemoveLayer, SIGNAL( triggered() ), this, SLOT( removeLayer() ) );
|
connect( mActionRemoveLayer, SIGNAL( triggered() ), this, SLOT( removeLayer() ) );
|
||||||
mActionRemoveLayer->setEnabled( false );
|
mActionRemoveLayer->setEnabled( false );
|
||||||
|
|
||||||
|
mActionSetLayerCRS = new QAction( getThemeIcon( "mActionSetLayerCRS.png" ), tr( "Set CRS of Layer(s)" ), this );
|
||||||
|
shortcuts->registerAction( mActionSetLayerCRS, tr( "Ctrl+Shift+C", "Set CRS of Layer(s)" ) );
|
||||||
|
mActionSetLayerCRS->setStatusTip( tr( "Set CRS of Layer(s)" ) );
|
||||||
|
connect( mActionSetLayerCRS, SIGNAL( triggered() ), this, SLOT( setLayerCRS() ) );
|
||||||
|
mActionSetLayerCRS->setEnabled( false );
|
||||||
|
|
||||||
mActionTileScale = new QAction( getThemeIcon( "mActionTileScale.png" ), tr( "Tile scale slider" ), this );
|
mActionTileScale = new QAction( getThemeIcon( "mActionTileScale.png" ), tr( "Tile scale slider" ), this );
|
||||||
shortcuts->registerAction( mActionTileScale, tr( "", "Tile scale slider" ) );
|
shortcuts->registerAction( mActionTileScale, tr( "", "Tile scale slider" ) );
|
||||||
mActionTileScale->setStatusTip( tr( "Show tile scale slider" ) );
|
mActionTileScale->setStatusTip( tr( "Show tile scale slider" ) );
|
||||||
@ -1249,6 +1255,14 @@ void QgisApp::createActions()
|
|||||||
#endif
|
#endif
|
||||||
mActionHelpContents->setStatusTip( tr( "Help Documentation" ) );
|
mActionHelpContents->setStatusTip( tr( "Help Documentation" ) );
|
||||||
connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
|
connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
|
||||||
|
mActionHelpContents->setEnabled( QFileInfo( QgsApplication::pkgDataPath() + "/doc/index.html" ).exists() );
|
||||||
|
|
||||||
|
#ifdef WITH_APIDOC
|
||||||
|
mActionHelpAPI = new QAction( getThemeIcon( "mActionHelpAPI.png" ), tr( "API documentation" ), this );
|
||||||
|
connect( mActionHelpAPI, SIGNAL( triggered() ), this, SLOT( apiDocumentation() ) );
|
||||||
|
mActionHelpAPI->setEnabled( QFileInfo( QgsApplication::pkgDataPath() + "/doc/api/index.html" ).exists() );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
mActionQgisHomePage = new QAction( getThemeIcon( "mActionQgisHomePage.png" ), tr( "QGIS Home Page" ), this );
|
mActionQgisHomePage = new QAction( getThemeIcon( "mActionQgisHomePage.png" ), tr( "QGIS Home Page" ), this );
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_WS_MAC
|
||||||
@ -1609,6 +1623,7 @@ void QgisApp::createMenus()
|
|||||||
mLayerMenu->addAction( mActionLayerSaveAs );
|
mLayerMenu->addAction( mActionLayerSaveAs );
|
||||||
mLayerMenu->addAction( mActionLayerSelectionSaveAs );
|
mLayerMenu->addAction( mActionLayerSelectionSaveAs );
|
||||||
mLayerMenu->addAction( mActionRemoveLayer );
|
mLayerMenu->addAction( mActionRemoveLayer );
|
||||||
|
mLayerMenu->addAction( mActionSetLayerCRS );
|
||||||
mLayerMenu->addAction( mActionLayerProperties );
|
mLayerMenu->addAction( mActionLayerProperties );
|
||||||
mLayerMenu->addAction( mActionLayerSubsetString );
|
mLayerMenu->addAction( mActionLayerSubsetString );
|
||||||
mActionLayerSeparator2 = mLayerMenu->addSeparator();
|
mActionLayerSeparator2 = mLayerMenu->addSeparator();
|
||||||
@ -1684,6 +1699,9 @@ void QgisApp::createMenus()
|
|||||||
mHelpMenu = menuBar()->addMenu( tr( "&Help" ) );
|
mHelpMenu = menuBar()->addMenu( tr( "&Help" ) );
|
||||||
|
|
||||||
mHelpMenu->addAction( mActionHelpContents );
|
mHelpMenu->addAction( mActionHelpContents );
|
||||||
|
#ifdef WITH_APIDOC
|
||||||
|
mHelpMenu->addAction( mActionHelpAPI );
|
||||||
|
#endif
|
||||||
mActionHelpSeparator1 = mHelpMenu->addSeparator();
|
mActionHelpSeparator1 = mHelpMenu->addSeparator();
|
||||||
|
|
||||||
mHelpMenu->addAction( mActionQgisHomePage );
|
mHelpMenu->addAction( mActionQgisHomePage );
|
||||||
@ -1730,6 +1748,7 @@ void QgisApp::createToolBars()
|
|||||||
mLayerToolBar->addAction( mActionAddWmsLayer );
|
mLayerToolBar->addAction( mActionAddWmsLayer );
|
||||||
mLayerToolBar->addAction( mActionNewVectorLayer );
|
mLayerToolBar->addAction( mActionNewVectorLayer );
|
||||||
mLayerToolBar->addAction( mActionRemoveLayer );
|
mLayerToolBar->addAction( mActionRemoveLayer );
|
||||||
|
mLayerToolBar->addAction( mActionSetLayerCRS );
|
||||||
//commented out for QGIS 1.4 by Tim
|
//commented out for QGIS 1.4 by Tim
|
||||||
//mLayerToolBar->addAction( mActionAddToOverview );
|
//mLayerToolBar->addAction( mActionAddToOverview );
|
||||||
//mLayerToolBar->addAction( mActionShowAllLayers );
|
//mLayerToolBar->addAction( mActionShowAllLayers );
|
||||||
@ -1898,6 +1917,9 @@ void QgisApp::createToolBars()
|
|||||||
mHelpToolBar = addToolBar( tr( "Help" ) );
|
mHelpToolBar = addToolBar( tr( "Help" ) );
|
||||||
mHelpToolBar->setObjectName( "Help" );
|
mHelpToolBar->setObjectName( "Help" );
|
||||||
mHelpToolBar->addAction( mActionHelpContents );
|
mHelpToolBar->addAction( mActionHelpContents );
|
||||||
|
#ifdef WITH_APIDOC
|
||||||
|
mHelpToolBar->addAction( mActionHelpAPI );
|
||||||
|
#endif
|
||||||
mHelpToolBar->addAction( QWhatsThis::createAction() );
|
mHelpToolBar->addAction( QWhatsThis::createAction() );
|
||||||
mToolbarMenu->addAction( mHelpToolBar->toggleViewAction() );
|
mToolbarMenu->addAction( mHelpToolBar->toggleViewAction() );
|
||||||
|
|
||||||
@ -2108,6 +2130,7 @@ void QgisApp::setTheme( QString theThemeName )
|
|||||||
mActionAddPgLayer->setIcon( getThemeIcon( "/mActionAddLayer.png" ) );
|
mActionAddPgLayer->setIcon( getThemeIcon( "/mActionAddLayer.png" ) );
|
||||||
mActionAddSpatiaLiteLayer->setIcon( getThemeIcon( "/mActionAddSpatiaLiteLayer.png" ) );
|
mActionAddSpatiaLiteLayer->setIcon( getThemeIcon( "/mActionAddSpatiaLiteLayer.png" ) );
|
||||||
mActionRemoveLayer->setIcon( getThemeIcon( "/mActionRemoveLayer.png" ) );
|
mActionRemoveLayer->setIcon( getThemeIcon( "/mActionRemoveLayer.png" ) );
|
||||||
|
mActionSetLayerCRS->setIcon( getThemeIcon( "/mActionSetLayerCRS.png" ) );
|
||||||
mActionNewVectorLayer->setIcon( getThemeIcon( "/mActionNewVectorLayer.png" ) );
|
mActionNewVectorLayer->setIcon( getThemeIcon( "/mActionNewVectorLayer.png" ) );
|
||||||
mActionAddAllToOverview->setIcon( getThemeIcon( "/mActionAddAllToOverview.png" ) );
|
mActionAddAllToOverview->setIcon( getThemeIcon( "/mActionAddAllToOverview.png" ) );
|
||||||
mActionHideAllLayers->setIcon( getThemeIcon( "/mActionHideAllLayers.png" ) );
|
mActionHideAllLayers->setIcon( getThemeIcon( "/mActionHideAllLayers.png" ) );
|
||||||
@ -2120,6 +2143,9 @@ void QgisApp::setTheme( QString theThemeName )
|
|||||||
mActionOptions->setIcon( getThemeIcon( "/mActionOptions.png" ) );
|
mActionOptions->setIcon( getThemeIcon( "/mActionOptions.png" ) );
|
||||||
mActionConfigureShortcuts->setIcon( getThemeIcon( "/mActionOptions.png" ) );
|
mActionConfigureShortcuts->setIcon( getThemeIcon( "/mActionOptions.png" ) );
|
||||||
mActionHelpContents->setIcon( getThemeIcon( "/mActionHelpContents.png" ) );
|
mActionHelpContents->setIcon( getThemeIcon( "/mActionHelpContents.png" ) );
|
||||||
|
#ifdef WITH_APIDOC
|
||||||
|
mActionHelpAPI->setIcon( getThemeIcon( "/mActionHelpApi.png" ) );
|
||||||
|
#endif
|
||||||
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
|
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
|
||||||
mActionQgisHomePage->setIcon( getThemeIcon( "/mActionQgisHomePage.png" ) );
|
mActionQgisHomePage->setIcon( getThemeIcon( "/mActionQgisHomePage.png" ) );
|
||||||
mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
|
mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
|
||||||
@ -4107,7 +4133,7 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
destCRS = vlayer->srs();
|
destCRS = vlayer->crs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4812,7 +4838,7 @@ void QgisApp::editCut( QgsMapLayer * layerContainingSelection )
|
|||||||
{
|
{
|
||||||
QgsFeatureList features = selectionVectorLayer->selectedFeatures();
|
QgsFeatureList features = selectionVectorLayer->selectedFeatures();
|
||||||
clipboard()->replaceWithCopyOf( selectionVectorLayer->pendingFields(), features );
|
clipboard()->replaceWithCopyOf( selectionVectorLayer->pendingFields(), features );
|
||||||
clipboard()->setCRS( selectionVectorLayer->srs() );
|
clipboard()->setCRS( selectionVectorLayer->crs() );
|
||||||
selectionVectorLayer->beginEditCommand( tr( "Features cut" ) );
|
selectionVectorLayer->beginEditCommand( tr( "Features cut" ) );
|
||||||
selectionVectorLayer->deleteSelectedFeatures();
|
selectionVectorLayer->deleteSelectedFeatures();
|
||||||
selectionVectorLayer->endEditCommand();
|
selectionVectorLayer->endEditCommand();
|
||||||
@ -4839,7 +4865,7 @@ void QgisApp::editCopy( QgsMapLayer * layerContainingSelection )
|
|||||||
{
|
{
|
||||||
QgsFeatureList features = selectionVectorLayer->selectedFeatures();
|
QgsFeatureList features = selectionVectorLayer->selectedFeatures();
|
||||||
clipboard()->replaceWithCopyOf( selectionVectorLayer->pendingFields(), features );
|
clipboard()->replaceWithCopyOf( selectionVectorLayer->pendingFields(), features );
|
||||||
clipboard()->setCRS( selectionVectorLayer->srs() );
|
clipboard()->setCRS( selectionVectorLayer->crs() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4865,7 +4891,7 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
|
|||||||
QgsFeatureList features;
|
QgsFeatureList features;
|
||||||
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
|
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
|
||||||
{
|
{
|
||||||
features = clipboard()->transformedCopyOf( pasteVectorLayer->srs() );
|
features = clipboard()->transformedCopyOf( pasteVectorLayer->crs() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5233,6 +5259,34 @@ void QgisApp::removeLayer()
|
|||||||
mMapCanvas->refresh();
|
mMapCanvas->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgisApp::setLayerCRS()
|
||||||
|
{
|
||||||
|
if ( mMapCanvas && mMapCanvas->isDrawing() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !mMapLegend )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this );
|
||||||
|
mySelector->setMessage();
|
||||||
|
if ( mySelector->exec() )
|
||||||
|
{
|
||||||
|
QgsCoordinateReferenceSystem crs( mySelector->selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );
|
||||||
|
mMapLegend->setCRSForSelectedLayers( crs );
|
||||||
|
mMapCanvas->refresh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete mySelector;
|
||||||
|
}
|
||||||
|
|
||||||
void QgisApp::showGpsTool()
|
void QgisApp::showGpsTool()
|
||||||
{
|
{
|
||||||
if ( !mpGpsWidget )
|
if ( !mpGpsWidget )
|
||||||
@ -5550,7 +5604,7 @@ void QgisApp::options()
|
|||||||
myRenderer->setProjectionsEnabled( false );
|
myRenderer->setProjectionsEnabled( false );
|
||||||
}
|
}
|
||||||
mMapCanvas->refresh();
|
mMapCanvas->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete optionsDialog;
|
delete optionsDialog;
|
||||||
}
|
}
|
||||||
@ -5602,6 +5656,11 @@ void QgisApp::helpContents()
|
|||||||
openURL( "index.html" );
|
openURL( "index.html" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgisApp::apiDocumentation()
|
||||||
|
{
|
||||||
|
openURL( "api/index.html" );
|
||||||
|
}
|
||||||
|
|
||||||
void QgisApp::helpQgisHomePage()
|
void QgisApp::helpQgisHomePage()
|
||||||
{
|
{
|
||||||
openURL( "http://qgis.org", false );
|
openURL( "http://qgis.org", false );
|
||||||
@ -6283,6 +6342,7 @@ void QgisApp::selectionChanged( QgsMapLayer *layer )
|
|||||||
void QgisApp::legendLayerSelectionChanged( void )
|
void QgisApp::legendLayerSelectionChanged( void )
|
||||||
{
|
{
|
||||||
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
|
mActionRemoveLayer->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
|
||||||
|
mActionSetLayerCRS->setEnabled( mMapLegend && mMapLegend->selectedLayers().size() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
|
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
|
||||||
|
@ -287,6 +287,7 @@ class QgisApp : public QMainWindow
|
|||||||
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
|
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
|
||||||
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
|
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
|
||||||
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
|
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
|
||||||
|
QAction *actionSetLayerCRS() { return mActionSetLayerCRS; }
|
||||||
QAction *actionTileScale() { return mActionTileScale; }
|
QAction *actionTileScale() { return mActionTileScale; }
|
||||||
QAction *actionGpsTool() { return mActionGpsTool; }
|
QAction *actionGpsTool() { return mActionGpsTool; }
|
||||||
QAction *actionLayerProperties() { return mActionLayerProperties; }
|
QAction *actionLayerProperties() { return mActionLayerProperties; }
|
||||||
@ -321,6 +322,7 @@ class QgisApp : public QMainWindow
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QAction *actionHelpContents() { return mActionHelpContents; }
|
QAction *actionHelpContents() { return mActionHelpContents; }
|
||||||
|
QAction *actionHelpAPI() { return mActionHelpAPI; }
|
||||||
QAction *actionHelpSeparator1() { return mActionHelpSeparator1; }
|
QAction *actionHelpSeparator1() { return mActionHelpSeparator1; }
|
||||||
QAction *actionQgisHomePage() { return mActionQgisHomePage; }
|
QAction *actionQgisHomePage() { return mActionQgisHomePage; }
|
||||||
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
|
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
|
||||||
@ -496,6 +498,8 @@ class QgisApp : public QMainWindow
|
|||||||
void userCenter();
|
void userCenter();
|
||||||
//! Remove a layer from the map and legend
|
//! Remove a layer from the map and legend
|
||||||
void removeLayer();
|
void removeLayer();
|
||||||
|
//! Set CRS of a layer
|
||||||
|
void setLayerCRS();
|
||||||
//! Show GPS tool
|
//! Show GPS tool
|
||||||
void showGpsTool();
|
void showGpsTool();
|
||||||
//! Show tile scale slider
|
//! Show tile scale slider
|
||||||
@ -577,6 +581,8 @@ class QgisApp : public QMainWindow
|
|||||||
bool setActiveLayer( QgsMapLayer * );
|
bool setActiveLayer( QgsMapLayer * );
|
||||||
//! Open the help contents in a browser
|
//! Open the help contents in a browser
|
||||||
void helpContents();
|
void helpContents();
|
||||||
|
//! Open the API documentation in a browser
|
||||||
|
void apiDocumentation();
|
||||||
//! Open the QGIS homepage in users browser
|
//! Open the QGIS homepage in users browser
|
||||||
void helpQgisHomePage();
|
void helpQgisHomePage();
|
||||||
//! Open a url in the users configured browser
|
//! Open a url in the users configured browser
|
||||||
@ -980,6 +986,7 @@ class QgisApp : public QMainWindow
|
|||||||
QAction *mActionLayerSaveAs;
|
QAction *mActionLayerSaveAs;
|
||||||
QAction *mActionLayerSelectionSaveAs;
|
QAction *mActionLayerSelectionSaveAs;
|
||||||
QAction *mActionRemoveLayer;
|
QAction *mActionRemoveLayer;
|
||||||
|
QAction *mActionSetLayerCRS;
|
||||||
QAction *mActionTileScale;
|
QAction *mActionTileScale;
|
||||||
QAction *mActionGpsTool;
|
QAction *mActionGpsTool;
|
||||||
QAction *mActionLayerProperties;
|
QAction *mActionLayerProperties;
|
||||||
@ -1013,6 +1020,7 @@ class QgisApp : public QMainWindow
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QAction *mActionHelpContents;
|
QAction *mActionHelpContents;
|
||||||
|
QAction *mActionHelpAPI;
|
||||||
QAction *mActionHelpSeparator1;
|
QAction *mActionHelpSeparator1;
|
||||||
QAction *mActionQgisHomePage;
|
QAction *mActionQgisHomePage;
|
||||||
QAction *mActionCheckQgisVersion;
|
QAction *mActionCheckQgisVersion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user