[OpenMap Users] ImageFormatter.getMimeType

From: Tore Halset <halset_at_pvv.ntnu.no>
Date: Wed, 12 Sep 2007 12:20:28 +0200


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;

  - Tore.

[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Sep 12 2007 - 06:24:23 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT