MCPcopy Index your code
hub / github.com/MapServer/MapServer / msDumpResult

Function msDumpResult

mapwms.c:2924–3018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2922}
2923
2924int msDumpResult(mapObj *map, int bFormatHtml, int nVersion, char *wms_exception_format)
2925{
2926 int numresults=0;
2927 int i;
2928
2929 for(i=0; i<map->numlayers; i++)
2930 {
2931 int j, k, *itemvisible;
2932 char **incitems=NULL;
2933 int numincitems=0;
2934 char **excitems=NULL;
2935 int numexcitems=0;
2936 const char *value;
2937
2938 layerObj *lp;
2939 lp = (GET_LAYER(map, i));
2940
2941 if(lp->status != MS_ON || lp->resultcache==NULL || lp->resultcache->numresults == 0)
2942 continue;
2943
2944 /* if(msLayerOpen(lp) != MS_SUCCESS || msLayerGetItems(lp) != MS_SUCCESS)
2945 return msWMSException(map, nVersion, NULL); */
2946
2947 /* Use metadata to control which fields to output. We use the same
2948 * metadata names as for GML:
2949 * wms/ows_include_items: comma delimited list or keyword 'all'
2950 * wms/ows_exclude_items: comma delimited list (all items are excluded by default)
2951 */
2952 /* get a list of items that should be excluded in output */
2953 if((value = msOWSLookupMetadata(&(lp->metadata), "MO", "include_items")) != NULL)
2954 incitems = msStringSplit(value, ',', &numincitems);
2955
2956 /* get a list of items that should be excluded in output */
2957 if((value = msOWSLookupMetadata(&(lp->metadata), "MO", "exclude_items")) != NULL)
2958 excitems = msStringSplit(value, ',', &numexcitems);
2959
2960 itemvisible = (int*)msSmallMalloc(lp->numitems*sizeof(int));
2961 for(k=0; k<lp->numitems; k++)
2962 {
2963 int l;
2964
2965 itemvisible[k] = MS_FALSE;
2966
2967 /* check visibility, included items first... */
2968 if(numincitems == 1 && strcasecmp("all", incitems[0]) == 0) {
2969 itemvisible[k] = MS_TRUE;
2970 } else {
2971 for(l=0; l<numincitems; l++) {
2972 if(strcasecmp(lp->items[k], incitems[l]) == 0)
2973 itemvisible[k] = MS_TRUE;
2974 }
2975 }
2976
2977 /* ...and now excluded items */
2978 for(l=0; l<numexcitems; l++) {
2979 if(strcasecmp(lp->items[k], excitems[l]) == 0)
2980 itemvisible[k] = MS_FALSE;
2981 }

Callers 1

msWMSFeatureInfoFunction · 0.85

Calls 11

msOWSLookupMetadataFunction · 0.85
msStringSplitFunction · 0.85
msSmallMallocFunction · 0.85
strcasecmpFunction · 0.85
msFreeCharArrayFunction · 0.85
msIO_printfFunction · 0.85
msInitShapeFunction · 0.85
msLayerGetShapeFunction · 0.85
msFreeFunction · 0.85
msWMSExceptionFunction · 0.85
msFreeShapeFunction · 0.85

Tested by

no test coverage detected