Skip to content
Permalink
Browse files

scale instead of map units in case of projection

  • Loading branch information
signedav committed Apr 8, 2019
1 parent 7ef426b commit 10b5f0858ad5c147ac2a67518cabf0e55e9cbacc
Showing with 32 additions and 21 deletions.
  1. +22 −2 src/app/qgsprojectproperties.cpp
  2. +4 −0 src/app/qgsprojectproperties.h
  3. +6 −19 src/ui/qgsprojectpropertiesbase.ui
@@ -643,7 +643,19 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa

mWMSMaxAtlasFeaturesSpinBox->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), 1 ) );

mWMSDefaultMapUnitsPerMm->setValue( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) );
if ( QgsProject::instance()->crs().isGeographic() )
{
mWMSDefaultMapUnitsPerMm = new QDoubleSpinBox();
mWMSDefaultMapUnitsPerMm->setValue( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) );
mWMSDefaultMapUnitsPerMmLayout->addWidget( mWMSDefaultMapUnitsPerMm );
}
else
{
//care for map units mm, km, inches etc...
mWMSDefaultMapUnitScale = new QgsScaleWidget();
mWMSDefaultMapUnitScale->setScale( QgsProject::instance()->readDoubleEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), 1 ) * 10000 );
mWMSDefaultMapUnitsPerMmLayout->addWidget( mWMSDefaultMapUnitScale );
}

mWMTSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), QString() ) );
mWMTSMinScaleLineEdit->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), 5000 ) );
@@ -1302,7 +1314,15 @@ void QgsProjectProperties::apply()
int maxAtlasFeatures = mWMSMaxAtlasFeaturesSpinBox->value();
QgsProject::instance()->writeEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), maxAtlasFeatures );

double defaultMapUnitsPerMm = mWMSDefaultMapUnitsPerMm->value();
double defaultMapUnitsPerMm;
if ( QgsProject::instance()->crs().isGeographic() )
{
defaultMapUnitsPerMm = mWMSDefaultMapUnitsPerMm->value();
}
else
{
defaultMapUnitsPerMm = mWMSDefaultMapUnitScale->scale() / 10000;
}
QgsProject::instance()->writeEntry( QStringLiteral( "WMSDefaultMapUnitsPerMm" ), QStringLiteral( "/" ), defaultMapUnitsPerMm );

QgsProject::instance()->writeEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), mWMTSUrlLineEdit->text() );
@@ -22,6 +22,7 @@
#include "qgis.h"
#include "qgsunittypes.h"
#include "qgsguiutils.h"
#include "qgsscalewidget.h"
#include "qgshelp.h"
#include "qgis_app.h"

@@ -204,6 +205,9 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
QgsMetadataWidget *mMetadataWidget = nullptr;
QgsLayerCapabilitiesModel *mLayerCapabilitiesModel = nullptr;

QDoubleSpinBox *mWMSDefaultMapUnitsPerMm = nullptr;
QgsScaleWidget *mWMSDefaultMapUnitScale = nullptr;

QgsCoordinateReferenceSystem mCrs;

void checkPageWidgetNameMap();
@@ -265,8 +265,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<height>781</height>
<width>590</width>
<height>777</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
@@ -1514,8 +1514,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<height>781</height>
<width>178</width>
<height>54</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
@@ -1575,9 +1575,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-1101</y>
<y>-975</y>
<width>671</width>
<height>2691</height>
<height>2682</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -2074,19 +2074,6 @@
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="mWMSDefaultMapUnitsPerMm">
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">

0 comments on commit 10b5f08

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