Hi Alessio,
Can you just delete those methods ( setScale( float newScale, int x, int y ) and pan(int dx, int dy) ) ? (I forgot to take them out).
That LamAzEqArea class is our subclass of com.bbn.openmap.proj.Proj and has a lot of code that's specific to our application. It's a Lambert Azimuthal Equal Area projection but we keep the center of projection fixed (to match the image data in our tiles) . I believe this is different from how the built-in openmap projections work as their center of projection changes whenever the user pans the map - so I'm not sure how useful it will be to you.
The following snippet from LamAzEqArea might be useful if you want to do google-maps-like zooming:
/**
* Changes the scale. Allows the zoom-in/out operation to be centered around
* an arbitrary point - not necessarily the center of the viewport. This
* allows google-maps-like zooming which zooms in on the point where the mouse
* is.
*
* _at_param s The new zoom scale.
* _at_param x Viewport coordinates
* _at_param y Viewport coordinates
*/
public void setScale ( float s, int x, int y )
{
s = boundsCheckedScale( s );
if ( s == scale ) //if scale didn't change, return.
{
return;
}
/* compute how much to move the map by */
double ratio = scale / s;
int dx = (int) round( ( mapX - x ) * ( ratio - 1 ) );
int dy = (int) round( ( mapY - y ) * ( ratio - 1 ) );
mapX += dx;
mapY += dy;
scale = s;
computeParameters();
}
-Ben
________________________________
From: Alessio Iannone [mailto:alessio_iannone_at_yahoo.it]
Sent: Thursday, April 24, 2008 4:26 AM
To: Weisburd, Ben
Cc: OpenMapUsers
Subject: Re: [OpenMap Users] Moving the map like Google
Hi Ben, Looking at your code I founded unresolved reference to a class named LamAzEqArea....can you share this file?
Best regards
Alessio Iannone
Software Engineer
Mobile: 39 329 8834960
Email: alessio.iannone_at_nextant.it<mailto:alessio.iannone_at_nextant.it>
IM: quonn77_at_hotmail.com (AIM)
http://www.linkedin.com/in/alessioiannone
Web sites of the Martial Arts I play<
http://www.shorinjikempo-ryu.it>
[
https://www.next.it/nextant/image/LogoBannerNextant.jpg]
Nextant - Navcomm Applications<
http://www.next.it>
Via Alessandro Noale
<
http://maps.google.com/maps?q=Via+Alessandro+Noale&hl=en>
See who we know in common<
http://www.linkedin.com/e/wwk/7254039/>
Want a signature like this?<
http://www.linkedin.com/e/sig/7254039/>
----- Messaggio originale -----
Da: "Weisburd, Ben" <benw_at_ll.mit.edu>
A: Jay D. Askren <jda_at_quantumleap.us>; "openmap-users_at_bbn.com" <openmap-users_at_bbn.com>
Inviato: Venerd́ 11 aprile 2008, 1:46:56
Oggetto: RE: [OpenMap Users] Moving the map like Google
Hi Jay,
I've attached subclasses of MapBean and ProjectionSupport.
We also had to subclass
BasicMapPanel so that createMapBean(Projection proj, Border border)
instanciated MyMapBean instead of a BufferedLayerMapBean, and had a custom main class
in place of OpenMap.java which instanciated MyBasicMapPanel.
Not sure if there is a better way to do all this, but hope this helps.
-Ben
-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On Behalf Of Jay D. Askren
Sent: Thursday, April 10, 2008 10:40 AM
To: openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] Moving the map like Google
I would be very interested in that code if you could post it somewhere.
I've been wanting to do the first item you mentioned but haven't had a
chance to do it.
Jay
-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of Weisburd, Ben
Sent: Thursday, April 10, 2008 10:12 AM
To: 'F.Bayliss'; openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] Moving the map like Google
Hi Frank,
We are doing something similar for a weather display of the continental
US. It has to display large rasters of radar data and various overlays.
We did several optimizations to make google-like panning/zooming work
faster:
- Since the data was on the local disk, we made the map repaint once
when all layers are done rendering, and prevented the layers from
calling repaint() on themselves. This made interaction smoother and
avoided flicker.
- originally we used OMGraphics for the overlays, but this was slow
because they had to project themselves from lat/lon to pixel coordinates
every time the user panned or zoomed. Since we only needed to look at
the continental US, and had a fixed projection type, we treated the map
as a 2D grid with 0,0 being near Seattle . So we made OMGraphics store
everything in our grid's pixel coordinates instead of lat/lon.
- for the large raster images, we pre-generated tiles at several zoom
steps.
We had to do a lot of subclassing for this, but didn't have to modify
openmap source. Let me know if you want any of that code.
-Ben
-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of F.Bayliss
Sent: Thursday, April 10, 2008 6:12 AM
To: openmap-users_at_bbn.com
Subject: [OpenMap Users] Moving the map like Google
Hello,
I've been asked by my upper management to once again mimic the way
Google allows the user to move the map. I've spent a lot of time on
this, too much, and I don't see anyway it can work. I have several,
several layers and the time it takes to process and draw a map movement
event is slow and that results in a choppy map picture. I've tried
several approaches, the best being drawing the map to an image buffer
and replacing the map with that, letting them move what they think is
the map. But this isn't acceptable because it takes time to create the
image. I was hoping the experts had a better idea.
Thanks
Frank
--
[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"]
--
[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"]
________________________________
Inviato da Yahoo! Mail<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http:/us.rd.yahoo.com/evt=52437/*http:/it.docs.yahoo.com/mail/overview/index.html>.
La casella di posta intelligente.
--
[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 Apr 24 2008 - 12:00:15 EDT