Skip to content
Permalink
Browse files

Catch crs transformation exceptions in gpsmarker

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14437 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Oct 27, 2010
1 parent d8ae3c1 commit 3c8f0263568a8a5db86c9ca6d445b8ca25238727
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/app/gps/qgsgpsmarker.cpp
@@ -24,7 +24,7 @@


QgsGpsMarker::QgsGpsMarker( QgsMapCanvas* mapCanvas )
: QgsMapCanvasItem( mapCanvas )
: QgsMapCanvasItem( mapCanvas )
{
mSize = 16;
mWgs84CRS.createFromEpsg( 4326 );
@@ -38,10 +38,17 @@ void QgsGpsMarker::setSize( int theSize )
void QgsGpsMarker::setCenter( const QgsPoint& point )
{
//transform to map crs
if ( mMapCanvas && mMapCanvas->mapRenderer() )
if( mMapCanvas && mMapCanvas->mapRenderer() )
{
QgsCoordinateTransform t( mWgs84CRS, mMapCanvas->mapRenderer()->destinationSrs() );
mCenter = t.transform( point );
try
{
mCenter = t.transform( point );
}
catch( QgsCsException e ) //silently ignore transformation exceptions
{
return;
}
}
else
{
@@ -55,7 +62,7 @@ void QgsGpsMarker::setCenter( const QgsPoint& point )
void QgsGpsMarker::paint( QPainter* p )
{
QSvgRenderer mySVG;
if ( !mySVG.load( QString( ":/images/north_arrows/gpsarrow2.svg" ) ) )
if( !mySVG.load( QString( ":/images/north_arrows/gpsarrow2.svg" ) ) )
{
qDebug( "GPS marker not found!" );
return;
@@ -68,7 +75,7 @@ void QgsGpsMarker::paint( QPainter* p )
QRectF QgsGpsMarker::boundingRect() const
{
float myHalfSize = mSize / 2.0;
return QRectF( -myHalfSize, -myHalfSize, 2.0*myHalfSize, 2.0*myHalfSize );
return QRectF( -myHalfSize, -myHalfSize, 2.0 * myHalfSize, 2.0 * myHalfSize );
}

void QgsGpsMarker::updatePosition()

0 comments on commit 3c8f026

Please sign in to comment.
You can’t perform that action at this time.