Y-SLD/assets/js/map-share-bdf5b7a63f.js

2 lines
38 KiB
JavaScript
Raw Normal View History

2024-03-01 11:23:55 +00:00
function toWKT(e){var t,n,r=[];if(e instanceof L.Polygon||e instanceof L.Polyline){for(var a=e.getLatLngs(),i=0;i<a.length;i++)a[i],r.push(a[i].lng+" "+a[i].lat),0===i&&(t=a[i].lng,n=a[i].lat);if(e instanceof L.Polygon)return"POLYGON(("+r.join(",")+","+t+" "+n+"))";if(e instanceof L.Polyline)return"LINESTRING("+r.join(",")+")"}else if(e instanceof L.Marker)return"POINT("+e.getLatLng().lng+" "+e.getLatLng().lat+")"}function renderLayer(e,t){if("undefined"==typeof featureGroup[e.unique_id]&&(featureGroup[e.unique_id]=new Array),featureGroup[e.unique_id][e.name]=new L.FeatureGroup,"undefined"!=typeof e.settings?1==e.settings.active?featureGroup[e.unique_id][e.name].addTo(mymap):e.settings.active=0:(featureGroup[e.unique_id][e.name].addTo(mymap),e.settings=new Object,e.settings.active=1),"undefined"!=typeof page&&"manage"==page&&(jQuery("#active-layers-container").append(Mustache.render(tmpl.activeLayer,{t:e,type:layerType[e.type]})),0==e.settings.active&&jQuery("#at-"+e.unique_id+" a.dropdown-toggle span").addClass("label-danger").removeClass("label-primary"),jQuery(".help-active-popup-hover").popover({title:"Active & In-Active",content:'<div class="row"><div class="col-md-12"><p>This feature allows you to initially hide a layer. This can be used to achieve a desired layer presentation as well as to provide faster map loading for larger layers.</p></div></div>',html:!0,trigger:"hover",container:"body"}),jQuery(".at_active_chk").bootstrapSwitch({size:"mini",onSwitchChange:function(t,n){t.preventDefault();var r=jQuery(this).parents("ul:first"),a=r.attr("data-id"),i=getIndex(selectedLayers,"unique_id",a);selectedLayers[i].settings||"undefined"!=typeof selectedLayers[i].settings||(selectedLayers[i].settings=new Object),n===!0?(selectedLayers[i].settings.active=1,jQuery("#at-"+e.unique_id+" a.dropdown-toggle span").removeClass("label-danger").addClass("label-primary"),mymap.addLayer(featureGroup[a][selectedLayers[i].name])):(selectedLayers[i].settings.active=0,jQuery("#at-"+e.unique_id+" a.dropdown-toggle span").addClass("label-danger").removeClass("label-primary"),mymap.removeLayer(featureGroup[a][selectedLayers[i].name])),calculateBounds()}})),1==e.type||4==e.type){var n={format:"image/png",layers:e.Name,transparent:!0,crs:L.CRS.EPSG4326,unique_id:e.unique_id,srs1:e.SRS,layer_type:e.type};"undefined"!=typeof e.geometry_area&&(n.geometry=e.geometry_area),L.tileLayer.betterWms(e.url,n).addTo(featureGroup[e.unique_id][e.name])}else 2==e.type?""==t?(e.cache_timer||"undefined"!=typeof e.cache_timer||(e.cache_timer=15),t={datasource:e.connection_id,sql_layer_name:e.name,query_box:e.query,_token:jQuery('[name="_token"]').val(),cache_key:e.cache_key,cache_timer:e.cache_timer,type:2},ajaxRequest("map/layer/json","post","json",t,function(t){"200"==t.status?processSQLJSON(t,e):showMsg(t.status,t.msg)})):processSQLJSON(t,e):3==e.type;overlayers_controls(e),overlays[e.name]=featureGroup[e.unique_id][e.name],layerSelector.addOverlay(featureGroup[e.unique_id][e.name],e.name),3==e.type&&jQuery("#at-"+e.unique_id).find(".style-at-layer").remove(),calculateBounds()}function getPopupContent(e,t){return $.each(e.features,function(e,n){$.each(n.properties,function(e,n){t=t.replace("&lt;"+e+"&gt;",n)})}),t}function processSQLJSON(e,t){t=defaultLayerStyle(t),jQuery.each(e.result,function(e,n){L.geoJson(n,{onEachFeature:function(e,n){if(n instanceof L.Marker){var r=!1;"nr"==t.style.type?$.each(t.style.custom,function(a,i){if(between(e.properties[t.style.field],i.val))return r=!0,n.setIcon(L.AwesomeMarkers.icon(i.style)),!1}):"g"==t.style.type&&$.each(t.style.custom,function(a,i){if(e.properties[t.style.field]==i.val)return r=!0,n.setIcon(L.AwesomeMarkers.icon(i.style)),!1}),0==r&&n.setIcon(L.AwesomeMarkers.icon(t.style.marker))}n.on("click",function(r){var a=getSQLPopupContent(e.properties,t.pc);n.bindPopup(a)})},style:function(e,n){return t.style.polygon}}).addTo(featureGroup[t.unique_id][t.name]),mymap.fitBounds(featureGroup[t.unique_id][t.name].getBounds())})}function initLayer(){selectedLayers.sort(sort_value_layer),selectedBaseLayers.length>0&&
g["is"+e]=function(t){return f.call(t)==="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return g.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(g.isFunction=function(e){return"function"==typeof e||!1}),g.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&e!==+e},g.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===f.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,t){return null!=e&&p.call(e,t)},g.noConflict=function(){return a._=i,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=j,g.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},g.matcher=g.matches=function(e){return e=g.extendOwn({},e),function(t){return g.isMatch(t,e)}},g.times=function(e,t,n){var r=Array(Math.max(0,e));t=L(t,n,1);for(var a=0;e>a;a++)r[a]=t(a);return r},g.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},T=g.invert(B),F=function(e){var t=function(t){return e[t]},n="(?:"+g.keys(e).join("|")+")",r=RegExp(n),a=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(a,t):e}};g.escape=F(B),g.unescape=F(T),g.result=function(e,t,n){var r=null==e?void 0:e[t];return void 0===r&&(r=n),g.isFunction(r)?r.call(e):r};var G=0;g.uniqueId=function(e){var t=++G+"";return e?e+t:t},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var C=/(.)^/,E={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},P=/\\|'|\r|\n|\u2028|\u2029/g,N=function(e){return"\\"+E[e]};g.template=function(e,t,n){!t&&n&&(t=n),t=g.defaults({},t,g.templateSettings);var r=RegExp([(t.escape||C).source,(t.interpolate||C).source,(t.evaluate||C).source].join("|")+"|$","g"),a=0,i="__p+='";e.replace(r,function(t,n,r,o,u){return i+=e.slice(a,u).replace(P,N),a=u+t.length,n?i+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?i+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(u){throw u.source=i,u}var s=function(e){return o.call(this,e,g)},l=t.variable||"obj";return s.source="function("+l+"){\n"+i+"}",s},g.chain=function(e){var t=g(e);return t._chain=!0,t};var R=function(e,t){return e._chain?g(t).chain():t};g.mixin=function(e){g.each(g.functions(e),function(t){var n=g[t]=e[t];g.prototype[t]=function(){var e=[this._wrapped];return l.apply(e,arguments),R(this,n.apply(g,e))}})},g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=o[e];g.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],R(this,n)}}),g.each(["concat","join","slice"],function(e){var t=o[e];g.prototype[e]=function(){return R(this,t.apply(this._wrapped,arguments))}}),g.prototype.value=function(){return this._wrapped},g.prototype.valueOf=g.prototype.toJSON=g.prototype.value,g.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return g})}.call(this),jQuery(document).ready(function(){L.TileLayer.BetterWMS=L.TileLayer.WMS.extend({onAdd:function(e){L.TileLayer.WMS.prototype.onAdd.call(this,e),e.on("click",this.getFeatureInfo,this)},onRemove:function(e){L.TileLayer.WMS.prototype.onRemove.call(this,e),e.off("click",this.getFeatureInfo,this)},getFeatureInfo:function(e){var t=this.getFeatureInfoUrl(e.latlng),n=L.Util.bind(this.showGetFeatureInfo,this);$.ajax({url:t,success:function(t,r,a){var i="string"==typeof t?null:t;n(i,e.latlng,t)},error:function(e,t,r){n(r)}})},getFeatureInfoUrl:function(e)