Skip to content
Permalink
Browse files

catch projection exceptions while V2 rendering

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12615 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 24, 2009
1 parent 7610e16 commit b76cd8114a75cb453e888b3298df7f25eaf0d438
Showing with 38 additions and 17 deletions.
  1. +38 −17 src/core/qgsvectorlayer.cpp
@@ -39,6 +39,7 @@
#include <QPolygonF>
#include <QSettings>
#include <QString>
#include <QDomNode>

#include "qgsvectorlayer.h"

@@ -703,23 +704,33 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
QgsFeature fet;
while ( nextFeature( fet ) )
{
bool sel = mSelectedFeatureIds.contains( fet.id() );
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );
try
{
bool sel = mSelectedFeatureIds.contains( fet.id() );
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );

// render feature
if ( sel )
selRenderer->renderFeature( fet, rendererContext, -1, drawMarker );
else
mRendererV2->renderFeature( fet, rendererContext, -1, drawMarker );
// render feature
if ( sel )
selRenderer->renderFeature( fet, rendererContext, -1, drawMarker );
else
mRendererV2->renderFeature( fet, rendererContext, -1, drawMarker );

// labeling - register feature
if ( labeling && mRendererV2->symbolForFeature( fet ) != NULL )
rendererContext.labelingEngine()->registerFeature( this, fet );
// labeling - register feature
if ( labeling && mRendererV2->symbolForFeature( fet ) != NULL )
rendererContext.labelingEngine()->registerFeature( this, fet );

if ( mEditable )
if ( mEditable )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
mCachedGeometries[fet.id()] = *fet.geometry();
}
}
catch ( const QgsCsException &cse )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
mCachedGeometries[fet.id()] = *fet.geometry();
QString msg( "Failed to transform a point while drawing a feature of type '"
+ fet.typeName() + "'. Ignoring this feature." );
msg += cse.what();
QgsLogger::warning( msg );
}
}

@@ -809,10 +820,20 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo
// maybe vertex markers should be drawn only during the last pass...
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );

if ( sel )
selRenderer->renderFeature( *fit, rendererContext, -1, drawMarker );
else
mRendererV2->renderFeature( *fit, rendererContext, layer, drawMarker );
try
{
if ( sel )
selRenderer->renderFeature( *fit, rendererContext, -1, drawMarker );
else
mRendererV2->renderFeature( *fit, rendererContext, layer, drawMarker );
}
catch ( const QgsCsException &cse )
{
QString msg( "Failed to transform a point while drawing a feature of type '"
+ fet.typeName() + "'. Ignoring this feature." );
msg += cse.what();
QgsLogger::warning( msg );
}
}
}
}

0 comments on commit b76cd81

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