Y-SLD/assets/js/map-preview.js.map

1 line
6.4 KiB
Plaintext

{"version":3,"sources":["layer-preview.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"map-preview.js","sourcesContent":["L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({\r\n\r\n onAdd: function (map) {\r\n // Triggered when the layer is added to a map.\r\n // Register a click listener, then do all the upstream WMS things\r\n L.TileLayer.WMS.prototype.onAdd.call(this, map);\r\n map.on('click', this.getFeatureInfo, this);\r\n },\r\n\r\n onRemove: function (map) {\r\n // Triggered when the layer is removed from a map.\r\n // Unregister a click listener, then do all the upstream WMS things\r\n L.TileLayer.WMS.prototype.onRemove.call(this, map);\r\n map.off('click', this.getFeatureInfo, this);\r\n },\r\n\r\n getFeatureInfo: function (evt) {\r\n // Make an AJAX request to the server and hope for the best\r\n var url = this.getFeatureInfoUrl(evt.latlng),\r\n showResults = L.Util.bind(this.showGetFeatureInfo, this);\r\n $.ajax({\r\n url: url,\r\n success: function (data, status, xhr) {\r\n var err = typeof data === 'string' ? null : data;\r\n showResults(err, evt.latlng, data);\r\n },\r\n error: function (xhr, status, error) {\r\n showResults(error);\r\n }\r\n });\r\n },\r\n\r\n getFeatureInfoUrl: function (latlng) {\r\n // Construct a GetFeatureInfo request URL given a point\r\n var point = this._map.latLngToContainerPoint(latlng, this._map.getZoom()),\r\n size = this._map.getSize(),\r\n params = {\r\n request: 'GetFeatureInfo',\r\n service: 'WMS',\r\n srs: 'EPSG:4326',\r\n styles: this.wmsParams.styles,\r\n transparent: this.wmsParams.transparent,\r\n version: this.wmsParams.version,\r\n format: this.wmsParams.format,\r\n bbox: this._map.getBounds().toBBoxString(),\r\n height: size.y,\r\n width: size.x,\r\n layers: this.wmsParams.layers,\r\n query_layers: this.wmsParams.layers,\r\n info_format: 'text/html'\r\n };\r\n\r\n params[params.version === '1.3.0' ? 'i' : 'x'] = point.x;\r\n params[params.version === '1.3.0' ? 'j' : 'y'] = point.y;\r\n\r\n return this._url + L.Util.getParamString(params, this._url, true);\r\n },\r\n\r\n showGetFeatureInfo: function (err, latlng, content) {\r\n if (err) {\r\n console.log(err);\r\n return;\r\n } // do nothing if there's an error\r\n\r\n\r\n if (jQuery(content).find(\"tr\").length < 2) {\r\n return;\r\n }\r\n\r\n content = content.toLowerCase();\r\n\r\n //var content = content.replace('/g', \"<table\");\r\n\r\n jQuery(content).filter(\"table\").addClass(\"table\");\r\n\r\n // Otherwise show the content in a popup, or something.\r\n L.popup({maxWidth: 'auto'})\r\n .setLatLng(latlng)\r\n .setContent(content)\r\n .openOn(this._map);\r\n\r\n// $('.leaflet-popup-content-wrapper').find('table').each(function(){\r\n// jQuery(this).replaceWith( jQuery(this).html()\r\n// .replace(/<tbody/gi, \"<div id='table'\")\r\n// .replace(/<tr/gi, \"<div\")\r\n// .replace(/<\\/tr>/gi, \"</div>\")\r\n// .replace(/<td/gi, \"<span\")\r\n// .replace(/<\\/td>/gi, \"</span>\")\r\n// .replace(/<\\/tbody/gi, \"<\\/div\")\r\n//);\r\n// });\r\n\r\n\r\n //$('.leaflet-popup-content-wrapper').find('table').addClass(\"table\");\r\n\r\n// each(function (){\r\n// $(this).replaceWith( $(this).html()\r\n// .replace(/<tbody/gi, \"<div class='table'\")\r\n// .replace(/<tr/gi, \"<div class='ccbnOutline'\")\r\n// .replace(/<\\/tr>/gi, \"</div>\")\r\n// .replace(/<td/gi, \"<span\")\r\n// .replace(/<\\/td>/gi, \"</span>\")\r\n// .replace(/<\\/tbody/gi, \"<\\/div\")\r\n// );\r\n // });\r\n }\r\n});\r\n\r\nL.tileLayer.myWms = function (url, options) {\r\n return new L.TileLayer.BetterWMS(url, options);\r\n};\r\n\r\n\r\njQuery(document).ready(function () {\r\n\r\n var mymap = L.map('mapid', {\r\n zoom: 8,\r\n crs: L.CRS.EPSG4326\r\n });\r\n\r\n mymap.setView([parseFloat(lat1), parseFloat(lng1)], 8);\r\n\r\n if (isGoogle()){\r\n \r\n currentBaseMap = L.tileLayer('https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {\r\n maxZoom: 20,\r\n subdomains: ['mt0', 'mt1', 'mt2', 'mt3']\r\n }).addTo(mymap);\r\n \r\n\r\n } else {\r\n\r\n currentBaseMap = L.tileLayer(baseLayers['mymap'][layername]._url, {\r\n maxZoom: 18,\r\n attribution: baseLayers['mymap'][layername].options.attribution,\r\n id: baseLayers['mymap'][layername].options.id\r\n }).addTo(mymap);\r\n }\r\n\r\n var states = L.tileLayer.myWms(url, {\r\n format: 'image/png',\r\n layers: layerName,\r\n format: 'image/png',\r\n transparent: true,\r\n //crs: L.CRS.EPSG4326\r\n });\r\n states.addTo(mymap);\r\n\r\n var bounds = new L.LatLngBounds([parseFloat(lat1), parseFloat(lng1)], [parseFloat(lat2), parseFloat(lng2)]);\r\n mymap.fitBounds(bounds);\r\n mymap.options.minZoom = mymap.getZoom();\r\n\r\n mymap.setMaxBounds(bounds);\r\n //var l = L.latLng(lat, lng);\r\n //console.log(states.getFeatureInfoUrl(l));\r\n})\r\n"]}