** msWMSFeatureInfo() */
| 3022 | ** msWMSFeatureInfo() |
| 3023 | */ |
| 3024 | int msWMSFeatureInfo(mapObj *map, int nVersion, char **names, char **values, int numentries, |
| 3025 | char *wms_exception_format, owsRequestObj *ows_request) |
| 3026 | { |
| 3027 | int i, feature_count=1, numlayers_found=0; |
| 3028 | pointObj point = {-1.0, -1.0}; |
| 3029 | const char *info_format="MIME"; |
| 3030 | double cellx, celly; |
| 3031 | errorObj *ms_error = msGetErrorObj(); |
| 3032 | int query_status=MS_NOERR; |
| 3033 | const char *encoding; |
| 3034 | int query_layer = 0; |
| 3035 | const char *format_list=NULL; |
| 3036 | int valid_format=MS_FALSE; |
| 3037 | int format_found = MS_FALSE; |
| 3038 | int use_bbox = MS_FALSE; |
| 3039 | |
| 3040 | encoding = msOWSLookupMetadata(&(map->web.metadata), "MO", "encoding"); |
| 3041 | |
| 3042 | for(i=0; map && i<numentries; i++) { |
| 3043 | if(strcasecmp(names[i], "QUERY_LAYERS") == 0) { |
| 3044 | char **layers; |
| 3045 | int numlayers, j, k; |
| 3046 | |
| 3047 | query_layer = 1; /* flag set if QUERY_LAYERS is the request */ |
| 3048 | |
| 3049 | layers = msStringSplit(values[i], ',', &numlayers); |
| 3050 | if(layers==NULL || numlayers < 1 || strlen(msStringTrimLeft(values[i])) < 1) { |
| 3051 | msSetError(MS_WMSERR, "At least one layer name required in QUERY_LAYERS.", "msWMSFeatureInfo()"); |
| 3052 | return msWMSException(map, nVersion, "LayerNotDefined", wms_exception_format); |
| 3053 | } |
| 3054 | |
| 3055 | |
| 3056 | |
| 3057 | for(j=0; j<map->numlayers; j++) { |
| 3058 | /* Force all layers OFF by default */ |
| 3059 | GET_LAYER(map, j)->status = MS_OFF; |
| 3060 | for(k=0; k<numlayers; k++) { |
| 3061 | if (((GET_LAYER(map, j)->name && strcasecmp(GET_LAYER(map, j)->name, layers[k]) == 0) || |
| 3062 | (map->name && strcasecmp(map->name, layers[k]) == 0) || |
| 3063 | (GET_LAYER(map, j)->group && strcasecmp(GET_LAYER(map, j)->group, layers[k]) == 0)) && |
| 3064 | (msIntegerInArray(GET_LAYER(map, j)->index, ows_request->enabled_layers, ows_request->numlayers)) ) |
| 3065 | { |
| 3066 | numlayers_found++; |
| 3067 | GET_LAYER(map, j)->status = MS_ON; |
| 3068 | } |
| 3069 | } |
| 3070 | } |
| 3071 | |
| 3072 | msFreeCharArray(layers, numlayers); |
| 3073 | } else if (strcasecmp(names[i], "INFO_FORMAT") == 0) |
| 3074 | { |
| 3075 | if (values[i] && strlen(values[i]) > 0) |
| 3076 | { |
| 3077 | info_format = values[i]; |
| 3078 | format_found = MS_TRUE; |
| 3079 | } |
| 3080 | } |
| 3081 | else if (strcasecmp(names[i], "FEATURE_COUNT") == 0) |
no test coverage detected