Skip to content
Permalink
Browse files

Consider feedback

  • Loading branch information
mhugent committed Jan 22, 2019
1 parent abd6297 commit ffae79b7d075a00d59e6d91664e771e3412ce01d
@@ -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:
@@ -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; }

@@ -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;
@@ -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" ) );
}
@@ -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 )
{
@@ -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

@@ -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; }

@@ -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; }

@@ -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 ) );
}
}

@@ -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 )
{
@@ -285,7 +285,7 @@ namespace QgsWms

void removeTemporaryLayers();

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

private:

0 comments on commit ffae79b

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