Skip to content
Permalink
Browse files

tweaks on wmst static temporal settings logic and ui

  • Loading branch information
Samweli committed Apr 26, 2020
1 parent a094300 commit 1ab581406bb11c11443c90329c3214730eac0dba
@@ -1244,15 +1244,15 @@ void QgsRasterLayerProperties::apply()

void QgsRasterLayerProperties::updateSourceStaticTime()
{
QgsProviderMetadata *metadata = QgsProviderRegistry::instance()->providerMetadata(
mRasterLayer->providerType() );
QVariantMap uri = metadata->decodeUri( mRasterLayer->dataProvider()->dataSourceUri() );
uri["allowTemporalUpdates"] = mWmstGroup->isChecked() ? QStringLiteral( "true" ) : QStringLiteral( "false" );

if ( mWmstGroup->isEnabled() &&
mRasterLayer->dataProvider() &&
mRasterLayer->dataProvider()->temporalCapabilities()->hasTemporalCapabilities() )
{
QgsProviderMetadata *metadata = QgsProviderRegistry::instance()->providerMetadata(
mRasterLayer->providerType() );

QVariantMap uri = metadata->decodeUri( mRasterLayer->dataProvider()->dataSourceUri() );

if ( mStaticTemporalRange->isChecked() )
{
QString time = mStartStaticDateTimeEdit->dateTime().toString( Qt::ISODateWithMs ) + '/' +
@@ -1290,12 +1290,11 @@ void QgsRasterLayerProperties::updateSourceStaticTime()
const QLatin1String enableTime = mDisableTime->isChecked() ? QLatin1String( "no" ) : QLatin1String( "yes" );

uri["enableTime"] = enableTime;

mRasterLayer->setDataSource( metadata->encodeUri( uri ), mRasterLayer->name(), mRasterLayer->providerType(), QgsDataProvider::ProviderOptions() );

mRasterLayer->temporalProperties()->setIntervalHandlingMethod( static_cast< QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod >(
mFetchModeComboBox->currentData().toInt() ) );
}
mRasterLayer->setDataSource( metadata->encodeUri( uri ), mRasterLayer->name(), mRasterLayer->providerType(), QgsDataProvider::ProviderOptions() );

}

void QgsRasterLayerProperties::setSourceStaticTimeState()
@@ -1373,6 +1372,9 @@ void QgsRasterLayerProperties::setSourceStaticTimeState()
mProjectTemporalRange->setChecked( !time.isEmpty() );

mDisableTime->setChecked( enableTime == QLatin1String( "no" ) );

mWmstGroup->setChecked( uri.contains( QStringLiteral( "allowTemporalUpdates" ) ) &&
uri.value( QStringLiteral( "allowTemporalUpdates" ) ).toString() == QStringLiteral( "true" ) );
}
}

@@ -301,6 +301,7 @@ QString QgsWMSItemBase::createUri()
// WMS-T defaults settings
if ( mDataSourceUri.param( QLatin1String( "type" ) ) == QLatin1String( "wmst" ) )
{
mDataSourceUri.setParam( QLatin1String( "allowTemporalUpdates" ), QLatin1String( "false" ) );
mDataSourceUri.setParam( QLatin1String( "temporalSource" ), QLatin1String( "provider" ) );
mDataSourceUri.setParam( QLatin1String( "enableTime" ), QLatin1String( "yes" ) );
}
@@ -1091,6 +1091,10 @@ void QgsWmsProvider::addWmstParameters( QUrlQuery &query )

QVariantMap uri = metadata->decodeUri( dataSourceUri() );

// Skip fetching if updates are not allowed
if ( uri.value( QStringLiteral( "allowTemporalUpdates" ), QStringLiteral( "true" ) ).toString() != QStringLiteral( "true" ) )
return;

if ( range.isInfinite() )
{
if ( uri.contains( QStringLiteral( "time" ) ) &&

0 comments on commit 1ab5814

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