Skip to content
Permalink
Browse files

Merge pull request #7244 from elpaso/bugfix-18518-server-gfi-relations

[bugfix][server] respect relations in getfeatureinfo
  • Loading branch information
elpaso committed Jun 18, 2018
2 parents e39abc5 + 9c85457 commit c20e441872de3925aabccd035ce8172df555b523
@@ -382,6 +382,11 @@ QgsProject::~QgsProject()
}
}

void QgsProject::setInstance( QgsProject *project )
{
sProject = project;
}


QgsProject *QgsProject::instance()
{
@@ -110,14 +110,14 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
~QgsProject() override;

/**
* Sets the project's title.
* \param title new title
*
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
*
* \see title()
* \since QGIS 2.4
*/
* Sets the project's title.
* \param title new title
*
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
*
* \see title()
* \since QGIS 2.4
*/
void setTitle( const QString &title );

/**
@@ -1257,6 +1257,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

static QgsProject *sProject;

/**
* Set the current project instance to \a project
*
* \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
* \see instance()
* \note not available in Python bindings
* \since QGIS 3.2
*/
static void setInstance( QgsProject *project ) SIP_SKIP;

/**
* Read map layers from project file.
* \param doc DOM document to parse
@@ -1362,6 +1372,9 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
QgsProjectMetadata mMetadata;

friend class QgsProjectDirtyBlocker;

// Required by QGIS Server for switching the current project instance
friend class QgsConfigCache;
};

/**
@@ -48,7 +48,7 @@ const QgsProject *QgsConfigCache::project( const QString &path )
mFileSystemWatcher.addPath( path );
}
}

QgsProject::setInstance( mProjectCache[ path ] );
return mProjectCache[ path ];
}

@@ -286,6 +286,19 @@ def testGetFeatureInfoFilter(self):
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\''),
'wms_getfeatureinfo_filter_no_width')

def test_value_relation(self):
"""Test whether value relations are resolved: regression 18518"""
self.wms_request_compare('GetFeatureInfo',
'&BBOX=537912.30469845747575164,4975501.92125043831765652,577227.89428471261635423,4996610.36656293831765652' +
'&CRS=EPSG:32632' +
'&WIDTH=1328&HEIGHT=713' +
'&LAYERS=test_multi' +
'&STYLES=&FORMAT=image/jpeg' +
'&QUERY_LAYERS=test_multi&INFO_FORMAT=text/xml' +
'&I=429&J=528&FEATURE_COUNT=10',
'wms_getfeatureinfo_value_relation',
project='test_project_value_relation.qgz')


if __name__ == '__main__':
unittest.main()
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
Content-Length: 238
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<Layer name="test_multi">
<Feature id="7">
<Attribute value="7" name="fid"/>
<Attribute value="10" name="id"/>
<Attribute value="Piacenza" name="fk_prov"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>

0 comments on commit c20e441

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