[OpenMap Users] Setting the Map Extent

From: Ümit DEMİR <udemir_at_aselsan.com.tr>
Date: Thu, 5 Apr 2007 10:33:01 +0300

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"]
Received on Thu Apr 05 2007 - 03:57:41 EDT

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