Consider feedback

This commit is contained in:
Marco Hugentobler 2019-01-22 16:11:04 +01:00
parent abd6297da6
commit ffae79b7d0
9 changed files with 54 additions and 31 deletions

View File

@ -571,8 +571,9 @@ in the area of the map item covered by the item.
QgsMapRendererJob::Errors renderingErrors() const; QgsMapRendererJob::Errors renderingErrors() const;
%Docstring %Docstring
renderingErrors Returns map rendering errors
@return list of layer id / error message
:return: list of errors
%End %End
protected: protected:

View File

@ -512,8 +512,8 @@ class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem
bool isLabelBlockingItem( QgsLayoutItem *item ) const; bool isLabelBlockingItem( QgsLayoutItem *item ) const;
/** /**
* @brief renderingErrors * \brief Returns map rendering errors
* @return list of layer id / error message * \returns list of errors
*/ */
QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; } QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; }

View File

@ -55,7 +55,7 @@ struct LayerRenderJob
bool cached; // if true, img already contains cached image from previous rendering bool cached; // if true, img already contains cached image from previous rendering
QgsWeakMapLayerPointer layer; QgsWeakMapLayerPointer layer;
int renderingTime; //!< Time it took to render the layer in ms (it is -1 if not rendered or still rendering) int renderingTime; //!< Time it took to render the layer in ms (it is -1 if not rendered or still rendering)
QStringList errors; //! rendering errors QStringList errors; //!< Rendering errors
}; };
typedef QList<LayerRenderJob> LayerRenderJobs; typedef QList<LayerRenderJob> LayerRenderJobs;

View File

@ -46,9 +46,9 @@ const QgsProject *QgsConfigCache::project( const QString &path )
prj->setBadLayerHandler( badLayerHandler ); prj->setBadLayerHandler( badLayerHandler );
if ( prj->read( path ) ) if ( prj->read( path ) )
{ {
if ( badLayerHandler->badLayers().size() > 0 ) if ( !badLayerHandler->badLayers().isEmpty() )
{ {
QString errorMsg = QString( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) ); QString errorMsg = QStringLiteral( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical ); QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) ); throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) );
} }

View File

@ -1,14 +1,23 @@
/***************************************************************************
qgsstorebadlayerinfo.cpp
------------------------
begin : Jan 2019
copyright : (C) 2019 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsstorebadlayerinfo.h" #include "qgsstorebadlayerinfo.h"
#include <QDomElement> #include <QDomElement>
QgsStoreBadLayerInfo::QgsStoreBadLayerInfo(): QgsProjectBadLayerHandler()
{
}
QgsStoreBadLayerInfo::~QgsStoreBadLayerInfo()
{
}
void QgsStoreBadLayerInfo::handleBadLayers( const QList<QDomNode> &layers ) void QgsStoreBadLayerInfo::handleBadLayers( const QList<QDomNode> &layers )
{ {
mBadLayerIds.clear(); mBadLayerIds.clear();

View File

@ -1,3 +1,20 @@
/***************************************************************************
qgsstorebadlayerinfo.h
----------------------
begin : Jan 2019
copyright : (C) 2019 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSSTOREBADLAYERINFO_H #ifndef QGSSTOREBADLAYERINFO_H
#define QGSSTOREBADLAYERINFO_H #define QGSSTOREBADLAYERINFO_H
@ -13,21 +30,17 @@ class QgsStoreBadLayerInfo: public QgsProjectBadLayerHandler
public: public:
/*Default constructor /*Default constructor
*/ */
QgsStoreBadLayerInfo(); QgsStoreBadLayerInfo() = default;
/*Destructor
*/
~QgsStoreBadLayerInfo();
/** /**
* @brief handleBadLayers * \brief handleBadLayers
* @param layers layer nodes * \param layers layer nodes
*/ */
void handleBadLayers( const QList<QDomNode> &layers ); void handleBadLayers( const QList<QDomNode> &layers );
/** /**
* @brief badLayers * \brief badLayers
* @return ids of bad layers * \returns ids of bad layers
*/ */
QStringList badLayers() const { return mBadLayerIds; } QStringList badLayers() const { return mBadLayerIds; }

View File

@ -63,8 +63,8 @@ namespace QgsWms
QPainter *takePainter(); QPainter *takePainter();
/** /**
* @brief Returns reported errors * \brief Returns map rendering errors
* @return error list * \returns error list
*/ */
QgsMapRendererJob::Errors errors() const { return mErrors; } QgsMapRendererJob::Errors errors() const { return mErrors; }

View File

@ -2938,9 +2938,9 @@ namespace QgsWms
} }
//Log first error //Log first error
QString errorMsg = QString( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId ); QString errorMsg = QStringLiteral( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical ); QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QString( "Map rendering error in layer '%1'" ).arg( layerWMSName ) ); throw QgsServerException( QStringLiteral( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
} }
} }
@ -3265,7 +3265,7 @@ namespace QgsWms
return tmpImage->dotsPerMeterX() / 1000.0; return tmpImage->dotsPerMeterX() / 1000.0;
} }
void QgsRenderer::handlePrintErrors( const QgsLayout *layout ) void QgsRenderer::handlePrintErrors( const QgsLayout *layout ) const
{ {
if ( !layout ) if ( !layout )
{ {

View File

@ -285,7 +285,7 @@ namespace QgsWms
void removeTemporaryLayers(); void removeTemporaryLayers();
void handlePrintErrors( const QgsLayout *layout ); void handlePrintErrors( const QgsLayout *layout ) const;
private: private: