Changeset 11892

Show
Ignore:
Timestamp:
08/17/07 14:16:39 (1 year ago)
Author:
warmerdam
Message:

support space delimited formats (#1748)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/wcs/wcsdataset.cpp

    r11713 r11892  
    972972        CPLXMLNode *psSF = CPLGetXMLNode( psCO, "supportedFormats" ); 
    973973        CPLXMLNode *psNode; 
     974        char **papszFormatList = NULL; 
    974975        CPLString osPreferredFormat; 
     976        int iFormat; 
    975977 
    976978        if( psSF == NULL ) 
     
    986988            if( psNode->eType == CXT_Element  
    987989                && EQUAL(psNode->pszValue,"formats")  
     990                && psNode->psChild != NULL  
    988991                && psNode->psChild->eType == CXT_Text ) 
    989992            { 
    990                 if( strlen(osPreferredFormat) == 0 ) 
    991                     osPreferredFormat = psNode->psChild->pszValue; 
    992  
    993                 if( strstr(psNode->psChild->pszValue,"tiff") != NULL  
    994                     || strstr(psNode->psChild->pszValue,"TIFF") != NULL 
    995                     || strstr(psNode->psChild->pszValue,"Tiff") != NULL ) 
     993                // This check is looking for deprecated WCS 1.0 capabilities 
     994                // with multiple formats space delimited in a single <formats> 
     995                // element per GDAL ticket 1748 (done by MapServer 4.10 and 
     996                // earlier for instance).  
     997                if( papszFormatList == NULL 
     998                    && psNode->psNext == NULL 
     999                    && strstr(psNode->psChild->pszValue," ") != NULL 
     1000                    && strstr(psNode->psChild->pszValue,";") == NULL ) 
    9961001                { 
    997                     osPreferredFormat = psNode->psChild->pszValue; 
    998                     break; 
     1002                    char **papszSubList =  
     1003                        CSLTokenizeString( psNode->psChild->pszValue ); 
     1004                    papszFormatList = CSLInsertStrings( papszFormatList,  
     1005                                                        -1, papszSubList ); 
     1006                    CSLDestroy( papszSubList ); 
     1007                } 
     1008                else 
     1009                { 
     1010                    papszFormatList = CSLAddString( papszFormatList,  
     1011                                                    psNode->psChild->pszValue); 
    9991012                } 
    10001013            } 
    10011014        } 
     1015         
     1016        for( iFormat = 0;  
     1017             papszFormatList != NULL && papszFormatList[iFormat] != NULL; 
     1018             iFormat++ ) 
     1019        { 
     1020            if( strlen(osPreferredFormat) == 0 ) 
     1021                osPreferredFormat = papszFormatList[iFormat]; 
     1022             
     1023            if( strstr(papszFormatList[iFormat],"tiff") != NULL  
     1024                    || strstr(papszFormatList[iFormat],"TIFF") != NULL 
     1025                    || strstr(papszFormatList[iFormat],"Tiff") != NULL ) 
     1026            { 
     1027                osPreferredFormat = papszFormatList[iFormat]; 
     1028                break; 
     1029            } 
     1030        } 
     1031 
     1032        CSLDestroy( papszFormatList ); 
    10021033 
    10031034        if( strlen(osPreferredFormat) > 0 ) 
     
    10301061/*      "Band", with a set of ascending numerical values.               */ 
    10311062/* -------------------------------------------------------------------- */ 
     1063    osBandIdentifier = CPLGetXMLValue( psService, "BandIdentifier", "" ); 
    10321064    CPLXMLNode * psAD = CPLGetXMLNode( psService,  
    10331065      "CoverageOffering.rangeSet.RangeSet.axisDescription.AxisDescription" ); 
    10341066    CPLXMLNode *psValues; 
    10351067 
    1036     if( psAD != NULL  
     1068    if( strlen(osBandIdentifier) == 0 
     1069        && psAD != NULL  
    10371070        && EQUAL(CPLGetXMLValue(psAD,"name",""),"Band")  
    10381071        && ( (psValues = CPLGetXMLNode( psAD, "values" )) != NULL ) )