mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
Simplify code and set default to 10 for old connections
This commit is contained in:
parent
022706179f
commit
751cb4f5d9
@ -74,7 +74,7 @@ const QgsSettingsEntryBool *QgsOwsConnection::settingsInvertAxisOrientation = ne
|
||||
const QgsSettingsEntryString *QgsOwsConnection::settingsUsername = new QgsSettingsEntryString( QStringLiteral( "username" ), sTreeOwsConnections ) ;
|
||||
const QgsSettingsEntryString *QgsOwsConnection::settingsPassword = new QgsSettingsEntryString( QStringLiteral( "password" ), sTreeOwsConnections ) ;
|
||||
const QgsSettingsEntryString *QgsOwsConnection::settingsAuthCfg = new QgsSettingsEntryString( QStringLiteral( "authcfg" ), sTreeOwsConnections ) ;
|
||||
const QgsSettingsEntryInteger *QgsOwsConnection::settingsDefaultFeatureCount = new QgsSettingsEntryInteger( QStringLiteral( "default-feature-count" ), sTreeOwsConnections, 10 );
|
||||
const QgsSettingsEntryInteger *QgsOwsConnection::settingsFeatureCount = new QgsSettingsEntryInteger( QStringLiteral( "feature-count" ), sTreeOwsConnections, 10 );
|
||||
|
||||
QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connName )
|
||||
: mConnName( connName )
|
||||
@ -213,9 +213,9 @@ QgsDataSourceUri &QgsOwsConnection::addWmsWcsConnectionSettings( QgsDataSourceUr
|
||||
{
|
||||
uri.setParam( QStringLiteral( "tilePixelRatio" ), QString::number( static_cast<int>( settingsTilePixelRatio->value( {service.toLower(), connName} ) ) ) );
|
||||
}
|
||||
if ( settingsDefaultFeatureCount->exists( {service.toLower(), connName} ) )
|
||||
if ( settingsFeatureCount->exists( {service.toLower(), connName} ) )
|
||||
{
|
||||
uri.setParam( QStringLiteral( "defaultFeatureCount" ), QString::number( settingsDefaultFeatureCount->value( {service.toLower(), connName} ) ) );
|
||||
uri.setParam( QStringLiteral( "featureCount" ), QString::number( settingsFeatureCount->value( {service.toLower(), connName} ) ) );
|
||||
}
|
||||
|
||||
return uri;
|
||||
|
@ -115,7 +115,7 @@ class CORE_EXPORT QgsOwsConnection : public QObject
|
||||
static const QgsSettingsEntryString *settingsUsername;
|
||||
static const QgsSettingsEntryString *settingsPassword;
|
||||
static const QgsSettingsEntryString *settingsAuthCfg;
|
||||
static const QgsSettingsEntryInteger *settingsDefaultFeatureCount;
|
||||
static const QgsSettingsEntryInteger *settingsFeatureCount;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -141,10 +141,10 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ
|
||||
cbxIgnoreGetFeatureInfoURI->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
|
||||
|
||||
sbDefaultFeatureCount->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( sbDefaultFeatureCount );
|
||||
lblDefaultFeatureCount->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( lblDefaultFeatureCount );
|
||||
sbFeatureCount->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( sbFeatureCount );
|
||||
lblFeatureCount->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( lblFeatureCount );
|
||||
|
||||
cmbDpiMode->setVisible( false );
|
||||
mGroupBox->layout()->removeWidget( cmbDpiMode );
|
||||
@ -325,7 +325,7 @@ void QgsNewHttpConnection::updateServiceSpecificSettings()
|
||||
Qgis::TilePixelRatio tilePixelRatio = QgsOwsConnection::settingsTilePixelRatio->value( detailsParameters );
|
||||
cmbTilePixelRatio->setCurrentIndex( cmbTilePixelRatio->findData( static_cast<int>( tilePixelRatio ) ) );
|
||||
|
||||
sbDefaultFeatureCount->setValue( QgsOwsConnection::settingsDefaultFeatureCount->value( detailsParameters ) );
|
||||
sbFeatureCount->setValue( QgsOwsConnection::settingsFeatureCount->value( detailsParameters ) );
|
||||
|
||||
const QString version = QgsOwsConnection::settingsVersion->value( detailsParameters );
|
||||
int versionIdx = WFS_VERSION_MAX; // AUTO
|
||||
@ -433,7 +433,7 @@ void QgsNewHttpConnection::accept()
|
||||
if ( mTypes & ConnectionWms )
|
||||
{
|
||||
QgsOwsConnection::settingsIgnoreGetFeatureInfoURI->setValue( cbxIgnoreGetFeatureInfoURI->isChecked(), detailsParameters );
|
||||
QgsOwsConnection::settingsDefaultFeatureCount->setValue( sbDefaultFeatureCount->value(), detailsParameters );
|
||||
QgsOwsConnection::settingsFeatureCount->setValue( sbFeatureCount->value(), detailsParameters );
|
||||
}
|
||||
if ( mTypes & ConnectionWfs )
|
||||
{
|
||||
|
@ -463,18 +463,11 @@ QString QgsWMSItemBase::createUri( bool withStyle )
|
||||
}
|
||||
mDataSourceUri.setParam( QStringLiteral( "crs" ), crs );
|
||||
|
||||
// Set featureCount if the connection has a valid default value
|
||||
if ( mDataSourceUri.hasParam( QStringLiteral( "defaultFeatureCount" ) ) )
|
||||
// Set default featureCount to 10, old connections might miss this
|
||||
// setting.
|
||||
if ( ! mDataSourceUri.hasParam( QStringLiteral( "featureCount" ) ) )
|
||||
{
|
||||
bool ok;
|
||||
mDataSourceUri.param( QStringLiteral( "defaultFeatureCount" ) ).toInt( &ok );
|
||||
if ( ok )
|
||||
{
|
||||
// Used by the provider
|
||||
mDataSourceUri.setParam( QStringLiteral( "featureCount" ), mDataSourceUri.param( QStringLiteral( "defaultFeatureCount" ) ) );
|
||||
}
|
||||
// Not used by the provider: remove it
|
||||
mDataSourceUri.removeParam( QStringLiteral( "defaultFeatureCount" ) );
|
||||
mDataSourceUri.setParam( QStringLiteral( "featureCount" ), QStringLiteral( "10" ) );
|
||||
}
|
||||
|
||||
//uri = rasterLayerPath + "|layers=" + layers.join( "," ) + "|styles=" + styles.join( "," ) + "|format=" + format + "|crs=" + crs;
|
||||
|
@ -469,16 +469,16 @@ void QgsWMSSourceSelect::btnConnect_clicked()
|
||||
QgsWMSConnection connection( cmbConnections->currentText() );
|
||||
mUri = connection.uri();
|
||||
|
||||
bool defaultFeatureCountSet { };
|
||||
if ( connection.uri().hasParam( QStringLiteral( "defaultFeatureCount" ) ) && !connection.uri().param( QStringLiteral( "defaultFeatureCount" ) ).isEmpty() )
|
||||
bool featureCountSet { };
|
||||
if ( connection.uri().hasParam( QStringLiteral( "featureCount" ) ) )
|
||||
{
|
||||
connection.uri().param( QStringLiteral( "defaultFeatureCount" ) ).toInt( &defaultFeatureCountSet );
|
||||
if ( defaultFeatureCountSet )
|
||||
mFeatureCount->setText( connection.uri().param( QStringLiteral( "defaultFeatureCount" ) ) );
|
||||
connection.uri().param( QStringLiteral( "featureCount" ) ).toInt( &featureCountSet );
|
||||
if ( featureCountSet )
|
||||
mFeatureCount->setText( connection.uri().param( QStringLiteral( "featureCount" ) ) );
|
||||
}
|
||||
|
||||
// Original default for old connections with no default feature count
|
||||
if ( ! defaultFeatureCountSet )
|
||||
// Original default for old connections with no default feature count set
|
||||
if ( ! featureCountSet )
|
||||
{
|
||||
mFeatureCount->setText( QStringLiteral( "10" ) );
|
||||
}
|
||||
|
@ -158,9 +158,9 @@
|
||||
<widget class="QComboBox" name="cmbTilePixelRatio"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblDefaultFeatureCount">
|
||||
<widget class="QLabel" name="lblFeatureCount">
|
||||
<property name="text">
|
||||
<string>Default maximum number of GetFeatureInfo results</string>
|
||||
<string>Maximum number of GetFeatureInfo results</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -216,7 +216,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbDefaultFeatureCount">
|
||||
<widget class="QSpinBox" name="sbFeatureCount">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Specify a default value for FEATURE_COUNT when a new layer is created from this connection. </p><p>FEATURE_COUNT defines the maximum number of results returned by a GetFeatureInfo request, if not specified the server default value (usually 1) will be used.</p><p>Set to 0 to use server default: no FEATURE_COUNT parameter will be added to the request.</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
@ -388,7 +388,7 @@
|
||||
<tabstop>cbxWfsUseGml2EncodingForTransactions</tabstop>
|
||||
<tabstop>cmbDpiMode</tabstop>
|
||||
<tabstop>cmbTilePixelRatio</tabstop>
|
||||
<tabstop>sbDefaultFeatureCount</tabstop>
|
||||
<tabstop>sbFeatureCount</tabstop>
|
||||
<tabstop>cbxIgnoreGetMapURI</tabstop>
|
||||
<tabstop>cbxIgnoreGetFeatureInfoURI</tabstop>
|
||||
<tabstop>cbxWmsIgnoreReportedLayerExtents</tabstop>
|
||||
|
Loading…
x
Reference in New Issue
Block a user