Re: [OpenMap Users] ImageFormatter.getMimeType

From: Tore Halset <halset_at_pvv.ntnu.no>
Date: Thu, 13 Sep 2007 11:24:52 +0200

Hello.

Changed name to ImageFormatter.getContentType and implemented it in
my own OpenMap repository. My motivation for this is to let users
switch between "image/png", "image/png; mode=8bit" and "image/png;
mode=32bit" without expand the hardcoding of
WmsRequestHandler.translateFormat.

Looking forward to the point in time where my utm/wms patches are
accepted so that I can start to create the next patch. It is kind of
a difficult situation when it takes so long time (6 months since utm
in march and 3 months since wms in june) to get patches into cvs.

  - Tore.

On Sep 12, 2007, at 12:20 , Tore Halset wrote:

> 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_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>

--
[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 Thu Sep 13 2007 - 05:27:57 EDT

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