Skip to content

Commit

Permalink
Let subsymbols have their own units
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Mar 13, 2013
1 parent 96a01e0 commit af1bde9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -1135,6 +1135,24 @@ QgsPointPatternFillSymbolLayer::~QgsPointPatternFillSymbolLayer()
{
}

void QgsPointPatternFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
{
mDistanceXUnit = unit;
mDistanceYUnit = unit;
mDisplacementXUnit = unit;
mDisplacementYUnit = unit;
}

QgsSymbolV2::OutputUnit QgsPointPatternFillSymbolLayer::outputUnit() const
{
QgsSymbolV2::OutputUnit unit = mDistanceXUnit;
if ( mDistanceYUnit != unit || mDisplacementXUnit != unit || mDisplacementYUnit != unit )
{
return QgsSymbolV2::Mixed;
}
return unit;
}

QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& properties )
{
QgsPointPatternFillSymbolLayer* layer = new QgsPointPatternFillSymbolLayer();
Expand Down Expand Up @@ -1215,7 +1233,6 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
pointRenderContext.setMapToPixel( mtp );
pointRenderContext.setForceVectorOutput( false );

mMarkerSymbol->setOutputUnit( context.outputUnit() );
mMarkerSymbol->startRender( pointRenderContext );

//render corner points
Expand Down
3 changes: 3 additions & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.h
Expand Up @@ -309,6 +309,9 @@ class CORE_EXPORT QgsPointPatternFillSymbolLayer: public QgsImageFillSymbolLayer
void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit ) { mDisplacementYUnit = unit; }
QgsSymbolV2::OutputUnit displacementYUnit() const { return mDisplacementYUnit; }

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;

protected:
QgsMarkerSymbolV2* mMarkerSymbol;
double mDistanceX;
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology-ng/qgslinesymbollayerv2.cpp
Expand Up @@ -419,7 +419,6 @@ void QgsMarkerLineSymbolLayerV2::setColor( const QColor& color )
void QgsMarkerLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
{
mMarker->setAlpha( context.alpha() );
mMarker->setOutputUnit( context.outputUnit() );

// if being rotated, it gets initialized with every line segment
int hints = 0;
Expand Down

0 comments on commit af1bde9

Please sign in to comment.