mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
fix(geometry_checker): do not call crs() on layer from another thread
This commit is contained in:
parent
b358ab8a9d
commit
fa961c7b5b
@ -58,6 +58,7 @@ The geometry will not be reprojected regardless of useMapCrs.
|
||||
%End
|
||||
|
||||
|
||||
|
||||
QString layerId() const;
|
||||
%Docstring
|
||||
The layer id.
|
||||
|
||||
@ -58,6 +58,7 @@ The geometry will not be reprojected regardless of useMapCrs.
|
||||
%End
|
||||
|
||||
|
||||
|
||||
QString layerId() const;
|
||||
%Docstring
|
||||
The layer id.
|
||||
|
||||
@ -149,7 +149,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
|
||||
{
|
||||
const QMap<QgsFeatureId, QList<QgsGeometryCheck::Change>> &layerChanges = it.value();
|
||||
QgsFeaturePool *featurePool = mFeaturePools[it.key()];
|
||||
QgsCoordinateTransform t( featurePool->layer()->crs(), mContext->mapCrs, QgsProject::instance() );
|
||||
QgsCoordinateTransform t( featurePool->crs(), mContext->mapCrs, QgsProject::instance() );
|
||||
t.setBallparkTransformsAreAppropriate( true );
|
||||
for ( auto layerChangeIt = layerChanges.constBegin(); layerChangeIt != layerChanges.constEnd(); ++layerChangeIt )
|
||||
{
|
||||
@ -189,7 +189,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
|
||||
for ( auto it = mFeaturePools.constBegin(); it != mFeaturePools.constEnd(); it++ )
|
||||
{
|
||||
QgsFeaturePool *featurePool = it.value();
|
||||
QgsCoordinateTransform t( mContext->mapCrs, featurePool->layer()->crs(), QgsProject::instance() );
|
||||
QgsCoordinateTransform t( mContext->mapCrs, featurePool->crs(), QgsProject::instance() );
|
||||
recheckAreaFeatures[it.key()] = featurePool->getIntersects( t.transform( recheckArea ) );
|
||||
}
|
||||
|
||||
|
||||
@ -63,19 +63,15 @@ QgsGeometryCheckError::QgsGeometryCheckError( const QgsGeometryCheck *check,
|
||||
}
|
||||
if ( !layerFeature.useMapCrs() )
|
||||
{
|
||||
QgsVectorLayer *vl = layerFeature.layer().data();
|
||||
if ( vl )
|
||||
const QgsCoordinateTransform ct( layerFeature.layerCrs(), check->context()->mapCrs, check->context()->transformContext );
|
||||
try
|
||||
{
|
||||
const QgsCoordinateTransform ct( vl->crs(), check->context()->mapCrs, check->context()->transformContext );
|
||||
try
|
||||
{
|
||||
mGeometry.transform( ct );
|
||||
mErrorLocation = ct.transform( mErrorLocation );
|
||||
}
|
||||
catch ( const QgsCsException & )
|
||||
{
|
||||
QgsDebugError( QStringLiteral( "Can not show error in current map coordinate reference system" ) );
|
||||
}
|
||||
mGeometry.transform( ct );
|
||||
mErrorLocation = ct.transform( mErrorLocation );
|
||||
}
|
||||
catch ( const QgsCsException & )
|
||||
{
|
||||
QgsDebugError( QStringLiteral( "Can not show error in current map coordinate reference system" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,11 @@ QgsFeature QgsGeometryCheckerUtils::LayerFeature::feature() const
|
||||
return mFeature;
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystem QgsGeometryCheckerUtils::LayerFeature::layerCrs() const
|
||||
{
|
||||
return mFeaturePool->crs();
|
||||
}
|
||||
|
||||
QPointer<QgsVectorLayer> QgsGeometryCheckerUtils::LayerFeature::layer() const
|
||||
{
|
||||
return mFeaturePool->layerPtr();
|
||||
|
||||
@ -66,6 +66,11 @@ class ANALYSIS_EXPORT QgsGeometryCheckerUtils
|
||||
*/
|
||||
QgsFeature feature() const;
|
||||
|
||||
/**
|
||||
* The layer CRS.
|
||||
*/
|
||||
QgsCoordinateReferenceSystem layerCrs() const SIP_SKIP;
|
||||
|
||||
/**
|
||||
* The layer.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user