mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
Remove support for disabling OTF reprojection
Because - OTF reprojection is mature and stable - Should be no cost when not required - transforms are shortcut when not required - Reduces code complexity - Canvas OTF support was being incorrectly used as a flag for whether measurements should be made in ellipsoidal mode. Instead the project's ellipsoid setting should be checked for this. - Should simplify behavior for new users
This commit is contained in:
parent
809d30ffbf
commit
20c07a58e6
@ -1257,6 +1257,12 @@ QgsLayerTreeNode {#qgis_api_break_3_0_QgsLayerTreeNode}
|
||||
- readXml() does not resolve layers from the layer IDs anymore. Call resolveReferences() or use readXml() override with QgsProject as the second argument.
|
||||
|
||||
|
||||
QgsLayerTreeMapCanvasBridge {#qgis_api_break_3_0_QgsLayerTreeMapCanvasBridge}
|
||||
-----------------
|
||||
|
||||
- setAutoEnableCrsTransform() and autoEnableCrsTransform() were removed. CRS transformation is now always enabled.
|
||||
|
||||
|
||||
QgsLayerTreeModel {#qgis_api_break_3_0_QgsLayerTreeMode}
|
||||
-----------------
|
||||
|
||||
@ -1315,6 +1321,7 @@ QgsMapCanvas {#qgis_api_break_3_0_QgsMapCanvas}
|
||||
- setProgress() signal has been removed. It was not emitted since 2.0.
|
||||
- enableOverviewMode() and updateOverview() have been removed. Map canvas does not keep pointer to overview canvas anymore. Use QgsLayerTreeMapCanvasBridge::setOverviewCanvas() to set up updates of overview canvas together with main canvas.
|
||||
- the duplicate mapToolSet signal with a single QgsMapTool argument has been removed. Use the signal with arguments for new and old map tool instead.
|
||||
- setCrsTransformEnabled(), hasCrsTransformEnabled(), hasCrsTransformEnabledChanged() were removed. CRS transformation is now always enabled.
|
||||
|
||||
QgsMapCanvasItem {#qgis_api_break_3_0_QgsMapCanvasItem}
|
||||
----------------
|
||||
@ -1354,6 +1361,7 @@ QgsMapOverviewCanvas {#qgis_api_break_3_0_QgsMapOverviewCanvas}
|
||||
|
||||
- layerSet() and setLayerSet() have been replaced by layers() and setLayers() which work with list of layers instead of layer IDs
|
||||
- destinationSrsChanged() was renamed to destinationCrsChanged()
|
||||
- hasCrsTransformEnabled() was removed. CRS transformation is now always enabled.
|
||||
|
||||
|
||||
QgsMapRenderer {#qgis_api_break_3_0_QgsMapRenderer}
|
||||
@ -1421,6 +1429,7 @@ QgsMapSettings {#qgis_api_break_3_0_QgsMapSettings}
|
||||
be returned instead of a null pointer if no transformation is required.
|
||||
- destinationCrs() now returns a copy instead of a reference to the CRS. This has no effect on PyQGIS code, but c++
|
||||
plugins calling this method will need to be updated.
|
||||
- setCrsTransformEnabled() and hasCrsTransformEnabled() were removed. CRS transformation is now always enabled.
|
||||
|
||||
|
||||
QgsMarkerSymbolLayer {#qgis_api_break_3_0_QgsMarkerSymbolLayer}
|
||||
@ -1896,6 +1905,12 @@ QgsTolerance {#qgis_api_break_3_0_QgsTolerance}
|
||||
- The MapUnits UnitType was removed. Use LayerUnits or ProjectUnits instead.
|
||||
|
||||
|
||||
QgsTracer {#qgis_api_break_3_0_QgsTracer}
|
||||
---------
|
||||
|
||||
- hasCrsTransformEnabled() and setCrsTransformEnabled() were removed. CRS transformation is now always enabled when required.
|
||||
|
||||
|
||||
QgsTreeWidgetItem {#qgis_api_break_3_0_QgsTreeWidgetItem}
|
||||
-----------------
|
||||
|
||||
|
@ -83,11 +83,6 @@ class QgsMapSettings
|
||||
*/
|
||||
void setCustomRenderFlags( const QString& customRenderFlags );
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
//! returns true if projections are enabled for this layer set
|
||||
bool hasCrsTransformEnabled() const;
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
//! returns CRS of destination coordinate reference system
|
||||
|
@ -20,11 +20,6 @@ class QgsTracer : QObject
|
||||
//! Set layers used for tracing
|
||||
void setLayers( const QList<QgsVectorLayer*>& layers );
|
||||
|
||||
//! Return true if reprojection to destination CRS is enabled
|
||||
bool hasCrsTransformEnabled() const;
|
||||
//! Set whether to do reprojection to destination CRS
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
|
||||
//! Get CRS used for tracing
|
||||
QgsCoordinateReferenceSystem destinationCrs() const;
|
||||
//! Set CRS used for tracing
|
||||
|
@ -45,11 +45,6 @@ class QgsLayerTreeMapCanvasBridge : QObject
|
||||
void setAutoSetupOnFirstLayer( bool enabled );
|
||||
bool autoSetupOnFirstLayer() const;
|
||||
|
||||
//! if enabled, will automatically turn on on-the-fly reprojection of layers if a layer
|
||||
//! with different source CRS is added
|
||||
void setAutoEnableCrsTransform( bool enabled );
|
||||
bool autoEnableCrsTransform() const;
|
||||
|
||||
public slots:
|
||||
void setHasCustomLayerOrder( bool state );
|
||||
void setCustomLayerOrder( const QStringList& order );
|
||||
|
@ -36,10 +36,6 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! @note added in 2.4
|
||||
const QgsMapSettings& mapSettings() const /KeepReference/;
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
//! @note added in 2.4
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
//! @note added in 2.4
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
@ -360,9 +356,6 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! State of render suppression flag
|
||||
bool renderFlag();
|
||||
|
||||
//! A simple helper method to find out if on the fly projections are enabled or not
|
||||
bool hasCrsTransformEnabled();
|
||||
|
||||
//! stop rendering (if there is any right now)
|
||||
//! @note added in 2.4
|
||||
void stopRendering();
|
||||
@ -454,10 +447,6 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! Emitted when zoom next status changed
|
||||
void zoomNextStatusChanged( bool );
|
||||
|
||||
//! Emitted when on-the-fly projection has been turned on/off
|
||||
//! @note added in 2.4
|
||||
void hasCrsTransformEnabledChanged( bool flag );
|
||||
|
||||
//! Emitted when map CRS has changed
|
||||
//! @note added in 2.4
|
||||
void destinationCrsChanged();
|
||||
|
@ -32,9 +32,6 @@ class QgsMapOverviewCanvas : QWidget
|
||||
//! used for overview canvas to reflect changed extent in main map canvas
|
||||
void drawExtentRect();
|
||||
|
||||
// ### QGIS 3: rename so it does not look like getter, make protected
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
|
||||
// ### QGIS 3: make protected
|
||||
//! Should be called when the canvas destination CRS is changed
|
||||
void destinationCrsChanged();
|
||||
|
@ -100,8 +100,7 @@ class FieldsCalculator(GeoAlgorithm):
|
||||
|
||||
da = QgsDistanceArea()
|
||||
da.setSourceCrs(layer.crs())
|
||||
da.setEllipsoidalMode(
|
||||
iface.mapCanvas().mapSettings().hasCrsTransformEnabled())
|
||||
da.setEllipsoidalMode(True)
|
||||
da.setEllipsoid(QgsProject.instance().readEntry(
|
||||
'Measure', '/Ellipsoid', GEO_NONE)[0])
|
||||
exp.setGeomCalculator(da)
|
||||
|
@ -104,8 +104,7 @@ class FieldsMapper(GeoAlgorithm):
|
||||
|
||||
da = QgsDistanceArea()
|
||||
da.setSourceCrs(layer.crs())
|
||||
da.setEllipsoidalMode(
|
||||
iface.mapCanvas().mapSettings().hasCrsTransformEnabled())
|
||||
da.setEllipsoidalMode(True)
|
||||
da.setEllipsoid(QgsProject.instance().readEntry(
|
||||
'Measure', '/Ellipsoid', GEO_NONE)[0])
|
||||
|
||||
|
@ -209,7 +209,7 @@ class ServiceAreaFromLayer(GeoAlgorithm):
|
||||
|
||||
director.addStrategy(strategy)
|
||||
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
|
||||
iface.mapCanvas().hasCrsTransformEnabled(),
|
||||
True,
|
||||
tolerance)
|
||||
|
||||
feedback.pushInfo(self.tr('Loading start points...'))
|
||||
|
@ -192,7 +192,7 @@ class ServiceAreaFromPoint(GeoAlgorithm):
|
||||
|
||||
director.addStrategy(strategy)
|
||||
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
|
||||
iface.mapCanvas().hasCrsTransformEnabled(),
|
||||
True,
|
||||
tolerance)
|
||||
feedback.pushInfo(self.tr('Building graph...'))
|
||||
snappedPoints = director.makeGraph(builder, [startPoint])
|
||||
|
@ -203,7 +203,7 @@ class ShortestPathLayerToPoint(GeoAlgorithm):
|
||||
|
||||
director.addStrategy(strategy)
|
||||
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
|
||||
iface.mapCanvas().hasCrsTransformEnabled(),
|
||||
True,
|
||||
tolerance)
|
||||
|
||||
feedback.pushInfo(self.tr('Loading start points...'))
|
||||
|
@ -203,7 +203,7 @@ class ShortestPathPointToLayer(GeoAlgorithm):
|
||||
|
||||
director.addStrategy(strategy)
|
||||
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
|
||||
iface.mapCanvas().hasCrsTransformEnabled(),
|
||||
True,
|
||||
tolerance)
|
||||
|
||||
feedback.pushInfo(self.tr('Loading end points...'))
|
||||
|
@ -204,7 +204,7 @@ class ShortestPathPointToPoint(GeoAlgorithm):
|
||||
|
||||
director.addStrategy(strategy)
|
||||
builder = QgsGraphBuilder(iface.mapCanvas().mapSettings().destinationCrs(),
|
||||
iface.mapCanvas().hasCrsTransformEnabled(),
|
||||
True,
|
||||
tolerance)
|
||||
feedback.pushInfo(self.tr('Building graph...'))
|
||||
snappedPoints = director.makeGraph(builder, [startPoint, endPoint])
|
||||
|
@ -101,17 +101,14 @@ void QgsOSMDownloadDialog::onExtentCanvas()
|
||||
{
|
||||
QgsRectangle r( QgisApp::instance()->mapCanvas()->extent() );
|
||||
|
||||
if ( QgisApp::instance()->mapCanvas()->hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsCoordinateReferenceSystem dst = QgsCoordinateReferenceSystem::fromSrsId( GEOCRS_ID );
|
||||
QgsCoordinateReferenceSystem dst = QgsCoordinateReferenceSystem::fromSrsId( GEOCRS_ID );
|
||||
|
||||
QgsCoordinateTransform ct( QgisApp::instance()->mapCanvas()->mapSettings().destinationCrs(), dst );
|
||||
r = ct.transformBoundingBox( r );
|
||||
if ( !r.isFinite() )
|
||||
{
|
||||
QMessageBox::information( this, tr( "OpenStreetMap download" ), tr( "Could not transform canvas extent." ) );
|
||||
return;
|
||||
}
|
||||
QgsCoordinateTransform ct( QgisApp::instance()->mapCanvas()->mapSettings().destinationCrs(), dst );
|
||||
r = ct.transformBoundingBox( r );
|
||||
if ( !r.isFinite() )
|
||||
{
|
||||
QMessageBox::information( this, tr( "OpenStreetMap download" ), tr( "Could not transform canvas extent." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
setRect( r );
|
||||
|
@ -2810,8 +2810,6 @@ void QgisApp::setupConnections()
|
||||
this, &QgisApp::mapCanvas_keyPressed );
|
||||
|
||||
// connect renderer
|
||||
connect( mMapCanvas, &QgsMapCanvas::hasCrsTransformEnabledChanged,
|
||||
this, &QgisApp::hasCrsTransformEnabled );
|
||||
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged,
|
||||
this, &QgisApp::destinationCrsChanged );
|
||||
|
||||
@ -3202,9 +3200,6 @@ void QgisApp::initLayerTreeView()
|
||||
connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument& ) ), mLayerTreeCanvasBridge, SLOT( writeProject( QDomDocument& ) ) );
|
||||
connect( QgsProject::instance(), SIGNAL( readProject( QDomDocument ) ), mLayerTreeCanvasBridge, SLOT( readProject( QDomDocument ) ) );
|
||||
|
||||
bool otfTransformAutoEnable = QSettings().value( QStringLiteral( "/Projections/otfTransformAutoEnable" ), true ).toBool();
|
||||
mLayerTreeCanvasBridge->setAutoEnableCrsTransform( otfTransformAutoEnable );
|
||||
|
||||
mMapLayerOrder = new QgsCustomLayerOrderWidget( mLayerTreeCanvasBridge, this );
|
||||
mMapLayerOrder->setObjectName( QStringLiteral( "theMapLayerOrder" ) );
|
||||
|
||||
@ -4607,9 +4602,6 @@ void QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
|
||||
mMapCanvas->setMapUnits( srs.mapUnits() );
|
||||
}
|
||||
|
||||
// enable OTF CRS transformation if necessary
|
||||
mMapCanvas->setCrsTransformEnabled( settings.value( QStringLiteral( "/Projections/otfTransformEnabled" ), 0 ).toBool() );
|
||||
|
||||
updateCrsStatusBar();
|
||||
|
||||
/** New Empty Project Created
|
||||
@ -5357,11 +5349,6 @@ void QgisApp::openProject( QAction *action )
|
||||
QString debugme = action->data().toString();
|
||||
if ( saveDirty() )
|
||||
addProject( debugme );
|
||||
|
||||
//set the projections enabled icon in the status bar
|
||||
int myProjectionEnabledFlag =
|
||||
QgsProject::instance()->readNumEntry( QStringLiteral( "SpatialRefSys" ), QStringLiteral( "/ProjectionsEnabled" ), 0 );
|
||||
mMapCanvas->setCrsTransformEnabled( myProjectionEnabledFlag );
|
||||
}
|
||||
|
||||
void QgisApp::runScript( const QString &filePath )
|
||||
@ -7582,15 +7569,7 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
|
||||
return;
|
||||
|
||||
pasteVectorLayer->beginEditCommand( tr( "Features pasted" ) );
|
||||
QgsFeatureList features;
|
||||
if ( mMapCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
{
|
||||
features = clipboard()->transformedCopyOf( pasteVectorLayer->crs(), pasteVectorLayer->fields() );
|
||||
}
|
||||
else
|
||||
{
|
||||
features = clipboard()->copyOf( pasteVectorLayer->fields() );
|
||||
}
|
||||
QgsFeatureList features = clipboard()->transformedCopyOf( pasteVectorLayer->crs(), pasteVectorLayer->fields() );
|
||||
int nTotalFeatures = features.count();
|
||||
|
||||
QHash<int, int> remap;
|
||||
@ -8822,23 +8801,17 @@ void QgisApp::legendLayerZoomNative()
|
||||
QgsDebugMsg( "Raster units per pixel : " + QString::number( layer->rasterUnitsPerPixelX() ) );
|
||||
QgsDebugMsg( "MapUnitsPerPixel before : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );
|
||||
|
||||
if ( mMapCanvas->hasCrsTransformEnabled() )
|
||||
{
|
||||
// get length of central canvas pixel width in source raster crs
|
||||
QgsRectangle e = mMapCanvas->extent();
|
||||
QSize s = mMapCanvas->mapSettings().outputSize();
|
||||
QgsPoint p1( e.center().x(), e.center().y() );
|
||||
QgsPoint p2( e.center().x() + e.width() / s.width(), e.center().y() + e.height() / s.height() );
|
||||
QgsCoordinateTransform ct( mMapCanvas->mapSettings().destinationCrs(), layer->crs() );
|
||||
p1 = ct.transform( p1 );
|
||||
p2 = ct.transform( p2 );
|
||||
double width = sqrt( p1.sqrDist( p2 ) ); // width (actually the diagonal) of reprojected pixel
|
||||
mMapCanvas->zoomByFactor( sqrt( layer->rasterUnitsPerPixelX() * layer->rasterUnitsPerPixelX() + layer->rasterUnitsPerPixelY() * layer->rasterUnitsPerPixelY() ) / width );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixelX() / mMapCanvas->mapUnitsPerPixel() ) );
|
||||
}
|
||||
// get length of central canvas pixel width in source raster crs
|
||||
QgsRectangle e = mMapCanvas->extent();
|
||||
QSize s = mMapCanvas->mapSettings().outputSize();
|
||||
QgsPoint p1( e.center().x(), e.center().y() );
|
||||
QgsPoint p2( e.center().x() + e.width() / s.width(), e.center().y() + e.height() / s.height() );
|
||||
QgsCoordinateTransform ct( mMapCanvas->mapSettings().destinationCrs(), layer->crs() );
|
||||
p1 = ct.transform( p1 );
|
||||
p2 = ct.transform( p2 );
|
||||
double width = sqrt( p1.sqrDist( p2 ) ); // width (actually the diagonal) of reprojected pixel
|
||||
mMapCanvas->zoomByFactor( sqrt( layer->rasterUnitsPerPixelX() * layer->rasterUnitsPerPixelX() + layer->rasterUnitsPerPixelY() * layer->rasterUnitsPerPixelY() ) / width );
|
||||
|
||||
mMapCanvas->refresh();
|
||||
QgsDebugMsg( "MapUnitsPerPixel after : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) );
|
||||
}
|
||||
@ -9189,9 +9162,6 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString& currentPage )
|
||||
qobject_cast<QgsMeasureTool*>( mMapTools.mMeasureArea )->updateSettings();
|
||||
qobject_cast<QgsMapToolMeasureAngle*>( mMapTools.mMeasureAngle )->updateSettings();
|
||||
|
||||
bool otfTransformAutoEnable = mySettings.value( QStringLiteral( "/Projections/otfTransformAutoEnable" ), true ).toBool();
|
||||
mLayerTreeCanvasBridge->setAutoEnableCrsTransform( otfTransformAutoEnable );
|
||||
|
||||
mMapCanvas->setSegmentationTolerance( mySettings.value( QStringLiteral( "/qgis/segmentationTolerance" ), "0.01745" ).toDouble() );
|
||||
mMapCanvas->setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType( mySettings.value( QStringLiteral( "/qgis/segmentationToleranceType" ), "0" ).toInt() ) );
|
||||
|
||||
@ -10311,19 +10281,9 @@ void QgisApp::updateCrsStatusBar()
|
||||
{
|
||||
mOnTheFlyProjectionStatusButton->setText( mMapCanvas->mapSettings().destinationCrs().authid() );
|
||||
|
||||
if ( mMapCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
{
|
||||
mOnTheFlyProjectionStatusButton->setToolTip(
|
||||
tr( "Current CRS: %1 (OTF enabled)" ).arg( mMapCanvas->mapSettings().destinationCrs().description() ) );
|
||||
mOnTheFlyProjectionStatusButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconProjectionEnabled.svg" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mOnTheFlyProjectionStatusButton->setText( tr( "%1 (OTF off)" ).arg( mOnTheFlyProjectionStatusButton->text() ) );
|
||||
mOnTheFlyProjectionStatusButton->setToolTip(
|
||||
tr( "Current CRS: %1 (OTF disabled)" ).arg( mMapCanvas->mapSettings().destinationCrs().description() ) );
|
||||
mOnTheFlyProjectionStatusButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconProjectionDisabled.svg" ) ) );
|
||||
}
|
||||
mOnTheFlyProjectionStatusButton->setToolTip(
|
||||
tr( "Current CRS: %1" ).arg( mMapCanvas->mapSettings().destinationCrs().description() ) );
|
||||
mOnTheFlyProjectionStatusButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconProjectionEnabled.svg" ) ) );
|
||||
}
|
||||
|
||||
void QgisApp::destinationCrsChanged()
|
||||
@ -10331,13 +10291,6 @@ void QgisApp::destinationCrsChanged()
|
||||
updateCrsStatusBar();
|
||||
}
|
||||
|
||||
void QgisApp::hasCrsTransformEnabled( bool flag )
|
||||
{
|
||||
// save this information to project
|
||||
QgsProject::instance()->writeEntry( QStringLiteral( "SpatialRefSys" ), QStringLiteral( "/ProjectionsEnabled" ), ( flag ? 1 : 0 ) );
|
||||
updateCrsStatusBar();
|
||||
}
|
||||
|
||||
// slot to update the progress bar in the status bar
|
||||
void QgisApp::showProgress( int progress, int totalSteps )
|
||||
{
|
||||
@ -11605,16 +11558,11 @@ void QgisApp::readProject( const QDomDocument &doc )
|
||||
projectChanged( doc );
|
||||
|
||||
// force update of canvas, without automatic changes to extent and OTF projections
|
||||
bool autoEnableCrsTransform = mLayerTreeCanvasBridge->autoEnableCrsTransform();
|
||||
bool autoSetupOnFirstLayer = mLayerTreeCanvasBridge->autoSetupOnFirstLayer();
|
||||
mLayerTreeCanvasBridge->setAutoEnableCrsTransform( false );
|
||||
mLayerTreeCanvasBridge->setAutoSetupOnFirstLayer( false );
|
||||
|
||||
mLayerTreeCanvasBridge->setCanvasLayers();
|
||||
|
||||
if ( autoEnableCrsTransform )
|
||||
mLayerTreeCanvasBridge->setAutoEnableCrsTransform( true );
|
||||
|
||||
if ( autoSetupOnFirstLayer )
|
||||
mLayerTreeCanvasBridge->setAutoSetupOnFirstLayer( true );
|
||||
}
|
||||
|
@ -1194,7 +1194,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
void displayMessage( const QString& title, const QString& message, QgsMessageBar::MessageLevel level );
|
||||
void removeMapToolMessage();
|
||||
void updateMouseCoordinatePrecision();
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
void destinationCrsChanged();
|
||||
// void debugHook();
|
||||
//! Add a Layer Definition file
|
||||
|
@ -105,10 +105,7 @@ void QgsMapToolLabel::createRubberBands()
|
||||
if ( mCanvas )
|
||||
{
|
||||
const QgsMapSettings& s = mCanvas->mapSettings();
|
||||
if ( s.hasCrsTransformEnabled() )
|
||||
{
|
||||
fixPoint = s.mapToLayerCoordinates( vlayer, fixPoint );
|
||||
}
|
||||
fixPoint = s.mapToLayerCoordinates( vlayer, fixPoint );
|
||||
}
|
||||
|
||||
QgsGeometry pointGeom = QgsGeometry::fromPoint( fixPoint );
|
||||
|
@ -124,12 +124,9 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
//transform to map crs first, because xdiff,ydiff are in map coordinates
|
||||
const QgsMapSettings& ms = mCanvas->mapSettings();
|
||||
if ( ms.hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsPoint transformedPoint = ms.layerToMapCoordinates( vlayer, QgsPoint( xPosOrig, yPosOrig ) );
|
||||
xPosOrig = transformedPoint.x();
|
||||
yPosOrig = transformedPoint.y();
|
||||
}
|
||||
QgsPoint transformedPoint = ms.layerToMapCoordinates( vlayer, QgsPoint( xPosOrig, yPosOrig ) );
|
||||
xPosOrig = transformedPoint.x();
|
||||
yPosOrig = transformedPoint.y();
|
||||
xPosNew = xPosOrig + xdiff;
|
||||
yPosNew = yPosOrig + ydiff;
|
||||
}
|
||||
@ -138,12 +135,9 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
if ( mCanvas )
|
||||
{
|
||||
const QgsMapSettings& s = mCanvas->mapSettings();
|
||||
if ( s.hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsPoint transformedPoint = s.mapToLayerCoordinates( vlayer, QgsPoint( xPosNew, yPosNew ) );
|
||||
xPosNew = transformedPoint.x();
|
||||
yPosNew = transformedPoint.y();
|
||||
}
|
||||
QgsPoint transformedPoint = s.mapToLayerCoordinates( vlayer, QgsPoint( xPosNew, yPosNew ) );
|
||||
xPosNew = transformedPoint.x();
|
||||
yPosNew = transformedPoint.y();
|
||||
}
|
||||
|
||||
vlayer->beginEditCommand( tr( "Moved label" ) + QStringLiteral( " '%1'" ).arg( currentLabelText( 24 ) ) );
|
||||
|
@ -362,13 +362,10 @@ bool QgsMapToolPinLabels::pinUnpinCurrentLabel( bool pin )
|
||||
double labelY = referencePoint.y();
|
||||
double labelR = labelpos.rotation * 180 / M_PI;
|
||||
|
||||
// transform back to layer crs, if on-fly on
|
||||
if ( mCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint );
|
||||
labelX = transformedPoint.x();
|
||||
labelY = transformedPoint.y();
|
||||
}
|
||||
// transform back to layer crs
|
||||
QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint );
|
||||
labelX = transformedPoint.x();
|
||||
labelY = transformedPoint.y();
|
||||
|
||||
vlayer->beginEditCommand( tr( "Pinned label" ) + QStringLiteral( " '%1'" ).arg( labelText ) );
|
||||
writeFailed = !vlayer->changeAttributeValue( fid, xCol, labelX );
|
||||
@ -456,13 +453,10 @@ bool QgsMapToolPinLabels::pinUnpinCurrentDiagram( bool pin )
|
||||
double labelX = referencePoint.x();
|
||||
double labelY = referencePoint.y();
|
||||
|
||||
// transform back to layer crs, if on-fly on
|
||||
if ( mCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint );
|
||||
labelX = transformedPoint.x();
|
||||
labelY = transformedPoint.y();
|
||||
}
|
||||
// transform back to layer crs
|
||||
QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint );
|
||||
labelX = transformedPoint.x();
|
||||
labelY = transformedPoint.y();
|
||||
|
||||
vlayer->beginEditCommand( tr( "Pinned diagram" ) + QStringLiteral( " '%1'" ).arg( labelText ) );
|
||||
writeFailed = !vlayer->changeAttributeValue( fid, xCol, labelX );
|
||||
|
@ -174,56 +174,53 @@ QgsFeatureIds QgsMapToolSelectUtils::getMatchingFeatures( QgsMapCanvas* canvas,
|
||||
// and then click somewhere off the globe, an exception will be thrown.
|
||||
QgsGeometry selectGeomTrans = selectGeometry;
|
||||
|
||||
if ( canvas->mapSettings().hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct( canvas->mapSettings().destinationCrs(), vlayer->crs() );
|
||||
QgsCoordinateTransform ct( canvas->mapSettings().destinationCrs(), vlayer->crs() );
|
||||
|
||||
if ( !ct.isShortCircuited() && selectGeomTrans.type() == QgsWkbTypes::PolygonGeometry )
|
||||
if ( !ct.isShortCircuited() && selectGeomTrans.type() == QgsWkbTypes::PolygonGeometry )
|
||||
{
|
||||
// convert add more points to the edges of the rectangle
|
||||
// improve transformation result
|
||||
QgsPolygon poly( selectGeomTrans.asPolygon() );
|
||||
if ( poly.size() == 1 && poly.at( 0 ).size() == 5 )
|
||||
{
|
||||
// convert add more points to the edges of the rectangle
|
||||
// improve transformation result
|
||||
QgsPolygon poly( selectGeomTrans.asPolygon() );
|
||||
if ( poly.size() == 1 && poly.at( 0 ).size() == 5 )
|
||||
const QgsPolyline &ringIn = poly.at( 0 );
|
||||
|
||||
QgsPolygon newpoly( 1 );
|
||||
newpoly[0].resize( 41 );
|
||||
QgsPolyline &ringOut = newpoly[0];
|
||||
|
||||
ringOut[ 0 ] = ringIn.at( 0 );
|
||||
|
||||
int i = 1;
|
||||
for ( int j = 1; j < 5; j++ )
|
||||
{
|
||||
const QgsPolyline &ringIn = poly.at( 0 );
|
||||
|
||||
QgsPolygon newpoly( 1 );
|
||||
newpoly[0].resize( 41 );
|
||||
QgsPolyline &ringOut = newpoly[0];
|
||||
|
||||
ringOut[ 0 ] = ringIn.at( 0 );
|
||||
|
||||
int i = 1;
|
||||
for ( int j = 1; j < 5; j++ )
|
||||
QgsVector v(( ringIn.at( j ) - ringIn.at( j - 1 ) ) / 10.0 );
|
||||
for ( int k = 0; k < 9; k++ )
|
||||
{
|
||||
QgsVector v(( ringIn.at( j ) - ringIn.at( j - 1 ) ) / 10.0 );
|
||||
for ( int k = 0; k < 9; k++ )
|
||||
{
|
||||
ringOut[ i ] = ringOut[ i - 1 ] + v;
|
||||
i++;
|
||||
}
|
||||
ringOut[ i++ ] = ringIn.at( j );
|
||||
ringOut[ i ] = ringOut[ i - 1 ] + v;
|
||||
i++;
|
||||
}
|
||||
selectGeomTrans = QgsGeometry::fromPolygon( newpoly );
|
||||
ringOut[ i++ ] = ringIn.at( j );
|
||||
}
|
||||
selectGeomTrans = QgsGeometry::fromPolygon( newpoly );
|
||||
}
|
||||
}
|
||||
|
||||
selectGeomTrans.transform( ct );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
// catch exception for 'invalid' point and leave existing selection unchanged
|
||||
QgsDebugMsg( "Caught CRS exception " );
|
||||
QgisApp::instance()->messageBar()->pushMessage(
|
||||
QObject::tr( "CRS Exception" ),
|
||||
QObject::tr( "Selection extends beyond layer's coordinate system" ),
|
||||
QgsMessageBar::WARNING,
|
||||
QgisApp::instance()->messageTimeout() );
|
||||
return newSelectedFeatures;
|
||||
}
|
||||
selectGeomTrans.transform( ct );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
// catch exception for 'invalid' point and leave existing selection unchanged
|
||||
QgsDebugMsg( "Caught CRS exception " );
|
||||
QgisApp::instance()->messageBar()->pushMessage(
|
||||
QObject::tr( "CRS Exception" ),
|
||||
QObject::tr( "Selection extends beyond layer's coordinate system" ),
|
||||
QgsMessageBar::WARNING,
|
||||
QgisApp::instance()->messageTimeout() );
|
||||
return newSelectedFeatures;
|
||||
}
|
||||
|
||||
QgsDebugMsgLevel( "Selection layer: " + vlayer->name(), 3 );
|
||||
|
@ -202,21 +202,18 @@ bool QgsMapToolShowHideLabels::selectedFeatures( QgsVectorLayer* vlayer,
|
||||
// and then click somewhere off the globe, an exception will be thrown.
|
||||
QgsGeometry selectGeomTrans( selectGeometry );
|
||||
|
||||
if ( mCanvas->hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct( mCanvas->mapSettings().destinationCrs(), vlayer->crs() );
|
||||
selectGeomTrans.transform( ct );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
// catch exception for 'invalid' point and leave existing selection unchanged
|
||||
QgsLogger::warning( "Caught CRS exception " + QStringLiteral( __FILE__ ) + ": " + QString::number( __LINE__ ) );
|
||||
emit messageEmitted( tr( "CRS Exception: selection extends beyond layer's coordinate system." ), QgsMessageBar::WARNING );
|
||||
return false;
|
||||
}
|
||||
QgsCoordinateTransform ct( mCanvas->mapSettings().destinationCrs(), vlayer->crs() );
|
||||
selectGeomTrans.transform( ct );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
// catch exception for 'invalid' point and leave existing selection unchanged
|
||||
QgsLogger::warning( "Caught CRS exception " + QStringLiteral( __FILE__ ) + ": " + QString::number( __LINE__ ) );
|
||||
emit messageEmitted( tr( "CRS Exception: selection extends beyond layer's coordinate system." ), QgsMessageBar::WARNING );
|
||||
return false;
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
@ -392,21 +392,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
|
||||
mLayerDefaultCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( myLayerDefaultCrs );
|
||||
leLayerGlobalCrs->setCrs( mLayerDefaultCrs );
|
||||
|
||||
//on the fly CRS transformation settings
|
||||
//it would be logical to have single settings value but originally the radio buttons were checkboxes
|
||||
if ( mSettings->value( QStringLiteral( "/Projections/otfTransformAutoEnable" ), true ).toBool() )
|
||||
{
|
||||
radOtfAuto->setChecked( true );
|
||||
}
|
||||
else if ( mSettings->value( QStringLiteral( "/Projections/otfTransformEnabled" ), false ).toBool() )
|
||||
{
|
||||
radOtfTransform->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
radOtfNone->setChecked( true ); // default
|
||||
}
|
||||
|
||||
QString myDefaultCrs = mSettings->value( QStringLiteral( "/Projections/projectDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString();
|
||||
mDefaultCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( myDefaultCrs );
|
||||
leProjectGlobalCrs->setCrs( mDefaultCrs );
|
||||
@ -1304,10 +1289,6 @@ void QgsOptions::saveOptions()
|
||||
}
|
||||
|
||||
mSettings->setValue( QStringLiteral( "/Projections/layerDefaultCrs" ), mLayerDefaultCrs.authid() );
|
||||
|
||||
// save 'on the fly' CRS transformation settings
|
||||
mSettings->setValue( QStringLiteral( "/Projections/otfTransformAutoEnable" ), radOtfAuto->isChecked() );
|
||||
mSettings->setValue( QStringLiteral( "/Projections/otfTransformEnabled" ), radOtfTransform->isChecked() );
|
||||
mSettings->setValue( QStringLiteral( "/Projections/projectDefaultCrs" ), mDefaultCrs.authid() );
|
||||
|
||||
mSettings->setValue( QStringLiteral( "/Projections/showDatumTransformDialog" ), chkShowDatumTransformDialog->isChecked() );
|
||||
|
@ -122,8 +122,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
// Properties stored in map canvas's QgsMapRenderer
|
||||
// these ones are propagated to QgsProject by a signal
|
||||
|
||||
// we need to initialize it, since the on_cbxProjectionEnabled_toggled()
|
||||
// slot triggered by setChecked() might use it.
|
||||
mProjectSrsId = mMapCanvas->mapSettings().destinationCrs().srsid();
|
||||
|
||||
QgsCoordinateReferenceSystem srs = QgsCoordinateReferenceSystem::fromSrsId( mProjectSrsId );
|
||||
@ -707,16 +705,8 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
}
|
||||
mRelationManagerDlg->setLayers( vectorLayers );
|
||||
|
||||
// Update projection selector (after mLayerSrsId is set)
|
||||
bool myProjectionEnabled = mMapCanvas->mapSettings().hasCrsTransformEnabled();
|
||||
bool onFlyChecked = cbxProjectionEnabled->isChecked();
|
||||
cbxProjectionEnabled->setChecked( myProjectionEnabled );
|
||||
|
||||
if ( onFlyChecked == myProjectionEnabled )
|
||||
{
|
||||
// ensure selector is updated if cbxProjectionEnabled->toggled signal not sent
|
||||
on_cbxProjectionEnabled_toggled( myProjectionEnabled );
|
||||
}
|
||||
// Update projection selector
|
||||
updateProjectionWidget();
|
||||
|
||||
mAutoTransaction->setChecked( QgsProject::instance()->autoTransaction() );
|
||||
mEvaluateDefaultValues->setChecked( QgsProject::instance()->evaluateDefaultValues() );
|
||||
@ -768,8 +758,6 @@ void QgsProjectProperties::title( QString const & title )
|
||||
//when user clicks apply button
|
||||
void QgsProjectProperties::apply()
|
||||
{
|
||||
mMapCanvas->setCrsTransformEnabled( cbxProjectionEnabled->isChecked() );
|
||||
|
||||
mMapCanvas->enableMapTileRendering( mMapTileRenderingCheckBox->isChecked() );
|
||||
|
||||
// Only change the projection if there is a node in the tree
|
||||
@ -787,19 +775,14 @@ void QgsProjectProperties::apply()
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
|
||||
// Set the map units to the projected coordinates if we are projecting
|
||||
if ( isProjected() )
|
||||
{
|
||||
// If we couldn't get the map units, default to the value in the
|
||||
// projectproperties dialog box (set above)
|
||||
if ( srs.mapUnits() != QgsUnitTypes::DistanceUnknownUnit )
|
||||
mMapCanvas->setMapUnits( srs.mapUnits() );
|
||||
}
|
||||
|
||||
if ( cbxProjectionEnabled->isChecked() )
|
||||
{
|
||||
// mark selected projection for push to front
|
||||
projectionSelector->pushProjectionToFront();
|
||||
}
|
||||
// If we couldn't get the map units, default to the value in the
|
||||
// projectproperties dialog box (set above)
|
||||
if ( srs.mapUnits() != QgsUnitTypes::DistanceUnknownUnit )
|
||||
mMapCanvas->setMapUnits( srs.mapUnits() );
|
||||
|
||||
// mark selected projection for push to front
|
||||
projectionSelector->pushProjectionToFront();
|
||||
}
|
||||
|
||||
// Set the project title
|
||||
@ -1195,51 +1178,18 @@ void QgsProjectProperties::apply()
|
||||
emit refresh();
|
||||
}
|
||||
|
||||
bool QgsProjectProperties::isProjected()
|
||||
{
|
||||
return cbxProjectionEnabled->isChecked();
|
||||
}
|
||||
|
||||
void QgsProjectProperties::showProjectionsTab()
|
||||
{
|
||||
mOptionsListWidget->setCurrentRow( 1 );
|
||||
}
|
||||
|
||||
void QgsProjectProperties::on_cbxProjectionEnabled_toggled( bool onFlyEnabled )
|
||||
void QgsProjectProperties::updateProjectionWidget()
|
||||
{
|
||||
if ( !onFlyEnabled )
|
||||
if ( !mLayerSrsId )
|
||||
{
|
||||
// reset projection to default
|
||||
const QMap<QString, QgsMapLayer*> &mapLayers = QgsProject::instance()->mapLayers();
|
||||
|
||||
QgsCoordinateReferenceSystem crs;
|
||||
if ( mMapCanvas->currentLayer() )
|
||||
{
|
||||
crs = mMapCanvas->currentLayer()->crs();
|
||||
}
|
||||
else if ( !mapLayers.isEmpty() )
|
||||
{
|
||||
crs = mapLayers.begin().value()->crs();
|
||||
}
|
||||
else
|
||||
{
|
||||
crs = QgsCoordinateReferenceSystem::fromSrsId( mProjectSrsId );
|
||||
}
|
||||
mLayerSrsId = crs.srsid();
|
||||
mProjectSrsId = mLayerSrsId;
|
||||
projectionSelector->setCrs( crs );
|
||||
|
||||
// unset ellipsoid
|
||||
mEllipsoidIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !mLayerSrsId )
|
||||
{
|
||||
mLayerSrsId = projectionSelector->crs().srsid();
|
||||
}
|
||||
projectionSelector->setCrs( QgsCoordinateReferenceSystem::fromSrsId( mProjectSrsId ) );
|
||||
mLayerSrsId = projectionSelector->crs().srsid();
|
||||
}
|
||||
projectionSelector->setCrs( QgsCoordinateReferenceSystem::fromSrsId( mProjectSrsId ) );
|
||||
|
||||
srIdUpdated();
|
||||
|
||||
@ -1306,7 +1256,7 @@ void QgsProjectProperties::updateGuiForMapUnits( QgsUnitTypes::DistanceUnit unit
|
||||
void QgsProjectProperties::srIdUpdated()
|
||||
{
|
||||
QgsCoordinateReferenceSystem srs = projectionSelector->crs();
|
||||
if ( !isProjected() || !srs.isValid() )
|
||||
if ( !srs.isValid() )
|
||||
return;
|
||||
|
||||
//set radio button to crs map unit type
|
||||
@ -1399,11 +1349,8 @@ void QgsProjectProperties::on_pbnWMSSetUsedSRS_clicked()
|
||||
|
||||
QSet<QString> crsList;
|
||||
|
||||
if ( cbxProjectionEnabled->isChecked() )
|
||||
{
|
||||
QgsCoordinateReferenceSystem srs = projectionSelector->crs();
|
||||
crsList << srs.authid();
|
||||
}
|
||||
QgsCoordinateReferenceSystem srs = projectionSelector->crs();
|
||||
crsList << srs.authid();
|
||||
|
||||
const QMap<QString, QgsMapLayer*> &mapLayers = QgsProject::instance()->mapLayers();
|
||||
for ( QMap<QString, QgsMapLayer*>::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it )
|
||||
|
@ -65,9 +65,6 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
//! Accessor for projection
|
||||
QString projectionWkt();
|
||||
|
||||
//! Indicates that the projection switch is on
|
||||
bool isProjected();
|
||||
|
||||
public slots:
|
||||
/*!
|
||||
* Slot called when apply button is pressed or dialog is accepted
|
||||
@ -143,7 +140,7 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
*/
|
||||
void on_buttonBox_helpRequested() { QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#project-properties" ) ); }
|
||||
|
||||
void on_cbxProjectionEnabled_toggled( bool onFlyEnabled );
|
||||
void updateProjectionWidget();
|
||||
|
||||
/*!
|
||||
* Slot to link WFS checkboxes
|
||||
|
@ -148,7 +148,6 @@ QgsMapSettings QgsComposerMap::mapSettings( const QgsRectangle& extent, QSizeF s
|
||||
|
||||
QgsMapSettings jobMapSettings;
|
||||
jobMapSettings.setDestinationCrs( renderCrs );
|
||||
jobMapSettings.setCrsTransformEnabled( true );
|
||||
jobMapSettings.setExtent( extent );
|
||||
jobMapSettings.setOutputSize( size.toSize() );
|
||||
jobMapSettings.setOutputDpi( dpi );
|
||||
|
@ -545,7 +545,6 @@ int QgsDxfExport::writeToFile( QIODevice* d, const QString& encoding )
|
||||
mMapSettings.setOutputDpi( dpi );
|
||||
if ( mCrs.isValid() )
|
||||
mMapSettings.setDestinationCrs( mCrs );
|
||||
mMapSettings.setCrsTransformEnabled( mCrs.isValid() );
|
||||
|
||||
writeHeader( dxfEncoding( encoding ) );
|
||||
writeTables();
|
||||
@ -1048,7 +1047,7 @@ void QgsDxfExport::writeEntities()
|
||||
|
||||
QgsFeatureIterator featureIt = vl->getFeatures( freq );
|
||||
|
||||
QgsCoordinateTransform ct = mMapSettings.hasCrsTransformEnabled() ? mMapSettings.layerTransform( vl ) : QgsCoordinateTransform();
|
||||
QgsCoordinateTransform ct = mMapSettings.layerTransform( vl );
|
||||
|
||||
QgsFeature fet;
|
||||
while ( featureIt.nextFeature( fet ) )
|
||||
@ -1183,7 +1182,7 @@ void QgsDxfExport::writeEntitiesSymbolLevels( QgsVectorLayer* layer )
|
||||
}
|
||||
}
|
||||
|
||||
QgsCoordinateTransform ct = mMapSettings.hasCrsTransformEnabled() ? mMapSettings.layerTransform( layer ) : QgsCoordinateTransform();
|
||||
QgsCoordinateTransform ct = mMapSettings.layerTransform( layer );
|
||||
|
||||
// export symbol layers and symbology
|
||||
for ( int l = 0; l < levels.count(); l++ )
|
||||
|
@ -70,11 +70,8 @@ void QgsMapHitTest::run()
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( mSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
context.setCoordinateTransform( mSettings.layerTransform( vl ) );
|
||||
context.setExtent( mSettings.outputExtentToLayerExtent( vl, mSettings.visibleExtent() ) );
|
||||
}
|
||||
context.setCoordinateTransform( mSettings.layerTransform( vl ) );
|
||||
context.setExtent( mSettings.outputExtentToLayerExtent( vl, mSettings.visibleExtent() ) );
|
||||
}
|
||||
|
||||
context.expressionContext() << QgsExpressionContextUtils::layerScope( vl );
|
||||
|
@ -249,19 +249,16 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsLabelingEn
|
||||
QgsRectangle r1 = mSettings.visibleExtent(), r2;
|
||||
QgsCoordinateTransform ct;
|
||||
|
||||
if ( mSettings.hasCrsTransformEnabled() )
|
||||
ct = mSettings.layerTransform( ml );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
ct = mSettings.layerTransform( ml );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
reprojectToLayerExtent( ml, ct, r1, r2 );
|
||||
}
|
||||
QgsDebugMsgLevel( "extent: " + r1.toString(), 3 );
|
||||
if ( !r1.isFinite() || !r2.isFinite() )
|
||||
{
|
||||
mErrors.append( Error( ml->id(), tr( "There was a problem transforming the layer's extent. Layer skipped." ) ) );
|
||||
continue;
|
||||
}
|
||||
reprojectToLayerExtent( ml, ct, r1, r2 );
|
||||
}
|
||||
QgsDebugMsgLevel( "extent: " + r1.toString(), 3 );
|
||||
if ( !r1.isFinite() || !r2.isFinite() )
|
||||
{
|
||||
mErrors.append( Error( ml->id(), tr( "There was a problem transforming the layer's extent. Layer skipped." ) ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Force render of layers that are being edited
|
||||
|
@ -37,7 +37,6 @@ QgsMapSettings::QgsMapSettings()
|
||||
, mExtent()
|
||||
, mRotation( 0.0 )
|
||||
, mMagnificationFactor( 1.0 )
|
||||
, mProjectionsEnabled( false )
|
||||
, mDestCRS( QgsCoordinateReferenceSystem::fromSrsId( GEOCRS_ID ) ) // WGS 84
|
||||
, mDatumTransformStore( mDestCRS )
|
||||
, mBackgroundColor( Qt::white )
|
||||
@ -281,17 +280,6 @@ void QgsMapSettings::setLayerStyleOverrides( const QMap<QString, QString>& overr
|
||||
mLayerStyleOverrides = overrides;
|
||||
}
|
||||
|
||||
void QgsMapSettings::setCrsTransformEnabled( bool enabled )
|
||||
{
|
||||
mProjectionsEnabled = enabled;
|
||||
}
|
||||
|
||||
bool QgsMapSettings::hasCrsTransformEnabled() const
|
||||
{
|
||||
return mProjectionsEnabled;
|
||||
}
|
||||
|
||||
|
||||
void QgsMapSettings::setDestinationCrs( const QgsCoordinateReferenceSystem& crs )
|
||||
{
|
||||
mDestCRS = crs;
|
||||
@ -398,24 +386,21 @@ double QgsMapSettings::layerToMapUnits( const QgsMapLayer *layer, const QgsRecta
|
||||
|
||||
QgsRectangle QgsMapSettings::layerExtentToOutputExtent( const QgsMapLayer* layer, QgsRectangle extent ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
QgsDebugMsg( QString( "sourceCrs = " + ct.sourceCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "destCRS = " + ct.destinationCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "extent = " + extent.toString() ) );
|
||||
extent = ct.transformBoundingBox( extent );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
QgsDebugMsg( QString( "sourceCrs = " + ct.sourceCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "destCRS = " + ct.destinationCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "extent = " + extent.toString() ) );
|
||||
extent = ct.transformBoundingBox( extent );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );
|
||||
|
||||
@ -425,24 +410,21 @@ QgsRectangle QgsMapSettings::layerExtentToOutputExtent( const QgsMapLayer* layer
|
||||
|
||||
QgsRectangle QgsMapSettings::outputExtentToLayerExtent( const QgsMapLayer* layer, QgsRectangle extent ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
QgsDebugMsg( QString( "sourceCrs = " + ct.sourceCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "destCRS = " + ct.destinationCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "extent = " + extent.toString() ) );
|
||||
extent = ct.transformBoundingBox( extent, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
QgsDebugMsg( QString( "sourceCrs = " + ct.sourceCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "destCRS = " + ct.destinationCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "extent = " + extent.toString() ) );
|
||||
extent = ct.transformBoundingBox( extent, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );
|
||||
|
||||
@ -452,88 +434,68 @@ QgsRectangle QgsMapSettings::outputExtentToLayerExtent( const QgsMapLayer* layer
|
||||
|
||||
QgsPoint QgsMapSettings::layerToMapCoordinates( const QgsMapLayer* layer, QgsPoint point ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
point = ct.transform( point, QgsCoordinateTransform::ForwardTransform );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
point = ct.transform( point, QgsCoordinateTransform::ForwardTransform );
|
||||
}
|
||||
else
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
// leave point without transformation
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
QgsRectangle QgsMapSettings::layerToMapCoordinates( const QgsMapLayer* layer, QgsRectangle rect ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
rect = ct.transform( rect, QgsCoordinateTransform::ForwardTransform );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
rect = ct.transform( rect, QgsCoordinateTransform::ForwardTransform );
|
||||
}
|
||||
else
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
// leave point without transformation
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
QgsPoint QgsMapSettings::mapToLayerCoordinates( const QgsMapLayer* layer, QgsPoint point ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
point = ct.transform( point, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
point = ct.transform( point, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
else
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
// leave point without transformation
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
QgsRectangle QgsMapSettings::mapToLayerCoordinates( const QgsMapLayer* layer, QgsRectangle rect ) const
|
||||
{
|
||||
if ( hasCrsTransformEnabled() )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
rect = ct.transform( rect, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
QgsCoordinateTransform ct = layerTransform( layer );
|
||||
if ( ct.isValid() )
|
||||
rect = ct.transform( rect, QgsCoordinateTransform::ReverseTransform );
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Transform error caught: %1" ).arg( cse.what() ), QStringLiteral( "CRS" ) );
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
@ -606,10 +568,6 @@ void QgsMapSettings::readXml( QDomNode& node )
|
||||
QgsUnitTypes::DistanceUnit units = QgsXmlUtils::readMapUnits( mapUnitsNode.toElement() );
|
||||
setMapUnits( units );
|
||||
|
||||
// set projections flag
|
||||
QDomNode projNode = node.namedItem( QStringLiteral( "projections" ) );
|
||||
setCrsTransformEnabled( projNode.toElement().text().toInt() );
|
||||
|
||||
// set destination CRS
|
||||
QgsCoordinateReferenceSystem srs;
|
||||
QDomNode srsNode = node.namedItem( QStringLiteral( "destinationsrs" ) );
|
||||
@ -657,11 +615,6 @@ void QgsMapSettings::writeXml( QDomNode& node, QDomDocument& doc )
|
||||
);
|
||||
node.appendChild( rotNode );
|
||||
|
||||
// projections enabled
|
||||
QDomElement projNode = doc.createElement( QStringLiteral( "projections" ) );
|
||||
projNode.appendChild( doc.createTextNode( QString::number( hasCrsTransformEnabled() ) ) );
|
||||
node.appendChild( projNode );
|
||||
|
||||
// destination CRS
|
||||
QDomElement srsNode = doc.createElement( QStringLiteral( "destinationsrs" ) );
|
||||
node.appendChild( srsNode );
|
||||
|
@ -133,11 +133,6 @@ class CORE_EXPORT QgsMapSettings
|
||||
*/
|
||||
void setCustomRenderFlags( const QString& customRenderFlags ) { mCustomRenderFlags = customRenderFlags; }
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
//! returns true if projections are enabled for this layer set
|
||||
bool hasCrsTransformEnabled() const;
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
//! returns CRS of destination coordinate reference system
|
||||
@ -315,7 +310,6 @@ class CORE_EXPORT QgsMapSettings
|
||||
QString mCustomRenderFlags;
|
||||
QgsExpressionContext mExpressionContext;
|
||||
|
||||
bool mProjectionsEnabled;
|
||||
QgsCoordinateReferenceSystem mDestCRS;
|
||||
QgsDatumTransformStore mDatumTransformStore;
|
||||
|
||||
|
@ -447,8 +447,8 @@ QgsPointLocator::Match QgsSnappingUtils::snapToCurrentLayer( QPoint point, int t
|
||||
|
||||
void QgsSnappingUtils::setMapSettings( const QgsMapSettings& settings )
|
||||
{
|
||||
QString oldDestCRS = mMapSettings.hasCrsTransformEnabled() ? mMapSettings.destinationCrs().authid() : QString();
|
||||
QString newDestCRS = settings.hasCrsTransformEnabled() ? settings.destinationCrs().authid() : QString();
|
||||
QString oldDestCRS = mMapSettings.destinationCrs().authid();
|
||||
QString newDestCRS = settings.destinationCrs().authid();
|
||||
mMapSettings = settings;
|
||||
|
||||
if ( newDestCRS != oldDestCRS )
|
||||
@ -543,7 +543,7 @@ QString QgsSnappingUtils::dump()
|
||||
|
||||
QgsCoordinateReferenceSystem QgsSnappingUtils::destinationCrs() const
|
||||
{
|
||||
return mMapSettings.hasCrsTransformEnabled() ? mMapSettings.destinationCrs() : QgsCoordinateReferenceSystem();
|
||||
return mMapSettings.destinationCrs();
|
||||
}
|
||||
|
||||
void QgsSnappingUtils::onIndividualLayerSettingsChanged( const QHash<QgsVectorLayer*, QgsSnappingConfig::IndividualLayerSettings>& layerSettings )
|
||||
|
@ -97,12 +97,6 @@ double QgsTolerance::defaultTolerance( QgsMapLayer *layer, const QgsMapSettings&
|
||||
|
||||
double QgsTolerance::computeMapUnitPerPixel( QgsMapLayer* layer, const QgsMapSettings& mapSettings )
|
||||
{
|
||||
if ( ! mapSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
// if the on-the-fly projections are not enabled, layer units pre pixel are the same as map units per pixel
|
||||
return mapSettings.mapUnitsPerPixel();
|
||||
}
|
||||
|
||||
// the layer is projected. Find out how many pixels are in one map unit - either horizontal and vertical direction
|
||||
// this check might not work correctly in some cases
|
||||
// (on a large area the pixels projected around "0,0" can have different properties from the actual point)
|
||||
|
@ -454,8 +454,7 @@ void extractLinework( const QgsGeometry& g, QgsMultiPolyline& mpl )
|
||||
|
||||
|
||||
QgsTracer::QgsTracer()
|
||||
: mReprojectionEnabled( false )
|
||||
, mMaxFeatureCount( 0 )
|
||||
: mMaxFeatureCount( 0 )
|
||||
, mHasTopologyProblem( false )
|
||||
{
|
||||
}
|
||||
@ -486,7 +485,7 @@ bool QgsTracer::initGraph()
|
||||
QgsFeatureRequest request;
|
||||
request.setSubsetOfAttributes( QgsAttributeList() );
|
||||
if ( !mExtent.isEmpty() )
|
||||
request.setFilterRect( mReprojectionEnabled ? ct.transformBoundingBox( mExtent, QgsCoordinateTransform::ReverseTransform ) : mExtent );
|
||||
request.setFilterRect( ct.transformBoundingBox( mExtent, QgsCoordinateTransform::ReverseTransform ) );
|
||||
|
||||
QgsFeatureIterator fi = vl->getFeatures( request );
|
||||
while ( fi.nextFeature( f ) )
|
||||
@ -494,7 +493,7 @@ bool QgsTracer::initGraph()
|
||||
if ( !f.hasGeometry() )
|
||||
continue;
|
||||
|
||||
if ( mReprojectionEnabled && !ct.isShortCircuited() )
|
||||
if ( !ct.isShortCircuited() )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -603,15 +602,6 @@ void QgsTracer::setLayers( const QList<QgsVectorLayer*>& layers )
|
||||
invalidateGraph();
|
||||
}
|
||||
|
||||
void QgsTracer::setCrsTransformEnabled( bool enabled )
|
||||
{
|
||||
if ( mReprojectionEnabled == enabled )
|
||||
return;
|
||||
|
||||
mReprojectionEnabled = enabled;
|
||||
invalidateGraph();
|
||||
}
|
||||
|
||||
void QgsTracer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs )
|
||||
{
|
||||
if ( mCRS == crs )
|
||||
|
@ -48,11 +48,6 @@ class CORE_EXPORT QgsTracer : public QObject
|
||||
//! Set layers used for tracing
|
||||
void setLayers( const QList<QgsVectorLayer*>& layers );
|
||||
|
||||
//! Return true if reprojection to destination CRS is enabled
|
||||
bool hasCrsTransformEnabled() const { return mReprojectionEnabled; }
|
||||
//! Set whether to do reprojection to destination CRS
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
|
||||
//! Get CRS used for tracing
|
||||
QgsCoordinateReferenceSystem destinationCrs() const { return mCRS; }
|
||||
//! Set CRS used for tracing
|
||||
@ -124,8 +119,6 @@ class CORE_EXPORT QgsTracer : public QObject
|
||||
std::unique_ptr< QgsTracerGraph > mGraph;
|
||||
//! Input layers for the graph building
|
||||
QList<QgsVectorLayer*> mLayers;
|
||||
//! Whether to reproject layer features to specified destination CRS
|
||||
bool mReprojectionEnabled;
|
||||
//! Destination CRS in which graph is built and tracing done
|
||||
QgsCoordinateReferenceSystem mCRS;
|
||||
//! Extent for graph building (empty extent means no limit)
|
||||
|
@ -141,19 +141,12 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS
|
||||
QgsDiagramLayerSettings& s2 = mSettings;
|
||||
const QgsMapSettings& mapSettings = mEngine->mapSettings();
|
||||
|
||||
if ( mapSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
if ( context.coordinateTransform().isValid() )
|
||||
// this is context for layer rendering - use its CT as it includes correct datum transform
|
||||
s2.setCoordinateTransform( context.coordinateTransform() );
|
||||
else
|
||||
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
|
||||
s2.setCoordinateTransform( QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );
|
||||
}
|
||||
if ( context.coordinateTransform().isValid() )
|
||||
// this is context for layer rendering - use its CT as it includes correct datum transform
|
||||
s2.setCoordinateTransform( context.coordinateTransform() );
|
||||
else
|
||||
{
|
||||
s2.setCoordinateTransform( QgsCoordinateTransform() );
|
||||
}
|
||||
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
|
||||
s2.setCoordinateTransform( QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );
|
||||
|
||||
s2.setRenderer( mDiagRenderer );
|
||||
|
||||
|
@ -172,15 +172,12 @@ bool QgsVectorLayerLabelProvider::prepare( const QgsRenderContext& context, QSet
|
||||
|
||||
lyr.xform = &mapSettings.mapToPixel();
|
||||
lyr.ct = QgsCoordinateTransform();
|
||||
if ( mapSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
if ( context.coordinateTransform().isValid() )
|
||||
// this is context for layer rendering - use its CT as it includes correct datum transform
|
||||
lyr.ct = context.coordinateTransform();
|
||||
else
|
||||
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
|
||||
lyr.ct = QgsCoordinateTransform( mCrs, mapSettings.destinationCrs() );
|
||||
}
|
||||
if ( context.coordinateTransform().isValid() )
|
||||
// this is context for layer rendering - use its CT as it includes correct datum transform
|
||||
lyr.ct = context.coordinateTransform();
|
||||
else
|
||||
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
|
||||
lyr.ct = QgsCoordinateTransform( mCrs, mapSettings.destinationCrs() );
|
||||
lyr.ptZero = lyr.xform->toMapCoordinates( 0, 0 );
|
||||
lyr.ptOne = lyr.xform->toMapCoordinates( 1, 0 );
|
||||
|
||||
|
@ -31,7 +31,6 @@ QgsLayerTreeMapCanvasBridge::QgsLayerTreeMapCanvasBridge( QgsLayerTreeGroup *roo
|
||||
, mPendingCanvasUpdate( false )
|
||||
, mHasCustomLayerOrder( false )
|
||||
, mAutoSetupOnFirstLayer( true )
|
||||
, mAutoEnableCrsTransform( true )
|
||||
, mLastLayerCount( !root->findLayers().isEmpty() )
|
||||
{
|
||||
connect( root, &QgsLayerTreeGroup::addedChildren, this, &QgsLayerTreeMapCanvasBridge::nodeAddedChildren );
|
||||
@ -141,27 +140,6 @@ void QgsLayerTreeMapCanvasBridge::setCanvasLayers()
|
||||
int currentLayerCount = layerNodes.count();
|
||||
bool firstLayers = mAutoSetupOnFirstLayer && mLastLayerCount == 0 && currentLayerCount != 0;
|
||||
|
||||
if ( firstLayers )
|
||||
{
|
||||
// also setup destination CRS and map units if the OTF projections are not yet enabled
|
||||
if ( !mCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
{
|
||||
Q_FOREACH ( QgsLayerTreeLayer* layerNode, layerNodes )
|
||||
{
|
||||
if ( !layerNode->layer() )
|
||||
continue;
|
||||
|
||||
if ( layerNode->layer()->isSpatial() )
|
||||
{
|
||||
mCanvas->setDestinationCrs( layerNode->layer()->crs() );
|
||||
QgsProject::instance()->setCrs( layerNode->layer()->crs() );
|
||||
mCanvas->setMapUnits( layerNode->layer()->crs().mapUnits() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCanvas->setLayers( canvasLayers );
|
||||
if ( mOverviewCanvas )
|
||||
mOverviewCanvas->setLayers( overviewLayers );
|
||||
@ -185,19 +163,10 @@ void QgsLayerTreeMapCanvasBridge::setCanvasLayers()
|
||||
}
|
||||
}
|
||||
|
||||
if ( mAutoEnableCrsTransform && mFirstCRS.isValid() && !mCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
if ( mFirstCRS.isValid() && firstLayers )
|
||||
{
|
||||
// check whether all layers still have the same CRS
|
||||
Q_FOREACH ( QgsLayerTreeLayer* layerNode, layerNodes )
|
||||
{
|
||||
if ( layerNode->layer() && layerNode->layer()->crs().isValid() && layerNode->layer()->crs() != mFirstCRS )
|
||||
{
|
||||
mCanvas->setDestinationCrs( mFirstCRS );
|
||||
QgsProject::instance()->setCrs( mFirstCRS );
|
||||
mCanvas->setCrsTransformEnabled( true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCanvas->setDestinationCrs( mFirstCRS );
|
||||
QgsProject::instance()->setCrs( mFirstCRS );
|
||||
}
|
||||
|
||||
mLastLayerCount = currentLayerCount;
|
||||
|
@ -73,11 +73,6 @@ class GUI_EXPORT QgsLayerTreeMapCanvasBridge : public QObject
|
||||
void setAutoSetupOnFirstLayer( bool enabled ) { mAutoSetupOnFirstLayer = enabled; }
|
||||
bool autoSetupOnFirstLayer() const { return mAutoSetupOnFirstLayer; }
|
||||
|
||||
//! if enabled, will automatically turn on on-the-fly reprojection of layers if a layer
|
||||
//! with different source CRS is added
|
||||
void setAutoEnableCrsTransform( bool enabled ) { mAutoEnableCrsTransform = enabled; }
|
||||
bool autoEnableCrsTransform() const { return mAutoEnableCrsTransform; }
|
||||
|
||||
public slots:
|
||||
void setHasCustomLayerOrder( bool state );
|
||||
void setCustomLayerOrder( const QStringList& order );
|
||||
@ -125,7 +120,6 @@ class GUI_EXPORT QgsLayerTreeMapCanvasBridge : public QObject
|
||||
QStringList mCustomLayerOrder;
|
||||
|
||||
bool mAutoSetupOnFirstLayer;
|
||||
bool mAutoEnableCrsTransform;
|
||||
|
||||
bool mHasFirstLayer;
|
||||
bool mLastLayerCount;
|
||||
|
@ -292,9 +292,8 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas* canvas, const Q
|
||||
if ( layerExtent.isNull() )
|
||||
continue;
|
||||
|
||||
//transform extent if otf-projection is on
|
||||
if ( canvas->hasCrsTransformEnabled() )
|
||||
layerExtent = canvas->mapSettings().layerExtentToOutputExtent( layer, layerExtent );
|
||||
//transform extent
|
||||
layerExtent = canvas->mapSettings().layerExtentToOutputExtent( layer, layerExtent );
|
||||
|
||||
extent.combineExtentWith( layerExtent );
|
||||
}
|
||||
|
@ -83,23 +83,21 @@ QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, const QgsFeature& feature,
|
||||
|
||||
void QgsHighlight::init()
|
||||
{
|
||||
if ( mMapCanvas->mapSettings().hasCrsTransformEnabled() )
|
||||
QgsCoordinateTransform ct = mMapCanvas->mapSettings().layerTransform( mLayer );
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
QgsCoordinateTransform ct = mMapCanvas->mapSettings().layerTransform( mLayer );
|
||||
if ( ct.isValid() )
|
||||
if ( mGeometry )
|
||||
{
|
||||
if ( mGeometry )
|
||||
{
|
||||
mGeometry->transform( ct );
|
||||
}
|
||||
else if ( mFeature.hasGeometry() )
|
||||
{
|
||||
QgsGeometry g = mFeature.geometry();
|
||||
g.transform( ct );
|
||||
mFeature.setGeometry( g );
|
||||
}
|
||||
mGeometry->transform( ct );
|
||||
}
|
||||
else if ( mFeature.hasGeometry() )
|
||||
{
|
||||
QgsGeometry g = mFeature.geometry();
|
||||
g.transform( ct );
|
||||
mFeature.setGeometry( g );
|
||||
}
|
||||
}
|
||||
|
||||
updateRect();
|
||||
update();
|
||||
setColor( QColor( Qt::lightGray ) );
|
||||
|
@ -333,20 +333,6 @@ const QgsMapSettings &QgsMapCanvas::mapSettings() const
|
||||
return mSettings;
|
||||
}
|
||||
|
||||
void QgsMapCanvas::setCrsTransformEnabled( bool enabled )
|
||||
{
|
||||
if ( mSettings.hasCrsTransformEnabled() == enabled )
|
||||
return;
|
||||
|
||||
mSettings.setCrsTransformEnabled( enabled );
|
||||
|
||||
updateDatumTransformEntries();
|
||||
|
||||
refresh();
|
||||
|
||||
emit hasCrsTransformEnabledChanged( enabled );
|
||||
}
|
||||
|
||||
void QgsMapCanvas::setDestinationCrs( const QgsCoordinateReferenceSystem &crs )
|
||||
{
|
||||
if ( mSettings.destinationCrs() == crs )
|
||||
@ -368,10 +354,6 @@ void QgsMapCanvas::setDestinationCrs( const QgsCoordinateReferenceSystem &crs )
|
||||
}
|
||||
}
|
||||
|
||||
if ( !mSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
mSettings.setMapUnits( crs.mapUnits() );
|
||||
}
|
||||
if ( !rect.isEmpty() )
|
||||
{
|
||||
setExtent( rect );
|
||||
@ -888,12 +870,6 @@ void QgsMapCanvas::clearExtentHistory()
|
||||
emit zoomNextStatusChanged( mLastExtentIndex < mLastExtent.size() - 1 );
|
||||
}// clearExtentHistory
|
||||
|
||||
|
||||
bool QgsMapCanvas::hasCrsTransformEnabled()
|
||||
{
|
||||
return mapSettings().hasCrsTransformEnabled();
|
||||
}
|
||||
|
||||
void QgsMapCanvas::zoomToSelected( QgsVectorLayer* layer )
|
||||
{
|
||||
if ( !layer )
|
||||
@ -1653,9 +1629,6 @@ void QgsMapCanvas::connectNotify( const char * signal )
|
||||
|
||||
void QgsMapCanvas::updateDatumTransformEntries()
|
||||
{
|
||||
if ( !mSettings.hasCrsTransformEnabled() )
|
||||
return;
|
||||
|
||||
QString destAuthId = mSettings.destinationCrs().authid();
|
||||
Q_FOREACH ( QgsMapLayer* layer, mSettings.layers() )
|
||||
{
|
||||
@ -1822,7 +1795,6 @@ void QgsMapCanvas::readProject( const QDomDocument & doc )
|
||||
QgsMapSettings tmpSettings;
|
||||
tmpSettings.readXml( node );
|
||||
setMapUnits( tmpSettings.mapUnits() );
|
||||
setCrsTransformEnabled( tmpSettings.hasCrsTransformEnabled() );
|
||||
setDestinationCrs( tmpSettings.destinationCrs() );
|
||||
setExtent( tmpSettings.extent() );
|
||||
setRotation( tmpSettings.rotation() );
|
||||
|
@ -94,10 +94,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! @note added in 2.4
|
||||
const QgsMapSettings& mapSettings() const;
|
||||
|
||||
//! sets whether to use projections for this layer set
|
||||
//! @note added in 2.4
|
||||
void setCrsTransformEnabled( bool enabled );
|
||||
|
||||
//! sets destination coordinate reference system
|
||||
//! @note added in 2.4
|
||||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs );
|
||||
@ -418,9 +414,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! State of render suppression flag
|
||||
bool renderFlag() {return mRenderFlag;}
|
||||
|
||||
//! A simple helper method to find out if on the fly projections are enabled or not
|
||||
bool hasCrsTransformEnabled();
|
||||
|
||||
//! stop rendering (if there is any right now)
|
||||
//! @note added in 2.4
|
||||
void stopRendering();
|
||||
@ -526,10 +519,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! Emitted when zoom next status changed
|
||||
void zoomNextStatusChanged( bool );
|
||||
|
||||
//! Emitted when on-the-fly projection has been turned on/off
|
||||
//! @note added in 2.4
|
||||
void hasCrsTransformEnabledChanged( bool flag );
|
||||
|
||||
//! Emitted when map CRS has changed
|
||||
//! @note added in 2.4
|
||||
void destinationCrsChanged();
|
||||
|
@ -95,7 +95,6 @@ void QgsMapCanvasTracer::reportError( QgsTracer::PathError err, bool addingVerte
|
||||
|
||||
void QgsMapCanvasTracer::configure()
|
||||
{
|
||||
setCrsTransformEnabled( mCanvas->mapSettings().hasCrsTransformEnabled() );
|
||||
setDestinationCrs( mCanvas->mapSettings().destinationCrs() );
|
||||
setExtent( mCanvas->extent() );
|
||||
|
||||
|
@ -43,7 +43,6 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget * parent, QgsMapCanvas* mapC
|
||||
mSettings.setFlag( QgsMapSettings::DrawLabeling, false );
|
||||
|
||||
connect( mMapCanvas, &QgsMapCanvas::extentsChanged, this, &QgsMapOverviewCanvas::drawExtentRect );
|
||||
connect( mMapCanvas, &QgsMapCanvas::hasCrsTransformEnabledChanged, this, &QgsMapOverviewCanvas::hasCrsTransformEnabled );
|
||||
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapOverviewCanvas::destinationCrsChanged );
|
||||
}
|
||||
|
||||
@ -258,11 +257,6 @@ void QgsMapOverviewCanvas::updateFullExtent()
|
||||
drawExtentRect();
|
||||
}
|
||||
|
||||
void QgsMapOverviewCanvas::hasCrsTransformEnabled( bool flag )
|
||||
{
|
||||
mSettings.setCrsTransformEnabled( flag );
|
||||
}
|
||||
|
||||
void QgsMapOverviewCanvas::destinationCrsChanged()
|
||||
{
|
||||
mSettings.setDestinationCrs( mMapCanvas->mapSettings().destinationCrs() );
|
||||
|
@ -66,9 +66,6 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
|
||||
//! used for overview canvas to reflect changed extent in main map canvas
|
||||
void drawExtentRect();
|
||||
|
||||
// ### QGIS 3: rename so it does not look like getter, make protected
|
||||
void hasCrsTransformEnabled( bool flag );
|
||||
|
||||
// ### QGIS 3: make protected
|
||||
//! Should be called when the canvas destination CRS is changed
|
||||
void destinationCrsChanged();
|
||||
|
@ -496,7 +496,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, Qg
|
||||
|
||||
QgsRasterIdentifyResult identifyResult;
|
||||
// We can only use current map canvas context (extent, width, height) if layer is not reprojected,
|
||||
if ( mCanvas->hasCrsTransformEnabled() && dprovider->crs() != mCanvas->mapSettings().destinationCrs() )
|
||||
if ( dprovider->crs() != mCanvas->mapSettings().destinationCrs() )
|
||||
{
|
||||
// To get some reasonable response for point/line WMS vector layers we must
|
||||
// use a context with approximately a resolution in layer CRS units
|
||||
|
@ -36,13 +36,8 @@ QgsProjectionSelectionWidget::QgsProjectionSelectionWidget( QWidget *parent )
|
||||
mCrsComboBox->addItem( tr( "invalid projection" ), QgsProjectionSelectionWidget::CurrentCrs );
|
||||
mCrsComboBox->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
|
||||
|
||||
if ( QgsProject::instance()->readNumEntry( QStringLiteral( "SpatialRefSys" ), QStringLiteral( "/ProjectionsEnabled" ), 0 ) )
|
||||
{
|
||||
//only show project CRS if OTF reprojection is enabled - otherwise the
|
||||
//CRS stored in the project can be misleading
|
||||
mProjectCrs = QgsProject::instance()->crs();
|
||||
addProjectCrsOption();
|
||||
}
|
||||
mProjectCrs = QgsProject::instance()->crs();
|
||||
addProjectCrsOption();
|
||||
|
||||
QSettings settings;
|
||||
QString defCrsString = settings.value( QStringLiteral( "/Projections/projectDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString();
|
||||
|
@ -714,14 +714,7 @@ bool QgsGrassModuleStandardOptions::inputRegion( struct Cell_head *window, QgsCo
|
||||
if ( mDirect && mode == RegionCurrent )
|
||||
{
|
||||
// TODO: warn if outside region
|
||||
if ( mCanvas->hasCrsTransformEnabled() )
|
||||
{
|
||||
crs = mCanvas->mapSettings().destinationCrs();
|
||||
}
|
||||
else
|
||||
{
|
||||
crs = QgsCoordinateReferenceSystem();
|
||||
}
|
||||
crs = mCanvas->mapSettings().destinationCrs();
|
||||
QgsRectangle rect = mCanvas->extent();
|
||||
|
||||
QgsGrass::initRegion( window );
|
||||
|
@ -109,7 +109,7 @@ void QgsGrassRegionEdit::calcSrcRegion()
|
||||
{
|
||||
mSrcRectangle.set( mStartPoint, mEndPoint );
|
||||
|
||||
if ( mCanvas->hasCrsTransformEnabled() && mCrs.isValid() && mCanvas->mapSettings().destinationCrs().isValid() )
|
||||
if ( mCrs.isValid() && mCanvas->mapSettings().destinationCrs().isValid() )
|
||||
{
|
||||
QgsCoordinateTransform coordinateTransform;
|
||||
coordinateTransform.setSourceCrs( mCanvas->mapSettings().destinationCrs() );
|
||||
@ -127,26 +127,23 @@ void QgsGrassRegionEdit::setTransform()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGrassRegionEdit::transform( QgsMapCanvas *canvas, QVector<QgsPoint> &points, const QgsCoordinateTransform& coordinateTransform, QgsCoordinateTransform::TransformDirection direction )
|
||||
void QgsGrassRegionEdit::transform( QgsMapCanvas *, QVector<QgsPoint> &points, const QgsCoordinateTransform& coordinateTransform, QgsCoordinateTransform::TransformDirection direction )
|
||||
{
|
||||
//! Coordinate transform
|
||||
if ( canvas->hasCrsTransformEnabled() )
|
||||
//QgsDebugMsg ( "srcCrs = " + coordinateTransform->sourceCrs().toWkt() );
|
||||
//QgsDebugMsg ( "destCrs = " + coordinateTransform->destCRS().toWkt() );
|
||||
try
|
||||
{
|
||||
//QgsDebugMsg ( "srcCrs = " + coordinateTransform->sourceCrs().toWkt() );
|
||||
//QgsDebugMsg ( "destCrs = " + coordinateTransform->destCRS().toWkt() );
|
||||
try
|
||||
for ( int i = 0; i < points.size(); i++ )
|
||||
{
|
||||
for ( int i = 0; i < points.size(); i++ )
|
||||
{
|
||||
points[i] = coordinateTransform.transform( points[i], direction );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
QgsDebugMsg( QString( "transformation failed: %1" ).arg( cse.what() ) );
|
||||
points[i] = coordinateTransform.transform( points[i], direction );
|
||||
}
|
||||
}
|
||||
catch ( QgsCsException &cse )
|
||||
{
|
||||
Q_UNUSED( cse );
|
||||
QgsDebugMsg( QString( "transformation failed: %1" ).arg( cse.what() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGrassRegionEdit::drawRegion( QgsMapCanvas *canvas, QgsRubberBand* rubberBand, const QgsRectangle &rect, const QgsCoordinateTransform& coordinateTransform, bool isPolygon )
|
||||
|
@ -687,10 +687,8 @@ void QgsSpatialQueryDialog::zoomFeature( QgsVectorLayer* lyr, QgsFeatureId fid )
|
||||
if ( sHasMsg )
|
||||
{
|
||||
QString crsMapcanvas = srcMapcanvas.authid();
|
||||
bool isFly = mIface->mapCanvas()->mapSettings().hasCrsTransformEnabled();
|
||||
QString msgFly = tr( "Map \"%1\" \"on the fly\" transformation." ).arg( isFly ? tr( "enable" ) : tr( "disable" ) );
|
||||
QString msg = tr( "Coordinate reference system(CRS) of\n\"%1\" is invalid(see CRS of provider)." ).arg( lyr->name() );
|
||||
msg.append( tr( "\n\nCRS of map is %1.\n%2." ).arg( crsMapcanvas, msgFly ) );
|
||||
msg.append( tr( "\n\nCRS of map is %1." ).arg( crsMapcanvas ) );
|
||||
msg.append( "\n\nUsing CRS of map for all features!" );
|
||||
|
||||
QMessageBox::warning( this, tr( "Zoom to feature" ), msg, QMessageBox::Ok );
|
||||
|
@ -416,12 +416,9 @@ namespace QgsWms
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( mapSettings.hasCrsTransformEnabled() )
|
||||
{
|
||||
QgsCoordinateTransform tr = mapSettings.layerTransform( vl );
|
||||
context.setCoordinateTransform( tr );
|
||||
context.setExtent( tr.transformBoundingBox( mapSettings.extent(), QgsCoordinateTransform::ReverseTransform ) );
|
||||
}
|
||||
QgsCoordinateTransform tr = mapSettings.layerTransform( vl );
|
||||
context.setCoordinateTransform( tr );
|
||||
context.setExtent( tr.transformBoundingBox( mapSettings.extent(), QgsCoordinateTransform::ReverseTransform ) );
|
||||
|
||||
SymbolSet& usedSymbols = hitTest[vl];
|
||||
runHitTestLayer( vl, usedSymbols, context );
|
||||
@ -1328,31 +1325,19 @@ namespace QgsWms
|
||||
QgsCoordinateReferenceSystem outputCRS;
|
||||
|
||||
//wms spec says that CRS parameter is mandatory.
|
||||
//we don't reject the request if it is not there but disable reprojection on the fly
|
||||
if ( crs.isEmpty() )
|
||||
{
|
||||
//disable on the fly projection
|
||||
QgsProject::instance()->writeEntry( QStringLiteral( "SpatialRefSys" ), QStringLiteral( "/ProjectionsEnabled" ), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//enable on the fly projection
|
||||
QgsMessageLog::logMessage( QStringLiteral( "enable on the fly projection" ) );
|
||||
QgsProject::instance()->writeEntry( QStringLiteral( "SpatialRefSys" ), QStringLiteral( "/ProjectionsEnabled" ), 1 );
|
||||
|
||||
//destination SRS
|
||||
outputCRS = QgsCoordinateReferenceSystem::fromOgcWmsCrs( crs );
|
||||
if ( !outputCRS.isValid() )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Error, could not create output CRS from EPSG" ) );
|
||||
throw QgsBadRequestException( QStringLiteral( "InvalidCRS" ), QStringLiteral( "Could not create output CRS" ) );
|
||||
}
|
||||
|
||||
//then set destinationCrs
|
||||
mapSettings.setDestinationCrs( outputCRS );
|
||||
mapSettings.setCrsTransformEnabled( true );
|
||||
mapUnits = outputCRS.mapUnits();
|
||||
//destination SRS
|
||||
outputCRS = QgsCoordinateReferenceSystem::fromOgcWmsCrs( crs );
|
||||
if ( !outputCRS.isValid() )
|
||||
{
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Error, could not create output CRS from EPSG" ) );
|
||||
throw QgsBadRequestException( QStringLiteral( "InvalidCRS" ), QStringLiteral( "Could not create output CRS" ) );
|
||||
}
|
||||
|
||||
//then set destinationCrs
|
||||
mapSettings.setDestinationCrs( outputCRS );
|
||||
mapUnits = outputCRS.mapUnits();
|
||||
|
||||
mapSettings.setMapUnits( mapUnits );
|
||||
|
||||
// Change x- and y- of BBOX for WMS 1.3.0 if axis inverted
|
||||
@ -1561,7 +1546,7 @@ namespace QgsWms
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystem outputCrs = layer->crs();
|
||||
if ( layer->crs() != mapSettings.destinationCrs() && mapSettings.hasCrsTransformEnabled() )
|
||||
if ( layer->crs() != mapSettings.destinationCrs() )
|
||||
{
|
||||
outputCrs = mapSettings.destinationCrs();
|
||||
}
|
||||
@ -1712,7 +1697,7 @@ namespace QgsWms
|
||||
// use context extent, width height (comes with request) to use WCS cache
|
||||
// We can only use context if raster is not reprojected, otherwise it is difficult
|
||||
// to guess correct source resolution
|
||||
if ( mapSettings.hasCrsTransformEnabled() && layer->dataProvider()->crs() != mapSettings.destinationCrs() )
|
||||
if ( layer->dataProvider()->crs() != mapSettings.destinationCrs() )
|
||||
{
|
||||
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue ).results();
|
||||
}
|
||||
|
@ -311,7 +311,7 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="mOptionsStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>12</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mOptionsPageGeneral">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@ -340,8 +340,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<width>843</width>
|
||||
<height>702</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_28">
|
||||
@ -1027,7 +1027,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>843</width>
|
||||
<height>1065</height>
|
||||
<height>1110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
@ -1557,7 +1557,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>843</width>
|
||||
<height>685</height>
|
||||
<height>787</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||
@ -1925,7 +1925,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>843</width>
|
||||
<height>936</height>
|
||||
<height>1110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_22">
|
||||
@ -2676,7 +2676,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_46">
|
||||
@ -2827,7 +2827,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
@ -3170,7 +3170,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_30">
|
||||
@ -3601,7 +3601,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_39">
|
||||
@ -3869,8 +3869,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<width>843</width>
|
||||
<height>828</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_31">
|
||||
@ -4448,7 +4448,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
@ -4587,140 +4587,11 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QgsCollapsibleGroupBox" name="grpProjectionBehavior">
|
||||
<property name="title">
|
||||
<string>CRS for new layers</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_14" columnstretch="0,1">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When a new layer is created, or when a layer is loaded that has no CRS</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radPromptForProjection">
|
||||
<property name="text">
|
||||
<string>Pro&mpt for CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radUseProjectProjection">
|
||||
<property name="text">
|
||||
<string>Use pro&ject CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radUseGlobalProjection">
|
||||
<property name="text">
|
||||
<string>Use a default CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QgsProjectionSelectionWidget" name="leLayerGlobalCrs" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QgsCollapsibleGroupBox" name="grpOtfTransform">
|
||||
<property name="title">
|
||||
<string>Default CRS for new projects</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_16" columnstretch="0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radOtfNone">
|
||||
<property name="text">
|
||||
<string>Don't enable 'on the fl&y' reprojection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_43">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radOtfAuto">
|
||||
<property name="whatsThis">
|
||||
<string>Automatically enable 'on the fly' reprojection if CRS of a new added layer differ from CRS of layer(s) already present. CRS of present layer(s) will be used.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically enable 'on the fly' reprojection if layers ha&ve different CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radOtfTransform">
|
||||
<property name="text">
|
||||
<string>Enable 'on t&he fly' reprojection by default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Always start new projects with following CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QgsProjectionSelectionWidget" name="leProjectGlobalCrs" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" rowspan="2">
|
||||
<item row="5" column="0" rowspan="2">
|
||||
<widget class="QgsCollapsibleGroupBox" name="mDefaultDatumTransformGroupBox">
|
||||
<property name="title">
|
||||
<string>Default datum transformations</string>
|
||||
@ -4799,6 +4670,102 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Default CRS for new projects</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsProjectionSelectionWidget" name="leProjectGlobalCrs" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QgsCollapsibleGroupBox" name="grpProjectionBehavior">
|
||||
<property name="title">
|
||||
<string>CRS for new layers</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_14" columnstretch="0,1">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When a new layer is created, or when a layer is loaded that has no CRS</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radPromptForProjection">
|
||||
<property name="text">
|
||||
<string>Pro&mpt for CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radUseProjectProjection">
|
||||
<property name="text">
|
||||
<string>Use pro&ject CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radUseGlobalProjection">
|
||||
<property name="text">
|
||||
<string>Use a default CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QgsProjectionSelectionWidget" name="leLayerGlobalCrs" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -4833,7 +4800,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>857</width>
|
||||
<height>680</height>
|
||||
<height>674</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_32">
|
||||
@ -4942,7 +4909,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>843</width>
|
||||
<height>689</height>
|
||||
<height>790</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
@ -5455,6 +5422,11 @@
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsFilterLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>qgsfilterlineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsColorButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
@ -5502,11 +5474,6 @@
|
||||
<header>qgsautheditorwidgets.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsFilterLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>qgsfilterlineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>mOptionsListWidget</tabstop>
|
||||
@ -5708,11 +5675,6 @@
|
||||
<tabstop>pbnEditPyramidsOptions</tabstop>
|
||||
<tabstop>lstGdalDrivers</tabstop>
|
||||
<tabstop>mOptionsScrollArea_08</tabstop>
|
||||
<tabstop>grpOtfTransform</tabstop>
|
||||
<tabstop>radOtfNone</tabstop>
|
||||
<tabstop>radOtfAuto</tabstop>
|
||||
<tabstop>radOtfTransform</tabstop>
|
||||
<tabstop>leProjectGlobalCrs</tabstop>
|
||||
<tabstop>radPromptForProjection</tabstop>
|
||||
<tabstop>radUseProjectProjection</tabstop>
|
||||
<tabstop>radUseGlobalProjection</tabstop>
|
||||
|
@ -230,7 +230,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mProjOpts_01">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
@ -260,7 +260,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>685</width>
|
||||
<height>784</height>
|
||||
<height>778</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@ -749,8 +749,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>341</width>
|
||||
<height>51</height>
|
||||
<width>685</width>
|
||||
<height>778</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -763,10 +763,10 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="cbxProjectionEnabled">
|
||||
<property name="title">
|
||||
<string>Enable 'on the fly' CRS transformation (OTF)</string>
|
||||
<string>Project Coordinate Reference System (CRS)</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
<item>
|
||||
@ -808,8 +808,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>133</width>
|
||||
<height>100</height>
|
||||
<width>685</width>
|
||||
<height>778</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -894,8 +894,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>369</width>
|
||||
<height>528</height>
|
||||
<width>685</width>
|
||||
<height>778</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
@ -1361,8 +1361,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>607</width>
|
||||
<height>2181</height>
|
||||
<width>671</width>
|
||||
<height>2451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
@ -2441,8 +2441,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>161</width>
|
||||
<height>51</height>
|
||||
<width>165</width>
|
||||
<height>57</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
@ -2585,12 +2585,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsColorButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
@ -2598,15 +2592,9 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCodeEditorPython</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgscodeeditorpython.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsProjectionSelectionTreeWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgsprojectionselectiontreewidget.h</header>
|
||||
<class>QgsCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
@ -2621,6 +2609,18 @@
|
||||
<header location="global">qgsvariableeditorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCodeEditorPython</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgscodeeditorpython.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsProjectionSelectionTreeWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgsprojectionselectiontreewidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>mOptionsListWidget</tabstop>
|
||||
|
@ -188,9 +188,6 @@ void QgsBench::render()
|
||||
//mMapRenderer->setMapUnits( outputCRS.mapUnits() );
|
||||
//mMapRenderer->setDestinationCrs( outputCRS );
|
||||
|
||||
// TODO: this should be probably set according to project
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
|
||||
// Enable labeling
|
||||
mMapSettings.setFlag( QgsMapSettings::DrawLabeling );
|
||||
|
||||
|
@ -87,7 +87,6 @@ void TestQgsAttributeTable::testFieldCalculation()
|
||||
tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
@ -138,7 +137,6 @@ void TestQgsAttributeTable::testFieldCalculationArea()
|
||||
tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
|
@ -85,7 +85,6 @@ void TestQgsFieldCalculator::testLengthCalculations()
|
||||
tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
@ -147,7 +146,6 @@ void TestQgsFieldCalculator::testAreaCalculations()
|
||||
tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
|
@ -127,7 +127,6 @@ void TestQgsMapToolIdentifyAction::lengthCalculation()
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
canvas->setCrsTransformEnabled( true );
|
||||
canvas->setDestinationCrs( srs );
|
||||
canvas->setExtent( f1.geometry().boundingBox() );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
@ -181,7 +180,6 @@ void TestQgsMapToolIdentifyAction::perimeterCalculation()
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
canvas->setCrsTransformEnabled( true );
|
||||
canvas->setDestinationCrs( srs );
|
||||
canvas->setExtent( f1.geometry().boundingBox() );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
@ -236,7 +234,6 @@ void TestQgsMapToolIdentifyAction::areaCalculation()
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
canvas->setCrsTransformEnabled( true );
|
||||
canvas->setDestinationCrs( srs );
|
||||
canvas->setExtent( f1.geometry().boundingBox() );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
|
@ -90,9 +90,7 @@ void TestQgsMeasureTool::testLengthCalculation()
|
||||
s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
mCanvas->setCrsTransformEnabled( true );
|
||||
mCanvas->setDestinationCrs( srs );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
@ -157,9 +155,7 @@ void TestQgsMeasureTool::testAreaCalculation()
|
||||
s.setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), true );
|
||||
|
||||
// set project CRS and ellipsoid
|
||||
QgisApp::instance()->mapCanvas()->setCrsTransformEnabled( true );
|
||||
QgsCoordinateReferenceSystem srs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
mCanvas->setCrsTransformEnabled( true );
|
||||
mCanvas->setDestinationCrs( srs );
|
||||
QgsProject::instance()->setCrs( srs );
|
||||
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
|
||||
|
@ -254,7 +254,6 @@ void TestQgsComposerMap::dataDefinedLayers()
|
||||
delete mComposition;
|
||||
QgsMapSettings ms;
|
||||
ms.setLayers( QList<QgsMapLayer*>() << mRasterLayer << mPolysLayer << mPointsLayer << mLinesLayer );
|
||||
ms.setCrsTransformEnabled( true );
|
||||
|
||||
mComposition = new QgsComposition( QgsProject::instance() );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
@ -100,7 +100,6 @@ void TestQgsComposerMapGrid::init()
|
||||
{
|
||||
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem( 32633 );
|
||||
mMapSettings->setDestinationCrs( crs );
|
||||
mMapSettings->setCrsTransformEnabled( false );
|
||||
mComposition = new QgsComposition( QgsProject::instance() );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
|
||||
|
@ -140,13 +140,11 @@ void TestQgsInvertedPolygon::projectionTest()
|
||||
{
|
||||
mReport += QLatin1String( "<h2>Inverted polygon renderer, projection test</h2>\n" );
|
||||
mMapSettings.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:2154" ) ) );
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
QgsRectangle extent( QgsPoint( -8639421, 8382691 ), QgsPoint( -3969110, 12570905 ) );
|
||||
QVERIFY( setQml( mpPolysLayer, "inverted_polys_single.qml" ) );
|
||||
QVERIFY( imageCheck( "inverted_polys_projection", &extent ) );
|
||||
QVERIFY( setQml( mpPolysLayer, "inverted_polys_preprocess.qml" ) );
|
||||
QVERIFY( imageCheck( "inverted_polys_projection2", &extent ) );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
}
|
||||
|
||||
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_MAJOR >= 2
|
||||
|
@ -313,7 +313,6 @@ void TestQgsTracer::testReprojection()
|
||||
QgsTracer tracer;
|
||||
tracer.setLayers( QList<QgsVectorLayer*>() << vl );
|
||||
tracer.setDestinationCrs( dstCrs );
|
||||
tracer.setCrsTransformEnabled( true );
|
||||
tracer.init();
|
||||
|
||||
QgsPolyline points1 = tracer.findShortestPath( p1, p2 );
|
||||
|
@ -40,7 +40,6 @@ class TestProjectionIssues : public QObject
|
||||
void init();// will be called before each testfunction is executed.
|
||||
void cleanup();// will be called after every testfunction.
|
||||
void issue5895();// test for #5895
|
||||
void issue15183();// test for #15183
|
||||
|
||||
private:
|
||||
QgsRasterLayer* mRasterLayer = nullptr;
|
||||
@ -83,7 +82,6 @@ void TestProjectionIssues::initTestCase()
|
||||
QgsCoordinateReferenceSystem destCRS;
|
||||
destCRS.createFromId( 3006, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
mMapCanvas->setDestinationCrs( destCRS );
|
||||
mMapCanvas->setCrsTransformEnabled( true );
|
||||
|
||||
}
|
||||
|
||||
@ -111,28 +109,5 @@ void TestProjectionIssues::issue5895()
|
||||
mMapCanvas->zoomByFactor( 2.0 ); // Zoom out. This should exceed the transform limits.
|
||||
}
|
||||
|
||||
void TestProjectionIssues::issue15183()
|
||||
{
|
||||
QgsRectangle largeExtent( -610861, 5101721, 2523921, 6795055 );
|
||||
mMapCanvas->setExtent( largeExtent );
|
||||
|
||||
// Set to CRS's
|
||||
QgsCoordinateReferenceSystem sourceCRS;
|
||||
sourceCRS = mMapCanvas->mapSettings().destinationCrs();
|
||||
QgsCoordinateReferenceSystem targetCRS;
|
||||
targetCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
|
||||
QgsCoordinateTransform ct( sourceCRS, targetCRS );
|
||||
QgsRectangle initialExtent = ct.transformBoundingBox( mMapCanvas->extent() );
|
||||
|
||||
mMapCanvas->setCrsTransformEnabled( false );
|
||||
mMapCanvas->setDestinationCrs( targetCRS );
|
||||
|
||||
QgsRectangle currentExtent = mMapCanvas->extent();
|
||||
|
||||
// Compare center
|
||||
QGSCOMPARENEARPOINT( initialExtent.center(), currentExtent.center(), 0.00001 );
|
||||
}
|
||||
|
||||
QGSTEST_MAIN( TestProjectionIssues )
|
||||
#include "testprojectionissues.moc"
|
||||
|
@ -36,7 +36,6 @@ class TestQgsComposerLabel(unittest.TestCase):
|
||||
# create composition with composer map
|
||||
mapSettings = QgsMapSettings()
|
||||
mapSettings.setLayers([mVectorLayer])
|
||||
mapSettings.setCrsTransformEnabled(False)
|
||||
|
||||
mComposition = QgsComposition(QgsProject.instance())
|
||||
mComposition.setPaperSize(297, 210)
|
||||
|
@ -54,7 +54,6 @@ class TestQgsComposerLegend(unittest.TestCase):
|
||||
|
||||
s = QgsMapSettings()
|
||||
s.setLayers([point_layer])
|
||||
s.setCrsTransformEnabled(False)
|
||||
composition = QgsComposition(QgsProject.instance())
|
||||
composition.setPaperSize(297, 210)
|
||||
|
||||
@ -90,7 +89,6 @@ class TestQgsComposerLegend(unittest.TestCase):
|
||||
|
||||
s = QgsMapSettings()
|
||||
s.setLayers([point_layer])
|
||||
s.setCrsTransformEnabled(False)
|
||||
composition = QgsComposition(QgsProject.instance())
|
||||
composition.setPaperSize(297, 210)
|
||||
|
||||
@ -129,7 +127,6 @@ class TestQgsComposerLegend(unittest.TestCase):
|
||||
|
||||
s = QgsMapSettings()
|
||||
s.setLayers([point_layer])
|
||||
s.setCrsTransformEnabled(False)
|
||||
composition = QgsComposition(QgsProject.instance())
|
||||
composition.setPaperSize(297, 210)
|
||||
|
||||
@ -172,7 +169,6 @@ class TestQgsComposerLegend(unittest.TestCase):
|
||||
|
||||
s = QgsMapSettings()
|
||||
s.setLayers([point_layer])
|
||||
s.setCrsTransformEnabled(False)
|
||||
composition = QgsComposition(QgsProject.instance())
|
||||
composition.setPaperSize(297, 210)
|
||||
|
||||
|
@ -43,7 +43,6 @@ class TestQgsComposerMap(unittest.TestCase):
|
||||
self.mMapSettings = QgsMapSettings()
|
||||
crs = QgsCoordinateReferenceSystem(32633)
|
||||
self.mMapSettings.setDestinationCrs(crs)
|
||||
self.mMapSettings.setCrsTransformEnabled(False)
|
||||
self.mComposition = QgsComposition(QgsProject.instance())
|
||||
self.mComposition.setPaperSize(297, 210)
|
||||
self.mComposerMap = QgsComposerMap(self.mComposition, 20, 20, 200, 100)
|
||||
|
@ -212,7 +212,6 @@ class TestQgsPalLabeling(unittest.TestCase):
|
||||
ms.setFlag(QgsMapSettings.UseAdvancedEffects, False)
|
||||
ms.setFlag(QgsMapSettings.ForceVectorOutput, False) # no caching?
|
||||
ms.setDestinationCrs(crs)
|
||||
ms.setCrsTransformEnabled(False)
|
||||
ms.setMapUnits(crs.mapUnits()) # meters
|
||||
ms.setExtent(cls.aoiExtent())
|
||||
return ms
|
||||
@ -228,7 +227,6 @@ class TestQgsPalLabeling(unittest.TestCase):
|
||||
ms.setOutputDpi(oms.outputDpi())
|
||||
ms.setFlags(oms.flags())
|
||||
ms.setDestinationCrs(oms.destinationCrs())
|
||||
ms.setCrsTransformEnabled(oms.hasCrsTransformEnabled())
|
||||
ms.setMapUnits(oms.mapUnits())
|
||||
ms.setExtent(oms.extent())
|
||||
ms.setOutputImageFormat(oms.outputImageFormat())
|
||||
|
@ -259,8 +259,6 @@ def mapSettingsString(ms):
|
||||
s += ' visibleExtent():\n {0}\n'.format(
|
||||
ms.visibleExtent().toString().replace(' : ', '\n '))
|
||||
s += ' fullExtent():\n {0}\n'.format(full_ext.replace(' : ', '\n '))
|
||||
s += ' hasCrsTransformEnabled(): {0}\n'.format(
|
||||
ms.hasCrsTransformEnabled())
|
||||
s += ' destinationCrs(): {0}\n'.format(
|
||||
ms.destinationCrs().authid())
|
||||
s += ' flag.Antialiasing: {0}\n'.format(
|
||||
|
Loading…
x
Reference in New Issue
Block a user