mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add server option 'QGIS_SERVER_IGNORE_RENDERING_ERRORS'
This commit is contained in:
parent
d893c1fa0b
commit
3bf96ab1de
@ -11,6 +11,7 @@ QgsServerSettingsEnv.QGIS_SERVER_LOG_FILE = QgsServerSettingsEnv.EnvVar.QGIS_SER
|
||||
QgsServerSettingsEnv.QGIS_SERVER_LOG_STDERR = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_LOG_STDERR
|
||||
QgsServerSettingsEnv.QGIS_PROJECT_FILE = QgsServerSettingsEnv.EnvVar.QGIS_PROJECT_FILE
|
||||
QgsServerSettingsEnv.QGIS_SERVER_IGNORE_BAD_LAYERS = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_IGNORE_BAD_LAYERS
|
||||
QgsServerSettingsEnv.QGIS_SERVER_IGNORE_RENDERING_ERRORS = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_IGNORE_RENDERING_ERRORS
|
||||
QgsServerSettingsEnv.QGIS_SERVER_RETRY_BAD_LAYERS = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_RETRY_BAD_LAYERS
|
||||
QgsServerSettingsEnv.QGIS_SERVER_CACHE_DIRECTORY = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_CACHE_DIRECTORY
|
||||
QgsServerSettingsEnv.QGIS_SERVER_CACHE_SIZE = QgsServerSettingsEnv.EnvVar.QGIS_SERVER_CACHE_SIZE
|
||||
|
@ -39,6 +39,7 @@ configuration.
|
||||
QGIS_SERVER_LOG_STDERR,
|
||||
QGIS_PROJECT_FILE,
|
||||
QGIS_SERVER_IGNORE_BAD_LAYERS,
|
||||
QGIS_SERVER_IGNORE_RENDERING_ERRORS,
|
||||
QGIS_SERVER_RETRY_BAD_LAYERS,
|
||||
QGIS_SERVER_CACHE_DIRECTORY,
|
||||
QGIS_SERVER_CACHE_SIZE,
|
||||
@ -283,6 +284,14 @@ The default value is ``True``, this value can be changed by setting the
|
||||
environment variable QGIS_SERVER_IGNORE_BAD_LAYERS.
|
||||
|
||||
.. versionadded:: 3.10.5
|
||||
%End
|
||||
|
||||
bool ignoreRenderingErrors() const;
|
||||
%Docstring
|
||||
Returns ``True`` if rendering errors are ignored by the server. Returns
|
||||
``False`` if the server throws an error in case of rendering errors.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
%End
|
||||
|
||||
bool retryBadLayers() const;
|
||||
|
@ -39,6 +39,7 @@ configuration.
|
||||
QGIS_SERVER_LOG_STDERR,
|
||||
QGIS_PROJECT_FILE,
|
||||
QGIS_SERVER_IGNORE_BAD_LAYERS,
|
||||
QGIS_SERVER_IGNORE_RENDERING_ERRORS,
|
||||
QGIS_SERVER_RETRY_BAD_LAYERS,
|
||||
QGIS_SERVER_CACHE_DIRECTORY,
|
||||
QGIS_SERVER_CACHE_SIZE,
|
||||
@ -283,6 +284,14 @@ The default value is ``True``, this value can be changed by setting the
|
||||
environment variable QGIS_SERVER_IGNORE_BAD_LAYERS.
|
||||
|
||||
.. versionadded:: 3.10.5
|
||||
%End
|
||||
|
||||
bool ignoreRenderingErrors() const;
|
||||
%Docstring
|
||||
Returns ``True`` if rendering errors are ignored by the server. Returns
|
||||
``False`` if the server throws an error in case of rendering errors.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
%End
|
||||
|
||||
bool retryBadLayers() const;
|
||||
|
@ -77,6 +77,9 @@ void QgsServerSettings::initSettings()
|
||||
const Setting sIgnoreBadLayers = { QgsServerSettingsEnv::QGIS_SERVER_IGNORE_BAD_LAYERS, QgsServerSettingsEnv::DEFAULT_VALUE, QStringLiteral( "Ignore bad layers" ), QString(), QMetaType::Type::Bool, QVariant( false ), QVariant() };
|
||||
mSettings[sIgnoreBadLayers.envVar] = sIgnoreBadLayers;
|
||||
|
||||
const Setting sIgnoreRenderingErrors = { QgsServerSettingsEnv::QGIS_SERVER_IGNORE_RENDERING_ERRORS, QgsServerSettingsEnv::DEFAULT_VALUE, QStringLiteral( "Ignore rendering errors" ), QString(), QMetaType::Type::Bool, QVariant( false ), QVariant() };
|
||||
mSettings[sIgnoreRenderingErrors.envVar] = sIgnoreRenderingErrors;
|
||||
|
||||
// retry bad layers
|
||||
const Setting sRetryBadLayers = { QgsServerSettingsEnv::QGIS_SERVER_RETRY_BAD_LAYERS, QgsServerSettingsEnv::DEFAULT_VALUE, QStringLiteral( "Retry bad layers" ), QString(), QMetaType::Type::Bool, QVariant( false ), QVariant() };
|
||||
mSettings[sRetryBadLayers.envVar] = sRetryBadLayers;
|
||||
@ -416,6 +419,11 @@ bool QgsServerSettings::ignoreBadLayers() const
|
||||
return value( QgsServerSettingsEnv::QGIS_SERVER_IGNORE_BAD_LAYERS ).toBool();
|
||||
}
|
||||
|
||||
bool QgsServerSettings::ignoreRenderingErrors() const
|
||||
{
|
||||
return value( QgsServerSettingsEnv::QGIS_SERVER_IGNORE_RENDERING_ERRORS ).toBool();
|
||||
}
|
||||
|
||||
bool QgsServerSettings::retryBadLayers() const
|
||||
{
|
||||
return value( QgsServerSettingsEnv::QGIS_SERVER_RETRY_BAD_LAYERS ).toBool();
|
||||
|
@ -57,7 +57,8 @@ class SERVER_EXPORT QgsServerSettingsEnv : public QObject
|
||||
QGIS_SERVER_LOG_STDERR,
|
||||
QGIS_PROJECT_FILE,
|
||||
QGIS_SERVER_IGNORE_BAD_LAYERS, //!< Do not consider the whole project unavailable if it contains bad layers
|
||||
QGIS_SERVER_RETRY_BAD_LAYERS, //!> Retry bad layers in following request in case they might only be temporary unavailable
|
||||
QGIS_SERVER_IGNORE_RENDERING_ERRORS, //!< Ignore rendering errors if true. If false, the server returns an error if a rendering error occurs
|
||||
QGIS_SERVER_RETRY_BAD_LAYERS, //!< Retry bad layers in following request in case they might only be temporary unavailable
|
||||
QGIS_SERVER_CACHE_DIRECTORY,
|
||||
QGIS_SERVER_CACHE_SIZE,
|
||||
QGIS_SERVER_SHOW_GROUP_SEPARATOR, //!< Show group (thousands) separator when formatting numeric values, defaults to FALSE \since QGIS 3.8
|
||||
@ -273,6 +274,12 @@ class SERVER_EXPORT QgsServerSettings
|
||||
*/
|
||||
bool ignoreBadLayers() const;
|
||||
|
||||
/**
|
||||
* Returns TRUE if rendering errors are ignored by the server. Returns FALSE if the server throws an error in case of rendering errors.
|
||||
* \since QGIS 4.0
|
||||
*/
|
||||
bool ignoreRenderingErrors() const;
|
||||
|
||||
/**
|
||||
* Returns TRUE if bad layers should be re-checked after the project has been cached. The default value is FALSE
|
||||
* \since QGIS 4.0
|
||||
|
@ -3483,7 +3483,7 @@ namespace QgsWms
|
||||
renderJob.render( mapSettings, image, mContext.socketFeedback() );
|
||||
painter = renderJob.takePainter();
|
||||
|
||||
if ( !renderJob.errors().isEmpty() )
|
||||
if ( !renderJob.errors().isEmpty() && !mContext.settings().ignoreRenderingErrors() )
|
||||
{
|
||||
const QgsMapRendererJob::Error e = renderJob.errors().at( 0 );
|
||||
|
||||
@ -3943,10 +3943,16 @@ namespace QgsWms
|
||||
|
||||
void QgsRenderer::handlePrintErrors( const QgsLayout *layout ) const
|
||||
{
|
||||
if( mContext.settings().ignoreRenderingErrors() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !layout )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QgsLayoutItemMap *> mapList;
|
||||
layout->layoutItems( mapList );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user