Re: [OpenMap Users] Adding a zoom area window

From: Don Dietrick <>
Date: Wed, 11 Jan 2006 10:53:13 -0500

Hi Chris,

I guess you could use the OverviewMap for something like this, but I
have the feeling it might be more work than it's work. The main
functionality of the OverviewMapHandler is to 'sync' two MapBeans'
projections, with some scale factor involved. I think what you are
doing here is something a little different.

I think you want to create a BufferedImage of the size of the popup
window, and then render the layers into that BufferedImage (by
passing its java.awt.Graphics object to the layers paint() method).
Then, you can put the image into a JLabel in a Window, or have the
image (along with the other boxes, lines) rendered on top of the
MapBean by a PaintListener object that is listening for MapBean paints

The tricky part is getting the image rendered at the new scale. It's
tricky because Layers and OMGraphics only expect to be rendered into
one map, and they know the projection of that map. Giving them other
projections at the same time might result in their being rendered in
the wrong place on one map or the other. You could apply an
AffineTransform to the image Graphics object, translating x, y
according to the offset of the little box vs the center of the map
and scaling accordingly, but I think that will just zoom in on the
image without increasing detail.

The more I think about it, I would use a modified ImageServer to
create that image. I'd modify the ImageServer to take an
AffineTransform to apply an x, y translation to the image Graphics.
You want to use a copy of the MapBean's projection with a different
scale (smaller value), and apply that x, y translation as the offset
between the center of the image to the center of the MapBean
projection. This should get you the image you want. The last thing
you have to do is reset the projection on the Layers, so they act
right in case the MapBean repaints itself. For
OMGraphicHandlerLayers, you can call layer.getList().generate

Hope this helps,


On Jan 10, 2006, at 3:43 PM, Chris Hopkins wrote:

> Hi all -
> I'm trying to create a zoom window that can be popped up to create
> a zoomed view of what is going on. Sort of like picture in a
> picture for your TV. The attached picture gives an idea of what I
> want to create. Does the overview map allow for this? My concern is
> that I'm not sure if the overview map would display the objects
> that are part of the layers on the base map.
> Has anyone attempted this?
> Thanks,
> Chris
> <zoomwindow.PNG>

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Jan 11 2006 - 11:02:09 EST

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