mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Fix line pattern fill symbol corruption with negative angles
This commit is contained in:
parent
e277b91087
commit
0f056b500a
@ -2560,6 +2560,9 @@ void QgsLinePatternFillSymbolLayer::applyPattern( const QgsSymbolRenderContext &
|
|||||||
|
|
||||||
//create image
|
//create image
|
||||||
int height, width;
|
int height, width;
|
||||||
|
lineAngle = std::fmod( lineAngle, 360 );
|
||||||
|
if ( lineAngle < 0 )
|
||||||
|
lineAngle += 360;
|
||||||
if ( qgsDoubleNear( lineAngle, 0 ) || qgsDoubleNear( lineAngle, 360 ) || qgsDoubleNear( lineAngle, 180 ) )
|
if ( qgsDoubleNear( lineAngle, 0 ) || qgsDoubleNear( lineAngle, 360 ) || qgsDoubleNear( lineAngle, 180 ) )
|
||||||
{
|
{
|
||||||
height = outputPixelDist;
|
height = outputPixelDist;
|
||||||
@ -2585,7 +2588,7 @@ void QgsLinePatternFillSymbolLayer::applyPattern( const QgsSymbolRenderContext &
|
|||||||
height = std::abs( height );
|
height = std::abs( height );
|
||||||
width = std::abs( width );
|
width = std::abs( width );
|
||||||
|
|
||||||
outputPixelDist = height * std::cos( lineAngle * M_PI / 180 );
|
outputPixelDist = std::abs( height * std::cos( lineAngle * M_PI / 180 ) );
|
||||||
|
|
||||||
// Round offset to correspond to one pixel height, otherwise lines may
|
// Round offset to correspond to one pixel height, otherwise lines may
|
||||||
// be shifted on tile border if offset falls close to pixel center
|
// be shifted on tile border if offset falls close to pixel center
|
||||||
|
@ -56,6 +56,7 @@ class TestQgsLineFillSymbol : public QObject
|
|||||||
void lineFillSymbol();
|
void lineFillSymbol();
|
||||||
void lineFillSymbolOffset();
|
void lineFillSymbolOffset();
|
||||||
void lineFillLargeOffset();
|
void lineFillLargeOffset();
|
||||||
|
void lineFillNegativeAngle();
|
||||||
|
|
||||||
void dataDefinedSubSymbol();
|
void dataDefinedSubSymbol();
|
||||||
|
|
||||||
@ -165,6 +166,17 @@ void TestQgsLineFillSymbol::lineFillLargeOffset()
|
|||||||
mLineFill->setOffset( 0 );
|
mLineFill->setOffset( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestQgsLineFillSymbol::lineFillNegativeAngle()
|
||||||
|
{
|
||||||
|
mLineFill->setOffset( -8 );
|
||||||
|
mLineFill->setDistance( 2.2 );
|
||||||
|
mLineFill->setLineAngle( -130 );
|
||||||
|
QVERIFY( imageCheck( QStringLiteral( "symbol_linefill_negangle" ) ) );
|
||||||
|
mLineFill->setOffset( 0 );
|
||||||
|
mLineFill->setLineAngle( 45 );
|
||||||
|
mLineFill->setDistance( 5 );
|
||||||
|
}
|
||||||
|
|
||||||
void TestQgsLineFillSymbol::dataDefinedSubSymbol()
|
void TestQgsLineFillSymbol::dataDefinedSubSymbol()
|
||||||
{
|
{
|
||||||
mReport += QLatin1String( "<h2>Line fill symbol data defined sub symbol test</h2>\n" );
|
mReport += QLatin1String( "<h2>Line fill symbol data defined sub symbol test</h2>\n" );
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
Loading…
x
Reference in New Issue
Block a user