Skip to content
Permalink
Browse files

Rename conversionFactor to scaleFactor

  • Loading branch information
m-kuhn committed Sep 10, 2018
1 parent 57677f6 commit cf82c13324a72bcae0f40deabaed45d86b014643
@@ -358,11 +358,11 @@ been modified in order to ensure that outdated CRS transforms are not created.
.. versionadded:: 3.0
%End

double conversionFactor( const QgsRectangle &referenceExtent ) const;
double scaleFactor( const QgsRectangle &referenceExtent ) const;
%Docstring
Computes an *estimated* conversion factor between source and destination units:

sourceUnits * conversionFactor = destinationUnits
sourceUnits * scaleFactor = destinationUnits

:param referenceExtent: A reference extent based on which to perform the computation

@@ -799,7 +799,7 @@ void QgsCoordinateTransform::invalidateCache()
sCacheLock.unlock();
}

double QgsCoordinateTransform::conversionFactor( const QgsRectangle &ReferenceExtent ) const
double QgsCoordinateTransform::scaleFactor( const QgsRectangle &ReferenceExtent ) const
{
QgsPointXY source1( ReferenceExtent.xMinimum(), ReferenceExtent.yMinimum() );
QgsPointXY source2( ReferenceExtent.xMaximum(), ReferenceExtent.yMaximum() );
@@ -408,13 +408,13 @@ class CORE_EXPORT QgsCoordinateTransform
/**
* Computes an *estimated* conversion factor between source and destination units:
*
* sourceUnits * conversionFactor = destinationUnits
* sourceUnits * scaleFactor = destinationUnits
*
* \param referenceExtent A reference extent based on which to perform the computation
*
* \since QGIS 3.4
*/
double conversionFactor( const QgsRectangle &referenceExtent ) const;
double scaleFactor( const QgsRectangle &referenceExtent ) const;

private:

@@ -396,7 +396,7 @@ QgsCoordinateTransform QgsMapSettings::layerTransform( const QgsMapLayer *layer

double QgsMapSettings::layerToMapUnits( const QgsMapLayer *layer, const QgsRectangle &referenceExtent ) const
{
return layerTransform( layer ).conversionFactor( referenceExtent );
return layerTransform( layer ).scaleFactor( referenceExtent );
}


@@ -36,8 +36,8 @@ class TestQgsCoordinateTransform: public QObject
void isValid();
void isShortCircuited();
void contextShared();
void conversionFactor();
void conversionFactor_data();
void scaleFactor();
void scaleFactor_data();

private:

@@ -215,7 +215,7 @@ void TestQgsCoordinateTransform::contextShared()
QCOMPARE( copy2.sourceDestinationDatumTransforms(), expected );
}

void TestQgsCoordinateTransform::conversionFactor()
void TestQgsCoordinateTransform::scaleFactor()
{
QFETCH( QgsCoordinateReferenceSystem, sourceCrs );
QFETCH( QgsCoordinateReferenceSystem, destCrs );
@@ -224,11 +224,11 @@ void TestQgsCoordinateTransform::conversionFactor()

QgsCoordinateTransform ct( sourceCrs, destCrs, QgsProject::instance() );

// qDebug() << QString::number(ct.conversionFactor( rect ), 'g', 17) ;
QVERIFY( qgsDoubleNear( ct.conversionFactor( rect ), factor ) );
// qDebug() << QString::number(ct.scaleFactor( rect ), 'g', 17) ;
QVERIFY( qgsDoubleNear( ct.scaleFactor( rect ), factor ) );
}

void TestQgsCoordinateTransform::conversionFactor_data()
void TestQgsCoordinateTransform::scaleFactor_data()
{
QTest::addColumn<QgsCoordinateReferenceSystem>( "sourceCrs" );
QTest::addColumn<QgsCoordinateReferenceSystem>( "destCrs" );

0 comments on commit cf82c13

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