| 2851 | #define MAX_MIMES 20 |
| 2852 | |
| 2853 | static int msWCSGetCapabilities20_CreateProfiles( |
| 2854 | mapObj *map, xmlNodePtr psServiceIdentification, xmlNsPtr psOwsNs) |
| 2855 | { |
| 2856 | xmlNodePtr psProfile, psTmpNode; |
| 2857 | char *available_mime_types[MAX_MIMES]; |
| 2858 | int i = 0; |
| 2859 | |
| 2860 | /* even indices are urls, uneven are mime-types, or null*/ |
| 2861 | char *urls_and_mime_types[] = |
| 2862 | { |
| 2863 | MS_WCS_20_PROFILE_CORE, NULL, |
| 2864 | MS_WCS_20_PROFILE_KVP, NULL, |
| 2865 | MS_WCS_20_PROFILE_POST, NULL, |
| 2866 | MS_WCS_20_PROFILE_CRS, NULL, |
| 2867 | MS_WCS_20_PROFILE_IMAGECRS, NULL, |
| 2868 | MS_WCS_20_PROFILE_GEOTIFF, "image/tiff", |
| 2869 | MS_WCS_20_PROFILE_GML_GEOTIFF, NULL, |
| 2870 | MS_WCS_20_PROFILE_SCALING, NULL, |
| 2871 | MS_WCS_20_PROFILE_RANGESUBSET, NULL, |
| 2872 | NULL, NULL /* guardian */ |
| 2873 | }; |
| 2874 | |
| 2875 | /* navigate to node where profiles shall be inserted */ |
| 2876 | for(psTmpNode = psServiceIdentification->children; psTmpNode->next != NULL; psTmpNode = psTmpNode->next) |
| 2877 | { |
| 2878 | if(EQUAL((char *)psTmpNode->name, "ServiceTypeVersion")) |
| 2879 | break; |
| 2880 | } |
| 2881 | |
| 2882 | /* get list of all available mime types */ |
| 2883 | msGetOutputFormatMimeList(map, available_mime_types, MAX_MIMES); |
| 2884 | |
| 2885 | while(urls_and_mime_types[i] != NULL) |
| 2886 | { |
| 2887 | char *mime_type; |
| 2888 | mime_type = urls_and_mime_types[i+1]; |
| 2889 | |
| 2890 | /* check if there is a mime type */ |
| 2891 | if(mime_type != NULL) |
| 2892 | { |
| 2893 | /* check if the mime_type is in the list of outputformats */ |
| 2894 | if(CSLPartialFindString(available_mime_types, mime_type) == -1) |
| 2895 | continue; |
| 2896 | } |
| 2897 | |
| 2898 | /* create a new node and attach it in the tree */ |
| 2899 | psProfile = xmlNewNode(psOwsNs, BAD_CAST "Profile"); |
| 2900 | xmlNodeSetContent(psProfile, BAD_CAST urls_and_mime_types[i]); |
| 2901 | xmlAddNextSibling(psTmpNode, psProfile); |
| 2902 | |
| 2903 | psTmpNode = psProfile; |
| 2904 | i += 2; |
| 2905 | } |
| 2906 | return MS_SUCCESS; |
| 2907 | } |
| 2908 | |
| 2909 | /************************************************************************/ |
| 2910 | /* msWCSGetCapabilities20_CoverageSummary() */ |
no test coverage detected