Re: getImageFromMapBean function seems to return nothing

From: Don Dietrick <dietrick@bbn.com>
Date: Mon Apr 15 2002 - 16:38:15 EDT

Hi Martijn,

If you view the layers in the OpenMap application, and choose File->Save
As... and save a JPEG from the menu item, does it work?

I get the impression you are doing things outside of the OpenMap
application. If you are, how are you setting up the layers with the
MapBean?

I'd check to make sure that the layers are being added to the MapBean,
and that they have received a projection event from it. Actually, since
you are getting black for a JPEG and clear for a GIF tells me that
absolutely nothing has been rendered into the formatter's buffered
image, not even the background color from the MapBean, so that's where
I'd start (making sure that the paintChildren methods of the MapBean are
being called). If it's a matter of the layers not working, you should
have the projection's background color in the image.

Hope this helps,

Don

On Monday, April 15, 2002, at 03:52 PM, Martijn van der Pauw wrote:

> Hi Don,
>
> No, i am doing nothing with transparent colors. The image contains the
> image
> of the world delivered with the OpenMap package and a LocationLayer
> with a
> DBLocationHandler (Great!!).
>
> I tried it with the GifFormatter as well and this returned a blank
> transparent image. So i think the imageformatter doesn't receive what it
> needs to receive in the getImageFromMapBean( ... ) function.
>
> Kind regards,
> Martijn
>
>
>> Hi Martijn,
>>
>> Are you trying to do anything with transparent colors? The jpeg format
>> doesn't handle transparency.
>>
>> - Don
>>
>>
>> On Monday, April 15, 2002, at 07:57 AM, MARTIJN VAN DER PAUW wrote:
>>
>>> Hello,
>>>
>>> I want to render a jpeg image from the mapbean. Therefore i do the
>>> following:
>>>
>>> com.bbn.openmap.image.SunJPEGFormatter formatter =
>>> newcom.bbn.openmap.image.SunJPEGFormatter();
>>> formatter.setImageQuality(.8f);
>>>
>>> byte[] imageBytes =
>>> formatter.getImageFromMapBean((MapBean)this.mapBean1);
>>>
>>> try {
>>> FileOutputStream binFile = new FileOutputStream("test.jpg");
>>> binFile.write(imageBytes);
>>> binFile.close();
>>> System.out.print("written");
>>> }
>>> catch (Exception ex) {System.out.println(ex.toString());}
>>>
>>> Where mapBean1 is filled with a map and labels etc. The funcion
>>> returns
>>> a black image. When I test the imageformatter on a
>>> 'normal' Graphics context, it works ok and returns an image filled
>>> with
>>> the drawn image. I already looked in the
>>> AbstractImageFormatter where the function comes from. I didn't see
>>> weird things there.
>>>
>>> Kind regards,
>>>
>>> Martijn
>>>
>>>
>>> Martijn van der Pauw, internetontwikkelaar.
>>> Meteo Consult
>>> martijn@weer.nl
>>> tel: 0317 - 399800
>>> fax: 0317 - 423164
>>> http://www.weer.nl
>>>
>>> --
>>> [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, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>>
>

--
[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 Mon Apr 15 16:39:10 2002

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