Skip to content
Permalink
Browse files
Fixes to arrow line symbology:
- Fix crash in Python bindings caused by subsymbol ownership
- Make symbol work correctly with categorised and graduated
renderers
  • Loading branch information
nyalldawson committed May 5, 2016
1 parent ca74cc0 commit d75eaff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
@@ -23,7 +23,7 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
virtual QgsSymbolV2* subSymbol();

/** Set the sub symbol used for filling */
virtual bool setSubSymbol( QgsSymbolV2* symbol );
virtual bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );

/** Return a list of attributes required to render this feature */
virtual QSet<QString> usedAttributes() const;
@@ -106,6 +106,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2

/** Main drawing method */
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
private:

void setColor( const QColor& c );

private:
QgsArrowSymbolLayer( const QgsArrowSymbolLayer& );
};
@@ -45,6 +45,7 @@ bool QgsArrowSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
mSymbol.reset( static_cast<QgsFillSymbolV2*>( symbol ) );
return true;
}
delete symbol;
return false;
}

@@ -604,3 +605,11 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
context.renderContext().expressionContext().popScope();
}

void QgsArrowSymbolLayer::setColor( const QColor& c )
{
if ( mSymbol.data() )
mSymbol->setColor( c );

mColor = c;
}

@@ -127,6 +127,8 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
/** Main drawing method */
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ) override;

void setColor( const QColor& c ) override;

private:
/** Filling sub symbol */
QScopedPointer<QgsFillSymbolV2> mSymbol;

0 comments on commit d75eaff

Please sign in to comment.