Re: Saving a virtual size .jpeg?

From: Don Dietrick <dietrick@bbn.com>
Date: Thu Mar 07 2002 - 11:41:51 EST

Hi Tony,

I think this is the easiest thing to do, and it does involve creating a
larger canvas:

1. Create a BufferedImage, with the size you want. You can get a
java.awt.Graphic object for that BufferedImage, save a handle to it.

2. Create a Projection object, using the ProjectionFactory, with the
same center point, type and scale as the current one in on the MapBean,
but with the height and width of the BufferedImage you created.

3. Use the MapHandler to get the LayerHandler. You'll have to decide
how to get the MapHandler, either by piggy-backing off some other
object, or adding your object to it, whatever. From the LayerHandler,
ask for its Layer[].

4. With the Graphics from the BufferedImage:

projection.drawBackground(Graphics);

then, with the Layer[], start at the last, working to the first, call

if (layer.isVisible()) {
        Layer.renderDataForProjection(projection, Graphics);
}

All visible layers are part of the map, and will get rendered on top of
each other properly.

Then, take the BufferedImage, pass it to an ImageFormatter of choice:

byte[] = ImageFormatter.formatImage(BufferedImage);

The byte[] array is the output.

Hope this helps,

Don

On Thursday, March 7, 2002, at 11:13 AM, Tony Bigbee wrote:

> Hi,
> The demo application allows you to save the currently displayed view as
> a jpeg. How difficult would it be to modify the save code to allow
> saving a larger area (i.e. say 4x the current displayed coverage)?
> Since a larger view hasn't been rendered yet, would it involve creating
> a larger canvas first?
>
> Thanks,
> Tony
>
>
> --
> [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 Thu Mar 7 11:42:14 2002

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