Skip to content

Commit

Permalink
[afs] Picture marker & picture fill width/height use points as unit type
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 10, 2018
1 parent 74172fc commit ffded6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/providers/arcgisrest/qgsarcgisrestutils.cpp
Expand Up @@ -658,7 +658,7 @@ std::unique_ptr<QgsFillSymbol> QgsArcGisRestUtils::parseEsriPictureFillSymbolJso
std::unique_ptr< QgsRasterFillSymbolLayer > fillLayer = qgis::make_unique< QgsRasterFillSymbolLayer >( symbolPath );
fillLayer->setWidth( widthInPixels );
fillLayer->setAngle( angleCW );
fillLayer->setWidthUnit( QgsUnitTypes::RenderPixels );
fillLayer->setWidthUnit( QgsUnitTypes::RenderPoints );
fillLayer->setOffset( QPointF( xOffset, yOffset ) );
fillLayer->setOffsetUnit( QgsUnitTypes::RenderPoints );
layers.append( fillLayer.release() );
Expand Down Expand Up @@ -755,7 +755,7 @@ std::unique_ptr<QgsMarkerSymbol> QgsArcGisRestUtils::parseEsriPictureMarkerSymbo

QgsSymbolLayerList layers;
std::unique_ptr< QgsRasterMarkerSymbolLayer > markerLayer = qgis::make_unique< QgsRasterMarkerSymbolLayer >( symbolPath, widthInPixels, angleCW, QgsSymbol::ScaleArea );
markerLayer->setSizeUnit( QgsUnitTypes::RenderPixels );
markerLayer->setSizeUnit( QgsUnitTypes::RenderPoints );

// only change the default aspect ratio if the server height setting requires this
if ( !qgsDoubleNear( static_cast< double >( heightInPixels ) / widthInPixels, markerLayer->defaultAspectRatio() ) )
Expand Down
4 changes: 2 additions & 2 deletions tests/src/providers/testqgsarcgisrestutils.cpp
Expand Up @@ -226,7 +226,7 @@ void TestQgsArcGisRestUtils::testPictureMarkerSymbol()
QCOMPARE( markerLayer->path(), QStringLiteral( "base64:abcdef" ) );
QCOMPARE( markerLayer->size(), 20.0 );
QCOMPARE( markerLayer->fixedAspectRatio(), 1.25 );
QCOMPARE( markerLayer->sizeUnit(), QgsUnitTypes::RenderPixels );
QCOMPARE( markerLayer->sizeUnit(), QgsUnitTypes::RenderPoints );
QCOMPARE( markerLayer->angle(), -10.0 ); // opposite direction to esri spec!
QCOMPARE( markerLayer->offset(), QPointF( 7, 17 ) );
QCOMPARE( markerLayer->offsetUnit(), QgsUnitTypes::RenderPoints );
Expand Down Expand Up @@ -333,7 +333,7 @@ void TestQgsArcGisRestUtils::testParsePictureFillSymbol()
QVERIFY( fillLayer );
QCOMPARE( fillLayer->imageFilePath(), QString( "base64:abcdef" ) );
QCOMPARE( fillLayer->width(), 20.0 );
QCOMPARE( fillLayer->widthUnit(), QgsUnitTypes::RenderPixels );
QCOMPARE( fillLayer->widthUnit(), QgsUnitTypes::RenderPoints );
QgsSimpleLineSymbolLayer *lineLayer = dynamic_cast< QgsSimpleLineSymbolLayer * >( fill->symbolLayer( 1 ) );
QVERIFY( lineLayer );
QCOMPARE( lineLayer->color(), QColor( 110, 120, 130, 215 ) );
Expand Down

0 comments on commit ffded6f

Please sign in to comment.