| 591 | |
| 592 | |
| 593 | outputFormatObj *msSelectOutputFormat( mapObj *map, |
| 594 | const char *imagetype ) |
| 595 | |
| 596 | { |
| 597 | int index; |
| 598 | outputFormatObj *format = NULL; |
| 599 | |
| 600 | if( map == NULL || imagetype == NULL || strlen(imagetype) == 0 ) |
| 601 | return NULL; |
| 602 | |
| 603 | /* -------------------------------------------------------------------- */ |
| 604 | /* Try to find the format in the maps list of formats, first by */ |
| 605 | /* mime type, and then by output format name. */ |
| 606 | /* -------------------------------------------------------------------- */ |
| 607 | index = msGetOutputFormatIndex(map, imagetype); |
| 608 | if (index >= 0) { |
| 609 | format = map->outputformatlist[index]; |
| 610 | } else { |
| 611 | struct defaultOutputFormatEntry *formatEntry = defaultoutputformats; |
| 612 | while(formatEntry->name) { |
| 613 | if(!strcasecmp(imagetype,formatEntry->name) || !strcasecmp(imagetype,formatEntry->mimetype)) { |
| 614 | format = msCreateDefaultOutputFormat( map, formatEntry->driver, formatEntry->name ); |
| 615 | break; |
| 616 | } |
| 617 | formatEntry++; |
| 618 | } |
| 619 | |
| 620 | } |
| 621 | |
| 622 | if (format) |
| 623 | { |
| 624 | if (map->imagetype) |
| 625 | free(map->imagetype); |
| 626 | map->imagetype = msStrdup(format->name); |
| 627 | } |
| 628 | |
| 629 | if( format != NULL ) |
| 630 | msOutputFormatValidate( format, MS_FALSE ); |
| 631 | |
| 632 | return format; |
| 633 | } |
| 634 | |
| 635 | /************************************************************************/ |
| 636 | /* msApplyOutputFormat() */ |
no test coverage detected