Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
move catch block to QgsQuickUtils::transformPoint since it can be inv…
- Loading branch information
|
@@ -19,8 +19,6 @@ |
|
|
#include "qgsquickattributeformmodelbase.h" |
|
|
#include "qgsquickattributeformmodel.h" |
|
|
#include <qgsvectorlayerutils.h> |
|
|
#include "qgsattributeeditorcontainer.h" |
|
|
#include "qgsattributeeditorfield.h" |
|
|
|
|
|
/// @cond PRIVATE |
|
|
|
|
|
|
@@ -32,7 +32,6 @@ |
|
|
|
|
|
#include "qgseditformconfig.h" |
|
|
#include "qgsexpressioncontext.h" |
|
|
#include "qgsattributeeditorcontainer.h" |
|
|
|
|
|
#include "qgis_quick.h" |
|
|
#include "qgsquickattributemodel.h" |
|
|
|
@@ -139,19 +139,12 @@ void QgsQuickPositionKit::updateProjectedPosition() |
|
|
return; |
|
|
|
|
|
QgsPointXY srcPoint = QgsPointXY( mPosition.x(), mPosition.y() ); |
|
|
QgsPointXY projectedPositionXY = srcPoint; |
|
|
try |
|
|
{ |
|
|
projectedPositionXY = QgsQuickUtils::transformPoint( |
|
|
positionCRS(), |
|
|
mMapSettings->destinationCrs(), |
|
|
mMapSettings->transformContext(), |
|
|
srcPoint ); |
|
|
} |
|
|
catch ( const QgsCsException & ) |
|
|
{ |
|
|
QgsDebugMsg( QStringLiteral( "Failed to transform GPS position: " ) + srcPoint.toString() ); |
|
|
} |
|
|
QgsPointXY projectedPositionXY = QgsQuickUtils::transformPoint( |
|
|
positionCRS(), |
|
|
mMapSettings->destinationCrs(), |
|
|
mMapSettings->transformContext(), |
|
|
srcPoint |
|
|
); |
|
|
|
|
|
QgsPoint projectedPosition( projectedPositionXY ); |
|
|
projectedPosition.addZValue( mPosition.z() ); |
|
|
|
@@ -68,9 +68,20 @@ QgsPointXY QgsQuickUtils::transformPoint( const QgsCoordinateReferenceSystem &sr |
|
|
const QgsCoordinateTransformContext &context, |
|
|
const QgsPointXY &srcPoint ) |
|
|
{ |
|
|
QgsCoordinateTransform mTransform( srcCrs, destCrs, context ); |
|
|
QgsPointXY pt = mTransform.transform( srcPoint ); |
|
|
return pt; |
|
|
try |
|
|
{ |
|
|
QgsCoordinateTransform ct( srcCrs, destCrs, context ); |
|
|
if ( ct.isValid() ) |
|
|
{ |
|
|
const QgsPointXY pt = ct.transform( srcPoint ); |
|
|
return pt; |
|
|
} |
|
|
} |
|
|
catch ( QgsCsException &cse ) |
|
|
{ |
|
|
Q_UNUSED( cse ) |
|
|
} |
|
|
return srcPoint; |
|
|
} |
|
|
|
|
|
double QgsQuickUtils::screenUnitsToMeters( QgsQuickMapSettings *mapSettings, int baseLengthPixels ) |
|
|