-$(document).ready(function () {
+function initializeExport(map) {
$("#exportanchor").click(function (e) {
$.ajax({ url: $(this).data('url'), success: function (sidebarHtml) {
startExport(sidebarHtml);
openSidebar();
- if (getMapBaseLayer().keyid == "mapnik") {
+ if (map.getMapBaseLayerId() == "mapnik") {
$("#format_mapnik").prop("checked", true);
}
}
function setBounds(bounds) {
- var toPrecision = zoomPrecision(map.getZoom());
+ var precision = zoomPrecision(map.getZoom());
- $("#minlon").val(toPrecision(bounds.getWest()));
- $("#minlat").val(toPrecision(bounds.getSouth()));
- $("#maxlon").val(toPrecision(bounds.getEast()));
- $("#maxlat").val(toPrecision(bounds.getNorth()));
+ $("#minlon").val(bounds.getWest().toFixed(precision));
+ $("#minlat").val(bounds.getSouth().toFixed(precision));
+ $("#maxlon").val(bounds.getEast().toFixed(precision));
+ $("#maxlat").val(bounds.getNorth().toFixed(precision));
mapnikSizeChanged();
htmlUrlChanged();
function htmlUrlChanged() {
var bounds = getBounds();
- var layerName = getMapBaseLayer().keyid;
+ var layerName = map.getMapBaseLayerId();
var url = "http://" + OSM.SERVER_URL + "/export/embed.html?bbox=" + bounds.toBBoxString() + "&layer=" + layerName;
var markerUrl = "";
var zoom = map.getBoundsZoom(bounds);
- var layers = getMapLayers();
+ var layers = map.getLayersCode();
var text = I18n.t('export.start_rjs.view_larger_map');
var escaped = [];
validateControls();
}
}
-});
+}