Skip to content
Permalink
Browse files
Some safety checks when working with geometryless layers
git-svn-id: http://svn.osgeo.org/qgis/branches/table_join_branch@14132 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 23, 2010
1 parent e249f60 commit eafcb5a838f0a9dc8c7a185817599581838ab963
Showing with 21 additions and 4 deletions.
  1. +21 −4 src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
@@ -59,6 +59,10 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbolForFeature( QgsFeature& feature )

void QgsSingleSymbolRendererV2::startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer )
{
if ( !mSymbol )
{
return;
}
mRotationFieldIdx = ( mRotationField.isEmpty() ? -1 : vlayer->fieldNameIndex( mRotationField ) );
mSizeScaleFieldIdx = ( mSizeScaleField.isEmpty() ? -1 : vlayer->fieldNameIndex( mSizeScaleField ) );

@@ -93,6 +97,10 @@ void QgsSingleSymbolRendererV2::startRender( QgsRenderContext& context, const Qg

void QgsSingleSymbolRendererV2::stopRender( QgsRenderContext& context )
{
if ( !mSymbol )
{
return;
}
mSymbol->stopRender( context );

if ( mRotationFieldIdx != -1 || mSizeScaleFieldIdx != -1 )
@@ -127,7 +135,14 @@ void QgsSingleSymbolRendererV2::setSymbol( QgsSymbolV2* s )

QString QgsSingleSymbolRendererV2::dump()
{
return QString( "SINGLE: %1" ).arg( mSymbol->dump() );
if ( mSymbol )
{
return QString( "SINGLE: %1" ).arg( mSymbol->dump() );
}
else
{
return "";
}
}

QgsFeatureRendererV2* QgsSingleSymbolRendererV2::clone()
@@ -198,10 +213,12 @@ QDomElement QgsSingleSymbolRendererV2::save( QDomDocument& doc )

QgsLegendSymbologyList QgsSingleSymbolRendererV2::legendSymbologyItems( QSize iconSize )
{
QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( mSymbol, iconSize );

QgsLegendSymbologyList lst;
lst << qMakePair( QString(), pix );
if ( mSymbol )
{
QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( mSymbol, iconSize );
lst << qMakePair( QString(), pix );
}
return lst;
}

0 comments on commit eafcb5a

Please sign in to comment.