function DataSetPoint(e,t,i,n,s,r,a,o,l,h,u){this.id=n,this.latitude=e,this.longitude=t,this.time=i,this.name=n,this.speed=s,this.altitude=r,this.address=a,this.icon=o,this.hasVoice=l,this.hasText=h,this.isInCall=u,DataSetPoint.prototype.merge=function(e){return _.extend(this,e),this},DataSetPoint.prototype.getNewIconsColor=function(){var e="default_size",t="#287aab",i=/_[0-9A-F]{6}_[sml]\./;if(this.icon&&i.test(this.icon)){var n=this.icon.split(/[_\.]/).slice(-3,-1);t="#"+n[0],e=n[1]}return{color:t,size:e}},DataSetPoint.prototype.getNewIconsSize=function(){var e=new google.maps.Point(16,48),t={s:new google.maps.Size(-6,-40),m:new google.maps.Size(-2,-33),l:new google.maps.Size(0,-24),default_size:new google.maps.Size(0,-25)},i=this.getNewIconsColor();return{labelOffset:t[i.size],labelColor:i.color,imageMarkerAnchor:e}}}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t1&&(t=t[1].split("&").reduce(function(e,t){var i=t.split("=");return e[i[0]]=i[1],e},{})),t[e]||null}function splitString(e,t,i){for(var n=0,s=0;si)return log("-----------command split at index: "+i+" / "+e.length+" -----------"),e.slice(0,s);return e}function bindEvents(e,t,i,n){function s(i,n){var s=t.get("center"),r=t.get("zoom");e.centerZoom(s[0],s[1],r)}t.on("change:bounds",function(i,n){e.autosizeOnBounds(n),sendExecTimeSince("set-bounds",this.get("lastUpdated")),t.attributes.bounds=[]}),t.on("change:center change:zoom",s),t.on("change:dimmensions",function(t,i){e.resize(i[0],i[1]),console.log("dimmensions changed to:"+i)}),t.on("change:polygonToGet",function(t,i){var n=i.name;e.getPolygon(n)}),t.on("change:openedMarker",function(i,n){n&&(e.openInfoBubble(n),t.set("openedMarker",""))}),t.on("change:isReset",function(t,i){e.resetAll()}),t.on("change:console",function(e,t){var i=t?"show":"hide";$("#log-area")[i]()}),t.on("change:traffic",function(t,i){e.setTraffic(i)}),t.on("change:legacyicons",function(t,i){e.setLegacyIcons(i)}),t.on("change:isVisible",function(t,s){console.log("map visibility: "+s),s&&(i.forEach(function(t){t.get("isVisible")?t.get("isPolyline")?e.setPoly(!0,t.get("color"),t.get("thickness"),t.get("points"),t.id):e.putPoints(t.get("points"),!0,t.get("isShowLabels")):t.get("isPolyline")&&e.deletePoly(t.id)}),n.forEach(function(t){console.log(t.get("points").length),(t.get("points")||0!==t.get("points").length)&&e.setPolygon(t.id,t.get("color"),t.get("points"),t.get("opacity"),t.get("borderColor"),t.get("borderOpacity"),t.get("borderWidth"),t.get("thickness"))}))}),i.on("add",function(t){t.on("change:isVisible change:lastUpdated",function(t,i){var n="";this.get("isVisible")?this.get("isPolyline")||(e.putPoints(this.get("points"),this.get("isAutosize"),this.get("isShowLabels"),this.get("id")),n="put"):(n="lastUpdated"===Object.keys(t.changedAttributes())[0]?"update":"remove",e.removePoints(this.get("points")),this.get("isPolyline")&&e.deletePoly(this.id)),sendExecTimeSince(n,this.get("lastUpdated"))},t),t.on("change:isShowLabels",function(t,i){var n=i?"put":"remove";e[n+"Labels"](this.get("points")),sendExecTimeSince(n+"-labels",t.get("lastUpdated"))},t),t.on("change:isPolyline change:color",function(t,i){i&&(e.setPoly(!0,t.get("color"),t.get("thickness"),t.get("points"),t.id),t.set("isVisible",!0))})}),i.on("remove",function(e){e.attributes.lastUpdated=new Date,e.set("isVisible",!1),console.log("removed dataset ="+e.get("id"))}),n.on("add",function(t){console.log("polygon added"),t.get("points")&&0!=t.get("points").length?e.setPolygon(t.get("id"),t.get("color"),t.get("points"),t.get("opacity"),t.get("borderColor"),t.get("borderOpacity"),t.get("borderWidth")):e.newPolygon(t.get("id"),t.get("color"),t.get("opacity"),t.get("borderColor"),t.get("borderOpacity"),t.get("borderWidth")),t.on("change:isEditing",function(t,i){i?e.startEditPolygon(t.get("id")):e.endEditPolygon(t.get("id"))}),t.on("change:color change:opacity change:borderColor change:borderWidth change:borderOpacity",function(t,i){var n=Object.keys(t.changedAttributes())[0];console.log(t.get("id")+" polygon changed prop "+n+" = "+i),e.updatePolygon(t.get("id"),n,i)})}),n.on("remove",function(t){e.deletePolygon(t.get("name"))}),n.on("reset",function(t,i){e.deleteAllPolygons()})}function navigate(e){log("sending : "+e);try{"undefined"!=typeof callbackObj&&null!=callbackObj&&callbackObj.callBackMethod("app://"+e)}catch(e){log(e.toString())}}function initialize(){function e(e){function t(e,t,i,n){var s=69.1*(i-e),r=53*(n-t);return Math.sqrt(Math.pow(s,2)+Math.pow(r,2))}var i=e.x,n=e.y,s=e.lat,r=e.lon,a="/nearest/"+i+"/"+n+"/"+parseFloat(s).toFixed(5)+"/"+parseFloat(r).toFixed(5);console.log("Will navigate to:.."+a);var o=new Promise(function(e,s){nearestCallback=function(s,r,a,o,l){l.forEach(function(e){e.speedUnits=e.speed.indexOf("k")<0?"mi":"km";var i="km"==e.speedUnits?1.6:1;e.distance=+(t(a,o,e.latitude,e.longitude)*i).toFixed(2),e.isEnabled=h.markerExists(e.id)}),console.log("Got a nearest reply for "+s+" and "+r+". Registered for "+i+" and "+n+"."),e(l)}});return navigate(a),o}if("osm"==mapProvider)document.getElementById("tools");var t={SfmbMapsMainSatelitte:"satellite",SfmbMapsMain:"hybrid",SfmbMapsMainMap:"map",SfmbMapsMainTerrain:"terrain"}[location.href.split("/").pop().split(".").shift()]||"hybrid",i=new MapProperties,n=new DataSetCollection;globalSets=n;var s=new PolygonCollection,r={divObject:document.getElementById("Map"),polyPointCallback:function(e){var t=e.map(function(e){return e.latitude+","+e.longitude}).join();document.getElementById("click_string").innerHTML=t,navigate("points/"+t)},getPolygonCallback:function(e){var t=e.points&&e.points.map(function(e){return e.latitude+","+e.longitude}).join(),i="["+e.name+","+e.color+","+t+"]";document.getElementById("response_string").innerHTML=i,navigate("polygon/"+i)},landmarkCallback:function(e){var t=e.latitude+","+e.longitude;document.getElementById("click_string").innerHTML=t,navigate("landmark/"+t)},fastCommandCallback:function(e,t,i){"ptt"==e&&"off"==i&&GWTcallback("setCall,"+t+",False"),i=encodeURIComponent(i),navigate({ptt:"ptt-command",text:"text-command",fast:"fast-command"}[e]+"/"+t+","+i)},mapLoaded:_.once(function(){i.set("isVisible",!0),navigate("map-loaded")}),setMapVisible:function(){i.set("isVisible",!0)},streetViewOpen:function(e){navigate("street-view-open/"+e)},mapType:t,properties:i,osmServer:getHrefParam("osmserver")},a=function(e,t){$(".ui-widget-header").html("Closest to ["+parseFloat(e).toFixed(4)+", "+parseFloat(t).toFixed(4)+"]"),$(document).contextmenu("setEntry","cmd0",{title:"loading...",uiIcon:"",disabled:!1});for(var i=1;i<5;i++)$(document).contextmenu("showEntry","cmd"+i,!1)};$(document).contextmenu({delegate:".map",autoFocus:!0,autoTrigger:!1,preventContextMenuForPopup:!0,preventSelect:!0,show:{effect:"slideDown",duration:200},menu:[{title:"Closest units",isHeader:!0},{title:"none",cmd:"cmd0",uiIcon:""},{title:"none",cmd:"cmd1",uiIcon:""},{title:"none",cmd:"cmd2",uiIcon:""},{title:"none",cmd:"cmd3",uiIcon:""}],position:function(e,t){return{my:"left top",at:"left bottom",of:e}},select:function(e,t){var i=t.item.data();i.isEnabled?h.openInfoBubble(i.id):navigate("/request-unit-display/"+i.id)},beforeOpen:function(t,i){var n=t.pageX,s=t.pageY,r=h.getLatLonFromPx(n,s),o=r.lon,l=r.lat;a(l,o),e&&e({x:n,y:s,lat:l,lon:o}).then(function(e){e.forEach(function(e,t){var i=e.id.length<=15?e.id:e.id.slice(0,13)+"..";$(document).contextmenu("setEntry","cmd"+t,{title:" "+i+" "+e.distance+e.speedUnits+"",data:{id:e.id,isEnabled:e.isEnabled},uiIcon:e.isEnabled?"ui-icon-blank":"ui-icon-refresh"}),$(document).contextmenu("showEntry","cmd"+t,!0)})}).catch(function(e){console.log(e);$(document).contextmenu("isOpen")})}});var o=location.href.match(/reloadMinutes=(\d+)/);o=o?o[1]:360,console.log("Minutes to reload ====================== "+o),setTimeout(function(){log("Map will refresh itself in "+o+" minutes.")},3e3);var l=60*o*1e3;"google"===t&&setInterval(function(){log("Kill map. Recreate a new one!"),i.set("isVisible",!1),h=null,h=new SfmbMaps(r)},l);var h=new SfmbMaps(r);bindEvents(h,i,n,s),window.parser=Parser(n,i,s);var u=$("#tools").width()-$("#open").width();$("#tools").animate({right:"-"+u+"px"},400),$("input:text:first").focus(function(){$(this).val("")});var p=_.isFunction(h.setTraffic)?"show":"hide";$("#traffic")[p](),$("#traffic").parent()[p](),$("#traffic").change(function(){i.set("traffic",$(this).is(":checked"))}),$("input:text:first").autocomplete({source:function(e,t){h.geocode(e.term).then(function(e){return t(e)}).catch(function(e){return t()})},select:function(e,t){h.geocode($(this).val(),!0)}}),$("input:text:first").keyup(function(e){if(13===e.which){var t=$(this).val();h.geocode(t,!0)}}),$("#open").click(function(){var e=$("#tools").width()-$("#open").width();console.log("");var t=-1===$("#open").attr("src").indexOf("close"),i=t?"images/close_vertical.png":"images/tools.png";$("#open").attr("src",i),$("#tools").animate({right:t?"0px":"-"+e+"px"},700)}),$(window).resize(function(){var e=[$(this).height(),$(this).width()];i.set("dimmensions",e)}),$(window).trigger("resize"),DEBUG&&i.set("console",!0)}function sendExecTimeSince(e,t){t||(t=new Date),navigate("exec-time/"+e+"/"+(new Date-t))}function getInfo(){var e=globalSets,t={};if(t.resStr="",window.performance.memory){var i=window.performance.memory,n=i.totalJSHeapSize,s=i.usedJSHeapSize;t.usedHeap=Math.floor(s/1024/1024),t.totalHeap=Math.floor(n/1024/1024),t.resStr+=t.usedHeap+"Mb"}if(e){var r=function(e,t){return e+t.get("points").length},a=e.reduce(r,0),o=e.filter(function(e){return e.get("isVisible")}).reduce(r,0);t.units=a,t.displayed=o,t.resStr+="/"+t.units+"u"}return t.time=moment(),t.timeStr=t.time.format("mm:ss"),t.resStr+="/"+t.timeStr,t}function sampleMemory(e){var t="";if(window.performance.memory){var i=window.performance.memory,n=i.totalJSHeapSize,s=i.usedJSHeapSize;t+="MEMORY Mb: "+(Math.floor(s/1024/1024)+" / "+Math.floor(n/1024/1024))}if(e){var r=function(e,t){return e+t.get("points").length},a=e.reduce(r,0);t+=" UNITS: "+e.filter(function(e){return e.get("isVisible")}).reduce(r,0)+" / "+a}t&&log(t)}function GWTcallback(e){commandsCache.length>2e3&&commandsCache.shift(),commandsCache.push(e);try{log(e),executeCommand(e)}catch(e){console.error(e),log(e.toString())}}function log(e,t,i){var n=document.getElementById("log-area"),s=n&&"none"!=n.style.display,r=moment().format("H:mm:ss:SS> ");if(r=getInfo().resStr+">",s){e.indexOf("Error")>-1&&(e=" "+e),e.indexOf("URL")>-1&&(e=" "+e),e=r+e;var a="",o=n.value,l=o.lastIndexOf("\n")+1,h=o.substr(l);if(h===e)a=n.value+" x 1";else{var u=/(.*)\sx\s(\d*)/.exec(h);if(u){var p=u[1],c=+u[2];p===e?a=n.value.substr(0,l)+p+" x "+(c+1):u=null}u||(a=n.value+"\n"+e)}return a.length>35e4&&(a=a.slice(7e3),console.log("======Removing lines from console========")),n.value=a,n.scrollTop=n.scrollHeight,!1}}function executeCommand(e){window.parser.parseCommand(e)}function startSeeding(){instanceId=Date.now(),id=setInterval(function(){if(!(commandsCache.length<1)){command=commandsCache.shift();var e="http://"+debugServer+"/api/command/"+instanceId+"/"+encodeURIComponent(command);$.ajax({type:"POST",url:e,success:function(e){console.log(command.substr(0,20)+"... command sent to "+debugServer+".")}})}},10)}function fileExists(e){return new Promise(function(t,i){$?$.ajax({url:e,type:"HEAD",dataType:"jsonp",error:function(e){200==e.status?t():i()}}):i()})}function SfmbMapsOL(e){function t(e){if(!e)return!1;var t=e.split(".");return 4===t.length&&t.every(function(e){return parseInt(e,10)>0})}function n(e){D(),null!=q&&(q.destroy(),q=null);var t=b.getLonLatFromViewPortPx(e.xy).transform(T,M);N&&N({latitude:t.lat,longitude:t.lon})}function s(e){S=e.attributes.id;var t=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{displayClass:"olScrollable olPopup",registerEvents:function(){this.events=new OpenLayers.Events(this)}}),i="
"+e.attributes.description+"
";e.attributes.description||(i=null),e.popup=new t("pop",e.geometry.getBounds().getCenterLonLat(),null,i,null,!0,function(){j.selector.unselectAll()}),$("#pop_contentDiv").replaceWith(A.el),b.addPopup(e.popup)}function r(e){S=null,e.popup.destroy(),e.popup=null}function a(e){}function o(e){return l(G.handler.getGeometry().getVertices())}function l(e){for(var t=[],i=0;i180){var i=360-Math.abs(t.longitude);t.longitude>=0&&(i=-i),t.longitude=i}return e.push(t),e},[])}function v(e){return m(e.geometry)}function L(e){Object.assign(z.styleMap.styles.default.defaultStyle,e)}function O(e){Object.assign(z.styleMap.styles.temporary.defaultStyle,e)}var b,w,S,C=e.divObject,x=e.polyPointCallback,E=e.getPolygonCallback,N=e.landmarkCallback,P=e.mapLoaded,M=(new Object,new OpenLayers.Projection("EPSG:4326")),T=new OpenLayers.Projection("EPSG:900913");this.div=C;var k=new InfoWindowModel,A=new InfoWindowView(_.extend({model:k},e)),F=new OpenLayers.Layer.OSM;setTimeout(function(){log(">>>>>>>>>>>>>>>>>>>>> Map loaded from: "+e.osmServer+".")},3e3),t(e.osmServer)&&(F=new OpenLayers.Layer.OSM("OpenStreetMap","http://"+e.osmServer+"/osm/${z}/${x}/${y}.png")),F.events.register("loadend",F,P),console.log("============ Using OSM server at: "+F.url[0]+". "+e.osmServer),b=new OpenLayers.Map({div:C,layers:[F],controls:[new OpenLayers.Control.Navigation({dragPanOptions:{enableKinetic:!1,documentDrag:!0}}),new OpenLayers.Control.ScaleLine,new OpenLayers.Control.PanZoomBar],center:[0,0],zoom:1}),SfmbMapsOL.prototype.markerExists=function(e){return!!U.getFeaturesByAttribute("id",e).length},SfmbMapsOL.prototype.getLatLonFromPx=function(e,t){return b.getLonLatFromViewPortPx({x:e,y:t}).transform(T,M)},b.div.oncontextmenu=function(e){return OpenLayers.Event.isRightClick(e)&&$(document).contextmenu("open",e),!1},b.events.register("move",b,function(){e.properties.attributes.center=[0,0],D()});var D=function(){$(document).contextmenu("close")};b.events.register("zoomstart",D),b.events.register("click",b,n);var I=OpenLayers.Util.getParameters(window.location.href).renderer;I=I?[I]:OpenLayers.Layer.Vector.prototype.renderers;var R=new OpenLayers.Layer.Vector("Poly"),z=new OpenLayers.Layer.Vector("Polygon",{styleMap:new OpenLayers.StyleMap({default:{cursor:"inherit",fillColor:"${color}",fillOpacity:"${opacity}",strokeColor:"${borderColor}",strokeOpacity:"${borderOpacity}",strokeWidth:"${borderWidth}",hoverPointUnit:"%",fontColor:"#ee9900",hoverFillColor:"white",hoverFillOpacity:.8,hoverPointRadius:1,hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:.2,labelAlign:"cm",labelOutlineColor:"white",labelOutlineWidth:3,pointRadius:6,pointerEvents:"visiblePainted",strokeDashstyle:"solid",strokeLinecap:"round"}})}),U=new OpenLayers.Layer.Vector("Markers",{styleMap:new OpenLayers.StyleMap({default:{strokeColor:"#00FF00",strokeOpacity:1,strokeWidth:3,fill:!0,fillColor:"yellow",fillOpacity:1,pointRadius:1,label:"${name}",labelOutlineColor:"${color}",backgroundColor:"${color}",externalGraphic:"${icon}",graphicWidth:30,graphicHeight:40,graphicOpacity:1,fontColor:"${favColor}",fontSize:"12px",fontFamily:"Courier New, monospace",fontWeight:"bold",labelAlign:"${align}",labelXOffset:"${Xoffset}",labelYOffset:"${Yoffset}",labelOutlineWidth:4}}),renderers:I});b.addLayer(U),b.addLayer(z),b.addLayer(R);var B=new OpenLayers.Control.SelectFeature(U,{onSelect:s,onUnselect:r}),G=new OpenLayers.Control.DrawFeature(z,OpenLayers.Handler.Polygon);G.handler.move=a,G.handler.dblclick=null,G.handler.callbacks.point=o;var H=new OpenLayers.Control.ModifyFeature(z);z.events.on({featuremodified:function(e){return l(e.feature.geometry.getVertices())}});var j={selector:B,polygon:G,modify:H,line:new OpenLayers.Control.DrawFeature(R,OpenLayers.Handler.Path)};j.modify.mode|=OpenLayers.Control.ModifyFeature.ROTATE,j.modify.createVertices=!0,j.modify.standalone=!0,j.modify.clickout=!1;for(var W in j)b.addControl(j[W]);j.selector.activate(),SfmbMapsOL.prototype.resize=function(e,t){this.div.style.height=e+"px",this.div.style.width=t+"px",b.updateSize()},SfmbMaps.prototype.setLegacyIcons=function(){},SfmbMapsOL.prototype.autosizeOnBounds=function(e){if((e=e.map(function(e){return new OpenLayers.LonLat(e.longitude,e.latitude).transform(M,T)})).length>1){var t=new OpenLayers.Bounds;e.forEach(function(e){return t.extend(e)}),t.toArray().filter(function(e){return!!e}).length&&p(t)}else{var i=e[0];b.panTo(i),b.zoomTo(7)}},SfmbMapsOL.prototype.putPoints=function(e,t,i,n){if(0!=e.length){for(var s=void 0,r=new OpenLayers.Bounds,a=(U.styleMap.styles.default.defaultStyle,0);a-1&&(c.attributes.Xoffset=c.attributes.Yoffset=5),U.addFeatures([c]),r.extend(c.geometry.getBounds()),""==e[a].id&&U.destroyFeatures([c])}}U.features.reduce(function(t,i){var n=i.attributes.id,s=i.attributes.dataset;return e.find(function(e){return e.id===n})||s!==e[0].dataset||t.push(i.attributes),t},[]).forEach(function(e){this.removePoint(e)},this),s&&(this.openInfoBubble(s),s=!1),t&&p(r)}},SfmbMapsOL.prototype.removeAllPoints=function(){B.unselectAll(),B.deactivate(),u(U),B.activate()},SfmbMapsOL.prototype.removePoint=function(e){var t=U.getFeaturesByAttribute("id",e.id);null!=t[0]&&(null!=t[0].popup&&B.unselect(t[0]),B.deactivate(),U.destroyFeatures([t[0]]),B.activate())},SfmbMapsOL.prototype.removePoints=function(e){if(e)for(var t=0;t0&&(n?r.openSimplePopup(e[0]):V=e,a(e.map(function(e){return""+e.display_name}))):o(t)})})};var q;SfmbMapsOL.prototype.openSimplePopup=function(e){null!=q&&(q.destroy(),q=null);var t=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{displayClass:"olScrollable olPopup",registerEvents:function(){this.events=new OpenLayers.Events(this)}}),i=new OpenLayers.LonLat(e.lon,e.lat).transform(M,T);q=new t("simple_pop",i,null,"
"+e.display_name+"
",null,!0,function(){q.destroy(),q=null}),b.addPopup(q),b.panTo(i)},SfmbMapsOL.prototype.updatePolygon=function(e,t,i){var n=z.getFeaturesByAttribute("name",e);n[0]&&(n[0].attributes[t]=i,z.drawFeature(n[0]))},SfmbMapsOL.prototype.setMapKind=function(){},SfmbMapsOL.prototype.getMapKind=function(){return"OSM"}}function SfmbMapsGoogle(e){function t(e,t){return t=t||8,parseFloat(parseFloat(e).toFixed(t))}function i(e,t){var i=new google.maps.LatLng(t.latitude,t.longitude);e.marker.setPosition(i),e.marker.setIcon(t.icon),e.label.setPosition(i);var s=t.getNewIconsSize().labelColor;D&&(s="yellow",e.marker.setOptions({icon:{url:t.icon,anchor:new google.maps.Point(16,16)}})),e.label.setContent(n(s,t.id)),e.point=t,w.id==t.id&&(w.mergePoint(t),w.isOpened()&&A.setCenter(i))}function n(e,t){return'

'+t+"

"}function s(e,t){var i=e.latitude,s=e.longitude,r={url:e.icon?""+e.icon:"",anchor:new google.maps.Point(16,16)},a=new google.maps.Size(-20,-35),o="yellow";if(!D){var l=e.getNewIconsSize();a=l.labelOffset,o=l.labelColor,r.anchor=l.imageMarkerAnchor}var h=new google.maps.Marker({position:new google.maps.LatLng(i,s),icon:r});/\d{1,3}\s?[mk][ph|mp]/.test(e.speed)&&google.maps.event.addListener(h,"click",I.bind(null,e.id)),""!==r.url&&h.setMap(A);var u={content:n(o,e.id),boxStyle:{textAlign:"center",fontSize:"8pt"},disableAutoPan:!0,pixelOffset:a,position:new google.maps.LatLng(i,s),closeBoxURL:"",isHidden:!1,zIndex:google.maps.Marker.MAX_ZINDEX+1,pane:"floatShadow"},p=new InfoBox(u);return p.open(A),t||p.setMap(null),{marker:h,dataset:e.dataset,label:p,id:e.id,description:e.description,point:e,hide:function(){this.id==w.get("id")&&k.close(),this.marker.setMap(null),this.label.setMap(null)}}}function r(e,t){var i=_.find(e,{id:t});i&&(i.hide(),e.splice(e.indexOf(i),1))}function a(e){_.pluck(e,"id").forEach(function(t){r(e,t)})}function o(e,t){var i=e?A:null;t?t.forEach(function(e,t,n){S.forEach(function(t,n,s){t.id==e.id&&t.label.setMap(i)})}):S.forEach(function(e,t,n){e.label.setMap(i)})}function l(e){return"map"==e?google.maps.MapTypeId.ROADMAP:"satellite"==e?google.maps.MapTypeId.SATELLITE:"hybrid"==e?google.maps.MapTypeId.HYBRID:"terrain"==e?google.maps.MapTypeId.TERRAIN:void 0}function h(e,t,i,n,s){(new google.maps.StreetViewService).getPanoramaByLocation(e.getPosition(),100,function(t,i){var n=i===google.maps.StreetViewStatus.OK;s.hasStreetView=n,w.get("id")!=s.id&&(k.close(),w.mergePoint(s)),k.open(A,e)}),A.getStreetView().setPosition(e.getPosition())}function u(e,t,i,n,s,r,a,o){console.log("borderColor = "+r+" width = "+o);var l={name:e,color:t,opacity:s,borderColor:r,borderWidth:o,borderOpacity:a},h=[];n||i.forEach(function(e,t,i){h.push(new google.maps.LatLng(e.latitude,e.longitude))});var u=new google.maps.Polygon({clickable:!1,path:h,strokeColor:r,strokeOpacity:a,strokeWeight:o,fillColor:t,fillOpacity:s});n&&(u.editable=!0);var p={polygonAttr:l,polygon:u,id:l.name,hide:function(){google.maps.event.clearListeners(this.polygon.getPath(),"set_at"),google.maps.event.clearListeners(this.polygon.getPath(),"insert_at"),this.polygon.setMap(null),N&&N.id==this.id&&(N=null,P=!1,A.setOptions({draggableCursor:"default"}))}};if(x.push(p),u.setMap(A),n)return x[x.length-1]}function c(){E.forEach(function(e){e.poly.setMap(null)}),a(E)}function d(e){var t=[];points=e.getPath();for(var i=points.getLength(),n=0;n0&&A.setZoom(parseInt(i))},SfmbMapsGoogle.prototype.setMapType=function(e){A.setMapTypeId(l(e))},SfmbMapsGoogle.prototype.getMapType=function(){result="";var e=A.getMapTypeId();return e==google.maps.MapTypeId.ROADMAP?result="map":e==google.maps.MapTypeId.SATELLITE?result="satellite":e==google.maps.MapTypeId.HYBRID?result="hybrid":e==google.maps.MapTypeId.TERRAIN&&(result="terrain"),result},SfmbMapsGoogle.prototype.getLocation=function(e){},SfmbMapsGoogle.prototype.getAddress=function(e,t){};var I=function(e){console.log("clicking on a marker "+e);var t=_.find(S,{id:e});t&&h(t.marker,t.id,t.description,t.dataset,t.point)};SfmbMapsGoogle.prototype.openInfoBubble=I,SfmbMapsGoogle.prototype.updatePolygon=function(e,t,i){var n={};n[{borderColor:"strokeColor",borderOpacity:"strokeOpacity",borderWidth:"strokeWeight",color:"fillColor",opacity:"fillOpacity"}[t]]=i;var s=_(x).findWhere({id:e});s&&s.polygon.setOptions(n)},SfmbMapsGoogle.prototype.setPolygon=function(e,t,i,n,s,r,a){u(e,t,i,!1,n,s,r,a)},SfmbMapsGoogle.prototype.deletePolygon=function(e){if(console.log("removing polygon "+e),e){var t=_.find(x,{polygonAttr:{name:e}});t&&t.polygon.setMap(null),r(x,e)}else this.deleteAllPolygons();A.setOptions({draggableCursor:"default"})},SfmbMapsGoogle.prototype.deleteAllPolygons=function(){x.forEach(function(e){e.polygon.setMap(null)}),console.log("------------------removing all polygons...."),a(x)},SfmbMapsGoogle.prototype.setPoly=function(e,t,i,n,s){var r={name:s,color:t,thickness:i},a=[];n.forEach(function(e,t,i){a.push(new google.maps.LatLng(e.latitude,e.longitude))});var o=new google.maps.Polyline({path:a,strokeColor:t,strokeOpacity:i,strokeWeight:4});E.push({polyAttr:r,poly:o,id:r.name,hide:function(){this.poly.setMap(null)}}),o.setMap(A)},SfmbMapsGoogle.prototype.deletePoly=function(e){e?(p=_.find(E,{polyAttr:{name:e}}),p&&p.poly.setMap(null),r(E,e)):c()},SfmbMapsGoogle.prototype.newPolygon=function(e,t,i,n,s,r){console.log("opacity = "+i+" borderColor = "+n);N=u(e,t,null,!0,i,n,s,r),A.setOptions({draggableCursor:"crosshair"}),f(N.polygon),P=!0},SfmbMapsGoogle.prototype.getPolygon=function(e){var t=[];if(e){var i=_(x).findWhere({id:e});i&&(t={name:i.polygonAttr.name,color:i.polygonAttr.color,points:d(i.polygon)})}else x.forEach(function(e,i,n){t.push({name:e.polygonAttr.name,color:e.polygonAttr.color,points:d(e.polygon)})});return console.log(JSON.stringify(t)),g&&g(t),t},SfmbMapsGoogle.prototype.startEditPolygon=function(e){var t=this,i=_(x).findWhere({id:e});i&&(i.polygon.getPath().forEach(function(e,i){return t.removePoint({id:"#"+(i+1)})}),i.polygon.setEditable(!0),N=i,A.setOptions({draggableCursor:"crosshair"}),f(i.polygon))},SfmbMapsGoogle.prototype.endEditPolygon=function(){google.maps.event.clearListeners(N.polygon.getPath(),"set_at"),google.maps.event.clearListeners(N.polygon.getPath(),"insert_at"),N.polygon.setEditable(!1),N=null,P=!1,A.setOptions({draggableCursor:"default"})},SfmbMapsGoogle.prototype.clearFromMap=function(e,t,i){},SfmbMapsGoogle.prototype.resetAll=function(){k.close(),this.removeAllPoints(),this.deletePolygon(),this.deletePoly()},SfmbMapsGoogle.prototype.changePolygonColor=function(e,t){var i=_(x).findWhere({id:e});i&&(i.polygonAttr.color=t,i.polygon.setOptions({fillColor:t,strokeColor:t}))},SfmbMapsGoogle.prototype.geocode=function(e,t){var i=this;return new Promise(function(n,s){var r=new google.maps.Geocoder,a=i;r.geocode({address:e},function(e,i){if(i==google.maps.GeocoderStatus.OK){var r={lat:e[0].geometry.location.lat(),lon:e[0].geometry.location.lng(),display_name:e[0].formatted_address};t&&a.openSimplePopup(r),n(e.map(function(e){return e.formatted_address}))}else s(i)})})};var R=null;SfmbMapsGoogle.prototype.openSimplePopup=function(e){var t="http://chart.apis.google.com/chart?chst=d_bubble_icon_text_small&chld=flag|bbtl|"+e.display_name+"|FFFFaa|000000",i="http://chart.apis.google.com/chart?chst=d_bubble_icon_text_small_shadow&chld=flag|bbtl|"+e.display_name+"|FFFF88|000000";A.panTo(new google.maps.LatLng(e.lat,e.lon));var n={anchor:new google.maps.Point(0,0),url:t},s={anchor:new google.maps.Point(0,0),url:i},r=new google.maps.Marker({map:A,position:new google.maps.LatLng(e.lat,e.lon),icon:n,shadow:s,anchorPoint:new google.maps.Point(0,0)});google.maps.event.addListener(r,"click",function(e){r.setMap(null),r=null})},SfmbMapsGoogle.prototype.autosizeOnBounds=function(e){var t=new google.maps.LatLngBounds;e.forEach(function(e){return t.extend(new google.maps.LatLng(e.latitude,e.longitude))}),A.fitBounds(t)};var z=new google.maps.TrafficLayer;SfmbMapsGoogle.prototype.setTraffic=function(e){e?z.setMap(A):z.setMap(null)},SfmbMapsGoogle.prototype.setMapKind=function(){},SfmbMapsGoogle.prototype.getMapKind=function(){return"Google"},SfmbMapsGoogle.prototype.setLegacyIcons=function(e){console.log("Legacy icons for Google Maps are: "+e),D=JSON.parse(e)}}}var OpenLayers={VERSION_NUMBER:"Release 2.13.1",singleFile:!0,_getScriptLocation:function(){for(var e,t,i=new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"),n=document.getElementsByTagName("script"),s="",r=0,a=n.length;r1){var s=[n,t].concat(Array.prototype.slice.call(arguments).slice(1,e-1),i);OpenLayers.inherit.apply(null,s)}else n.prototype=i;return n},OpenLayers.inherit=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i;var n,s,r;for(n=2,s=arguments.length;n0&&(i=parseFloat(e.toPrecision(t))),i},format:function(e,t,i,n){t=void 0!==t?t:0,i=void 0!==i?i:OpenLayers.Number.thousandsSeparator,n=void 0!==n?n:OpenLayers.Number.decimalSeparator,null!=t&&(e=parseFloat(e.toFixed(t)));var s=e.toString().split(".");1==s.length&&null==t&&(t=0);var r=s[0];if(i)for(var a=/(-?[0-9]+)([0-9]{3})/;a.test(r);)r=r.replace(a,"$1"+i+"$2");var o;if(0==t)o=r;else{var l=s.length>1?s[1]:"0";null!=t&&(l+=new Array(t-l.length+1).join("0")),o=r+n+l}return o},zeroPad:function(e,t,i){for(var n=e.toString(i||10);n.lengththis.right)&&(this.right=e.right),(null==this.top||e.top>this.top)&&(this.top=e.top)}},extendXY:function(e,t){this.centerLonLat=null,(null==this.left||ethis.right)&&(this.right=e),(null==this.top||t>this.top)&&(this.top=t)},containsLonLat:function(e,t){"boolean"==typeof t&&(t={inclusive:t}),t=t||{};var i=this.contains(e.lon,e.lat,t.inclusive),n=t.worldBounds;if(n&&!i){var s=n.getWidth(),r=(n.left+n.right)/2,a=Math.round((e.lon-r)/s);i=this.containsLonLat({lon:e.lon-a*s,lat:e.lat},{inclusive:t.inclusive})}return i},containsPixel:function(e,t){return this.contains(e.x,e.y,t)},contains:function(e,t,i){if(null==i&&(i=!0),null==e||null==t)return!1;e=OpenLayers.Util.toFloat(e),t=OpenLayers.Util.toFloat(t);return i?e>=this.left&&e<=this.right&&t>=this.bottom&&t<=this.top:e>this.left&&ethis.bottom&&t=i.bottom&&e.bottom<=i.top||i.bottom>=e.bottom&&i.bottom<=e.top,a=e.top>=i.bottom&&e.top<=i.top||i.top>e.bottom&&i.top=i.left&&e.left<=i.right||i.left>=e.left&&i.left<=e.right,l=e.right>=i.left&&e.right<=i.right||i.right>=e.left&&i.right<=e.right;n=(r||a)&&(o||l)}if(t.worldBounds&&!n){var h=t.worldBounds,u=h.getWidth(),p=!h.containsBounds(i),c=!h.containsBounds(e);p&&!c?(e=e.add(-u,0),n=i.intersectsBounds(e,{inclusive:t.inclusive})):c&&!p&&(i=i.add(-u,0),n=e.intersectsBounds(i,{inclusive:t.inclusive}))}return n},containsBounds:function(e,t,i){null==t&&(t=!1),null==i&&(i=!0);var n=this.contains(e.left,e.bottom,i),s=this.contains(e.right,e.bottom,i),r=this.contains(e.left,e.top,i),a=this.contains(e.right,e.top,i);return t?n||s||r||a:n&&s&&r&&a},determineQuadrant:function(e){var t="",i=this.getCenterLonLat();return t+=e.lat=e.right&&s.right>e.right;)s=s.add(-r,0);var a=s.left+i;ae.left&&s.right-n>e.right&&(s=s.add(-r,0))}return s},CLASS_NAME:"OpenLayers.Bounds"}),OpenLayers.Bounds.fromString=function(e,t){var i=e.split(",");return OpenLayers.Bounds.fromArray(i,t)},OpenLayers.Bounds.fromArray=function(e,t){return!0===t?new OpenLayers.Bounds(e[1],e[0],e[3],e[2]):new OpenLayers.Bounds(e[0],e[1],e[2],e[3])},OpenLayers.Bounds.fromSize=function(e){return new OpenLayers.Bounds(0,e.h,e.w,0)},OpenLayers.Bounds.oppositeQuadrant=function(e){var t="";return t+="t"==e.charAt(0)?"b":"t",t+="l"==e.charAt(1)?"r":"l"},OpenLayers.Element={visible:function(e){return"none"!=OpenLayers.Util.getElement(e).style.display},toggle:function(){for(var e=0,t=arguments.length;ee.right;)t.lon-=e.getWidth()}return t},CLASS_NAME:"OpenLayers.LonLat"}),OpenLayers.LonLat.fromString=function(e){var t=e.split(",");return new OpenLayers.LonLat(t[0],t[1])},OpenLayers.LonLat.fromArray=function(e){var t=OpenLayers.Util.isArray(e),i=t&&e[0],n=t&&e[1];return new OpenLayers.LonLat(i,n)},OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(e,t){this.x=parseFloat(e),this.y=parseFloat(t)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(e){var t=!1;return null!=e&&(t=this.x==e.x&&this.y==e.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(e.x)&&isNaN(e.y)),t},distanceTo:function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},add:function(e,t){if(null==e||null==t)throw new TypeError("Pixel.add cannot receive null values");return new OpenLayers.Pixel(this.x+e,this.y+t)},offset:function(e){var t=this.clone();return e&&(t=this.add(e.x,e.y)),t},CLASS_NAME:"OpenLayers.Pixel"}),OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(e,t){this.w=parseFloat(e),this.h=parseFloat(t)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(e){var t=!1;return null!=e&&(t=this.w==e.w&&this.h==e.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(e.w)&&isNaN(e.h)),t},CLASS_NAME:"OpenLayers.Size"}),OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(e){alert(e)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"},function(){for(var e=document.getElementsByTagName("script"),t=0,i=e.length;t=0;i--)e[i]==t&&e.splice(i,1);return e},OpenLayers.Util.indexOf=function(e,t){if("function"==typeof e.indexOf)return e.indexOf(t);for(var i=0,n=e.length;i=0&&parseFloat(o)<1?(e.style.filter="alpha(opacity="+100*o+")",e.style.opacity=o):1==parseFloat(o)&&(e.style.filter="",e.style.opacity="")},OpenLayers.Util.createDiv=function(e,t,i,n,s,r,a,o){var l=document.createElement("div");return n&&(l.style.backgroundImage="url("+n+")"),e||(e=OpenLayers.Util.createUniqueID("OpenLayersDiv")),s||(s="absolute"),OpenLayers.Util.modifyDOMElement(l,e,t,i,s,r,a,o),l},OpenLayers.Util.createImage=function(e,t,i,n,s,r,a,o){function l(){h.style.display="",OpenLayers.Event.stopObservingElement(h)}var h=document.createElement("img");return e||(e=OpenLayers.Util.createUniqueID("OpenLayersDiv")),s||(s="relative"),OpenLayers.Util.modifyDOMElement(h,e,t,i,s,r,null,a),o&&(h.style.display="none",OpenLayers.Event.observe(h,"load",l),OpenLayers.Event.observe(h,"error",l)),h.style.alt=e,h.galleryImg="no",n&&(h.src=n),h},OpenLayers.IMAGE_RELOAD_ATTEMPTS=0,OpenLayers.Util.alphaHackNeeded=null,OpenLayers.Util.alphaHack=function(){if(null==OpenLayers.Util.alphaHackNeeded){var e=navigator.appVersion.split("MSIE"),t=parseFloat(e[1]),i=!1;try{i=!!document.body.filters}catch(e){}OpenLayers.Util.alphaHackNeeded=i&&t>=5.5&&t<7}return OpenLayers.Util.alphaHackNeeded},OpenLayers.Util.modifyAlphaImageDiv=function(e,t,i,n,s,r,a,o,l){OpenLayers.Util.modifyDOMElement(e,t,i,n,r,null,null,l);var h=e.childNodes[0];s&&(h.src=s),OpenLayers.Util.modifyDOMElement(h,e.id+"_innerImage",null,n,"relative",a),OpenLayers.Util.alphaHack()&&("none"!=e.style.display&&(e.style.display="inline-block"),null==o&&(o="scale"),e.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+h.src+"', sizingMethod='"+o+"')",parseFloat(e.style.opacity)>=0&&parseFloat(e.style.opacity)<1&&(e.style.filter+=" alpha(opacity="+100*e.style.opacity+")"),h.style.filter="alpha(opacity=0)")},OpenLayers.Util.createAlphaImageDiv=function(e,t,i,n,s,r,a,o,l){var h=OpenLayers.Util.createDiv(),u=OpenLayers.Util.createImage(null,null,null,null,null,null,null,l);return u.className="olAlphaImg",h.appendChild(u),OpenLayers.Util.modifyAlphaImageDiv(h,e,t,i,n,s,r,a,o),h},OpenLayers.Util.upperCaseObject=function(e){var t={};for(var i in e)t[i.toUpperCase()]=e[i];return t},OpenLayers.Util.applyDefaults=function(e,t){e=e||{};var i="function"==typeof window.Event&&t instanceof window.Event;for(var n in t)(void 0===e[n]||!i&&t.hasOwnProperty&&t.hasOwnProperty(n)&&!e.hasOwnProperty(n))&&(e[n]=t[n]);return!i&&t&&t.hasOwnProperty&&t.hasOwnProperty("toString")&&!e.hasOwnProperty("toString")&&(e.toString=t.toString),e},OpenLayers.Util.getParameterString=function(e){var t=[];for(var i in e){var n=e[i];if(null!=n&&"function"!=typeof n){var s;if("object"==typeof n&&n.constructor==Array){for(var r,a=[],o=0,l=n.length;o1e-12&&--m>0;){var y=Math.sin(d),g=Math.cos(d),v=Math.sqrt(c*y*(c*y)+(u*p-h*c*g)*(u*p-h*c*g));if(0==v)return 0;var L=h*p+u*c*g,O=Math.atan2(v,L),b=Math.asin(u*c*y/v),w=Math.cos(b)*Math.cos(b),S=L-2*h*p/w,C=r/16*w*(4+r*(4-3*w));f=d,d=a+(1-C)*r*Math.sin(b)*(O+C*v*(S+C*L*(2*S*S-1)))}if(0==m)return NaN;var x=w*(n*n-s*s)/(s*s),_=x/1024*(256+x*(x*(74-47*x)-128));return(s*(1+x/16384*(4096+x*(x*(320-175*x)-768)))*(O-_*v*(S+_/4*(L*(2*S*S-1)-_/6*S*(4*v*v-3)*(4*S*S-3))))).toFixed(3)/1e3},OpenLayers.Util.destinationVincenty=function(e,t,i){for(var n=OpenLayers.Util,s=n.VincentyConstants,r=s.a,a=s.b,o=s.f,l=e.lon,h=e.lat,u=i,p=n.rad(t),c=Math.sin(p),d=Math.cos(p),f=(1-o)*Math.tan(n.rad(h)),m=1/Math.sqrt(1+f*f),y=f*m,g=Math.atan2(f,d),v=m*c,L=1-v*v,O=L*(r*r-a*a)/(a*a),b=1+O/16384*(4096+O*(O*(320-175*O)-768)),w=O/1024*(256+O*(O*(74-47*O)-128)),S=u/(a*b),C=2*Math.PI;Math.abs(S-C)>1e-12;){var x=Math.cos(2*g+S),_=Math.sin(S),E=Math.cos(S);C=S,S=u/(a*b)+w*_*(x+w/4*(E*(2*x*x-1)-w/6*x*(4*_*_-3)*(4*x*x-3)))}var N=y*_-m*E*d,P=Math.atan2(y*E+m*_*d,(1-o)*Math.sqrt(v*v+N*N)),M=o/16*L*(4+o*(4-3*L)),T=Math.atan2(_*c,m*E-y*_*d)-(1-M)*o*v*(S+M*_*(x+M*E*(2*x*x-1)));Math.atan2(v,-N);return new OpenLayers.LonLat(l+n.deg(T),n.deg(P))},OpenLayers.Util.getParameters=function(e,t){t=t||{},e=null===e||void 0===e?window.location.href:e;var i="";if(OpenLayers.String.contains(e,"?")){var n=e.indexOf("?")+1,s=OpenLayers.String.contains(e,"#")?e.indexOf("#"):e.length;i=e.substring(n,s)}for(var r={},a=i.split(/[&;]/),o=0,l=a.length;o1?1/e:e},OpenLayers.Util.getResolutionFromScale=function(e,t){var i;return e&&(null==t&&(t="degrees"),i=1/(OpenLayers.Util.normalizeScale(e)*OpenLayers.INCHES_PER_UNIT[t]*OpenLayers.DOTS_PER_INCH)),i},OpenLayers.Util.getScaleFromResolution=function(e,t){return null==t&&(t="degrees"),e*OpenLayers.INCHES_PER_UNIT[t]*OpenLayers.DOTS_PER_INCH},OpenLayers.Util.pagePosition=function(e){var t=[0,0],i=OpenLayers.Util.getViewportElement();if(!e||e==window||e==i)return t;var n,s=OpenLayers.IS_GECKO&&document.getBoxObjectFor&&"absolute"==OpenLayers.Element.getStyle(e,"position")&&(""==e.style.top||""==e.style.left),r=null;if(e.getBoundingClientRect){n=e.getBoundingClientRect();var a=window.pageYOffset||i.scrollTop,o=window.pageXOffset||i.scrollLeft;t[0]=n.left+o,t[1]=n.top+a}else if(document.getBoxObjectFor&&!s){n=document.getBoxObjectFor(e);var l=document.getBoxObjectFor(i);t[0]=n.screenX-l.screenX,t[1]=n.screenY-l.screenY}else{if(t[0]=e.offsetLeft,t[1]=e.offsetTop,(r=e.offsetParent)!=e)for(;r;)t[0]+=r.offsetLeft,t[1]+=r.offsetTop,r=r.offsetParent;var h=OpenLayers.BROWSER_NAME;for(("opera"==h||"safari"==h&&"absolute"==OpenLayers.Element.getStyle(e,"position"))&&(t[1]-=document.body.offsetTop),r=e.offsetParent;r&&r!=document.body;)t[0]-=r.scrollLeft,"opera"==h&&"TR"==r.tagName||(t[1]-=r.scrollTop),r=r.offsetParent}return t},OpenLayers.Util.getViewportElement=function(){var e=arguments.callee.viewportElement;return void 0==e&&(e="msie"==OpenLayers.BROWSER_NAME&&"CSS1Compat"!=document.compatMode?document.body:document.documentElement,arguments.callee.viewportElement=e),e},OpenLayers.Util.isEquivalentUrl=function(e,t,i){i=i||{},OpenLayers.Util.applyDefaults(i,{ignoreCase:!0,ignorePort80:!0,ignoreHash:!0,splitArgs:!1});var n=OpenLayers.Util.createUrlObject(e,i),s=OpenLayers.Util.createUrlObject(t,i);for(var r in n)if("args"!==r&&n[r]!=s[r])return!1;for(var r in n.args){if(n.args[r]!=s.args[r])return!1;delete s.args[r]}for(var r in s.args)return!1;return!0},OpenLayers.Util.createUrlObject=function(e,t){if(t=t||{},!/^\w+:\/\//.test(e)){var i=window.location,n=i.port?":"+i.port:"",s=i.protocol+"//"+i.host.split(":").shift()+n;if(0===e.indexOf("/"))e=s+e;else{var r=i.pathname.split("/");r.pop(),e=s+r.join("/")+"/"+e}}t.ignoreCase&&(e=e.toLowerCase());var a=document.createElement("a");a.href=e;var o={};o.host=a.host.split(":").shift(),o.protocol=a.protocol,t.ignorePort80?o.port="80"==a.port||"0"==a.port?"":a.port:o.port=""==a.port||"0"==a.port?"80":a.port,o.hash=t.ignoreHash||"#"===a.hash?"":a.hash;var l=a.search;if(!l){var h=e.indexOf("?");l=-1!=h?e.substr(h):""}return o.args=OpenLayers.Util.getParameters(l,{splitArgs:t.splitArgs}),o.pathname="/"==a.pathname.charAt(0)?a.pathname:"/"+a.pathname,o},OpenLayers.Util.removeTail=function(e){var t=e.indexOf("?"),i=e.indexOf("#");return-1==t?-1!=i?e.substr(0,i):e:-1!=i?e.substr(0,Math.min(t,i)):e.substr(0,t)},OpenLayers.IS_GECKO=function(){var e=navigator.userAgent.toLowerCase();return-1==e.indexOf("webkit")&&-1!=e.indexOf("gecko")}(),OpenLayers.CANVAS_SUPPORTED=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),OpenLayers.BROWSER_NAME=function(){var e="",t=navigator.userAgent.toLowerCase();return-1!=t.indexOf("opera")?e="opera":-1!=t.indexOf("msie")?e="msie":-1!=t.indexOf("safari")?e="safari":-1!=t.indexOf("mozilla")&&(e=-1!=t.indexOf("firefox")?"firefox":"mozilla"),e}(),OpenLayers.Util.getBrowserName=function(){return OpenLayers.BROWSER_NAME},OpenLayers.Util.getRenderedDimensions=function(e,t,i){var n,s,r=document.createElement("div");r.style.visibility="hidden";for(var a=i&&i.containerElement?i.containerElement:document.body,o=!1,l=null,h=a;h&&"body"!=h.tagName.toLowerCase();){var u=OpenLayers.Element.getStyle(h,"position");if("absolute"==u){o=!0;break}if(u&&"static"!=u)break;h=h.parentNode}!o||0!==a.clientHeight&&0!==a.clientWidth||((l=document.createElement("div")).style.visibility="hidden",l.style.position="absolute",l.style.overflow="visible",l.style.width=document.body.clientWidth+"px",l.style.height=document.body.clientHeight+"px",l.appendChild(r)),r.style.position="absolute",t&&(t.w?(n=t.w,r.style.width=n+"px"):t.h&&(s=t.h,r.style.height=s+"px")),i&&i.displayClass&&(r.className=i.displayClass);var p=document.createElement("div");if(p.innerHTML=e,p.style.overflow="visible",p.childNodes)for(var c=0,d=p.childNodes.length;c=60&&(a-=60,(r+=1)>=60&&(r-=60,s+=1)),s<10&&(s="0"+s);var o=s+"°";return i.indexOf("dm")>=0&&(r<10&&(r="0"+r),o+=r+"'",i.indexOf("dms")>=0&&(a<10&&(a="0"+a),o+=a+'"')),o+="lon"==t?e<0?OpenLayers.i18n("W"):OpenLayers.i18n("E"):e<0?OpenLayers.i18n("S"):OpenLayers.i18n("N")},OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(e){OpenLayers.Util.extend(this,e),this.options=e},destroy:function(){},read:function(e){throw new Error("Read not implemented.")},write:function(e){throw new Error("Write not implemented.")},CLASS_NAME:"OpenLayers.Format"}),OpenLayers.Format.CSWGetRecords=function(e){e=OpenLayers.Util.applyDefaults(e,OpenLayers.Format.CSWGetRecords.DEFAULTS);var t=OpenLayers.Format.CSWGetRecords["v"+e.version.replace(/\./g,"_")];if(!t)throw"Unsupported CSWGetRecords version: "+e.version;return new t(e)},OpenLayers.Format.CSWGetRecords.DEFAULTS={version:"2.0.2"},OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handlerOptions:null,handler:null,eventListeners:null,events:null,initialize:function(e){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,""),OpenLayers.Util.extend(this,e),this.events=new OpenLayers.Events(this),this.eventListeners instanceof Object&&this.events.on(this.eventListeners),null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_"))},destroy:function(){if(this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null),this.eventListeners=null,this.handler&&(this.handler.destroy(),this.handler=null),this.handlers){for(var e in this.handlers)this.handlers.hasOwnProperty(e)&&"function"==typeof this.handlers[e].destroy&&this.handlers[e].destroy();this.handlers=null}this.map&&(this.map.removeControl(this),this.map=null),this.div=null},setMap:function(e){this.map=e,this.handler&&this.handler.setMap(e)},draw:function(e){return null==this.div&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),""!=this.title&&(this.div.title=this.title)),null!=e&&(this.position=e.clone()),this.moveTo(this.position),this.div},moveTo:function(e){null!=e&&null!=this.div&&(this.div.style.left=e.x+"px",this.div.style.top=e.y+"px")},activate:function(){return!this.active&&(this.handler&&this.handler.activate(),this.active=!0,this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("activate"),!0)},deactivate:function(){return!!this.active&&(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"),!0)},CLASS_NAME:"OpenLayers.Control"}),OpenLayers.Control.TYPE_BUTTON=1,OpenLayers.Control.TYPE_TOGGLE=2,OpenLayers.Control.TYPE_TOOL=3,OpenLayers.Event={observers:!1,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(e){return e.target||e.srcElement},isSingleTouch:function(e){return e.touches&&1==e.touches.length},isMultiTouch:function(e){return e.touches&&e.touches.length>1},isLeftClick:function(e){return e.which&&1==e.which||e.button&&1==e.button},isRightClick:function(e){return e.which&&3==e.which||e.button&&2==e.button},stop:function(e,t){t||OpenLayers.Event.preventDefault(e),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},findElement:function(e,t){for(var i=OpenLayers.Event.element(e);i.parentNode&&(!i.tagName||i.tagName.toUpperCase()!=t.toUpperCase());)i=i.parentNode;return i},observe:function(e,t,i,n){var s=OpenLayers.Util.getElement(e);if(n=n||!1,"keypress"==t&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||s.attachEvent)&&(t="keydown"),this.observers||(this.observers={}),!s._eventCacheID){var r="eventCacheID_";s.id&&(r=s.id+"_"+r),s._eventCacheID=OpenLayers.Util.createUniqueID(r)}var a=s._eventCacheID;this.observers[a]||(this.observers[a]=[]),this.observers[a].push({element:s,name:t,observer:i,useCapture:n}),s.addEventListener?s.addEventListener(t,i,n):s.attachEvent&&s.attachEvent("on"+t,i)},stopObservingElement:function(e){var t=OpenLayers.Util.getElement(e)._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[t])},_removeElementObservers:function(e){if(e)for(var t=e.length-1;t>=0;t--){var i=e[t];OpenLayers.Event.stopObserving.apply(this,[i.element,i.name,i.observer,i.useCapture])}},stopObserving:function(e,t,i,n){n=n||!1;var s=OpenLayers.Util.getElement(e),r=s._eventCacheID;"keypress"==t&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||s.detachEvent)&&(t="keydown");var a=!1,o=OpenLayers.Event.observers[r];if(o)for(var l=0;!a&&lMath.floor(e.pageY)||0===e.pageX&&Math.floor(s)>Math.floor(e.pageX)?(s-=i,r-=n):(r=0;--e)s[e].stopPropagation()},preventDefault:function(){for(var e=s.length-1;e>=0;--e)s[e].preventDefault()},type:t},e))}this.eventHandler;var s=this._msTouches;switch(t){case"touchstart":return this.addMsTouchListenerStart(e,t,n);case"touchend":return this.addMsTouchListenerEnd(e,t,n);case"touchmove":return this.addMsTouchListenerMove(e,t,n);default:throw"Unknown touch event type"}},addMsTouchListenerStart:function(e,t,i){var n=this._msTouches,s=function(e){for(var t=!1,s=0,r=n.length;s=0;--t)this.target.register(this.events[t],this,this.buttonClick,{extension:!0})},destroy:function(){for(var e=this.events.length-1;e>=0;--e)this.target.unregister(this.events[e],this,this.buttonClick);delete this.target},getPressedButton:function(e){var t,i=3;do{if(OpenLayers.Element.hasClass(e,"olButton")){t=e;break}e=e.parentNode}while(--i>0&&e);return t},ignore:function(e){var t=3,i=!1;do{if("a"===e.nodeName.toLowerCase()){i=!0;break}e=e.parentNode}while(--t>0&&e);return i},buttonClick:function(e){var t=!0,i=OpenLayers.Event.element(e);if(i&&(OpenLayers.Event.isLeftClick(e)||!~e.type.indexOf("mouse"))){var n=this.getPressedButton(i);if(n){if("keydown"===e.type)switch(e.keyCode){case OpenLayers.Event.KEY_RETURN:case OpenLayers.Event.KEY_SPACE:this.target.triggerEvent("buttonclick",{buttonElement:n}),OpenLayers.Event.stop(e),t=!1}else if(this.startEvt){if(this.completeRegEx.test(e.type)){var s=OpenLayers.Util.pagePosition(n),r=OpenLayers.Util.getViewportElement(),a=window.pageYOffset||r.scrollTop,o=window.pageXOffset||r.scrollLeft;s[0]=s[0]-o,s[1]=s[1]-a,this.target.triggerEvent("buttonclick",{buttonElement:n,buttonXY:{x:this.startEvt.clientX-s[0],y:this.startEvt.clientY-s[1]}})}this.cancelRegEx.test(e.type)&&delete this.startEvt,OpenLayers.Event.stop(e),t=!1}this.startRegEx.test(e.type)&&(this.startEvt=e,OpenLayers.Event.stop(e),t=!1)}else t=!this.ignore(OpenLayers.Event.element(e)),delete this.startEvt}return t}}),OpenLayers.Util=OpenLayers.Util||{},OpenLayers.Util.vendorPrefix=function(){"use strict";function e(e){return e?e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}).replace(/^ms-/,"-ms-"):null}function t(t){if(void 0===a[t]){var i=n(t.replace(/(-[\s\S])/g,function(e){return e.charAt(1).toUpperCase()}));a[t]=e(i)}return a[t]}function i(e,t){if(void 0===o[t]){var i,n,r=0,a=s.length,l=void 0!==e.cssText;for(o[t]=null;r0?t:Number.POSITIVE_INFINITY;var n=++a,s=+new Date;return o[n]=function(){o[n]&&+new Date-s<=t?(e(),o[n]&&r(o[n],i)):delete o[n]},r(o[n],i),n}function i(e){delete o[e]}var n=OpenLayers.Util.vendorPrefix.js(e,"requestAnimationFrame"),s=!!n,r=function(){var t=e[n]||function(t,i){e.setTimeout(t,16)};return function(i,n){t.apply(e,[i,n])}}(),a=0,o={};return{isNative:s,requestFrame:r,start:t,stop:i}}(window),OpenLayers.Tween=OpenLayers.Class({easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,minFrameRate:null,startTime:null,animationId:null,playing:!1,initialize:function(e){this.easing=e||OpenLayers.Easing.Expo.easeOut},start:function(e,t,i,n){this.playing=!0,this.begin=e,this.finish=t,this.duration=i,this.callbacks=n.callbacks,this.minFrameRate=n.minFrameRate||30,this.time=0,this.startTime=(new Date).getTime(),OpenLayers.Animation.stop(this.animationId),this.animationId=null,this.callbacks&&this.callbacks.start&&this.callbacks.start.call(this,this.begin),this.animationId=OpenLayers.Animation.start(OpenLayers.Function.bind(this.play,this))},stop:function(){this.playing&&(this.callbacks&&this.callbacks.done&&this.callbacks.done.call(this,this.finish),OpenLayers.Animation.stop(this.animationId),this.animationId=null,this.playing=!1)},play:function(){var e={};for(var t in this.begin){var i=this.begin[t],n=this.finish[t];if(null==i||null==n||isNaN(i)||isNaN(n))throw new TypeError("invalid value for Tween");var s=n-i;e[t]=this.easing.apply(this,[this.time,i,s,this.duration])}this.time++,this.callbacks&&this.callbacks.eachStep&&((new Date).getTime()-this.startTime)/this.time<=1e3/this.minFrameRate&&this.callbacks.eachStep.call(this,e),this.time>this.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"}),OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"},OpenLayers.Easing.Linear={easeIn:function(e,t,i,n){return i*e/n+t},easeOut:function(e,t,i,n){return i*e/n+t},easeInOut:function(e,t,i,n){return i*e/n+t},CLASS_NAME:"OpenLayers.Easing.Linear"},OpenLayers.Easing.Expo={easeIn:function(e,t,i,n){return 0==e?t:i*Math.pow(2,10*(e/n-1))+t},easeOut:function(e,t,i,n){return e==n?t+i:i*(1-Math.pow(2,-10*e/n))+t},easeInOut:function(e,t,i,n){return 0==e?t:e==n?t+i:(e/=n/2)<1?i/2*Math.pow(2,10*(e-1))+t:i/2*(2-Math.pow(2,-10*--e))+t},CLASS_NAME:"OpenLayers.Easing.Expo"},OpenLayers.Easing.Quad={easeIn:function(e,t,i,n){return i*(e/=n)*e+t},easeOut:function(e,t,i,n){return-i*(e/=n)*(e-2)+t},easeInOut:function(e,t,i,n){return(e/=n/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t},CLASS_NAME:"OpenLayers.Easing.Quad"},OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(e,t){OpenLayers.Util.extend(this,t),this.projCode=e,"object"==typeof Proj4js&&(this.proj=new Proj4js.Proj(e))},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(e){var t=e,i=!1;if(t)if(t instanceof OpenLayers.Projection||(t=new OpenLayers.Projection(t)),"object"==typeof Proj4js&&this.proj.defData&&t.proj.defData)i=this.proj.defData.replace(this.titleRegEx,"")==t.proj.defData.replace(this.titleRegEx,"");else if(t.getCode){var n=this.getCode(),s=t.getCode();i=n==s||!!OpenLayers.Projection.transforms[n]&&OpenLayers.Projection.transforms[n][s]===OpenLayers.Projection.nullTransform}return i},destroy:function(){delete this.proj,delete this.projCode},CLASS_NAME:"OpenLayers.Projection"}),OpenLayers.Projection.transforms={},OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],yx:!0},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-20037508.34,-20037508.34,20037508.34,20037508.34]}},OpenLayers.Projection.addTransform=function(e,t,i){if(i===OpenLayers.Projection.nullTransform){var n=OpenLayers.Projection.defaults[e];n&&!OpenLayers.Projection.defaults[t]&&(OpenLayers.Projection.defaults[t]=n)}OpenLayers.Projection.transforms[e]||(OpenLayers.Projection.transforms[e]={}),OpenLayers.Projection.transforms[e][t]=i},OpenLayers.Projection.transform=function(e,t,i){if(t&&i)if(t instanceof OpenLayers.Projection||(t=new OpenLayers.Projection(t)),i instanceof OpenLayers.Projection||(i=new OpenLayers.Projection(i)),t.proj&&i.proj)e=Proj4js.transform(t.proj,i.proj,e);else{var n=t.getCode(),s=i.getCode(),r=OpenLayers.Projection.transforms;r[n]&&r[n][s]&&r[n][s](e)}return e},OpenLayers.Projection.nullTransform=function(e){return e},function(){function e(e){return e.x=180*e.x/s,e.y=180/Math.PI*(2*Math.atan(Math.exp(e.y/s*Math.PI))-Math.PI/2),e}function t(e){e.x=e.x*s/180;var t=Math.log(Math.tan((90+e.y)*Math.PI/360))/Math.PI*s;return e.y=Math.max(-20037508.34,Math.min(t,20037508.34)),e}function i(i,n){var s,r,a,o,l,h=OpenLayers.Projection.addTransform,u=OpenLayers.Projection.nullTransform;for(s=0,r=n.length;s=0;--n)i(r[n],a);for(n=a.length-1;n>=0;--n)i(a[n],r)}(),OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1e3},id:null,fractionalZoom:!1,events:null,allOverlays:!1,div:null,dragging:!1,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,options:null,tileSize:null,projection:"EPSG:4326",units:null,resolutions:null,maxResolution:null,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:!1,autoUpdateSize:!0,eventListeners:null,panTween:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,zoomTween:null,zoomMethod:OpenLayers.Easing.Quad.easeOut,zoomDuration:20,paddingForPopups:null,layerContainerOriginPx:null,minPx:null,maxPx:null,initialize:function(e,t){1===arguments.length&&"object"==typeof e&&(e=(t=e)&&t.div),this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT),this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15),this.theme=OpenLayers._getScriptLocation()+"theme/default/style.css",this.options=OpenLayers.Util.extend({},t),OpenLayers.Util.extend(this,t);var i=this.projection instanceof OpenLayers.Projection?this.projection.projCode:this.projection;OpenLayers.Util.applyDefaults(this,OpenLayers.Projection.defaults[i]),!this.maxExtent||this.maxExtent instanceof OpenLayers.Bounds||(this.maxExtent=new OpenLayers.Bounds(this.maxExtent)),!this.minExtent||this.minExtent instanceof OpenLayers.Bounds||(this.minExtent=new OpenLayers.Bounds(this.minExtent)),!this.restrictedExtent||this.restrictedExtent instanceof OpenLayers.Bounds||(this.restrictedExtent=new OpenLayers.Bounds(this.restrictedExtent)),!this.center||this.center instanceof OpenLayers.LonLat||(this.center=new OpenLayers.LonLat(this.center)),this.layers=[],this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_"),this.div=OpenLayers.Util.getElement(e),this.div||(this.div=document.createElement("div"),this.div.style.height="1px",this.div.style.width="1px"),OpenLayers.Element.addClass(this.div,"olMap");var n=this.id+"_OpenLayers_ViewPort";if(this.viewPortDiv=OpenLayers.Util.createDiv(n,null,null,null,"relative",null,"hidden"),this.viewPortDiv.style.width="100%",this.viewPortDiv.style.height="100%",this.viewPortDiv.className="olMapViewport",this.div.appendChild(this.viewPortDiv),this.events=new OpenLayers.Events(this,this.viewPortDiv,null,this.fallThrough,{includeXY:!0}),OpenLayers.TileManager&&null!==this.tileManager&&(this.tileManager instanceof OpenLayers.TileManager||(this.tileManager=new OpenLayers.TileManager(this.tileManager)),this.tileManager.addMap(this)),n=this.id+"_OpenLayers_Container",this.layerContainerDiv=OpenLayers.Util.createDiv(n),this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE.Popup-1,this.layerContainerOriginPx={x:0,y:0},this.applyTransform(),this.viewPortDiv.appendChild(this.layerContainerDiv),this.updateSize(),this.eventListeners instanceof Object&&this.events.on(this.eventListeners),!0===this.autoUpdateSize&&(this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this),OpenLayers.Event.observe(window,"resize",this.updateSizeDestroy)),this.theme){for(var s=!0,r=document.getElementsByTagName("link"),a=0,o=r.length;a=0;--e)this.controls[e].destroy();this.controls=null}if(null!=this.layers){for(var e=this.layers.length-1;e>=0;--e)this.layers[e].destroy(!1);this.layers=null}this.viewPortDiv&&this.viewPortDiv.parentNode&&this.viewPortDiv.parentNode.removeChild(this.viewPortDiv),this.viewPortDiv=null,this.tileManager&&(this.tileManager.removeMap(this),this.tileManager=null),this.eventListeners&&(this.events.un(this.eventListeners),this.eventListeners=null),this.events.destroy(),this.events=null,this.options=null},setOptions:function(e){var t=this.minPx&&e.restrictedExtent!=this.restrictedExtent;OpenLayers.Util.extend(this,e),t&&this.moveTo(this.getCachedCenter(),this.zoom,{forceZoomChange:!0})},getTileSize:function(){return this.tileSize},getBy:function(e,t,i){var n="function"==typeof i.test;return OpenLayers.Array.filter(this[e],function(e){return e[t]==i||n&&i.test(e[t])})},getLayersBy:function(e,t){return this.getBy("layers",e,t)},getLayersByName:function(e){return this.getLayersBy("name",e)},getLayersByClass:function(e){return this.getLayersBy("CLASS_NAME",e)},getControlsBy:function(e,t){return this.getBy("controls",e,t)},getControlsByClass:function(e){return this.getControlsBy("CLASS_NAME",e)},getLayer:function(e){for(var t=null,i=0,n=this.layers.length;ithis.layers.length&&(t=this.layers.length),i!=t){this.layers.splice(i,1),this.layers.splice(t,0,e);for(var n=0,s=this.layers.length;n=0;--i)this.removePopup(this.popups[i]);e.map=this,this.popups.push(e);var n=e.draw();n&&(n.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length,this.layerContainerDiv.appendChild(n))},removePopup:function(e){if(OpenLayers.Util.removeItem(this.popups,e),e.div)try{this.layerContainerDiv.removeChild(e.div)}catch(e){}e.map=null},getSize:function(){var e=null;return null!=this.size&&(e=this.size.clone()),e},updateSize:function(){var e=this.getCurrentSize();if(e&&!isNaN(e.h)&&!isNaN(e.w)){this.events.clearMouseCache();var t=this.getSize();if(null==t&&(this.size=t=e),!e.equals(t)){this.size=e;for(var i=0,n=this.layers.length;i=this.minPx.x+o?Math.round(e):0,t=r<=this.maxPx.y-l&&r>=this.minPx.y+l?Math.round(t):0,e||t){this.dragging||(this.dragging=!0,this.events.triggerEvent("movestart")),this.center=null,e&&(this.layerContainerOriginPx.x-=e,this.minPx.x-=e,this.maxPx.x-=e),t&&(this.layerContainerOriginPx.y-=t,this.minPx.y-=t,this.maxPx.y-=t),this.applyTransform();var h,u,p;for(u=0,p=this.layers.length;ui)if(this.fractionalZoom)e=this.getZoomForResolution(i);else for(var n=0|e,s=t.length;nthis.restrictedExtent.getWidth()?e=new OpenLayers.LonLat(l.lon,e.lat):o.leftthis.restrictedExtent.right&&(e=e.add(this.restrictedExtent.right-o.right,0)),o.getHeight()>this.restrictedExtent.getHeight()?e=new OpenLayers.LonLat(e.lon,l.lat):o.bottomthis.restrictedExtent.top&&(e=e.add(0,this.restrictedExtent.top-o.top))}}var h=r||this.isValidZoomLevel(t)&&t!=this.getZoom(),u=this.isValidLonLat(e)&&!e.equals(this.center);if(h||u||s){s||this.events.triggerEvent("movestart",{zoomChanged:h}),u&&(!h&&this.center&&this.centerLayerContainer(e),this.center=e.clone());var p=h?this.getResolutionForZoom(t):this.getResolution();if(h||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter(),this.layerContainerOriginPx.x=0,this.layerContainerOriginPx.y=0,this.applyTransform();var c=this.getMaxExtent({restricted:!0}),d=c.getCenterLonLat(),f=this.center.lon-d.lon,m=d.lat-this.center.lat,y=Math.round(c.getWidth()/p),g=Math.round(c.getHeight()/p);this.minPx={x:(this.size.w-y)/2-f/p,y:(this.size.h-g)/2-m/p},this.maxPx={x:this.minPx.x+Math.round(c.getWidth()/p),y:this.minPx.y+Math.round(c.getHeight()/p)}}h&&(this.zoom=t,this.resolution=p);var v=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(v,h,i.dragging),i.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:h})),v=this.baseLayer.getExtent();for(b=this.layers.length-1;b>=0;--b){var L=this.layers[b];if(L!==this.baseLayer&&!L.isBaseLayer){var O=L.calculateInRange();L.inRange!=O&&(L.inRange=O,O||L.display(!1),this.events.triggerEvent("changelayer",{layer:L,property:"visibility"})),O&&L.visibility&&(L.moveTo(v,h,i.dragging),i.dragging||L.events.triggerEvent("moveend",{zoomChanged:h}))}}if(this.events.triggerEvent("move"),s||this.events.triggerEvent("moveend"),h){for(var b=0,w=this.popups.length;b=0&&e0&&(e=this.layers[0].getResolution()),e},getUnits:function(){var e=null;return null!=this.baseLayer&&(e=this.baseLayer.units),e},getScale:function(){var e=null;if(null!=this.baseLayer){var t=this.getResolution(),i=this.baseLayer.units;e=OpenLayers.Util.getScaleFromResolution(t,i)}return e},getZoomForExtent:function(e,t){var i=null;return null!=this.baseLayer&&(i=this.baseLayer.getZoomForExtent(e,t)),i},getResolutionForZoom:function(e){var t=null;return this.baseLayer&&(t=this.baseLayer.getResolutionForZoom(e)),t},getZoomForResolution:function(e,t){var i=null;return null!=this.baseLayer&&(i=this.baseLayer.getZoomForResolution(e,t)),i},zoomTo:function(e,t){var i=this;if(i.isValidZoomLevel(e))if(i.baseLayer.wrapDateLine&&(e=i.adjustZoom(e)),i.zoomTween){var n={scale:1},s={scale:i.getResolution()/i.getResolutionForZoom(e)};if(i.zoomTween.playing&&i.zoomTween.duration<3*i.zoomDuration)i.zoomTween.finish={scale:i.zoomTween.finish.scale*s.scale};else{if(!t){var r=i.getSize();t={x:r.w/2,y:r.h/2}}i.zoomTween.start(n,s,i.zoomDuration,{minFrameRate:50,callbacks:{eachStep:function(e){var n=i.layerContainerOriginPx,s=e.scale,r=(s-1)*(n.x-t.x)|0,a=(s-1)*(n.y-t.y)|0;i.applyTransform(n.x+r,n.y+a,s)},done:function(e){i.applyTransform();var n=i.getResolution()/e.scale,s=i.getZoomForResolution(n,!0);i.moveTo(i.getZoomTargetCenter(t,n),s,!0)}}})}}else{var a=t?i.getZoomTargetCenter(t,i.getResolutionForZoom(e)):null;i.setCenter(a,e)}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(e,t){e instanceof OpenLayers.Bounds||(e=new OpenLayers.Bounds(e));var i=e.getCenterLonLat();if(this.baseLayer.wrapDateLine){var n=this.getMaxExtent();for(e=e.clone();e.right=this.down.xy.distanceTo(e.xy))&&this.touch&&this.down.touches.length===this.last.touches.length)for(var i=0,n=this.down.touches.length;ithis.pixelTolerance){t=!1;break}return t},getTouchDistance:function(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))},passesDblclickTolerance:function(e){var t=!0;return this.down&&this.first&&(t=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance),t},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null),null!=this.rightclickTimerId&&(window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null)},delayedCall:function(e){this.timerId=null,e&&this.callback("click",[e])},getEventInfo:function(e){var t;if(e.touches){var i=e.touches.length;t=new Array(i);for(var n,s=0;s0&&(this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)),this.dragging=!0,this.move(e),this.callback("move",[e.xy]),this.oldOnselectstart||(this.oldOnselectstart=document.onselectstart,document.onselectstart=OpenLayers.Function.False),this.last=e.xy),!0},dragend:function(e){if(this.started){!0===this.documentDrag&&this.documentEvents&&(this.adjustXY(e),this.removeDocumentEvents());var t=this.start!=this.last;this.started=!1,this.dragging=!1,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"),this.up(e),this.callback("up",[e.xy]),t&&this.callback("done",[e.xy]),document.onselectstart=this.oldOnselectstart}return!0},down:function(e){},move:function(e){},up:function(e){},out:function(e){},mousedown:function(e){return this.dragstart(e)},touchstart:function(e){return this.startTouch(),this.dragstart(e)},mousemove:function(e){return this.dragmove(e)},touchmove:function(e){return this.dragmove(e)},removeTimeout:function(){this.timeoutId=null,this.dragging&&this.mousemove(this.lastMoveEvt)},mouseup:function(e){return this.dragend(e)},touchend:function(e){return e.xy=this.last,this.dragend(e)},mouseout:function(e){if(this.started&&OpenLayers.Util.mouseLeft(e,this.map.viewPortDiv))if(!0===this.documentDrag)this.addDocumentEvents();else{var t=this.start!=this.last;this.started=!1,this.dragging=!1,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown"),this.out(e),this.callback("out",[]),t&&this.callback("done",[e.xy]),document.onselectstart&&(document.onselectstart=this.oldOnselectstart)}return!0},click:function(e){return this.start==this.last},activate:function(){var e=!1;return OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragging=!1,e=!0),e},deactivate:function(){var e=!1;return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.started=!1,this.dragging=!1,this.start=null,this.last=null,e=!0,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")),e},adjustXY:function(e){var t=OpenLayers.Util.pagePosition(this.map.viewPortDiv);e.xy.x-=t[0],e.xy.y-=t[1]},addDocumentEvents:function(){OpenLayers.Element.addClass(document.body,"olDragDown"),this.documentEvents=!0,OpenLayers.Event.observe(document,"mousemove",this._docMove),OpenLayers.Event.observe(document,"mouseup",this._docUp)},removeDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown"),this.documentEvents=!1,OpenLayers.Event.stopObserving(document,"mousemove",this._docMove),OpenLayers.Event.stopObserving(document,"mouseup",this._docUp)},CLASS_NAME:"OpenLayers.Handler.Drag"}),OpenLayers.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:{w:180,h:90},layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:!1,handlers:null,resolutionFactor:1,maximized:!1,maximizeTitle:"",minimizeTitle:"",initialize:function(e){this.layers=[],this.handlers={},OpenLayers.Control.prototype.initialize.apply(this,[e])},destroy:function(){this.mapDiv&&(this.handlers.click&&this.handlers.click.destroy(),this.handlers.drag&&this.handlers.drag.destroy(),this.ovmap&&this.ovmap.viewPortDiv.removeChild(this.extentRectangle),this.extentRectangle=null,this.rectEvents&&(this.rectEvents.destroy(),this.rectEvents=null),this.ovmap&&(this.ovmap.destroy(),this.ovmap=null),this.element.removeChild(this.mapDiv),this.mapDiv=null,this.div.removeChild(this.element),this.element=null,this.maximizeDiv&&(this.div.removeChild(this.maximizeDiv),this.maximizeDiv=null),this.minimizeDiv&&(this.div.removeChild(this.minimizeDiv),this.minimizeDiv=null),this.map.events.un({buttonclick:this.onButtonClick,moveend:this.update,changebaselayer:this.baseLayerDraw,scope:this}),OpenLayers.Control.prototype.destroy.apply(this,arguments))},draw:function(){if(OpenLayers.Control.prototype.draw.apply(this,arguments),0===this.layers.length){if(!this.map.baseLayer)return this.map.events.register("changebaselayer",this,this.baseLayerDraw),this.div;var e=this.map.baseLayer.clone();this.layers=[e]}if(this.element=document.createElement("div"),this.element.className=this.displayClass+"Element",this.element.style.display="none",this.mapDiv=document.createElement("div"),this.mapDiv.style.width=this.size.w+"px",this.mapDiv.style.height=this.size.h+"px",this.mapDiv.style.position="relative",this.mapDiv.style.overflow="hidden",this.mapDiv.id=OpenLayers.Util.createUniqueID("overviewMap"),this.extentRectangle=document.createElement("div"),this.extentRectangle.style.position="absolute",this.extentRectangle.style.zIndex=1e3,this.extentRectangle.className=this.displayClass+"ExtentRectangle",this.element.appendChild(this.mapDiv),this.div.appendChild(this.element),this.outsideViewport)this.element.style.display="";else{this.div.className+=" "+this.displayClass+"Container";t=OpenLayers.Util.getImageLocation("layer-switcher-maximize.png");this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+"MaximizeButton",null,null,t,"absolute"),this.maximizeDiv.style.display="none",this.maximizeDiv.className=this.displayClass+"MaximizeButton olButton",this.maximizeTitle&&(this.maximizeDiv.title=this.maximizeTitle),this.div.appendChild(this.maximizeDiv);var t=OpenLayers.Util.getImageLocation("layer-switcher-minimize.png");this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_minimizeDiv",null,null,t,"absolute"),this.minimizeDiv.style.display="none",this.minimizeDiv.className=this.displayClass+"MinimizeButton olButton",this.minimizeTitle&&(this.minimizeDiv.title=this.minimizeTitle),this.div.appendChild(this.minimizeDiv),this.minimizeControl()}return this.map.getExtent()&&this.update(),this.map.events.on({buttonclick:this.onButtonClick,moveend:this.update,scope:this}),this.maximized&&this.maximizeControl(),this.div},baseLayerDraw:function(){this.draw(),this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectDrag:function(e){var t=this.handlers.drag.last.x-e.x,i=this.handlers.drag.last.y-e.y;if(0!=t||0!=i){var n=this.rectPxBounds.top,s=this.rectPxBounds.left,r=Math.abs(this.rectPxBounds.getHeight()),a=this.rectPxBounds.getWidth(),o=Math.max(0,n-i);o=Math.min(o,this.ovmap.size.h-this.hComp-r);var l=Math.max(0,s-t);l=Math.min(l,this.ovmap.size.w-this.wComp-a),this.setRectPxBounds(new OpenLayers.Bounds(l,o+r,l+a,o))}},mapDivClick:function(e){var t=this.rectPxBounds.getCenterPixel(),i=e.xy.x-t.x,n=e.xy.y-t.y,s=this.rectPxBounds.top,r=this.rectPxBounds.left,a=Math.abs(this.rectPxBounds.getHeight()),o=this.rectPxBounds.getWidth(),l=Math.max(0,s+n);l=Math.min(l,this.ovmap.size.h-a);var h=Math.max(0,r+i);h=Math.min(h,this.ovmap.size.w-o),this.setRectPxBounds(new OpenLayers.Bounds(h,l+a,h+o,l)),this.updateMapToRect()},onButtonClick:function(e){e.buttonElement===this.minimizeDiv?this.minimizeControl():e.buttonElement===this.maximizeDiv&&this.maximizeControl()},maximizeControl:function(e){this.element.style.display="",this.showToggle(!1),null!=e&&OpenLayers.Event.stop(e)},minimizeControl:function(e){this.element.style.display="none",this.showToggle(!0),null!=e&&OpenLayers.Event.stop(e)},showToggle:function(e){this.maximizeDiv&&(this.maximizeDiv.style.display=e?"":"none"),this.minimizeDiv&&(this.minimizeDiv.style.display=e?"none":"")},update:function(){null==this.ovmap&&this.createMap(),!this.autoPan&&this.isSuitableOverview()||this.updateOverview(),this.updateRectToMap()},isSuitableOverview:function(){var e=this.map.getExtent(),t=this.map.getMaxExtent(),i=new OpenLayers.Bounds(Math.max(e.left,t.left),Math.max(e.bottom,t.bottom),Math.min(e.right,t.right),Math.min(e.top,t.top));this.ovmap.getProjection()!=this.map.getProjection()&&(i=i.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()));var n=this.ovmap.getResolution()/this.map.getResolution();return n>this.minRatio&&n<=this.maxRatio&&this.ovmap.getExtent().containsBounds(i)},updateOverview:function(){var e=this.map.getResolution(),t=this.ovmap.getResolution(),i=t/e;i>this.maxRatio?t=this.minRatio*e:i<=this.minRatio&&(t=this.maxRatio*e);var n;this.ovmap.getProjection()!=this.map.getProjection()?(n=this.map.center.clone()).transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()):n=this.map.center,this.ovmap.setCenter(n,this.ovmap.getZoomForResolution(t*this.resolutionFactor)),this.updateRectToMap()},createMap:function(){var e=OpenLayers.Util.extend({controls:[],maxResolution:"auto",fallThrough:!1},this.mapOptions);if(this.ovmap=new OpenLayers.Map(this.mapDiv,e),this.ovmap.viewPortDiv.appendChild(this.extentRectangle),OpenLayers.Event.stopObserving(window,"unload",this.ovmap.unloadDestroy),this.ovmap.addLayers(this.layers),this.ovmap.zoomToMaxExtent(),this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width")),this.wComp=this.wComp?this.wComp:2,this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width")),this.hComp=this.hComp?this.hComp:2,this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap}),this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.mapDivClick},{single:!0,double:!1,stopSingle:!0,stopDouble:!0,pixelTolerance:1,map:this.ovmap}),this.handlers.click.activate(),this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,!0),this.rectEvents.register("mouseover",this,function(e){this.handlers.drag.active||this.map.dragging||this.handlers.drag.activate()}),this.rectEvents.register("mouseout",this,function(e){this.handlers.drag.dragging||this.handlers.drag.deactivate()}),this.ovmap.getProjection()!=this.map.getProjection()){var t=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units,i=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=t&&i?OpenLayers.INCHES_PER_UNIT[t]/OpenLayers.INCHES_PER_UNIT[i]:1}},updateRectToMap:function(){var e;e=this.ovmap.getProjection()!=this.map.getProjection()?this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()):this.map.getExtent();var t=this.getRectBoundsFromMapBounds(e);t&&this.setRectPxBounds(t)},updateMapToRect:function(){var e=this.getMapBoundsFromRectBounds(this.rectPxBounds);this.ovmap.getProjection()!=this.map.getProjection()&&(e=e.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject())),this.map.panTo(e.getCenterLonLat())},setRectPxBounds:function(e){var t=Math.max(e.top,0),i=Math.max(e.left,0),n=Math.min(e.top+Math.abs(e.getHeight()),this.ovmap.size.h-this.hComp),s=Math.min(e.left+e.getWidth(),this.ovmap.size.w-this.wComp),r=Math.max(s-i,0),a=Math.max(n-t,0);if(r=0){this.initResolutions(),t&&this.map.baseLayer===this&&(this.map.setCenter(this.map.getCenter(),this.map.getZoomForResolution(i),!1,!0),this.map.events.triggerEvent("changebaselayer",{layer:this}));break}}},onMapResize:function(){},redraw:function(){var e=!1;if(this.map){this.inRange=this.calculateInRange();var t=this.getExtent();if(t&&this.inRange&&this.visibility){this.moveTo(t,!0,!1),this.events.triggerEvent("moveend",{zoomChanged:!0}),e=!0}}return e},moveTo:function(e,t,i){var n=this.visibility;this.isBaseLayer||(n=n&&this.inRange),this.display(n)},moveByPx:function(e,t){},setMap:function(e){if(null==this.map){if(this.map=e,this.maxExtent=this.maxExtent||this.map.maxExtent,this.minExtent=this.minExtent||this.map.minExtent,this.projection=this.projection||this.map.projection,"string"==typeof this.projection&&(this.projection=new OpenLayers.Projection(this.projection)),this.units=this.projection.getUnits()||this.units||this.map.units,this.initResolutions(),!this.isBaseLayer){this.inRange=this.calculateInRange();var t=this.visibility&&this.inRange;this.div.style.display=t?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(e){},getImageSize:function(e){return this.imageSize||this.tileSize},setTileSize:function(e){var t=e||(this.tileSize?this.tileSize:this.map.getTileSize());this.tileSize=t,this.gutter&&(this.imageSize=new OpenLayers.Size(t.w+2*this.gutter,t.h+2*this.gutter))},getVisibility:function(){return this.visibility},setVisibility:function(e){e!=this.visibility&&(this.visibility=e,this.display(e),this.redraw(),null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"}),this.events.triggerEvent("visibilitychanged"))},display:function(e){e!=("none"!=this.div.style.display)&&(this.div.style.display=e&&this.calculateInRange()?"block":"none")},calculateInRange:function(){var e=!1;if(this.alwaysInRange)e=!0;else if(this.map){var t=this.map.getResolution();e=t>=this.minResolution&&t<=this.maxResolution}return e},setIsBaseLayer:function(e){e!=this.isBaseLayer&&(this.isBaseLayer=e,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var e,t,i,n={},s=!0;for(e=0,t=this.RESOLUTION_PROPERTIES.length;e=e&&(l=r,a=n),r<=e){h=r,o=n;break}var u=l-h;i=u>0?a+(l-e)/u:a}else{var p,c=Number.POSITIVE_INFINITY;for(n=0,s=this.resolutions.length;nc)break;c=p}else if(this.resolutions[n]0&&(e=e.substring(t));var i=OpenLayers.Util.Try(OpenLayers.Function.bind(function(){var t;return(t=window.ActiveXObject&&!this.xmldom?new ActiveXObject("Microsoft.XMLDOM"):this.xmldom).loadXML(e),t},this),function(){return(new DOMParser).parseFromString(e,"text/xml")},function(){var t=new XMLHttpRequest;return t.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(e),!1),t.overrideMimeType&&t.overrideMimeType("text/xml"),t.send(null),t.responseXML});return this.keepData&&(this.data=i),i},write:function(e){var t;if(this.xmldom)t=e.xml;else{var i=new XMLSerializer;if(1==e.nodeType){var n=document.implementation.createDocument("","",null);n.importNode&&(e=n.importNode(e,!0)),n.appendChild(e),t=i.serializeToString(n)}else t=i.serializeToString(e)}return t},createElementNS:function(e,t){return this.xmldom?"string"==typeof e?this.xmldom.createNode(1,t,e):this.xmldom.createNode(1,t,""):document.createElementNS(e,t)},createDocumentFragment:function(){return this.xmldom?this.xmldom.createDocumentFragment():document.createDocumentFragment()},createTextNode:function(e){return"string"!=typeof e&&(e=String(e)),this.xmldom?this.xmldom.createTextNode(e):document.createTextNode(e)},getElementsByTagNameNS:function(e,t,i){var n=[];if(e.getElementsByTagNameNS)n=e.getElementsByTagNameNS(t,i);else for(var s,r,a=e.getElementsByTagName("*"),o=0,l=a.length;o0?(n=e.substring(0,r),s=e.substring(r+1)):(n=i?this.namespaceAlias[i.namespaceURI]:this.defaultPrefix,s=e);var a=this.writers[n][s].apply(this,[t]);return i&&i.appendChild(a),a},getChildEl:function(e,t,i){return e&&this.getThisOrNextEl(e.firstChild,t,i)},getNextEl:function(e,t,i){return e&&this.getThisOrNextEl(e.nextSibling,t,i)},getThisOrNextEl:function(e,t,i){e:for(var n=e;n;n=n.nextSibling)switch(n.nodeType){case 1:if(!(t&&t!==(n.localName||n.nodeName.split(":").pop())||i&&i!==n.namespaceURI))break e;n=null;break e;case 3:if(/^\s*$/.test(n.nodeValue))break;case 4:case 6:case 12:case 10:case 11:n=null;break e}return n||null},lookupNamespaceURI:function(e,t){var i=null;if(e)if(e.lookupNamespaceURI)i=e.lookupNamespaceURI(t);else e:switch(e.nodeType){case 1:if(null!==e.namespaceURI&&e.prefix===t){i=e.namespaceURI;break e}var n=e.attributes.length;if(n)for(var s,r=0;r0){r=!0;for(var a=0,o=s.length;a0&&0==r&&(i.display="none"),null!=i.label&&"string"!=typeof i.label&&(i.label=String(i.label)),i},applySymbolizer:function(e,t,i){var n=i.geometry?this.getSymbolizerPrefix(i.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0],s=e.symbolizer[n]||e.symbolizer;if(!0===this.defaultsPerSymbolizer){var r=this.defaultStyle;OpenLayers.Util.applyDefaults(s,{pointRadius:r.pointRadius}),!0!==s.stroke&&!0!==s.graphic||OpenLayers.Util.applyDefaults(s,{strokeWidth:r.strokeWidth,strokeColor:r.strokeColor,strokeOpacity:r.strokeOpacity,strokeDashstyle:r.strokeDashstyle,strokeLinecap:r.strokeLinecap}),!0!==s.fill&&!0!==s.graphic||OpenLayers.Util.applyDefaults(s,{fillColor:r.fillColor,fillOpacity:r.fillOpacity}),!0===s.graphic&&OpenLayers.Util.applyDefaults(s,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset})}return this.createLiterals(OpenLayers.Util.extend(t,s),i)},createLiterals:function(e,t){var i=OpenLayers.Util.extend({},t.attributes||t.data);OpenLayers.Util.extend(i,this.context);for(var n in this.propertyStyles)e[n]=OpenLayers.Style.createLiteral(e[n],i,t,n);return e},findPropertyStyles:function(){var e={},t=this.defaultStyle;this.addPropertyStyles(e,t);for(var i,n,s=this.rules,r=0,a=s.length;rthis.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:i=n<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:i=n>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:i=n>=this.lowerBoundary&&n<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:i=new RegExp(this.value,"gi").test(n);break;case OpenLayers.Filter.Comparison.IS_NULL:i=null===n}return i},value2regex:function(e,t,i){if("."==e)throw new Error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");return e=e||"*",t=t||".",i=i||"!",this.value=this.value.replace(new RegExp("\\"+i+"(.|$)","g"),"\\$1"),this.value=this.value.replace(new RegExp("\\"+t,"g"),"."),this.value=this.value.replace(new RegExp("\\"+e,"g"),".*"),this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+e),this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+t),this.value},regex2value:function(){var e=this.value;return e=e.replace(/!/g,"!!"),e=e.replace(/(\\)?\\\./g,function(e,t){return t?e:"!."}),e=e.replace(/(\\)?\\\*/g,function(e,t){return t?e:"!*"}),e=e.replace(/\\\\/g,"\\"),e=e.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison,this)},CLASS_NAME:"OpenLayers.Filter.Comparison"}),OpenLayers.Filter.Comparison.EQUAL_TO="==",OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=",OpenLayers.Filter.Comparison.LESS_THAN="<",OpenLayers.Filter.Comparison.GREATER_THAN=">",OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=",OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=",OpenLayers.Filter.Comparison.BETWEEN="..",OpenLayers.Filter.Comparison.LIKE="~",OpenLayers.Filter.Comparison.IS_NULL="NULL",OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"}),OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"}),OpenLayers.Date={dateRegEx:/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,toISOString:function(){return"toISOString"in Date.prototype?function(e){return e.toISOString()}:function(e){return isNaN(e.getTime())?"Invalid Date":e.getUTCFullYear()+"-"+OpenLayers.Number.zeroPad(e.getUTCMonth()+1,2)+"-"+OpenLayers.Number.zeroPad(e.getUTCDate(),2)+"T"+OpenLayers.Number.zeroPad(e.getUTCHours(),2)+":"+OpenLayers.Number.zeroPad(e.getUTCMinutes(),2)+":"+OpenLayers.Number.zeroPad(e.getUTCSeconds(),2)+"."+OpenLayers.Number.zeroPad(e.getUTCMilliseconds(),3)+"Z"}}(),parse:function(e){var t,i=e.match(this.dateRegEx);if(i&&(i[1]||i[7])){var n=parseInt(i[1],10)||0,s=parseInt(i[2],10)-1||0,r=parseInt(i[3],10)||1;t=new Date(Date.UTC(n,s,r));var a=i[7];if(a){var o=parseInt(i[4],10),l=parseInt(i[5],10),h=parseFloat(i[6]),u=0|h,p=Math.round(1e3*(h-u));if(t.setUTCHours(o,l,u,p),"Z"!==a){var c=-1e3*(60*parseInt(a,10)*60+60*(parseInt(i[8],10)||0));t=new Date(t.getTime()+c)}}}else t=new Date("invalid");return t}},OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(e){OpenLayers.Format.XML.prototype.initialize.apply(this,[e])},read:function(e){var t={};return this.readers.ogc.Filter.apply(this,[e,t]),t.filter},readers:{ogc:{_expression:function(e){for(var t,i="",n=e.firstChild;n;n=n.nextSibling)switch(n.nodeType){case 1:(t=this.readNode(n)).property?i+="${"+t.property+"}":void 0!==t.value&&(i+=t.value);break;case 3:case 4:i+=n.nodeValue}return i},Filter:function(e,t){var i={fids:[],filters:[]};this.readChildNodes(e,i),i.fids.length>0?t.filter=new OpenLayers.Filter.FeatureId({fids:i.fids}):i.filters.length>0&&(t.filter=i.filters[0])},FeatureId:function(e,t){var i=e.getAttribute("fid");i&&t.fids.push(i)},And:function(e,t){var i=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});this.readChildNodes(e,i),t.filters.push(i)},Or:function(e,t){var i=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR});this.readChildNodes(e,i),t.filters.push(i)},Not:function(e,t){var i=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.NOT});this.readChildNodes(e,i),t.filters.push(i)},PropertyIsLessThan:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN});this.readChildNodes(e,i),t.filters.push(i)},PropertyIsGreaterThan:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN});this.readChildNodes(e,i),t.filters.push(i)},PropertyIsLessThanOrEqualTo:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO});this.readChildNodes(e,i),t.filters.push(i)},PropertyIsGreaterThanOrEqualTo:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO});this.readChildNodes(e,i),t.filters.push(i)},PropertyIsBetween:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.BETWEEN});this.readChildNodes(e,i),t.filters.push(i)},Literal:function(e,t){t.value=OpenLayers.String.numericIf(this.getChildValue(e),!0)},PropertyName:function(e,t){t.property=this.getChildValue(e)},LowerBoundary:function(e,t){t.lowerBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,e),!0)},UpperBoundary:function(e,t){t.upperBoundary=OpenLayers.String.numericIf(this.readers.ogc._expression.call(this,e),!0)},Intersects:function(e,t){this.readSpatial(e,t,OpenLayers.Filter.Spatial.INTERSECTS)},Within:function(e,t){this.readSpatial(e,t,OpenLayers.Filter.Spatial.WITHIN)},Contains:function(e,t){this.readSpatial(e,t,OpenLayers.Filter.Spatial.CONTAINS)},DWithin:function(e,t){this.readSpatial(e,t,OpenLayers.Filter.Spatial.DWITHIN)},Distance:function(e,t){t.distance=parseInt(this.getChildValue(e)),t.distanceUnits=e.getAttribute("units")},Function:function(e,t){},PropertyIsNull:function(e,t){var i=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.IS_NULL});this.readChildNodes(e,i),t.filters.push(i)}}},readSpatial:function(e,t,i){var n=new OpenLayers.Filter.Spatial({type:i});this.readChildNodes(e,n),n.value=n.components[0],delete n.components,t.filters.push(n)},encodeLiteral:function(e){return e instanceof Date&&(e=OpenLayers.Date.toISOString(e)),e},writeOgcExpression:function(e,t){return e instanceof OpenLayers.Filter.Function?this.writeNode("Function",e,t):this.writeNode("Literal",e,t),t},write:function(e){return this.writers.ogc.Filter.apply(this,[e])},writers:{ogc:{Filter:function(e){var t=this.createElementNSPlus("ogc:Filter");return this.writeNode(this.getFilterType(e),e,t),t},_featureIds:function(e){for(var t=this.createDocumentFragment(),i=0,n=e.fids.length;i":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike",NULL:"PropertyIsNull",BBOX:"BBOX",DWITHIN:"DWITHIN",WITHIN:"WITHIN",CONTAINS:"CONTAINS",INTERSECTS:"INTERSECTS",FID:"_featureIds"},CLASS_NAME:"OpenLayers.Format.Filter.v1"}),OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.id=null,this.bounds=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(e){e&&(this.bounds=e.clone())},clearBounds:function(){this.bounds=null,this.parent&&this.parent.clearBounds()},extendBounds:function(e){this.getBounds()?this.bounds.extend(e):this.setBounds(e)},getBounds:function(){return null==this.bounds&&this.calculateBounds(),this.bounds},calculateBounds:function(){},distanceTo:function(e,t){},getVertices:function(e){},atPoint:function(e,t,i){var n=!1;if(null!=this.getBounds()&&null!=e){var s=null!=t?t:0,r=null!=i?i:0;n=new OpenLayers.Bounds(this.bounds.left-s,this.bounds.bottom-r,this.bounds.right+s,this.bounds.top+r).containsLonLat(e)}return n},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.WKT?OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this)):Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Geometry"}),OpenLayers.Geometry.fromWKT=function(e){var t;if(OpenLayers.Format&&OpenLayers.Format.WKT){var i=OpenLayers.Geometry.fromWKT.format;i||(i=new OpenLayers.Format.WKT,OpenLayers.Geometry.fromWKT.format=i);var n=i.read(e);if(n instanceof OpenLayers.Feature.Vector)t=n.geometry;else if(OpenLayers.Util.isArray(n)){for(var s=n.length,r=new Array(s),a=0;a=0&&m<=1&&y>=0&&y<=1)if(n){var g=e.x1+m*l,v=e.y1+m*h;r=new OpenLayers.Geometry.Point(g,v)}else r=!0}if(s){if(r){if(n){var L,O=[e,t];e:for(C=0;C<2;++C){L=O[C];for(x=1;x<3;++x)if(g=L["x"+x],v=L["y"+x],Math.sqrt(Math.pow(g-r.x,2)+Math.pow(v-r.y,2))=1?(i=l,n=h):(i=a+c*u,n=o+c*p),{distance:Math.pow(i-s,2)+Math.pow(n-r,2),x:i,y:n,along:c}},OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(e,t){OpenLayers.Geometry.prototype.initialize.apply(this,arguments),this.x=parseFloat(e),this.y=parseFloat(t)},clone:function(e){return null==e&&(e=new OpenLayers.Geometry.Point(this.x,this.y)),OpenLayers.Util.applyDefaults(e,this),e},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(e,t){var i,n,s,r,a,o,l=!(t&&!1===t.edge)&&t&&t.details;return e instanceof OpenLayers.Geometry.Point?(n=this.x,s=this.y,r=e.x,a=e.y,i=Math.sqrt(Math.pow(n-r,2)+Math.pow(s-a,2)),o=l?{x0:n,y0:s,x1:r,y1:a,distance:i}:i):(o=e.distanceTo(this,t),l&&(o={x0:o.x1,y0:o.y1,x1:o.x0,y1:o.y0,distance:o.distance})),o},equals:function(e){var t=!1;return null!=e&&(t=this.x==e.x&&this.y==e.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(e.x)&&isNaN(e.y)),t},toShortString:function(){return this.x+", "+this.y},move:function(e,t){this.x=this.x+e,this.y=this.y+t,this.clearBounds()},rotate:function(e,t){e*=Math.PI/180;var i=this.distanceTo(t),n=e+Math.atan2(this.y-t.y,this.x-t.x);this.x=t.x+i*Math.cos(n),this.y=t.y+i*Math.sin(n),this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(e,t,i){return i=void 0==i?1:i,this.x=t.x+e*i*(this.x-t.x),this.y=t.y+e*(this.y-t.y),this.clearBounds(),this},intersects:function(e){return"OpenLayers.Geometry.Point"==e.CLASS_NAME?this.equals(e):e.intersects(this)},transform:function(e,t){return e&&t&&(OpenLayers.Projection.transform(this,e,t),this.bounds=null),this},getVertices:function(e){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"}),OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(e){OpenLayers.Geometry.prototype.initialize.apply(this,arguments),this.components=[],null!=e&&this.addComponents(e)},destroy:function(){this.components.length=0,this.components=null,OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var geometry=eval("new "+this.CLASS_NAME+"()"),i=0,len=this.components.length;i-1)){if(null!=t&&t=0;--i)t=this.removeComponent(e[i])||t;return t},removeComponent:function(e){return OpenLayers.Util.removeItem(this.components,e),this.clearBounds(),!0},getLength:function(){for(var e=0,t=0,i=this.components.length;t0?l:a,s.push(h))}if(t=n.length,0===r){for(o=0;o1)for(var t=1,i=this.components.length;t1)for(var s,r,a=1,o=t.components.length;a2;return t&&OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments),t},intersects:function(e){var t=!1,i=e.CLASS_NAME;if("OpenLayers.Geometry.LineString"==i||"OpenLayers.Geometry.LinearRing"==i||"OpenLayers.Geometry.Point"==i){var n,s=this.getSortedSegments();n="OpenLayers.Geometry.Point"==i?[{x1:e.x,y1:e.y,x2:e.x,y2:e.y}]:e.getSortedSegments();var r,a,o,l,h,u,p,c;e:for(var d=0,f=s.length;do);++m)if(!(u.x2Math.max(l,h))&&!(Math.max(p,c)0){var g=e.x10&&(c.unshift(v,1),Array.prototype.splice.apply(r,c),v+=c.length-2),o))for(var L=0,O=p.points.length;L0&&m.length>0&&(m.push(h.clone()),s.push(new OpenLayers.Geometry.LineString(m)))}else a=e.splitWith(this,t);return r&&r.length>1?n=!0:r=[],s&&s.length>1?i=!0:s=[],(n||i)&&(a=o?[s,r]:r),a},splitWith:function(e,t){return e.split(this,t)},getVertices:function(e){return!0===e?[this.components[0],this.components[this.components.length-1]]:!1===e?this.components.slice(1,this.components.length-1):this.components.slice()},distanceTo:function(e,t){var i,n=!(t&&!1===t.edge)&&t&&t.details,s={},r=Number.POSITIVE_INFINITY;if(e instanceof OpenLayers.Geometry.Point){for(var a,o=this.getSortedSegments(),l=e.x,h=e.y,u=0,p=o.length;ul&&(h>a.y1&&ha.y2))break;s=n?{distance:s.distance,x0:s.x,y0:s.y,x1:l,y1:h}:s.distance}else if(e instanceof OpenLayers.Geometry.LineString){var c,d,f,m,y,g=this.getSortedSegments(),v=e.getSortedSegments(),L=v.length,O={point:!0};e:for(var u=0,p=g.length;ul&&(l=o,h=u);l>r&&h!=t&&(a.push(h),n(e,t,h,r),n(e,h,i,r))},s=function(e,t,i){return Math.abs(.5*(e.x*t.y+t.x*i.y+i.x*e.y-t.x*e.y-i.x*t.y-e.x*i.y))/Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))*2},r=t.length-1,a=[];for(a.push(0),a.push(r);t[0].equals(t[r]);)r--,a.push(r);n(t,0,r,e);var o=[];a.sort(i);for(var l=0;l1?r=!0:h=[],u&&u.length>1?a=!0:u=[],(r||a)&&(o=l?[h,u]:u),o},splitWith:function(e,t){var i,n,s,r,a,o,l,h=null,u=t&&t.mutual;if(e instanceof OpenLayers.Geometry.LineString){l=[],o=[e];for(var p=0,c=this.components.length;p1?r=!0:o=[],l&&l.length>1?a=!0:l=[],(r||a)&&(h=u?[o,l]:l),h},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"}),OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],addComponent:function(e,t){var i=!1,n=this.components.pop();null==t&&e.equals(n)||(i=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments));var s=this.components[0];return OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[s]),i},removeComponent:function(e){var t=this.components&&this.components.length>3;if(t){this.components.pop(),OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var i=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[i])}return t},move:function(e,t){for(var i=0,n=this.components.length;i0&&e<=2)return this.components[0].clone();if(e>2){var t=0,i=0,n=this.components[0].x,s=this.components[0].y,r=-1*this.getArea();if(0!=r){for(u=0;u2){for(var t=0,i=0,n=this.components.length;i2){for(var r,a,o=0;o=s&&u<=a||s>a&&u<=s&&u>=a)){c=-1;break}o<=h||n!=r&&(oMath.max(n,r))||(s=s&&ua&&u=a)&&++c}else if(u==s&&(n<=r&&h>=n&&h<=r||n>=r&&h<=n&&h>=r)){c=-1;break}return-1==c?1:!!(1&c)},intersects:function(e){var t=!1;if("OpenLayers.Geometry.Point"==e.CLASS_NAME)t=this.containsPoint(e);else if("OpenLayers.Geometry.LineString"==e.CLASS_NAME)t=e.intersects(this);else if("OpenLayers.Geometry.LinearRing"==e.CLASS_NAME)t=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[e]);else for(var i=0,n=e.components.length;i0){e+=Math.abs(this.components[0].getArea());for(var t=1,i=this.components.length;t0){t+=Math.abs(this.components[0].getGeodesicArea(e));for(var i=1,n=this.components.length;i0&&1!==(i=this.components[0].containsPoint(e))&&i&&t>1)for(var n,s=1;s0){if(!(s=this.parseGeometry[t.toLowerCase()]))throw new TypeError("Unsupported geometry type: "+t);n=s.apply(this,[i[0]]),this.internalProjection&&this.externalProjection&&n.transform(this.externalProjection,this.internalProjection);break}var o,l=this.getElementsByTagNameNS(e,this.gmlns,"Box");for(a=0;a0&&(i=t[0].firstChild.nodeValue.replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace)),0==i.length&&(t=this.getElementsByTagNameNS(e,this.gmlns,"coordinates")).length>0&&(i=t[0].firstChild.nodeValue.replace(this.regExes.removeSpace,"").split(",")),0==i.length&&(t=this.getElementsByTagNameNS(e,this.gmlns,"coord")).length>0){var n=this.getElementsByTagNameNS(t[0],this.gmlns,"X"),s=this.getElementsByTagNameNS(t[0],this.gmlns,"Y");n.length>0&&s.length>0&&(i=[n[0].firstChild.nodeValue,s[0].firstChild.nodeValue])}return 2==i.length&&(i[2]=null),this.xy?new OpenLayers.Geometry.Point(i[0],i[1],i[2]):new OpenLayers.Geometry.Point(i[1],i[0],i[2])},multipoint:function(e){var t=this.getElementsByTagNameNS(e,this.gmlns,"Point"),i=[];if(t.length>0)for(var n,s=0;s0){s=(n=(n=this.getChildValue(i[0])).replace(this.regExes.trimSpace,"")).split(this.regExes.splitSpace);for(var a,o,l,h,u=parseInt(i[0].getAttribute("dimension")),p=0;p0)for(var c=(n=(n=(n=this.getChildValue(i[0])).replace(this.regExes.trimSpace,"")).replace(this.regExes.trimComma,",")).split(this.regExes.splitSpace),p=0;p0)for(var n,s=0;s0)for(var n,s=0;s0)for(var n,s=0;s0){a=[];if(n.length>0&&(a=n[0].firstChild.nodeValue.replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace)),2==a.length&&(a[2]=null),this.xy)s=new OpenLayers.Geometry.Point(a[0],a[1],a[2]);else var s=new OpenLayers.Geometry.Point(a[1],a[0],a[2])}var r=this.getElementsByTagNameNS(e,this.gmlns,"upperCorner");if(r.length>0){var a=[];if(r.length>0&&(a=r[0].firstChild.nodeValue.replace(this.regExes.trimSpace,"").split(this.regExes.splitSpace)),2==a.length&&(a[2]=null),this.xy)o=new OpenLayers.Geometry.Point(a[0],a[1],a[2]);else var o=new OpenLayers.Geometry.Point(a[1],a[0],a[2])}if(s&&o){i.push(new OpenLayers.Geometry.Point(s.x,s.y)),i.push(new OpenLayers.Geometry.Point(o.x,s.y)),i.push(new OpenLayers.Geometry.Point(o.x,o.y)),i.push(new OpenLayers.Geometry.Point(s.x,o.y)),i.push(new OpenLayers.Geometry.Point(s.x,s.y));var l=new OpenLayers.Geometry.LinearRing(i);t=new OpenLayers.Geometry.Polygon([l])}return t},box:function(e){var t,i=this.getElementsByTagNameNS(e,this.gmlns,"coordinates"),n=null,s=null;if(i.length>0&&2==(t=i[0].firstChild.nodeValue.split(" ")).length&&(n=t[0].split(","),s=t[1].split(",")),null!==n&&null!==s)return new OpenLayers.Bounds(parseFloat(n[0]),parseFloat(n[1]),parseFloat(s[0]),parseFloat(s[1]))}},parseAttributes:function(e){for(var t,i,n,s,r,a,o,l={},h=e.firstChild;h;){if(1==h.nodeType){for(t=h.childNodes,i=0;i0&&(t.bounds=i.components[0])},Point:function(e,t){var i={points:[]};this.readChildNodes(e,i),t.components||(t.components=[]),t.components.push(i.points[0])},coordinates:function(e,t){for(var i,n=this.getChildValue(e).replace(this.regExes.trimSpace,""),s=(n=n.replace(this.regExes.trimComma,",")).split(this.regExes.splitSpace),r=s.length,a=new Array(r),o=0;o0&&(t.components=[new OpenLayers.Geometry.MultiLineString(i.components)])},curveMember:function(e,t){this.readChildNodes(e,t)},MultiSurface:function(e,t){var i={components:[]};this.readers.gml._inherit.apply(this,[e,i,t]),this.readChildNodes(e,i),i.components.length>0&&(t.components=[new OpenLayers.Geometry.MultiPolygon(i.components)])},surfaceMember:function(e,t){this.readChildNodes(e,t)},surfaceMembers:function(e,t){this.readChildNodes(e,t)},pointMembers:function(e,t){this.readChildNodes(e,t)},lineStringMembers:function(e,t){this.readChildNodes(e,t)},polygonMembers:function(e,t){this.readChildNodes(e,t)},geometryMembers:function(e,t){this.readChildNodes(e,t)},Envelope:function(e,t){var i={points:new Array(2)};this.readChildNodes(e,i),t.components||(t.components=[]);var n=i.points[0],s=i.points[1];t.components.push(new OpenLayers.Bounds(n.x,n.y,s.x,s.y))},lowerCorner:function(e,t){var i={};this.readers.gml.pos.apply(this,[e,i]),t.points[0]=i.points[0]},upperCorner:function(e,t){var i={};this.readers.gml.pos.apply(this,[e,i]),t.points[1]=i.points[0]}},OpenLayers.Format.GML.Base.prototype.readers.gml),feature:OpenLayers.Format.GML.Base.prototype.readers.feature,wfs:OpenLayers.Format.GML.Base.prototype.readers.wfs},write:function(e){var t;t=OpenLayers.Util.isArray(e)?"featureMembers":"featureMember";var i=this.writeNode("gml:"+t,e);return this.setAttributeNS(i,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation),OpenLayers.Format.XML.prototype.write.apply(this,[i])},writers:{gml:OpenLayers.Util.applyDefaults({featureMembers:function(e){for(var t=this.createElementNSPlus("gml:featureMembers"),i=0,n=e.length;i0},CLASS_NAME:"OpenLayers.Protocol.Response"}),OpenLayers.Protocol.Response.SUCCESS=1,OpenLayers.Protocol.Response.FAILURE=0,OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:" ",space:" ",newline:"\n",level:0,pretty:!1,nativeJSON:function(){return!(!window.JSON||"function"!=typeof JSON.parse||"function"!=typeof JSON.stringify)}(),read:function(json,filter){function walk(e,t){if(t&&"object"==typeof t)for(var i in t)t.hasOwnProperty(i)&&(t[i]=walk(i,t[i]));return filter(e,t)}var object;if(this.nativeJSON)object=JSON.parse(json,filter);else try{/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))&&(object=eval("("+json+")"),"function"==typeof filter&&(object=walk("",object)))}catch(e){}return this.keepData&&(this.data=object),object},write:function(e,t){this.pretty=!!t;var i=null,n=typeof e;if(this.serialize[n])try{i=!this.pretty&&this.nativeJSON?JSON.stringify(e):this.serialize[n].apply(this,[e])}catch(e){OpenLayers.Console.error("Trouble serializing: "+e)}return i},writeIndent:function(){var e=[];if(this.pretty)for(var t=0;t0&&i.push(","),i.push(this.writeNewline(),this.writeIndent(),t));return this.level-=1,i.push(this.writeNewline(),this.writeIndent(),"]"),i.join("")},string:function(e){var t={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(e)?'"'+e.replace(/([\x00-\x1f\\"])/g,function(e,i){var n=t[i];return n||(n=i.charCodeAt(),"\\u00"+Math.floor(n/16).toString(16)+(n%16).toString(16))})+'"':'"'+e+'"'},number:function(e){return isFinite(e)?String(e):"null"},boolean:function(e){return String(e)},date:function(e){function t(e){return e<10?"0"+e:e}return'"'+e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"}),OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:!1,read:function(e,t,i){t=t||"FeatureCollection";var n=null,s=null;if(s="string"==typeof e?OpenLayers.Format.JSON.prototype.read.apply(this,[e,i]):e){if("string"!=typeof s.type)OpenLayers.Console.error("Bad GeoJSON - no type: "+e);else if(this.isValidType(s,t))switch(t){case"Geometry":try{n=this.parseGeometry(s)}catch(e){OpenLayers.Console.error(e)}break;case"Feature":try{(n=this.parseFeature(s)).type="Feature"}catch(e){OpenLayers.Console.error(e)}break;case"FeatureCollection":switch(n=[],s.type){case"Feature":try{n.push(this.parseFeature(s))}catch(e){n=null,OpenLayers.Console.error(e)}break;case"FeatureCollection":for(var r=0,a=s.features.length;r>1):s>>1}return t},encodeUnsignedIntegers:function(e){for(var t="",i=e.length,n=0;n>1):t>>1},encodeUnsignedInteger:function(e){for(var t,i="";e>=32;)t=63+(32|31&e),i+=String.fromCharCode(t),e>>=5;return t=e+63,i+=String.fromCharCode(t)},decodeUnsignedInteger:function(e){for(var t=0,i=0,n=e.length,s=0;s=0;t--)(e=this.controls[t]).events&&e.events.un({activate:this.iconOn,deactivate:this.iconOff}),e.panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var e,t=0,i=this.controls.length;t=0;e--)this.div.removeChild(this.div.childNodes[e]);if(this.div.innerHTML="",this.active)for(var e=0,t=this.controls.length;e=0;--n)if(t[n].panel_div===i){this.activateControl(t[n]);break}},getControlsBy:function(e,t){var i="function"==typeof t.test;return OpenLayers.Array.filter(this.controls,function(n){return n[e]==t||i&&t.test(n[e])})},getControlsByName:function(e){return this.getControlsBy("name",e)},getControlsByClass:function(e){return this.getControlsBy("CLASS_NAME",e)},CLASS_NAME:"OpenLayers.Control.Panel"}),OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"}),OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control.Button,{trigger:function(){this.map&&this.map.zoomIn()},CLASS_NAME:"OpenLayers.Control.ZoomIn"}),OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control.Button,{trigger:function(){this.map&&this.map.zoomOut()},CLASS_NAME:"OpenLayers.Control.ZoomOut"}),OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control.Button,{trigger:function(){this.map&&this.map.zoomToMaxExtent()},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"}),OpenLayers.Control.ZoomPanel=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(e){OpenLayers.Control.Panel.prototype.initialize.apply(this,[e]),this.addControls([new OpenLayers.Control.ZoomIn,new OpenLayers.Control.ZoomToMaxExtent,new OpenLayers.Control.ZoomOut])},CLASS_NAME:"OpenLayers.Control.ZoomPanel"}),OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:!1,initialize:function(e,t,i,n){OpenLayers.Layer.prototype.initialize.apply(this,[e,n]),this.url=t,this.params||(this.params=OpenLayers.Util.extend({},i))},destroy:function(){this.url=null,this.params=null,OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(e){return null==e&&(e=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions())),e=OpenLayers.Layer.prototype.clone.apply(this,[e])},setUrl:function(e){this.url=e},mergeNewParams:function(e){this.params=OpenLayers.Util.extend(this.params,e);var t=this.redraw();return null!=this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"params"}),t},redraw:function(e){return e?this.mergeNewParams({_olSalt:Math.random()}):OpenLayers.Layer.prototype.redraw.apply(this,[])},selectUrl:function(e,t){for(var i=1,n=0,s=e.length;n=0&&m=0&&(s=this.serverResolutions[i],!((n=Math.abs(s-e))>t));i--)t=n,r=s;e=r}return e},getServerZoom:function(){var e=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,e):this.map.getZoomForResolution(e)+(this.zoomOffset||0)},applyBackBuffer:function(e){null!==this.backBufferTimerId&&this.removeBackBuffer();var t=this.backBuffer;if(!t){if(!(t=this.createBackBuffer()))return;e===this.gridResolution?this.div.insertBefore(t,this.div.firstChild):this.map.baseLayer.div.parentNode.insertBefore(t,this.map.baseLayer.div),this.backBuffer=t;var i=this.grid[0][0].bounds;this.backBufferLonLat={lon:i.left,lat:i.top},this.backBufferResolution=this.gridResolution}for(var n,s=this.backBufferResolution/e,r=t.childNodes,a=r.length-1;a>=0;--a)(n=r[a]).style.top=(s*n._i*n._h|0)+"px",n.style.left=(s*n._j*n._w|0)+"px",n.style.width=Math.round(s*n._w)+"px",n.style.height=Math.round(s*n._h)+"px";var o=this.getViewPortPxFromLonLat(this.backBufferLonLat,e),l=this.map.layerContainerOriginPx.x,h=this.map.layerContainerOriginPx.y;t.style.left=Math.round(o.x-l)+"px",t.style.top=Math.round(o.y-h)+"px"},createBackBuffer:function(){var e;if(this.grid.length>0){(e=document.createElement("div")).id=this.div.id+"_bb",e.className="olBackBuffer",e.style.position="absolute";var t=this.map;e.style.zIndex="resize"===this.transitionEffect?this.getZIndex()-1:t.Z_INDEX_BASE.BaseLayer-(t.getNumLayers()-t.getLayerIndex(this));for(var i=0,n=this.grid.length;i=0;--e)OpenLayers.Event.stopObserving(this._transitionElement,this.transitionendEvents[e],this._removeBackBuffer);delete this._transitionElement}this.backBuffer&&(this.backBuffer.parentNode&&this.backBuffer.parentNode.removeChild(this.backBuffer),this.backBuffer=null,this.backBufferResolution=null,null!==this.backBufferTimerId&&(window.clearTimeout(this.backBufferTimerId),this.backBufferTimerId=null))},moveByPx:function(e,t){this.singleTile||this.moveGriddedTiles()},setTileSize:function(e){this.singleTile&&((e=this.map.getSize()).h=parseInt(e.h*this.ratio,10),e.w=parseInt(e.w*this.ratio,10)),OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[e])},getTilesBounds:function(){var e=null,t=this.grid.length;if(t){var i=this.grid[t-1][0].bounds,n=this.grid[0].length*i.getWidth(),s=this.grid.length*i.getHeight();e=new OpenLayers.Bounds(i.left,i.bottom,i.left+n,i.bottom+s)}return e},initSingleTile:function(e){this.events.triggerEvent("retile");var t=e.getCenterLonLat(),i=e.getWidth()*this.ratio,n=e.getHeight()*this.ratio,s=new OpenLayers.Bounds(t.lon-i/2,t.lat-n/2,t.lon+i/2,t.lat+n/2),r=this.map.getLayerPxFromLonLat({lon:s.left,lat:s.top});this.grid.length||(this.grid[0]=[]);var a=this.grid[0][0];a?a.moveTo(s,r):(a=this.addTile(s,r),this.addTileMonitoringHooks(a),a.draw(),this.grid[0][0]=a),this.removeExcessTiles(1,1),this.gridResolution=this.getServerResolution()},calculateGridLayout:function(e,t,i){var n=i*this.tileSize.w,s=i*this.tileSize.h,r=e.left-t.lon,a=Math.floor(r/n)-this.buffer,o=this.rowSign,l=o*(t.lat-e.top+s);return{tilelon:n,tilelat:s,startcol:a,startrow:Math[~o?"floor":"ceil"](l/s)-this.buffer*o}},getTileOrigin:function(){var e=this.tileOrigin;if(!e){var t=this.getMaxExtent(),i={tl:["left","top"],tr:["right","top"],bl:["left","bottom"],br:["right","bottom"]}[this.tileOriginCorner];e=new OpenLayers.LonLat(t[i[0]],t[i[1]])}return e},getTileBoundsForGridIndex:function(e,t){var i=this.getTileOrigin(),n=this.gridLayout,s=n.tilelon,r=n.tilelat,a=n.startcol,o=n.startrow,l=this.rowSign;return new OpenLayers.Bounds(i.lon+(a+t)*s,i.lat-(o+e*l)*r*l,i.lon+(a+t+1)*s,i.lat-(o+(e-1)*l)*r*l)},initGriddedTiles:function(e){this.events.triggerEvent("retile");var t=this.map.getSize(),i=this.getTileOrigin(),n=this.map.getResolution(),s=this.getServerResolution(),r=n/s,a={w:this.tileSize.w/r,h:this.tileSize.h/r},o=Math.ceil(t.h/a.h)+2*this.buffer+1,l=Math.ceil(t.w/a.w)+2*this.buffer+1,h=this.calculateGridLayout(e,i,s);this.gridLayout=h;var u=h.tilelon,p=h.tilelat,c=this.map.layerContainerOriginPx.x,d=this.map.layerContainerOriginPx.y,f=this.getTileBoundsForGridIndex(0,0),m=this.map.getViewPortPxFromLonLat(new OpenLayers.LonLat(f.left,f.top));m.x=Math.round(m.x)-c,m.y=Math.round(m.y)-d;var y=[],g=this.map.getCenter(),v=0;do{var L=this.grid[v];L||(L=[],this.grid.push(L));var O=0;do{f=this.getTileBoundsForGridIndex(v,O);var b=m.clone();b.x=b.x+O*Math.round(a.w),b.y=b.y+v*Math.round(a.h);var w=L[O];w?w.moveTo(f,b,!1):(w=this.addTile(f,b),this.addTileMonitoringHooks(w),L.push(w));var S=f.getCenterLonLat();y.push({tile:w,distance:Math.pow(S.lon-g.lon,2)+Math.pow(S.lat-g.lat,2)}),O+=1}while(f.right<=e.right+u*this.buffer||O=e.bottom-p*this.buffer||v=0;--a)OpenLayers.Event.observe(this._transitionElement,r[a],this._removeBackBuffer);this.backBufferTimerId=window.setTimeout(this._removeBackBuffer,this.removeBackBufferDelay)}this.loading=!1,this.events.triggerEvent("loadend")}},e.onLoadError=function(){this.events.triggerEvent("tileerror",{tile:e})},e.events.on({loadstart:e.onLoadStart,loadend:e.onLoadEnd,unload:e.onLoadEnd,loaderror:e.onLoadError,scope:this})},removeTileMonitoringHooks:function(e){e.unload(),e.events.un({loadstart:e.onLoadStart,loadend:e.onLoadEnd,unload:e.onLoadEnd,loaderror:e.onLoadError,scope:this})},moveGriddedTiles:function(){for(var e=this.buffer+1;;){var t=this.grid[0][0],i={x:t.position.x+this.map.layerContainerOriginPx.x,y:t.position.y+this.map.layerContainerOriginPx.y},n=this.getServerResolution()/this.map.getResolution(),s={w:Math.round(this.tileSize.w*n),h:Math.round(this.tileSize.h*n)};if(i.x>-s.w*(e-1))this.shiftColumn(!0,s);else if(i.x<-s.w*e)this.shiftColumn(!1,s);else if(i.y>-s.h*(e-1))this.shiftRow(!0,s);else{if(!(i.y<-s.h*e))break;this.shiftRow(!1,s)}}},shiftRow:function(e,t){var i=this.grid,n=e?0:i.length-1,s=e?-1:1,r=this.rowSign;this.gridLayout.startrow+=s*r;for(var a=i[n],o=i[e?"pop":"shift"](),l=0,h=o.length;le;)for(i=0,n=(s=this.grid.pop()).length;it;){var s=this.grid[i],r=s.pop();this.destroyTile(r)}},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(e){var t=this.maxExtent,i=this.getResolution(),n=i*this.tileSize.w,s=i*this.tileSize.h,r=this.getLonLatFromViewPortPx(e),a=t.left+n*Math.floor((r.lon-t.left)/n),o=t.bottom+s*Math.floor((r.lat-t.bottom)/s);return new OpenLayers.Bounds(a,o,a+n,o+s)},CLASS_NAME:"OpenLayers.Layer.Grid"}),OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:["antialiasing","blockout","font","fontcolor","fontsize","fontstyle","glowing","interval","outline","printmode","shadow","transparency"],request:null,response:null,initialize:function(e){if(this.request=new OpenLayers.Format.ArcXML.Request,this.response=new OpenLayers.Format.ArcXML.Response,e)if("feature"==e.requesttype){this.request.get_image=null;var t=this.request.get_feature.query;this.addCoordSys(t.featurecoordsys,e.featureCoordSys),this.addCoordSys(t.filtercoordsys,e.filterCoordSys),e.polygon?(t.isspatial=!0,t.spatialfilter.polygon=e.polygon):e.envelope&&(t.isspatial=!0,t.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0},this.parseEnvelope(t.spatialfilter.envelope,e.envelope))}else if("image"==e.requesttype){this.request.get_feature=null;var i=this.request.get_image.properties;this.parseEnvelope(i.envelope,e.envelope),this.addLayers(i.layerlist,e.layers),this.addImageSize(i.imagesize,e.tileSize),this.addCoordSys(i.featurecoordsys,e.featureCoordSys),this.addCoordSys(i.filtercoordsys,e.filterCoordSys)}else this.request=null;OpenLayers.Format.XML.prototype.initialize.apply(this,[e])},parseEnvelope:function(e,t){t&&4==t.length&&(e.minx=t[0],e.miny=t[1],e.maxx=t[2],e.maxy=t[3])},addLayers:function(e,t){for(var i=0,n=t.length;i0}else t=""!==this.response.error;return t},read:function(e){"string"==typeof e&&(e=OpenLayers.Format.XML.prototype.read.apply(this,[e]));var t=null;if(e&&e.documentElement&&(t="ARCXML"==e.documentElement.nodeName?e.documentElement:e.documentElement.getElementsByTagName("ARCXML")[0]),!t||"parsererror"===t.firstChild.nodeName){var i,n;try{i=e.firstChild.nodeValue,n=e.firstChild.childNodes[1].firstChild.nodeValue}catch(e){}throw{message:"Error parsing the ArcXML request",error:i,source:n}}return this.parseResponse(t)},write:function(e){e||(e=this.request);var t=this.createElementNS("","ARCXML");t.setAttribute("version","1.1");var i=this.createElementNS("","REQUEST");if(null!=e.get_image){var n=this.createElementNS("","GET_IMAGE");i.appendChild(n);var s=this.createElementNS("","PROPERTIES");n.appendChild(s);var r=e.get_image.properties;if(null!=r.featurecoordsys){var a=this.createElementNS("","FEATURECOORDSYS");s.appendChild(a),0===r.featurecoordsys.id?a.setAttribute("string",r.featurecoordsys.string):a.setAttribute("id",r.featurecoordsys.id)}if(null!=r.filtercoordsys){var o=this.createElementNS("","FILTERCOORDSYS");s.appendChild(o),0===r.filtercoordsys.id?o.setAttribute("string",r.filtercoordsys.string):o.setAttribute("id",r.filtercoordsys.id)}if(null!=r.envelope){var l=this.createElementNS("","ENVELOPE");s.appendChild(l),l.setAttribute("minx",r.envelope.minx),l.setAttribute("miny",r.envelope.miny),l.setAttribute("maxx",r.envelope.maxx),l.setAttribute("maxy",r.envelope.maxy)}var h=this.createElementNS("","IMAGESIZE");if(s.appendChild(h),h.setAttribute("height",r.imagesize.height),h.setAttribute("width",r.imagesize.width),r.imagesize.height==r.imagesize.printheight&&r.imagesize.width==r.imagesize.printwidth||(h.setAttribute("printheight",r.imagesize.printheight),h.setArrtibute("printwidth",r.imagesize.printwidth)),null!=r.background){var u=this.createElementNS("","BACKGROUND");s.appendChild(u),u.setAttribute("color",r.background.color.r+","+r.background.color.g+","+r.background.color.b),null!==r.background.transcolor&&u.setAttribute("transcolor",r.background.transcolor.r+","+r.background.transcolor.g+","+r.background.transcolor.b)}if(null!=r.layerlist&&r.layerlist.length>0){var p=this.createElementNS("","LAYERLIST");s.appendChild(p);for(var c=0;c0&&m.setAttribute("accuracy",f.accuracy),"number"==typeof f.featurelimit&&f.featurelimit<2e3&&m.setAttribute("featurelimit",f.featurelimit),"string"==typeof f.subfields&&"#ALL#"!=f.subfields&&m.setAttribute("subfields",f.subfields),"string"==typeof f.joinexpression&&f.joinexpression.length>0&&m.setAttribute("joinexpression",f.joinexpression),"string"==typeof f.jointables&&f.jointables.length>0&&m.setAttribute("jointables",f.jointables),d.appendChild(m)}"object"==typeof r.layerlist[c].renderer&&this.addRenderer(d,r.layerlist[c].renderer)}}}else if(null!=e.get_feature){if((n=this.createElementNS("","GET_FEATURES")).setAttribute("outputmode","newxml"),n.setAttribute("checkesc","true"),e.get_feature.geometry?n.setAttribute("geometry",e.get_feature.geometry):n.setAttribute("geometry","false"),e.get_feature.compact&&n.setAttribute("compact",e.get_feature.compact),"number"==e.get_feature.featurelimit&&n.setAttribute("featurelimit",e.get_feature.featurelimit),n.setAttribute("globalenvelope","true"),i.appendChild(n),null!=e.get_feature.layer&&e.get_feature.layer.length>0){var y=this.createElementNS("","LAYER");y.setAttribute("id",e.get_feature.layer),n.appendChild(y)}var g=e.get_feature.query;if(null!=g){var v=null;if(v=g.isspatial?this.createElementNS("","SPATIALQUERY"):this.createElementNS("","QUERY"),n.appendChild(v),"number"==typeof g.accuracy&&v.setAttribute("accuracy",g.accuracy),null!=g.featurecoordsys){var L=this.createElementNS("","FEATURECOORDSYS");0==g.featurecoordsys.id?L.setAttribute("string",g.featurecoordsys.string):L.setAttribute("id",g.featurecoordsys.id),v.appendChild(L)}if(null!=g.filtercoordsys){var O=this.createElementNS("","FILTERCOORDSYS");0===g.filtercoordsys.id?O.setAttribute("string",g.filtercoordsys.string):O.setAttribute("id",g.filtercoordsys.id),v.appendChild(O)}if(g.buffer>0){var b=this.createElementNS("","BUFFER");b.setAttribute("distance",g.buffer),v.appendChild(b)}if(g.isspatial){var w=this.createElementNS("","SPATIALFILTER");if(w.setAttribute("relation",g.spatialfilter.relation),v.appendChild(w),g.spatialfilter.envelope){var S=this.createElementNS("","ENVELOPE");S.setAttribute("minx",g.spatialfilter.envelope.minx),S.setAttribute("miny",g.spatialfilter.envelope.miny),S.setAttribute("maxx",g.spatialfilter.envelope.maxx),S.setAttribute("maxy",g.spatialfilter.envelope.maxy),w.appendChild(S)}else"object"==typeof g.spatialfilter.polygon&&w.appendChild(this.writePolygonGeometry(g.spatialfilter.polygon))}null!=g.where&&g.where.length>0&&v.setAttribute("where",g.where)}}return t.appendChild(i),OpenLayers.Format.XML.prototype.write.apply(this,[t])},addGroupRenderer:function(e,t){var i=this.createElementNS("","GROUPRENDERER");e.appendChild(i);for(var n=0;n0)t.error=this.getChildValue(i,"Unknown error.");else{var n=e.getElementsByTagName("RESPONSE");if(null==n||0==n.length)return t.error="No RESPONSE tag found in ArcXML response.",t;var s=n[0].firstChild.nodeName;if("#text"==s&&(s=n[0].firstChild.nextSibling.nodeName),"IMAGE"==s){var r=e.getElementsByTagName("ENVELOPE"),a=e.getElementsByTagName("OUTPUT");if(null==r||0==r.length)t.error="No ENVELOPE tag found in ArcXML response.";else if(null==a||0==a.length)t.error="No OUTPUT tag found in ArcXML response.";else{var o=this.parseAttributes(r[0]),l=this.parseAttributes(a[0]);"string"==typeof l.type?t.image={envelope:o,output:{type:l.type,data:this.getChildValue(a[0])}}:t.image={envelope:o,output:l}}}else if("FEATURES"==s){var h=n[0].getElementsByTagName("FEATURES"),u=h[0].getElementsByTagName("FEATURECOUNT");if(t.features.featurecount=u[0].getAttribute("count"),t.features.featurecount>0){var p=h[0].getElementsByTagName("ENVELOPE");t.features.envelope=this.parseAttributes(p[0],"number");for(var c=h[0].getElementsByTagName("FEATURE"),d=0;d0){for(var O=L[0].getElementsByTagName("RING"),b=[],w=0;w0){var n=this.getChildValue(i[0]);n=n.split(/;/);for(var s=0;s0)for(var o=0;o4?this._object.open(e,i,s,o,u):arguments.length>3?this._object.open(e,i,s,o):this._object.open(e,i,s),this.readyState=t.OPENED,n(this),this._object.onreadystatechange=function(){l&&!s||(c.readyState=c._object.readyState,r(c),c._aborted?c.readyState=t.UNSENT:(c.readyState==t.DONE&&(delete c._data,a(c),h&&s&&window.detachEvent("onunload",p)),d!=c.readyState&&n(c),d=c.readyState))}},t.prototype.send=function(e){t.onsend&&t.onsend.apply(this,arguments),arguments.length||(e=null),e&&e.nodeType&&(e=window.XMLSerializer?(new window.XMLSerializer).serializeToString(e):e.xml,this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")),this._data=e,i(this)},t.prototype.abort=function(){t.onabort&&t.onabort.apply(this,arguments),this.readyState>t.UNSENT&&(this._aborted=!0),this._object.abort(),a(this),this.readyState=t.UNSENT,delete this._data},t.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()},t.prototype.getResponseHeader=function(e){return this._object.getResponseHeader(e)},t.prototype.setRequestHeader=function(e,t){return this._headers||(this._headers={}),this._headers[e]=t,this._object.setRequestHeader(e,t)},t.prototype.addEventListener=function(e,t,i){for(var n,s=0;n=this._listeners[s];s++)if(n[0]==e&&n[1]==t&&n[2]==i)return;this._listeners.push([e,t,i])},t.prototype.removeEventListener=function(e,t,i){for(var n,s=0;(n=this._listeners[s])&&(n[0]!=e||n[1]!=t||n[2]!=i);s++);n&&this._listeners.splice(s,1)},t.prototype.dispatchEvent=function(e){var t={type:e.type,target:this,currentTarget:this,eventPhase:2,bubbles:e.bubbles,cancelable:e.cancelable,timeStamp:e.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};"readystatechange"==t.type&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[t]);for(var i,n=0;i=this._listeners[n];n++)i[0]!=t.type||i[2]||(i[1].handleEvent||i[1]).apply(this,[t])},t.prototype.toString=function(){return"[object XMLHttpRequest]"},t.toString=function(){return"[XMLHttpRequest]"},window.Function.prototype.apply||(window.Function.prototype.apply=function(e,t){t||(t=[]),e.__func=this,e.__func(t[0],t[1],t[2],t[3],t[4]),delete e.__func}),OpenLayers.Request||(OpenLayers.Request={}),OpenLayers.Request.XMLHttpRequest=t}(),OpenLayers.ProxyHost="",OpenLayers.Request||(OpenLayers.Request={}),OpenLayers.Util.extend(OpenLayers.Request,{DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:!0,user:void 0,password:void 0,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),makeSameOrigin:function(e,t){var i=0!==e.indexOf("http"),n=!i&&e.match(this.URL_SPLIT_REGEX);if(n){var s=window.location;i=n[1]==s.protocol&&n[3]==s.hostname;var r=n[4],a=s.port;(80!=r&&""!=r||"80"!=a&&""!=a)&&(i=i&&r==a)}return i||t&&(e="function"==typeof t?t(e):t+encodeURIComponent(e)),e},issue:function(e){var t=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});(e=e||{}).headers=e.headers||{},(e=OpenLayers.Util.applyDefaults(e,t)).headers=OpenLayers.Util.applyDefaults(e.headers,t.headers);var i,n=!1;for(i in e.headers)e.headers.hasOwnProperty(i)&&"x-requested-with"===i.toLowerCase()&&(n=!0);!1===n&&(e.headers["X-Requested-With"]="XMLHttpRequest");var s=new OpenLayers.Request.XMLHttpRequest,r=OpenLayers.Util.urlAppend(e.url,OpenLayers.Util.getParameterString(e.params||{}));r=OpenLayers.Request.makeSameOrigin(r,e.proxy),s.open(e.method,r,e.async,e.user,e.password);for(var a in e.headers)s.setRequestHeader(a,e.headers[a]);var o=this.events,l=this;return s.onreadystatechange=function(){s.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&!1!==o.triggerEvent("complete",{request:s,config:e,requestUrl:r})&&l.runCallbacks({request:s,config:e,requestUrl:r})},!1===e.async?s.send(e.data):window.setTimeout(function(){0!==s.readyState&&s.send(e.data)},0),s},runCallbacks:function(e){var t,i=e.request,n=e.config,s=n.scope?OpenLayers.Function.bind(n.callback,n.scope):n.callback;n.success&&(t=n.scope?OpenLayers.Function.bind(n.success,n.scope):n.success);var r;n.failure&&(r=n.scope?OpenLayers.Function.bind(n.failure,n.scope):n.failure),"file:"==OpenLayers.Util.createUrlObject(n.url).protocol&&i.responseText&&(i.status=200),s(i),(!i.status||i.status>=200&&i.status<300)&&(this.events.triggerEvent("success",e),t&&t(i)),i.status&&(i.status<200||i.status>=300)&&(this.events.triggerEvent("failure",e),r&&r(i))},GET:function(e){return e=OpenLayers.Util.extend(e,{method:"GET"}),OpenLayers.Request.issue(e)},POST:function(e){return e=OpenLayers.Util.extend(e,{method:"POST"}),e.headers=e.headers?e.headers:{},"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(e.headers)||(e.headers["Content-Type"]="application/xml"),OpenLayers.Request.issue(e)},PUT:function(e){return e=OpenLayers.Util.extend(e,{method:"PUT"}),e.headers=e.headers?e.headers:{},"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(e.headers)||(e.headers["Content-Type"]="application/xml"),OpenLayers.Request.issue(e)},DELETE:function(e){return e=OpenLayers.Util.extend(e,{method:"DELETE"}),OpenLayers.Request.issue(e)},HEAD:function(e){return e=OpenLayers.Util.extend(e,{method:"HEAD"}),OpenLayers.Request.issue(e)},OPTIONS:function(e){return e=OpenLayers.Util.extend(e,{method:"OPTIONS"}),OpenLayers.Request.issue(e)}}),OpenLayers.Layer.ArcIMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{ClientVersion:"9.2",ServiceName:""},featureCoordSys:"4326",filterCoordSys:"4326",layers:null,async:!0,name:"ArcIMS",isBaseLayer:!0,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),featureCoordSys:"4326",filterCoordSys:"4326",layers:null,isBaseLayer:!0,async:!0,name:"ArcIMS"},initialize:function(e,t,i){this.tileSize=new OpenLayers.Size(512,512),this.params=OpenLayers.Util.applyDefaults({ServiceName:i.serviceName},this.DEFAULT_PARAMS),this.options=OpenLayers.Util.applyDefaults(i,this.DEFAULT_OPTIONS),OpenLayers.Layer.Grid.prototype.initialize.apply(this,[e,t,this.params,i]),this.transparent&&(this.isBaseLayer||(this.isBaseLayer=!1),"image/jpeg"==this.format&&(this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png")),null===this.options.layers&&(this.options.layers=[])},getURL:function(e){var t="";e=this.adjustBounds(e);var i=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:e.toArray(),tileSize:this.tileSize})),n=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:i.write(),async:!1});if(null!=n){var s=n.responseXML;s&&s.documentElement||(s=n.responseText);var r=(new OpenLayers.Format.ArcXML).read(s);t=this.getUrlOrImage(r.image.output)}return t},getURLasync:function(e,t,i){e=this.adjustBounds(e);var n=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:e.toArray(),tileSize:this.tileSize}));OpenLayers.Request.POST({url:this.getFullRequestString(),async:!0,data:n.write(),callback:function(e){var n=e.responseXML;n&&n.documentElement||(n=e.responseText);var s=(new OpenLayers.Format.ArcXML).read(n);t.call(i,this.getUrlOrImage(s.image.output))},scope:this})},getUrlOrImage:function(e){var t="";return e.url?t=e.url:e.data&&(t="data:image/"+e.type+";base64,"+e.data),t},setLayerQuery:function(e,t){for(var i=0;i=0;--e)this._removeButton(this.buttons[e])},onButtonClick:function(e){switch(e.buttonElement.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent()}},getSlideFactor:function(e){return this.slideRatio?this.map.getSize()[e]*this.slideRatio:this.slideFactor},CLASS_NAME:"OpenLayers.Control.PanZoom"}),OpenLayers.Control.PanZoom.X=4,OpenLayers.Control.PanZoom.Y=4,OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,zoomWorldIcon:!1,panIcons:!0,forceFixedZoomLevel:!1,mouseDragStart:null,deltaY:null,zoomStart:null,destroy:function(){this._removeZoomBar(),this.map.events.un({changebaselayer:this.redraw,updatesize:this.redraw,scope:this}),OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments),delete this.mouseDragStart,delete this.zoomStart},setMap:function(e){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments),this.map.events.on({changebaselayer:this.redraw,updatesize:this.redraw,scope:this})},redraw:function(){null!=this.div&&(this.removeButtons(),this._removeZoomBar()),this.draw()},draw:function(e){OpenLayers.Control.prototype.draw.apply(this,arguments),e=this.position.clone(),this.buttons=[];var t={w:18,h:18};if(this.panIcons){var i=new OpenLayers.Pixel(e.x+t.w/2,e.y),n=t.w;this.zoomWorldIcon&&(i=new OpenLayers.Pixel(e.x+t.w,e.y)),this._addButton("panup","north-mini.png",i,t),e.y=i.y+t.h,this._addButton("panleft","west-mini.png",e,t),this.zoomWorldIcon&&(this._addButton("zoomworld","zoom-world-mini.png",e.add(t.w,0),t),n*=2),this._addButton("panright","east-mini.png",e.add(n,0),t),this._addButton("pandown","south-mini.png",i.add(0,2*t.h),t),this._addButton("zoomin","zoom-plus-mini.png",i.add(0,3*t.h+5),t),i=this._addZoomBar(i.add(0,4*t.h+5)),this._addButton("zoomout","zoom-minus-mini.png",i,t)}else this._addButton("zoomin","zoom-plus-mini.png",e,t),i=this._addZoomBar(e.add(0,t.h)),this._addButton("zoomout","zoom-minus-mini.png",i,t),this.zoomWorldIcon&&(i=i.add(0,t.h+3),this._addButton("zoomworld","zoom-world-mini.png",i,t));return this.div},_addZoomBar:function(e){var t=OpenLayers.Util.getImageLocation("slider.png"),i=this.id+"_"+this.map.id,n=this.map.getMinZoom(),s=this.map.getNumZoomLevels()-1-this.map.getZoom(),r=OpenLayers.Util.createAlphaImageDiv(i,e.add(-1,s*this.zoomStopHeight),{w:20,h:9},t,"absolute");r.style.cursor="move",this.slider=r,this.sliderEvents=new OpenLayers.Events(this,r,null,!0,{includeXY:!0}),this.sliderEvents.on({touchstart:this.zoomBarDown,touchmove:this.zoomBarDrag,touchend:this.zoomBarUp,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp});var a={w:this.zoomStopWidth,h:this.zoomStopHeight*(this.map.getNumZoomLevels()-n)},t=OpenLayers.Util.getImageLocation("zoombar.png"),o=null;if(OpenLayers.Util.alphaHack()){i=this.id+"_"+this.map.id;(o=OpenLayers.Util.createAlphaImageDiv(i,e,{w:a.w,h:this.zoomStopHeight},t,"absolute",null,"crop")).style.height=a.h+"px"}else o=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,e,a,t);return o.style.cursor="pointer",o.className="olButton",this.zoombarDiv=o,this.div.appendChild(o),this.startTop=parseInt(o.style.top),this.div.appendChild(r),this.map.events.register("zoomend",this,this.moveZoomBar),e=e.add(0,this.zoomStopHeight*(this.map.getNumZoomLevels()-n))},_removeZoomBar:function(){this.sliderEvents.un({touchstart:this.zoomBarDown,touchmove:this.zoomBarDrag,touchend:this.zoomBarUp,mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp}),this.sliderEvents.destroy(),this.div.removeChild(this.zoombarDiv),this.zoombarDiv=null,this.div.removeChild(this.slider),this.slider=null,this.map.events.unregister("zoomend",this,this.moveZoomBar)},onButtonClick:function(e){if(OpenLayers.Control.PanZoom.prototype.onButtonClick.apply(this,arguments),e.buttonElement===this.zoombarDiv){var t=e.buttonXY.y/this.zoomStopHeight;!this.forceFixedZoomLevel&&this.map.fractionalZoom||(t=Math.floor(t));var i=this.map.getNumZoomLevels()-1-t;i=Math.min(Math.max(i,0),this.map.getNumZoomLevels()-1),this.map.zoomTo(i)}},passEventToSlider:function(e){this.sliderEvents.handleBrowserEvent(e)},zoomBarDown:function(e){(OpenLayers.Event.isLeftClick(e)||OpenLayers.Event.isSingleTouch(e))&&(this.map.events.on({touchmove:this.passEventToSlider,mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this}),this.mouseDragStart=e.xy.clone(),this.zoomStart=e.xy.clone(),this.div.style.cursor="move",this.zoombarDiv.offsets=null,OpenLayers.Event.stop(e))},zoomBarDrag:function(e){if(null!=this.mouseDragStart){var t=this.mouseDragStart.y-e.xy.y,i=OpenLayers.Util.pagePosition(this.zoombarDiv);if(e.clientY-i[1]>0&&e.clientY-i[1]0&&(t.featureNS=this.lookupNamespaceURI(e,n[0]))}},Title:function(e,t){var i=this.getChildValue(e);i&&(t.title=i)},Abstract:function(e,t){var i=this.getChildValue(e);i&&(t.abstract=i)}}},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1"}),OpenLayers.Format.WFSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},readers:{wfs:OpenLayers.Util.applyDefaults({DefaultSRS:function(e,t){var i=this.getChildValue(e);i&&(t.srs=i)}},OpenLayers.Format.WFSCapabilities.v1.prototype.readers.wfs),ows:OpenLayers.Format.OWSCommon.v1.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_1_0"}),OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!0,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(e,t,i,n,s){this.url=t,this.extent=i,this.maxExtent=i,this.size=n,OpenLayers.Layer.prototype.initialize.apply(this,[e,s]),this.aspectRatio=this.extent.getHeight()/this.size.h/(this.extent.getWidth()/this.size.w)},destroy:function(){this.tile&&(this.removeTileMonitoringHooks(this.tile),this.tile.destroy(),this.tile=null),OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(e){return null==e&&(e=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions())),e=OpenLayers.Layer.prototype.clone.apply(this,[e])},setMap:function(e){null==this.options.maxResolution&&(this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w),OpenLayers.Layer.prototype.setMap.apply(this,arguments)},moveTo:function(e,t,i){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var n=null==this.tile;if(t||n){this.setTileSize();var s=this.map.getLayerPxFromLonLat({lon:this.extent.left,lat:this.extent.top});n?(this.tile=new OpenLayers.Tile.Image(this,s,this.extent,null,this.tileSize),this.addTileMonitoringHooks(this.tile)):(this.tile.size=this.tileSize.clone(),this.tile.position=s.clone()),this.tile.draw()}},setTileSize:function(){var e=this.extent.getWidth()/this.map.getResolution(),t=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(e,t)},addTileMonitoringHooks:function(e){e.onLoadStart=function(){this.events.triggerEvent("loadstart")},e.events.register("loadstart",this,e.onLoadStart),e.onLoadEnd=function(){this.events.triggerEvent("loadend")},e.events.register("loadend",this,e.onLoadEnd),e.events.register("unload",this,e.onLoadEnd)},removeTileMonitoringHooks:function(e){e.unload(),e.events.un({loadstart:e.onLoadStart,loadend:e.onLoadEnd,unload:e.onLoadEnd,scope:this})},setUrl:function(e){this.url=e,this.tile.draw()},getURL:function(e){return this.url},CLASS_NAME:"OpenLayers.Layer.Image"}),OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:!0,autoDestroy:!0,initialize:function(e){OpenLayers.Util.extend(this,e),this.options=e,this.active=!1},destroy:function(){this.deactivate(),this.layer=null,this.options=null},setLayer:function(e){this.layer=e},activate:function(){return!this.active&&(this.active=!0,!0)},deactivate:function(){return!!this.active&&(this.active=!1,!0)},CLASS_NAME:"OpenLayers.Strategy"}),OpenLayers.Strategy.Save=OpenLayers.Class(OpenLayers.Strategy,{events:null,auto:!1,timer:null,initialize:function(e){OpenLayers.Strategy.prototype.initialize.apply(this,[e]),this.events=new OpenLayers.Events(this)},activate:function(){var e=OpenLayers.Strategy.prototype.activate.call(this);return e&&this.auto&&("number"==typeof this.auto?this.timer=window.setInterval(OpenLayers.Function.bind(this.save,this),1e3*this.auto):this.layer.events.on({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this})),e},deactivate:function(){var e=OpenLayers.Strategy.prototype.deactivate.call(this);return e&&this.auto&&("number"==typeof this.auto?window.clearInterval(this.timer):this.layer.events.un({featureadded:this.triggerSave,afterfeaturemodified:this.triggerSave,scope:this})),e},triggerSave:function(e){var t=e.feature;t.state!==OpenLayers.State.INSERT&&t.state!==OpenLayers.State.UPDATE&&t.state!==OpenLayers.State.DELETE||this.save([e.feature])},save:function(e){e||(e=this.layer.features),this.events.triggerEvent("start",{features:e});var t=this.layer.projection,i=this.layer.map.getProjectionObject();if(!i.equals(t)){for(var n,s,r=e.length,a=new Array(r),o=0;o0&&this.layer.destroyFeatures(r),this.events.triggerEvent("success",t)}else this.events.triggerEvent("fail",t)},CLASS_NAME:"OpenLayers.Strategy.Save"}),OpenLayers.Events.featureclick=OpenLayers.Class({cache:null,map:null,provides:["featureclick","nofeatureclick","featureover","featureout"],initialize:function(e){if(this.target=e,e.object instanceof OpenLayers.Map)this.setMap(e.object);else{if(!(e.object instanceof OpenLayers.Layer.Vector))throw"Listeners for '"+this.provides.join("', '")+"' events can only be registered for OpenLayers.Layer.Vector or OpenLayers.Map instances";e.object.map?this.setMap(e.object.map):e.object.events.register("added",this,function(t){this.setMap(e.object.map)})}for(var t=this.provides.length-1;t>=0;--t)e.extensions[this.provides[t]]=!0},setMap:function(e){this.map=e,this.cache={},e.events.register("mousedown",this,this.start,{extension:!0}),e.events.register("mouseup",this,this.onClick,{extension:!0}),e.events.register("touchstart",this,this.start,{extension:!0}),e.events.register("touchmove",this,this.cancel,{extension:!0}),e.events.register("touchend",this,this.onClick,{extension:!0}),e.events.register("mousemove",this,this.onMousemove,{extension:!0})},start:function(e){this.startEvt=e},cancel:function(e){delete this.startEvt},onClick:function(e){if(this.startEvt&&("touchend"===e.type||OpenLayers.Event.isLeftClick(e))){var t=this.getFeatures(this.startEvt);delete this.startEvt;for(var i,n,s={},r=0,a=t.length;r=0;--s)if("none"!==(t=this.map.layers[s]).div.style.display)if(t.renderer instanceof OpenLayers.Renderer.Elements){if(t instanceof OpenLayers.Layer.Vector)for(i=document.elementFromPoint(a,o);i&&i._featureId;)(n=t.getFeatureById(i._featureId))?(l.push(n),i.style.display="none",h.push(i),i=document.elementFromPoint(a,o)):i=!1;u.push(t),t.div.style.display="none"}else t.renderer instanceof OpenLayers.Renderer.Canvas&&(n=t.renderer.getFeatureIdFromEvent(e))&&(l.push(n),u.push(t));for(s=0,r=h.length;s=0;--s)u[s].div.style.display="block";return l},destroy:function(){for(var e=this.provides.length-1;e>=0;--e)delete this.target.extensions[this.provides[e]];this.map.events.un({mousemove:this.onMousemove,mousedown:this.start,mouseup:this.onClick,touchstart:this.start,touchmove:this.cancel,touchend:this.onClick,scope:this}),delete this.cache,delete this.map,delete this.target}}),OpenLayers.Events.nofeatureclick=OpenLayers.Events.featureclick,OpenLayers.Events.featureover=OpenLayers.Events.featureclick,OpenLayers.Events.featureout=OpenLayers.Events.featureclick,OpenLayers.Format.GPX=OpenLayers.Class(OpenLayers.Format.XML,{defaultDesc:"No description available",extractWaypoints:!0,extractTracks:!0,extractRoutes:!0,extractAttributes:!0,namespaces:{gpx:"http://www.topografix.com/GPX/1/1",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd",creator:"OpenLayers",initialize:function(e){this.externalProjection=new OpenLayers.Projection("EPSG:4326"),OpenLayers.Format.XML.prototype.initialize.apply(this,[e])},read:function(e){"string"==typeof e&&(e=OpenLayers.Format.XML.prototype.read.apply(this,[e]));var t=[];if(this.extractTracks)for(var i=e.getElementsByTagName("trk"),n=0,s=i.length;n0&&((h=u[0].getAttribute("typeName"))||(h=u[0].getAttribute("typename")));var p={layerName:a,owsType:o,owsURL:l,typeName:h};s.layerDescriptions.push(p),s.length=s.layerDescriptions.length,s[s.length-1]=p}else if("ServiceException"==i)return{error:(new OpenLayers.Format.OGCExceptionReport).read(e)};return s},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer.v1_1_1"}),OpenLayers.Format.WMSDescribeLayer.v1_1_0=OpenLayers.Format.WMSDescribeLayer.v1_1_1,OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,sphericalMercator:!1,zoomOffset:0,serverResolutions:null,initialize:function(e,t,i){(i&&i.sphericalMercator||this.sphericalMercator)&&(i=OpenLayers.Util.extend({projection:"EPSG:900913",numZoomLevels:19},i)),OpenLayers.Layer.Grid.prototype.initialize.apply(this,[e||this.name,t||this.url,{},i])},clone:function(e){return null==e&&(e=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions())),e=OpenLayers.Layer.Grid.prototype.clone.apply(this,[e])},getURL:function(e){var t=this.getXYZ(e),i=this.url;if(OpenLayers.Util.isArray(i)){var n=""+t.x+t.y+t.z;i=this.selectUrl(n,i)}return OpenLayers.String.format(i,t)},getXYZ:function(e){var t=this.getServerResolution(),i=Math.round((e.left-this.maxExtent.left)/(t*this.tileSize.w)),n=Math.round((this.maxExtent.top-e.top)/(t*this.tileSize.h)),s=this.getServerZoom();if(this.wrapDateLine){var r=Math.pow(2,s);i=(i%r+r)%r}return{x:i,y:n,z:s}},setMap:function(e){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments),this.tileOrigin||(this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom))},CLASS_NAME:"OpenLayers.Layer.XYZ"}),OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",url:["http://a.tile.openstreetmap.org/${z}/${x}/${y}.png","http://b.tile.openstreetmap.org/${z}/${x}/${y}.png","http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"],attribution:"© OpenStreetMap contributors",sphericalMercator:!0,wrapDateLine:!0,tileOptions:null,initialize:function(e,t,i){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments),this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options&&this.options.tileOptions)},clone:function(e){return null==e&&(e=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions())),e=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[e])},CLASS_NAME:"OpenLayers.Layer.OSM"}),OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(e,t){this.container=OpenLayers.Util.getElement(e),OpenLayers.Util.extend(this,t)},destroy:function(){this.container=null,this.extent=null,this.size=null,this.resolution=null,this.map=null},supported:function(){return!1},setExtent:function(e,t){if(this.extent=e.clone(),this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var i=e.getWidth()/this.map.getExtent().getWidth(),e=e.scale(1/i);this.extent=e.wrapDateLine(this.map.getMaxExtent()).scale(i)}return t&&(this.resolution=null),!0},setSize:function(e){this.size=e.clone(),this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution(),this.resolution},drawFeature:function(e,t){if(null==t&&(t=e.style),e.geometry){var i=e.geometry.getBounds();if(i){var n;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(n=this.map.getMaxExtent()),i.intersectsBounds(this.extent,{worldBounds:n})?this.calculateFeatureDx(i,n):t={display:"none"};var s=this.drawGeometry(e.geometry,t,e.id);if("none"!=t.display&&t.label&&!1!==s){var r=e.geometry.getCentroid();if(t.labelXOffset||t.labelYOffset){var a=isNaN(t.labelXOffset)?0:t.labelXOffset,o=isNaN(t.labelYOffset)?0:t.labelYOffset,l=this.getResolution();r.move(a*l,o*l)}this.drawText(e.id,t,r)}else this.removeText(e.id);return s}}},calculateFeatureDx:function(e,t){if(this.featureDx=0,t){var i=t.getWidth(),n=(this.extent.left+this.extent.right)/2,s=(e.left+e.right)/2,r=Math.round((s-n)/i);this.featureDx=r*i}},drawGeometry:function(e,t,i){},drawText:function(e,t,i){},removeText:function(e){},clear:function(){},getFeatureIdFromEvent:function(e){},eraseFeatures:function(e){OpenLayers.Util.isArray(e)||(e=[e]);for(var t=0,i=e.length;t=16777216&&(this.hitOverflow=t-16777215,t=t%16777216+1);var i="000000"+t.toString(16),n=i.length;return i="#"+i.substring(n-6,n)},setHitContextStyle:function(e,t,i,n){var s=this.featureIdToHex(t);"fill"==e?(this.hitContext.globalAlpha=1,this.hitContext.fillStyle=s):"stroke"==e?(this.hitContext.globalAlpha=1,this.hitContext.strokeStyle=s,void 0===n?this.hitContext.lineWidth=i.strokeWidth+2:isNaN(n)||(this.hitContext.lineWidth=i.strokeWidth+2/n)):(this.hitContext.globalAlpha=0,this.hitContext.lineWidth=1)},drawPoint:function(e,t,i){if(!1!==t.graphic)if(t.externalGraphic)this.drawExternalGraphic(e,t,i);else if(t.graphicName&&"circle"!=t.graphicName)this.drawNamedSymbol(e,t,i);else{var n=this.getLocalXY(e),s=n[0],r=n[1];if(!isNaN(s)&&!isNaN(r)){var a=2*Math.PI,o=t.pointRadius;!1!==t.fill&&(this.setCanvasStyle("fill",t),this.canvas.beginPath(),this.canvas.arc(s,r,o,0,a,!0),this.canvas.fill(),this.hitDetection&&(this.setHitContextStyle("fill",i,t),this.hitContext.beginPath(),this.hitContext.arc(s,r,o,0,a,!0),this.hitContext.fill())),!1!==t.stroke&&(this.setCanvasStyle("stroke",t),this.canvas.beginPath(),this.canvas.arc(s,r,o,0,a,!0),this.canvas.stroke(),this.hitDetection&&(this.setHitContextStyle("stroke",i,t),this.hitContext.beginPath(),this.hitContext.arc(s,r,o,0,a,!0),this.hitContext.stroke()),this.setCanvasStyle("reset"))}}},drawLineString:function(e,t,i){t=OpenLayers.Util.applyDefaults({fill:!1},t),this.drawLinearRing(e,t,i)},drawLinearRing:function(e,t,i){!1!==t.fill&&(this.setCanvasStyle("fill",t),this.renderPath(this.canvas,e,t,i,"fill"),this.hitDetection&&(this.setHitContextStyle("fill",i,t),this.renderPath(this.hitContext,e,t,i,"fill"))),!1!==t.stroke&&(this.setCanvasStyle("stroke",t),this.renderPath(this.canvas,e,t,i,"stroke"),this.hitDetection&&(this.setHitContextStyle("stroke",i,t),this.renderPath(this.hitContext,e,t,i,"stroke"))),this.setCanvasStyle("reset")},renderPath:function(e,t,i,n,s){var r=t.components,a=r.length;e.beginPath();var o=this.getLocalXY(r[0]),l=o[0],h=o[1];if(!isNaN(l)&&!isNaN(h)){e.moveTo(o[0],o[1]);for(var u=1;u=0;i--)for(var n=this.createFeatureNodes(e[i]),s=0;s0&&(this.layer.destroyFeatures(this.virtualVertices,{silent:!0}),this.virtualVertices=[]),this.layer.drawFeature(this.feature,this.standalone?void 0:"select")),this.layer.drawFeature(e)},dragComplete:function(e){this.resetVertices(),this.setFeatureState(),this.onModification(this.feature),this.layer.events.triggerEvent("featuremodified",{feature:this.feature})},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE&&(this.feature.state=OpenLayers.State.UPDATE,this.modified&&this._originalGeometry)){var e=this.feature;e.modified=OpenLayers.Util.extend(e.modified,{geometry:this._originalGeometry}),delete this._originalGeometry}},resetVertices:function(){this.vertices.length>0&&(this.layer.removeFeatures(this.vertices,{silent:!0}),this.vertices=[]),this.virtualVertices.length>0&&(this.layer.removeFeatures(this.virtualVertices,{silent:!0}),this.virtualVertices=[]),this.dragHandle&&(this.layer.destroyFeatures([this.dragHandle],{silent:!0}),this.dragHandle=null),this.radiusHandle&&(this.layer.destroyFeatures([this.radiusHandle],{silent:!0}),this.radiusHandle=null),this.feature&&"OpenLayers.Geometry.Point"!=this.feature.geometry.CLASS_NAME&&(this.mode&OpenLayers.Control.ModifyFeature.DRAG&&this.collectDragHandle(),this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE)&&this.collectRadiusHandle(),this.mode&OpenLayers.Control.ModifyFeature.RESHAPE&&(this.mode&OpenLayers.Control.ModifyFeature.RESIZE||this.collectVertices()))},handleKeypress:function(e){var t=e.keyCode;if(this.feature&&-1!=OpenLayers.Util.indexOf(this.deleteCodes,t)){var i=this.layer.getFeatureFromEvent(this.handlers.drag.evt);i&&-1!=OpenLayers.Util.indexOf(this.vertices,i)&&!this.handlers.drag.dragging&&i.geometry.parent&&(i.geometry.parent.removeComponent(i.geometry),this.layer.events.triggerEvent("vertexremoved",{vertex:i.geometry,feature:this.feature,pixel:e.xy}),this.layer.drawFeature(this.feature,this.standalone?void 0:"select"),this.modified=!0,this.resetVertices(),this.setFeatureState(),this.onModification(this.feature),this.layer.events.triggerEvent("featuremodified",{feature:this.feature}))}},collectVertices:function(){function e(i){var n,s,r,a;if("OpenLayers.Geometry.Point"==i.CLASS_NAME)(s=new OpenLayers.Feature.Vector(i))._sketch=!0,s.renderIntent=t.vertexRenderIntent,t.vertices.push(s);else{var o=i.components.length;for("OpenLayers.Geometry.LinearRing"==i.CLASS_NAME&&(o-=1),n=0;n=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(e):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Control.ModifyFeature"}),OpenLayers.Control.ModifyFeature.RESHAPE=1,OpenLayers.Control.ModifyFeature.RESIZE=2,OpenLayers.Control.ModifyFeature.ROTATE=4,OpenLayers.Control.ModifyFeature.DRAG=8,OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.29858214169740677,.14929107084870338,.07464553542435169],attributionTemplate:'
${copyrights}Terms of Use
',metadata:null,protocolRegex:/^http:/i,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,protocol:~window.location.href.indexOf("http")?"":"http:",initialize:function(e){var t=[(e=OpenLayers.Util.applyDefaults({sphericalMercator:!0},e)).name||"Bing "+(e.type||this.type),null,e];OpenLayers.Layer.XYZ.prototype.initialize.apply(this,t),this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions),this.loadMetadata()},loadMetadata:function(){this._callbackId="_callback_"+this.id.replace(/\./g,"_"),window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var e=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams),t=this.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(e),i=document.createElement("script");i.type="text/javascript",i.src=t,i.id=this._callbackId,document.getElementsByTagName("head")[0].appendChild(i)},initLayer:function(){var e=this.metadata.resourceSets[0].resources[0],t=e.imageUrl.replace("{quadkey}","${quadkey}");t=(t=t.replace("{culture}",this.culture)).replace(this.protocolRegex,this.protocol),this.url=[];for(var i=0;i0;--a){var o="0",l=1<=o.zoomMin&&(c+=t.attribution+" ");var d=e.brandLogoUri.replace(this.protocolRegex,this.protocol);this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(),logo:d,copyrights:c}),this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})}},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments),this.map.events.register("moveend",this,this.updateAttribution)},clone:function(e){return null==e&&(e=new OpenLayers.Layer.Bing(this.options)),e=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[e])},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution),OpenLayers.Layer.XYZ.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"}),OpenLayers.Layer.Bing.processMetadata=function(e){this.metadata=e,this.initLayer();var t=document.getElementById(this._callbackId);t.parentNode.removeChild(t),window[this._callbackId]=void 0,delete this._callbackId},OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,initialize:function(e,t){if(this.styles={default:new OpenLayers.Style(OpenLayers.Feature.Vector.style.default),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),delete:new OpenLayers.Style(OpenLayers.Feature.Vector.style.delete)},e instanceof OpenLayers.Style)this.styles.default=e,this.styles.select=e,this.styles.temporary=e,this.styles.delete=e;else if("object"==typeof e)for(var i in e)if(e[i]instanceof OpenLayers.Style)this.styles[i]=e[i];else{if("object"!=typeof e[i]){this.styles.default=new OpenLayers.Style(e),this.styles.select=new OpenLayers.Style(e),this.styles.temporary=new OpenLayers.Style(e),this.styles.delete=new OpenLayers.Style(e);break}this.styles[i]=new OpenLayers.Style(e[i])}OpenLayers.Util.extend(this,t)},destroy:function(){for(var e in this.styles)this.styles[e].destroy();this.styles=null},createSymbolizer:function(e,t){e||(e=new OpenLayers.Feature.Vector),this.styles[t]||(t="default"),e.renderIntent=t;var i={};return this.extendDefault&&"default"!=t&&(i=this.styles.default.createSymbolizer(e)),OpenLayers.Util.extend(i,this.styles[t].createSymbolizer(e))},addUniqueValueRules:function(e,t,i,n){var s=[];for(var r in i)s.push(new OpenLayers.Rule({symbolizer:i[r],context:n,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:t,value:r})}));this.styles[e].addRules(s)},CLASS_NAME:"OpenLayers.StyleMap"}),OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,ratio:1,initialize:function(e,t){if(OpenLayers.Layer.prototype.initialize.apply(this,arguments),this.renderer&&this.renderer.supported()||this.assignRenderer(),this.renderer&&this.renderer.supported()||(this.renderer=null,this.displayError()),this.styleMap||(this.styleMap=new OpenLayers.StyleMap),this.features=[],this.selectedFeatures=[],this.unrenderedFeatures={},this.strategies)for(var i=0,n=this.strategies.length;i=0;n--){0!=n&&e[n-1].geometry?this.renderer.locked=!0:this.renderer.locked=!1;var s=e[n];delete this.unrenderedFeatures[s.id],i&&this.events.triggerEvent("beforefeatureremoved",{feature:s}),this.features=OpenLayers.Util.removeItem(this.features,s),s.layer=null,s.geometry&&this.renderer.eraseFeatures(s),-1!=OpenLayers.Util.indexOf(this.selectedFeatures,s)&&OpenLayers.Util.removeItem(this.selectedFeatures,s),i&&this.events.triggerEvent("featureremoved",{feature:s})}i&&this.events.triggerEvent("featuresremoved",{features:e})}},removeAllFeatures:function(e){var t=!e||!e.silent,i=this.features;t&&this.events.triggerEvent("beforefeaturesremoved",{features:i});for(var n,s=i.length-1;s>=0;s--)n=i[s],t&&this.events.triggerEvent("beforefeatureremoved",{feature:n}),n.layer=null,t&&this.events.triggerEvent("featureremoved",{feature:n});this.renderer.clear(),this.features=[],this.unrenderedFeatures={},this.selectedFeatures=[],t&&this.events.triggerEvent("featuresremoved",{features:i})},destroyFeatures:function(e,t){if(void 0==e&&(e=this.features),e){this.removeFeatures(e,t);for(var i=e.length-1;i>=0;i--)e[i].destroy()}},drawFeature:function(e,t){if(this.drawn){if("object"!=typeof t){t||e.state!==OpenLayers.State.DELETE||(t="delete");var i=t||e.renderIntent;(t=e.style||this.style)||(t=this.styleMap.createSymbolizer(e,i))}var n=this.renderer.drawFeature(e,t);!1===n||null===n?this.unrenderedFeatures[e.id]=e:delete this.unrenderedFeatures[e.id]}},eraseFeatures:function(e){this.renderer.eraseFeatures(e)},getFeatureFromEvent:function(e){if(!this.renderer)throw new Error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");var t=null,i=this.renderer.getFeatureIdFromEvent(e);return i&&(t="string"==typeof i?this.getFeatureById(i):i),t},getFeatureBy:function(e,t){for(var i=null,n=0,s=this.features.length;n0)for(var i=null,n=0,s=t.length;n=OpenLayers.Style.createLiteral(this.minScaleDenominator,t)),i&&this.maxScaleDenominator&&(i=n1;)i=parseInt((n+s)/2),this.compare(this,e,OpenLayers.Util.getElement(this.order[i]))>0?n=i:s=i;return this.order.splice(s,0,t),this.indices[t]=this.getZIndex(e),this.getNextElement(s)},remove:function(e){var t=e.id,i=OpenLayers.Util.indexOf(this.order,t);if(i>=0)if(this.order.splice(i,1),delete this.indices[t],this.order.length>0){var n=this.order[this.order.length-1];this.maxZIndex=this.indices[n]}else this.maxZIndex=0},clear:function(){this.order=[],this.indices={},this.maxZIndex=0},exists:function(e){return null!=this.indices[e.id]},getZIndex:function(e){return e._style.graphicZIndex},determineZIndex:function(e){var t=e._style.graphicZIndex;null==t?(t=this.maxZIndex,e._style.graphicZIndex=t):t>this.maxZIndex&&(this.maxZIndex=t)},getNextElement:function(e){var t=e+1;if(te.left&&a.righte.left&&a.left0&&(e="?"+e.substring(i+1,e.length),OpenLayers.Util.extend(t,OpenLayers.Util.getParameters(e))),t},setMap:function(e){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var t=0,i=this.map.controls.length;t0){var n=t.projection,s=t.map.getProjectionObject();if(!s.equals(n))for(var r,a=0,o=i.length;a0){var h=null!=this.dataFrom?e[a+this.dataFrom].data||e[a+this.dataFrom].attributes:null,u=null!=this.styleFrom?e[a+this.styleFrom].style:null,p=new OpenLayers.Geometry.LineString([n,s]);r[a-1]=new OpenLayers.Feature.Vector(p,h,u)}n=s}this.addFeatures(r,t)},CLASS_NAME:"OpenLayers.Layer.PointTrack"}),OpenLayers.Layer.PointTrack.SOURCE_NODE=-1,OpenLayers.Layer.PointTrack.TARGET_NODE=0,OpenLayers.Layer.PointTrack.dataFrom={SOURCE_NODE:-1,TARGET_NODE:0},OpenLayers.Protocol.WFS=function(e){e=OpenLayers.Util.applyDefaults(e,OpenLayers.Protocol.WFS.DEFAULTS);var t=OpenLayers.Protocol.WFS["v"+e.version.replace(/\./g,"_")];if(!t)throw"Unsupported WFS version: "+e.version;return new t(e)},OpenLayers.Protocol.WFS.fromWMSLayer=function(e,t){var i,n,s=e.params.LAYERS,r=(OpenLayers.Util.isArray(s)?s[0]:s).split(":");r.length>1&&(n=r[0]),i=r.pop();var a={url:e.url,featureType:i,featurePrefix:n,srsName:e.projection&&e.projection.getCode()||e.map&&e.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(t,a))},OpenLayers.Protocol.WFS.DEFAULTS={version:"1.0.0"},OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,markers:null,drawn:!1,initialize:function(e,t){OpenLayers.Layer.prototype.initialize.apply(this,arguments),this.markers=[]},destroy:function(){this.clearMarkers(),this.markers=null,OpenLayers.Layer.prototype.destroy.apply(this,arguments)},setOpacity:function(e){if(e!=this.opacity){this.opacity=e;for(var t=0,i=this.markers.length;t0;)this.removeMarker(this.markers[0])},drawMarker:function(e){var t=this.map.getLayerPxFromLonLat(e.lonlat);if(null==t)e.display(!1);else if(e.isDrawn())e.icon&&e.icon.moveTo(t);else{var i=e.draw(t);this.div.appendChild(i)}},getDataExtent:function(){e=null;if(this.markers&&this.markers.length>0)for(var e=new OpenLayers.Bounds,t=0,i=this.markers.length;t=0;--i)(t=this.targets[i]).layer===e&&this.removeTarget(t)},removeTarget:function(e){return OpenLayers.Util.removeItem(this.targets,e)},activate:function(){var e=OpenLayers.Control.prototype.activate.call(this);return e&&this.layer&&this.layer.events&&this.layer.events.on({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this}),e},deactivate:function(){var e=OpenLayers.Control.prototype.deactivate.call(this);return e&&this.layer&&this.layer.events&&this.layer.events.un({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this}),this.feature=null,this.point=null,e},onSketchModified:function(e){this.feature=e.feature,this.considerSnapping(e.vertex,e.vertex)},onVertexModified:function(e){this.feature=e.feature;var t=this.layer.map.getLonLatFromViewPortPx(e.pixel);this.considerSnapping(e.vertex,new OpenLayers.Geometry.Point(t.lon,t.lat))},considerSnapping:function(e,t){for(var i,n,s={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY,x:null,y:null},r=!1,a=0,o=this.targets.length;a=e.maxResolution)return null;for(var n,s,r,a,o,l,h,u={node:this.getGeoTolerance(e.nodeTolerance,i),vertex:this.getGeoTolerance(e.vertexTolerance,i),edge:this.getGeoTolerance(e.edgeTolerance,i)},p=Math.max(u.node,u.vertex,u.edge),c={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY},d=!1,f=e.layer.features,m=this.precedence.length,y=new OpenLayers.LonLat(t.x,t.y),g=0,v=f.length;g=this.maxDepth)return!1;var i=OpenLayers.Util.extend({},t);i.depth++;for(var n=0,s=e.length;n0){var u=h[0],p={features:[],feature:a};this.readNode(u,p),p.features.length>0&&i.push.apply(i,p.features)}}else i.push(a)}this.features=this.features.concat(i)},readers:{kml:{when:function(e,t){t.whens.push(OpenLayers.Date.parse(this.getChildValue(e)))},_trackPointAttribute:function(e,t){var i=e.nodeName.split(":").pop();t.attributes[i].push(this.getChildValue(e))}},gx:{Track:function(e,t){var i={whens:[],points:[],angles:[]};if(this.trackAttributes){i.attributes={};for(var n=0,s=this.trackAttributes.length;n0;if(r&&i.whens.length!==i.angles.length)throw new Error("gx:Track with unequal number of when ("+i.whens.length+") and gx:angles ("+i.angles.length+") elements.");for(var a,o,l,n=0,s=i.whens.length;n2&&(n.z=parseFloat(i[2])),t.points.push(n)},angles:function(e,t){var i=this.getChildValue(e).replace(this.regExes.trimSpace,"").split(/\s+/);t.angles.push(i)}}},parseFeature:function(e){for(var t,i,n,s,r=["MultiGeometry","Polygon","LineString","Point"],a=0,o=r.length;a0){if(!(s=this.parseGeometry[t.toLowerCase()]))throw new TypeError("Unsupported geometry type: "+t);n=s.apply(this,[i[0]]),this.internalProjection&&this.externalProjection&&n.transform(this.externalProjection,this.internalProjection);break}var l;this.extractAttributes&&(l=this.parseAttributes(e));var h=new OpenLayers.Feature.Vector(n,l),u=e.getAttribute("id")||e.getAttribute("name");return null!=u&&(h.fid=u),h},getStyle:function(e,t){var i=OpenLayers.Util.removeTail(e),n=OpenLayers.Util.extend({},t);if(n.depth++,n.styleBaseUrl=i,!this.styles[e]&&!OpenLayers.String.startsWith(e,"#")&&n.depth<=this.maxDepth&&!this.fetched[i]){var s=this.fetchLink(i);s&&this.parseData(s,n)}return OpenLayers.Util.extend({},this.styles[e])},parseGeometry:{point:function(e){var t=this.getElementsByTagNameNS(e,this.internalns,"coordinates"),i=[];if(t.length>0){var n=t[0].firstChild.nodeValue;i=(n=n.replace(this.regExes.removeSpace,"")).split(",")}if(!(i.length>1))throw"Bad coordinate string: "+n;return 2==i.length&&(i[2]=null),new OpenLayers.Geometry.Point(i[0],i[1],i[2])},linestring:function(e,t){var i=this.getElementsByTagNameNS(e,this.internalns,"coordinates"),n=null;if(i.length>0){for(var s,r=this.getChildValue(i[0]),a=(r=(r=r.replace(this.regExes.trimSpace,"")).replace(this.regExes.trimComma,",")).split(this.regExes.splitSpace),o=a.length,l=new Array(o),h=0;h1))throw"Bad LineString point coordinates: "+a[h];2==s.length&&(s[2]=null),l[h]=new OpenLayers.Geometry.Point(s[0],s[1],s[2])}if(!o)throw"Bad LineString coordinates: "+r;n=t?new OpenLayers.Geometry.LinearRing(l):new OpenLayers.Geometry.LineString(l)}return n},polygon:function(e){var t=this.getElementsByTagNameNS(e,this.internalns,"LinearRing"),i=t.length,n=new Array(i);if(i>0)for(var s,r=0,a=t.length;r=1&&s.length<=3){var l;switch(s.length){case 1:l=s[0];break;case 2:var h=s[0],u=s[1];l=3==h.nodeType||4==h.nodeType?h:u;break;case 3:default:l=s[1]}if(3==l.nodeType||4==l.nodeType){var p=n.prefix?n.nodeName.split(":")[1]:n.nodeName,c=OpenLayers.Util.getXmlNodeValue(l);c&&(c=c.replace(this.regExes.trimSpace,""),t[p]=c)}}return t},parseExtendedData:function(e){var t,i,n,s,r={},a=e.getElementsByTagName("Data");for(t=0,i=a.length;t0&&(d.prefix=f[0]),n.layers.push(d),void 0===d.formats&&(d.formats=m.getmap.formats),void 0===d.infoFormats&&y&&(d.infoFormats=y.formats)}},Attribution:function(e,t){t.attribution={},this.readChildNodes(e,t.attribution)},LogoURL:function(e,t){t.logo={width:e.getAttribute("width"),height:e.getAttribute("height")},this.readChildNodes(e,t.logo)},Style:function(e,t){var i={};t.styles.push(i),this.readChildNodes(e,i)},LegendURL:function(e,t){var i={width:e.getAttribute("width"),height:e.getAttribute("height")};t.legend=i,this.readChildNodes(e,i)},MetadataURL:function(e,t){var i={type:e.getAttribute("type")};t.metadataURLs.push(i),this.readChildNodes(e,i)},DataURL:function(e,t){t.dataURL={},this.readChildNodes(e,t.dataURL)},FeatureListURL:function(e,t){t.featureListURL={},this.readChildNodes(e,t.featureListURL)},AuthorityURL:function(e,t){var i=e.getAttribute("name"),n={};this.readChildNodes(e,n),t.authorityURLs[i]=n.href},Identifier:function(e,t){var i=e.getAttribute("authority");t.identifiers[i]=this.getChildValue(e)},KeywordList:function(e,t){this.readChildNodes(e,t)},SRS:function(e,t){t.srs[this.getChildValue(e)]=!0}}},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1"}),OpenLayers.Format.WMSCapabilities.v1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1,{readers:{wms:OpenLayers.Util.applyDefaults({WMT_MS_Capabilities:function(e,t){this.readChildNodes(e,t)},Keyword:function(e,t){t.keywords&&t.keywords.push(this.getChildValue(e))},DescribeLayer:function(e,t){t.describelayer={formats:[]},this.readChildNodes(e,t.describelayer)},GetLegendGraphic:function(e,t){t.getlegendgraphic={formats:[]},this.readChildNodes(e,t.getlegendgraphic)},GetStyles:function(e,t){t.getstyles={formats:[]},this.readChildNodes(e,t.getstyles)},PutStyles:function(e,t){t.putstyles={formats:[]},this.readChildNodes(e,t.putstyles)},UserDefinedSymbolization:function(e,t){var i={supportSLD:1==parseInt(e.getAttribute("SupportSLD")),userLayer:1==parseInt(e.getAttribute("UserLayer")),userStyle:1==parseInt(e.getAttribute("UserStyle")),remoteWFS:1==parseInt(e.getAttribute("RemoteWFS"))};t.userSymbols=i},LatLonBoundingBox:function(e,t){t.llbbox=[parseFloat(e.getAttribute("minx")),parseFloat(e.getAttribute("miny")),parseFloat(e.getAttribute("maxx")),parseFloat(e.getAttribute("maxy"))]},BoundingBox:function(e,t){var i=OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms.BoundingBox.apply(this,[e,t]);i.srs=e.getAttribute("SRS"),t.bbox[i.srs]=i},ScaleHint:function(e,t){var i=e.getAttribute("min"),n=e.getAttribute("max"),s=Math.pow(2,.5),r=OpenLayers.INCHES_PER_UNIT.m;0!=i&&(t.maxScale=parseFloat((i/s*r*OpenLayers.DOTS_PER_INCH).toPrecision(13))),n!=Number.POSITIVE_INFINITY&&(t.minScale=parseFloat((n/s*r*OpenLayers.DOTS_PER_INCH).toPrecision(13)))},Dimension:function(e,t){var i={name:e.getAttribute("name").toLowerCase(),units:e.getAttribute("units"),unitsymbol:e.getAttribute("unitSymbol")};t.dimensions[i.name]=i},Extent:function(e,t){var i=e.getAttribute("name").toLowerCase();if(i in t.dimensions){var n=t.dimensions[i];n.nearestVal="1"===e.getAttribute("nearestValue"),n.multipleVal="1"===e.getAttribute("multipleValues"),n.current="1"===e.getAttribute("current"),n.default=e.getAttribute("default")||"";var s=this.getChildValue(e);n.values=s.split(",")}}},OpenLayers.Format.WMSCapabilities.v1.prototype.readers.wms)},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1"}),OpenLayers.Format.WMSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.0",readers:{wms:OpenLayers.Util.applyDefaults({SRS:function(e,t){for(var i=this.getChildValue(e).split(/ +/),n=0,s=i.length;n1&&this.setGeometryName(null)},destroy:function(){this.options&&!this.options.format&&this.format.destroy(),this.format=null,OpenLayers.Protocol.prototype.destroy.apply(this)},read:function(e){OpenLayers.Protocol.prototype.read.apply(this,arguments),e=OpenLayers.Util.extend({},e),OpenLayers.Util.applyDefaults(e,this.options||{});var t=new OpenLayers.Protocol.Response({requestType:"read"}),i=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",e)]);return t.priv=OpenLayers.Request.POST({url:e.url,callback:this.createCallback(this.handleRead,t,e),params:e.params,headers:e.headers,data:i}),t},setFeatureType:function(e){this.featureType=e,this.format.featureType=e},setGeometryName:function(e){this.geometryName=e,this.format.geometryName=e},handleRead:function(e,t){if(t=OpenLayers.Util.extend({},t),OpenLayers.Util.applyDefaults(t,this.options),t.callback){var i=e.priv;if(i.status>=200&&i.status<300){var n=this.parseResponse(i,t.readOptions);n&&!1!==n.success?(t.readOptions&&"object"==t.readOptions.output?OpenLayers.Util.extend(e,n):e.features=n,e.code=OpenLayers.Protocol.Response.SUCCESS):(e.code=OpenLayers.Protocol.Response.FAILURE,e.error=n)}else e.code=OpenLayers.Protocol.Response.FAILURE;t.callback.call(t.scope,e)}},parseResponse:function(e,t){var i=e.responseXML;if(i&&i.documentElement||(i=e.responseText),!i||i.length<=0)return null;var n=null!==this.readFormat?this.readFormat.read(i):this.format.read(i,t);if(!this.featureNS){var s=this.readFormat||this.format;this.featureNS=s.featureNS,s.autoConfig=!1,this.geometryName||this.setGeometryName(s.geometryName)}return n},commit:function(e,t){t=OpenLayers.Util.extend({},t),OpenLayers.Util.applyDefaults(t,this.options);var i=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:e});return i.priv=OpenLayers.Request.POST({url:t.url,headers:t.headers,data:this.format.write(e,t),callback:this.createCallback(this.handleCommit,i,t)}),i},handleCommit:function(e,t){if(t.callback){var i=e.priv,n=i.responseXML;n&&n.documentElement||(n=i.responseText);var s=this.format.read(n)||{};e.insertIds=s.insertIds||[],s.success?e.code=OpenLayers.Protocol.Response.SUCCESS:(e.code=OpenLayers.Protocol.Response.FAILURE,e.error=s),t.callback.call(t.scope,e)}},filterDelete:function(e,t){t=OpenLayers.Util.extend({},t),OpenLayers.Util.applyDefaults(t,this.options);new OpenLayers.Protocol.Response({requestType:"commit"});var i=this.format.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}}),n=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(t.featureNS?this.featurePrefix+":":"")+t.featureType}});t.featureNS&&n.setAttribute("xmlns:"+this.featurePrefix,t.featureNS);var s=this.format.writeNode("ogc:Filter",e);n.appendChild(s),i.appendChild(n);var r=OpenLayers.Format.XML.prototype.write.apply(this.format,[i]);return OpenLayers.Request.POST({url:this.url,callback:t.callback||function(){},data:r})},abort:function(e){e&&e.priv.abort()},CLASS_NAME:"OpenLayers.Protocol.WFS.v1"}),OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{in:"click",out:"clickout"},mousemove:{in:"over",out:"out"},dblclick:{in:"dblclick",out:null},mousedown:{in:null,out:null},mouseup:{in:null,out:null},touchstart:{in:"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(e,t,i,n){OpenLayers.Handler.prototype.initialize.apply(this,[e,i,n]),this.layer=t},touchstart:function(e){return this.startTouch(),!!OpenLayers.Event.isMultiTouch(e)||this.mousedown(e)},touchmove:function(e){OpenLayers.Event.preventDefault(e)},mousedown:function(e){return(OpenLayers.Event.isLeftClick(e)||OpenLayers.Event.isSingleTouch(e))&&(this.down=e.xy),!this.handle(e)||!this.stopDown},mouseup:function(e){return this.up=e.xy,!this.handle(e)||!this.stopUp},click:function(e){return!this.handle(e)||!this.stopClick},mousemove:function(e){return!this.callbacks.over&&!this.callbacks.out||(this.handle(e),!0)},dblclick:function(e){return!this.handle(e)},geometryTypeMatches:function(e){return null==this.geometryTypes||OpenLayers.Util.indexOf(this.geometryTypes,e.geometry.CLASS_NAME)>-1},handle:function(e){this.feature&&!this.feature.layer&&(this.feature=null);var t=e.type,i=!1,n=!!this.feature,s="click"==t||"dblclick"==t||"touchstart"==t;if(this.feature=this.layer.getFeatureFromEvent(e),this.feature&&!this.feature.layer&&(this.feature=null),this.lastFeature&&!this.lastFeature.layer&&(this.lastFeature=null),this.feature){"touchstart"===t&&OpenLayers.Event.preventDefault(e);var r=this.feature!=this.lastFeature;this.geometryTypeMatches(this.feature)?(n&&r?(this.lastFeature&&this.triggerCallback(t,"out",[this.lastFeature]),this.triggerCallback(t,"in",[this.feature])):n&&!s||this.triggerCallback(t,"in",[this.feature]),this.lastFeature=this.feature,i=!0):(this.lastFeature&&(n&&r||s)&&this.triggerCallback(t,"out",[this.lastFeature]),this.feature=null)}else this.lastFeature&&(n||s)&&this.triggerCallback(t,"out",[this.lastFeature]);return i},triggerCallback:function(e,t,i){var n=this.EVENTMAP[e][t];n&&("click"==e&&this.up&&this.down?(Math.sqrt(Math.pow(this.up.x-this.down.x,2)+Math.pow(this.up.y-this.down.y,2))<=this.clickTolerance&&this.callback(n,i),this.up=this.down=null):this.callback(n,i))},activate:function(){var e=!1;return OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.moveLayerToTop(),this.map.events.on({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),e=!0),e},deactivate:function(){var e=!1;return OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.moveLayerBack(),this.feature=null,this.lastFeature=null,this.down=null,this.up=null,this.map.events.un({removelayer:this.handleMapEvents,changelayer:this.handleMapEvents,scope:this}),e=!0),e},handleMapEvents:function(e){"removelayer"!=e.type&&"order"!=e.property||this.moveLayerToTop()},moveLayerToTop:function(){var e=Math.max(this.map.Z_INDEX_BASE.Feature-1,this.layer.getZIndex())+1;this.layer.setZIndex(e)},moveLayerBack:function(){var e=this.layer.getZIndex()-1;e>=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(e):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"}),OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:!1,layers:null,display:function(){},getFeatureFromEvent:function(e){for(var t,i=this.layers,n=0;ns;)i=t.selectedFeatures[s],e&&e.except==i?++s:this.unselect(i)},clickFeature:function(e){this.hover||(OpenLayers.Util.indexOf(e.layer.selectedFeatures,e)>-1?this.toggleSelect()?this.unselect(e):this.multipleSelect()||this.unselectAll({except:e}):(this.multipleSelect()||this.unselectAll({except:e}),this.select(e)))},multipleSelect:function(){return this.multiple||this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]},toggleSelect:function(){return this.toggle||this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]},clickoutFeature:function(e){!this.hover&&this.clickout&&this.unselectAll()},overFeature:function(e){var t=e.layer;this.hover&&(this.highlightOnly?this.highlight(e):-1==OpenLayers.Util.indexOf(t.selectedFeatures,e)&&this.select(e))},outFeature:function(e){if(this.hover)if(this.highlightOnly){if(e._lastHighlighter==this.id)if(e._prevHighlighter&&e._prevHighlighter!=this.id){delete e._lastHighlighter;var t=this.map.getControl(e._prevHighlighter);t&&t.highlight(e)}else this.unhighlight(e)}else this.unselect(e)},highlight:function(e){var t=e.layer;if(!1!==this.events.triggerEvent("beforefeaturehighlighted",{feature:e})){e._prevHighlighter=e._lastHighlighter,e._lastHighlighter=this.id;var i=this.selectStyle||this.renderIntent;t.drawFeature(e,i),this.events.triggerEvent("featurehighlighted",{feature:e})}},unhighlight:function(e){var t=e.layer;void 0==e._prevHighlighter?delete e._lastHighlighter:e._prevHighlighter==this.id?delete e._prevHighlighter:(e._lastHighlighter=e._prevHighlighter,delete e._prevHighlighter),t.drawFeature(e,e.style||e.layer.style||"default"),this.events.triggerEvent("featureunhighlighted",{feature:e})},select:function(e){var t=this.onBeforeSelect.call(this.scope,e),i=e.layer;!1!==t&&!1!==(t=i.events.triggerEvent("beforefeatureselected",{feature:e}))&&(i.selectedFeatures.push(e),this.highlight(e),this.handlers.feature.lastFeature||(this.handlers.feature.lastFeature=i.selectedFeatures[0]),i.events.triggerEvent("featureselected",{feature:e}),this.onSelect.call(this.scope,e))},unselect:function(e){var t=e.layer;this.unhighlight(e),OpenLayers.Util.removeItem(t.selectedFeatures,e),t.events.triggerEvent("featureunselected",{feature:e}),this.onUnselect.call(this.scope,e)},selectBox:function(e){if(e instanceof OpenLayers.Bounds){var t=this.map.getLonLatFromPixel({x:e.left,y:e.bottom}),i=this.map.getLonLatFromPixel({x:e.right,y:e.top}),n=new OpenLayers.Bounds(t.lon,t.lat,i.lon,i.lat);this.multipleSelect()||this.unselectAll();var s=this.multiple;this.multiple=!0;var r=this.layers||[this.layer];this.events.triggerEvent("boxselectionstart",{layers:r});for(var a,o=0;o-1)&&n.toGeometry().intersects(u.geometry)&&-1==OpenLayers.Util.indexOf(a.selectedFeatures,u)&&this.select(u))}this.multiple=s,this.events.triggerEvent("boxselectionend",{layers:r})}},setMap:function(e){this.handlers.feature.setMap(e),this.box&&this.handlers.box.setMap(e),OpenLayers.Control.prototype.setMap.apply(this,arguments)},setLayer:function(e){var t=this.active;this.unselectAll(),this.deactivate(),this.layers&&(this.layer.destroy(),this.layers=null),this.initLayer(e),this.handlers.feature.layer=this.layer,t&&this.activate()},CLASS_NAME:"OpenLayers.Control.SelectFeature"}),OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:!1,citeCompliant:!1,mouseDown:!1,stoppedDown:null,lastDown:null,lastUp:null,persist:!1,stopDown:!1,stopUp:!1,layerOptions:null,pixelTolerance:5,lastTouchPx:null,initialize:function(e,t,i){i&&i.layerOptions&&i.layerOptions.styleMap||(this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style.default,{})),OpenLayers.Handler.prototype.initialize.apply(this,arguments)},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments))return!1;var e=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions);return this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,e),this.map.addLayer(this.layer),!0},createFeature:function(e){var t=this.layer.getLonLatFromViewPortPx(e),i=new OpenLayers.Geometry.Point(t.lon,t.lat);this.point=new OpenLayers.Feature.Vector(i),this.callback("create",[this.point.geometry,this.point]),this.point.geometry.clearBounds(),this.layer.addFeatures([this.point],{silent:!0})},deactivate:function(){return!!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.cancel(),null!=this.layer.map&&(this.destroyFeature(!0),this.layer.destroy(!1)),this.layer=null,!0)},destroyFeature:function(e){!this.layer||!e&&this.persist||this.layer.destroyFeatures(),this.point=null},destroyPersistedFeature:function(){var e=this.layer;e&&e.features.length>1&&this.layer.features[0].destroy()},finalize:function(e){var t=e?"cancel":"done";this.mouseDown=!1,this.lastDown=null,this.lastUp=null,this.lastTouchPx=null,this.callback(t,[this.geometryClone()]),this.destroyFeature(e)},cancel:function(){this.finalize(!0)},click:function(e){return OpenLayers.Event.stop(e),!1},dblclick:function(e){return OpenLayers.Event.stop(e),!1},modifyFeature:function(e){this.point||this.createFeature(e);var t=this.layer.getLonLatFromViewPortPx(e);this.point.geometry.x=t.lon,this.point.geometry.y=t.lat,this.callback("modify",[this.point.geometry,this.point,!1]),this.point.geometry.clearBounds(),this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.point,this.style)},getGeometry:function(){var e=this.point&&this.point.geometry;return e&&this.multi&&(e=new OpenLayers.Geometry.MultiPoint([e])),e},geometryClone:function(){var e=this.getGeometry();return e&&e.clone()},mousedown:function(e){return this.down(e)},touchstart:function(e){return this.startTouch(),this.lastTouchPx=e.xy,this.down(e)},mousemove:function(e){return this.move(e)},touchmove:function(e){return this.lastTouchPx=e.xy,this.move(e)},mouseup:function(e){return this.up(e)},touchend:function(e){return e.xy=this.lastTouchPx,this.up(e)},down:function(e){return this.mouseDown=!0,this.lastDown=e.xy,this.touch||this.modifyFeature(e.xy),this.stoppedDown=this.stopDown,!this.stopDown},move:function(e){return this.touch||this.mouseDown&&!this.stoppedDown||this.modifyFeature(e.xy),!0},up:function(e){return this.mouseDown=!1,this.stoppedDown=this.stopDown,!this.checkModifiers(e)||(!(!this.lastUp||!this.lastUp.equals(e.xy))||(!this.lastDown||!this.passesTolerance(this.lastDown,e.xy,this.pixelTolerance)||(this.touch&&this.modifyFeature(e.xy),this.persist&&this.destroyPersistedFeature(),this.lastUp=e.xy,this.finalize(),!this.stopUp)))},mouseout:function(e){OpenLayers.Util.mouseLeft(e,this.map.viewPortDiv)&&(this.stoppedDown=this.stopDown,this.mouseDown=!1)},passesTolerance:function(e,t,i){var n=!0;return null!=i&&e&&t&&e.distanceTo(t)>i&&(n=!1),n},CLASS_NAME:"OpenLayers.Handler.Point"}),OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:!1,freehandToggle:"shiftKey",timerId:null,redoStack:null,createFeature:function(e){var t=this.layer.getLonLatFromViewPortPx(e),i=new OpenLayers.Geometry.Point(t.lon,t.lat);this.point=new OpenLayers.Feature.Vector(i),this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry])),this.callback("create",[this.point.geometry,this.getSketch()]),this.point.geometry.clearBounds(),this.layer.addFeatures([this.line,this.point],{silent:!0})},destroyFeature:function(e){OpenLayers.Handler.Point.prototype.destroyFeature.call(this,e),this.line=null},destroyPersistedFeature:function(){var e=this.layer;e&&e.features.length>2&&this.layer.features[0].destroy()},removePoint:function(){this.point&&this.layer.removeFeatures([this.point])},addPoint:function(e){this.layer.removeFeatures([this.point]);var t=this.layer.getLonLatFromViewPortPx(e);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t.lon,t.lat)),this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length),this.layer.addFeatures([this.point]),this.callback("point",[this.point.geometry,this.getGeometry()]),this.callback("modify",[this.point.geometry,this.getSketch()]),this.drawFeature(),delete this.redoStack},insertXY:function(e,t){this.line.geometry.addComponent(new OpenLayers.Geometry.Point(e,t),this.getCurrentPointIndex()),this.drawFeature(),delete this.redoStack},insertDeltaXY:function(e,t){var i=this.getCurrentPointIndex()-1,n=this.line.geometry.components[i];!n||isNaN(n.x)||isNaN(n.y)||this.insertXY(n.x+e,n.y+t)},insertDirectionLength:function(e,t){e*=Math.PI/180;var i=t*Math.cos(e),n=t*Math.sin(e);this.insertDeltaXY(i,n)},insertDeflectionLength:function(e,t){var i=this.getCurrentPointIndex()-1;if(i>0){var n=this.line.geometry.components[i],s=this.line.geometry.components[i-1],r=Math.atan2(n.y-s.y,n.x-s.x);this.insertDirectionLength(180*r/Math.PI+e,t)}},getCurrentPointIndex:function(){return this.line.geometry.components.length-1},undo:function(){var e=this.line.geometry,t=e.components,i=this.getCurrentPointIndex()-1,n=t[i],s=e.removeComponent(n);if(s){if(this.touch&&i>0){var r=(t=e.components)[i-1],a=t[this.getCurrentPointIndex()];a.x=r.x,a.y=r.y}this.redoStack||(this.redoStack=[]),this.redoStack.push(n),this.drawFeature()}return s},redo:function(){var e=this.redoStack&&this.redoStack.pop();return e&&(this.line.geometry.addComponent(e,this.getCurrentPointIndex()),this.drawFeature()),!!e},freehandMode:function(e){return this.freehandToggle&&e[this.freehandToggle]?!this.freehand:this.freehand},modifyFeature:function(e,t){this.line||this.createFeature(e);var i=this.layer.getLonLatFromViewPortPx(e);this.point.geometry.x=i.lon,this.point.geometry.y=i.lat,this.callback("modify",[this.point.geometry,this.getSketch(),t]),this.point.geometry.clearBounds(),this.drawFeature()},drawFeature:function(){this.layer.drawFeature(this.line,this.style),this.layer.drawFeature(this.point,this.style)},getSketch:function(){return this.line},getGeometry:function(){var e=this.line&&this.line.geometry;return e&&this.multi&&(e=new OpenLayers.Geometry.MultiLineString([e])),e},touchstart:function(e){return this.timerId&&this.passesTolerance(this.lastTouchPx,e.xy,this.doubleTouchTolerance)?(this.finishGeometry(),window.clearTimeout(this.timerId),this.timerId=null,!1):(this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null),this.timerId=window.setTimeout(OpenLayers.Function.bind(function(){this.timerId=null},this),300),OpenLayers.Handler.Point.prototype.touchstart.call(this,e))},down:function(e){var t=this.stopDown;return this.freehandMode(e)&&(t=!0,this.touch&&(this.modifyFeature(e.xy,!!this.lastUp),OpenLayers.Event.stop(e))),this.touch||this.lastDown&&this.passesTolerance(this.lastDown,e.xy,this.pixelTolerance)||this.modifyFeature(e.xy,!!this.lastUp),this.mouseDown=!0,this.lastDown=e.xy,this.stoppedDown=t,!t},move:function(e){return this.stoppedDown&&this.freehandMode(e)?(this.persist&&this.destroyPersistedFeature(),this.maxVertices&&this.line&&this.line.geometry.components.length===this.maxVertices?(this.removePoint(),this.finalize()):this.addPoint(e.xy),!1):(this.touch||this.mouseDown&&!this.stoppedDown||this.modifyFeature(e.xy,!!this.lastUp),!0)},up:function(e){return!this.mouseDown||this.lastUp&&this.lastUp.equals(e.xy)||(this.stoppedDown&&this.freehandMode(e)?(this.persist&&this.destroyPersistedFeature(),this.removePoint(),this.finalize()):this.passesTolerance(this.lastDown,e.xy,this.pixelTolerance)&&(this.touch&&this.modifyFeature(e.xy),null==this.lastUp&&this.persist&&this.destroyPersistedFeature(),this.addPoint(e.xy),this.lastUp=e.xy,this.line.geometry.components.length===this.maxVertices+1&&this.finishGeometry())),this.stoppedDown=this.stopDown,this.mouseDown=!1,!this.stopUp},finishGeometry:function(){var e=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[e]),this.removePoint(),this.finalize()},dblclick:function(e){return this.freehandMode(e)||this.finishGeometry(),!1},CLASS_NAME:"OpenLayers.Handler.Path"}),OpenLayers.Spherical=OpenLayers.Spherical||{},OpenLayers.Spherical.DEFAULT_RADIUS=6378137,OpenLayers.Spherical.computeDistanceBetween=function(e,t,i){var n=i||OpenLayers.Spherical.DEFAULT_RADIUS,s=Math.sin(Math.PI*(t.lon-e.lon)/360),r=Math.sin(Math.PI*(t.lat-e.lat)/360),a=r*r+s*s*Math.cos(Math.PI*e.lat/180)*Math.cos(Math.PI*t.lat/180);return 2*n*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))},OpenLayers.Spherical.computeHeading=function(e,t){var i=Math.sin(Math.PI*(e.lon-t.lon)/180)*Math.cos(Math.PI*t.lat/180),n=Math.cos(Math.PI*e.lat/180)*Math.sin(Math.PI*t.lat/180)-Math.sin(Math.PI*e.lat/180)*Math.cos(Math.PI*t.lat/180)*Math.cos(Math.PI*(e.lon-t.lon)/180);return 180*Math.atan2(i,n)/Math.PI},OpenLayers.Control.CacheWrite=OpenLayers.Class(OpenLayers.Control,{layers:null,imageFormat:"image/png",quotaRegEx:/quota/i,setMap:function(e){OpenLayers.Control.prototype.setMap.apply(this,arguments);var t,i=this.layers||e.layers;for(t=i.length-1;t>=0;--t)this.addLayer({layer:i[t]});this.layers||e.events.on({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this})},addLayer:function(e){e.layer.events.on({tileloadstart:this.makeSameOrigin,tileloaded:this.onTileLoaded,scope:this})},removeLayer:function(e){e.layer.events.un({tileloadstart:this.makeSameOrigin,tileloaded:this.onTileLoaded,scope:this})},makeSameOrigin:function(e){if(this.active){var t=e.tile;if(t instanceof OpenLayers.Tile.Image&&!t.crossOriginKeyword&&"data:"!==t.url.substr(0,5)){var i=OpenLayers.Request.makeSameOrigin(t.url,OpenLayers.ProxyHost);OpenLayers.Control.CacheWrite.urlMap[i]=t.url,t.url=i}}},onTileLoaded:function(e){this.active&&!e.aborted&&e.tile instanceof OpenLayers.Tile.Image&&"data:"!==e.tile.url.substr(0,5)&&(this.cache({tile:e.tile}),delete OpenLayers.Control.CacheWrite.urlMap[e.tile.url])},cache:function(e){if(window.localStorage){var t=e.tile;try{var i=t.getCanvasContext();if(i){var n=OpenLayers.Control.CacheWrite.urlMap[t.url]||t.url;window.localStorage.setItem("olCache_"+n,i.canvas.toDataURL(this.imageFormat))}}catch(e){var s=e.name||e.message;s&&this.quotaRegEx.test(s)?this.events.triggerEvent("cachefull",{tile:t}):OpenLayers.Console.error(e.toString())}}},destroy:function(){if(this.layers||this.map){var e,t=this.layers||this.map.layers;for(e=t.length-1;e>=0;--e)this.removeLayer({layer:t[e]})}this.map&&this.map.events.un({addlayer:this.addLayer,removeLayer:this.removeLayer,scope:this}),OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.CacheWrite"}),OpenLayers.Control.CacheWrite.clearCache=function(){if(window.localStorage){var e,t;for(e=window.localStorage.length-1;e>=0;--e)"olCache_"===(t=window.localStorage.key(e)).substr(0,8)&&window.localStorage.removeItem(t)}},OpenLayers.Control.CacheWrite.urlMap={},OpenLayers.Format.Context=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{layerOptions:null,layerParams:null,read:function(e,t){var i,n=OpenLayers.Format.XML.VersionedOGC.prototype.read.apply(this,arguments);if(t&&t.map)if(this.context=n,t.map instanceof OpenLayers.Map)i=this.mergeContextToMap(n,t.map);else{var s=t.map;(OpenLayers.Util.isElement(s)||"string"==typeof s)&&(s={div:s}),i=this.contextToMap(n,s)}else i=n;return i},getLayerFromContext:function(e){var t,i,n={queryable:e.queryable,visibility:e.visibility,maxExtent:e.maxExtent,metadata:OpenLayers.Util.applyDefaults(e.metadata,{styles:e.styles,formats:e.formats,abstract:e.abstract,dataURL:e.dataURL}),numZoomLevels:e.numZoomLevels,units:e.units,isBaseLayer:e.isBaseLayer,opacity:e.opacity,displayInLayerSwitcher:e.displayInLayerSwitcher,singleTile:e.singleTile,tileSize:e.tileSize?new OpenLayers.Size(e.tileSize.width,e.tileSize.height):void 0,minScale:e.minScale||e.maxScaleDenominator,maxScale:e.maxScale||e.minScaleDenominator,srs:e.srs,dimensions:e.dimensions,metadataURL:e.metadataURL};this.layerOptions&&OpenLayers.Util.applyDefaults(n,this.layerOptions);var s={layers:e.name,transparent:e.transparent,version:e.version};if(e.formats&&e.formats.length>0)for(s.format=e.formats[0].value,t=0,i=e.formats.length;t0)for(t=0,i=e.styles.length;t0)for(var n=0,s=e.metadata.formats.length;n0)for(var n=0,s=e.metadata.styles.length;n0&&this.read_wmc_OnlineResource(t,i[0]),t.href},CLASS_NAME:"OpenLayers.Format.WMC.v1"}),OpenLayers.Control.PanPanel=OpenLayers.Class(OpenLayers.Control.Panel,{slideFactor:50,slideRatio:null,initialize:function(e){OpenLayers.Control.Panel.prototype.initialize.apply(this,[e]);var e={slideFactor:this.slideFactor,slideRatio:this.slideRatio};this.addControls([new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,e),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,e),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,e),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,e)])},CLASS_NAME:"OpenLayers.Control.PanPanel"}),OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",template:"${layers}",destroy:function(){this.map.events.un({removelayer:this.updateAttribution,addlayer:this.updateAttribution,changelayer:this.updateAttribution,changebaselayer:this.updateAttribution,scope:this}),OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){return OpenLayers.Control.prototype.draw.apply(this,arguments),this.map.events.on({changebaselayer:this.updateAttribution,changelayer:this.updateAttribution,addlayer:this.updateAttribution,removelayer:this.updateAttribution,scope:this}),this.updateAttribution(),this.div},updateAttribution:function(){var e=[];if(this.map&&this.map.layers){for(var t=0,i=this.map.layers.length;tthis.nbPoints&&this.points.pop()},end:function(e){for(var t,i,n=(new Date).getTime(),s=0,r=this.points.length;sthis.delay));s++)t=i;if(t){var a=(new Date).getTime()-t.tick,o=Math.sqrt(Math.pow(e.x-t.xy.x,2)+Math.pow(e.y-t.xy.y,2)),l=o/a;if(!(0==l||l'),c+=l,u&&(c+=""),c+="",c+='
',c+=h,c+="
",o.popupContentHTML=c}var d=new OpenLayers.Feature(this,p,o);this.features.push(d);var f=d.createMarker();f.events.register("click",d,this.markerClick),this.addMarker(f)}}this.events.triggerEvent("loadend")},markerClick:function(e){var t=this==this.layer.selectedFeature;this.layer.selectedFeature=t?null:this;for(var i=0,n=this.layer.map.popups.length;i0;){var e=this.features[0];OpenLayers.Util.removeItem(this.features,e),e.destroy()}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"}),OpenLayers.Symbolizer.Point=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(e){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Point"}),OpenLayers.Symbolizer.Line=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(e){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Line"}),OpenLayers.Symbolizer.Text=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(e){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Text"}),OpenLayers.Format.SLD.v1=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,{namespaces:{sld:"http://www.opengis.net/sld",ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"sld",schemaLocation:null,multipleSymbolizers:!1,featureTypeCounter:null,defaultSymbolizer:{fillColor:"#808080",fillOpacity:1,strokeColor:"#000000",strokeOpacity:1,strokeWidth:1,strokeDashstyle:"solid",pointRadius:3,graphicName:"square"},read:function(e,t){var i={namedLayers:!0===(t=OpenLayers.Util.applyDefaults(t,this.options)).namedLayersAsArray?[]:{}};return this.readChildNodes(e,i),i},readers:OpenLayers.Util.applyDefaults({sld:{StyledLayerDescriptor:function(e,t){t.version=e.getAttribute("version"),this.readChildNodes(e,t)},Name:function(e,t){t.name=this.getChildValue(e)},Title:function(e,t){t.title=this.getChildValue(e)},Abstract:function(e,t){t.description=this.getChildValue(e)},NamedLayer:function(e,t){var i={userStyles:[],namedStyles:[]};this.readChildNodes(e,i);for(var n=0,s=i.userStyles.length;n1/3&&s<2/3?n="c":s>=2/3&&(n="r"),r<=1/3?n+="b":r>1/3&&r<2/3?n+="m":r>=2/3&&(n+="t"),i.labelAlign=n,OpenLayers.Util.applyDefaults(t,i)},AnchorPoint:function(e,t){this.readChildNodes(e,t)},AnchorPointX:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.labelAnchorPointX=i)},AnchorPointY:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.labelAnchorPointY=i)},Displacement:function(e,t){this.readChildNodes(e,t)},DisplacementX:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.labelXOffset=i)},DisplacementY:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.labelYOffset=i)},LinePlacement:function(e,t){this.readChildNodes(e,t)},PerpendicularOffset:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.labelPerpendicularOffset=i)},Label:function(e,t){var i=this.readers.ogc._expression.call(this,e);i&&(t.label=i)},Font:function(e,t){this.readChildNodes(e,t)},Halo:function(e,t){var i={};this.readChildNodes(e,i),t.haloRadius=i.haloRadius,t.haloColor=i.fillColor,t.haloOpacity=i.fillOpacity},Radius:function(e,t){var i=this.readers.ogc._expression.call(this,e);null!=i&&(t.haloRadius=i)},RasterSymbolizer:function(e,t){var i={};this.readChildNodes(e,i),this.multipleSymbolizers?(i.zIndex=this.featureTypeCounter,t.symbolizers.push(new OpenLayers.Symbolizer.Raster(i))):t.symbolizer.Raster=OpenLayers.Util.applyDefaults(i,t.symbolizer.Raster)},Geometry:function(e,t){t.geometry={},this.readChildNodes(e,t.geometry)},ColorMap:function(e,t){t.colorMap=[],this.readChildNodes(e,t.colorMap)},ColorMapEntry:function(e,t){var i=e.getAttribute("quantity"),n=e.getAttribute("opacity");t.push({color:e.getAttribute("color"),quantity:null!==i?parseFloat(i):void 0,label:e.getAttribute("label")||void 0,opacity:null!==n?parseFloat(n):void 0})},LineSymbolizer:function(e,t){var i={};this.readChildNodes(e,i),this.multipleSymbolizers?(i.zIndex=this.featureTypeCounter,t.symbolizers.push(new OpenLayers.Symbolizer.Line(i))):t.symbolizer.Line=OpenLayers.Util.applyDefaults(i,t.symbolizer.Line)},PolygonSymbolizer:function(e,t){var i={fill:!1,stroke:!1};this.multipleSymbolizers||(i=t.symbolizer.Polygon||i),this.readChildNodes(e,i),this.multipleSymbolizers?(i.zIndex=this.featureTypeCounter,t.symbolizers.push(new OpenLayers.Symbolizer.Polygon(i))):t.symbolizer.Polygon=i},PointSymbolizer:function(e,t){var i={fill:!1,stroke:!1,graphic:!1};this.multipleSymbolizers||(i=t.symbolizer.Point||i),this.readChildNodes(e,i),this.multipleSymbolizers?(i.zIndex=this.featureTypeCounter,t.symbolizers.push(new OpenLayers.Symbolizer.Point(i))):t.symbolizer.Point=i},Stroke:function(e,t){t.stroke=!0,this.readChildNodes(e,t)},Fill:function(e,t){t.fill=!0,this.readChildNodes(e,t)},CssParameter:function(e,t){var i=e.getAttribute("name"),n=this.cssMap[i];if(t.label&&("fill"===i?n="fontColor":"fill-opacity"===i&&(n="fontOpacity")),n){var s=this.readers.ogc._expression.call(this,e);s&&(t[n]=s)}},Graphic:function(e,t){t.graphic=!0;var i={};this.readChildNodes(e,i);for(var n,s,r=["stroke","strokeColor","strokeWidth","strokeOpacity","strokeLinecap","fill","fillColor","fillOpacity","graphicName","rotation","graphicFormat"],a=0,o=r.length;a0?(this.writeNode("ogc:PropertyName",{property:s.substring(0,r)},i),i.appendChild(this.createTextNode(s.substring(++r)))):i.appendChild(this.createTextNode("${"+s));return i},StyledLayerDescriptor:function(e){var t=this.createElementNSPlus("sld:StyledLayerDescriptor",{attributes:{version:this.VERSION,"xsi:schemaLocation":this.schemaLocation}});if(t.setAttribute("xmlns:ogc",this.namespaces.ogc),t.setAttribute("xmlns:gml",this.namespaces.gml),e.name&&this.writeNode("Name",e.name,t),e.title&&this.writeNode("Title",e.title,t),e.description&&this.writeNode("Abstract",e.description,t),OpenLayers.Util.isArray(e.namedLayers))for(var i=0,n=e.namedLayers.length;i0&&((a=e.clone()).rules=o[l[h]],this.writeNode("FeatureTypeStyle",a,t))}else this.writeNode("FeatureTypeStyle",e,t);return t},IsDefault:function(e){return this.createElementNSPlus("sld:IsDefault",{value:e?"1":"0"})},FeatureTypeStyle:function(e){for(var t=this.createElementNSPlus("sld:FeatureTypeStyle"),i=0,n=e.rules.length;i=1.3&&!i.EXCEPTIONS&&(i.EXCEPTIONS="INIMAGE"),s.push(e,t,i,n),OpenLayers.Layer.Grid.prototype.initialize.apply(this,s),OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)),!this.noMagic&&this.params.TRANSPARENT&&"true"==this.params.TRANSPARENT.toString().toLowerCase()&&(null!=n&&n.isBaseLayer||(this.isBaseLayer=!1),"image/jpeg"==this.params.FORMAT&&(this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"))},clone:function(e){return null==e&&(e=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions())),e=OpenLayers.Layer.Grid.prototype.clone.apply(this,[e])},reverseAxisOrder:function(){var e=this.projection.getCode();return parseFloat(this.params.VERSION)>=1.3&&!!(this.yx[e]||OpenLayers.Projection.defaults[e]&&OpenLayers.Projection.defaults[e].yx)},getURL:function(e){e=this.adjustBounds(e);var t=this.getImageSize(),i={},n=this.reverseAxisOrder();return i.BBOX=this.encodeBBOX?e.toBBOX(null,n):e.toArray(n),i.WIDTH=t.w,i.HEIGHT=t.h,this.getFullRequestString(i)},mergeNewParams:function(e){var t=[OpenLayers.Util.upperCaseObject(e)];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,t)},getFullRequestString:function(e,t){var i=this.map.getProjectionObject(),n=this.projection&&this.projection.equals(i)?this.projection.getCode():i.getCode(),s="none"==n?null:n;return parseFloat(this.params.VERSION)>=1.3?this.params.CRS=s:this.params.SRS=s,"boolean"==typeof this.params.TRANSPARENT&&(e.TRANSPARENT=this.params.TRANSPARENT?"TRUE":"FALSE"),OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"}),OpenLayers.Layer.KaMap=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,DEFAULT_PARAMS:{i:"jpeg",map:""},initialize:function(e,t,i,n){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments),this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS)},getURL:function(e){e=this.adjustBounds(e);var t=this.map.getResolution(),i=Math.round(1e4*this.map.getScale())/1e4,n=Math.round(e.left/t),s=-Math.round(e.top/t);return this.getFullRequestString({t:s,l:n,s:i})},calculateGridLayout:function(e,t,i){var n=i*this.tileSize.w,s=i*this.tileSize.h,r=e.left,a=Math.floor(r/n)-this.buffer,o=e.top;return{tilelon:n,tilelat:s,startcol:a,startrow:Math.floor(o/s)+this.buffer}},getTileBoundsForGridIndex:function(e,t){this.getTileOrigin();var i=this.gridLayout,n=i.tilelon,s=i.tilelat,r=(i.startcol+t)*n,a=(i.startrow-e)*s;return new OpenLayers.Bounds(r,a,r+n,a+s)},clone:function(e){return null==e&&(e=new OpenLayers.Layer.KaMap(this.name,this.url,this.params,this.getOptions())),e=OpenLayers.Layer.Grid.prototype.clone.apply(this,[e]),null!=this.tileSize&&(e.tileSize=this.tileSize.clone()),e.grid=[],e},getTileBounds:function(e){var t=this.getResolution(),i=t*this.tileSize.w,n=t*this.tileSize.h,s=this.getLonLatFromViewPortPx(e),r=i*Math.floor(s.lon/i),a=n*Math.floor(s.lat/n);return new OpenLayers.Bounds(r,a,r+i,a+n)},CLASS_NAME:"OpenLayers.Layer.KaMap"}),OpenLayers.Format.WMC.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",initialize:function(e){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[e])},read_sld_MinScaleDenominator:function(e,t){var i=parseFloat(this.getChildValue(t));i>0&&(e.maxScale=i)},read_sld_MaxScaleDenominator:function(e,t){e.minScale=parseFloat(this.getChildValue(t))},read_wmc_SRS:function(e,t){"srs"in e||(e.srs={}),e.srs[this.getChildValue(t)]=!0},write_wmc_Layer:function(e){var t=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(this,[e]);if(e.maxScale){var i=this.createElementNS(this.namespaces.sld,"sld:MinScaleDenominator");i.appendChild(this.createTextNode(e.maxScale.toPrecision(16))),t.appendChild(i)}if(e.minScale){var n=this.createElementNS(this.namespaces.sld,"sld:MaxScaleDenominator");n.appendChild(this.createTextNode(e.minScale.toPrecision(16))),t.appendChild(n)}if(e.srs)for(var s in e.srs)t.appendChild(this.createElementDefaultNS("SRS",s));return t.appendChild(this.write_wmc_FormatList(e)),t.appendChild(this.write_wmc_StyleList(e)),e.dimensions&&t.appendChild(this.write_wmc_DimensionList(e)),t.appendChild(this.write_wmc_LayerExtension(e)),t},CLASS_NAME:"OpenLayers.Format.WMC.v1_1_0"}),OpenLayers.Format.XLS=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.1.0",stringifyOutput:!0,CLASS_NAME:"OpenLayers.Format.XLS"}),OpenLayers.Format.XLS.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xls:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},xy:!0,defaultPrefix:"xls",schemaLocation:null,read:function(e,t){t=OpenLayers.Util.applyDefaults(t,this.options);var i={};return this.readChildNodes(e,i),i},readers:{xls:{XLS:function(e,t){t.version=e.getAttribute("version"),this.readChildNodes(e,t)},Response:function(e,t){this.readChildNodes(e,t)},GeocodeResponse:function(e,t){t.responseLists=[],this.readChildNodes(e,t)},GeocodeResponseList:function(e,t){var i={features:[],numberOfGeocodedAddresses:parseInt(e.getAttribute("numberOfGeocodedAddresses"))};t.responseLists.push(i),this.readChildNodes(e,i)},GeocodedAddress:function(e,t){var i=new OpenLayers.Feature.Vector;t.features.push(i),this.readChildNodes(e,i),i.geometry=i.components[0]},GeocodeMatchCode:function(e,t){t.attributes.matchCode={accuracy:parseFloat(e.getAttribute("accuracy")),matchType:e.getAttribute("matchType")}},Address:function(e,t){var i={countryCode:e.getAttribute("countryCode"),addressee:e.getAttribute("addressee"),street:[],place:[]};t.attributes.address=i,this.readChildNodes(e,i)},freeFormAddress:function(e,t){t.freeFormAddress=this.getChildValue(e)},StreetAddress:function(e,t){this.readChildNodes(e,t)},Building:function(e,t){t.building={number:e.getAttribute("number"),subdivision:e.getAttribute("subdivision"),buildingName:e.getAttribute("buildingName")}},Street:function(e,t){t.street.push(this.getChildValue(e))},Place:function(e,t){t.place[e.getAttribute("type")]=this.getChildValue(e)},PostalCode:function(e,t){t.postalCode=this.getChildValue(e)}},gml:OpenLayers.Format.GML.v3.prototype.readers.gml},write:function(e){return this.writers.xls.XLS.apply(this,[e])},writers:{xls:{XLS:function(e){var t=this.createElementNSPlus("xls:XLS",{attributes:{version:this.VERSION,"xsi:schemaLocation":this.schemaLocation}});return this.writeNode("RequestHeader",e.header,t),this.writeNode("Request",e,t),t},RequestHeader:function(e){return this.createElementNSPlus("xls:RequestHeader")},Request:function(e){var t=this.createElementNSPlus("xls:Request",{attributes:{methodName:"GeocodeRequest",requestID:e.requestID||"",version:this.VERSION}});return this.writeNode("GeocodeRequest",e.addresses,t),t},GeocodeRequest:function(e){for(var t=this.createElementNSPlus("xls:GeocodeRequest"),i=0,n=e.length;i=-this.MAX_PIXEL&&n<=this.MAX_PIXEL&&s>=-this.MAX_PIXEL&&s<=this.MAX_PIXEL},setExtent:function(e,t){var i=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),n=this.getResolution(),s=-e.left/n,r=e.top/n;if(t){this.left=s,this.top=r;var a="0 0 "+this.size.w+" "+this.size.h;return this.rendererRoot.setAttributeNS(null,"viewBox",a),this.translate(this.xOffset,0),!0}var o=this.translate(s-this.left+this.xOffset,r-this.top);return o||this.setExtent(e,!0),i&&o},translate:function(e,t){if(this.inValidRange(e,t,!0)){var i="";return(e||t)&&(i="translate("+e+","+t+")"),this.root.setAttributeNS(null,"transform",i),this.translationParameters={x:e,y:t},!0}return!1},setSize:function(e){OpenLayers.Renderer.prototype.setSize.apply(this,arguments),this.rendererRoot.setAttributeNS(null,"width",this.size.w),this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(e,t){var i=null;switch(e.CLASS_NAME){case"OpenLayers.Geometry.Point":i=t.externalGraphic?"image":this.isComplexSymbol(t.graphicName)?"svg":"circle";break;case"OpenLayers.Geometry.Rectangle":i="rect";break;case"OpenLayers.Geometry.LineString":i="polyline";break;case"OpenLayers.Geometry.LinearRing":i="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":i="path"}return i},setStyle:function(e,t,i){t=t||e._style,i=i||e._options;var n=t.title||t.graphicTitle;if(n){e.setAttributeNS(null,"title",n);var s=e.getElementsByTagName("title");if(s.length>0)s[0].firstChild.textContent=n;else{var r=this.nodeFactory(null,"title");r.textContent=n,e.appendChild(r)}}var a,o=parseFloat(e.getAttributeNS(null,"r")),l=1;if("OpenLayers.Geometry.Point"==e._geometryClass&&o){if(e.style.visibility="",!1===t.graphic)e.style.visibility="hidden";else if(t.externalGraphic){a=this.getPosition(e),t.graphicWidth&&t.graphicHeight&&e.setAttributeNS(null,"preserveAspectRatio","none");var h=t.graphicWidth||t.graphicHeight,u=t.graphicHeight||t.graphicWidth;h=h||2*t.pointRadius,u=u||2*t.pointRadius;var p=void 0!=t.graphicXOffset?t.graphicXOffset:-.5*h,c=void 0!=t.graphicYOffset?t.graphicYOffset:-.5*u,d=t.graphicOpacity||t.fillOpacity;e.setAttributeNS(null,"x",(a.x+p).toFixed()),e.setAttributeNS(null,"y",(a.y+c).toFixed()),e.setAttributeNS(null,"width",h),e.setAttributeNS(null,"height",u),e.setAttributeNS(this.xlinkns,"xlink:href",t.externalGraphic),e.setAttributeNS(null,"style","opacity: "+d),e.onclick=OpenLayers.Event.preventDefault}else if(this.isComplexSymbol(t.graphicName)){var f=3*t.pointRadius,m=2*f,y=this.importSymbol(t.graphicName);a=this.getPosition(e),l=3*this.symbolMetrics[y.id][0]/m;var g=e.parentNode,v=e.nextSibling;g&&g.removeChild(e),e.firstChild&&e.removeChild(e.firstChild),e.appendChild(y.firstChild.cloneNode(!0)),e.setAttributeNS(null,"viewBox",y.getAttributeNS(null,"viewBox")),e.setAttributeNS(null,"width",m),e.setAttributeNS(null,"height",m),e.setAttributeNS(null,"x",a.x-f),e.setAttributeNS(null,"y",a.y-f),v?g.insertBefore(e,v):g&&g.appendChild(e)}else e.setAttributeNS(null,"r",t.pointRadius);var L=t.rotation;if((void 0!==L||void 0!==e._rotation)&&a)if(e._rotation=L,L|=0,"svg"!==e.nodeName)e.setAttributeNS(null,"transform","rotate("+L+" "+a.x+" "+a.y+")");else{var O=this.symbolMetrics[y.id];e.firstChild.setAttributeNS(null,"transform","rotate("+L+" "+O[1]+" "+O[2]+")")}}return i.isFilled?(e.setAttributeNS(null,"fill",t.fillColor),e.setAttributeNS(null,"fill-opacity",t.fillOpacity)):e.setAttributeNS(null,"fill","none"),i.isStroked?(e.setAttributeNS(null,"stroke",t.strokeColor),e.setAttributeNS(null,"stroke-opacity",t.strokeOpacity),e.setAttributeNS(null,"stroke-width",t.strokeWidth*l),e.setAttributeNS(null,"stroke-linecap",t.strokeLinecap||"round"),e.setAttributeNS(null,"stroke-linejoin","round"),t.strokeDashstyle&&e.setAttributeNS(null,"stroke-dasharray",this.dashStyle(t,l))):e.setAttributeNS(null,"stroke","none"),t.pointerEvents&&e.setAttributeNS(null,"pointer-events",t.pointerEvents),null!=t.cursor&&e.setAttributeNS(null,"cursor",t.cursor),e},dashStyle:function(e,t){var i=e.strokeWidth*t,n=e.strokeDashstyle;switch(n){case"solid":return"none";case"dot":return[1,4*i].join();case"dash":return[4*i,4*i].join();case"dashdot":return[4*i,4*i,1,4*i].join();case"longdash":return[8*i,4*i].join();case"longdashdot":return[8*i,4*i,1,4*i].join();default:return OpenLayers.String.trim(n).replace(/\s+/g,",")}},createNode:function(e,t){var i=document.createElementNS(this.xmlns,e);return t&&i.setAttributeNS(null,"id",t),i},nodeTypeCompare:function(e,t){return t==e.nodeName},createRenderRoot:function(){var e=this.nodeFactory(this.container.id+"_svgRoot","svg");return e.style.display="block",e},createRoot:function(e){return this.nodeFactory(this.container.id+e,"g")},createDefs:function(){var e=this.nodeFactory(this.container.id+"_defs","defs");return this.rendererRoot.appendChild(e),e},drawPoint:function(e,t){return this.drawCircle(e,t,1)},drawCircle:function(e,t,i){var n=this.getResolution(),s=(t.x-this.featureDx)/n+this.left,r=this.top-t.y/n;return!!this.inValidRange(s,r)&&(e.setAttributeNS(null,"cx",s),e.setAttributeNS(null,"cy",r),e.setAttributeNS(null,"r",i),e)},drawLineString:function(e,t){var i=this.getComponentsString(t.components);return!!i.path&&(e.setAttributeNS(null,"points",i.path),i.complete?e:null)},drawLinearRing:function(e,t){var i=this.getComponentsString(t.components);return!!i.path&&(e.setAttributeNS(null,"points",i.path),i.complete?e:null)},drawPolygon:function(e,t){for(var i,n,s="",r=!0,a=!0,o=0,l=t.components.length;oc;)h.removeChild(h.lastChild);for(var d=0;d0&&this.getShortString(e[l-1])&&o.push(this.clipLine(e[l],e[l-1])),ls)&&(i=(h-o)/(l-a),h=o+((l=l<0?-s:s)-a)*i),(h<-r||h>r)&&(i=(l-a)/(h-o),l=a+((h=h<0?-r:r)-o)*i),l+","+h},getShortString:function(e){var t=this.getResolution(),i=(e.x-this.featureDx)/t+this.left,n=this.top-e.y/t;return!!this.inValidRange(i,n)&&i+","+n},getPosition:function(e){return{x:parseFloat(e.getAttributeNS(null,"cx")),y:parseFloat(e.getAttributeNS(null,"cy"))}},importSymbol:function(e){this.defs||(this.defs=this.createDefs());var t=this.container.id+"-"+e,i=document.getElementById(t);if(null!=i)return i;var n=OpenLayers.Renderer.symbol[e];if(!n)throw new Error(e+" is not a valid symbol name");var s=this.nodeFactory(t,"symbol"),r=this.nodeFactory(null,"polygon");s.appendChild(r);for(var a,o,l=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0),h=[],u=0;u0;)t.push(i.slice()),i.pop();t.reverse()}return t},read:function(e){"string"==typeof e&&(e=OpenLayers.Format.XML.prototype.read.apply(this,[e])),e&&9==e.nodeType&&(e=e.documentElement);var t={};this.readNode(e,t),this.setNestingPath({layersContext:t.layersContext});var i=[];return this.processLayer(i,t),delete t.layersContext,t.layersContext=i,t},processLayer:function(e,t){if(t.layersContext)for(var i=0,n=t.layersContext.length;i=1&&(i=n[0]),i&&i.firstChild){var s=i.firstChild.nextSibling?i.firstChild.nextSibling:i.firstChild;this.setNamespace("feature",s.namespaceURI),this.featureType=s.localName||s.nodeName.split(":").pop(),this.readChildNodes(e,t)}},Server:function(e,t){(t.service||t.version)&&t.service==OpenLayers.Format.Context.serviceTypes.WMS||(t.service=e.getAttribute("service"),t.version=e.getAttribute("version"),this.readChildNodes(e,t))},Name:function(e,t){t.name=this.getChildValue(e),this.readChildNodes(e,t)},Title:function(e,t){t.title=this.getChildValue(e),this.readChildNodes(e,t)},StyleList:function(e,t){this.readChildNodes(e,t.styles)},Style:function(e,t){var i={};t.push(i),this.readChildNodes(e,i)},LegendURL:function(e,t){var i={};t.legend=i,this.readChildNodes(e,i)},OnlineResource:function(e,t){t.url=this.getAttributeNS(e,this.namespaces.xlink,"href"),this.readChildNodes(e,t)}},ows:OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows,gml:OpenLayers.Format.GML.v2.prototype.readers.gml,sld:OpenLayers.Format.SLD.v1_0_0.prototype.readers.sld,feature:OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{owc:{OWSContext:function(e){var t=this.createElementNSPlus("OWSContext",{attributes:{version:this.VERSION,id:e.id||OpenLayers.Util.createUniqueID("OpenLayers_OWSContext_")}});return this.writeNode("General",e,t),this.writeNode("ResourceList",e,t),t},General:function(e){var t=this.createElementNSPlus("General");return this.writeNode("ows:BoundingBox",e,t),this.writeNode("ows:Title",e.title||"OpenLayers OWSContext",t),t},ResourceList:function(e){for(var t=this.createElementNSPlus("ResourceList"),i=0,n=e.layers.length;i0&&this.writeNode("StyleList",e.metadata.styles,t),t},_Layer:function(e){var t,i,n,s;if(t=e.layer,i=e.subPaths,n=null,s=null,i.length>0){var r=i[0].join("/"),a=r.lastIndexOf("/");return n=this.nestingLayerLookup[r],s=a>0?r.substring(a+1,r.length):r,n||(n=this.createElementNSPlus("Layer"),this.writeNode("ows:Title",s,n),this.nestingLayerLookup[r]=n),e.subPaths.shift(),this.writeNode("_Layer",e,n),n}return t instanceof OpenLayers.Layer.WMS?n=this.writeNode("_WMS",t):t instanceof OpenLayers.Layer.Vector&&(t.protocol instanceof OpenLayers.Protocol.WFS.v1?n=this.writeNode("_WFS",t):t.protocol instanceof OpenLayers.Protocol.HTTP?t.protocol.format instanceof OpenLayers.Format.GML?(t.protocol.format.version="2.1.2",n=this.writeNode("_GML",t)):t.protocol.format instanceof OpenLayers.Format.KML&&(t.protocol.format.version="2.2",n=this.writeNode("_KML",t)):(this.setNamespace("feature",this.featureNS),n=this.writeNode("_InlineGeometry",t))),t.options.maxScale&&this.writeNode("sld:MinScaleDenominator",t.options.maxScale,n),t.options.minScale&&this.writeNode("sld:MaxScaleDenominator",t.options.minScale,n),this.nestingLayerLookup[t.name]=n,n},_WFS:function(e){var t=this.createElementNSPlus("Layer",{attributes:{name:e.protocol.featurePrefix+":"+e.protocol.featureType,hidden:e.visibility?"0":"1"}});return this.writeNode("ows:Title",e.name,t),this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WFS,version:e.protocol.version,url:e.protocol.url},t),t},_InlineGeometry:function(e){var t=this.createElementNSPlus("Layer",{attributes:{name:this.featureType,hidden:e.visibility?"0":"1"}});return this.writeNode("ows:Title",e.name,t),this.writeNode("InlineGeometry",e,t),t},_GML:function(e){var t=this.createElementNSPlus("Layer");return this.writeNode("ows:Title",e.name,t),this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.GML,url:e.protocol.url,version:e.protocol.format.version},t),t},_KML:function(e){var t=this.createElementNSPlus("Layer");return this.writeNode("ows:Title",e.name,t),this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.KML,version:e.protocol.format.version,url:e.protocol.url},t),t}},gml:OpenLayers.Util.applyDefaults({boundedBy:function(e){var t=this.createElementNSPlus("gml:boundedBy");return this.writeNode("gml:Box",e,t),t}},OpenLayers.Format.GML.v2.prototype.writers.gml),ows:OpenLayers.Format.OWSCommon.v1_0_0.prototype.writers.ows,sld:OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,feature:OpenLayers.Format.GML.v2.prototype.writers.feature},CLASS_NAME:"OpenLayers.Format.OWSContext.v0_3_1"}),OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:!1,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:!1,fixPadding:function(){"number"==typeof this.padding&&(this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding))},panMapIfOutOfView:!1,keepInMap:!1,closeOnMove:!1,map:null,initialize:function(e,t,i,n,s,r){null==e&&(e=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")),this.id=e,this.lonlat=t,this.contentSize=null!=i?i:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT),null!=n&&(this.contentHTML=n),this.backgroundColor=OpenLayers.Popup.COLOR,this.opacity=OpenLayers.Popup.OPACITY,this.border=OpenLayers.Popup.BORDER,this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden"),this.div.className=this.displayClass;var a=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(a,null,null,null,"relative",null,"hidden");var e=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(e,null,this.contentSize.clone(),null,"relative"),this.contentDiv.className=this.contentDisplayClass,this.groupDiv.appendChild(this.contentDiv),this.div.appendChild(this.groupDiv),s&&this.addCloseBox(r),this.registerEvents()},destroy:function(){this.id=null,this.lonlat=null,this.size=null,this.contentHTML=null,this.backgroundColor=null,this.opacity=null,this.border=null,this.closeOnMove&&this.map&&this.map.events.unregister("movestart",this,this.hide),this.events.destroy(),this.events=null,this.closeDiv&&(OpenLayers.Event.stopObservingElement(this.closeDiv),this.groupDiv.removeChild(this.closeDiv)),this.closeDiv=null,this.div.removeChild(this.groupDiv),this.groupDiv=null,null!=this.map&&this.map.removePopup(this),this.map=null,this.div=null,this.autoSize=null,this.minSize=null,this.maxSize=null,this.padding=null,this.panMapIfOutOfView=null},draw:function(e){return null==e&&null!=this.lonlat&&null!=this.map&&(e=this.map.getLayerPxFromLonLat(this.lonlat)),this.closeOnMove&&this.map.events.register("movestart",this,this.hide),this.disableFirefoxOverflowHack||"firefox"!=OpenLayers.BROWSER_NAME||(this.map.events.register("movestart",this,function(){var e=document.defaultView.getComputedStyle(this.contentDiv,null).getPropertyValue("overflow");"hidden"!=e&&(this.contentDiv._oldOverflow=e,this.contentDiv.style.overflow="hidden")}),this.map.events.register("moveend",this,function(){var e=this.contentDiv._oldOverflow;e&&(this.contentDiv.style.overflow=e,this.contentDiv._oldOverflow=null)})),this.moveTo(e),this.autoSize||this.size||this.setSize(this.contentSize),this.setBackgroundColor(),this.setOpacity(),this.setBorder(),this.setContentHTML(),this.panMapIfOutOfView&&this.panIntoView(),this.div},updatePosition:function(){if(this.lonlat&&this.map){var e=this.map.getLayerPxFromLonLat(this.lonlat);e&&this.moveTo(e)}},moveTo:function(e){null!=e&&null!=this.div&&(this.div.style.left=e.x+"px",this.div.style.top=e.y+"px")},visible:function(){return OpenLayers.Element.visible(this.div)},toggle:function(){this.visible()?this.hide():this.show()},show:function(){this.div.style.display="",this.panMapIfOutOfView&&this.panIntoView()},hide:function(){this.div.style.display="none"},setSize:function(e){this.size=e.clone();var t=this.getContentDivPadding(),i=t.left+t.right,n=t.top+t.bottom;this.fixPadding(),i+=this.padding.left+this.padding.right,n+=this.padding.top+this.padding.bottom,this.closeDiv&&(i+=parseInt(this.closeDiv.style.width)+t.right),this.size.w+=i,this.size.h+=n,"msie"==OpenLayers.BROWSER_NAME&&(this.contentSize.w+=t.left+t.right,this.contentSize.h+=t.bottom+t.top),null!=this.div&&(this.div.style.width=this.size.w+"px",this.div.style.height=this.size.h+"px"),null!=this.contentDiv&&(this.contentDiv.style.width=e.w+"px",this.contentDiv.style.height=e.h+"px")},updateSize:function(){var e="
"+this.contentDiv.innerHTML+"
",t=this.map?this.map.div:document.body,i=OpenLayers.Util.getRenderedDimensions(e,null,{displayClass:this.displayClass,containerElement:t}),n=this.getSafeContentSize(i),s=null;if(n.equals(i))s=i;else{var r={w:n.we.w-this.map.paddingForPopups.right&&(i.x=e.w-this.map.paddingForPopups.right-this.size.w),t.ye.h-this.map.paddingForPopups.bottom&&(i.y=e.h-this.map.paddingForPopups.bottom-this.size.h);var n=t.x-i.x,s=t.y-i.y;this.map.pan(n,s)},registerEvents:function(){function e(e){OpenLayers.Event.stop(e,!0)}this.events=new OpenLayers.Events(this,this.div,null,!0),this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,touchstart:e,scope:this})},onmousedown:function(e){this.mousedown=!0,OpenLayers.Event.stop(e,!0)},onmousemove:function(e){this.mousedown&&OpenLayers.Event.stop(e,!0)},onmouseup:function(e){this.mousedown&&(this.mousedown=!1,OpenLayers.Event.stop(e,!0))},onclick:function(e){OpenLayers.Event.stop(e,!0)},onmouseout:function(e){this.mousedown=!1},ondblclick:function(e){OpenLayers.Event.stop(e,!0)},CLASS_NAME:"OpenLayers.Popup"}),OpenLayers.Popup.WIDTH=200,OpenLayers.Popup.HEIGHT=200,OpenLayers.Popup.COLOR="white",OpenLayers.Popup.OPACITY=1,OpenLayers.Popup.BORDER="0px",OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,geodesic:!1,draw:function(){if(OpenLayers.Control.prototype.draw.apply(this,arguments),!this.eTop){this.eTop=document.createElement("div"),this.eTop.className=this.displayClass+"Top";this.topInUnits.length;this.div.appendChild(this.eTop),""==this.topOutUnits||""==this.topInUnits?this.eTop.style.visibility="hidden":this.eTop.style.visibility="visible",this.eBottom=document.createElement("div"),this.eBottom.className=this.displayClass+"Bottom",this.div.appendChild(this.eBottom),""==this.bottomOutUnits||""==this.bottomInUnits?this.eBottom.style.visibility="hidden":this.eBottom.style.visibility="visible"}return this.map.events.register("moveend",this,this.update),this.update(),this.div},getBarLen:function(e){var t=parseInt(Math.log(e)/Math.log(10)),i=Math.pow(10,t),n=parseInt(e/i);return(n>5?5:n>2?2:1)*i},update:function(){var e=this.map.getResolution();if(e){var t=this.map.getUnits(),i=OpenLayers.INCHES_PER_UNIT,n=this.maxWidth*e*i[t],s=1;!0===this.geodesic&&(n*=s=(this.map.getGeodesicPixelSize().w||1e-6)*this.maxWidth/(n/i.km));var r,a;n>1e5?(r=this.topOutUnits,a=this.bottomOutUnits):(r=this.topInUnits,a=this.bottomInUnits);var o=n/i[r],l=n/i[a],h=this.getBarLen(o),u=this.getBarLen(l),p=(o=h/i[t]*i[r])/e/s,c=(l=u/i[t]*i[a])/e/s;"visible"==this.eBottom.style.visibility&&(this.eBottom.style.width=Math.round(c)+"px",this.eBottom.innerHTML=u+" "+a),"visible"==this.eTop.style.visibility&&(this.eTop.style.width=Math.round(p)+"px",this.eTop.innerHTML=h+" "+r)}},CLASS_NAME:"OpenLayers.Control.ScaleLine"}),OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(e,t,i,n){this.url=e,this.size=t||{w:20,h:20},this.offset=i||{x:-this.size.w/2,y:-this.size.h/2},this.calculateOffset=n;var s=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(s)},destroy:function(){this.erase(),OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild),this.imageDiv.innerHTML="",this.imageDiv=null},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset)},setSize:function(e){null!=e&&(this.size=e),this.draw()},setUrl:function(e){null!=e&&(this.url=e),this.draw()},draw:function(e){return OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute"),this.moveTo(e),this.imageDiv},erase:function(){null!=this.imageDiv&&null!=this.imageDiv.parentNode&&OpenLayers.Element.remove(this.imageDiv)},setOpacity:function(e){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,e)},moveTo:function(e){null!=e&&(this.px=e),null!=this.imageDiv&&(null==this.px?this.display(!1):(this.calculateOffset&&(this.offset=this.calculateOffset(this.size)),OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,{x:this.px.x+this.offset.x,y:this.px.y+this.offset.y})))},display:function(e){this.imageDiv.style.display=e?"":"none"},isDrawn:function(){return this.imageDiv&&this.imageDiv.parentNode&&11!=this.imageDiv.parentNode.nodeType},CLASS_NAME:"OpenLayers.Icon"}),OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(e,t){this.lonlat=e;var i=t||OpenLayers.Marker.defaultIcon();null==this.icon?this.icon=i:(this.icon.url=i.url,this.icon.size=i.size,this.icon.offset=i.offset,this.icon.calculateOffset=i.calculateOffset),this.events=new OpenLayers.Events(this,this.icon.imageDiv)},destroy:function(){this.erase(),this.map=null,this.events.destroy(),this.events=null,null!=this.icon&&(this.icon.destroy(),this.icon=null)},draw:function(e){return this.icon.draw(e)},erase:function(){null!=this.icon&&this.icon.erase()},moveTo:function(e){null!=e&&null!=this.icon&&this.icon.moveTo(e),this.lonlat=this.map.getLonLatFromLayerPx(e)},isDrawn:function(){return this.icon&&this.icon.isDrawn()},onScreen:function(){var e=!1;return this.map&&(e=this.map.getExtent().containsLonLat(this.lonlat)),e},inflate:function(e){this.icon&&this.icon.setSize({w:this.icon.size.w*e,h:this.icon.size.h*e})},setOpacity:function(e){this.icon.setOpacity(e)},setUrl:function(e){this.icon.setUrl(e)},display:function(e){this.icon.display(e)},CLASS_NAME:"OpenLayers.Marker"}),OpenLayers.Marker.defaultIcon=function(){return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"),{w:21,h:25},{x:-10.5,y:-25})},OpenLayers.Layer.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,format:"image/png",serverResolutions:null,initialize:function(e,t,i,n){this.layername=i,OpenLayers.Layer.Grid.prototype.initialize.apply(this,[e,t,{},n]),this.extension=this.format.split("/")[1].toLowerCase(),this.extension="jpg"==this.extension?"jpeg":this.extension},clone:function(e){return null==e&&(e=new OpenLayers.Layer.TileCache(this.name,this.url,this.layername,this.getOptions())),e=OpenLayers.Layer.Grid.prototype.clone.apply(this,[e])},getURL:function(e){var t=this.getServerResolution(),i=this.maxExtent,n=this.tileSize,s=Math.round((e.left-i.left)/(t*n.w)),r=Math.round((e.bottom-i.bottom)/(t*n.h)),a=null!=this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,t):this.map.getZoom(),o=[this.layername,OpenLayers.Number.zeroPad(a,2),OpenLayers.Number.zeroPad(parseInt(s/1e6),3),OpenLayers.Number.zeroPad(parseInt(s/1e3)%1e3,3),OpenLayers.Number.zeroPad(parseInt(s)%1e3,3),OpenLayers.Number.zeroPad(parseInt(r/1e6),3),OpenLayers.Number.zeroPad(parseInt(r/1e3)%1e3,3),OpenLayers.Number.zeroPad(parseInt(r)%1e3,3)+"."+this.extension].join("/"),l=this.url;return OpenLayers.Util.isArray(l)&&(l=this.selectUrl(o,l)),(l="/"==l.charAt(l.length-1)?l:l+"/")+o},CLASS_NAME:"OpenLayers.Layer.TileCache"}),OpenLayers.Strategy.Paging=OpenLayers.Class(OpenLayers.Strategy,{features:null,length:10,num:null,paging:!1,activate:function(){var e=OpenLayers.Strategy.prototype.activate.call(this);return e&&this.layer.events.on({beforefeaturesadded:this.cacheFeatures,scope:this}),e},deactivate:function(){var e=OpenLayers.Strategy.prototype.deactivate.call(this);return e&&(this.clearCache(),this.layer.events.un({beforefeaturesadded:this.cacheFeatures,scope:this})),e},cacheFeatures:function(e){this.paging||(this.clearCache(),this.features=e.features,this.pageNext(e))},clearCache:function(){if(this.features)for(var e=0;e0&&(this.length=e),this.length},pageNext:function(e){var t=!1;if(this.features){null===this.num&&(this.num=-1);var i=(this.num+1)*this.length;t=this.page(i,e)}return t},pagePrevious:function(){var e=!1;if(this.features){null===this.num&&(this.num=this.pageCount());var t=(this.num-1)*this.length;e=this.page(t)}return e},page:function(e,t){var i=!1;if(this.features&&e>=0&&e=a||0!==f)&&(d=Math.round(e._angle/a)*a-f,e._angle=0,e.box.geometry.rotate(d,o),e.transformFeature({rotation:d}))}},h=new Array(8),u=new Array(4),p=["sw","s","se","e","ne","n","nw","w"],c=0;c<8;++c)t=this.box.geometry.components[c],i=new OpenLayers.Feature.Vector(t.clone(),{role:p[c]+"-resize"},"string"==typeof this.renderIntent?null:this.renderIntent),c%2==0&&((n=new OpenLayers.Feature.Vector(t.clone(),{role:p[c]+"-rotate"},"string"==typeof this.rotationHandleSymbolizer?null:this.rotationHandleSymbolizer)).geometry.move=l,t._rotationHandle=n,u[c/2]=n),t.move=s,t.resize=r,t.rotate=a,i.geometry.move=o,t._handle=i,h[c]=i;this.rotationHandles=u,this.handles=h},createControl:function(){var e=this;this.dragControl=new OpenLayers.Control.DragFeature(this.layer,{documentDrag:!0,moveFeature:function(t){this.feature===e.feature&&(this.feature=e.box),OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,arguments)},onDrag:function(t,i){t===e.box&&e.transformFeature({center:e.center})},onStart:function(t,i){var n=!e.geometryTypes||-1!==OpenLayers.Util.indexOf(e.geometryTypes,t.geometry.CLASS_NAME),s=OpenLayers.Util.indexOf(e.handles,t);s+=OpenLayers.Util.indexOf(e.rotationHandles,t),t!==e.feature&&t!==e.box&&-2==s&&n&&e.setFeature(t)},onComplete:function(t,i){e.events.triggerEvent("transformcomplete",{feature:e.feature})}})},drawHandles:function(){for(var e=this.layer,t=0;t<8;++t)this.rotate&&t%2==0&&e.drawFeature(this.rotationHandles[t/2],this.rotationHandleSymbolizer),e.drawFeature(this.handles[t],this.renderIntent)},transformFeature:function(e){if(!this._setfeature){this.scale*=e.scale||1,this.ratio*=e.ratio||1;var t=this.rotation;if(this.rotation=(this.rotation+(e.rotation||0))%360,!1!==this.events.triggerEvent("beforetransform",e)){var i=this.feature,n=i.geometry,s=this.center;n.rotate(-t,s),e.scale||e.ratio?n.resize(e.scale,s,e.ratio):e.center&&i.move(e.center.getBounds().getCenterLonLat()),n.rotate(this.rotation,s),this.layer.drawFeature(i),i.toState(OpenLayers.State.UPDATE),this.events.triggerEvent("transform",e)}}this.layer.drawFeature(this.box,this.renderIntent),this.drawHandles()},destroy:function(){for(var e,t=0;t<8;++t)(e=this.box.geometry.components[t])._handle.destroy(),e._handle=null,e._rotationHandle&&e._rotationHandle.destroy(),e._rotationHandle=null;this.center=null,this.feature=null,this.handles=null,this.rotationHandleSymbolizer=null,this.rotationHandles=null,this.box.destroy(),this.box=null,this.layer=null,this.dragControl.destroy(),this.dragControl=null,OpenLayers.Control.prototype.destroy.apply(this,arguments)},CLASS_NAME:"OpenLayers.Control.TransformFeature"}),OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(e,t,i){OpenLayers.Handler.prototype.initialize.apply(this,arguments),this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments),this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler=null)},setMap:function(e){OpenLayers.Handler.prototype.setMap.apply(this,arguments),this.dragHandler&&this.dragHandler.setMap(e)},startBox:function(e){this.callback("start",[]),this.zoomBox=OpenLayers.Util.createDiv("zoomBox",{x:-9999,y:-9999}),this.zoomBox.className=this.boxDivClassName,this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1,this.map.viewPortDiv.appendChild(this.zoomBox),OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(e){var t=this.dragHandler.start.x,i=this.dragHandler.start.y,n=Math.abs(t-e.x),s=Math.abs(i-e.y),r=this.getBoxOffsets();this.zoomBox.style.width=n+r.width+1+"px",this.zoomBox.style.height=s+r.height+1+"px",this.zoomBox.style.left=(e.x5||Math.abs(this.dragHandler.start.y-e.y)>5){var i=this.dragHandler.start,n=Math.min(i.y,e.y),s=Math.max(i.y,e.y),r=Math.min(i.x,e.x),a=Math.max(i.x,e.x);t=new OpenLayers.Bounds(r,s,a,n)}else t=this.dragHandler.start.clone();this.removeBox(),this.callback("done",[t])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox),this.zoomBox=null,this.boxOffsets=null,OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){return!!OpenLayers.Handler.prototype.activate.apply(this,arguments)&&(this.dragHandler.activate(),!0)},deactivate:function(){return!!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)&&(this.dragHandler.deactivate()&&this.zoomBox&&this.removeBox(),!0)},getBoxOffsets:function(){if(!this.boxOffsets){var e=document.createElement("div");e.style.position="absolute",e.style.border="1px solid black",e.style.width="3px",document.body.appendChild(e);var t=3==e.clientWidth;document.body.removeChild(e);var i=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width")),n=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width")),s=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width")),r=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"));this.boxOffsets={left:i,right:n,top:s,bottom:r,width:!1===t?i+n:0,height:!1===t?s+r:0}}return this.boxOffsets},CLASS_NAME:"OpenLayers.Handler.Box"}),OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:!1,keyMask:null,alwaysZoom:!1,zoomOnClick:!0,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask})},zoomBox:function(e){if(e instanceof OpenLayers.Bounds){var t,i=e.getCenterPixel();if(this.out){var n=e.right-e.left,s=e.bottom-e.top,r=Math.min(this.map.size.h/s,this.map.size.w/n),a=this.map.getExtent(),o=this.map.getLonLatFromPixel(i),l=o.lon-a.getWidth()/2*r,h=o.lon+a.getWidth()/2*r,u=o.lat-a.getHeight()/2*r,p=o.lat+a.getHeight()/2*r;t=new OpenLayers.Bounds(l,u,h,p)}else{var c=this.map.getLonLatFromPixel({x:e.left,y:e.bottom}),d=this.map.getLonLatFromPixel({x:e.right,y:e.top});t=new OpenLayers.Bounds(c.lon,c.lat,d.lon,d.lat)}var f=this.map.getZoom(),m=this.map.getSize(),y={x:m.w/2,y:m.h/2},g=this.map.getZoomForExtent(t),v=this.map.getResolution(),L=this.map.getResolutionForZoom(g);if(v==L)this.map.setCenter(this.map.getLonLatFromPixel(i));else{var O={x:(v*i.x-L*y.x)/(v-L),y:(v*i.y-L*y.y)/(v-L)};this.map.zoomTo(g,O)}f==this.map.getZoom()&&1==this.alwaysZoom&&this.map.zoomTo(f+(this.out?-1:1))}else this.zoomOnClick&&(this.out?this.map.zoomTo(this.map.getZoom()-1,e):this.map.zoomTo(this.map.getZoom()+1,e))},CLASS_NAME:"OpenLayers.Control.ZoomBox"}),OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:!1,interval:0,documentDrag:!1,kinetic:null,enableKinetic:!0,kineticInterval:10,draw:function(){if(this.enableKinetic&&OpenLayers.Kinetic){var e={interval:this.kineticInterval};"object"==typeof this.enableKinetic&&(e=OpenLayers.Util.extend(e,this.enableKinetic)),this.kinetic=new OpenLayers.Kinetic(e)}this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone,down:this.panMapStart},{interval:this.interval,documentDrag:this.documentDrag})},panMapStart:function(){this.kinetic&&this.kinetic.begin()},panMap:function(e){this.kinetic&&this.kinetic.update(e),this.panned=!0,this.map.pan(this.handler.last.x-e.x,this.handler.last.y-e.y,{dragging:!0,animate:!1})},panMapDone:function(e){if(this.panned){var t=null;if(this.kinetic&&(t=this.kinetic.end(e)),this.map.pan(this.handler.last.x-e.x,this.handler.last.y-e.y,{dragging:!!t,animate:!1}),t){var i=this;this.kinetic.move(t,function(e,t,n){i.map.pan(e,t,{dragging:!n,animate:!1})})}this.panned=!1}},CLASS_NAME:"OpenLayers.Control.DragPan"}),OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,pinchZoom:null,pinchZoomOptions:null,documentDrag:!1,zoomBox:null,zoomBoxEnabled:!0,zoomWheelEnabled:!0,mouseWheelOptions:null,handleRightClicks:!1,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:!0,initialize:function(e){this.handlers={},OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.deactivate(),this.dragPan&&this.dragPan.destroy(),this.dragPan=null,this.zoomBox&&this.zoomBox.destroy(),this.zoomBox=null,this.pinchZoom&&this.pinchZoom.destroy(),this.pinchZoom=null,OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){return this.dragPan.activate(),this.zoomWheelEnabled&&this.handlers.wheel.activate(),this.handlers.click.activate(),this.zoomBoxEnabled&&this.zoomBox.activate(),this.pinchZoom&&this.pinchZoom.activate(),OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){return this.pinchZoom&&this.pinchZoom.deactivate(),this.zoomBox.deactivate(),this.dragPan.deactivate(),this.handlers.click.deactivate(),this.handlers.wheel.deactivate(),OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){this.handleRightClicks&&(this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False);var e={click:this.defaultClick,dblclick:this.defaultDblClick,dblrightclick:this.defaultDblRightClick},t={double:!0,stopDouble:!0};this.handlers.click=new OpenLayers.Handler.Click(this,e,t),this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions)),this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask}),this.dragPan.draw(),this.zoomBox.draw();var i=this.map.fractionalZoom?{}:{cumulative:!1,interval:50,maxDelta:6};this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown},OpenLayers.Util.extend(i,this.mouseWheelOptions)),OpenLayers.Control.PinchZoom&&(this.pinchZoom=new OpenLayers.Control.PinchZoom(OpenLayers.Util.extend({map:this.map},this.pinchZoomOptions)))},defaultClick:function(e){e.lastTouches&&2==e.lastTouches.length&&this.map.zoomOut()},defaultDblClick:function(e){this.map.zoomTo(this.map.zoom+1,e.xy)},defaultDblRightClick:function(e){this.map.zoomTo(this.map.zoom-1,e.xy)},wheelChange:function(e,t){this.map.fractionalZoom||(t=Math.round(t));var i=this.map.getZoom(),n=i+t;n=Math.max(n,0),(n=Math.min(n,this.map.getNumZoomLevels()))!==i&&this.map.zoomTo(n,e.xy)},wheelUp:function(e,t){this.wheelChange(e,t||1)},wheelDown:function(e,t){this.wheelChange(e,t||-1)},disableZoomBox:function(){this.zoomBoxEnabled=!1,this.zoomBox.deactivate()},enableZoomBox:function(){this.zoomBoxEnabled=!0,this.active&&this.zoomBox.activate()},disableZoomWheel:function(){this.zoomWheelEnabled=!1,this.handlers.wheel.deactivate()},enableZoomWheel:function(){this.zoomWheelEnabled=!0,this.active&&this.handlers.wheel.activate()},CLASS_NAME:"OpenLayers.Control.Navigation"}),OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,multi:!1,featureAdded:function(){},initialize:function(e,t,i){OpenLayers.Control.prototype.initialize.apply(this,[i]),this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(e,t){this.layer.events.triggerEvent("sketchmodified",{vertex:e,feature:t})},create:function(e,t){this.layer.events.triggerEvent("sketchstarted",{vertex:e,feature:t})}},this.callbacks),this.layer=e,this.handlerOptions=this.handlerOptions||{},this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{renderers:e.renderers,rendererOptions:e.rendererOptions}),"multi"in this.handlerOptions||(this.handlerOptions.multi=this.multi);var n=this.layer.styleMap&&this.layer.styleMap.styles.temporary;n&&(this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({default:n})})),this.handler=new t(this,this.callbacks,this.handlerOptions)},drawFeature:function(e){var t=new OpenLayers.Feature.Vector(e);!1!==this.layer.events.triggerEvent("sketchcomplete",{feature:t})&&(t.state=OpenLayers.State.INSERT,this.layer.addFeatures([t]),this.featureAdded(t),this.events.triggerEvent("featureadded",{feature:t}))},insertXY:function(e,t){this.handler&&this.handler.line&&this.handler.insertXY(e,t)},insertDeltaXY:function(e,t){this.handler&&this.handler.line&&this.handler.insertDeltaXY(e,t)},insertDirectionLength:function(e,t){this.handler&&this.handler.line&&this.handler.insertDirectionLength(e,t)},insertDeflectionLength:function(e,t){this.handler&&this.handler.line&&this.handler.insertDeflectionLength(e,t)},undo:function(){return this.handler.undo&&this.handler.undo()},redo:function(){return this.handler.redo&&this.handler.redo()},finishSketch:function(){this.handler.finishGeometry()},cancel:function(){this.handler.cancel()},CLASS_NAME:"OpenLayers.Control.DrawFeature"}),OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{holeModifier:null,drawingHole:!1,polygon:null,createFeature:function(e){var t=this.layer.getLonLatFromViewPortPx(e),i=new OpenLayers.Geometry.Point(t.lon,t.lat);this.point=new OpenLayers.Feature.Vector(i),this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry])),this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry])),this.callback("create",[this.point.geometry,this.getSketch()]),this.point.geometry.clearBounds(),this.layer.addFeatures([this.polygon,this.point],{silent:!0})},addPoint:function(e){if(!this.drawingHole&&this.holeModifier&&this.evt&&this.evt[this.holeModifier])for(var t,i,n=this.point.geometry,s=this.control.layer.features,r=s.length-1;r>=0;--r)if(((t=s[r].geometry)instanceof OpenLayers.Geometry.Polygon||t instanceof OpenLayers.Geometry.MultiPolygon)&&t.intersects(n)){i=s[r],this.control.layer.removeFeatures([i],{silent:!0}),this.control.layer.events.registerPriority("sketchcomplete",this,this.finalizeInteriorRing),this.control.layer.events.registerPriority("sketchmodified",this,this.enforceTopology),i.geometry.addComponent(this.line.geometry),this.polygon=i,this.drawingHole=!0;break}OpenLayers.Handler.Path.prototype.addPoint.apply(this,arguments)},getCurrentPointIndex:function(){return this.line.geometry.components.length-2},enforceTopology:function(e){var t=e.vertex,i=this.line.geometry.components;if(!this.polygon.geometry.intersects(t)){var n=i[i.length-3];t.x=n.x,t.y=n.y}},finishGeometry:function(){var e=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[e]),this.removePoint(),this.finalize()},finalizeInteriorRing:function(){var e=this.line.geometry,t=0!==e.getArea();if(t){for(var i=this.polygon.geometry.components,n=i.length-2;n>=0;--n)if(e.intersects(i[n])){t=!1;break}if(t){e:for(n=i.length-2;n>0;--n)for(var s=i[n].components,r=0,a=s.length;r=this.resFactor||i<=1/this.resFactor}return t},calculateBounds:function(e){e||(e=this.getMapBounds());var t=e.getCenterLonLat(),i=e.getWidth()*this.ratio,n=e.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(t.lon-i/2,t.lat-n/2,t.lon+i/2,t.lat+n/2)},triggerRead:function(e){!this.response||e&&!0===e.noAbort||(this.layer.protocol.abort(this.response),this.layer.events.triggerEvent("loadend"));var t={filter:this.createFilter()};this.layer.events.triggerEvent("loadstart",t),this.response=this.layer.protocol.read(OpenLayers.Util.applyDefaults({filter:t.filter,callback:this.merge,scope:this},e))},createFilter:function(){var e=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});return this.layer.filter&&(e=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.layer.filter,e]})),e},merge:function(e){if(this.layer.destroyFeatures(),e.success()){var t=e.features;if(t&&t.length>0){var i=this.layer.projection,n=this.layer.map.getProjectionObject();if(!n.equals(i))for(var s,r=0,a=t.length;r=1&&(o=n.tileMatrixSets[i.tileMatrixSetLinks[0].tileMatrixSet]),!o)throw new Error("matrixSet not found");for(var l,s=0,r=i.styles.length;s=0;--a)if((n=r[a])instanceof OpenLayers.Layer.Google&&!0===n.visibility&&!0===n.inRange){s=n.type,e=!0;break}var o=this.mapObject.getDiv();if(!0===e){if(o.parentNode!==i.div)if(t.rendered)i.div.appendChild(o),t.googleControl.appendChild(i.viewPortDiv),google.maps.event.trigger(this.mapObject,"resize");else{var l=this;google.maps.event.addListenerOnce(this.mapObject,"tilesloaded",function(){t.rendered=!0,l.setGMapVisibility(l.getVisibility()),l.moveTo(l.map.getCenter())})}this.mapObject.setMapTypeId(s)}else t.googleControl.hasChildNodes()&&(i.div.appendChild(i.viewPortDiv),i.div.removeChild(o))}},getMapContainer:function(){return this.mapObject.getDiv()},getMapObjectBoundsFromOLBounds:function(e){var t=null;if(null!=e){var i=this.sphericalMercator?this.inverseMercator(e.bottom,e.left):new OpenLayers.LonLat(e.bottom,e.left),n=this.sphericalMercator?this.inverseMercator(e.top,e.right):new OpenLayers.LonLat(e.top,e.right);t=new google.maps.LatLngBounds(new google.maps.LatLng(i.lat,i.lon),new google.maps.LatLng(n.lat,n.lon))}return t},getMapObjectLonLatFromMapObjectPixel:function(e){var t=this.map.getSize(),i=this.getLongitudeFromMapObjectLonLat(this.mapObject.center),n=this.getLatitudeFromMapObjectLonLat(this.mapObject.center),s=this.map.getResolution(),r=e.x-t.w/2,a=e.y-t.h/2,o=new OpenLayers.LonLat(i+r*s,n-a*s);return this.wrapDateLine&&(o=o.wrapDateLine(this.maxExtent)),this.getMapObjectLonLatFromLonLat(o.lon,o.lat)},getMapObjectPixelFromMapObjectLonLat:function(e){var t=this.getLongitudeFromMapObjectLonLat(e),i=this.getLatitudeFromMapObjectLonLat(e),n=this.map.getResolution(),s=this.map.getExtent();return this.getMapObjectPixelFromXY(1/n*(t-s.left),1/n*(s.top-i))},setMapObjectCenter:function(e,t){if(!1===this.animationEnabled&&t!=this.mapObject.zoom){var i=this.getMapContainer();google.maps.event.addListenerOnce(this.mapObject,"idle",function(){i.style.visibility=""}),i.style.visibility="hidden"}this.mapObject.setOptions({center:e,zoom:t})},getMapObjectZoomFromMapObjectBounds:function(e){return this.mapObject.getBoundsZoomLevel(e)},getMapObjectLonLatFromLonLat:function(e,t){var i;if(this.sphericalMercator){var n=this.inverseMercator(e,t);i=new google.maps.LatLng(n.lat,n.lon)}else i=new google.maps.LatLng(t,e);return i},getMapObjectPixelFromXY:function(e,t){return new google.maps.Point(e,t)}},OpenLayers.Format.WPSDescribeProcess=OpenLayers.Class(OpenLayers.Format.XML,{VERSION:"1.0.0",namespaces:{wps:"http://www.opengis.net/wps/1.0.0",ows:"http://www.opengis.net/ows/1.1",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",defaultPrefix:"wps",regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},read:function(e){"string"==typeof e&&(e=OpenLayers.Format.XML.prototype.read.apply(this,[e])),e&&9==e.nodeType&&(e=e.documentElement);var t={};return this.readNode(e,t),t},readers:{wps:{ProcessDescriptions:function(e,t){t.processDescriptions={},this.readChildNodes(e,t.processDescriptions)},ProcessDescription:function(e,t){var i={processVersion:this.getAttributeNS(e,this.namespaces.wps,"processVersion"),statusSupported:"true"===e.getAttribute("statusSupported"),storeSupported:"true"===e.getAttribute("storeSupported")};this.readChildNodes(e,i),t[i.identifier]=i},DataInputs:function(e,t){t.dataInputs=[],this.readChildNodes(e,t.dataInputs)},ProcessOutputs:function(e,t){t.processOutputs=[],this.readChildNodes(e,t.processOutputs)},Output:function(e,t){var i={};this.readChildNodes(e,i),t.push(i)},ComplexOutput:function(e,t){t.complexOutput={},this.readChildNodes(e,t.complexOutput)},LiteralOutput:function(e,t){t.literalOutput={},this.readChildNodes(e,t.literalOutput)},Input:function(e,t){var i={maxOccurs:parseInt(e.getAttribute("maxOccurs")),minOccurs:parseInt(e.getAttribute("minOccurs"))};this.readChildNodes(e,i),t.push(i)},BoundingBoxData:function(e,t){t.boundingBoxData={},this.readChildNodes(e,t.boundingBoxData)},CRS:function(e,t){t.CRSs||(t.CRSs={}),t.CRSs[this.getChildValue(e)]=!0},LiteralData:function(e,t){t.literalData={},this.readChildNodes(e,t.literalData)},ComplexData:function(e,t){t.complexData={},this.readChildNodes(e,t.complexData)},Default:function(e,t){t.default={},this.readChildNodes(e,t.default)},Supported:function(e,t){t.supported={},this.readChildNodes(e,t.supported)},Format:function(e,t){var i={};this.readChildNodes(e,i),t.formats||(t.formats={}),t.formats[i.mimeType]=!0},MimeType:function(e,t){t.mimeType=this.getChildValue(e)}},ows:OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers.ows},CLASS_NAME:"OpenLayers.Format.WPSDescribeProcess"}),OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(e){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},OpenLayers.Format.prototype.initialize.apply(this,[e])},read:function(e){var t,i,n;e=e.replace(/[\n\r]/g," ");var s=this.regExes.typeStr.exec(e);if(s&&(i=s[1].toLowerCase(),n=s[2],this.parse[i]&&(t=this.parse[i].apply(this,[n])),this.internalProjection&&this.externalProjection))if(t&&"OpenLayers.Feature.Vector"==t.CLASS_NAME)t.geometry.transform(this.externalProjection,this.internalProjection);else if(t&&"geometrycollection"!=i&&"object"==typeof t)for(var r=0,a=t.length;r0&&s.push(","),i=t[r].geometry,s.push(this.extractGeometry(i));return n&&s.push(")"),s.join("")},extractGeometry:function(e){var t=e.CLASS_NAME.split(".")[2].toLowerCase();return this.extract[t]?(this.internalProjection&&this.externalProjection&&(e=e.clone()).transform(this.internalProjection,this.externalProjection),("collection"==t?"GEOMETRYCOLLECTION":t.toUpperCase())+"("+this.extract[t].apply(this,[e])+")"):null},extract:{point:function(e){return e.x+" "+e.y},multipoint:function(e){for(var t=[],i=0,n=e.components.length;i=0;--n)if(e[n].identifier===t){i=n;break}}else i=0;return i},chainProcess:function(e,t){var i=this.getOutputIndex(t.process.description.processOutputs,t.output);e.reference.mimeType=this.findMimeType(e.complexData.supported.formats,t.process.description.processOutputs[i].complexOutput.supported.formats);var n={};for(n[e.reference.mimeType]=!0,t.process.setResponseForm({outputIndex:i,supportedFormats:n}),e.reference.body=t.process.description;this.executeCallbacks.length>0;)this.executeCallbacks[0]()},toFeatures:function(e){var t=OpenLayers.Util.isArray(e);t||(e=[e]);for(var i,n=new Array(e.length),s=0,r=e.length;s0)for(var n=0,s=i.length;n0)for(var n=0,s=i.length;n"+u.attributes.title+"

"+u.attributes.description+"

"),h.overflow=u.attributes.overflow||"auto";var p=new OpenLayers.Feature(this,a,h);this.features.push(p);var c=p.createMarker();null!=u.attributes.title&&null!=u.attributes.description&&c.events.register("click",p,this.markerClick),this.addMarker(c)}this.events.triggerEvent("loadend")},markerClick:function(e){var t=this==this.layer.selectedFeature;this.layer.selectedFeature=t?null:this;for(var i=0,n=this.layer.map.popups.length;i0;){var e=this.features[0];OpenLayers.Util.removeItem(this.features,e),e.destroy()}},CLASS_NAME:"OpenLayers.Layer.Text"}),OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:"shiftKey",layerOptions:null,persist:!1,irregular:!1,citeCompliant:!1,angle:null,fixedRadius:!1,feature:null,layer:null,origin:null,initialize:function(e,t,i){i&&i.layerOptions&&i.layerOptions.styleMap||(this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style.default,{})),OpenLayers.Handler.Drag.prototype.initialize.apply(this,[e,t,i]),this.options=i||{}},setOptions:function(e){OpenLayers.Util.extend(this.options,e),OpenLayers.Util.extend(this,e)},activate:function(){var e=!1;if(OpenLayers.Handler.Drag.prototype.activate.apply(this,arguments)){var t=OpenLayers.Util.extend({displayInLayerSwitcher:!1,calculateInRange:OpenLayers.Function.True,wrapDateLine:this.citeCompliant},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,t),this.map.addLayer(this.layer),e=!0}return e},deactivate:function(){var e=!1;return OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)&&(this.dragging&&this.cancel(),null!=this.layer.map&&(this.layer.destroy(!1),this.feature&&this.feature.destroy()),this.layer=null,this.feature=null,e=!0),e},down:function(e){this.fixedRadius=!!this.radius;var t=this.layer.getLonLatFromViewPortPx(e.xy);this.origin=new OpenLayers.Geometry.Point(t.lon,t.lat),this.fixedRadius&&!this.irregular||(this.radius=this.map.getResolution()),this.persist&&this.clear(),this.feature=new OpenLayers.Feature.Vector,this.createGeometry(),this.callback("create",[this.origin,this.feature]),this.layer.addFeatures([this.feature],{silent:!0}),this.layer.drawFeature(this.feature,this.style)},move:function(e){var t=this.layer.getLonLatFromViewPortPx(e.xy),i=new OpenLayers.Geometry.Point(t.lon,t.lat);if(this.irregular){var n=Math.sqrt(2)*Math.abs(i.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,n)}else this.fixedRadius?this.origin=i:(this.calculateAngle(i,e),this.radius=Math.max(this.map.getResolution()/2,i.distanceTo(this.origin)));if(this.modifyGeometry(),this.irregular){var s,r=i.x-this.origin.x,a=i.y-this.origin.y;s=0==a?r/(this.radius*Math.sqrt(2)):r/a,this.feature.geometry.resize(1,this.origin,s),this.feature.geometry.move(r/2,a/2)}this.layer.drawFeature(this.feature,this.style)},up:function(e){this.finalize(),this.start==this.last&&this.callback("done",[e.xy])},out:function(e){this.finalize()},createGeometry:function(){this.angle=Math.PI*(1/this.sides-.5),this.snapAngle&&(this.angle+=this.snapAngle*(Math.PI/180)),this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle)},modifyGeometry:function(){var e,t,i=this.feature.geometry.components[0];i.components.length!=this.sides+1&&(this.createGeometry(),i=this.feature.geometry.components[0]);for(var n=0;n=0?l={Polygon:this.selectionSymbolizer.Polygon}:h.type.indexOf("LineString")>=0?l={Line:this.selectionSymbolizer.Line}:h.type.indexOf("Point")>=0&&(l={Point:this.selectionSymbolizer.Point});var u=t[r];n.namedLayers[o].userStyles.push({name:"default",rules:[new OpenLayers.Rule({symbolizer:l,filter:u,maxScaleDenominator:e.options.minScale})]})}return new OpenLayers.Format.SLD({srsName:this.map.getProjection()}).write(n)},parseDescribeLayer:function(e){var t=new OpenLayers.Format.WMSDescribeLayer,i=e.responseXML;i&&i.documentElement||(i=e.responseText);for(var n=t.read(i),s=[],r=null,a=0,o=n.length;a=0||h.indexOf("GeometryAssociationType")>=0||h.indexOf("GeometryPropertyType")>=0||h.indexOf("Point")>=0||h.indexOf("Polygon")>=0)&&t.push(l)}return t},activate:function(){var e=OpenLayers.Control.prototype.activate.call(this);if(e)for(var t=0,i=this.layers.length;t=0?new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:e.name,distance:.01*this.map.getExtent().getWidth(),distanceUnits:this.map.getUnits(),value:t}):new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:e.name,value:t}):this.handler instanceof OpenLayers.Handler.Click&&(i=e.type.indexOf("Polygon")>=0?new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:e.name,value:t}):new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:e.name,distance:.01*this.map.getExtent().getWidth(),distanceUnits:this.map.getUnits(),value:t})),i},select:function(e){this._queue=function(){for(var t=0,i=this.layers.length;t=9500&&e<=95e4?Math.round(e/1e3)+"K":e>=95e4?Math.round(e/1e6)+"M":Math.round(e),this.element.innerHTML=OpenLayers.i18n("Scale = 1 : ${scaleDenom}",{scaleDenom:e}))},CLASS_NAME:"OpenLayers.Control.Scale"}),OpenLayers.Layer.MapGuide=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,useHttpTile:!1,singleTile:!1,useOverlay:!1,useAsyncOverlay:!0,TILE_PARAMS:{operation:"GETTILEIMAGE",version:"1.2.0"},SINGLE_TILE_PARAMS:{operation:"GETMAPIMAGE",format:"PNG",locale:"en",clip:"1",version:"1.0.0"},OVERLAY_PARAMS:{operation:"GETDYNAMICMAPOVERLAYIMAGE",format:"PNG",locale:"en",clip:"1",version:"2.0.0"},FOLDER_PARAMS:{tileColumnsPerFolder:30,tileRowsPerFolder:30,format:"png",querystring:null},defaultSize:new OpenLayers.Size(300,300),tileOriginCorner:"tl",initialize:function(e,t,i,n){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments),null!=n&&null!=n.isBaseLayer||(this.isBaseLayer="true"!=this.transparent&&1!=this.transparent),n&&null!=n.useOverlay&&(this.useOverlay=n.useOverlay),this.singleTile?this.useOverlay?(OpenLayers.Util.applyDefaults(this.params,this.OVERLAY_PARAMS),this.useAsyncOverlay||(this.params.version="1.0.0")):OpenLayers.Util.applyDefaults(this.params,this.SINGLE_TILE_PARAMS):(this.useHttpTile?OpenLayers.Util.applyDefaults(this.params,this.FOLDER_PARAMS):OpenLayers.Util.applyDefaults(this.params,this.TILE_PARAMS),this.setTileSize(this.defaultSize))},clone:function(e){return null==e&&(e=new OpenLayers.Layer.MapGuide(this.name,this.url,this.params,this.getOptions())),e=OpenLayers.Layer.Grid.prototype.clone.apply(this,[e])},getURL:function(e){var t,i=e.getCenterLonLat(),n=this.map.getSize();if(this.singleTile){var s={setdisplaydpi:OpenLayers.DOTS_PER_INCH,setdisplayheight:n.h*this.ratio,setdisplaywidth:n.w*this.ratio,setviewcenterx:i.lon,setviewcentery:i.lat,setviewscale:this.map.getScale()};if(this.useOverlay&&!this.useAsyncOverlay){var r={};(r=OpenLayers.Util.extend(r,s)).operation="GETVISIBLEMAPEXTENT",r.version="1.0.0",r.session=this.params.session,r.mapName=this.params.mapName,r.format="text/xml",t=this.getFullRequestString(r),OpenLayers.Request.GET({url:t,async:!1})}t=this.getFullRequestString(s)}else{var a=this.map.getResolution(),o=Math.floor((e.left-this.maxExtent.left)/a);o=Math.round(o/this.tileSize.w);var l=Math.floor((this.maxExtent.top-e.top)/a);l=Math.round(l/this.tileSize.h),t=this.useHttpTile?this.getImageFilePath({tilecol:o,tilerow:l,scaleindex:this.resolutions.length-this.map.zoom-1}):this.getFullRequestString({tilecol:o,tilerow:l,scaleindex:this.resolutions.length-this.map.zoom-1})}return t},getFullRequestString:function(e,t){var i=null==t?this.url:t;"object"==typeof i&&(i=i[Math.floor(Math.random()*i.length)]);var n=i,s=OpenLayers.Util.extend({},this.params);s=OpenLayers.Util.extend(s,e);var r=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(i));for(var a in s)a.toUpperCase()in r&&delete s[a];var o=OpenLayers.Util.getParameterString(s);if(""!=(o=o.replace(/,/g,"+"))){var l=i.charAt(i.length-1);"&"==l||"?"==l?n+=o:-1==i.indexOf("?")?n+="?"+o:n+="&"+o}return n},getImageFilePath:function(e,t){var i=null==t?this.url:t;"object"==typeof i&&(i=i[Math.floor(Math.random()*i.length)]);var n=i,s="",r="";e.tilerow<0&&(s="-"),0==e.tilerow?s+="0":s+=Math.floor(Math.abs(e.tilerow/this.params.tileRowsPerFolder))*this.params.tileRowsPerFolder,e.tilecol<0&&(r="-"),0==e.tilecol?r+="0":r+=Math.floor(Math.abs(e.tilecol/this.params.tileColumnsPerFolder))*this.params.tileColumnsPerFolder;var a="/S"+Math.floor(e.scaleindex)+"/"+this.params.basemaplayergroupname+"/R"+s+"/C"+r+"/"+e.tilerow%this.params.tileRowsPerFolder+"_"+e.tilecol%this.params.tileColumnsPerFolder+"."+this.params.format;return this.params.querystring&&(a+="?"+this.params.querystring),n+=a},CLASS_NAME:"OpenLayers.Layer.MapGuide"}),OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{callbacks:null,displaySystem:"metric",geodesic:!1,displaySystemUnits:{geographic:["dd"],english:["mi","ft","in"],metric:["km","m"]},partialDelay:300,delayedTrigger:null,persist:!1,immediate:!1,initialize:function(e,t){OpenLayers.Control.prototype.initialize.apply(this,[t]);var i={done:this.measureComplete,point:this.measurePartial};this.immediate&&(i.modify=this.measureImmediate),this.callbacks=OpenLayers.Util.extend(i,this.callbacks),this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions),this.handler=new e(this,this.callbacks,this.handlerOptions)},deactivate:function(){return this.cancelDelay(),OpenLayers.Control.prototype.deactivate.apply(this,arguments)},cancel:function(){this.cancelDelay(),this.handler.cancel()},setImmediate:function(e){this.immediate=e,this.immediate?this.callbacks.modify=this.measureImmediate:delete this.callbacks.modify},updateHandler:function(e,t){var i=this.active;i&&this.deactivate(),this.handler=new e(this,this.callbacks,t),i&&this.activate()},measureComplete:function(e){this.cancelDelay(),this.measure(e,"measure")},measurePartial:function(e,t){this.cancelDelay(),t=t.clone(),this.handler.freehandMode(this.handler.evt)?this.measure(t,"measurepartial"):this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.delayedTrigger=null,this.measure(t,"measurepartial")},this),this.partialDelay)},measureImmediate:function(e,t,i){i&&!this.handler.freehandMode(this.handler.evt)&&(this.cancelDelay(),this.measure(t.geometry,"measurepartial"))},cancelDelay:function(){null!==this.delayedTrigger&&(window.clearTimeout(this.delayedTrigger),this.delayedTrigger=null)},measure:function(e,t){var i,n;e.CLASS_NAME.indexOf("LineString")>-1?(i=this.getBestLength(e),n=1):(i=this.getBestArea(e),n=2),this.events.triggerEvent(t,{measure:i[0],units:i[1],order:n,geometry:e})},getBestArea:function(e){for(var t,i,n=this.displaySystemUnits[this.displaySystem],s=0,r=n.length;s1));++s);return[i,t]},getArea:function(e,t){var i,n;this.geodesic?(i=e.getGeodesicArea(this.map.getProjectionObject()),n="m"):(i=e.getArea(),n=this.map.getUnits());var s=OpenLayers.INCHES_PER_UNIT[t];if(s){var r=OpenLayers.INCHES_PER_UNIT[n];i*=Math.pow(r/s,2)}return i},getBestLength:function(e){for(var t,i,n=this.displaySystemUnits[this.displaySystem],s=0,r=n.length;s1));++s);return[i,t]},getLength:function(e,t){var i,n;this.geodesic?(i=e.getGeodesicLength(this.map.getProjectionObject()),n="m"):(i=e.getLength(),n=this.map.getUnits());var s=OpenLayers.INCHES_PER_UNIT[t];return s&&(i*=OpenLayers.INCHES_PER_UNIT[n]/s),i},CLASS_NAME:"OpenLayers.Control.Measure"}),OpenLayers.Format.WMC.v1_0_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.0.0/context.xsd",initialize:function(e){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[e])},read_wmc_SRS:function(e,t){var i=this.getChildValue(t);"object"!=typeof e.projections&&(e.projections={});for(var n=i.split(/ +/),s=0,r=n.length;sthis.maxGetUrlLength;var i=t&&!this.useIFrame,n=!t&&this.useIFrame;(i||n)&&(this.imgDiv&&this.imgDiv.parentNode===this.frame&&this.frame.removeChild(this.imgDiv),this.imgDiv=null,i&&this.frame.removeChild(this.frame.firstChild))}return OpenLayers.Tile.Image.prototype.draw.apply(this,arguments)},getImage:function(){if(!0===this.useIFrame){if(!this.frame.childNodes.length){var e=document.createElement("div"),t=e.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex=1,t.backgroundImage="url("+this.blankImageUrl+")",this.frame.appendChild(e)}var i,n=this.id+"_iFrame";return parseFloat(navigator.appVersion.split("MSIE")[1])<9?((i=document.createElement('