Skip to content
Permalink
Browse files

Merge pull request #6787 from pblottiere/bugfix_ellipse

[server] Add project's context before rendering
  • Loading branch information
pblottiere committed Apr 16, 2018
2 parents d7fd14b + 2d340a0 commit 5e33d7d639ae8e27ca5cb6173a78f50eb2c29193
@@ -2191,7 +2191,10 @@ QDomElement QgsOgcUtils::expressionToOgcExpression( const QgsExpression &exp,
break;
}
default:
*errorMessage = QObject::tr( "Node type not supported in expression translation: %1" ).arg( node->nodeType() );
{
if ( errorMessage )
*errorMessage = QObject::tr( "Node type not supported in expression translation: %1" ).arg( node->nodeType() );
}
}
// got an error
return QDomElement();
@@ -1125,6 +1125,11 @@ namespace QgsWms
{
mapSettings.setBackgroundColor( backgroundColor );
}

// add context from project (global variables, ...)
QgsExpressionContext context = mProject->createExpressionContext();
context << QgsExpressionContextUtils::mapSettingsScope( mapSettings );
mapSettings.setExpressionContext( context );
}

QDomDocument QgsRenderer::featureInfoDocument( QList<QgsMapLayer *> &layers, const QgsMapSettings &mapSettings,
@@ -184,6 +184,25 @@ def test_wms_getmap_basic(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Basic4")

def test_wms_getmap_context_rendering(self):
project = os.path.join(self.testdata_path, "test_project_render_context.qgs")
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(project),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "points",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "-119.8,20.4,-82.4,49.2",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:4326"
}.items())])

r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_ContextRendering")

def test_wms_getmap_dpi(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
@@ -947,7 +966,7 @@ def test_wms_getmap_sld(self):
self._img_diff_error(r, h, "WMS_GetMap_SLDRestored")

def test_wms_getmap_group(self):
"""A WMS shall render the requested layers by drawing the leftmost in the list
"""A WMS shall render the requested layers by drawing the leftmost in the list
bottommost, the next one over that, and so on."""

qs = "?" + "&".join(["%s=%s" % i for i in list({
Binary file not shown.

0 comments on commit 5e33d7d

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