Skip to content
Permalink
Browse files
add symbol ASSERTions
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14253 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 19, 2010
1 parent 6691763 commit 87b5030d425196f8ef23ee7806ea29b0dea62222
Showing with 10 additions and 4 deletions.
  1. +6 −4 src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
  2. +4 −0 src/core/symbology-ng/qgssymbollayerv2utils.cpp
@@ -12,9 +12,10 @@
#include <QDomElement>

QgsSingleSymbolRendererV2::QgsSingleSymbolRendererV2( QgsSymbolV2* symbol )
: QgsFeatureRendererV2( "singleSymbol" ),
mTempSymbol( NULL )
: QgsFeatureRendererV2( "singleSymbol" )
, mTempSymbol( NULL )
{
Q_ASSERT( symbol );
mSymbol = symbol;
}

@@ -59,8 +60,8 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbolForFeature( QgsFeature& feature )

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

mSymbol->startRender( context );

@@ -121,6 +122,7 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbol() const

void QgsSingleSymbolRendererV2::setSymbol( QgsSymbolV2* s )
{
Q_ASSERT( s );
delete mSymbol;
mSymbol = s;
}
@@ -223,6 +223,8 @@ QIcon QgsSymbolLayerV2Utils::symbolPreviewIcon( QgsSymbolV2* symbol, QSize size

QPixmap QgsSymbolLayerV2Utils::symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size )
{
Q_ASSERT( symbol );

QPixmap pixmap( size );
QPainter painter;
painter.begin( &pixmap );
@@ -472,6 +474,8 @@ static QString _nameForSymbolType( QgsSymbolV2::SymbolType type )

QDomElement QgsSymbolLayerV2Utils::saveSymbol( QString name, QgsSymbolV2* symbol, QDomDocument& doc, QgsSymbolV2Map* subSymbols )
{
Q_ASSERT( symbol );

QDomElement symEl = doc.createElement( "symbol" );
symEl.setAttribute( "type", _nameForSymbolType( symbol->type() ) );
symEl.setAttribute( "name", name );

0 comments on commit 87b5030

Please sign in to comment.