Skip to content

Commit

Permalink
catch projection exceptions while V2 rendering
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12615 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 24, 2009
1 parent 7610e16 commit b76cd81
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <QPolygonF>
#include <QSettings>
#include <QString>
#include <QDomNode>

#include "qgsvectorlayer.h"

Expand Down Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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 );
}
}
}
}
Expand Down

0 comments on commit b76cd81

Please sign in to comment.