Changeset 6453 in josm for trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
- Timestamp:
- 2013-12-07T15:19:55+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r6394 r6453 249 249 250 250 /** 251 * Return OSM URL for given area 251 * Return OSM URL for given area. 252 252 * 253 253 * @param b bounds of the area 254 254 * @return link to display that area in OSM map 255 255 */ 256 static public String getURL(Bounds b) {256 public static String getURL(Bounds b) { 257 257 return getURL(b.getCenter(), getZoom(b)); 258 258 } 259 259 260 260 /** 261 * Return OSM URL for given position and zoom 261 * Return OSM URL for given position and zoom. 262 262 * 263 263 * @param pos center position of area … … 265 265 * @return link to display that area in OSM map 266 266 */ 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) { 268 282 // Truncate lat and lon to something more sensible 269 283 int decimals = (int) Math.pow(10, (zoom / 3)); 270 double lat = (Math.round( pos.lat()* decimals));284 double lat = (Math.round(dlat * decimals)); 271 285 lat /= decimals; 272 double lon = (Math.round( pos.lon()* decimals));286 double lon = (Math.round(dlon * decimals)); 273 287 lon /= decimals; 274 return "http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom;288 return Main.OSM_WEBSITE + "/#map="+zoom+"/"+lat+"/"+lon; 275 289 } 276 290 }
Note:
See TracChangeset
for help on using the changeset viewer.