Skip to content
Permalink
Browse files

Merge pull request #4667 from mhugent/server_tilemode

Fix tile render mode not applied in 2.18 server
  • Loading branch information
mhugent committed Jun 2, 2017
2 parents 8987bb5 + 4f307f7 commit 19ddeb18bdfc7f7c8ea1f5281b8ed84e59518460
@@ -325,6 +325,9 @@ class QgsMapRenderer : QObject
*/
void setFeatureFilterProvider( const QgsFeatureFilterProvider* ffp );

/** Set tile mode (render code tries to prevent tile border effects)*/
void setTileRenderMode( bool enabled );

signals:

//! @deprecated in 2.4 - not emitted anymore
@@ -123,6 +123,9 @@ class QgsWMSConfigParser

virtual bool useLayerIDs() const = 0;

/** True if tile render mode is enabled in the configuration*/
virtual bool tileRenderMode() const = 0;

private:

QgsWMSConfigParser();
@@ -62,6 +62,8 @@ QgsMapRenderer::QgsMapRenderer()

mLabelingEngine = nullptr;
readDefaultDatumTransformations();

mTileRenderMode = false;
}

QgsMapRenderer::~QgsMapRenderer()
@@ -343,6 +345,8 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
QListIterator<QString> li( mLayerSet );
li.toBack();

mRenderContext.setFlag( QgsRenderContext::RenderMapTile, mTileRenderMode );

QgsRectangle r1, r2;

while ( li.hasPrevious() )
@@ -396,6 +396,9 @@ class CORE_EXPORT QgsMapRenderer : public QObject
mRenderContext.setFeatureFilterProvider( ffp );
}

/** Set tile mode (render code tries to prevent tile border effects)*/
void setTileRenderMode( bool enabled ) { mTileRenderMode = enabled; }

signals:

//! @deprecated in 2.4 - not emitted anymore
@@ -512,6 +515,9 @@ class CORE_EXPORT QgsMapRenderer : public QObject

QHash< QPair< QString, QString >, QPair< int, int > > mDefaultDatumTransformations;

/** Tell the render system we are rendering a map tile*/
bool mTileRenderMode;

private:
void readDefaultDatumTransformations();
};
@@ -801,6 +801,15 @@ void QgsSLDConfigParser::serviceCapabilities( QDomElement& parentElement, QDomDo
}
}

bool QgsSLDConfigParser::tileRenderMode() const
{
if ( mFallbackParser )
{
return mFallbackParser->tileRenderMode();
}
return false;
}

QList<QDomElement> QgsSLDConfigParser::findNamedLayerElements( const QString& layerName ) const
{
QList<QDomElement> resultList;
@@ -132,6 +132,9 @@ class QgsSLDConfigParser : public QgsWMSConfigParser

void serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const override;

/** True if tile render mode is enabled in the configuration*/
bool tileRenderMode() const override;

private:

/** SLD as dom document*/
@@ -139,6 +139,9 @@ class SERVER_EXPORT QgsWMSConfigParser

virtual bool useLayerIDs() const = 0;

/** True if tile render mode is enabled in the configuration*/
virtual bool tileRenderMode() const = 0;

/** Adds highlight layers to the layer registry and to the layer set. Returns the ids of the newly created layers (for later removal)*/
static QStringList addHighlightLayers( const QMap<QString, QString>& parameterMap, QStringList& layerSet, const QString& parameterPrefix = QString() );
static void removeHighlightLayers( const QStringList& layerIds );
@@ -2323,6 +2323,28 @@ void QgsWMSProjectParser::serviceCapabilities( QDomElement& parentElement, QDomD
mProjectParser->serviceCapabilities( parentElement, doc, "WMS", featureInfoFormatSIA2045() );
}

bool QgsWMSProjectParser::tileRenderMode() const
{
if ( !mProjectParser->xmlDocument() )
{
return false;
}

QDomElement qgisElem = mProjectParser->xmlDocument()->documentElement();
QDomElement mapCanvasElem = qgisElem.firstChildElement( "mapcanvas" );
if ( mapCanvasElem.isNull() )
{
return false;
}
QDomElement renderMapTileElem = mapCanvasElem.firstChildElement( "rendermaptile" );
if ( renderMapTileElem.isNull() )
{
return false;
}

return ( renderMapTileElem.text() == "1" );
}

QDomElement QgsWMSProjectParser::composerByName( const QString& composerName ) const
{
QDomElement composerElem;
@@ -127,6 +127,9 @@ class SERVER_EXPORT QgsWMSProjectParser : public QgsWMSConfigParser

bool useLayerIDs() const override { return mProjectParser->useLayerIDs(); }

/** True if tile render mode is enabled in the configuration*/
bool tileRenderMode() const override;

private:
QgsServerProjectParser* mProjectParser;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
@@ -2103,6 +2103,7 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const

mMapRenderer->clearLayerCoordinateTransforms();
mMapRenderer->setOutputSize( QSize( paintDevice->width(), paintDevice->height() ), paintDevice->logicalDpiX() );
mMapRenderer->setTileRenderMode( mConfigParser->tileRenderMode() );

//map extent
bool bboxOk = true;

0 comments on commit 19ddeb1

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