Skip to content
Permalink
Browse files

Correctly handle offset when calculating symbol bleed

  • Loading branch information
nyalldawson committed Jan 30, 2017
1 parent 219a45a commit 7594774dac96a4ab942c3d1da6ff095dd8a1fe46
Showing with 6 additions and 6 deletions.
  1. +4 −4 src/core/symbology-ng/qgsfillsymbollayer.cpp
  2. +2 −2 src/core/symbology-ng/qgslinesymbollayer.cpp
@@ -389,7 +389,7 @@ QgsSymbolLayer* QgsSimpleFillSymbolLayer::createFromSld( QDomElement &element )
double QgsSimpleFillSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
{
double penBleed = context.convertToPainterUnits( mBorderStyle == Qt::NoPen ? 0 : ( mBorderWidth / 2.0 ), mBorderWidthUnit, mBorderWidthMapUnitScale );
double offsetBleed = context.convertToPainterUnits( mOffset.x() > mOffset.y() ? mOffset.x() : mOffset.y(), mOffsetUnit, mOffsetMapUnitScale );
double offsetBleed = context.convertToPainterUnits( qMax( qAbs( mOffset.x() ), qAbs( mOffset.y() ) ), mOffsetUnit, mOffsetMapUnitScale );
return penBleed + offsetBleed;
}

@@ -909,7 +909,7 @@ QgsGradientFillSymbolLayer* QgsGradientFillSymbolLayer::clone() const

double QgsGradientFillSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
{
double offsetBleed = context.convertToPainterUnits( mOffset.x() > mOffset.y() ? mOffset.x() : mOffset.y(), mOffsetUnit, mOffsetMapUnitScale );
double offsetBleed = context.convertToPainterUnits( qMax( qAbs( mOffset.x() ), qAbs( mOffset.y() ) ), mOffsetUnit, mOffsetMapUnitScale );
return offsetBleed;
}

@@ -1504,7 +1504,7 @@ QgsShapeburstFillSymbolLayer* QgsShapeburstFillSymbolLayer::clone() const

double QgsShapeburstFillSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
{
double offsetBleed = context.convertToPainterUnits( qMax( mOffset.x(), mOffset.y() ), mOffsetUnit, mOffsetMapUnitScale );
double offsetBleed = context.convertToPainterUnits( qMax( qAbs( mOffset.x() ), qAbs( mOffset.y() ) ), mOffsetUnit, mOffsetMapUnitScale );
return offsetBleed;
}

@@ -3727,7 +3727,7 @@ QgsRasterFillSymbolLayer* QgsRasterFillSymbolLayer::clone() const

double QgsRasterFillSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
{
return context.convertToPainterUnits( mOffset.x() > mOffset.y() ? mOffset.x() : mOffset.y(), mOffsetUnit, mOffsetMapUnitScale );
return context.convertToPainterUnits( qMax( qAbs( mOffset.x() ), qAbs( mOffset.y() ) ), mOffsetUnit, mOffsetMapUnitScale );
}

void QgsRasterFillSymbolLayer::setImageFilePath( const QString &imagePath )
@@ -576,7 +576,7 @@ double QgsSimpleLineSymbolLayer::estimateMaxBleed( const QgsRenderContext& conte
else
{
return context.convertToPainterUnits(( mWidth / 2.0 ), mWidthUnit, mWidthMapUnitScale ) +
context.convertToPainterUnits( mOffset, mOffsetUnit, mOffsetMapUnitScale );
context.convertToPainterUnits( qAbs( mOffset ), mOffsetUnit, mOffsetMapUnitScale );
}
}

@@ -1597,7 +1597,7 @@ QSet<QString> QgsMarkerLineSymbolLayer::usedAttributes( const QgsRenderContext&
double QgsMarkerLineSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
{
return context.convertToPainterUnits(( mMarker->size() / 2.0 ), mMarker->sizeUnit(), mMarker->sizeMapUnitScale() ) +
context.convertToPainterUnits( mOffset, mOffsetUnit, mOffsetMapUnitScale );
context.convertToPainterUnits( qAbs( mOffset ), mOffsetUnit, mOffsetMapUnitScale );
}


0 comments on commit 7594774

Please sign in to comment.
You can’t perform that action at this time.