| 934 | /************************************************************************/ |
| 935 | |
| 936 | void msGetOutputFormatMimeListWMS( mapObj *map, char **mime_list, int max_mime ) |
| 937 | { |
| 938 | int mime_count = 0, i,j; |
| 939 | const char *format_list = NULL; |
| 940 | char **tokens = NULL; |
| 941 | int numtokens = 0; |
| 942 | outputFormatObj *format; |
| 943 | msApplyDefaultOutputFormats(map); |
| 944 | format_list = msOWSLookupMetadata(&(map->web.metadata), "M","getmap_formatlist"); |
| 945 | if ( format_list && strlen(format_list) > 0) |
| 946 | tokens = msStringSplit(format_list, ',', &numtokens); |
| 947 | |
| 948 | if (tokens && numtokens > 0) |
| 949 | { |
| 950 | for(j = 0; j < numtokens; j++ ) |
| 951 | { |
| 952 | format = msSelectOutputFormat(map, tokens[j]); |
| 953 | if (format != NULL) |
| 954 | { |
| 955 | mime_list[mime_count++] = format->mimetype; |
| 956 | } |
| 957 | } |
| 958 | msFreeCharArray(tokens, numtokens); |
| 959 | } |
| 960 | else |
| 961 | { |
| 962 | for( i = 0; i < map->numoutputformats && mime_count < max_mime; i++ ) |
| 963 | { |
| 964 | int j; |
| 965 | |
| 966 | if( map->outputformatlist[i]->mimetype == NULL ) |
| 967 | continue; |
| 968 | |
| 969 | for( j = 0; j < mime_count; j++ ) |
| 970 | { |
| 971 | if( strcasecmp(mime_list[j], |
| 972 | map->outputformatlist[i]->mimetype) == 0 ) |
| 973 | break; |
| 974 | } |
| 975 | |
| 976 | if( j == mime_count && map->outputformatlist[i]->driver && |
| 977 | (strncasecmp(map->outputformatlist[i]->driver, "GD/", 3)==0 || |
| 978 | strncasecmp(map->outputformatlist[i]->driver, "GDAL/", 5)==0 || |
| 979 | strncasecmp(map->outputformatlist[i]->driver, "AGG/", 4)==0 || |
| 980 | strcasecmp(map->outputformatlist[i]->driver, "CAIRO/SVG")==0 || |
| 981 | strcasecmp(map->outputformatlist[i]->driver, "CAIRO/PDF")==0 || |
| 982 | strcasecmp(map->outputformatlist[i]->driver, "kml")==0 || |
| 983 | strcasecmp(map->outputformatlist[i]->driver, "kmz")==0)) |
| 984 | mime_list[mime_count++] = map->outputformatlist[i]->mimetype; |
| 985 | } |
| 986 | } |
| 987 | if( mime_count < max_mime ) |
| 988 | mime_list[mime_count] = NULL; |
| 989 | } |
| 990 | |
| 991 | |
| 992 | /************************************************************************/ |
no test coverage detected