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

1 line
68 KiB
Plaintext

{"version":3,"sources":["mustache.min.js","underscore-min.js","style-map.js"],"names":[],"mappings":"AAAA;AACA;ACDA;AACA;AACA;AACA;AACA;AACA;ACLA;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;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;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;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;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;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;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":"style-map.js","sourcesContent":["(function defineMustache(global,factory){if(typeof exports===\"object\"&&exports&&typeof exports.nodeName!==\"string\"){factory(exports)}else if(typeof define===\"function\"&&define.amd){define([\"exports\"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)===\"[object Array]\"};function isFunction(object){return typeof object===\"function\"}function typeStr(obj){return isArray(obj)?\"array\":typeof obj}function escapeRegExp(string){return string.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g,\"\\\\$&\")}function hasProperty(obj,propName){return obj!=null&&typeof obj===\"object\"&&propName in obj}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&quot;\",\"'\":\"&#39;\",\"/\":\"&#x2F;\",\"`\":\"&#x60;\",\"=\":\"&#x3D;\"};function escapeHtml(string){return String(string).replace(/[&<>\"'`=\\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\\s*/;var spaceRe=/\\s+/;var equalsRe=/\\s*=/;var curlyRe=/\\s*\\}/;var tagRe=/#|\\^|\\/|>|\\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile===\"string\")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error(\"Invalid tags: \"+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+\"\\\\s*\");closingTagRe=new RegExp(\"\\\\s*\"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp(\"\\\\s*\"+escapeRegExp(\"}\"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i<valueLength;++i){chr=value.charAt(i);if(isWhitespace(chr)){spaces.push(tokens.length)}else{nonSpace=true}tokens.push([\"text\",chr,start,start+1]);start+=1;if(chr===\"\\n\")stripSpace()}}if(!scanner.scan(openingTagRe))break;hasTag=true;type=scanner.scan(tagRe)||\"name\";scanner.scan(whiteRe);if(type===\"=\"){value=scanner.scanUntil(equalsRe);scanner.scan(equalsRe);scanner.scanUntil(closingTagRe)}else if(type===\"{\"){value=scanner.scanUntil(closingCurlyRe);scanner.scan(curlyRe);scanner.scanUntil(closingTagRe);type=\"&\"}else{value=scanner.scanUntil(closingTagRe)}if(!scanner.scan(closingTagRe))throw new Error(\"Unclosed tag at \"+scanner.pos);token=[type,value,start,scanner.pos];tokens.push(token);if(type===\"#\"||type===\"^\"){sections.push(token)}else if(type===\"/\"){openSection=sections.pop();if(!openSection)throw new Error('Unopened section \"'+value+'\" at '+start);if(openSection[1]!==value)throw new Error('Unclosed section \"'+openSection[1]+'\" at '+start)}else if(type===\"name\"||type===\"{\"||type===\"&\"){nonSpace=true}else if(type===\"=\"){compileTags(value)}}openSection=sections.pop();if(openSection)throw new Error('Unclosed section \"'+openSection[1]+'\" at '+scanner.pos);return nestTokens(squashTokens(tokens))}function squashTokens(tokens){var squashedTokens=[];var token,lastToken;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];if(token){if(token[0]===\"text\"&&lastToken&&lastToken[0]===\"text\"){lastToken[1]+=token[1];lastToken[3]=token[3]}else{squashedTokens.push(token);lastToken=token}}}return squashedTokens}function nestTokens(tokens){var nestedTokens=[];var collector=nestedTokens;var sections=[];var token,section;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];switch(token[0]){case\"#\":case\"^\":collector.push(token);sections.push(token);collector=token[4]=[];break;case\"/\":section=sections.pop();section[5]=token[2];collector=sections.length>0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===\"\"};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return\"\";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail=\"\";break;case 0:match=\"\";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={\".\":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,names,index,lookupHit=false;while(context){if(name.indexOf(\".\")>0){value=context.view;names=name.split(\".\");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=hasProperty(value,names[index]);value=value[names[index++]]}}else{value=context.view[name];lookupHit=hasProperty(context.view,name)}if(lookupHit)break;context=context.parent}cache[name]=value}if(isFunction(value))value=value.call(this.view);return value};function Writer(){this.cache={}}Writer.prototype.clearCache=function clearCache(){this.cache={}};Writer.prototype.parse=function parse(template,tags){var cache=this.cache;var tokens=cache[template];if(tokens==null)tokens=cache[template]=parseTemplate(template,tags);return tokens};Writer.prototype.render=function render(template,view,partials){var tokens=this.parse(template);var context=view instanceof Context?view:new Context(view);return this.renderTokens(tokens,context,partials,template)};Writer.prototype.renderTokens=function renderTokens(tokens,context,partials,originalTemplate){var buffer=\"\";var token,symbol,value;for(var i=0,numTokens=tokens.length;i<numTokens;++i){value=undefined;token=tokens[i];symbol=token[0];if(symbol===\"#\")value=this.renderSection(token,context,partials,originalTemplate);else if(symbol===\"^\")value=this.renderInverted(token,context,partials,originalTemplate);else if(symbol===\">\")value=this.renderPartial(token,context,partials,originalTemplate);else if(symbol===\"&\")value=this.unescapedValue(token,context);else if(symbol===\"name\")value=this.escapedValue(token,context);else if(symbol===\"text\")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer=\"\";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j<valueLength;++j){buffer+=this.renderTokens(token[4],context.push(value[j]),partials,originalTemplate)}}else if(typeof value===\"object\"||typeof value===\"string\"||typeof value===\"number\"){buffer+=this.renderTokens(token[4],context.push(value),partials,originalTemplate)}else if(isFunction(value)){if(typeof originalTemplate!==\"string\")throw new Error(\"Cannot use higher-order sections without the original template\");value=value.call(context.view,originalTemplate.slice(token[3],token[5]),subRender);if(value!=null)buffer+=value}else{buffer+=this.renderTokens(token[4],context,partials,originalTemplate)}return buffer};Writer.prototype.renderInverted=function renderInverted(token,context,partials,originalTemplate){var value=context.lookup(token[1]);if(!value||isArray(value)&&value.length===0)return this.renderTokens(token[4],context,partials,originalTemplate)};Writer.prototype.renderPartial=function renderPartial(token,context,partials){if(!partials)return;var value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null)return this.renderTokens(this.parse(value),context,partials,value)};Writer.prototype.unescapedValue=function unescapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return value};Writer.prototype.escapedValue=function escapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return mustache.escape(value)};Writer.prototype.rawValue=function rawValue(token){return token[1]};mustache.name=\"mustache.js\";mustache.version=\"2.2.1\";mustache.tags=[\"{{\",\"}}\"];var defaultWriter=new Writer;mustache.clearCache=function clearCache(){return defaultWriter.clearCache()};mustache.parse=function parse(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function render(template,view,partials){if(typeof template!==\"string\"){throw new TypeError('Invalid template! Template should be a \"string\" '+'but \"'+typeStr(template)+'\" was given as the first '+\"argument for mustache#render(template, view, partials)\")}return defaultWriter.render(template,view,partials)};mustache.to_html=function to_html(template,view,partials,send){var result=mustache.render(template,view,partials);if(isFunction(send)){send(result)}else{return result}};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer});\n","// Underscore.js 1.8.3\n// http://underscorejs.org\n// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Underscore may be freely distributed under the MIT license.\n(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=b(e,i,4);var o=!k(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=x(r,e);for(var u=O(t),i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t,r){return function(e,u,i){var o=0,a=O(e);if(\"number\"==typeof i)n>0?o=i>=0?i:Math.max(i+a,o):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(e,u),e[i]===u?i:-1;if(u!==u)return i=t(l.call(e,o,a),m.isNaN),i>=0?i+o:-1;for(i=n>0?o:a-1;i>=0&&a>i;i+=n)if(e[i]===u)return i;return-1}}function e(n,t){var r=I.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||a,i=\"constructor\";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=I[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var u=this,i=u._,o=Array.prototype,a=Object.prototype,c=Function.prototype,f=o.push,l=o.slice,s=a.toString,p=a.hasOwnProperty,h=Array.isArray,v=Object.keys,g=c.bind,y=Object.create,d=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};\"undefined\"!=typeof exports?(\"undefined\"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):u._=m,m.VERSION=\"1.8.3\";var b=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},x=function(n,t,r){return null==n?m.identity:m.isFunction(n)?b(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return x(n,t,1/0)};var _=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var f=o[c];t&&r[f]!==void 0||(r[f]=i[f])}return r}},j=function(n){if(!m.isObject(n))return{};if(y)return y(n);d.prototype=n;var t=new d;return d.prototype=null,t},w=function(n){return function(t){return null==t?void 0:t[n]}},A=Math.pow(2,53)-1,O=w(\"length\"),k=function(n){var t=O(n);return\"number\"==typeof t&&t>=0&&A>=t};m.each=m.forEach=function(n,t,r){t=b(t,r);var e,u;if(k(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=k(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=x(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(x(t)),r)},m.every=m.all=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r,e){return k(n)||(n=m.values(n)),(\"number\"!=typeof r||e)&&(r=0),m.indexOf(n,t,r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=k(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(k(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=x(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),\"value\")};var F=function(n){return function(t,r,e){var u={};return r=x(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=F(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=F(function(n,t,r){n[r]=t}),m.countBy=F(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):k(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:k(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=x(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var S=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=O(n);a>o;o++){var c=n[o];if(k(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=S(c,t,r));var f=0,l=c.length;for(u.length+=l;l>f;)u[i++]=c[f++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return S(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=x(r,e));for(var u=[],i=[],o=0,a=O(n);a>o;o++){var c=n[o],f=r?r(c,o,n):c;t?(o&&i===f||u.push(c),i=f):r?m.contains(i,f)||(i.push(f),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(S(arguments,!0,!0))},m.intersection=function(n){for(var t=[],r=arguments.length,e=0,u=O(n);u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=S(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,O).length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=O(n);u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=x(r,e,1);for(var u=r(t),i=0,o=O(n);o>i;){var a=Math.floor((i+o)/2);r(n[a])<u?i=a+1:o=a}return i},m.indexOf=r(1,m.findIndex,m.sortedIndex),m.lastIndexOf=r(-1,m.findLastIndex),m.range=function(n,t,r){null==t&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var E=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=j(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(g&&n.bind===g)return g.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError(\"Bind must be called on a function\");var r=l.call(arguments,2),e=function(){return E(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e<arguments.length;)i.push(arguments[e++]);return E(n,r,this,this,i)};return r},m.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error(\"bindAll must be passed function names\");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=\"\"+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var f=m.now();a||r.leading!==!1||(a=f);var l=t-(f-a);return e=this,u=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),a=f,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,l)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var f=m.now()-o;t>f&&f>=0?e=setTimeout(c,t-f):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var f=r&&!e;return e||(e=setTimeout(c,t)),f&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var M=!{toString:null}.propertyIsEnumerable(\"toString\"),I=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"];m.keys=function(n){if(!m.isObject(n))return[];if(v)return v(n);var t=[];for(var r in n)m.has(n,r)&&t.push(r);return M&&e(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&e(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=_(m.allKeys),m.extendOwn=m.assign=_(m.keys),m.findKey=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=b(t,r)):(u=S(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var f=u[a],l=o[f];e(l,f,o)&&(i[f]=l)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(S(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=_(m.allKeys,!0),m.create=function(n,t){var r=j(n);return t&&m.extendOwn(r,t),r},m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=s.call(n);if(u!==s.call(t))return!1;switch(u){case\"[object RegExp]\":case\"[object String]\":return\"\"+n==\"\"+t;case\"[object Number]\":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case\"[object Date]\":case\"[object Boolean]\":return+n===+t}var i=\"[object Array]\"===u;if(!i){if(\"object\"!=typeof n||\"object\"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&\"constructor\"in n&&\"constructor\"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!N(n[c],t[c],r,e))return!1}else{var f,l=m.keys(n);if(c=l.length,m.keys(t).length!==c)return!1;for(;c--;)if(f=l[c],!m.has(t,f)||!N(n[f],t[f],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return N(n,t)},m.isEmpty=function(n){return null==n?!0:k(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=h||function(n){return\"[object Array]\"===s.call(n)},m.isObject=function(n){var t=typeof n;return\"function\"===t||\"object\"===t&&!!n},m.each([\"Arguments\",\"Function\",\"String\",\"Number\",\"Date\",\"RegExp\",\"Error\"],function(n){m[\"is\"+n]=function(t){return s.call(t)===\"[object \"+n+\"]\"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,\"callee\")}),\"function\"!=typeof/./&&\"object\"!=typeof Int8Array&&(m.isFunction=function(n){return\"function\"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||\"[object Boolean]\"===s.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&p.call(n,t)},m.noConflict=function(){return u._=i,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=w,m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=b(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var B={\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&quot;\",\"'\":\"&#x27;\",\"`\":\"&#x60;\"},T=m.invert(B),R=function(n){var t=function(t){return n[t]},r=\"(?:\"+m.keys(n).join(\"|\")+\")\",e=RegExp(r),u=RegExp(r,\"g\");return function(n){return n=null==n?\"\":\"\"+n,e.test(n)?n.replace(u,t):n}};m.escape=R(B),m.unescape=R(T),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var q=0;m.uniqueId=function(n){var t=++q+\"\";return n?n+t:t},m.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var K=/(.)^/,z={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},D=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g,L=function(n){return\"\\\\\"+z[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).source].join(\"|\")+\"|$\",\"g\"),u=0,i=\"__p+='\";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(D,L),u=a+t.length,r?i+=\"'+\\n((__t=(\"+r+\"))==null?'':_.escape(__t))+\\n'\":e?i+=\"'+\\n((__t=(\"+e+\"))==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(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},f=t.variable||\"obj\";return c.source=\"function(\"+f+\"){\\n\"+i+\"}\",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var P=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return f.apply(n,arguments),P(this,r.apply(m,n))}})},m.mixin(m),m.each([\"pop\",\"push\",\"reverse\",\"shift\",\"sort\",\"splice\",\"unshift\"],function(n){var t=o[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),\"shift\"!==n&&\"splice\"!==n||0!==r.length||delete r[0],P(this,r)}}),m.each([\"concat\",\"join\",\"slice\"],function(n){var t=o[n];m.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return\"\"+this._wrapped},\"function\"==typeof define&&define.amd&&define(\"underscore\",[],function(){return m})}).call(this);\n//# sourceMappingURL=underscore-min.map","var pgsql_tmpl;\r\nvar featureGroup = new Array();\r\nvar bounds;\r\nvar layerSelector = new Array();\r\nvar overlays = new Array();\r\nvar mymap;\r\nvar currentBaseMap = new Array();\r\nvar marker_content_tmpl;\r\nvar popupContentId = new Array();\r\nvar tmpl = {};\r\nvar db = {};\r\nvar currentIndex = -1;\r\nvar drawingGroup;\r\nvar editMode = false;\r\nvar layername;\r\nvar myupload;\r\n\r\njQuery(document).ready(function () {\r\n\r\n\r\n\r\n drawingGroup = new L.FeatureGroup();\r\n\r\n var drawControl = new L.Control.Draw({\r\n edit: {\r\n featureGroup: drawingGroup\r\n }\r\n });\r\n\r\n\r\n\r\n tmpl.activeLayer = document.getElementById(\"active-layers-tmpl\").innerHTML;\r\n Mustache.parse(tmpl.activeLayer);\r\n\r\n mymap = L.map('mapid').setView([51.505, -0.09], 13);\r\n\r\n drawControl.addTo(mymap);\r\n drawingGroup.addTo(mymap);\r\n\r\n drawing_event();\r\n\r\n $.each(baseLayers[\"mymap\"], function (layer, value) {\r\n layername = layer;\r\n })\r\n\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 L.Icon.Default.imagePath = baseURL + \"/assets/plugins/leaflet/images\";\r\n L.AwesomeMarkers.Icon.prototype.options.prefix = 'fa';\r\n\r\n jQuery('.control-sidebar').on('click', '.save-settings', function (e) {\r\n e.preventDefault();\r\n var $self = jQuery(this);\r\n if (jQuery('#style_settings_form').validate().form()) {\r\n // $self.button(\"loading\");\r\n saveMapData('style', function (data) {\r\n //$self.button(\"reset\");\r\n showMsg(\"success\", \"Style saved successfully.\");\r\n });\r\n }\r\n })\r\n jQuery('#download-your-style').click(function (e) {\r\n e.preventDefault();\r\n\r\n // $self.button(\"loading\");\r\n saveMapData('style', function (data) {\r\n //$self.button(\"reset\");\r\n //showMsg(\"success\", \"Style saved successfully.\");\r\n jQuery('#download-modal').modal(\"show\");\r\n });\r\n\r\n })\r\n\r\n\r\n jQuery('.close-right-sidebar').click(function () {\r\n\r\n if (jQuery('.sidebar_hide').hasClass(\"hide\")) {\r\n jQuery('.sidebar_hide').toggleClass(\"hide\");\r\n jQuery('.control-sidebar').toggleClass('control-sidebar-open');\r\n }\r\n\r\n })\r\n \r\n jQuery('#map-sidebar-container').on(\"click\", '.sidebar-close-btn', function () {\r\n jQuery('#style-edit-layers-container').removeClass(\"open\");\r\n });\r\n \r\n jQuery('#active-layers-container').on(\"click\", '.delete-at-layer', function () {\r\n var $self = jQuery(this);\r\n swal({\r\n title: \"Are you sure?\",\r\n text: \"This will remove layer from current map.\",\r\n type: \"warning\",\r\n showCancelButton: true,\r\n confirmButtonColor: \"#DD6B55\",\r\n confirmButtonText: \"Yes, delete it!\",\r\n cancelButtonText: \"No, cancel plx!\",\r\n closeOnConfirm: true,\r\n closeOnCancel: true\r\n },\r\n function (isConfirm) {\r\n if (isConfirm) {\r\n var unique_id = $self.parents(\"ul:first\").attr(\"data-id\");\r\n deleteLayer(unique_id);\r\n }\r\n });\r\n })\r\n\r\n jQuery('#active-layers-container').on(\"click\", '.edit-at-layer', function () {\r\n\r\n var $self = jQuery(this);\r\n var unique_id = $self.parents(\"ul:first\").attr(\"data-id\");\r\n editATLayer(unique_id);\r\n })\r\n\r\n\r\n jQuery('.control-sidebar').on('click', '.markers-images', function () {\r\n\r\n var href = jQuery(this).find(\"img\").attr(\"src\");\r\n\r\n replaceIcon(href);\r\n })\r\n\r\n\r\n initLayer();\r\n\r\n}).ajaxStop(function () {\r\n //ajaxLoadSucess();a\r\n ajaxLoadSucess();\r\n\r\n});\r\n\r\nfunction ajaxLoadSucess() {\r\n jQuery('#main-loader').addClass(\"hide\");\r\n}\r\n\r\n\r\nfunction deleteLayer(id) {\r\n var index = getLayersIndex(id);\r\n if (selectedLayers[index].type == 3) {\r\n drawingGroup.removeLayer(selectedLayers[index].layer);\r\n }\r\n jQuery('#at-' + id).remove();\r\n featureGroup[selectedLayers[index]['unique_id']][selectedLayers[index]['name']].clearLayers();\r\n // layerSelector.removeLayer(featureGroup[selectedLayers[index]['unique_id']][selectedLayers[index]['name']]);\r\n selectedLayers.splice(index, 1);\r\n}\r\n\r\nfunction editATLayer(id) {\r\n\r\n var index = getLayersIndex(id);\r\n //var id = jQuery(this).val();\r\n currentIndex = index;\r\n\r\n if (selectedLayers[index]['type'] == 1 || selectedLayers[index]['type'] == 4) {\r\n\r\n// var geoserver_tmpl = document.getElementById(\"geoserver-modal-tmpl\").innerHTML;\r\n// Mustache.parse(geoserver_tmpl);\r\n// jQuery('#geoserver_layer_form').html(Mustache.render(geoserver_tmpl));\r\n// jQuery('#geoserver-layer-modal').modal(\"show\");\r\n//\r\n// jQuery('#geoserver_layer_name').val(selectedLayers[index]['name']);\r\n// jQuery('#geoserver_unique_id').val(selectedLayers[index]['unique_id']);\r\n//\r\n// validateForm(jQuery('#geoserver_layer_form'));\r\n//\r\n// sqlFormChange = false;\r\n\r\n layerDialog(selectedLayers[index]);\r\n\r\n } else if (selectedLayers[index]['type'] == 2) {\r\n\r\n// var sql_tmpl = document.getElementById(\"sql-layer-modal-tmpl\").innerHTML;\r\n// Mustache.parse(sql_tmpl);\r\n// jQuery('#sql_layer_form').html(Mustache.render(sql_tmpl, {ds: ds}));\r\n// jQuery('#sql-layer-modal').modal(\"show\");\r\n//\r\n//\r\n// jQuery('#query_box').val(selectedLayers[index]['query']);\r\n//\r\n// jQuery('#query_box').val(selectedLayers[index]['query']);\r\n// jQuery('#sql_layer_name').val(selectedLayers[index]['name']);\r\n// jQuery('#sql_datasource').val(selectedLayers[index]['connection_id']);\r\n// jQuery('#sql_unique_id').val(selectedLayers[index]['unique_id']);\r\n//\r\n// jQuery('#sql_datasource').trigger(\"change\");\r\n// validateForm(jQuery('#sql_layer_form'));\r\n//\r\n// // jQuery('#sql-mode-switch').bootstrapSwitch('state', selectedLayers[index]['sql_mode'], false);\r\n//\r\n// sqlFormChange = false;\r\n// SQLModeModal(selectedLayers[index]['sqlMode']);\r\n layerDialog(selectedLayers[index]);\r\n } else if (selectedLayers[index]['type'] == 3) {\r\n layerDialog(selectedLayers[index]);\r\n }\r\n\r\n}\r\n\r\n\r\n\r\nfunction editStyleLayer(id) {\r\n\r\n\r\n var index = getLayersIndex(id);\r\n currentIndex = index;\r\n var $form = jQuery('#style_settings_form');\r\n\r\n if (selectedLayers[index]['type'] == 1) {\r\n var geoserver_tmpl = document.getElementById(\"geoserver-style-modal-tmpl\").innerHTML;\r\n Mustache.parse(geoserver_tmpl);\r\n $form.html(Mustache.render(geoserver_tmpl));\r\n jQuery('#style-settings-modal').modal(\"show\");\r\n jQuery('#style-settings-modal .btn.btn-success').addClass(\"hide\");\r\n\r\n } else if (selectedLayers[index]['type'] == 2) {\r\n\r\n var rs_tmpl = document.getElementById('sql-layer-style-modal-tmpl').innerHTML;\r\n Mustache.parse(rs_tmpl);\r\n jQuery('#map-sidebar-container').html(Mustache.render(rs_tmpl, {t: selectedLayers[index]}));\r\n jQuery('.control-sidebar').toggleClass('control-sidebar-open');\r\n\r\n\r\n jQuery('#layer_polygon_fill_color,#layer_polygon_color').colorpicker({\r\n theme: 'bootstrap',\r\n }).on('changeColor', function (ev) {\r\n applyLiveStyle();\r\n });\r\n\r\n jQuery('#layer-polygon-styling input').change(function () {\r\n applyLiveStyle();\r\n });\r\n\r\n\r\n jQuery('#layer-marker-styling select').change(function () {\r\n applyLiveStyle();\r\n });\r\n\r\n jQuery('.sidebar_hide').toggleClass(\"hide\");\r\n return;\r\n\r\n var sql_tmpl = document.getElementById(\"sql-layer-style-modal-tmpl\").innerHTML;\r\n Mustache.parse(sql_tmpl);\r\n $form.html(Mustache.render(sql_tmpl, {ds: ds}));\r\n jQuery('#style-settings-modal').modal(\"show\");\r\n\r\n $form.find('[name=\"unique_id\"]').val(selectedLayers[index]['unique_id']);\r\n\r\n validateForm(jQuery('#style_settings_form'));\r\n jQuery('#style-settings-modal .btn.btn-success').removeClass(\"hide\");\r\n } else if (selectedLayers[index]['type'] == 3) {\r\n\r\n jQuery('#layer_polygon_fill_color,#layer_polygon_color').colorpicker({\r\n theme: 'bootstrap',\r\n }).on('changeColor', function (ev) {\r\n applyLiveStyle();\r\n });\r\n\r\n jQuery('#layer-polygon-styling input').change(function () {\r\n applyLiveStyle();\r\n });\r\n\r\n }\r\n}\r\n\r\n\r\nfunction drawing_event() {\r\n\r\n var handleDrawEvent = function () {\r\n\r\n mymap.on('draw:drawstart', function (e) {\r\n draw_editStart(e);\r\n });\r\n mymap.on('draw:deletestart', function (e) {\r\n draw_editStart(e);\r\n });\r\n\r\n mymap.on('draw:editstop', function (e) {\r\n draw_editStop(e)\r\n });\r\n mymap.on('draw:drawstop', function (e) {\r\n draw_editStop(e)\r\n });\r\n mymap.on('draw:deletestop', function (e) {\r\n draw_editStop(e)\r\n });\r\n\r\n\r\n mymap.on('moveend', function (e) {\r\n updateMapCenter();\r\n });\r\n\r\n mymap.on('draw:created', function (e) {\r\n\r\n var layerPro = new Object;\r\n layerPro.lt = e.layerType;\r\n\r\n var layer = e.layer;\r\n\r\n drawingGroup.addLayer(layer);\r\n\r\n /* Shape Style */\r\n style = {};\r\n var layerType = \"\";\r\n if (layer instanceof L.Marker) {\r\n \r\n style.marker = new Object;\r\n style.marker.icon = '';\r\n style.marker.color = '';\r\n style.marker.image = baseURL + \"/assets/plugins/leaflet/images/marker-icon.png\";\r\n layerPro.marker = true;\r\n layerPro.polygon = false;\r\n \r\n } else if (layer instanceof L.MultiPolygon ||\r\n layer instanceof L.Polyline ||\r\n layer instanceof L.Rectangle ||\r\n layer instanceof L.Circle) {\r\n\r\n style.polygon = new Object;\r\n style.polygon.color = '#ff0000';\r\n style.polygon.opacity = 0.5;\r\n style.polygon.weight = 5;\r\n style.polygon.fillColor = '#ff0000';\r\n style.polygon.fillOpacity = 0.5;\r\n\r\n layer.setStyle(style.polygon);\r\n layerPro.marker = false;\r\n layerPro.polygon = true;\r\n }\r\n\r\n layerPro.layer = layer;\r\n layerPro.style = style;\r\n layerPro.type = 3;\r\n layerPro.name = layerPro.lt;\r\n layerPro.location = \"\";\r\n layerPro.pc = \"\";\r\n layerPro.unique_id = uniqId('cl'); //custom layers\r\n selectedLayers.push(layerPro);\r\n layerDialog(layerPro);\r\n\r\n renderLayer(layerPro);\r\n });\r\n\r\n mymap.on('draw:editstart', function (e) {\r\n// setTimeout(function () {\r\n// var layers = drawingGroup.getLayers();\r\n// $.each(layers, function (index, layer) {\r\n// index = getLayerIndex(layer);\r\n// if (layer instanceof L.Marker) {\r\n// if (mapLayers[index].style.markerColor) {\r\n// layer.setIcon(L.AwesomeMarkers.icon(mapLayers[index].style));\r\n// }\r\n// } else if (layer instanceof L.Polyline ||\r\n// layer instanceof L.Polygon ||\r\n// layer instanceof L.Rectangle ||\r\n// layer instanceof L.Circle) {\r\n// layer.setStyle(mapLayers[index].style);\r\n// }\r\n// });\r\n// }, 50);\r\n\r\n draw_editStart();\r\n editMode = true;\r\n });\r\n\r\n mymap.on('draw:editstop', function (e) {\r\n// setTimeout(function () {\r\n// var layers = drawingGroup.getLayers();\r\n// $.each(layers, function (index, layer) {\r\n// index = getLayerIndex(layer);\r\n// if (layer instanceof L.Marker) {\r\n// if (selectedLayers[index].style.marker) {\r\n// layer.setIcon(L.AwesomeMarkers.icon(selectedLayers[index].style.marker));\r\n// }\r\n// } else if (layer instanceof L.Polyline ||\r\n// layer instanceof L.Polygon ||\r\n// layer instanceof L.Rectangle ||\r\n// layer instanceof L.Circle) {\r\n// layer.setStyle(selectedLayers[index].style.polygon);\r\n// }\r\n// });\r\n// }, 50);\r\n\r\n editMode = false;\r\n draw_editStop(e);\r\n });\r\n\r\n mymap.on('draw:deleted', function (e) {\r\n var layers = e.layers;\r\n layers.eachLayer(function (layer) {\r\n if (layer instanceof L.MultiPolygon ||\r\n layer instanceof L.Polyline ||\r\n layer instanceof L.Rectangle ||\r\n layer instanceof L.Circle ||\r\n layer instanceof L.Marker) {\r\n deleteLayer(layer.feature.properties.unique_id);\r\n }\r\n });\r\n });\r\n }\r\n handleDrawEvent();\r\n\r\n $('.leaflet-draw.leaflet-control').hide();\r\n\r\n $('#mapid > #data').show();\r\n\r\n $('#draw-polyline,#draw-polygon,#draw-rectangle,#draw-marker, #edit-edit,#edit-remove, #draw-circle').click(function (e) {\r\n if ($(this).attr('href') == \"#\") {\r\n e.preventDefault();\r\n\r\n var id = $(this).attr('id');\r\n $('.leaflet-draw-' + id)[0].click();\r\n }\r\n });\r\n}\r\n\r\nfunction draw_editStart(e) {\r\n var idx = 0;\r\n\r\n setTimeout(function () {\r\n info = $('.leaflet-draw-tooltip').text().replace('Click cancel to undo changes.', '');\r\n $('#control-tip-info').html(info);\r\n\r\n $('#control-tip-buttons').text('');\r\n $('.leaflet-draw-actions li').each(function (index) {\r\n var obj = $(this);\r\n if (obj.parent().css('display') == 'block') {\r\n var value = obj.text();\r\n var icon = '';\r\n\r\n if (/cancel/i.test(value)) {\r\n icon = 'remove';\r\n } else if (/save/i.test(value)) {\r\n icon = 'save';\r\n } else {\r\n icon = 'trash';\r\n }\r\n\r\n Actions = '<a href=\"#\" onClick=\"return tipButtonsclick(' + (idx++) + ');\" class=\"button-top drawing-icon pin-right unround button quiet icon close pad1 inline\"><i class=\"fa fa-' + icon + '\"></i> ' + obj.text() + '</a>';\r\n $('#control-tip-buttons').prepend(Actions);\r\n }\r\n });\r\n }, 100);\r\n}\r\nfunction draw_editStop(e) {\r\n $('#control-tip-info').html('Select the Shape to draw on Map or <a href=\"#\" class=\"btn btn-primary btn-xs\" onClick=\"$(\\'#data-importer\\').click(); return false;\" style=\"color:white;\">click here to import</a> gpx, json or kml.');\r\n $('#control-tip-buttons').text('');\r\n}\r\nfunction updateMapCenter() {\r\n canter = mymap.getCenter();\r\n $('input[name=latitude]').val(canter.lat);\r\n $('input[name=longitude]').val(canter.lng);\r\n\r\n $('#mapcenter').val('[' + canter.lat + ',' + canter.lng + ']');\r\n}\r\n\r\n\r\nfunction layerDialog(t) {\r\n\r\n var cs_html = document.getElementById('cl-style-modal-tmpl').innerHTML;\r\n Mustache.parse(cs_html);\r\n\r\n jQuery('#map-sidebar-container').html(Mustache.render(cs_html, {t: t, type: layerType[t.type]}));\r\n sidebar_toggle('#style-edit-layers-container');\r\n if (t.lt == \"polyline\") {\r\n jQuery('#fill-color-container').remove();\r\n }\r\n\r\n if (t.lt == \"marker\") {\r\n myupload = new Dropzone(\"div#upload-file\", {\r\n url: baseURL + \"/developer/style/upload/marker\",\r\n init: function () {\r\n this.on(\"success\", function (file, responseText) {\r\n var h = '<a href=\"javascript:void(0)\" class=\"markers-images\"><img src=\"' + baseURL + \"uploads/markers/\" + responseText.filename + '\" height=\"32\"/></a>';\r\n jQuery('#image_preview_marker').append(h);\r\n jQuery('.dz-preview').remove();\r\n });\r\n }\r\n });\r\n myupload.on(\"sending\", function (file, xhr, formData) {\r\n // Show the total progress bar when upload starts\r\n\r\n formData.append('_token', $('input[name=\"_token\"]').val());\r\n\r\n });\r\n }\r\n jQuery('#upload-marker').click(function () {\r\n\r\n })\r\n\r\n if (!jQuery('.sidebar_hide').hasClass(\"hide\")) {\r\n jQuery('.sidebar_hide').toggleClass(\"hide\");\r\n jQuery('.control-sidebar').toggleClass('control-sidebar-open');\r\n }\r\n\r\n\r\n if (t.type == 2 || t.type == 3) {\r\n\r\n if (t.style.type == \"nr\" || t.style.type == \"g\") {\r\n\r\n var layers = featureGroup[t.unique_id][t.name].getLayers();\r\n var featuredata = new Array();\r\n var counter = 0;\r\n $.each(layers, function (key, val) {\r\n val.eachLayer(function (layer) {\r\n featuredata[counter++] = layer.feature.properties;\r\n });\r\n });\r\n\r\n\r\n\r\n if (t.style.type == \"nr\") {\r\n\r\n var featuremax = _.max(featuredata, function (o) {\r\n return o[t.style.field];\r\n });\r\n\r\n var numericRange = document.getElementById(t.style.type + \"-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n jQuery('#style_column_name').val(t.style.field);\r\n jQuery('#style_data_type').val(t.style.type);\r\n\r\n jQuery('#attribute-input-field').html(Mustache.render(numericRange, {max: featuremax[t.style.field]}));\r\n var tr = 0;\r\n $.each(t.style.custom, function (tr, val) {\r\n var numericRange = document.getElementById(t.style.type + \"-column-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n var html = Mustache.render(numericRange, {});\r\n\r\n jQuery('#attribute-input-field table tbody').append(html);\r\n var $last = jQuery('#attribute-input-field table tbody tr:last');\r\n $last.find(\"input\").val(val.val);\r\n $last.find('select[data-name=\"markerColor\"]').val(val.style.markerColor);\r\n $last.find('select[data-name=\"icon\"]').val(val.style.icon);\r\n })\r\n\r\n } else if (t.style.type == \"g\") {\r\n\r\n var featuremax = _.groupBy(featuredata, function (o) {\r\n return parseFloat(o[t.style.field]);\r\n });\r\n\r\n var numericRange = document.getElementById(t.style.type + \"-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n jQuery('#style_column_name').val(t.style.field);\r\n jQuery('#style_data_type').val(t.style.type);\r\n\r\n jQuery('#attribute-input-field').html(Mustache.render(numericRange, {max: featuremax[t.style.field]}));\r\n var tr = 0;\r\n $.each(t.style.custom, function (tr, val) {\r\n var numericRange = document.getElementById(t.style.type + \"-column-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n var html = Mustache.render(numericRange, {});\r\n\r\n jQuery('#attribute-input-field table tbody').append(html);\r\n var $last = jQuery('#attribute-input-field table tbody tr:last');\r\n $last.find(\"input\").val(val.val);\r\n $last.find('select[data-name=\"markerColor\"]').val(val.style.markerColor);\r\n $last.find('select[data-name=\"icon\"]').val(val.style.icon);\r\n })\r\n\r\n }\r\n }\r\n\r\n jQuery('#layer_polygon_fill_color,#layer_polygon_color').colorpicker({\r\n theme: 'bootstrap',\r\n }).on('changeColor', function (ev) {\r\n applyLiveStyle();\r\n });\r\n\r\n jQuery('#layer-polygon-styling input,#layer-polygon-styling select').change(function () {\r\n applyLiveStyle();\r\n });\r\n\r\n\r\n jQuery('#layer-marker-styling .default-marker-style select').change(function () {\r\n applyLiveStyle();\r\n });\r\n\r\n jQuery('#layer-marker-styling').on(\"click\", \".numeric-range\", function () {\r\n var $currentTr = jQuery(this).parents(\"tr:first\");\r\n var cloneTr = $currentTr.clone();\r\n cloneTr.find('input').val('');\r\n $currentTr.after(cloneTr);\r\n })\r\n\r\n jQuery('#layer-marker-styling .custom-marker-style #style_data_type, #layer-marker-styling .custom-marker-style #style_column_name').change(function () {\r\n\r\n var columnName = jQuery('#style_column_name').val();\r\n var data_type = jQuery('#style_data_type').val();\r\n\r\n if (columnName != \"\" && data_type != \"\") {\r\n\r\n jQuery('#attribute-input-field').html('');\r\n\r\n var my_unique_id = jQuery('#map-sidebar-container [name=\"my_unique_id\"]').val();\r\n var index = getIndex(selectedLayers, 'unique_id', my_unique_id);\r\n var layers = featureGroup[selectedLayers[index].unique_id][selectedLayers[index].name].getLayers();\r\n var featuredata = new Array();\r\n var counter = 0;\r\n $.each(layers, function (key, val) {\r\n val.eachLayer(function (layer) {\r\n featuredata[counter++] = layer.feature.properties;\r\n });\r\n });\r\n\r\n if (data_type == \"nr\") {\r\n\r\n var featuremax = _.max(featuredata, function (o) {\r\n return parseFloat(o[columnName]);\r\n });\r\n\r\n var numericRange = document.getElementById(data_type + \"-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n\r\n jQuery('#attribute-input-field').html(Mustache.render(numericRange, {max: featuremax[columnName]}));\r\n\r\n if (jQuery('#attribute-input-field table tboday tr').length == 0) {\r\n var numericRange = document.getElementById(\"nr-column-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n var html = Mustache.render(numericRange, {});\r\n\r\n jQuery('#attribute-input-field table tbody').append(html);\r\n }\r\n\r\n } else {\r\n\r\n var featuremax = _.groupBy(featuredata, function (o) {\r\n return o[columnName];\r\n });\r\n\r\n var numericRange = document.getElementById(data_type + \"-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n\r\n jQuery('#attribute-input-field').html(Mustache.render(numericRange, {max: featuremax[columnName]}));\r\n\r\n $.each(featuremax, function (tr, val) {\r\n\r\n var numericRange = document.getElementById(\"g-column-style-selection\").innerHTML;\r\n Mustache.parse(numericRange);\r\n var html = Mustache.render(numericRange, {attr: tr});\r\n\r\n jQuery('#attribute-input-field table tbody').append(html);\r\n// var $last = jQuery('#attribute-input-field table tbody tr:last');\r\n// $last.find(\"input\").val(val.range);\r\n// $last.find('select[data-name=\"markerColor\"]').val(val.style.markerColor);\r\n// $last.find('select[data-name=\"icon\"]').val(val.style.icon);\r\n })\r\n\r\n }\r\n\r\n\r\n }\r\n });\r\n\r\n var customStyle = new Array();\r\n var s = 0;\r\n jQuery('#attribute-input-field').on('change', 'table input, table select', function () {\r\n\r\n var my_unique_id = jQuery('#map-sidebar-container [name=\"my_unique_id\"]').val();\r\n var index = getIndex(selectedLayers, 'unique_id', my_unique_id);\r\n var layers = featureGroup[selectedLayers[index].unique_id][selectedLayers[index].name].getLayers();\r\n var columnName = jQuery('#style_column_name').val();\r\n var data_type = jQuery('#style_data_type').val();\r\n customStyle = new Array();\r\n s = 0;\r\n jQuery('#attribute-numeric-table tbody tr').each(function () {\r\n\r\n var $self = jQuery(this);\r\n var range = $self.find('input:text').val();\r\n\r\n var marker = {};\r\n $self.find(\"select\").each(function () {\r\n marker[jQuery(this).attr(\"data-name\")] = jQuery(this).val();\r\n });\r\n\r\n\r\n\r\n customStyle[s] = new Object;\r\n customStyle[s].val = range;\r\n customStyle[s].style = marker;\r\n s++;\r\n\r\n marker = getMarkerStyle(marker);\r\n\r\n $.each(layers, function (key, val) {\r\n val.eachLayer(function (layer) {\r\n\r\n if (data_type == \"nr\") {\r\n\r\n if (between(layer.feature.properties[columnName], range)) {\r\n layer.setIcon(L.AwesomeMarkers.icon(marker));\r\n }\r\n } else if (data_type == \"g\") {\r\n if (layer.feature.properties[columnName] == range) {\r\n layer.setIcon(L.AwesomeMarkers.icon(marker));\r\n }\r\n }\r\n\r\n });\r\n });\r\n })\r\n\r\n if (typeof selectedLayers[index].style.custom == \"undefined\") {\r\n selectedLayers[index].style.custom = new Object;\r\n }\r\n\r\n selectedLayers[index].style.custom = customStyle;\r\n\r\n selectedLayers[index].style.type = data_type;\r\n selectedLayers[index].style.field = columnName;\r\n })\r\n\r\n\r\n\r\n if (t.style.marker && typeof t.style.marker != \"undefined\") {\r\n jQuery('#layer-marker-styling select[name=\"marker_color\"]').val(t.style.marker.markerColor);\r\n jQuery('#layer-marker-styling select[name=\"marker_icon\"]').val(t.style.marker.icon);\r\n }\r\n }\r\n\r\n jQuery('#cs-layer-info input').change(function () {\r\n var $self = jQuery(this);\r\n\r\n var my_unique_id = jQuery('#map-sidebar-container [name=\"my_unique_id\"]').val();\r\n var index = getIndex(selectedLayers, 'unique_id', my_unique_id);\r\n selectedLayers[index][$self.attr(\"name\")] = $self.val();\r\n jQuery('#at-' + selectedLayers[index]['unique_id'] + \" span.at-text\").html(selectedLayers[index].name);\r\n });\r\n\r\n\r\n\r\n}\r\nfunction tipButtonsclick(index) {\r\n\r\n var action = undefined;\r\n $('.leaflet-draw-actions').each(function (index) {\r\n if ($(this).css('display') == 'block') {\r\n action = $(this);\r\n }\r\n });\r\n\r\n if (action) {\r\n action.find('a')[index].click();\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction getDetailsByType(obj, key, val, key1, value1) {\r\n var objects = [];\r\n var len = obj.length;\r\n for (i = 0; i < len; i++) {\r\n if (obj[i][key] == val && obj[i][key1] == value1) {\r\n objects.push(obj[i]);\r\n }\r\n }\r\n return objects;\r\n}\r\nfunction renderLayer(t) {\r\n\r\n if (typeof page != \"undefined\" && page == \"manage\") {\r\n\r\n //jQuery('#active-layers-container').append(Mustache.render(tmpl.activeLayer, t));\r\n jQuery('#active-layers-container').append(Mustache.render(tmpl.activeLayer, {t: t, type: layerType[t.type]}));\r\n\r\n }\r\n\r\n if (typeof featureGroup[t.unique_id] == \"undefined\") {\r\n featureGroup[t.unique_id] = new Array();\r\n }\r\n\r\n featureGroup[t.unique_id][t.name] = new L.FeatureGroup();\r\n\r\n\r\n featureGroup[t.unique_id][t.name].addTo(mymap);\r\n\r\n\r\n\r\n}\r\n\r\nfunction applyLiveStyle(type) {\r\n\r\n var my_unique_id = jQuery('#map-sidebar-container [name=\"my_unique_id\"]').val();\r\n var index = getIndex(selectedLayers, 'unique_id', my_unique_id);\r\n\r\n var style = {};\r\n jQuery('#layer-polygon-styling input, #layer-polygon-styling select').each(function () {\r\n var $self = jQuery(this);\r\n if ($self.val() == \"dashed\") {\r\n style[\"dashArray\"] = \"20,15\";\r\n } else {\r\n style[$self.attr(\"name\")] = $self.val();\r\n }\r\n console.log(style);\r\n\r\n })\r\n\r\n var marker = {};\r\n jQuery('#layer-marker-styling .default-marker-style select').each(function () {\r\n var $self = jQuery(this);\r\n marker[$self.attr(\"data-name\")] = $self.val();\r\n })\r\n\r\n if (selectedLayers[index].type == 2) {\r\n var layers = featureGroup[selectedLayers[index].unique_id][selectedLayers[index].name].getLayers();\r\n $.each(layers, function (key, val) {\r\n val.eachLayer(function (layer) {\r\n\r\n if (layer instanceof L.Marker) {\r\n layer.setIcon(L.AwesomeMarkers.icon(marker));\r\n } else if (layer instanceof L.Polyline ||\r\n layer instanceof L.Polygon ||\r\n layer instanceof L.Rectangle ||\r\n layer instanceof L.Circle) {\r\n layer.setStyle(style);\r\n }\r\n\r\n });\r\n });\r\n } else if (selectedLayers[index].type == 3) {\r\n var layer = selectedLayers[index].layer;\r\n if (layer instanceof L.Marker) {\r\n layer.setIcon(L.AwesomeMarkers.icon(marker));\r\n } else if (layer instanceof L.Polyline ||\r\n layer instanceof L.Polygon ||\r\n layer instanceof L.Rectangle ||\r\n layer instanceof L.Circle) {\r\n layer.setStyle(style);\r\n }\r\n\r\n }\r\n\r\n // .setStyle(style);\r\n selectedLayers[index]['style'].polygon = style;\r\n selectedLayers[index]['style'].marker = marker;\r\n\r\n}\r\n\r\n\r\n\r\nfunction getIndex(obj, key, value) {\r\n var len = obj.length;\r\n for (i = 0; i < len; i++) {\r\n if (obj[i][key] == value) {\r\n return i;\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\nfunction saveMapData(type, callback) {\r\n\r\n var len = selectedLayers.length;\r\n\r\n var jt = new Array();\r\n for (i = 0; i < len; i++) {\r\n\r\n var s = jQuery.extend(true, {}, selectedLayers[i]);\r\n\r\n if (s.type == 3) {\r\n if (s.layer instanceof L.Circle) {\r\n s.radius = s.layer.getRadius();\r\n }\r\n s.layer = s.layer.toGeoJSON();\r\n }\r\n jt.push(s);\r\n }\r\n var t = {\r\n \"selectedLayers\": jt\r\n }\r\n jQuery('#action_type').val(type);\r\n var json = JSON.stringify(t);\r\n\r\n jQuery('#layer_json').val(json);\r\n var formdata = jQuery('#layer-form, #map-settings-form').serialize();\r\n\r\n ajaxRequest('/developer/style/save', 'post', 'json', formdata, function (data) {\r\n\r\n if (data.status == 200) {\r\n jQuery('#map_id').val(data.map_id);\r\n // window.location = baseURL + \"/developer/map/edit/\" + data.map_id;\r\n //showMsg(data.action, data.msg);\r\n callback(data);\r\n } else {\r\n showMsg(\"error\", data.msg);\r\n }\r\n })\r\n}\r\n\r\nfunction initLayer() {\r\n\r\n jQuery.each(selectedLayers, function (key, value) {\r\n renderLayer(value, '');\r\n processFreeHand(value);\r\n })\r\n}\r\n\r\nfunction processFreeHand(t) {\r\n\r\n\r\n// t = selectedLayers[index];\r\n//\r\n// if (typeof featureGroup[t.unique_id] == \"undefined\") {\r\n// featureGroup[t.unique_id] = new Array();\r\n// }\r\n// featureGroup[t.unique_id][t.name] = new L.FeatureGroup();\r\n//\r\n// if (typeof t.settings != \"undefined\") {\r\n// if (t.settings.active == 1) {\r\n// featureGroup[t.unique_id][t.name].addTo(mymap);\r\n// } else {\r\n// t.settings.active = 0;\r\n// }\r\n// } else {\r\n// featureGroup[t.unique_id][t.name].addTo(mymap);\r\n// t.settings = new Object;\r\n// t.settings.active = 1;\r\n// }\r\n\r\n //featureGroup[t.unique_id][t.name].addTo(mymap);\r\n\r\n\r\n L.geoJson(t.layer, {\r\n onEachFeature: function (feature, layer) {\r\n index = getIndex(selectedLayers, 'unique_id', t.unique_id);\r\n selectedLayers[index].layer = layer;\r\n\r\n\r\n drawingGroup.addLayer(layer);\r\n\r\n featureGroup[t.unique_id][t.name].addLayer(layer);\r\n\r\n if (layer instanceof L.Marker) {\r\n if (typeof selectedLayers[index].style.marker.image != \"undefined\") {\r\n replaceIcon(selectedLayers[index].style.marker.image, index);\r\n }\r\n // layer.setIcon(L.AwesomeMarkers.icon(selectedLayers[index].style.marker));\r\n }\r\n layer.bindPopup(selectedLayers[index].pc);\r\n\r\n// layer.on(\"click\", function () {\r\n// var index = getLayerIndex1(layer);\r\n// if (layer instanceof L.Marker) {\r\n// var popup = L.popup();\r\n// popup.setLatLng(layer.getLatLng());\r\n// popup.setContent(selectedLayers[index].pc);\r\n// mymap.openPopup(popup);\r\n// } else {\r\n// var bounds = layer.getBounds();\r\n// var popup = L.popup();\r\n// popup.setLatLng(bounds.getCenter());\r\n// popup.setContent(selectedLayers[index].pc);\r\n// mymap.openPopup(popup);\r\n// }\r\n// });\r\n\r\n },\r\n style: function (feature, layer) {\r\n return t.style.polygon;\r\n },\r\n pointToLayer: function (feature, latlng) {\r\n //console.log(feature);\r\n if (typeof t.radius != \"undefined\") {\r\n return L.circle(latlng, parseInt(t.radius, 10));\r\n } else {\r\n return L.marker(latlng);\r\n }\r\n },\r\n })\r\n\r\n\r\n //calculateBounds();\r\n}\r\nfunction getLayersIndex(id) {\r\n var len = selectedLayers.length;\r\n for (i = 0; i < len; i++) {\r\n if (selectedLayers[i].unique_id == id) {\r\n return i;\r\n }\r\n }\r\n}\r\n\r\nfunction replaceIcon(href, index) {\r\n \r\n var myIconReplc = L.Icon.extend({\r\n options: {\r\n iconUrl: href,\r\n iconSize: [30, 35],\r\n shadowUrl: href,\r\n shadowAnchor: [8, 20],\r\n shadowSize: [25, 18],\r\n iconAnchor: [8, 30] // horizontal puis vertical\r\n }\r\n });\r\n\r\n if (typeof index != \"undefined\") {\r\n \r\n } else {\r\n var my_unique_id = jQuery('#map-sidebar-container [name=\"my_unique_id\"]').val();\r\n index = getIndex(selectedLayers, 'unique_id', my_unique_id);\r\n }\r\n\r\n selectedLayers[index].style.marker.image = href;\r\n selectedLayers[index].style.marker.size = 32;\r\n var layer = selectedLayers[index].layer;\r\n layer.setIcon(new myIconReplc);\r\n}\r\n\r\nfunction sidebar_toggle(eleid) {\r\n jQuery('.control-sidebar').removeClass('open');\r\n jQuery( eleid).addClass('open');\r\n}"]}