Ignore:
Timestamp:
2013-12-07T15:19:55+01:00 (10 years ago)
Author:
Don-vip
Message:

global use of osm website url and new url scheme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r6394 r6453  
    249249
    250250    /**
    251      * Return OSM URL for given area
     251     * Return OSM URL for given area.
    252252     *
    253253     * @param b bounds of the area
    254254     * @return link to display that area in OSM map
    255255     */
    256     static public String getURL(Bounds b) {
     256    public static String getURL(Bounds b) {
    257257        return getURL(b.getCenter(), getZoom(b));
    258258    }
    259259
    260260    /**
    261      * Return OSM URL for given position and zoom
     261     * Return OSM URL for given position and zoom.
    262262     *
    263263     * @param pos center position of area
     
    265265     * @return link to display that area in OSM map
    266266     */
    267     static public String getURL(LatLon pos, int zoom) {
     267    public static String getURL(LatLon pos, int zoom) {
     268        return getURL(pos.lat(), pos.lon(), zoom);
     269    }
     270
     271    /**
     272     * Return OSM URL for given lat/lon and zoom.
     273     *
     274     * @param dlat center latitude of area
     275     * @param dlon center longitude of area
     276     * @param zoom zoom depth of display
     277     * @return link to display that area in OSM map
     278     *
     279     * @since 6453
     280     */
     281    public static String getURL(double dlat, double dlon, int zoom) {
    268282        // Truncate lat and lon to something more sensible
    269283        int decimals = (int) Math.pow(10, (zoom / 3));
    270         double lat = (Math.round(pos.lat() * decimals));
     284        double lat = (Math.round(dlat * decimals));
    271285        lat /= decimals;
    272         double lon = (Math.round(pos.lon() * decimals));
     286        double lon = (Math.round(dlon * decimals));
    273287        lon /= decimals;
    274         return "http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom;
     288        return Main.OSM_WEBSITE + "/#map="+zoom+"/"+lat+"/"+lon;
    275289    }
    276290}
Note: See TracChangeset for help on using the changeset viewer.