var OLM = {}; (function(OLM) { OLM.initialized = false; OLM.minZoom = 3; OLM.maxZoom = 19; OLM.maxResolution = 156543.0339; OLM.resolutions = []; OLM.zoomOffset = 0; OLM.LAYER_RELIEF_ZINDEX = 510; OLM.LAYER_BASE_ZINDEX = 500; OLM.LAYER_PATH_ZINDEX = 550; OLM.LAYER_MARKERS_ZINDEX = 600; OLM.LAYER_MARKERSHIGHLIGHTED_ZINDEX = 605; OLM.cbOnTuristActivate = null; OLM.cbOnTuristDeactivate = null; OLM.cbOnCykloActivate = null; OLM.cbOnCykloDeactivate = null; OLM.cbOnOFActivate = null; OLM.cbOnOFDeactivate = null; OLM.cbOnWinterActivate = null; OLM.cbOnWinterDeactivate = null; OLM.cbOnReliefActivate = null; OLM.cbOnReliefDeactivate = null; OLM.Markers = new function() { this.nextMarkerId = 1; this.createMarker = function(latLng, map, style) { var point = map.fromLatLng(latLng); var marker = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(point.lon, point.lat), {style: style}, { externalGraphic: style.externalGraphic, graphicHeight: style.graphicHeight, graphicWidth: style.graphicWidth, graphicXOffset: style.graphicXOffset, graphicYOffset: style.graphicYOffset, cursor: style.cursor } ); marker.redraw = function(style) { if (this.olmLayerAdded) { this.olmLayerAdded.drawFeature(this); } } marker.olmMarkerId = this.getNewMarkerId(); marker.olmMap = map; marker.olmLayerAdded = null; return marker; } this.getNewMarkerId = function() { return this.nextMarkerId++; } }(); OLM.OLMap = function(elMap, settings) { this.elMap = elMap; this.map; this.ctrlScaleLine; this.ctrlNavigation; this.elSHOCartLogo; this.isOnTurist; this.isOnCyklo; this.isOnOF; this.isOnWinter; this.isOnRelief; this.isOnSimplePath = false; this.vSimplePathLayer = null; this.isOnSimplePathMarkers = false; this.vSimplePathMarkersLayer = null; this.addedMarkers = {}; this.vMarkersLayer = null; this.vMarkersLayerSelectControl = null; this.vMarkersHighlightedLayer = null; this.projection = new OpenLayers.Projection('EPSG:900913'); this.displayProjection = new OpenLayers.Projection('EPSG:4326'); this.initialize = function() { this.map = new OpenLayers.Map(this.elMap.id, { controls: [], maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), maxResolution: OLM.maxResolution, projection: this.projection, displayProjection: this.displayProjection }); //this.map.addControl(new OpenLayers.Control.MousePosition()); this.prepareDefaultLayers(); this.projectionObject = this.map.getProjectionObject(); if ((settings.pos) && (settings.zoom)) this.setCenter(settings.pos, settings.zoom); this.prepareDefWorkingArea(); } this.prepareDefWorkingArea = function() { this.defWorkingArea = new OpenLayers.Bounds(); this.defWorkingArea.extend(this.fromLatLng(new OLM.LatLng(51.5, 11.5))); this.defWorkingArea.extend(this.fromLatLng(new OLM.LatLng(47.5, 23))); } this.isInDefWorkingArea = function(pos) { return this.defWorkingArea.containsLonLat((new OpenLayers.LonLat(pos.lng, pos.lat)).transform(this.map.displayProjection, this.projectionObject)); } this.activateNavigation = function() { if (!this.ctrlNavigation) { this.ctrlNavigation = new OpenLayers.Control.Navigation({'zoomWheelEnabled': false}); this.map.addControl(this.ctrlNavigation); } } this.deactivateNavigation = function() { if (this.ctrlNavigation) { this.map.removeControl(this.ctrlNavigation); this.ctrlNavigation = null; } } this.activateMapWheel = function() { if (this.ctrlNavigation) { this.ctrlNavigation.enableZoomWheel(); } } this.deactivateMapWheel = function() { if (this.ctrlNavigation) { this.ctrlNavigation.disableZoomWheel(); } } this.activateScaleLine = function() { if (!this.ctrlScaleLine) { this.ctrlScaleLine = new OpenLayers.Control.ScaleLine(); this.ctrlScaleLine.geodesic = true; this.map.addControl(this.ctrlScaleLine); } } this.deactivateScaleLine = function() { if (this.ctrlScaleLine) { this.map.removeControl(this.ctrlScaleLine); this.ctrlScaleLine = null; } } this.activateSHOCartLogo = function() { if (!this.elSHOCartLogo) { this.elSHOCartLogo = document.createElement('a'); this.elSHOCartLogo.href = 'http://www.shocart.cz/'; this.elSHOCartLogo.target = '_blank'; this.elSHOCartLogo.style.display = 'block'; this.elSHOCartLogo.style.position = 'relative'; this.elSHOCartLogo.style.styleFloat = 'right'; this.elSHOCartLogo.style.cssFloat = 'right'; this.elSHOCartLogo.style.right = '0px'; this.elSHOCartLogo.style.bottom = '0px'; this.elSHOCartLogo.style.zIndex = '9999'; this.elSHOCarLogoImg = document.createElement('img'); this.elSHOCarLogoImg.src = 'https://www.cykloserver.cz/img/shocart_logo_h25_emb.gif'; this.elSHOCarLogoImg.style.position = 'absolute'; this.elSHOCarLogoImg.style.zIndex = '9999'; this.elSHOCartLogo.appendChild(this.elSHOCarLogoImg); this.elMap.appendChild(this.elSHOCartLogo); } } this.deactivateSHOCartLogo = function() { if (this.elSHOCartLogo) { this.elMap.removeChild(this.elSHOCartLogo); this.elSHOCartLogo = null; } } this.moveSHOCartLogo = function(left, bottom, right, top) { if (this.elSHOCarLogoImg) { if (left != null) { this.elSHOCarLogoImg.style.left = left + 'px'; } if (bottom != null) { this.elSHOCarLogoImg.style.bottom = bottom + 'px'; } if (right != null) { this.elSHOCarLogoImg.style.right = right + 'px'; } if (top != null) { this.elSHOCarLogoImg.style.top = top + 'px'; } } } this.activateSimplePath = function(pts, opts) { if (!this.isOnSimplePath) { this.isOnSimplePath = true; this.vSimplePathLayer = new OpenLayers.Layer.Vector('SimplePath'); this.map.addLayer(this.vSimplePathLayer); this.vSimplePathLayer.div.style.zIndex = OLM.LAYER_PATH_ZINDEX; this.vSimplePathLayer.presetZIndex = OLM.LAYER_PATH_ZINDEX; var style = { strokeColor: "#000000", strokeWidth: 5, strokeOpacity: 0.8 }; if (opts.color) style.strokeColor = opts.color; if (opts.width) style.strokeWidth = opts.width; if (opts.opacity) style.strokeOpacity = opts.opacity; var points = new Array(); while (pts.length) { var p = pts.pop(); points.push(this.pointFromLatLng(p)); } var g = new OpenLayers.Geometry.LineString(points); this.vSimplePathLayer.addFeatures([new OpenLayers.Feature.Vector(g, null, style)]); } } this.deactivateSimplePath = function() { if (this.isOnSimplePath) { this.isOnSimplePath = false; this.map.removeLayer(this.vSimplePathLayer); this.vSimplePathLayer.removeAllFeatures(); this.vSimplePathLayer = null; } } this.activateSimplePathMarkers = function(markers) { if (!this.isOnSimplePathMarkers) { this.isOnSimplePathMarkers = true; this.vSimplePathMarkerLayer = new OpenLayers.Layer.Markers('SimplePathMarkers'); this.map.addLayer(this.vSimplePathMarkerLayer); this.vSimplePathMarkerLayer.div.style.zIndex = OLM.LAYER_MARKERS_ZINDEX; this.vSimplePathMarkerLayer.presetZIndex = OLM.LAYER_MARKERS_ZINDEX; while (markers.length) { var markerInfo = markers.pop(); if (markerInfo.type == 'start') { var size = new OpenLayers.Size(30, 24); var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); var icon = new OpenLayers.Icon('https://www.cykloserver.cz/img/cyklo-ico-start.gif', size, offset); } else if (markerInfo.type == 'end') { var size = new OpenLayers.Size(30, 24); var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); var icon = new OpenLayers.Icon('https://www.cykloserver.cz/img/cyklo-ico-cil.gif', size, offset); } else if (markerInfo.type == 'point') { var size = new OpenLayers.Size(10, 10); var offset = new OpenLayers.Pixel(-(size.w/2), -(size.h/2)); var icon = new OpenLayers.Icon('https://www.cykloserver.cz/img/cykloatlas-point.gif', size, offset); } else { var size = new OpenLayers.Size(30, 24); var offset = new OpenLayers.Pixel(-(size.w/2) + 1, -size.h + 1); var icon = new OpenLayers.Icon('https://www.cykloserver.cz/img/cyklo-ico-poi.gif', size, offset); } icon.imageDiv.title = markerInfo.name; var marker = new OpenLayers.Marker(this.fromLatLng(markerInfo.pos), icon); this.vSimplePathMarkerLayer.addMarker(marker); } } } this.deactivateSimplePathMarkers = function() { if (this.isOnSimplePathMarkers) { this.isOnSimplePathMarkers = false; this.map.removeLayer(this.vSimplePathMarkerLayer); this.vSimplePathMarkerLayer = null; } } this.addMarker = function(marker, settings) { if (!this.addedMarkers['id' + marker.olmMarkerId]) { this.addedMarkers['id' + marker.olmMarkerId] = marker; marker.olmLayerAdded = this.vMarkersLayer; this.vMarkersLayer.addFeatures([marker]); } } this.removeMarker = function(marker) { if (this.addedMarkers['id' + marker.olmMarkerId]) { this.vMarkersLayer.removeFeatures([marker]); marker.olmLayerAdded = null; this.addedMarkers['id' + marker.olmMarkerId] = null; } } this.removeAllMarkers = function() { while (this.addedMarkers.length) { var m = this.addedMarkers.pop(); this.vMarkersLayer.removeFeatures([marker]); } } this.prepareDefaultLayers = function() { this.isOnTurist = false; this.isOnCyklo = false; this.isOnOF = false; this.isOnWinter = false; this.isOnRelief = false; this.activateLayerCyklo(); if (!OLM.restrictMarkersLayer) this.prepareMarkersLayer(); } this.prepareMarkersLayer = function() { this.vMarkersLayer = new OpenLayers.Layer.Vector("OLLayerMarkers", {rendererOptions: {yOrdering: true}}); this.map.addLayer(this.vMarkersLayer); this.vMarkersLayer.div.style.zIndex = OLM.LAYER_MARKERS_ZINDEX; this.vMarkersLayer.presetZIndex = OLM.LAYER_MARKERS_ZINDEX; this.vMarkersLayer.presetDisplay = 'none'; this.vMarkersHighlightedLayer = new OpenLayers.Layer.Vector("OLLayerMarkersHighlighted"); this.map.addLayer(this.vMarkersHighlightedLayer); this.vMarkersHighlightedLayer.div.style.zIndex = OLM.LAYER_MARKERSHIGHLIGHTED_ZINDEX; this.vMarkersHighlightedLayer.presetZIndex = OLM.LAYER_MARKERSHIGHLIGHTED_ZINDEX; this.vMarkersHighlightedLayer.presetDisplay = 'none'; this.vMarkersLayerSelectControl = new OpenLayers.Control.SelectFeature([this.vMarkersLayer, this.vMarkersHighlightedLayer], { callbacks: { click: jQuery.proxy(this.onMarkersLayerFeatureSelected, this), over: jQuery.proxy(this.onMarkersLayerBeforeFeatureHighlighted, this), out: jQuery.proxy(this.onMarkersLayerFeatureUnhighlighted, this) } }); this.map.addControl(this.vMarkersLayerSelectControl); this.vMarkersLayerSelectControl.activate(); } this.onMarkersLayerBeforeFeatureHighlighted = function(ev) { if (ev.olmMarkerId) { if (ev.onMouseOver) { ev.onMouseOver(ev); } this.vMarkersHighlightedLayer.destroyFeatures(); if (ev.attributes) { if (ev.attributes.style) { if (ev.attributes.style.externalGraphicSel) { var p = ev.geometry.clone(); var marker = new OpenLayers.Feature.Vector( p, {}, { externalGraphic: ev.attributes.style.externalGraphicSel, graphicHeight: ev.attributes.style.graphicHeight, graphicWidth: ev.attributes.style.graphicWidth, graphicXOffset: ev.attributes.style.graphicXOffset, graphicYOffset: ev.attributes.style.graphicYOffset, cursor: ev.attributes.style.cursor } ); marker.forMarker = ev; this.vMarkersHighlightedLayer.addFeatures([marker]); } } } } } this.onMarkersLayerFeatureUnhighlighted = function(ev) { if (ev) { if (!ev.olmMarkerId) { if (ev.forMarker) { this.vMarkersHighlightedLayer.destroyFeatures(); if (ev.forMarker.onMouseOut) { ev.forMarker.onMouseOut(ev); } } } else { if (!ev.attributes.style.externalGraphicSel) { if (ev.onMouseOut) { ev.onMouseOut(ev); } } } } } this.onMarkersLayerFeatureSelected = function(ev) { var pixel = this.vMarkersLayerSelectControl.handlers.feature.evt.xy; var ll = this.map.getLonLatFromPixel(pixel); ev.ll = ll; if (ev.onMouseClick) { ev.onMouseClick(ev); } else { if (ev.forMarker) { if (ev.forMarker.onMouseClick) { ev.forMarker.onMouseClick(ev); } } } } this.activateLayerTurist = function() { var z = this.map.getZoom(); if (!this.isOnTurist) { jQuery('#copyrightBlockOF').css('display', 'none'); jQuery('#copyrightBlockDefault').css('display', 'block'); this.isOnTurist = true; this.map.addLayer(OLM.LayerTurist); if (this.isOnOF) { this.isOnOF = false; this.map.removeLayer(OLM.LayerOF); if (this.cbOnOFDeactivate) this.cbOnOFDeactivate(); } if (this.isOnCyklo) { this.isOnCyklo = false; this.map.removeLayer(OLM.LayerCyklo); // possible layer removal zoom problem patch if (this.map.getZoom() != z) { this.map.zoomTo(z); } if (this.cbOnCykloActivate) this.cbOnCykloActivate(); } if (this.isOnWinter) { this.isOnWinter = false; this.map.removeLayer(OLM.LayerWinter); if (this.cbOnWinterActivate) this.cbOnWinterActivate(); } if (this.cbOnTuristActivate) this.cbOnTuristActivate(); } if (this.map.getZoom() > 14) this.map.zoomTo(14); } this.activateLayerCyklo = function() { if (!this.isOnCyklo) { jQuery('#copyrightBlockOF').css('display', 'none'); jQuery('#copyrightBlockDefault').css('display', 'block'); this.isOnCyklo = true; this.map.addLayer(OLM.LayerCyklo); if (this.isOnOF) { this.isOnOF = false; this.map.removeLayer(OLM.LayerOF); if (this.cbOnOFDeactivate) this.cbOnOFDeactivate(); } if (this.isOnTurist) { this.isOnTurist = false; this.map.removeLayer(OLM.LayerTurist); if (this.cbOnTuristDeactivate) this.cbOnTuristDeactivate(); } if (this.isOnWinter) { this.isOnWinter = false; this.map.removeLayer(OLM.LayerWinter); if (this.cbOnWinterDeactivate) this.cbOnWinterDeactivate(); } if (this.cbOnCykloActivate) this.cbOnCykloActivate(); } if (this.map.getZoom() > 12) this.map.zoomTo(12); } this.activateLayerOF = function() { var z = this.map.getZoom(); if (!this.isOnOF) { jQuery('#copyrightBlockDefault').css('display', 'none'); jQuery('#copyrightBlockOF').css('display', 'block'); this.isOnOF = true; this.map.addLayer(OLM.LayerOF); if (this.isOnCyklo) { this.isOnCyklo = false; this.map.removeLayer(OLM.LayerCyklo); // possible layer removal zoom problem patch if (this.map.getZoom() != z) { this.map.zoomTo(z); } if (this.cbOnCykloActivate) this.cbOnCykloActivate(); } if (this.isOnTurist) { this.isOnTurist = false; this.map.removeLayer(OLM.LayerTurist); if (this.cbOnTuristDeactivate) this.cbOnTuristDeactivate(); } if (this.isOnWinter) { this.isOnWinter = false; this.map.removeLayer(OLM.LayerWinter); if (this.cbOnWinterDeactivate) this.cbOnWinterDeactivate(); } if (this.cbOnOFActivate) this.cbOnOFActivate(); } } this.activateLayerWinter = function() { var z = this.map.getZoom(); if (!this.isOnWinter) { jQuery('#copyrightBlockOF').css('display', 'none'); jQuery('#copyrightBlockDefault').css('display', 'block'); this.isOnWinter = true; this.map.addLayer(OLM.LayerWinter); if (this.isOnOF) { this.isOnOF = false; this.map.removeLayer(OLM.LayerOF); if (this.cbOnOFDeactivate) this.cbOnOFDeactivate(); } if (this.isOnTurist) { this.isOnTurist = false; this.map.removeLayer(OLM.LayerTurist); if (this.cbOnTuristDeactivate) this.cbOnTuristDeactivate(); } if (this.isOnCyklo) { this.isOnCyklo = false; this.map.removeLayer(OLM.LayerCyklo); // possible layer removal zoom problem patch if (this.map.getZoom() != z) { this.map.zoomTo(z); } if (this.cbOnCykloDeactivate) this.cbOnCykloDeactivate(); } if (this.cbOnWinterActivate) this.cbOnWinterActivate(); } if (this.map.getZoom() > 12) this.map.zoomTo(12); } this.getMapType = function() { if (this.isOnCyklo) { return 0; } else { return 1; } } this.flipLayerRelief = function() { if (!this.isOnRelief) { this.activateLayerRelief(); } else { this.deactivateLayerRelief(); } } this.activateLayerRelief = function() { if (!this.isOnRelief) { this.isOnRelief = true; this.map.addLayer(OLM.LayerRelief); } if (this.cbOnReliefActivate) this.cbOnReliefActivate(); } this.deactivateLayerRelief = function() { if (this.isOnRelief) { this.isOnRelief = false; this.map.removeLayer(OLM.LayerRelief); } if (this.cbOnReliefDeactivate) this.cbOnReliefDeactivate(); } this.showExtent = function(left, bottom, right, top, maxZoom) { var p1 = this.fromLatLng(new OLM.LatLng(bottom, left)); var p2 = this.fromLatLng(new OLM.LatLng(top, right)); var bnds = new OpenLayers.Bounds(p1.lon, p1.lat, p2.lon, p2.lat); var zoom = this.map.getZoomForExtent(bnds); if (maxZoom) { if (zoom > maxZoom) zoom = maxZoom; } else { if (zoom > 8) zoom = 8; } this.map.setCenter(bnds.getCenterLonLat(), zoom); } this.setCenter = function(pos, zoom) { if (zoom) { this.map.setCenter(this.fromLatLng(pos), zoom - OLM.zoomOffset); } else { this.map.setCenter(this.fromLatLng(pos)); } } this.getCenter = function(pos, zoom) { return this.getLatLngFromLonLat(this.map.getCenter()); } this.panDirection = function(h, v) { this.map.pan(h * -400, v * -400); } this.panTo = function(latLng) { this.map.panTo(this.fromLatLng(latLng)); } this.getBounds = function() { return this.map.getExtent().transform(this.projection, this.displayProjection).toArray(); } this.getBoundsObj = function() { return this.map.getExtent().transform(this.projection, this.displayProjection); } this.zoomIn = function() { this.map.zoomIn(); } this.zoomOut = function() { this.map.zoomOut(); } this.getZoom = function() { return this.map.getZoom() + OLM.zoomOffset; } this.setZoom = function(lvl) { return this.map.zoomTo(lvl - OLM.zoomOffset); } this.pointFromLatLng = function(pos) { var point = new OpenLayers.Geometry.Point(pos.lng, pos.lat).transform(new OpenLayers.Projection("EPSG:4326"), this.projectionObject); return point; } this.fromLatLng = function(pos) { var lonLat = new OpenLayers.LonLat(pos.lng, pos.lat); lonLat.transform(this.map.displayProjection, this.projectionObject); return lonLat; } this.getLatLngFromLonLat = function(pos) { var ll = pos.clone().transform(this.projection, this.displayProjection); return new OLM.LatLng(ll.lat, ll.lon); } this.getLatLngFromPixel = function(pos) { var ll = this.map.getLonLatFromPixel(pos).transform(this.projection, this.displayProjection); return new OLM.LatLng(ll.lat, ll.lon); } this.getLatLngFromPoint = function(pos) { var ll = new OpenLayers.LonLat(pos.x, pos.y); ll.transform(this.projectionObject, new OpenLayers.Projection("EPSG:4326")); return new OLM.LatLng(ll.lat, ll.lon); } this.tranformToOLM = function(obj) { return obj.clone().transform(this.projection, this.displayProjection); } this.tranformToOL = function(obj) { return obj.clone().transform(this.displayProjection, this.projection); } this.initialize(); return this; } OLM.LatLng = function(lat, lng) { this.lat = lat; this.lng = lng; return this; } OLM.NewOLLayerTurist = function() { var layer = new OpenLayers.Layer.TMS('OLLayerTurist', '', {'type':'png', 'getURL':OLM.getLayerTuristURL, 'isBaseLayer':true, 'wrapDateLine': true, resolutions:OLM.resolutions, zoomOffset:OLM.zoomOffset}); layer.presetZIndex = OLM.LAYER_BASE_ZINDEX; return layer; } OLM.NewOLLayerCyklo = function() { var layer = new OpenLayers.Layer.TMS('OLLayerCyklo', '', {'type':'png', 'getURL':OLM.getLayerCykloURL, 'isBaseLayer':true, 'wrapDateLine': true, resolutions:OLM.resolutions, zoomOffset:OLM.zoomOffset}); layer.presetZIndex = OLM.LAYER_BASE_ZINDEX; return layer; } OLM.NewOLLayerOF = function() { var layer = new OpenLayers.Layer.WMS('OLLayerOF', 'http://ags.cuzk.cz/arcgis/services/ortofoto/MapServer/WMSServer', {layers: '0'}, {resolutions: OLM.resolutions}); layer.presetZIndex = OLM.LAYER_BASE_ZINDEX; layer.projection = 'EPSG:3857'; return layer; } OLM.NewOLLayerWinter = function() { var layer = new OpenLayers.Layer.TMS('OLLayerWinter', '', {'type':'png', 'getURL':OLM.getLayerWinterURL, 'isBaseLayer':true, 'wrapDateLine': true, resolutions:OLM.resolutions, zoomOffset:OLM.zoomOffset}); layer.presetZIndex = OLM.LAYER_BASE_ZINDEX; return layer; } OLM.NewOLLayerRelief = function() { var layer = new OpenLayers.Layer.TMS('OLLayerRelief', '', {'type':'png', 'getURL':OLM.getLayerReliefURL, 'isBaseLayer':false, 'alpha':true, resolutions:OLM.resolutions, zoomOffset:OLM.zoomOffset}); layer.presetZIndex = OLM.LAYER_RELIEF_ZINDEX; return layer; } OLM.getLayerTuristURL = function(bnds) { var res = this.map.getResolution(); var x = Math.round((bnds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bnds.top) / (res * this.tileSize.h)); var z = this.map.getZoom() + this.zoomOffset; return __tt_gettilemapturist({'x':x, 'y':y}, z); } OLM.getLayerCykloURL = function(bnds) { var res = this.map.getResolution(); var x = Math.round((bnds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bnds.top) / (res * this.tileSize.h)); var z = this.map.getZoom() + this.zoomOffset; return __tt_gettilemapturistcyklo({'x':x, 'y':y}, z); } OLM.getLayerWinterURL = function(bnds) { var res = this.map.getResolution(); var x = Math.round((bnds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bnds.top) / (res * this.tileSize.h)); var z = this.map.getZoom() + this.zoomOffset; return __tt_gettilemapwinter({'x':x, 'y':y}, z); } OLM.getLayerReliefURL = function(bnds) { var res = this.map.getResolution(); var x = Math.round((bnds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bnds.top) / (res * this.tileSize.h)); var z = this.map.getZoom() + this.zoomOffset; return __tt_gettilemaprelief({'x':x, 'y':y}, z); } OLM.initialize = function() { if (!OLM.initialized) { OLM.resolutions = []; OLM.zoomOffset = OLM.minZoom; var res = OLM.maxResolution; for (var zoom = 0; zoom <= OLM.maxZoom; zoom++) { if (zoom >= OLM.minZoom) OLM.resolutions.push(res); res*= 0.5; } OLM.LayerTurist = OLM.NewOLLayerTurist(); OLM.LayerCyklo = OLM.NewOLLayerCyklo(); OLM.LayerOF = OLM.NewOLLayerOF(); OLM.LayerWinter = OLM.NewOLLayerWinter(); OLM.LayerRelief = OLM.NewOLLayerRelief(); OLM.initialized = true; } } }(OLM));