[OpenMap Users] Projection:getScale(LatLonPoint, LatLonPoint, Point, Point) problem

From: F.Bayliss <bayliss_at_alcatel-lucent.com>
Date: Fri, 09 Jan 2009 11:06:32 -0500

Hello,

When I call this function and get a new scale, and apply that new scale,
it seems like the scale is based on only making the two items fit in
the east/west direction. So if I place these two items so their
longitude are the same this function returns a scale for maximum zoom
and the items are not shown on the map. Below is the code I'm using. Any
idea's?

Thanks
Frank


        // rec is the bounding box of the two items (or more)
        Point point1 = rec.getLocation();
        Point point2 = new Point((int) rec.getMaxX(), (int) rec.getMaxY());
        float newScale = proj.getScale(proj.inverse(point1),
proj.inverse(point2), point1, point2);

        // Figure out the center of the rectangle
        int dx = Math.abs(point2.x - point1.x);
        int dy = Math.abs(point2.y - point1.y);
        int centerx = Math.min(point1.x, point2.x) + dx / 2;
        int centery = Math.min(point1.y, point2.y) + dy / 2;
        com.bbn.openmap.LatLonPoint center = proj.inverse(centerx, centery);

        ((Proj) proj).setCenter(center);
        if (siteList.size() > 1) {
            ((Proj) proj).setScale(newScale);
        }

--
[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 Jan 09 2009 - 11:14:52 EST

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