mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -05:00
use calculation factor for scale
This commit is contained in:
parent
3d7cc160d4
commit
1c3cfd1e13
@ -170,6 +170,8 @@ Returns the denominator of the default scale used in case of the scale is not gi
|
||||
:param project: the QGIS project
|
||||
|
||||
:return: the denominator of the scale
|
||||
|
||||
.. versionadded:: 3.8
|
||||
%End
|
||||
|
||||
bool wmsUseLayerIds( const QgsProject &project );
|
||||
|
||||
@ -643,13 +643,13 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
|
||||
|
||||
mWMSMaxAtlasFeaturesSpinBox->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), 1 ) );
|
||||
|
||||
//connect this to crs change
|
||||
mWMSDefaultMapUnitsPerMm = new QDoubleSpinBox();
|
||||
mWMSDefaultMapUnitsPerMm->setDecimals( 3 );
|
||||
mWMSDefaultMapUnitsPerMm->setDecimals( 4 );
|
||||
mWMSDefaultMapUnitsPerMm->setSingleStep( 0.001 );
|
||||
mWMSDefaultMapUnitsPerMm->setValue( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) );
|
||||
|
||||
//care for map units mm, km, inches etc...
|
||||
mWMSDefaultMapUnitScale = new QgsScaleWidget();
|
||||
mWMSDefaultMapUnitScale->setScale( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) * 1000 );
|
||||
mWMSDefaultMapUnitScale->setScale( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) * QgsUnitTypes::fromUnitToUnitFactor( QgsProject::instance()->crs().mapUnits(), QgsUnitTypes::DistanceMillimeters ) );
|
||||
|
||||
if ( QgsProject::instance()->crs().isGeographic() )
|
||||
{
|
||||
@ -1324,7 +1324,7 @@ void QgsProjectProperties::apply()
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultMapUnitsPerMm = mWMSDefaultMapUnitScale->scale() / 1000;
|
||||
defaultMapUnitsPerMm = mWMSDefaultMapUnitScale->scale() / QgsUnitTypes::fromUnitToUnitFactor( QgsProject::instance()->crs().mapUnits(), QgsUnitTypes::DistanceMillimeters );
|
||||
}
|
||||
|
||||
QgsProject::instance()->writeEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), defaultMapUnitsPerMm );
|
||||
|
||||
@ -158,6 +158,7 @@ namespace QgsServerProjectUtils
|
||||
* Returns the denominator of the default scale used in case of the scale is not given
|
||||
* \param project the QGIS project
|
||||
* \return the denominator of the scale
|
||||
* \since QGIS 3.8
|
||||
*/
|
||||
SERVER_EXPORT double wmsDefaultMapUnitsPerMm( const QgsProject &project );
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user