Skip to content
Permalink
Browse files
Extend wfs_use_default_extent_for_getfeature false to msWFSRunBasicGe…
…tFeature() for mssql2008 by creating a helper function
  • Loading branch information
rouault committed Feb 25, 2020
1 parent f9ca113 commit d00771656ebf84cf2137100d88c7e048f179672b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
@@ -729,6 +729,31 @@ static FilterEncodingNode* FLTGetTopBBOX(FilterEncodingNode *psNode)
return psTopBBOX;
}

/************************************************************************/
/* FLTLayerSetInvalidRectIfSupported */
/* */
/* This function will set in *rect a very huge extent if the layer */
/* wfs_use_default_extent_for_getfeature metadata item is set to false */
/* and the layer supports such degenerate rectangle, as a hint that */
/* they should not issue a spatial filter. */
/************************************************************************/

int FLTLayerSetInvalidRectIfSupported(layerObj* lp,
rectObj* rect)
{
const char* pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
"use_default_extent_for_getfeature");
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
(lp->connectiontype == MS_OGR ||
((lp->connectiontype == MS_PLUGIN) && (strstr(lp->plugin_library,"msplugin_mssql2008") != NULL))) )
{
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
*rect = rectInvalid;
return MS_TRUE;
}
return MS_FALSE;
}

/************************************************************************/
/* FLTLayerApplyPlainFilterToLayer */
/* */
@@ -743,19 +768,10 @@ int FLTLayerApplyPlainFilterToLayer(FilterEncodingNode *psNode, mapObj *map,

pszExpression = FLTGetCommonExpression(psNode, lp);
if (pszExpression) {
const char* pszUseDefaultExtent;
FilterEncodingNode* psTopBBOX;
rectObj rect = map->extent;

pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
"use_default_extent_for_getfeature");
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
(lp->connectiontype == MS_OGR ||
((lp->connectiontype == MS_PLUGIN) && (strstr(lp->plugin_library,"msplugin_mssql2008") != NULL))) )
{
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
rect = rectInvalid;
}
FLTLayerSetInvalidRectIfSupported(lp, &rect);

psTopBBOX = FLTGetTopBBOX(psNode);
if( psTopBBOX )
@@ -144,6 +144,7 @@ FilterEncodingNode* FLTSimplify(FilterEncodingNode *psFilterNode,
int FLTApplyFilterToLayerCommonExpressionWithRect(mapObj *map, int iLayerIndex, const char *pszExpression, rectObj rect);
int FLTProcessPropertyIsNull(FilterEncodingNode *psFilterNode,
mapObj *map, int i);
int FLTLayerSetInvalidRectIfSupported(layerObj* lp, rectObj* rect);

#ifdef __cplusplus
}
@@ -2169,21 +2169,15 @@ static int msWFSRunBasicGetFeature(mapObj* map,
{
rectObj ext;
int status;
const char* pszUseDefaultExtent;

map->query.type = MS_QUERY_BY_RECT; /* setup the query */
map->query.mode = MS_QUERY_MULTIPLE;
map->query.rect = map->extent;
map->query.layer = lp->index;


pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
"use_default_extent_for_getfeature");
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
lp->connectiontype == MS_OGR )
if( FLTLayerSetInvalidRectIfSupported(lp, &(map->query.rect)) )
{
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
map->query.rect = rectInvalid;
/* do nothing */
}
else if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS) {
char *pszMapSRS=NULL;

0 comments on commit d007716

Please sign in to comment.