Skip to content

Commit

Permalink
add symbol ASSERTions
Browse files Browse the repository at this point in the history
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 87b5030
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
#include <QDomElement>

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

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

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

void QgsSingleSymbolRendererV2::setSymbol( QgsSymbolV2* s )
{
Q_ASSERT( s );
delete mSymbol;
mSymbol = s;
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 87b5030

Please sign in to comment.