MCPcopy Create free account
hub / github.com/MapServer/MapServer / msWCSGetFormatsList20

Function msWCSGetFormatsList20

mapwcs20.c:1489–1596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1487/************************************************************************/
1488
1489static char *msWCSGetFormatsList20( mapObj *map, layerObj *layer )
1490{
1491 char *format_list = msStrdup("");
1492 char **tokens = NULL, **formats = NULL;
1493 int i, numtokens = 0, numformats;
1494 const char *value;
1495
1496 /* -------------------------------------------------------------------- */
1497 /* Parse from layer metadata. */
1498 /* -------------------------------------------------------------------- */
1499 if( layer != NULL
1500 && (value = msOWSGetEncodeMetadata( &(layer->metadata),"CO","formats",
1501 NULL )) != NULL )
1502 {
1503 tokens = msStringSplit(value, ' ', &numtokens);
1504 }
1505
1506 /* -------------------------------------------------------------------- */
1507 /* Or generate from all configured raster output formats that */
1508 /* look plausible. */
1509 /* -------------------------------------------------------------------- */
1510 else
1511 {
1512 tokens = (char **) msSmallCalloc(map->numoutputformats,sizeof(char*));
1513 for( i = 0; i < map->numoutputformats; i++ )
1514 {
1515 switch( map->outputformatlist[i]->renderer )
1516 {
1517 /* seemingly normal raster format */
1518 case MS_RENDER_WITH_GD:
1519 case MS_RENDER_WITH_AGG:
1520 case MS_RENDER_WITH_RAWDATA:
1521 tokens[numtokens++] = msStrdup(map->outputformatlist[i]->name);
1522 break;
1523 /* rest of formats aren't really WCS compatible */
1524 default:
1525 break;
1526 }
1527 }
1528 }
1529
1530 /* -------------------------------------------------------------------- */
1531 /* Convert outputFormatObj names into mime types and remove */
1532 /* duplicates. */
1533 /* -------------------------------------------------------------------- */
1534 numformats = 0;
1535 formats = (char **) msSmallCalloc(sizeof(char*),numtokens);
1536
1537 for( i = 0; i < numtokens; i++ )
1538 {
1539 int format_i, j;
1540 const char *mimetype;
1541
1542 for( format_i = 0; format_i < map->numoutputformats; format_i++ )
1543 {
1544 if( EQUAL(map->outputformatlist[format_i]->name, tokens[i]) )
1545 break;
1546 }

Calls 7

msStrdupFunction · 0.85
msOWSGetEncodeMetadataFunction · 0.85
msStringSplitFunction · 0.85
msSmallCallocFunction · 0.85
msDebugFunction · 0.85
msFreeCharArrayFunction · 0.85
msStringConcatenateFunction · 0.85

Tested by

no test coverage detected