[OpenMap Users] ImageFormatter.getMimeType

From: Tore Halset <halset_at_email.domain.hidden>
Date: Wed Sep 12 2007 - 06:20:28 EDT

Hello.

ImageFormatter.getFormatLabel() return an String like "JPEG", but
sometimes the mime-type are needed. Coversion between "JPEG" and
"image/jpeg" are done in WmsRequestHandler.translateFormat.

By having a separate ImageFormatter.getMimeType it would be easier
for users to add their own ImageFromatters for different mime-types
and the ugly code (see below) in WmsRequestHandler.translateFormat
can ba switched over to a simple Map lookup.

     private String translateFormat(String format) {
         if (format.equals(WMTConstants.IMAGEFORMAT_JPEG)) {
             return HttpConnection.CONTENT_JPEG;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_PNG)) {
             return HttpConnection.CONTENT_PNG;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_GIF)) {
             return HttpConnection.CONTENT_GIF;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_TIFF)) {
             return HttpConnection.CONTENT_TIFF;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_GEOTIFF)) {
             return HttpConnection.CONTENT_GEOTIFF;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_PPM)) {
             return HttpConnection.CONTENT_PPM;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_WBMP)) {
             return HttpConnection.CONTENT_WBMP;
         } else if (format.equals(WMTConstants.IMAGEFORMAT_SVG)) {
             return HttpConnection.CONTENT_SVG;
         } else {
             return format;
         }
     }

Regards,
  - Tore.

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Sep 12 06:29:46 2007

This archive was generated by hypermail 2.1.8 : Wed Sep 12 2007 - 06:29:49 EDT