forked from cutting-room-floor/wax
/
wax.ol.min.js
10 lines (10 loc) · 19.7 KB
/
wax.ol.min.js
1
2
3
4
5
6
7
8
9
10
/*
* jQuery JSONP Core Plugin 2.1.4 (2010-11-17)
*
* http://code.google.com/p/jquery-jsonp/
*
* Copyright (c) 2010 Julian Aubourg
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);return c},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!(Math.floor((b-$(c).offset().top)/this.tileRes)>256||Math.floor((a-$(c).offset().left)/this.tileRes)>256)){var e=this.grid_tile.grid[Math.floor((b-$(c).offset().top)/this.tileRes)].charCodeAt(Math.floor((a-$(c).offset().left)/this.tileRes));e=this.resolveCode(e);if(this.grid_tile.keys[e])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[e]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(.png|.jpg|.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){!b&&(b=$('<div class="wax-legends"></div>')),this.context=a,this.container=b,this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){this.container.empty();var b=this,c=function(a){a?b.legends[e]?b.legends[e].show():(b.legends[e]=$("<div class='wax-legend'></div>").append(a),b.container.append(b.legends[e])):b.legends[e]=!1};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,function(a){a&&a.legend&&c(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c){var d=$(b).children("div.wax-tooltip-"+c+":not(.removed)");d.size()===0&&(d=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).append(d));for(var e=c-1;e>0;e--){var f=$("div.wax-tooltip-"+e+":not(.removed)");f.size()>0&&f.addClass("hidden").hide()}return d},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c){!a||(wax.tooltip.getToolTip(a,b,c),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c){$(b).css("cursor","default").children("div.wax-tooltip-"+c+":not(.wax-popup)").addClass("removed").fadeOut("fast",function(){$(this).remove()}),$("div",b).css("cursor","default"),$(b).children("div.wax-tooltip:first").removeClass("hidden").show()};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){a=a||{},a.handlerOptions=a.handlerOptions||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}]),this.handlers={hover:new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{delay:$.browser.msie?40:10})),click:new OpenLayers.Handler.Click(this,{click:this.getInfoForClick})},this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click}},setMap:function(a){this.handlers.hover.setMap(a),this.handlers.click.setMap(a),OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate()},activate:function(){this.active||(this.handlers.hover.activate(),this.handlers.click.activate());return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},getTileStack:function(a,b){var c=!1,d={},e=[];for(var f=0;f<a[0].grid.length&&!c;f++)for(var g=0;g<a[0].grid[f].length&&!c;g++){var h=$(a[0].grid[f][g].imgDiv).offset();c=h&&h.top<b.pY&&h.top+256>b.pY&&h.left<b.pX&&h.left+256>b.pX,c&&(d={x:f,y:g})}if(c)for(var i=0;i<a.length;i++)a[i].grid[d.x]&&a[i].grid[d.x][d.y]&&e.push(a[i].grid[d.x][d.y]);return e},viableLayers:function(){if(this._viableLayers)return this._viableLayers;return this._viableLayers=$(this.map.layers).filter(function(a){return this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"})},getInfoForClick:function(a){var b={format:"full"},c=this.viableLayers(),d=this.gm.makeEvent(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null;this.target=d.target;var h=this;for(var i=0;i<e.length;i++)this.gm.getGrid(e[i].url,function(a){if(!!a){var c=a.getFeature(d.pX,d.pY,e[i].imgDiv,b);c&&h.callbacks.click(c,e[i].layer.map.viewPortDiv,i)}})},getInfoForHover:function(a){var b={format:"teaser"},c=this.viableLayers(),d=this.gm.makeEvent(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null;this.target=d.target;var h=this;for(var i=0;i<e.length;i++)this.gm.getGrid(e[i].url,function(a){if(a&&e[i]){var c=a.getFeature(d.pX,d.pY,e[i].imgDiv,b);if(c){if(!e[i])return;c&&h.feature[i]!==c?(h.feature[i]=c,h.callbacks.out(c,e[i].layer.map.viewPortDiv,i),h.callbacks.over(c,e[i].layer.map.viewPortDiv,i)):c||(h.feature[i]=null,h.callbacks.out(c,e[i].layer.map.viewPortDiv,i))}else h.feature[i]=null,e[i]?h.callbacks.out({},e[i].layer.map.viewPortDiv,i):h.callbacks.out({},!1,i)}})},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}})