Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Consider feedback
  • Loading branch information
mhugent committed Jan 22, 2019
1 parent abd6297 commit ffae79b
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 31 deletions.
5 changes: 3 additions & 2 deletions python/core/auto_generated/layout/qgslayoutitemmap.sip.in
Expand Up @@ -571,8 +571,9 @@ in the area of the map item covered by the item.

QgsMapRendererJob::Errors renderingErrors() const;
%Docstring
renderingErrors
@return list of layer id / error message
Returns map rendering errors

:return: list of errors
%End

protected:
Expand Down
4 changes: 2 additions & 2 deletions src/core/layout/qgslayoutitemmap.h
Expand Up @@ -512,8 +512,8 @@ class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem
bool isLabelBlockingItem( QgsLayoutItem *item ) const;

/**
* @brief renderingErrors
* @return list of layer id / error message
* \brief Returns map rendering errors
* \returns list of errors
*/
QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; }

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprendererjob.h
Expand Up @@ -55,7 +55,7 @@ struct LayerRenderJob
bool cached; // if true, img already contains cached image from previous rendering
QgsWeakMapLayerPointer layer;
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;
Expand Down
4 changes: 2 additions & 2 deletions src/server/qgsconfigcache.cpp
Expand Up @@ -46,9 +46,9 @@ const QgsProject *QgsConfigCache::project( const QString &path )
prj->setBadLayerHandler( badLayerHandler );
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 );
throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) );
}
Expand Down
25 changes: 17 additions & 8 deletions src/server/qgsstorebadlayerinfo.cpp
@@ -1,13 +1,22 @@
#include "qgsstorebadlayerinfo.h"
#include <QDomElement>
/***************************************************************************
qgsstorebadlayerinfo.cpp
------------------------
begin : Jan 2019
copyright : (C) 2019 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/

QgsStoreBadLayerInfo::QgsStoreBadLayerInfo(): QgsProjectBadLayerHandler()
{
}
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/

QgsStoreBadLayerInfo::~QgsStoreBadLayerInfo()
{
}
#include "qgsstorebadlayerinfo.h"
#include <QDomElement>

void QgsStoreBadLayerInfo::handleBadLayers( const QList<QDomNode> &layers )
{
Expand Down
31 changes: 22 additions & 9 deletions src/server/qgsstorebadlayerinfo.h
@@ -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
#define QGSSTOREBADLAYERINFO_H

Expand All @@ -13,21 +30,17 @@ class QgsStoreBadLayerInfo: public QgsProjectBadLayerHandler
public:
/*Default constructor
*/
QgsStoreBadLayerInfo();

/*Destructor
*/
~QgsStoreBadLayerInfo();
QgsStoreBadLayerInfo() = default;

/**
* @brief handleBadLayers
* @param layers layer nodes
* \brief handleBadLayers
* \param layers layer nodes
*/
void handleBadLayers( const QList<QDomNode> &layers );

/**
* @brief badLayers
* @return ids of bad layers
* \brief badLayers
* \returns ids of bad layers
*/
QStringList badLayers() const { return mBadLayerIds; }

Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wms/qgsmaprendererjobproxy.h
Expand Up @@ -63,8 +63,8 @@ namespace QgsWms
QPainter *takePainter();

/**
* @brief Returns reported errors
* @return error list
* \brief Returns map rendering errors
* \returns error list
*/
QgsMapRendererJob::Errors errors() const { return mErrors; }

Expand Down
8 changes: 4 additions & 4 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -2938,9 +2938,9 @@ namespace QgsWms
}

//Log first error
QString errorMsg = QString( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );
throw QgsServerException( QString( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
QString errorMsg = QStringLiteral( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
}
}

Expand Down Expand Up @@ -3265,7 +3265,7 @@ namespace QgsWms
return tmpImage->dotsPerMeterX() / 1000.0;
}

void QgsRenderer::handlePrintErrors( const QgsLayout *layout )
void QgsRenderer::handlePrintErrors( const QgsLayout *layout ) const
{
if ( !layout )
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsrenderer.h
Expand Up @@ -285,7 +285,7 @@ namespace QgsWms

void removeTemporaryLayers();

void handlePrintErrors( const QgsLayout *layout );
void handlePrintErrors( const QgsLayout *layout ) const;

private:

Expand Down

0 comments on commit ffae79b

Please sign in to comment.