Re: [OpenMap Users] RasterFormatException

From: Don Dietrick <dietrick@bbn.com>
Date: Wed Jun 16 2004 - 19:21:46 EDT

Hi Leah,

Thanks for reporting that problem, but that fix has already been
implemented in the latest version of OpenMap checked into CVS. It'll
be available in the next release.

- Don

On Jun 16, 2004, at 6:43 PM, Leah Wong wrote:

> Hello Don,
>
> In OpenMap v4.5.4 I was getting the following RasterFormatException
> when
> panning around a boundary for CIB10. It seemed more likely to happen
> right
> after I resized the map display window. I looked at
> com.bbn.openmap.omGraphics.OMScalingRaster in v4.6 and noticed that the
> scaleTo() function hasn't changed.
>
> CADRG|RpfLayer.RpfWorker.construct():
> java.awt.image.RasterFormatException:
> negative or zero width
> java.awt.image.RasterFormatException: negative or zero width
> at java.awt.image.Raster.<init>(Raster.java:1091)
> at java.awt.image.WritableRaster.<init>(WritableRaster.java:111)
> at sun.awt.image.SunWritableRaster.<init>(SunWritableRaster.java:49)
> at
> sun.awt.image.IntegerComponentRaster.<init>(IntegerComponentRaster.java
> :151)
> at
> sun.awt.image.IntegerInterleavedRaster.<init>(IntegerInterleavedRaster.
> java:
> 111)
> at
> sun.awt.image.IntegerInterleavedRaster.createWritableChild(IntegerInter
> leave
> dRaster.java:468)
> at java.awt.image.BufferedImage.getSubimage(BufferedImage.java:1060)
> at
> com.bbn.openmap.omGraphics.OMScalingRaster.scaleTo(OMScalingRaster.java
> :377)
> at
> com.bbn.openmap.omGraphics.OMScalingRaster.generate(OMScalingRaster.jav
> a:278
> )
> at com.bbn.openmap.omGraphics.OMGraphicList.generate(Unknown Source)
> at com.bbn.openmap.omGraphics.OMGraphicList.generate(Unknown Source)
> at
> com.bbn.openmap.layer.rpf.RpfCacheManager$RpfMaps.generate(Unknown
> Source)
> at com.bbn.openmap.omGraphics.OMGraphicList.generate(Unknown Source)
> at com.bbn.openmap.omGraphics.OMGraphicList.project(Unknown Source)
> at com.bbn.openmap.layer.rpf.RpfLayer.prepare(Unknown Source)
> at com.bbn.openmap.layer.rpf.RpfLayer$RpfWorker.construct(Unknown
> Source)
> at com.bbn.openmap.util.SwingWorker$2.run(Unknown Source)
> at java.lang.Thread.run(Thread.java:536)
>
> What I did to fix this was change part of the
> com.bbn.openmap.omGraphics.OMScalingRaster.scaleTo() function from:
>
> clipRect.width = (int)(iRect.width * xScaleFactor); // scale the
> width
> clipRect.height = (int)(iRect.height * yScaleFactor); // scale the
> height
>
> where the clipRect.width or clipRect.height could potentially be 0
> because
> of rounding to:
>
> // scale the width
> int scaledWidth = (int)(iRect.width * xScaleFactor);
> clipRect.width = (scaledWidth < 1) ? 1 : scaledWidth;
> // scale the height
> int scaledHeight = (int)(iRect.height * yScaleFactor);
> clipRect.height = (scaledHeight < 1) ? 1 : scaledHeight;
>
> where the smallest integer clipRect.width or clipRect.height can be is
> 1.
>
> Is this a viable fix? It worked in my tests, but maybe you can think
> of a
> case where setting clipRect.width or clipRect.height to 1 isn't a good
> idea.
> Or maybe you fixed this in v4.6 in a different way. Please let me
> know what
> you think.
>
> Thanks,
> Leah
>
> --
> [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"]
>
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Jun 16 19:23:55 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT