Skip to content

Commit

Permalink
[afs] Fix picture marker ratio calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 10, 2018
1 parent 22a66ef commit 74172fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/providers/arcgisrest/qgsarcgisrestutils.cpp
Expand Up @@ -758,8 +758,8 @@ std::unique_ptr<QgsMarkerSymbol> QgsArcGisRestUtils::parseEsriPictureMarkerSymbo
markerLayer->setSizeUnit( QgsUnitTypes::RenderPixels );

// only change the default aspect ratio if the server height setting requires this
if ( !qgsDoubleNear( static_cast< double >( widthInPixels ) / heightInPixels, markerLayer->defaultAspectRatio() ) )
markerLayer->setFixedAspectRatio( static_cast< double >( widthInPixels ) / heightInPixels );
if ( !qgsDoubleNear( static_cast< double >( heightInPixels ) / widthInPixels, markerLayer->defaultAspectRatio() ) )
markerLayer->setFixedAspectRatio( static_cast< double >( heightInPixels ) / widthInPixels );

markerLayer->setOffset( QPointF( xOffset, yOffset ) );
markerLayer->setOffsetUnit( QgsUnitTypes::RenderPoints );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/providers/testqgsarcgisrestutils.cpp
Expand Up @@ -225,7 +225,7 @@ void TestQgsArcGisRestUtils::testPictureMarkerSymbol()
QVERIFY( markerLayer );
QCOMPARE( markerLayer->path(), QStringLiteral( "base64:abcdef" ) );
QCOMPARE( markerLayer->size(), 20.0 );
QCOMPARE( markerLayer->fixedAspectRatio(), 0.8 );
QCOMPARE( markerLayer->fixedAspectRatio(), 1.25 );
QCOMPARE( markerLayer->sizeUnit(), QgsUnitTypes::RenderPixels );
QCOMPARE( markerLayer->angle(), -10.0 ); // opposite direction to esri spec!
QCOMPARE( markerLayer->offset(), QPointF( 7, 17 ) );
Expand Down

0 comments on commit 74172fc

Please sign in to comment.