Re: [OpenMap Users] Setting the Map Extent

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 6 Apr 2007 23:36:57 -0400

Hi Umit,

I'd use the com.bbn.openmap.proj.ProjMath getScale methods, which
know how to call the projection getScale methods. There are some
tricky aspects to calling the projection methods directly, because
they deal with the window height/width ratio. Check out the
com.bbn.openmap.event.NavMouseMode.mouseReleased() method for an
example.

Hope this helps,

Don

On Apr 5, 2007, at 3:33 AM, Ümit DEMİR wrote:

> Hi,
>
> I am trying to set the extent of the Map but I could not.
>
> Below is the code segment I am using to set map extent. Is there an
> easy way to do this?
>
> Thank you
>
> public void setMapExtent(CGeoExtent mapGeoExtent) {
> float maxlat = (float)mapGeoExtent.getMaxLatitude();
> float maxlon = (float)mapGeoExtent.getMaxLongitude();
> float minlat = (float)mapGeoExtent.getMinLatitude();
> float minlon = (float)mapGeoExtent.getMinLongitude();
> float centerLat = (maxlat + minlat) / 2;
> float centerLon = (maxlon + minlon) / 2;
> Projection proj = mapBean.getProjection();
> LatLonPoint upleft = new LatLonPoint(minlon, maxlat);
> LatLonPoint lowright = new LatLonPoint(maxlon, minlat);
> mapBean.setCenter(centerLon, centerLat);
> try{
> float scale = proj.getScale(upleft, lowright,
> new Point(0, 0),
> new Point
> (drawingPanel.getWidth(),
>
> drawingPanel.getHeight()));
> mapBean.setScale(scale);
> }
> catch (Exception ex){
> ex.printStackTrace();
> }
> }
>
> Drawing panel is the JPanel I am using for the map.
>
>
> Ümit Demir
> ASELSAN A.Ş.
> Kıdemli Uzman Mühendis
> 90 (312) 5922745
> ######################################################################
> Dikkat:
>
> Bu elektronik posta mesaji kisisel ve ozeldir. Eger size
> gonderilmediyse lutfen gondericiyi bilgilendirip mesaji siliniz.
> Firmamiza gelen ve giden mesajlar virus taramasindan gecirilmekte,
> guvenlik nedeni ile kontrol edilerek saklanmaktadir. Mesajdaki
> gorusler ve bakis acisi gondericiye ait olup Aselsan A.S. resmi
> gorusu olmak zorunda degildir.
>
> ######################################################################
> Attention:
>
> This e-mail message is privileged and confidential. If you are
> not the intended recipient please delete the message and notify
> the sender. E-mails to and from the company are monitored for
> operational reasons and in accordance with lawful business practices.
> Any views or opinions presented are solely those of the author and
> do not necessarily represent the views of the company.
>
> ######################################################################
>
> --
> [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"]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[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 Fri Apr 06 2007 - 23:40:12 EDT

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