/* * Copyright 2005- by IONIC Software S.A., * 18 Av Wallonie, 4460 Grace-Hollogne, Belgium. * All rights reserved. * * This software is the confidential and proprietary information * of IONIC Software S.A.("Confidential Information"). * You shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with IONIC Software. * * * IMPORTANT * * This file is internal to RedSpider Enterprise Tilapia toolkit. It is subject to * changes and CANNOT BE DIRECTLY ACCESSED BY APPLICATIONS. Only * the objects contained in the IONIC.api package may be used. */ /* * Some IE-specific stuff. Especially for knowing what format to * choose for images: GIF or PNG? */ var IE = false; /*@cc_on IE=true; @*/ var IE7 = false; /*@cc_on /*@if (@_jscript_version >= 5.7) IE7=true; @else @*/ /*@end @*/ /* * We will try and discover the pixel size (in meters) of the * screen. That helps get a correct scale. */ var PixelSize = 0.00028; // Add an onload handler YAHOO.util.Event.on ( window, "load", function () { var d = document.createElement ("div"); d.style.width = d.style.height = "1in"; d.style.backgroundColor = "#e0e0e0"; document.body.appendChild (d); try { var nfo = ElementPosition.get (d); var dpi = nfo.width; PixelSize = (1 / ((100 / 2.54) * dpi)); // } catch (e) { // } finally { document.body.removeChild (d); } }); /* * Copyright 2005- by IONIC Software S.A., * 18 Av Wallonie, 4460 Grace-Hollogne, Belgium. * All rights reserved. * * This software is the confidential and proprietary information * of IONIC Software S.A.("Confidential Information"). * You shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with IONIC Software. * * * IMPORTANT * * This file is internal to RedSpider Enterprise Tilapia toolkit. It is subject to * changes and CANNOT BE DIRECTLY ACCESSED BY APPLICATIONS. Only * the objects contained in the IONIC.api package may be used. */ /** * Name spaces definition file. */ /** * This declares the 'root' name space of the whole Tilapia tookit, 'IONIC'. * It provides a namespace creation helper method. */ if (typeof IONIC === "undefined") { /** * @class IONIC * @static */ var IONIC = {}; /** * Define 'namespaces' in the IONIC namespace * *

* Those namespaces can be composed; i.e., "util.misc". Is * such cases, that will result in two namespaces being * created *

    *
  1. the "util" namespace in the "IONIC" parent
  2. *
  3. the "misc" namespace in the "util" parent
  4. *
*

*/ IONIC.defns = function () { var i, n, j, n2; var curns, parts, curpart, node; for (i = 0, n = arguments.length; i < n; i ++) { curns = arguments [i]; parts = curns.split ('.'); node = IONIC; for (j = 0, n2 = parts.length; j < n2; j ++) { curpart = parts [j]; // Ignore an "IONIC" prefix if (curpart === "IONIC") { continue; } if (typeof (node [curpart]) === "undefined") { node [curpart] = {}; } node = node [curpart]; } } }; } /**************************************************************************** * * * ONLY the API contained in the IONIC.api package is user-accessible. The * * other packages are internal to Tilapia. * * * ****************************************************************************/ /* * IONIC.api.maps: The 'map' object and other objects directly related to it * (key maps, layers, map service discovery,...). */ IONIC.defns ("api.maps"); /* * IONIC.api.maps.keymap: All that's needed in order to attach keymaps * (i.e., child maps) to 'main' maps. */ IONIC.defns ("api.maps.keymap"); /* * IONIC.api.ui: Objects related to the user interface: HTML-related helper, * toolbars, layer list viewer,... */ IONIC.defns ("api.ui"); IONIC.defns ("api.ui.featuretableactions"); /* * IONIC.api.ui.navigation: A navigation tool bar. */ IONIC.defns ("api.ui.navigation"); /* * IONIC.api.geom: Geometry-related objects such as box, point, polygons,... */ IONIC.defns ("api.geom"); /* * IONIC.api.features: Feature and feature editing related objects (feature * definitions, feature edition panels,...). */ IONIC.defns ("api.feature"); /* * IONIC.api.misc: Miscellaneous */ IONIC.defns ("api.misc"); /**************************************************************************** * * * The following defines name spaces outside the IONIC.api package. It is * * internal to Tilapia and should not be accessed directly by the user. * * * ****************************************************************************/ /* * Private packages hold the same kind of objects as their public counterparts. */ IONIC.defns ("misc"); IONIC.defns ("maps"); IONIC.defns ("ui"); IONIC.defns ("ui.security"); IONIC.defns ("geom"); IONIC.defns ("geom.edit"); IONIC.defns ("feature"); IONIC.defns ("feature.edit"); IONIC.defns ("portray"); IONIC.defns ("security"); /** * Create a new XMLHttpRequest object. * * Inspired from * here * * @return a new XMLHttpRequest object. */ IONIC.misc.createXMLHttpRequest = function () { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (! xmlhttp && typeof XMLHttpRequest !== 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; }; IONIC.misc.isDigit=function(ch){if((ch>='0')&&(ch<='9')){return true;}else{return false;}};IONIC.misc.isAlpha=function(ch){if(((ch>='a')&&(ch<='z'))||((ch>='A')&&(ch<='Z'))){return true;}else{return false;}};IONIC.misc.isAlnum=function(ch){if(IONIC.misc.isAlpha(ch)||IONIC.misc.isDigit(ch)){return true;}else{return false;}};IONIC.misc.isNumber=function(o){return(typeof(o)==="number");};IONIC.misc.trimString=function(str){return str.replace(/^\s+/g,'').replace(/\s+$/g,'');};IONIC.misc.getPreferredImageMimeType=function(){return"image/gif";};IONIC.misc.getLocationSearchParameter=function(location,paramName,caseSensitive){var values=[];var ss=location.search;var kvps,i,n,knv;if(ss.length>0){ss=ss.substring(1);kvps=ss.split('&');for(i=0,n=kvps.length;i0){return vals[0];}};IONIC.misc.getWebappBaseUrl=function(){return"/ioniciasclient";};IONIC.misc.setElementOpacity=function(el,opacity){if(IE){try{el.filters.alpha.opacity=opacity*100;}catch(e){el.style.filter+="alpha(opacity="+(opacity*100)+")";}}else{el.style.opacity=opacity;}};IONIC.misc.mouseOnElement=function(e,element){var info=ElementPosition.get(element);e=e||event;var evt=JSToolbox.Event;var mx=evt.getMouseX(e);var my=evt.getMouseY(e);if(mx<(info.left)||mx>=(info.left+info.width)||my<(info.top)||my>=(info.top+info.height)){return false;}else{return true;}};IONIC.misc.swapElements=function(elt1,elt2){var parent1,parent2,sib1,sib2;if(elt1.swapNode){elt1.swapNode(elt2);}else{parent1=elt1.parentNode;parent2=elt2.parentNode;sib1=elt1.nextSibling;sib2=elt2.nextSibling;if(sib2!=elt1){parent2.insertBefore(elt1,sib2);} if(sib1!=elt2){parent1.insertBefore(elt2,sib1);}}};IONIC.misc.makeGensymmer=function(initcnt){var count=(typeof initcnt==="number"?initcnt:0);return function(prefix){var str="g_"+(count++)+(prefix?prefix:"");return str;};};var gensym=IONIC.misc.makeGensymmer();IONIC.misc.findItem=function(item,array,test,key){var i,n,res;var eq=function(val0,val1){return val0===val1;};if(!test){test=eq;} for(i=0,n=array.length;i0){c_start=doc.cookie.indexOf(name+"=");if(c_start!=-1){c_start=c_start+name.length+1;c_end=doc.cookie.indexOf(";",c_start);if(c_end==-1){c_end=doc.cookie.length;} return unescape(doc.cookie.substring(c_start,c_end));}}} IONIC.misc.subset=function(pred,arr){var out=[];if(arr){IONIC.misc.forEach(function(item){if(pred(item)===true){out.push(item);}},arr);} return out;};IONIC.misc.removeUndefined=function(input){var out=[];var i,n,cur;for(i=0,n=input.length;i');}else{obj._transitFrame=document.createElement('IFRAME');obj._transitFrame.id=obj._transitFrame.name=frameId;} s=obj._transitFrame.style;s.display="none";s.width=s.height="1px";document.body.appendChild(obj._transitFrame);} return obj._transitFrame;};IONIC.misc.destroyTransitFrame=function(obj){if(obj._transitFrame){document.body.removeChild(obj._transitFrame);}};IONIC.misc.ajaxifyForm=function(dh,form,actionName,keep,callback,errorCallback){var frameReferencerObject={};var trampolineName=gensym("trampoline");var self=this;top[trampolineName]=function(object){if(!object.error){if(callback){callback(object);}}else{if(errorCallback){errorCallback(object);}else{alert('Error: '+object.errorMessage+'. '+object.stackTrace);}} if(keep===false){top[trampolineName]=null;setTimeout(function(){IONIC.misc.destroyTransitFrame(frameReferencerObject);},30000);}};var transitFrame=IONIC.misc.getTransitFrame(frameReferencerObject);form.target=transitFrame.name;if(actionName){form.action=IONIC.misc.getWebappBaseUrl()+actionName;} form.enctype=form.encoding="multipart/form-data";form.method="POST";var wrappedHtml=form["wrappedInHtml"];if(!wrappedHtml){wrappedHtml=dh.elt("input");wrappedHtml.type="hidden";wrappedHtml.name="wrappedInHtml";wrappedHtml.value="true";dh.append(form,wrappedHtml);} var codeToExecute="function (object) {\n"+" top ['"+trampolineName+"'] (object);\n"+"}";var jsCallbackCode=form["jsCallbackCode"];if(!jsCallbackCode){jsCallbackCode=dh.elt("input");jsCallbackCode.type="hidden";jsCallbackCode.name="jsCallbackCode";dh.append(form,jsCallbackCode);} jsCallbackCode.value=codeToExecute;var jsCallbackErrorCode=form["jsCallbackErrorCode"];if(!jsCallbackErrorCode){jsCallbackErrorCode=dh.elt("input");jsCallbackErrorCode.type="hidden";jsCallbackErrorCode.name="jsCallbackErrorCode";dh.append(form,jsCallbackErrorCode);} jsCallbackErrorCode.value=codeToExecute;};IONIC.misc._tryTrace=function(){var callers=[];var cler=arguments.callee.caller;if(cler){do{callers.push(cler.name||"[anonymous]");cler=cler.caller;}while(cler);} return callers;};IONIC.misc.appendStyleRule=function(ruleSet){var ruleSetPattern,match,selector,declarations;if(document.styleSheets){if(document.styleSheets.length===0){IONIC.misc.appendStyleElement();} if(document.styleSheets.length>0){if(document.styleSheets[0].insertRule){document.styleSheets[document.styleSheets.length-1].insertRule(ruleSet,document.styleSheets[document.styleSheets.length-1].cssRules.length);}else if(document.styleSheets[0].addRule){ruleSetPattern=/(.*)({([^}]*)})/;match=ruleSetPattern.exec(ruleSet);if(match){selector=match[1];declarations=match[3];document.styleSheets[document.styleSheets.length-1].addRule(selector,declarations);}}}}};IONIC.misc.appendStyleElement=function(){var styleElement,headElement;if(document.createElement){styleElement=document.createElement('style');if(styleElement){styleElement.type='text/css';headElement=document.getElementsByTagName('head')[0];headElement.appendChild(styleElement);}}}; IONIC.misc.ErrorMessage=function(){throw"This object is not a constructor; it should not be instantiated.";};IONIC.misc.ErrorMessage.alert=function(errorMessage){var msg="An error has occured:\n\n"+errorMessage.message;alert(msg);}; IONIC.misc.CustomEvent=function(type,oScope,silent,signature){YAHOO.util.CustomEvent.call(this,type,oScope,silent,signature);};IONIC.misc.extendType(IONIC.misc.CustomEvent,YAHOO.util.CustomEvent);IONIC.misc.CustomEvent.prototype.fire=function(){var e,rv=YAHOO.util.CustomEvent.prototype.fire.apply(this,arguments);if(this.lastError){e=this.lastError;this.lastError=null;throw e;}else{return rv;}}; YAHOO.widget.LogWriter.prototype.debug=function(message){this.log(message,"info");};YAHOO.widget.LogWriter.prototype.warn=function(message){this.log(message,"warn");};YAHOO.widget.LogWriter.prototype.error=function(message){this.log(message,"error");};IONIC.misc.createDedicatedLogger=function(id){return new YAHOO.widget.LogWriter(id);};IONIC.misc.getDefaultLogger=(function(){var dl;return function(){if(!dl){dl=IONIC.misc.createDedicatedLogger("global");} return dl;};})(); IONIC.misc.PropertyType={};IONIC.misc.PropertyType._STR_TO_INT={};IONIC.misc.PropertyType._INT_TO_STR={};IONIC.misc.PropertyType.getInt=function(strType){return IONIC.misc.PropertyType._STR_TO_INT(strType);};IONIC.misc.PropertyType.getString=function(intType){return IONIC.misc.PropertyType._INT_TO_STR(intType);};IONIC.misc.PropertyType.register=function(type,intVal){intVal=intVal||IONIC.misc.PropertyType._INT_TO_STR.length;IONIC.misc.PropertyType._INT_TO_STR[intVal]=type;IONIC.misc.PropertyType._STR_TO_INT[type]=intVal};IONIC.misc.PropertyType.BYTE="byte";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.BYTE);IONIC.misc.PropertyType.FLOAT="float";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.FLOAT);IONIC.misc.PropertyType.DOUBLE="double";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.DOUBLE);IONIC.misc.PropertyType.INTEGER="integer";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.INTEGER);IONIC.misc.PropertyType.LONG="long";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.LONG);IONIC.misc.PropertyType.SHORT="short";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.SHORT);IONIC.misc.PropertyType.DOUBLE="double";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.DOUBLE);IONIC.misc.PropertyType.DATE="date";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.DATE);IONIC.misc.PropertyType.STRING="string";IONIC.misc.PropertyType.register(IONIC.misc.PropertyType.STRING); IONIC.misc.BaseStack=function(){this.initBaseStack();};IONIC.misc.BaseStack.newInstance=function(){return new IONIC.misc.BaseStack();};IONIC.misc.BaseStack.prototype.initBaseStack=function(){this.lifo=[];IONIC.misc.createCustomEvents(["onContentsChanged"],this);};IONIC.misc.BaseStack.prototype.push=function(item){this.lifo.splice(0,0,item);this.onContentsChanged.fire(this.lifo.length);};IONIC.misc.BaseStack.prototype.pop=function(){var r;if(this.lifo.length){r=this.lifo.splice(0,1);this.onContentsChanged.fire(this.lifo.length);return r[0];}else{throw"Stack is empty";}};IONIC.misc.BaseStack.prototype.top=function(){return this.lifo[0];}; IONIC.misc.CompositeClassName=function(element,parts){this.parts=parts?parts:{};this.element=element;if(element.className){this.parts["$inherited"+gensym()]=element.className;} this.syncWithElement();element._compClassName=this;IONIC.misc.CompositeClassName.registerInstance(this);};IONIC.misc.CompositeClassName.instances=[];IONIC.misc.CompositeClassName.registerInstance=function(inst){IONIC.misc.CompositeClassName.instances.push(inst);};(function(){YAHOO.util.Event.on(window,"unload",function(){IONIC.misc.forEach(function(inst){inst.destroy();},IONIC.misc.CompositeClassName.instances);IONIC.misc.CompositeClassName.instances=[];});})();IONIC.misc.CompositeClassName.newInstance=function(element,parts){return new IONIC.misc.CompositeClassName(element,parts);};IONIC.misc.CompositeClassName.forElement=function(element,nocreate){if(!element._compClassName&&!nocreate){element._compClassName=new IONIC.misc.CompositeClassName(element);} return element._compClassName;};IONIC.misc.CompositeClassName.prototype.destroy=function(){var element=this.element;if(this.element){this.element=null;element._compClassName=null;}};IONIC.misc.CompositeClassName.prototype.setPart=function(key,value){if(!key){key=gensym("CCNkey_");} this.parts[key]=value;this.syncWithElement();};IONIC.misc.CompositeClassName.prototype.getPart=function(key){return this.parts[key];};IONIC.misc.CompositeClassName.prototype.syncWithElement=function(){var arr=[];for(var i in this.parts){if(this.parts.hasOwnProperty(i)){arr[arr.length]=this.parts[i];}} this.element.className=arr.join(" ");}; Date.prototype.setISO8601=function(string){var regexp="([0-9]{4})(-([0-9]{2})(-([0-9]{2})"+"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?"+"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";var d=string.match(new RegExp(regexp));var offset=0;var date=new Date(d[1],0,1);if(d[3]){date.setMonth(d[3]-1);} if(d[5]){date.setDate(d[5]);} if(d[7]){date.setHours(d[7]);} if(d[8]){date.setMinutes(d[8]);} if(d[10]){date.setSeconds(d[10]);} if(d[12]){date.setMilliseconds(Number("0."+d[12])*1000);} if(d[14]){offset=(Number(d[16])*60)+Number(d[17]);offset*=((d[15]=='-')?1:-1);} offset-=date.getTimezoneOffset();time=(Number(date)+(offset*60*1000));this.setTime(Number(time));} Date.prototype.toISO8601String=function(format,offset){if(!format){var format=6;} if(!offset){var offset='Z';var date=this;}else{var d=offset.match(/([-+])([0-9]{2}):([0-9]{2})/);var offsetnum=(Number(d[2])*60)+Number(d[3]);offsetnum*=((d[1]=='-')?-1:1);var date=new Date(Number(Number(this)+(offsetnum*60000)));} var zeropad=function(num){return((num<10)?'0':'')+num;} var str="";str+=date.getUTCFullYear();if(format>1){str+="-"+zeropad(date.getUTCMonth()+1);} if(format>2){str+="-"+zeropad(date.getUTCDate());} if(format>3){str+="T"+zeropad(date.getUTCHours())+":"+zeropad(date.getUTCMinutes());} if(format>5){var secs=Number(date.getUTCSeconds()+"."+ ((date.getUTCMilliseconds()<100)?'0':'')+ zeropad(date.getUTCMilliseconds()));str+=":"+zeropad(secs);}else if(format>4){str+=":"+zeropad(date.getUTCSeconds());} if(format>3){str+=offset;} return str;} IONIC.misc.RequestTool=function(){this._ehs={};this._ehs[IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER]=IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER_FUN;this.setErrorHandler(IONIC.misc.RequestTool.IONIC_ERROR_HTTP_CODE,IONIC.misc.RequestTool.DEFAULT_IONIC_ERROR_HANDLER_FUN);};IONIC.misc.RequestTool.newInstance=function(){return new IONIC.misc.RequestTool();};IONIC.misc.RequestTool.JSON_MIME_TYPE="application/json";IONIC.misc.RequestTool.IONIC_ERROR_HTTP_CODE=407;IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER_FUN=function(status,respText){var conf=confirm("There was an error while performing the operation. Do you want to see the details?");var funname,purl;if(conf){funname=gensym("errorTextRetriever");window[funname]=function(){return respText;};purl=IONIC.misc.getWebappBaseUrl()+"/BaseErrorHandler.jsp?messageGetter="+ escape(funname);window.open(purl,"windowFor_"+funname,'scrollbars=1,resizable=1,menubar=0');}};IONIC.misc.RequestTool.DEFAULT_IONIC_ERROR_HANDLER_FUN=function(status,respText,request,callback,quiet){var service,errorMsg=eval("("+respText+")");var alertMsg="An error has occured.";if(errorMsg.type.indexOf("authentication")===0){alertMsg+="\nAccess to a secure service has not been granted.";if(errorMsg.type==="authenticationError"){service=IONIC.security.SecureServices.getSecureService(errorMsg.serviceType,errorMsg.serviceUrl);if(service){service.removeUserPassword();IONIC.security.SecureServices.setSecureService(service);}else{IONIC.security.SecureServices.setSecureService(new IONIC.security.SecureService(errorMsg.serviceType,errorMsg.serviceUrl));}}} if(!quiet){if(errorMsg.message&&errorMsg.message.length>0){alertMsg+="\nThe complete error message is:\n"+errorMsg.message;} alert(alertMsg);}};IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER="%def";IONIC.misc.RequestTool.prototype.withUrl=function(url,httpMethod,callback,bodyText){this._withUrl(url,httpMethod,callback,bodyText);};IONIC.misc.RequestTool.prototype._withUrl=function(url,httpMethod,callback,bodyText){httpMethod=httpMethod.toUpperCase();var req=IONIC.misc.createXMLHttpRequest();var self=this;req.onreadystatechange=function(){var success,obj,vname,contentType;if(req.readyState==4){success=false;obj=null;if(req.status==200){success=true;contentType=req.getResponseHeader("Content-Type");if(contentType&&contentType.indexOf(IONIC.misc.RequestTool.JSON_MIME_TYPE)>=0){obj=eval(req.responseText);}} if(self.requestHTMLNotifier){self.requestHTMLNotifier.style.display="none";} if(self.requestListener){self.requestListener("stop",url,success);} if(success){IONIC.misc.RequestTool._doSuccess(self,callback,obj,req);}else{IONIC.misc.RequestTool._doError(self,callback,req);} setTimeout(function(){req.onreadystatechange=function(){};req=null;self=null;},100);}};var isGet=httpMethod==="GET";if(isGet){url+=(url.indexOf("?")>=0?"&":"?")+"time="+new Date().getTime();} req.open(httpMethod,url,true);if(!isGet){req.setRequestHeader("Content-Type","application/json");} if(this.requestHTMLNotifier){this.requestHTMLNotifier.style.display="";} if(this.requestListener){this.requestListener("start",url);} req.send(bodyText?bodyText:"");};IONIC.misc.RequestTool._doSuccess=function(rt,callback,obj,req){if(callback){callback(true,obj,req.responseText,req);}};IONIC.misc.RequestTool._doError=function(rt,callback,req){var hndlr=rt.getErrorHandler(req.status)||rt.getDefaultErrorHandler();if(hndlr){hndlr(req.status,req.responseText,req,callback);}};IONIC.misc.RequestTool.prototype.getErrorHandler=function(code){return this._ehs["$"+code]||this._ehs[IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER];};IONIC.misc.RequestTool.prototype.hasErrorHandler=function(code){return!!this._ehs["$"+code];};IONIC.misc.RequestTool.prototype.setErrorHandler=function(code,handler){this._ehs["$"+code]=handler;};IONIC.misc.RequestTool.prototype.getDefaultErrorHandler=function(){return this._ehs[IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER];};IONIC.misc.RequestTool.prototype.setDefaultErrorHandler=function(handler){this._ehs[IONIC.misc.RequestTool.DEFAULT_ERROR_HANDLER]=handler;};IONIC.misc.RequestTool.prototype.setRequestHTMLNotifier=function(htmlElement){this.requestHTMLNotifier=htmlElement;};IONIC.misc.RequestTool.prototype.setRequestListener=function(listener){this.requestListener=listener;};IONIC.misc.RequestTool.prototype._wrapIterationCallbacks=function(beginCb,iterationCb,endCb,treeChildrenKey,sortKey,nodeTreatment,firstLevelKey){var maybeTreat=function(desc){return nodeTreatment?nodeTreatment(desc):desc;};return function(success,parsedObject,responseText,thisReq){var sortWithKey,descNode,arr,i,n,obj;if(beginCb){beginCb(success,parsedObject,responseText,thisReq);} if(iterationCb){if(sortKey){if(typeof sortKey==="string"){sortWithKey=function(arr){return arr.sort(function(o0,o1){if(o0[sortKey]===o1[sortKey]){return 0;}else if(o0[sortKey]=this._items.length){this._ptr=this._items.length-1;} this._fireStateChanged();}};IONIC.misc.HistoryChain.prototype._fireStateChanged=function(){var p=this._ptr;var l=this._items.length;this.onStateChanged.fire(p,l,(p0));};IONIC.misc.HistoryChain.prototype.addItem=function(forwardOp,backOp){if(this._ptr>0){this._items=this._items.slice(this._ptr);} var i={fwd:forwardOp,back:backOp};this._items.splice(0,0,i);this._ptr=1;var mi=this.getMaxItems();if(this._items.length>mi){this._items=this._items.slice(0,mi);} this.forward(true);this._fireStateChanged();return i;};IONIC.misc.HistoryChain.prototype._setPtr=function(p,noEvent){if(p!=this._ptr){this._ptr=p;if(!noEvent){this._fireStateChanged();}}};IONIC.misc.HistoryChain.prototype.forward=function(noEvent){var r;var tuple;var curPtr=this._ptr;switch(curPtr){case-1:tuple=this._items[0];curPtr=0;break;case 0:r=false;break;default:tuple=this._items[--curPtr];r=true;} if(tuple){tuple.fwd();} this._setPtr(curPtr,noEvent);return r;};IONIC.misc.HistoryChain.prototype.back=function(noEvent){var r;var tuple;var curPtr=this._ptr;var maxPtr=this._items.length;switch(curPtr){case-1:throw"Trying to 'back' on geometry editing history, but there has been no action so far.";case maxPtr:r=false;break;default:tuple=this._items[curPtr++];r=true;} if(tuple){tuple.back();} this._setPtr(curPtr,noEvent);return r;}; IONIC.misc.QName=function(name,nsUri){this.name=name;this.namespace=nsUri;};IONIC.misc.QName.prototype.getName=function(){return this.name;};IONIC.misc.QName.prototype.getNamespace=function(){return this.namespace;};IONIC.misc.QName.prototype.equals=function(other){return IONIC.misc.QName.equal(this,other);};IONIC.misc.QName.equal=function(qn0,qn1){return qn0.name===qn1.name&&qn0.namespace===qn1.namespace;};IONIC.misc.QName.prototype.toString=function(){return"{"+this.namespace+"}"+this.name;}; IONIC.misc.ObjReference=function(obj,onEstablished,onBrk,onB4Brk){this.setObject(obj);this.setHandlers(onEstablished,onBrk,onB4Brk);this.activated=false;};IONIC.misc.ObjReference.prototype.setHandlers=function(onEstablished,onBrk,onB4Brk){this._oe=onEstablished;this._ob=onBrk;this._obb=onB4Brk;};IONIC.misc.ObjReference.prototype.setObject=function(o){this._o=o;};IONIC.misc.ObjReference.prototype.getObject=function(){return this._o;};IONIC.misc.ObjReference.prototype.activate=function(){this.ensureInactive();if(this.isObjectAvailable()){this.onEstablished(this.getObject());}};IONIC.misc.ObjReference.prototype.ensureInactive=function(){if(this.activated){throw"Illegal state: ObjReference is already activated";}};IONIC.misc.ObjReference.prototype.isObjectAvailable=function(){return!!this._o;};IONIC.misc.ObjReference.prototype.onEstablished=function(o){var h=this._getOnEstablishedHandler();if(h){h(o);}};IONIC.misc.ObjReference.prototype.onBroken=function(o){var h=this._getOnBrokenHandler();if(h){h(o);}};IONIC.misc.ObjReference.prototype.onB4Broken=function(o){var h=this._getOnB4BrokenHandler();if(h){h(o);}};IONIC.misc.ObjReference.prototype._getOnEstablishedHandler=function(){return this._oe;};IONIC.misc.ObjReference.prototype._getOnBrokenHandler=function(){return this._ob;};IONIC.misc.ObjReference.prototype._getOnB4BrokenHandler=function(){return this._obb;}; IONIC.misc.TilapiaPoolSoftReference=function(objName,objType,onEstablished,onBrk,onB4Brk){this.setHandlers(onEstablished,onBrk,onB4Brk);this._on=objName;this._ot=objType;var thisRef=this;IONIC.api.misc.TilapiaPool.onAdded.subscribe(function(etype,args){var name=args[0];var type=args[1];if(objName===name&&objType===type){thisRef.onEstablished(args[2]);}});IONIC.api.misc.TilapiaPool.onRemoved.subscribe(function(etype,args){var name=args[0];var type=args[1];var obj=args[2];if(objName===name&&objType===type){thisRef.onB4Broken(obj);thisRef.onBroken(obj);}});};IONIC.misc.extendType(IONIC.misc.TilapiaPoolSoftReference,IONIC.misc.ObjReference);IONIC.misc.TilapiaPoolSoftReference.prototype.getObjectName=function(){return this._on;};IONIC.misc.TilapiaPoolSoftReference.prototype.getObjectType=function(){return this._ot;};IONIC.misc.TilapiaPoolSoftReference.prototype.setObject=function(o){throw"Illegal state: IONIC.misc.TilapiaPoolSoftReference#setObject () was called";};IONIC.misc.TilapiaPoolSoftReference.prototype.getObject=function(){return IONIC.api.misc.TilapiaPool.getObject(this.getObjectName(),this.getObjectType());};IONIC.misc.TilapiaPoolSoftReference.prototype.isObjectAvailable=function(){return!!this.getObject();}; IONIC.misc.AbstractResultsHandler=function(){};IONIC.misc.AbstractResultsHandler.prototype.onB4RequestSubmitted=function(){};IONIC.misc.AbstractResultsHandler.prototype.onBegin=function(success,obj){IONIC.misc.unimp("IONIC.misc.AbstractResultsHandler","onBegin");};IONIC.misc.AbstractResultsHandler.prototype.onIterate=function(item){IONIC.misc.unimp("IONIC.misc.AbstractResultsHandler","onIterate");};IONIC.misc.AbstractResultsHandler.prototype.onEnd=function(){IONIC.misc.unimp("IONIC.misc.AbstractResultsHandler","onEnd");}; IONIC.ui.AbstractLoadingSign=function(win){win=win||window;this.progress=0;this.setComponent(this.createComponent(new IONIC.api.ui.DomHelper(win.document)));this.getComponent().style.display="none";this.isLoading=false;};IONIC.ui.AbstractLoadingSign.prototype.getComponent=function(){return this.component;};IONIC.ui.AbstractLoadingSign.prototype.setComponent=function(comp){this.component=comp;};IONIC.ui.AbstractLoadingSign.prototype.createComponent=function(dh){IONIC.misc.unimp("IONIC.ui.AbstractLoadingSign","createComponent");};IONIC.ui.AbstractLoadingSign.prototype.onLoadStart=function(){this.getComponent().style.display="";};IONIC.ui.AbstractLoadingSign.prototype.onLoadEnd=function(){this.getComponent().style.display="none";};IONIC.ui.AbstractLoadingSign.prototype.onProgress=function(progress){};IONIC.ui.AbstractLoadingSign.prototype.getProgress=function(){return this.progress;};IONIC.ui.AbstractLoadingSign.prototype.setProgress=function(progress){progress=Math.min(1.0,Math.max(0.0,progress));this.progress=progress;if(!this.isLoading){this.onLoadStart();} this.onProgress(progress);if(progress===1.0){this.onLoadEnd();this.isLoading=false;} this.refreshComponent();};IONIC.ui.AbstractLoadingSign.prototype.refreshComponent=function(){}; IONIC.ui.AbstractEditor=function(component){if(!component){throw"Missing component for editor";} this._cpnt=component;};IONIC.ui.AbstractEditor.prototype.getComponent=function(){return this._cpnt;};IONIC.ui.AbstractEditor.prototype.getValue=function(){IONIC.misc.unimp("IONIC.ui.AbstractEditor","getValue");}; IONIC.ui.AbstractMultiValuedEditor=function(component){IONIC.ui.AbstractEditor.call(this,component);};IONIC.misc.extendType(IONIC.ui.AbstractMultiValuedEditor,IONIC.ui.AbstractEditor);IONIC.ui.AbstractMultiValuedEditor.prototype.getValue=function(){var values=this.getValues();return values;};IONIC.ui.AbstractMultiValuedEditor.prototype.getValues=function(){IONIC.misc.unimp("IONIC.ui.AbstractMultiValuedEditor","getValues");}; IONIC.ui.AbstractComposedEditor=function(component){IONIC.ui.AbstractMultiValuedEditor.call(this,component);var args=[],i,n;if(arguments.length>1){for(i=0,n=arguments.length;i(this.hasNoPrompt()?-1:0)){o=c.options[c.options.selectedIndex];val=(o&&o.value&&o.value!=="")?o.value:undefined;} return val;};IONIC.ui.SelectEditor.prototype.setNoPrompt=function(flag){this._noPrompt=!!flag;};IONIC.ui.SelectEditor.prototype.hasNoPrompt=function(){return this._noPrompt;}; IONIC.ui.NavigableMapEditor=function(holder,dh){IONIC.ui.AbstractSpatialEditor.call(this,holder);this._dh=dh;this.initComponent();};IONIC.misc.extendType(IONIC.ui.NavigableMapEditor,IONIC.ui.AbstractSpatialEditor);IONIC.ui.NavigableMapEditor.prototype.getValue=function(){if(this.isMapVisible()){var map=this.getMap();return this.boxToPolygon(map.getSrsBox());}};IONIC.ui.NavigableMapEditor.prototype.getMap=function(){return this._map;};IONIC.ui.NavigableMapEditor.prototype.getDomHelper=function(){return this._dh;};IONIC.ui.NavigableMapEditor.prototype.initComponent=function(){var holder=this.getComponent();var dh=this.getDomHelper();var thisRef=this;var toggler=dh.elt("img");toggler.onclick=function(){thisRef.toggleMapVisibility();};var block=dh.elt("div");this._map=new IONIC.api.maps.Map(block);var block2=dh.elt("div");var navbar=new IONIC.api.ui.NavigationBar(block2,this._map);var nba=IONIC.api.ui.NavigationBar;navbar.addItems(nba.ZOOMIN|nba.ZOOMOUT|nba.PAN|nba.HISTORY);dh.append(holder,toggler,block,block2);holder.toggler=toggler;holder.mapHolder=block;holder.navbarHolder=block2;this.setMapVisibility(false);};IONIC.ui.NavigableMapEditor.prototype.toggleMapVisibility=function(){this.setMapVisibility(!this.isMapVisible());};IONIC.ui.NavigableMapEditor.prototype.setMapVisibility=function(visibility){var holder=this.getComponent();var toggler=holder.toggler;var mapHolder=holder.mapHolder;var navbarHolder=holder.navbarHolder;if(visibility){toggler.src=IONIC.misc.getWebappBaseUrl()+"/images/editor/navigablemap/toggle_toinvisible.gif";toggler.alt="tilapia.editor.navigablemap.toggle.toinvisibile.alt";toggler.title="tilapia.editor.navigablemap.toggle.toinvisibile.title";mapHolder.style.display="";navbarHolder.style.display="";}else{toggler.src=IONIC.misc.getWebappBaseUrl()+"/images/editor/navigablemap/toggle_tovisible.gif";toggler.alt="tilapia.editor.navigablemap.toggle.tovisibile.alt";toggler.title="tilapia.editor.navigablemap.toggle.tovisibile.title";mapHolder.style.display="none";navbarHolder.style.display="none";}};IONIC.ui.NavigableMapEditor.prototype.isMapVisible=function(){return this.getComponent().mapHolder.style.display!=="none";}; IONIC.ui.TimestampIntervalEditor=function(component){IONIC.ui.AbstractComposedEditor.call(this,component);};IONIC.misc.extendType(IONIC.ui.TimestampIntervalEditor,IONIC.ui.AbstractComposedEditor);IONIC.ui.TimestampIntervalEditor.prototype.getValues=function(){var c=this.getComponent();var startDate=c.startBoundComponent.dateValue;var endDate=c.endBoundComponent.dateValue;return[startDate||null,endDate||null];};IONIC.ui.TimestampIntervalEditor.buildComponent=function(dh){var startBoundComponent=dh.elt("input");startBoundComponent.type="text";startBoundComponent.value="";startBoundComponent.dateValue=undefined;startBoundComponent.readOnly=true;var endBoundComponent=dh.elt("input");endBoundComponent.type="text";endBoundComponent.value="";endBoundComponent.dateValue=undefined;endBoundComponent.readOnly=true;var startCalendarHolder=dh.elt("div.timestampCalendar");var endCalendarHolder=dh.elt("div.timestampCalendar");startCalendarHolder.id=gensym("cphdr");endCalendarHolder.id=gensym("cphdr");startCalendarHolder.style.position=endCalendarHolder.style.position="absolute";startCalendarHolder.style.visibility=endCalendarHolder.style.visibility="hidden";startCalendarHolder.style.backgroundColor=endCalendarHolder.style.backgroundColor="white";dh.append(dh.getDocument().body,startCalendarHolder);dh.append(dh.getDocument().body,endCalendarHolder);var startCalendarHook=dh.elt("img");var endCalendarHook=dh.elt("img");startCalendarHook.id=gensym("chk");endCalendarHook.id=gensym("chk");startCalendarHook.src=endCalendarHook.src=IONIC.misc.getWebappBaseUrl()+"/images/editor/timestamp/calendar.gif";startCalendarHook.alt=endCalendarHook.alt="calendar";startCalendarHook.title=endCalendarHook.title="Open calendar";var startClear=dh.elt("img");var endClear=dh.elt("img");startClear.src=endClear.src=IONIC.misc.getWebappBaseUrl()+"/images/editor/timestamp/clear.gif";startClear.alt=endClear.alt="clear";startClear.title=endClear.title="Clear current date";var startCal=new CalendarPopup(startCalendarHolder.id);startCal.showNavigationDropdowns();var endCal=new CalendarPopup(endCalendarHolder.id);endCal.showNavigationDropdowns();var win=window;var startCBName=gensym("startCalCb");var endCBName=gensym("endCalCb");win[startCBName]=function(y,m,d){var date=new Date(Date.UTC(y,m-1,d,0,0,0));startBoundComponent.value=date.toUTCString();startBoundComponent.dateValue=date;};win[endCBName]=function(y,m,d){var date=new Date(Date.UTC(y,m-1,d,23,59,59));endBoundComponent.value=date.toUTCString();endBoundComponent.dateValue=date;};startCal.setReturnFunction(startCBName);endCal.setReturnFunction(endCBName);startCalendarHook.onclick=function(){startCal.showCalendar(startCalendarHook.id);return false;};endCalendarHook.onclick=function(){endCal.showCalendar(endCalendarHook.id);return false;};startClear.onclick=function(){startBoundComponent.value="";startBoundComponent.dateValue=undefined;};endClear.onclick=function(){endBoundComponent.value="";endBoundComponent.dateValue=undefined;};var cpnt=dh.elt("div.ui_timestampIntervalEditor",dh.elt("table",dh.elt("tbody",dh.elt("tr",dh.elt("td",startBoundComponent),dh.elt("td",startCalendarHook),dh.elt("td",startClear)),dh.elt("tr",dh.elt("td",endBoundComponent),dh.elt("td",endCalendarHook),dh.elt("td",endClear)))));cpnt.startBoundComponent=startBoundComponent;cpnt.endBoundComponent=endBoundComponent;cpnt.startCalendar=startCal;cpnt.endCalendar=endCal;return cpnt;}; IONIC.ui.TBItem=function(factory,name){this.nme=name;this.ena=true;this.sts={};this.fac=factory;} IONIC.ui.TBItem.DISABLED_STYLE="%%dis";IONIC.ui.TBItem.INITIAL_STYLE="%%ini";IONIC.ui.TBItem.prototype.getName=function(){return this.nme;};IONIC.ui.TBItem.prototype.getItemFactory=function(){return this.fac;};IONIC.ui.TBItem.prototype.setItemFactory=function(f){this.fac=f;};IONIC.ui.TBItem.prototype.getItemGroup=function(){return this.grp;};IONIC.ui.TBItem.prototype.setItemGroup=function(g){this.grp=g;};IONIC.ui.TBItem.prototype.getComponent=function(){if(!this.cpnt) this.cpnt=this.createComponent();return this.cpnt;};IONIC.ui.TBItem.prototype.createComponent=function(){throw"Don't know how to create component";};IONIC.ui.TBItem.prototype.select=function(){};IONIC.ui.TBItem.prototype.onselect=function(){};IONIC.ui.TBItem.prototype.ondeselect=function(){};IONIC.ui.TBItem.prototype.onactivate=function(){};IONIC.ui.TBItem.prototype.registerStyle=function(name,data){};IONIC.ui.TBItem.prototype.selectStyle=function(name){} IONIC.ui.TBItem.prototype.setEnabled=function(flag){this.ena=flag;};IONIC.ui.TBItem.prototype.isEnabled=function(flag){return this.ena;};IONIC.ui.TBItem.prototype.setVisibility=function(flag){this.getComponent().style.display=(flag?"":"none");};IONIC.ui.TBItem.prototype.destroy=function(){this.onDestroy();};IONIC.ui.TBItem.prototype.onDestroy=function(){}; IONIC.ui.TBImgItem=function(factory,name,fileName,title,alt){IONIC.ui.TBItem.call(this,factory,name);this.registerStyle(IONIC.ui.TBItem.INITIAL_STYLE,{fileName:fileName,title:title,alt:alt});this.selectStyle(IONIC.ui.TBItem.INITIAL_STYLE);};IONIC.misc.extendType(IONIC.ui.TBImgItem,IONIC.ui.TBItem);IONIC.ui.TBImgItem.prototype.select=function(e){var g=this.getItemGroup();if(g){g.setSelected(this,e);}else{this.onactivate(e);}};IONIC.ui.TBImgItem.prototype.createComponent=function(){var thisRef=this;var f=this.getItemFactory();var d=f.getDocument();var img=d.createElement("img");img.title=this.imgTitle;img.alt=this.imgAlt;img.src=IONIC.misc.getWebappBaseUrl()+"/"+f.getImagePath()+"/"+this.imgFileName;img.onclick=function(e){if(thisRef.isEnabled()){thisRef.select(e);}};img.ccn=new IONIC.misc.CompositeClassName(img);img.ccn.setPart("sel","deselected");return img;};IONIC.ui.TBImgItem.prototype.getImageFileName=function(){return this.imgFileName;};IONIC.ui.TBImgItem.prototype.setImageFileName=function(fn){this.imgFileName=fn;var f=this.getItemFactory();this.getComponent().src=IONIC.misc.getWebappBaseUrl()+"/"+f.getImagePath()+"/"+this.imgFileName;};IONIC.ui.TBImgItem.prototype.setImageTitle=function(t){this.imgTitle=t;this.getComponent().title=t;};IONIC.ui.TBImgItem.prototype.setImageAlt=function(alt){this.imgAlt=alt;this.getComponent().alt=alt;};IONIC.ui.TBImgItem.prototype.registerStyle=function(name,data){this.sts[name]=data;};IONIC.ui.TBImgItem.prototype.selectStyle=function(name){var s=this.sts[name];if(s){this.setImageFileName(s.fileName);this.setImageTitle(s.title);this.setImageAlt(s.alt);}else{}};IONIC.ui.TBImgItem.prototype.setEnabled=function(flag){var bef=this.isEnabled();IONIC.ui.TBItem.prototype.setEnabled.call(this,flag);if(bef!=flag){this.selectStyle(flag?IONIC.ui.TBItem.INITIAL_STYLE:IONIC.ui.TBItem.DISABLED_STYLE);}};IONIC.ui.TBImgItem.prototype.destroy=function(){IONIC.ui.TBItem.prototype.destroy.call(this);this.getComponent().onclick=undefined;}; IONIC.ui.TBInputItem=function(factory,name,text,initialValue){IONIC.ui.TBItem.call(this,factory,name);this.labelText=text;this.initVal=initialValue;};IONIC.misc.extendType(IONIC.ui.TBInputItem,IONIC.ui.TBItem);IONIC.ui.TBInputItem.prototype.createComponent=function(){var f=this.getItemFactory();var d=f.getDocument();var c=d.createElement("div");var l=d.createTextNode(this.labelText);var i=d.createElement("input");i.className='inputItem';i.type="text";if(typeof this.initVal!=="undefined"){i.value=this.initVal;} c.appendChild(l);c.appendChild(i);c.input=i;return c;};IONIC.ui.TBInputItem.prototype.getValue=function(){var v=this.getComponent().input.value;return(this.unformatter?this.unformatter(v):v);};IONIC.ui.TBInputItem.prototype.setValue=function(v){var c=this.getComponent();c.input.value=(this.formatter?this.formatter(v):v);};IONIC.ui.TBInputItem.prototype.setFormatter=function(f){this.formatter=f;};IONIC.ui.TBInputItem.prototype.setUnformatter=function(f){this.unformatter=f;};IONIC.ui.TBInputItem.prototype.setEditable=function(flag){flag=!!flag;var c=this.getComponent();c.editable=flag;if(flag){var thisRef=this;c.onkeydown=function(e){thisRef.checkKey(e);return true;};c.input.readOnly=false;}else{c.input.readOnly=true;c.onkeydown=null;}};IONIC.ui.TBInputItem.prototype.checkKey=function(e){e=e||event;var code;if(e.keyCode)code=e.keyCode;else if(e.which)code=e.which;var character=String.fromCharCode(code);if(code==8||code==46||(code>=96&&code<=105)||IONIC.misc.isDigit(character)){this.userModified();}else if(code==13){this.synchronizeInput();}};IONIC.ui.TBInputItem.prototype.userModified=function(){this.setNeedsSync(true);this.showApplyDialog();};IONIC.ui.TBInputItem.prototype.setNeedsSync=function(flag){this.nsc=flag;};IONIC.ui.TBInputItem.prototype.getNeedsSync=function(){return this.nsc;};IONIC.ui.TBInputItem.prototype.setSize=function(s){return this.getComponent().input.size=s;};IONIC.ui.TBInputItem.prototype.synchronizeInput=function(){};IONIC.ui.TBInputItem.prototype.showApplyDialog=function(){};IONIC.ui.TBInputItem.prototype.destroy=function(){IONIC.ui.TBItem.prototype.destroy.call(this);this.getComponent().onkeydown=undefined;}; IONIC.ui.TBLabelItem=function(factory,name,text){IONIC.ui.TBItem.call(this,factory,name);this.labelText=text||"";} IONIC.misc.extendType(IONIC.ui.TBLabelItem,IONIC.ui.TBItem);IONIC.ui.TBLabelItem.prototype.createComponent=function(){var f=this.getItemFactory();var d=f.getDocument();var c=d.createElement("span");c.innerHTML=this.labelText;return c;} IONIC.ui.TBLabelItem.prototype.setValue=function(text){this.getComponent().innerHTML=text||"";} IONIC.ui.TBSelectItem=function(factory,name,text){IONIC.ui.TBItem.call(this,factory,name);this.labelText=text;};IONIC.misc.extendType(IONIC.ui.TBSelectItem,IONIC.ui.TBItem);IONIC.ui.TBSelectItem.prototype.createComponent=function(){var self=this;var f=this.getItemFactory();var d=f.getDocument();var component=d.createElement("div");var l=d.createTextNode(this.labelText);var select=d.createElement("select");select.className='selectItem';component.appendChild(l);component.appendChild(select);component.select=select;select.onchange=function(){self.onchange();};return component;};IONIC.ui.TBSelectItem.prototype.getValue=function(){var select=this.getComponent().select;var value=select.options[select.options.selectedIndex].value return value;};IONIC.ui.TBSelectItem.prototype.setValue=function(value){var select=this.getComponent().select;var i,n,idxToSelect;for(i=0,n=select.options.length;i=96&&code<=105)||IONIC.misc.isDigit(character)){this.userModifiedInput();}else if(code==13){this.userAcceptedInput();}};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.userModifiedInput=function(){};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.userAcceptedInput=function(){};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.getInputSize=function(){return this._inputSz||12;};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.setInputSize=function(size){this._inputSz=size;this.getComponentInput().size=size;};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.getComponentInput=function(){var c=this.getComponent();return c.getElementsByTagName("input")[0];};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.setValue=function(v){var i=this.getComponentInput();i.value=""+v;};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.getValue=function(){return this.getComponentInput().value;};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.setEnabled=function(flag){var i=this.getComponentInput();i.readOnly=!flag;};IONIC.ui.navigation.AbstractNavInfoInputField.prototype.getLabelText=function(){return"";}; IONIC.defns("ui.navigation");IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField=function(navInfo){IONIC.ui.navigation.AbstractNavInfoInputField.call(this,navInfo);};IONIC.misc.extendType(IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField,IONIC.ui.navigation.AbstractNavInfoInputField);IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField.prototype.userAcceptedInput=function(){var map,box;var val=+(this.getValue());if(!isNaN(val)&&typeof val==="number"){map=this.getMap();if(map){box=map.getBox();box=this.modifyBox(box,val);if(box){map.setBox(box);}}}};IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField.prototype.modifyBox=function(box,arg){return box;}; IONIC.defns("ui.navigation");IONIC.ui.navigation.AbstractCoordField=function(navInfo){IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField.call(this,navInfo);this.setInputSize(7);};IONIC.misc.extendType(IONIC.ui.navigation.AbstractCoordField,IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField);IONIC.ui.navigation.AbstractCoordField.prototype.onMapAvailable=function(map,handler){if(typeof this._handler==="number"){throw"Illegal state: The map was already available";} var map=this.getMap();this._handlerId=map.addHandler("onmousemove",handler);};IONIC.ui.navigation.AbstractCoordField.prototype.onB4MapUnavailable=function(map){if(typeof this._handlerId==="number"){map.removeHandler("onmousemove",this._handlerId);this._handlerId=undefined;}};IONIC.ui.navigation.AbstractCoordField.prototype.setCoordValue=function(v){this.setValue(this.format(+v));};IONIC.ui.navigation.AbstractCoordField.prototype.format=function(inp){return Math.round(inp*1e3)/1e3;}; IONIC.ui.AbstractObjectRenderer=function(){};IONIC.ui.AbstractObjectRenderer.prototype.render=function(parentResultsHandler,object){IONIC.misc.unimp("IONIC.ui.AbstractObjectRenderer","render");}; var Dom=YAHOO.util.Dom;var Event=YAHOO.util.Event;var DDM=YAHOO.util.DragDropMgr;IONIC.ui.LayerListDDEntry=function(id,sGroup,config){IONIC.ui.LayerListDDEntry.superclass.constructor.call(this,id,sGroup,config);this.logger=this.logger||YAHOO;var el=this.getDragEl();Dom.setStyle(el,"opacity",0.67);this.goingUp=false;this.lastY=0;};YAHOO.extend(IONIC.ui.LayerListDDEntry,YAHOO.util.DDProxy,{startDrag:function(x,y){this.logger.log(this.id+" startDrag");var dragEl=this.getDragEl();var clickEl=this.getEl();Dom.setStyle(clickEl,"visibility","hidden");dragEl.innerHTML=clickEl.innerHTML;Dom.setStyle(dragEl,"color",Dom.getStyle(clickEl,"color"));Dom.setStyle(dragEl,"backgroundColor",Dom.getStyle(clickEl,"backgroundColor"));Dom.setStyle(dragEl,"border","2px solid gray");},endDrag:function(e){var srcEl=this.getEl();var proxy=this.getDragEl();Dom.setStyle(proxy,"visibility","");var a=new YAHOO.util.Motion(proxy,{points:{to:Dom.getXY(srcEl)}},0.2,YAHOO.util.Easing.easeOut) var proxyid=proxy.id;var thisid=this.id;a.onComplete.subscribe(function(){Dom.setStyle(proxyid,"visibility","hidden");Dom.setStyle(thisid,"visibility","");});a.animate();this.config.owner.applyLayersOrder();},onDragDrop:function(e,id){if(DDM.interactionInfo.drop.length===1){var pt=DDM.interactionInfo.point;var region=DDM.interactionInfo.sourceRegion;if(!region.intersect(pt)){var destEl=Dom.get(id);var destDD=DDM.getDDById(id);destEl.appendChild(this.getEl());destDD.isEmpty=false;DDM.refreshCache();}}},onDrag:function(e){var y=Event.getPageY(e);if(ythis.lastY){this.goingUp=false;} this.lastY=y;},onDragOver:function(e,id){if(isArray(id)){for(var inx=0;inx0&&this._ssld.styles[0]);if(!style){callback(null);return;} callback(style.iconUrl);};IONIC.maps.LayerLegend.prototype.render=function(){this._dh.clr(this._elt);if(this._isVisible===false||this.getSetting("display")==="none"){return;} var self=this;var elt=this._dh.elt("div.LayerLegend");var titleTxt=this._dh.txt(this.getSetting("title")||this._ssld.getParentLayerDescriptor().getTitle()||this._ssld.getName());var img=this._dh.elt("img.LayerLegendImg");switch(this.getSetting("titlePosition")){case"none":this._dh.append(elt,img);break;case"right":var title=this._dh.elt("span.Title",titleTxt);this._dh.append(elt,img,title);break;case"left":var title=this._dh.elt("span.Title",titleTxt);this._dh.append(elt,title,img);break;default:var title=this._dh.elt("div.Title",titleTxt);this._dh.append(elt,title,img);break;} function nextUrl(callback,noMoreProducersCallback){var producer;while((producer=producers.shift())){if(typeof producer==="string"){callback(producer);return;}else{producer.call(self,callback);return;}} noMoreProducersCallback();} var producers=this.getSetting("legendProducers").concat([IONIC.api.maps.MapLegend.NOLEGENDURL]);this._dh.append(this._elt,elt);img.onerror=function(event){function setImgUrl(url){if(url){img.src=url;}else{img.onerror(event);}} nextUrl(setImgUrl,function(){img.onerror=null;});};nextUrl(function(url){img.src=url;});img.onload=function(){img.onload=img.onerror=null;};};IONIC.maps.LayerLegend.prototype.refresh=IONIC.maps.LayerLegend.prototype.render;IONIC.maps.LayerLegend.prototype.destroy=function(){this._ssld.getParentLayerDescriptor().onVisibilityChanged.unsubscribe(this._onVisibilityChangedCallback);this._dh.rmv(this._elt);}; IONIC.maps.ContextSerializationTool=function(window){IONIC.misc.errorInstantiate("IONIC.maps.ContextSerializationTool");};IONIC.maps.ContextSerializationTool.serialize=function(map,saveCredentials){var topObj=IONIC.api.maps.Map.toTransportFormat(map);var str=JSON.stringify(topObj);var transitFrame=IONIC.misc.getTransitFrame(IONIC.maps.ContextSerializationTool);var form=document.createElement("form");form.style.display="none";form.method="post";form.name=gensym("context_serialization_form_");form.target=transitFrame.name;form.enctype="multipart/form-data";form.action=IONIC.misc.getWebappBaseUrl()+"/buildContext.do"+ (saveCredentials?"?saveCredentials="+escape(saveCredentials):"");var jsonText=document.createElement("input");jsonText.type="hidden";jsonText.name="jsonText";jsonText.value=str;form.appendChild(jsonText);document.body.appendChild(form);form.submit();};IONIC.maps.ContextSerializationTool.serializeToString=function(map,callback){var rt=new IONIC.misc.RequestTool();var url=IONIC.misc.getWebappBaseUrl()+"/buildContext.do?outputType=string";rt.withUrl(url,"POST",function(success,obj,responseText){callback(responseText);},JSON.stringify(IONIC.api.maps.Map.toTransportFormat(map)));};IONIC.maps.ContextSerializationTool.withDeserialized=function(form,callback,win,map){win=win||window;var dh=new IONIC.api.ui.DomHelper(win.document);var self=this;IONIC.misc.ajaxifyForm(dh,form,"/extractContext.do",true,function(viewDescriptor){self._loadOrCreateMap(map,win,viewDescriptor,callback);});var extractionMethod=form.extractionMethod;if(!extractionMethod){extractionMethod=dh.elt("input");extractionMethod.type="hidden";extractionMethod.name="extractionMethod";extractionMethod.value="contextfile";dh.append(form,extractionMethod);} form.submit();};IONIC.maps.ContextSerializationTool.withDeserializedFromString=function(xmlBlob,callback,win,map){var rt=new IONIC.misc.RequestTool();var thisRef=this;var url=IONIC.misc.getWebappBaseUrl()+"/extractContext.do"+"?extractionMethod=handler"+"&handlerClassName=com.ionicsoft.paic.actions.context.HttpServletRequestBodyContextStreamSource";rt.withUrl(url,"POST",function(success,mapDescriptor,response){if(callback){thisRef._loadOrCreateMap(map,win,mapDescriptor,callback);}},xmlBlob);};IONIC.maps.ContextSerializationTool._loadOrCreateMap=function(map,win,descriptor,callback){if(!descriptor){throw"Woops! The object that was returned by the server does not appear to be a view descriptor..";} var view;var proceed=function(){if(callback){callback(view);}};if(map){view=map;view.loadMapFromDescriptor(descriptor,proceed);}else{view=IONIC.api.maps.Map.fromTransportFormat(descriptor,win,null,proceed);}}; IONIC.defns("maps");IONIC.maps.BoxNegociatorsQueue=function(){this.negociators=[];};IONIC.maps.BoxNegociatorsQueue.prototype.insertAt=function(negociator,position){var list=this.getNegociators();if(position>list.length){throw"Illegal state: Cannot insert box negociator at out-of-bounds position "+position;} list.splice(position,0,negociator);};IONIC.maps.BoxNegociatorsQueue.prototype.forEachNegociator=function(fun){IONIC.misc.forEach(fun,this.getNegociators());};IONIC.maps.BoxNegociatorsQueue.prototype.getNegociators=function(){return this.negociators;};IONIC.maps.BoxNegociatorsQueue.prototype.remove=function(negociator){var list=this.getNegociators();var data=IONIC.misc.findItem(negociator,list);if(data){list.splice(data[1],1);}};IONIC.maps.BoxNegociatorsQueue.prototype.withNegociatedBox=function(input,prevBox,map,proceed){var self=this;var negociators=this.getNegociators().slice();var iteratr=function(currentBox){var curNeg=negociators.shift();if(curNeg){curNeg.withNegociatedBox(currentBox,prevBox,map,iteratr);}else{proceed(currentBox);}};iteratr(input);}; IONIC.maps.AbstractBoxNegociator=function(){};IONIC.maps.AbstractBoxNegociator.prototype.toString=function(){return"IONIC.maps.AbstractBoxNegociator";};IONIC.maps.AbstractBoxNegociator.prototype.withNegociatedBox=function(input,prevBox,view,proceed){proceed(input);};IONIC.maps.AbstractBoxNegociator.prototype.findPreferredPositionInQueue=function(queue){return queue.getNegociators().length;}; IONIC.maps.SimpleBoxNegociator=function(){IONIC.maps.AbstractBoxNegociator.call(this);this.setAspect(1.0);};IONIC.misc.extendType(IONIC.maps.SimpleBoxNegociator,IONIC.maps.AbstractBoxNegociator);IONIC.maps.SimpleBoxNegociator.prototype.setAspect=function(aspect){this.aspect=aspect;};IONIC.maps.SimpleBoxNegociator.prototype.getAspect=function(){return this.aspect;};IONIC.maps.SimpleBoxNegociator.prototype.toString=function(){return"IONIC.maps.SimpleBoxNegociator";};IONIC.maps.SimpleBoxNegociator.prototype.withNegociatedBox=function(input,prevBox,map,proceed){var conb=this.getConstrainedBox();var offx=0,offy=0;if(conb){if(conb.epsgId!=input.epsgId){}else{if(input.minxconb.maxx){offx=conb.maxx-input.maxx;} if(input.maxy>conb.maxy){offy=conb.maxy-input.maxy;} if(offx||offy){input.shift(offx,offy);} if(input.minx0.0001){if(dxBox>dyBox){output=new IONIC.api.geom.Box(input.minx,center.y-((dxBox/2)*ratioPxl),input.maxx,center.y+((dxBox/2)*ratioPxl),input.epsgId);}else{output=new IONIC.api.geom.Box(center.x-((dyBox/2)/ratioPxl),input.miny,center.x+((dyBox/2)/ratioPxl),input.maxy,input.epsgId);}}else{output=input;} proceed(output);};IONIC.maps.SimpleBoxNegociator.prototype.getConstrainedBox=function(){return this._constrBox;};IONIC.maps.SimpleBoxNegociator.prototype.setConstrainedBox=function(box){this._constrBox=box;}; IONIC.maps.GridBoxNegociator=function(grids){IONIC.maps.AbstractBoxNegociator.call(this);this._gs=grids;};IONIC.misc.extendType(IONIC.maps.GridBoxNegociator,IONIC.maps.AbstractBoxNegociator);IONIC.maps.GridBoxNegociator.prototype.getGridsDescriptions=function(){return this._gs;};IONIC.maps.GridBoxNegociator.prototype.forEachGridDescription=function(fun){IONIC.misc.forEach(fun,this.getGridsDescriptions());};IONIC.maps.GridBoxNegociator.GridDesc=function(dxpp,dypp,informativeScale){this.dxpp=dxpp;this.dypp=dypp;this.informativeScale=informativeScale;};IONIC.maps.GridBoxNegociator.GridDesc.prototype.getAspect=function(){return this.dypp/this.dxpp;};IONIC.maps.GridBoxNegociator.prototype.withNegociatedBox=function(input,prevBox,view,proceed){var i,n,rsx,rsy,_x,_y,center,newBox;var width=view.getWidth();var height=view.getHeight();var grids=this.getGridsDescriptions();var dx=input.diffX();var dy=input.diffY();var rrx=dx/width;var rry=dy/height;var curGrid,curGridRatioDist;var curGridScale,curGridRatioX,curGridRatioY;var careForX=rrx>=rry;var foundGrid,foundGridRatioDist;for(i=0,n=grids.length;i0?" type=\"text/vbscript\"":"")+" src=\"",(path+"/"+file),"\"",">","\n");} var inclStr=includes.join("");document.write(inclStr);})(); IONIC.maps.AbstractLayerDescriptor=function(){this.uuid=gensym("uuid");this.opacity=1.0;this.visibilityBits={};this.whenInitializedQueue=[];this.webappBaseURL=IONIC.misc.getWebappBaseUrl();IONIC.misc.createCustomEvents(this.getCustomEventsNames(),this);this.setUserVisibility(true);};IONIC.maps.AbstractLayerDescriptor.customEventsNames=["onLoading","onLoadingDone","onLoadingError","onVisibilityChanged","onOpacityChanged","onAttributeChanged"];IONIC.maps.AbstractLayerDescriptor.prototype.getView=function(){return this.map;};IONIC.maps.AbstractLayerDescriptor.prototype.getMap=function(){return this.getView();};IONIC.maps.AbstractLayerDescriptor.prototype.getCustomEventsNames=function(){return IONIC.maps.AbstractLayerDescriptor.customEventsNames.slice();};IONIC.maps.AbstractLayerDescriptor.prototype.isBasemap=function(){return false;};IONIC.maps.AbstractLayerDescriptor.prototype.getBoundingBox=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.setView=function(v){this.setMap();};IONIC.maps.AbstractLayerDescriptor.prototype.attachToMap=function(map){var htmlLayer=this.produceHTMLLayer();if(htmlLayer){this.setHTMLLayer(htmlLayer);map.getHTMLView().appendChild(htmlLayer);}};IONIC.maps.AbstractLayerDescriptor.prototype.detachFromMap=function(map){var htmlLayer=this.getHTMLLayer();var htmlView=map.getHTMLView();if(htmlLayer&&htmlLayer.parentNode===htmlView){htmlView.removeChild(htmlLayer);}};IONIC.maps.AbstractLayerDescriptor.prototype.destroy=function(domHelper){if(this.getMap()){throw"Illegal state: IONIC.maps.AbstractLayerDescriptor.prototype.destroy() was called but the layer still refers the map";} var htmlLayer=this.getHTMLLayer();if(htmlLayer){domHelper.purge(htmlLayer);this.setHTMLLayer(null);}};IONIC.maps.AbstractLayerDescriptor.prototype.setMap=function(map){this.map=map;};IONIC.maps.AbstractLayerDescriptor.prototype.refresh=function(mapRequest){if(mapRequest){mapRequest.layerLoaded(this);}};IONIC.maps.AbstractLayerDescriptor.prototype.setIntermediateBox=function(box,mapBox,zoomPoint){};IONIC.maps.AbstractLayerDescriptor.prototype.onMapDragStart=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.onMapDragEnd=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.mapFullyRefreshed=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.mapResized=function(width,height){};IONIC.maps.AbstractLayerDescriptor.prototype.mapScaleComputed=function(scale){};IONIC.maps.AbstractLayerDescriptor.prototype.toString=function(){return"Layer ("+this.uuid+")";};IONIC.maps.AbstractLayerDescriptor.prototype.isNativelySupportedSrs=function(epsgId){return true;};IONIC.maps.AbstractLayerDescriptor.prototype.getHTMLLayer=function(){return this.htmlLayer;};IONIC.maps.AbstractLayerDescriptor.prototype.produceHTMLLayer=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.setHTMLLayer=function(layer){this.htmlLayer=layer;};IONIC.maps.AbstractLayerDescriptor.prototype.shift=function(shiftx,shifty){var view=this.getView();var htmlLayer=this.getHTMLLayer();if(htmlLayer){htmlLayer.style.left=shiftx+'px';htmlLayer.style.top=shifty+'px';}};IONIC.maps.AbstractLayerDescriptor.prototype.endDrag=function(){};IONIC.maps.AbstractLayerDescriptor.prototype.getScaleRangeVisibility=function(){return this.getScaleVisibility();};IONIC.maps.AbstractLayerDescriptor.prototype.getScaleVisibility=function(){if(!this.getView()){return true;} return this.isVisibleAtScale(this.getView().getComputedScale());};IONIC.maps.AbstractLayerDescriptor.prototype.isVisibleAtScale=function(scale){return true;};IONIC.maps.AbstractLayerDescriptor.prototype.getVisibility=function(){var id,bits=this.visibilityBits,vis=true;for(id in bits){if(bits.hasOwnProperty(id)){vis=vis&&bits[id];}} return vis&&this.getScaleVisibility();};IONIC.maps.AbstractLayerDescriptor.USER_VISIBILITY_BIT="user";IONIC.maps.AbstractLayerDescriptor.prototype.toggleUserVisibility=function(){this.setUserVisibility(!this.getUserVisibility());};IONIC.maps.AbstractLayerDescriptor.prototype.setUserVisibility=function(flag){this.setVisibilityBit(IONIC.maps.AbstractLayerDescriptor.USER_VISIBILITY_BIT,flag);var map=this.getMap();var curSrsBox,htmlLayer;if(map){htmlLayer=this.getHTMLLayer();if(htmlLayer){this.setHTMLLayerVisibility(this.getVisibility());}}};IONIC.maps.AbstractLayerDescriptor.prototype.getUserVisibility=function(){return this.getVisibilityBit(IONIC.maps.AbstractLayerDescriptor.USER_VISIBILITY_BIT);};IONIC.maps.AbstractLayerDescriptor.prototype.setVisibilityBit=function(bit,value){this.visibilityBits[bit]=!!value;this.fireVisibilityChanged();};IONIC.maps.AbstractLayerDescriptor.prototype.getVisibilityBit=function(bit){return this.visibilityBits[bit];};IONIC.maps.AbstractLayerDescriptor.prototype.fireVisibilityChanged=function(){this.onVisibilityChanged.fire(this.getVisibility(),this.getUserVisibility(),this.getScaleVisibility());};IONIC.maps.AbstractLayerDescriptor.prototype.setHTMLLayerVisibility=function(flag){var l=this.getHTMLLayer();var cur;var wanted;if(l){cur=l.style.visibility;wanted=(flag===true)?"visible":"hidden";if(cur!==wanted){l.style.visibility=wanted;}}};IONIC.maps.AbstractLayerDescriptor.prototype.setOpacity=function(factor){factor=Math.max(0.0,Math.min(factor,1.0));var view,htmlLayer;if(this.opacity!=factor){this.opacity=factor;this.setHTMLLayerOpacity(factor);this.onOpacityChanged.fire(factor);}};IONIC.maps.AbstractLayerDescriptor.prototype.getOpacity=function(){return this.opacity;};IONIC.maps.AbstractLayerDescriptor.prototype.setHTMLLayerOpacity=function(factor){var l=this.getHTMLLayer();if(l){IONIC.misc.setElementOpacity(l,factor);}};IONIC.maps.AbstractLayerDescriptor.prototype.setBoxNegociator=function(boxNegociator){this.boxNegociator=boxNegociator;};IONIC.maps.AbstractLayerDescriptor.prototype.getBoxNegociator=function(){return this.boxNegociator;};IONIC.maps.AbstractLayerDescriptor.prototype.isLayerInitializing=function(){return!!this.initializing;};IONIC.maps.AbstractLayerDescriptor.prototype.setLayerInitializing=function(state){var self;var prevState=this.initializing;this.initializing=state;if(typeof prevState==="boolean"){if(prevState===true){if(state===false){self=this;IONIC.misc.forEach(function(callback){callback(self);},this.getInitializedCallbacksQueue());this.setInitializedCallbacksQueue([]);}}else{if(state===true){throw"Illegal state: A layer that was done initializing cannot start initialization again";}}}};IONIC.maps.AbstractLayerDescriptor.prototype.withInitializedLayer=function(fun){if(this.isLayerInitializing()){this.getInitializedCallbacksQueue().push(fun);}else{fun(this);}};IONIC.maps.AbstractLayerDescriptor.prototype.getInitializedCallbacksQueue=function(){return this.whenInitializedQueue;};IONIC.maps.AbstractLayerDescriptor.prototype.setInitializedCallbacksQueue=function(queue){this.whenInitializedQueue=queue;}; IONIC.maps.AbstractMapLayerDescriptor=function(){IONIC.maps.AbstractLayerDescriptor.call(this);this.title="";this.userSelected=false;this.ssLayers=[];};IONIC.misc.extendType(IONIC.maps.AbstractMapLayerDescriptor,IONIC.maps.AbstractLayerDescriptor);IONIC.maps.AbstractMapLayerDescriptor.prototype.setTitle=function(title){this.title=title;};IONIC.maps.AbstractMapLayerDescriptor.prototype.getTitle=function(){return this.title;};IONIC.maps.AbstractMapLayerDescriptor.prototype.isBasemap=function(){return true;};IONIC.maps.AbstractMapLayerDescriptor.prototype.getServiceType=function(){var ss0=this.getServerSideLayers()[0];if(ss0){return ss0.getServiceType();}};IONIC.maps.AbstractMapLayerDescriptor.prototype.isUserVisibilityChangeAllowed=function(){return false;};IONIC.maps.AbstractMapLayerDescriptor.prototype.hasMetadata=function(){return false;};IONIC.maps.AbstractMapLayerDescriptor.prototype.isUserSelectable=function(){return true;};IONIC.maps.AbstractMapLayerDescriptor.prototype.isUserSelected=function(){return this.userSelected;};IONIC.maps.AbstractMapLayerDescriptor.prototype.setUserSelected=function(flag){this.userSelected=flag;};IONIC.maps.AbstractMapLayerDescriptor.prototype.toggleUserSelected=function(){this.setUserSelected(!this.isUserSelected());};IONIC.maps.AbstractMapLayerDescriptor.prototype.positionChanged=function(){};IONIC.maps.AbstractMapLayerDescriptor.prototype.supportsReprojecting=function(){IONIC.misc.unimp("IONIC.maps.AbstractMapLayerDescriptor","supportsReprojecting");};IONIC.maps.AbstractMapLayerDescriptor.prototype.isRemovable=function(){return true;};IONIC.maps.AbstractMapLayerDescriptor.prototype.mapScaleComputed=function(scale){this.setHTMLLayerVisibility(this.getVisibility());};IONIC.maps.AbstractMapLayerDescriptor.prototype.mapResized=function(width,height){var l=this.getHTMLLayer(),s;if(l){l.width=width;l.height=height;s=l.style;if(s){s.width=width+"px";s.height=height+"px";}}};IONIC.maps.AbstractMapLayerDescriptor.prototype.featureSetChanged=function(url,name,namespace,ids){};IONIC.maps.AbstractMapLayerDescriptor.prototype.supportsPreviewing=function(){return false;};IONIC.maps.AbstractMapLayerDescriptor.prototype.forEachServerSideLayer=function(callback){for(var i=0,n=this.getServerSideLayers().length;i0){finalEnv=cs[0].getEnvelope();} for(i=1,n=cs.length;i0){e=true;break;}} if(e){throw"Cannot get child for insertion with pointer #"+ptr;}else{c=this.createChild(this.epsgId);this.pushChild(c);}} return c;};IONIC.geom.CCG.prototype.createChild=function(epsgId){throw this+" does not override createChild(). It should.";};IONIC.geom.CCG.prototype.insertPointAt=function(ptr,pt){var c;if(ptr.length>1){c=this._getChild4Insert(ptr);c.insertPointAt(ptr.slice(1),pt);}else{throw"Should never have come here!";}};IONIC.geom.CCG.prototype.getPointAt=function(ptr){var cn=ptr[0];var c=this._directChild4Ptr(ptr,true,"getPointAt");return c.getPointAt(ptr.slice(1));};IONIC.geom.CCG.prototype.deletePointAt=function(ptr,autodel){var cn=ptr[0];var c=this._directChild4Ptr(ptr,true,"deletePointAt");c.deletePointAt(ptr.slice(1),autodel);if(autodel&&!c.countVertices()){this.removeChild(cn);}};IONIC.geom.CCG.prototype.removeChild=function(i){var cn,c;if(typeof i==="number"){cn=this.countChildren();if(i>=cn){throw"Trying to remove geometry #"+i+" out of a composed geometry consisting of "+ cn+" children";} return this._c.splice(i,1);}else{switch(i.length){case 2:this.removeChild(i[0]);break;case 3:c=this._directChild4Ptr(i,true,"removeChild");c.removeChild(i.slice(1));break;default:throw"Unexpected pointer for removeChild(): "+i;}}};IONIC.geom.CCG.prototype.setPointAt=function(ptr,pt){var cn=ptr[0];var c=this._directChild4Ptr(ptr,true,"setPointAt");c.setPointAt(ptr.slice(1),pt);};IONIC.geom.CCG.prototype.getStartPointer=function(){throw this+" does not override getStartPointer(). It should.";};IONIC.geom.CCG.prototype.getEndPointer=function(){var cc=this.countChildren();var lc=cc-1;if(lc<0){return this.getStartPointer();}else{return[lc].concat(this.getChild(lc).getEndPointer());}};IONIC.geom.CCG.prototype.vertexIdxToPointer=function(idx){var i,n,cc,ccn;for(i=0,n=this.countChildren();i2?c.pointerToVertexIdx(ptr.slice(1)):ptr[1];var total=0;for(var i=0;i1&&c){c=c._directChild4Ptr(ptr,ex,"getCurveForPointer");ptr=ptr.slice(1);} return c;};IONIC.geom.CCG.prototype.getCurveEndPointer=function(ptr){var cn=ptr[0];var c=this._directChild4Ptr(ptr,true,"getCurveEndPointer");if(ptr.length>2){return[cn].concat(c.getCurveEndPointer(ptr.slice(1)));}else{return[cn].concat(c.getCurveEndPointer());}};IONIC.geom.CCG.prototype.forEachPair=function(fun){this.doForEachPair(fun);};IONIC.geom.CCG.prototype.doForEachPair=function(fun,parentPtr){parentPtr=(parentPtr?parentPtr.concat([0]):[0]);this.forEachChild(function(child){child.doForEachPair(fun,parentPtr);parentPtr[parentPtr.length-1]++;});}; IONIC.geom.GeometryTypes=function(){throw"The GeometryTypes type is not meant to be instanciated.";};IONIC.geom.GeometryTypes.TYPE_POINT=0xbeadfeed;IONIC.geom.GeometryTypes.TYPE_BOX=0xdeadbeef;IONIC.geom.GeometryTypes.TYPE_MULTIPOINT=0xdeaffade;IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING=0xdaddadee;IONIC.geom.GeometryTypes.TYPE_LINE_STRING=0xfadebedd;IONIC.geom.GeometryTypes.TYPE_LINEAR_RING=0xfaadbade;IONIC.geom.GeometryTypes.TYPE_POLYGON=0x000decaf;IONIC.geom.GeometryTypes.TYPE_MULTIPOLYGON=0x00dadada;IONIC.geom.GeometryTypes.get=function(geomData){if(geomData._tp){return geomData._tp;} var t;if(geomData instanceof IONIC.api.geom.Box){t=IONIC.geom.GeometryTypes.TYPE_BOX;} else if(geomData instanceof IONIC.api.geom.Point){t=IONIC.geom.GeometryTypes.TYPE_POINT;} else if(geomData instanceof IONIC.api.geom.Polygon){t=IONIC.geom.GeometryTypes.TYPE_POLYGON;} else if(geomData instanceof IONIC.api.geom.MultiPolygon){t=IONIC.geom.GeometryTypes.TYPE_MULTIPOLYGON;} else if(geomData instanceof IONIC.api.geom.MultiLineString){t=IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING;} else if(geomData instanceof IONIC.api.geom.LineString){t=IONIC.geom.GeometryTypes.TYPE_LINE_STRING;} else if(geomData instanceof IONIC.api.geom.MultiPoint){t=IONIC.geom.GeometryTypes.TYPE_MULTIPOINT;} else{throw"Unrecognized geometry type: "+geomData;} geomData._tp=t;return t;} IONIC.geom.JGTFTool=function(){IONIC.misc.errorInstantiate("IONIC.geom.JGTFTool");};IONIC.geom.JGTFTool.TYPES_MAP={"point":IONIC.geom.GeometryTypes.TYPE_POINT,"box":IONIC.geom.GeometryTypes.TYPE_BOX,"multipoint":IONIC.geom.GeometryTypes.TYPE_MULTIPOINT,"linestring":IONIC.geom.GeometryTypes.TYPE_LINE_STRING,"multilinestring":IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING,"linearring":IONIC.geom.GeometryTypes.TYPE_LINEAR_RING,"polygon":IONIC.geom.GeometryTypes.TYPE_POLYGON,"multipolygon":IONIC.geom.GeometryTypes.TYPE_MULTIPOLYGON};IONIC.geom.JGTFTool.typeStringToType=function(ts){return IONIC.geom.JGTFTool.TYPES_MAP[ts];};IONIC.geom.JGTFTool.typeToTypeString=function(type){var tm=IONIC.geom.JGTFTool.TYPES_MAP;for(var id in tm){if(tm.hasOwnProperty(id)){if(tm[id]==type){return id;}}}};IONIC.geom.JGTFTool.COMPRESSION_NORMAL=1<<0;IONIC.geom.JGTFTool.geometryToJGTF=function(geomData,cardinality,compression){if(typeof cardinality==="undefined"){cardinality=2;} if(typeof compression==="undefined"){compression=IONIC.geom.JGTFTool.COMPRESSION_NORMAL;} if(cardinality!=2){throw"Can only write in 2D data";} if(compression!=IONIC.geom.JGTFTool.COMPRESSION_NORMAL){throw"Unknown compression mode: "+compression;} var type=IONIC.geom.GeometryTypes.get(geomData);var data;var epsgId=geomData.epsgId;switch(type){case IONIC.geom.GeometryTypes.TYPE_POINT:data=[geomData.x,geomData.y];break;case IONIC.geom.GeometryTypes.TYPE_BOX:data=[geomData.minx,geomData.miny,geomData.maxx,geomData.maxy];break;case IONIC.geom.GeometryTypes.TYPE_LINE_STRING:case IONIC.geom.GeometryTypes.TYPE_MULTIPOINT:data=geomData.points.slice();data.arrayOfDoubles=true;break;case IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING:data=IONIC.geom.JGTFTool._extractMultiLineStringPts(geomData);break;case IONIC.geom.GeometryTypes.TYPE_POLYGON:data=IONIC.geom.JGTFTool._extractPolygonPts(geomData);break;case IONIC.geom.GeometryTypes.TYPE_MULTIPOLYGON:data=[];var cs=geomData.getChildren();for(var i=0;imaxx?x:maxx;maxy=y>maxy?y:maxy;} this.envelope=IONIC.api.geom.Box.newInstance(minx,miny,maxx,maxy,this.epsgId);} return this.envelope;};IONIC.geom.edit.Chunk.prototype.forEachSegment=function(callback){if(this.pointCount<2){return;} switch(this.geometryType){case IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING:case IONIC.geom.GeometryTypes.TYPE_LINE_STRING:case IONIC.geom.GeometryTypes.TYPE_POLYGON:case IONIC.geom.GeometryTypes.TYPE_MULTIPOLYGON:var n=this.pointCount-1;for(var i=0;i=ptCount){upperBound=ptCount;lowerBound=Math.max(0,upperBound-chunkSize);}} if(lowerBound<0){pts=curve.getPoints(ptCount+lowerBound,ptCount).concat(curve.getPoints(0,upperBound));IONIC.geom.edit.Chunk._addIndicesAndPointers (idxs,ptrs,curveStartIdxInGeom,curveStartPtrInGeom,ptCount+lowerBound,ptCount);IONIC.geom.edit.Chunk._addIndicesAndPointers (idxs,ptrs,curveStartIdxInGeom,curveStartPtrInGeom,0,upperBound);}else if(upperBound>ptCount){pts=curve.getPoints(lowerBound,ptCount).concat(curve.getPoints(0,(upperBound-ptCount)+1));IONIC.geom.edit.Chunk._addIndicesAndPointers (idxs,ptrs,curveStartIdxInGeom,curveStartPtrInGeom,lowerBound,ptCount);IONIC.geom.edit.Chunk._addIndicesAndPointers (idxs,ptrs,curveStartIdxInGeom,curveStartPtrInGeom,0,(upperBound-ptCount));}else{pts=curve.getPoints(lowerBound,upperBound);IONIC.geom.edit.Chunk._addIndicesAndPointers (idxs,ptrs,curveStartIdxInGeom,curveStartPtrInGeom,lowerBound,upperBound);}} return new IONIC.geom.edit.Chunk(pts,idxs,ptrs,type,epsgId,chunkSize,curveStartPtrInGeom,null,wholeRing,requestedPointer,IONIC.geom.edit.GeometryPointer.set(requestedPointer,0,idxInCurve));}; IONIC.geom.edit.GeometryEditionBuffer=function(verticesFetcher,verticesProvider){this.verticesFetcher=verticesFetcher;this.verticesProvider=verticesProvider;};IONIC.geom.edit.GeometryEditionBuffer.newInstance=function(verticesFetcher,verticesProvider){return new IONIC.geom.edit.GeometryEditionBuffer(verticesFetcher,verticesProvider);};IONIC.geom.edit.GeometryEditionBuffer.prototype.getGeometryType=function(){return this.verticesFetcher.getGeometryType();};IONIC.geom.edit.GeometryEditionBuffer.prototype.findNearestPointerInfo=function(point){return this.verticesFetcher.findNearestPointerInfo(point);};IONIC.geom.edit.GeometryEditionBuffer.prototype.getCurrentChunk=function(){return this.verticesProvider.getCurrentChunk();};IONIC.geom.edit.GeometryEditionBuffer.prototype.selectChunkForPointer=function(ptr){return this.verticesProvider.selectChunkForPointer(ptr);};IONIC.geom.edit.GeometryEditionBuffer.prototype.hasNextChunk=function(){return this.verticesProvider.hasNextChunk(this);};IONIC.geom.edit.GeometryEditionBuffer.prototype.hasPreviousChunk=function(){return this.verticesProvider.hasPreviousChunk(this);};IONIC.geom.edit.GeometryEditionBuffer.prototype.getGeometryObject=function(){return this.verticesFetcher.getGeometryObject();};IONIC.geom.edit.GeometryEditionBuffer.prototype.setGeometryObject=function(geom,ptrOfInterest){return this.verticesFetcher.setGeometryObject(geom,ptrOfInterest);}; IONIC.geom.edit.GeometryPointer=function(){throw"The IONIC.geom.edit.GeometryPointer type is static and is not meant to be instanciated.";};IONIC.geom.edit.GeometryPointer.copy=function(p){return p.slice();};IONIC.geom.edit.GeometryPointer.add=function(p0,p1){var pCopy=p0.slice();if(typeof p1!=="number"){throw"Cannot YET add non-number to multi-dimensional pointer";} pCopy[pCopy.length-1]+=p1;return pCopy;};IONIC.geom.edit.GeometryPointer.set=function(p,rank,value){var pc;if(rank<\/div>';};jsGraphics.prototype.drawEditableGeometryVertex=function(x,y,w,h,zIndex,geometryIdx,pointer,vertexIdInGeom,mapViewId,layerDesignator,onMouseClickHandlerName,onMouseDownHandlerName,onMouseUpHandlerName,noVtxIdx){this.mkVertexDiv(x,y,w,h,zIndex,geometryIdx,pointer,mapViewId,layerDesignator,onMouseClickHandlerName,onMouseDownHandlerName,onMouseUpHandlerName);if(!noVtxIdx){var oldColor=this.getColor();this.setColor("#000000");this.setFont('verdana,geneva,helvetica,sans-serif',String.fromCharCode(0x30,0x39,0x70,0x78),Font.PLAIN);this.drawString(vertexIdInGeom,x,y+(h/2));this.setColor(oldColor);}}; IONIC.defns("feature");IONIC.feature.WFSInfoTool=function(){IONIC.misc.errorInstantiate("IONIC.feature.WFSInfoTool");};IONIC.feature.WFSInfoTool.ServiceInfo=function(url,insertOp,updateOp,deleteOp){this._url=url;this._ins=insertOp;this._upd=updateOp;this._del=deleteOp;};IONIC.feature.WFSInfoTool.ServiceInfo.prototype.getServiceUrl=function(){return this._url;};IONIC.feature.WFSInfoTool.ServiceInfo.prototype.supportsInsert=function(){return!!this._ins;};IONIC.feature.WFSInfoTool.ServiceInfo.prototype.supportsUpdate=function(){return!!this._upd;};IONIC.feature.WFSInfoTool.ServiceInfo.prototype.supportsDelete=function(){return!!this._del;};IONIC.feature.WFSInfoTool.ServiceInfo.prototype.isTransactional=function(){return this.supportsInsert()||this.supportsUpdate()||this.supportsDelete();};IONIC.feature.WFSInfoTool.ServiceInfo.fromTransportFormat=function(tfsi){return new IONIC.feature.WFSInfoTool.ServiceInfo(tfsi.url,tfsi.insertOp,tfsi.updateOp,tfsi.deleteOp);};IONIC.feature.WFSInfoTool._RT=new IONIC.misc.RequestTool();IONIC.feature.WFSInfoTool.withServiceInfo=function(url,callback){if(!callback){return;} var fullUrl=IONIC.misc.getWebappBaseUrl()+"/wfsInfo.do"+"?serverUrl="+escape(url);IONIC.feature.WFSInfoTool._RT.withUrl(fullUrl,"GET",function(success,obj){if(success){callback(IONIC.feature.WFSInfoTool.ServiceInfo.fromTransportFormat(obj));}});}; IONIC.feature.FeaturePanelConfig=function(name,ns){this.name=name;this.ns=ns;this.properties=[];};IONIC.feature.FeaturePanelConfig._RT=IONIC.misc.RequestTool.newInstance();IONIC.feature.FeaturePanelConfig._pool=[];IONIC.feature.FeaturePanelConfig._getGetPanelConfigurationUrl=function(name,ns,featureServerUrl){return IONIC.misc.getWebappBaseUrl()+"/getFeaturePanelConfig.do"+"?featureTypeName="+escape(name)+"&featureTypeNamespace="+escape(ns)+"&serverUrl="+escape(featureServerUrl)+"&sourceType="+escape("FeatureServer");} IONIC.feature.FeaturePanelConfig.withFeaturePanelConfig=function(name,ns,featureServerUrl,callback){var cacheConfig=IONIC.feature.FeaturePanelConfig._getFeaturePanelConfigFromPool(name,ns);if(cacheConfig){return callback(true,cacheConfig);} var url=IONIC.feature.FeaturePanelConfig._getGetPanelConfigurationUrl(name,ns,featureServerUrl);var putInPool=function(success,config){IONIC.feature.FeaturePanelConfig._pool.push(config);callback(success,config);};IONIC.feature.FeaturePanelConfig._RT._withUrl(url,"GET",function(success,config){putInPool(success,IONIC.feature.FeaturePanelConfig.fromTransportFormat(name,ns,config));});};IONIC.feature.FeaturePanelConfig._getFeaturePanelConfigFromPool=function(name,namespace){var found=IONIC.misc.findItem(null,IONIC.feature.FeaturePanelConfig._pool,function(unused,poolConfig){return(poolConfig.getName()===name&&poolConfig.getNamespace()===namespace);});if(found){return found[0];} return null;};IONIC.feature.FeaturePanelConfig.prototype._getPropertyConfig=function(name,ns){var prop;for(var i=0,n=this.properties.length;i=0){saveDescriptor.maxNbFeatures=maxNbFeatures;} IONIC.feature.DataManager.getForm(saveDescriptor).submit();};IONIC.feature.DataManager.getForm=function(saveDescriptor){var form,jsonText,trampolineName,jsCallbackErrorCode;if(!IONIC.feature.DataManager._form){form=document.createElement("form");form.style.display="none";form.method="post";form.name=gensym("data_manager_form_");form.target=IONIC.misc.getTransitFrame(IONIC.feature.DataManager).name;form.enctype="multipart/form-data";form.action=IONIC.misc.getWebappBaseUrl()+"/downloadFeatureData.do";jsonText=document.createElement("input");jsonText.type="hidden";jsonText.name="jsonText";form.appendChild(jsonText);IONIC.feature.DataManager._form_jsonText=jsonText;trampolineName=gensym("trampolineDataManager");top[trampolineName]=function(object){alert('Error: '+object.errorMessage+'. '+object.stackTrace);};jsCallbackErrorCode=document.createElement("input");jsCallbackErrorCode.type="hidden";jsCallbackErrorCode.name="jsCallbackErrorCode";jsCallbackErrorCode.value="function (object) {\n"+" top ['"+trampolineName+"'] (object);\n}";form.appendChild(jsCallbackErrorCode);document.body.appendChild(form);IONIC.feature.DataManager._form=form;} IONIC.feature.DataManager._form_jsonText.value=JSON.stringify(saveDescriptor);return IONIC.feature.DataManager._form;}; IONIC.feature.FilterDef=function(){IONIC.misc.errorInstantiate("FilterDef");};IONIC.feature.FilterDef.OGC_FILTER="ogcFilter";IONIC.feature.FilterDef.PROPERTIES_FILTER="properties";IONIC.feature.FilterDef.OUTPROPERTIES_FILTER="outproperties";IONIC.feature.FilterDef.IDS_ENTRY="ids";IONIC.feature.FilterDef.EXPR_ENTRY="expr";IONIC.feature.FilterDef.OP_LOG_OR="or";IONIC.feature.FilterDef.OP_LOG_AND="and";IONIC.feature.FilterDef.OP_LOG_NOT="not";IONIC.feature.FilterDef.OP_SPAT_EQUAL="sp_eql";IONIC.feature.FilterDef.OP_SPAT_DISJOINT="sp_disjoint";IONIC.feature.FilterDef.OP_SPAT_TOUCHES="sp_touches";IONIC.feature.FilterDef.OP_SPAT_WITHIN="sp_within";IONIC.feature.FilterDef.OP_SPAT_OVERLAPS="sp_overlaps";IONIC.feature.FilterDef.OP_SPAT_CROSSES="sp_crosses";IONIC.feature.FilterDef.OP_SPAT_INTERSECTS="sp_intersects";IONIC.feature.FilterDef.OP_SPAT_CONTAINS="sp_contains";IONIC.feature.FilterDef.OP_SPAT_DWITHIN="sp_dwithin";IONIC.feature.FilterDef.OP_SPAT_BEYOND="sp_beyond";IONIC.feature.FilterDef.OP_SPAT_BBOX="sp_bbox";IONIC.feature.FilterDef.OP_COMP_EQUAL="==";IONIC.feature.FilterDef.OP_COMP_NOT_EQUAL="!=";IONIC.feature.FilterDef.OP_COMP_LESS="<";IONIC.feature.FilterDef.OP_COMP_GREATER=">";IONIC.feature.FilterDef.OP_COMP_LESSOE="<=";IONIC.feature.FilterDef.OP_COMP_GREATEROE=">=";IONIC.feature.FilterDef.OP_COMP_LIKE="like";IONIC.feature.FilterDef.OP_COMP_NULL="isnull";IONIC.feature.FilterDef.OP_COMP_BETWEEN="isbetween";IONIC.feature.FilterDef.OP_FUNCTION="function";IONIC.feature.FilterDef.FUNCTION_PARAM_TYPE_GEOMETRY="geometry";IONIC.feature.FilterDef.FUNCTION_PARAM_TYPE_STRING="string";IONIC.feature.FilterDef.FUNCTION_PARAM_TYPE_PROPERTY="property"; IONIC.feature.FeatureEditionTool=function(serverUrl,featureName,featureNamespace){IONIC.misc.RequestTool.call(this);this.serverUrl=serverUrl;this.featureName=featureName;this.featureNamespace=featureNamespace;var myAn={};var pubAn=IONIC.feature.FeatureEditionTool.DEFAULT_ACTION_PATHS;for(var id in pubAn){if(pubAn.hasOwnProperty(id)){myAn[id]=pubAn[id];}} this._actionNames=myAn;};IONIC.misc.extendType(IONIC.feature.FeatureEditionTool,IONIC.misc.RequestTool);IONIC.feature.FeatureEditionTool.newInstance=function(serverUrl,featureName,featureNamespace){return new IONIC.feature.FeatureEditionTool(serverUrl,featureName,featureNamespace);};IONIC.feature.FeatureEditionTool.DEFAULT_ACTION_PATHS={"getFeatures":"getFeatures","newFeature":"createFeature","selectFeature":"selectFeature","updateFeature":"updateFeature","deleteFeature":"deleteFeature","releaseFeature":"releaseFeature","fetchSatelliteGeometries":"fetchSatelliteGeometries"};IONIC.feature.FeatureEditionTool.prototype.getServerUrl=function(){return this.serverUrl;};IONIC.feature.FeatureEditionTool.prototype.getFeatureTypeName=function(){return this.featureName;};IONIC.feature.FeatureEditionTool.prototype.getFeatureTypeNamespace=function(){return this.featureNamespace;};IONIC.feature.FeatureEditionTool.prototype._buildActionBaseUrl=function(actionName){return IONIC.misc.getWebappBaseUrl()+"/"+this._actionNames[actionName]+".do?"+"featureName="+escape(this.featureName)+ (this.featureNamespace?("&featureNameSpace="+escape(this.featureNamespace)):"")+"&serverUrl="+escape(this.serverUrl)+"&sourceType="+escape("FeatureServer");};IONIC.feature.FeatureEditionTool.prototype.setActionPath=function(name,path){this._actionNames[name]=path;};IONIC.feature.FeatureEditionTool.prototype.getGetFeaturesUrl=function(){return this._buildActionBaseUrl("getFeatures")+"&outputFormat="+escape("json");};IONIC.feature.FeatureEditionTool.prototype.getGetFeatureByIdUrl=function(id,epsgId){return this._buildActionBaseUrl("getFeatures")+"&featureId="+escape(id)+"&outputFormat="+escape("json")+"&epsgId="+escape(epsgId);};IONIC.feature.FeatureEditionTool.prototype.getSelectFeatureUrl=function(id,epsgId){return this._buildActionBaseUrl("selectFeature")+ (id?"&featureId="+escape(id):"&createFeature="+escape(true))+"&twoDimensional="+escape(true)+"&epsgId="+escape(epsgId);};IONIC.feature.FeatureEditionTool.prototype.getReleaseFeatureUrl=function(id){return this._buildActionBaseUrl("releaseFeature")+"&featureId="+escape(id);};IONIC.feature.FeatureEditionTool.prototype.getNewFeatureUrl=function(id,epsgId){return this._buildActionBaseUrl("newFeature")+ (id?("&featureId="+escape(id)):"")+"&twoDimensional="+escape(true)+"&epsgId="+escape(epsgId);};IONIC.feature.FeatureEditionTool.prototype.getDeleteFeatureUrl=function(id){return this._buildActionBaseUrl("deleteFeature")+"&featureId="+escape(id);};IONIC.feature.FeatureEditionTool.prototype.getUpdateFeatureUrl=function(id,lockTime,epsgId){return this._buildActionBaseUrl("updateFeature")+ (id?"&featureId="+escape(id):"")+"&twoDimensional="+escape(true)+"&epsgId="+escape(epsgId)+"&lockTime="+escape(lockTime);};IONIC.feature.FeatureEditionTool.prototype.getSatelliteGeometriesUrl=function(point,srsBox,outputEpsgId,maxVertices,outerShapesOnly,geomPName,geomPNamespace){return this._buildActionBaseUrl("fetchSatelliteGeometries")+"&logicalX="+escape(point[0])+"&logicalY="+escape(point[1])+"&srsBox="+escape(srsBox.commaRepresentation())+"&epsgId="+escape(outputEpsgId)+"&maxVertices="+escape(maxVertices)+"&outerShapesOnly="+escape(outerShapesOnly)+"&geometryPropertyName="+escape(geomPName)+"&geometryPropertyNamespace="+escape(geomPNamespace)+"&outputFormat="+escape("json");};IONIC.feature.FeatureEditionTool.prototype.withFeatureTypeInfo=function(callback){var thisRef=this;IONIC.feature.FeatureTypeInfoPool.withFeatureTypeInfo(this.getServerUrl(),this.getFeatureTypeName(),this.getFeatureTypeNamespace(),function(fti){thisRef._featureTypeDescriptor=fti;callback(fti);});};IONIC.feature.FeatureEditionTool.prototype.withNewFeature=function(id,epsgId,callback){IONIC.feature.FeatureTypeInfoPool.withFeatureTypeInfo(this.getServerUrl(),this.getFeatureTypeName(),this.getFeatureTypeNamespace(),function(fti){var feature=fti.newFeature();callback(feature);});};IONIC.feature.FeatureEditionTool.prototype.finalizeUpdatePropertiesFilters=function(propertiesFilters){return propertiesFilters;};IONIC.feature.FeatureEditionTool.prototype.withUpdatedFeature=function(feature,epsgId,callback){var url=this.getUpdateFeatureUrl(feature.getId(),0,epsgId);var thisRef=this;var updateMaterial={"update":IONIC.feature.FeatureSerializationTool.featureToTransportFormat (feature._getDirtyClone(),this.getServerUrl())};this.withUrl (url,"POST",function(success,featureDataWrapper,respText){if(!featureDataWrapper.featureData.id){throw"After update, the server returned no ID. This cannot be!";} var ps=featureDataWrapper.featureData.properties;if(feature.getId()!==featureDataWrapper.featureData.id){feature.setId(featureDataWrapper.featureData.id);} for(var i=0,n=ps.length;i=0)){subtype=type.substr(colIdx+1);type=type.substr(0,colIdx);} var editor;switch(type){case"int":case"double":case"float":editor=IONIC.feature.edit.NumberPEditor.newInstance(this);break;case"geometry":editor=IONIC.feature.edit.GeomPEditor.newInstance(this,subtype);break;case"date":editor=IONIC.feature.edit.DatePEditor.newInstance(this);break;case"dateTime":editor=IONIC.feature.edit.DateTimePEditor.newInstance(this);break;case"enum":editor=IONIC.feature.edit.BaseEnumPEditor.newInstance(this,pDesc.values,subtype);break;case"sequence":editor=IONIC.feature.edit.BaseSequencePEditor.newInstance(this,subtype,pDesc.complexType);break;case"string":default:editor=IONIC.feature.edit.PEditor.newInstance(this);break;} return editor;};IONIC.feature.AbstractFeaturePanel.prototype._getPreferredEpsgId=function(){var view=this.getView();var epsgId;if(view){epsgId=view.getSrsBox().epsgId;}else{epsgId=4326;} return epsgId;}; IONIC.feature.edit.PEditor=function(panel){this.panel=panel;this.baseSize=30;this.setInteractiveState(IONIC.feature.edit.PEditor.STATE_DISABLED);};IONIC.feature.edit.PEditor.newInstance=function(panel){return new IONIC.feature.edit.PEditor(panel);};IONIC.feature.edit.PEditor.STATE_INTERACTIVE=0xBEAD;IONIC.feature.edit.PEditor.STATE_READONLY=0xDEAD;IONIC.feature.edit.PEditor.STATE_DISABLED=0xBEEF;IONIC.feature.edit.PEditor.prototype.getPanel=function(){return this.panel;};IONIC.feature.edit.PEditor.prototype.getDomHelper=function(){return this.getPanel().getDomHelper();};IONIC.feature.edit.PEditor.prototype.getFeatureEditionPanel=function(){return this.getPanel();};IONIC.feature.edit.PEditor.prototype.propagateValue=function(v){this.getPanel().acceptPropertyValue(this,v);};IONIC.feature.edit.PEditor.prototype._retrieveAssociatedPropertyValue=function(){var feat=this.getPanel().getFeature();var propQN=this.getPanel().getEditorAssociatedPropertyQName(this);return feat.getValueQN(propQN);};IONIC.feature.edit.PEditor.prototype.makeComponent=function(){var thisRef=this;var dh=this.getDomHelper();var c=dh.elt("input.basePropertyEditor");c.type="text";c.size=this.baseSize;c.onchange=function(){var v=c.value;if(v.length===0){v=undefined;} thisRef.propagateValue(v);};return c;};IONIC.feature.edit.PEditor.prototype.getLabelText=function(){if(this._labelText){return this._labelText;} var qn=this.getPanel().getEditorAssociatedPropertyQName(this);if(!qn){throw"This IONIC.feature.edit.PEditor instance doesn't seem to be associated to a panel.";} return(this._labelText=this._decorateLabelText(qn.getName()));};IONIC.feature.edit.PEditor.prototype.setLabelText=function(text,force){this._labelText=force?text:this._decorateLabelText(text);this.getLabel().innerHTML=this._labelText;};IONIC.feature.edit.PEditor.prototype._decorateLabelText=function(text){var p=this.getPanel();var fti=IONIC.feature.FeatureTypeInfoPool.getFeatureTypeInfoOrFail(p.getFeatureTypeName(),p.getFeatureTypeNamespace());var qn=p.getEditorAssociatedPropertyQName(this);if(!qn){throw"This IONIC.feature.edit.PEditor instance doesn't seem to be associated to a panel.";} var pDesc=fti.getPropertyInfo(qn.getName(),qn.getNamespace());if(pDesc.mandatory){return"[*] "+text;}else{return text;}};IONIC.feature.edit.PEditor.prototype.makeLabelWithText=function(txt){var dh=this.getDomHelper();return dh.elt("span.basePropertyLabel",dh.txt(txt));};IONIC.feature.edit.PEditor.prototype.makeLabel=function(){return this.makeLabelWithText(this.getLabelText());};IONIC.feature.edit.PEditor.prototype.getComponent=function(){if(!this.component){this.component=this.makeComponent();} return this.component;};IONIC.feature.edit.PEditor.prototype.getLabel=function(){if(!this.label){this.label=this.makeLabel();} return this.label;};IONIC.feature.edit.PEditor.prototype.displayValue=function(value){this.getComponent().value=((typeof value==="string")?value:"");};IONIC.feature.edit.PEditor.prototype.reset=function(){this.getComponent().value="";};IONIC.feature.edit.PEditor.prototype.setInteractiveState=function(state){this._state=state;this.applyInteractiveStateToComponent(state);};IONIC.feature.edit.PEditor.prototype.isEditable=function(){return this._state===IONIC.feature.edit.PEditor.STATE_INTERACTIVE;};IONIC.feature.edit.PEditor.prototype.applyInteractiveStateToComponent=function(state){this._setHTMLInputInteractiveState(this.getComponent(),state);};IONIC.feature.edit.PEditor.prototype._setHTMLInputInteractiveState=function(elt,state){switch(state){case IONIC.feature.edit.PEditor.STATE_INTERACTIVE:elt.disabled=false;elt.readOnly=false;break;case IONIC.feature.edit.PEditor.STATE_READONLY:elt.disabled=false;elt.readOnly=true;break;case IONIC.feature.edit.PEditor.STATE_DISABLED:elt.disabled=true;elt.readOnly=true;break;default:throw"Unrecognized state: "+state;}}; IONIC.feature.edit.NumberPEditor=function(panel){IONIC.feature.edit.PEditor.call(this,panel);this.baseSize=10;};IONIC.misc.extendType(IONIC.feature.edit.NumberPEditor,IONIC.feature.edit.PEditor);IONIC.feature.edit.NumberPEditor.newInstance=function(panel){return new IONIC.feature.edit.NumberPEditor(panel);};IONIC.feature.edit.NumberPEditor.prototype.makeComponent=function(){var thisRef=this;var c=IONIC.feature.edit.PEditor.prototype.makeComponent.call(this);c.onchange=function(){var v=c.value;if(v) v=v.replace(",",".");if(v.length===0){v=undefined;}else{v=+v;} if(isNaN(v)){v=undefined;} thisRef.propagateValue(v);};return c;};IONIC.feature.edit.NumberPEditor.prototype.displayValue=function(value){this.getComponent().value=((typeof value==="number"&&!isNaN(value))?value:"");};IONIC.feature.edit.NumberPEditor.prototype.reset=function(){this.getComponent().value=0;}; IONIC.feature.edit.DatePEditor=function(panel){IONIC.feature.edit.PEditor.call(this,panel);};IONIC.misc.extendType(IONIC.feature.edit.DatePEditor,IONIC.feature.edit.PEditor);IONIC.feature.edit.DatePEditor.newInstance=function(panel){return new IONIC.feature.edit.DatePEditor(panel);};IONIC.feature.edit.DatePEditor.prototype.makeComponent=function(){var thisRef=this;var dh=this.getDomHelper();var inpYear=dh.elt("input");var inpMonth=dh.elt("input");var inpDay=dh.elt("input");var pDiv=dh.elt("div");inpYear.size=4;inpMonth.size=inpDay.size=2;inpYear.id=gensym();inpMonth.id=gensym();inpDay.id=gensym();var calendarBut=dh.elt("img.featureEditionDateButton");calendarBut.src="/ioniciasclient/images/features/editing/editors/calendar.gif";calendarBut.title="Open calendar" calendarBut.alt="calendar" calendarBut.id=gensym();var c=new CalendarPopup();this.pid=gensym();var cbn=this.panel._pid+"_"+this.pid;window[cbn]=function(y,m,d){inpYear.value=String(y);inpMonth.value=String(m);inpDay.value=String(d);thisRef.propagateValue(IONIC.feature.edit.DatePEditor.getDateDescriptor(inpYear,inpMonth,inpDay).toDate());};c.setReturnFunction(cbn);c.showNavigationDropdowns();this.calendar=c;inpYear.onchange=inpMonth.onchange=inpDay.onchange=function(){thisRef.getPanel().acceptValue (thisRef,IONIC.feature.edit.DatePEditor.getDateDescriptor(inpYear,inpMonth,inpDay).toDate());};calendarBut.onclick=function(){if(thisRef.getPanel().holdsFeature()){c.showCalendar(calendarBut.id,IONIC.feature.edit.DatePEditor.getDateDescriptor(inpYear,inpMonth,inpDay).toString());} return false;};var cpnt=dh.elt("table.featureEditionDateEditor",dh.elt("tbody",dh.elt("tr",dh.elt("td",dh.elt("div.featureEditionDateEditorInputs",inpDay,inpMonth,inpYear)),dh.elt("td",calendarBut))));this.inpYear=inpYear;this.inpMonth=inpMonth;this.inpDay=inpDay;return cpnt;};IONIC.feature.edit.DatePEditor.prototype.displayValue=function(date){if(!date){this.inpYear.value=this.inpMonth.value=this.inpDay.value="";}else{this.inpYear.value=date.getFullYear();this.inpMonth.value=date.getMonth()+1;this.inpDay.value=date.getDate();}};IONIC.feature.edit.DatePEditor.prototype.reset=function(){this.displayValue(new Date());};IONIC.feature.edit.DatePEditor.prototype.applyInteractiveStateToComponent=function(state){this.getComponent();this._setHTMLInputInteractiveState(this.inpYear,state);this._setHTMLInputInteractiveState(this.inpMonth,state);this._setHTMLInputInteractiveState(this.inpDay,state);};IONIC.feature.edit.DatePEditor.getDateDescriptor=function(inpYear,inpMonth,inpDay){return{"year":parseInt(inpYear.value),"month":parseInt(inpMonth.value),"day":parseInt(inpDay.value),"toDate":function(){return new Date(Date.UTC(this.year,this.month-1,this.day,0,0,0));},"isValid":function(){return(!isNaN(this.year)&&!isNaN(this.month)&&!isNaN(this.day));},"toString":function(){if(isNaN(this.year)||isNaN(this.month)||isNaN(this.day)) return null;else return this.year+'-'+this.month+'-'+this.day;}};};IONIC.feature.edit.DatePEditor.offsetToString=function(offset){var hrs=""+Math.floor(Math.abs(offset)/60);var mins=""+Math.floor(Math.abs(offset)%60);if(hrs.length==1) hrs="0"+hrs;if(mins.length==1) mins="0"+mins;return(offset<0?"-":"+")+hrs+":"+mins;}; IONIC.feature.edit.DateTimePEditor=function(panel){IONIC.feature.edit.DatePEditor.call(this,panel);};IONIC.misc.extendType(IONIC.feature.edit.DateTimePEditor,IONIC.feature.edit.DatePEditor);IONIC.feature.edit.DateTimePEditor.newInstance=function(panel){return new IONIC.feature.edit.DateTimePEditor(panel);}; IONIC.feature.edit.GeomPEditor=function(panel,geomType){IONIC.feature.edit.PEditor.call(this,panel);this._gt=geomType;this._valid=undefined;this._chosenButtons=IONIC.feature.edit.GeomPEditor.AVAILABLE_BUTTONS.slice();};IONIC.misc.extendType(IONIC.feature.edit.GeomPEditor,IONIC.feature.edit.PEditor);IONIC.feature.edit.GeomPEditor.newInstance=function(panel,geomType){return new IONIC.feature.edit.GeomPEditor(panel,geomType);};IONIC.feature.edit.GeomPEditor.NEW_BUTTON="new";IONIC.feature.edit.GeomPEditor.EDIT_BUTTON="edit";IONIC.feature.edit.GeomPEditor.DELETE_BUTTON="delete";IONIC.feature.edit.GeomPEditor.AVAILABLE_BUTTONS=[IONIC.feature.edit.GeomPEditor.NEW_BUTTON,IONIC.feature.edit.GeomPEditor.EDIT_BUTTON,IONIC.feature.edit.GeomPEditor.DELETE_BUTTON];IONIC.feature.edit.GeomPEditor.prototype._hasButton=function(b){var bs=this._chosenButtons;for(var i=0,n=bs.length;i=(ei.left+ei.width)||my<(ei.top)||my>=(ei.top+ei.height)){elt.setVisibility(false);}}else{elt.setVisibility(false);}};elt.getPosInfo=function(){return this._posInfo;};elt.setPosInfo=function(i){this._posInfo=i;};elt.setVisibility=function(flag){this.style.display=flag?"":"none";};return elt;};IONIC.feature.edit.GeomPEditor.ManagementToolbar.prototype.showTypesList=function(posInfo){var tlElt=this._getTypesListElement();var st=tlElt.style;st.top=posInfo.top+"px";st.left=posInfo.left+"px";tlElt.setVisibility(true);tlElt.setPosInfo(ElementPosition.get(tlElt));};IONIC.feature.edit.GeomPEditor.ManagementToolbar.prototype._makeComponent=function(){var thisRef=this;var dh=this.getEditor().getDomHelper();var cpnt=dh.elt("div.managementToolbar");var edit=this.createImageItem("edit",null,"edit.gif","Edit current geometry","edit current");edit.registerStyle(IONIC.ui.TBItem.DISABLED_STYLE,{fileName:"noedit.gif",title:"You cannot edit the current geometry",alt:"can't edit current"});edit.setEnabled(false);edit.onactivate=function(event){thisRef.getEditor().editAssociatedGeometry();};var dlete=this.createImageItem("delete",null,"delete.gif","Delete current geometry","delete current");dlete.registerStyle(IONIC.ui.TBItem.DISABLED_STYLE,{fileName:"nodelete.gif",title:"You cannot delete the current geometry",alt:"can't delete current"});dlete.setEnabled(false);dlete.onactivate=function(event){if(confirm("Really delete?")){thisRef.getEditor().propagateValue(undefined);}};var create=this.createImageItem("create",null,"create.gif","Create a new geometry","create new");create.registerStyle(IONIC.ui.TBItem.DISABLED_STYLE,{fileName:"nocreate.gif",title:"You cannot create a new geometry",alt:"can't create new"});create.setEnabled(false);create.onactivate=function(event){thisRef.showTypesList(ElementPosition.get(create.getComponent()));};dh.append(cpnt,create.getComponent(),edit.getComponent(),dlete.getComponent());this._mgmtItems=[create,edit,dlete];return cpnt;};IONIC.feature.edit.GeomPEditor.prototype.getEnvelope=function(){try{var geom=this._retrieveAssociatedPropertyValue();return geom.getEnvelope();}catch(e){return null;}}; IONIC.feature.edit.BaseEnumPEditor=function(panel,customEnum,enumType){this.customEnum=customEnum;this.enumType=enumType;IONIC.feature.edit.PEditor.call(this,panel);};IONIC.misc.extendType(IONIC.feature.edit.BaseEnumPEditor,IONIC.feature.edit.PEditor);IONIC.feature.edit.BaseEnumPEditor.newInstance=function(panel,customEnum,enumType){return new IONIC.feature.edit.BaseEnumPEditor(panel,customEnum,enumType);};IONIC.feature.edit.BaseEnumPEditor.prototype.getEnumName=function(){return" value -";};IONIC.feature.edit.BaseEnumPEditor.prototype.applySubstitutionResolver=function(resolver){var opts=this.getComponent().options;for(var i=0,n=opts.length;ie1.name){return 1;}else return 0;});for(var i=0;i=ehs.length){throw"Handler index out-of-bounds: "+idx;}else{ehs[idx]=undefined;}}};IONIC.api.maps.Map.prototype._triggerHandlers=function(eventname,evt){var ehs=this._ehs[eventname];var i,n;if(ehs){for(i=0,n=ehs.length;i0){ld=this.layerDescriptors[0];epsgIds=epsgIds.concat(ld.getNativelySupportedSrses());} var i,layerEpsgIds;for(i=1;i=0;i--){curLd=lds[i];if(curLd.isBasemap()){this.removeLayerDescriptor(curLd);}}};IONIC.api.maps.Map.prototype.destroyAllLayerDescriptors=function(){this.destroyAllMapLayerDescriptors();this.destroyAllUtilityLayerDescriptors();};IONIC.api.maps.Map.prototype.destroyAllMapLayerDescriptors=function(){var cur,dh=this.getDomHelper();while(this.getMapLayerDescriptors().length){cur=this.getMapLayerDescriptors()[0];this.removeLayerDescriptor(cur);cur.destroy(dh);}};IONIC.api.maps.Map.prototype.destroyAllUtilityLayerDescriptors=function(){var cur,dh=this.getDomHelper();while(this.getUtilityLayerDescriptors().length){cur=this.getUtilityLayerDescriptors()[0];this.removeUtilityLayerDescriptor(cur);cur.destroy(dh);}};IONIC.api.maps.Map.prototype.getLayersCount=function(){return this.layerDescriptors.length;};IONIC.api.maps.Map.prototype._findLayer=function(layerDesignator){var ldd=layerDesignator;var match,item;if(ldd instanceof IONIC.maps.AbstractLayerDescriptor){item=IONIC.misc.findItem(ldd,this.layerDescriptors);if(!item){item=IONIC.misc.findItem(ldd,this.utilityLayerDescriptors);} return item;}else if(typeof ldd==="string"){if((match=/^g_(\d+)uuid$/.exec(ldd))){item=IONIC.misc.findItem(ldd,this.layerDescriptors,null,IONIC.api.maps.Map._UUID_GETTER);if(!item){item=IONIC.misc.findItem(ldd,this.utilityLayerDescriptors,null,IONIC.api.maps.Map._UUID_GETTER);} return item;}}};IONIC.api.maps.Map._UUID_GETTER=function(ld){return ld.uuid;};IONIC.api.maps.Map.prototype.findLayer=function(layerDesignator){var found;if(layerDesignator instanceof IONIC.maps.AbstractLayerDescriptor){if(this._findLayer(layerDesignator)){return layerDesignator;}}else{found=this._findLayer(layerDesignator);if(found){return found[0];}else{return undefined;}}};IONIC.api.maps.Map.prototype.replaceLayer=function(previous,replacement,callback){var prevData=this._findLayer(previous);this.removeLayerDescriptor(prevData[0]);this.insertLayerDescriptorAt(replacement,prevData[1],false,callback);};IONIC.api.maps.Map.prototype.onAddMapLayerFailed=function(message){message=message||"";alert('Cannot add layer'+(message?(" ("+message+")"):""));};IONIC.api.maps.Map.prototype.insertLayerDescriptorAt=function(layerDescriptor,position,norefresh,callback){if(position>this.layerDescriptors.length){throw"Cannot set layer at position "+position+". There are currently only "+ this.layerDescriptors.length+" layers.";} var self=this;var mapNeedsRefresh=false;var transformedCurrentBox;var attached=false;var proceedInsertFailed=function(message){if(attached){throw"Illegal state: proceedInsertFailed() called while the layer is already attached to the map";} self.onAddMapLayerFailed(message);self.layerDescriptors.splice(position,1);layerDescriptor.setMap(null);};var proceedAttachToMap=function(){layerDescriptor.attachToMap(self);attached=true;self.onLayerAdded.fire(layerDescriptor,position);self._checkLayerScaleRangeVisibility(layerDescriptor);var i,n;for(i=position+1,n=self.layerDescriptors.length;i=0){this.forEachLayer(function(ld){thisRef._checkLayerScaleRangeVisibility(ld);});}};IONIC.api.maps.Map.prototype.getDefaultItemsGroup=function(){if(!this._digrp){this._digrp=IONIC.ui.TBItemGroup.newInstance();} return this._digrp;};IONIC.api.maps.Map.prototype.getComputedScale=function(){return this._computedScale;};IONIC.api.maps.Map.prototype._withComputedScale=function(callback){this._computedScale=-1;var srsBox=this.getSrsBox();if(!srsBox||this.getWidth()<=0||this.getHeight()<=0){this.fireOnScaleComputing();callback(this._computedScale);this.fireOnScaleComputed(this._computedScale);return;} var thisRef=this;var computer=this._scaleComputer?this._scaleComputer:IONIC.api.maps.Map.defaultScaleComputers[srsBox.epsgId];if(computer){this.fireOnScaleComputing();this._computedScale=computer(srsBox,this.getWidth(),this.getHeight());this.fireOnScaleComputed(this._computedScale);callback(thisRef._computedScale);}else{this.fireOnScaleComputing();IONIC.geom.TransformTool.withScale(srsBox,this.getWidth(),this.getHeight(),function(scale){thisRef._computedScale=scale;thisRef.fireOnScaleComputed(scale);callback(thisRef._computedScale);});}};IONIC.api.maps.Map.prototype.fireOnScaleComputing=function(){this.onScaleComputing.fire();};IONIC.api.maps.Map.prototype.fireOnScaleComputed=function(scale){this.forEachLayer(function(ld){ld.mapScaleComputed(scale);});this.onScaleComputed.fire(scale);};IONIC.api.maps.Map.prototype._WMCFromUrlBuildUrl=function(url){return IONIC.misc.getWebappBaseUrl()+"/extractContext.do"+"?extractionMethod="+escape("handler")+"&handlerClassName="+escape("com.ionicsoft.paic.actions.context.URLContextStreamSource")+"&contextUrl="+escape(url);};IONIC.api.maps.Map.prototype._WMCFromWebappBuildUrl=function(contextPath){return IONIC.misc.getWebappBaseUrl()+"/extractContext.do"+"?extractionMethod="+escape("handler")+"&handlerClassName="+escape("com.ionicsoft.paic.actions.context.WebappWMCStreamSource")+"&wmcPath="+escape(contextPath);};IONIC.api.maps.Map.prototype.loadWMCFromUrl=function(url,callback){var rt=IONIC.misc.RequestTool.newInstance();var fullUrl=this._WMCFromUrlBuildUrl(url);var thisRef=this;rt._withUrl(fullUrl,"GET",function(success,tfvo){thisRef.loadMapFromDescriptor(tfvo,callback);});};IONIC.api.maps.Map.prototype.loadWMCFromWebapp=function(contextPath,callback){var rt=IONIC.misc.RequestTool.newInstance();var url=this._WMCFromWebappBuildUrl(contextPath);var thisRef=this;rt._withUrl(url,"GET",function(success,tfvo){thisRef.loadMapFromDescriptor(tfvo,callback);});};IONIC.api.maps.Map.prototype.loadMapFromDescriptor=function(descriptor,callback){this._loadWMC(descriptor,callback);};IONIC.api.maps.Map.prototype._loadWMC=function(tfvo,callback){var ld,ldConfig,i,n,curLd;var dims=tfvo.dimensions;this.setDimensions(dims[0],dims[1],true);this.destroyAllMapLayerDescriptors();var self=this;var layerAdder=function(type,args){self.onScaleComputed.unsubscribe(layerAdder,self);var lis=tfvo.layersInfo;var curLayerInfo,ssLayers,ssLayer;for(i=0,n=lis.length;isr[1]){return false;}} return true;};IONIC.api.maps.WMSSSLayer.SERIALIZER=function(wmsSSLayer){return((IONIC.api.maps.StyledSSLayer.getLayerSerializer("W*S"))(wmsSSLayer));};IONIC.api.maps.WMSSSLayer.DESERIALIZER=function(tflo,ldConfig){return((IONIC.api.maps.StyledSSLayer.getLayerDeserializer("W*S"))(tflo,ldConfig));};IONIC.api.maps.StyledSSLayer.registerLayerSerialization(IONIC.api.maps.WMSSSLayer.SERVICE_TYPE,IONIC.api.maps.WMSSSLayer.SERIALIZER,IONIC.api.maps.WMSSSLayer.DESERIALIZER); IONIC.api.maps.WFSSSLayer=function(name,namespace){IONIC.api.maps.WxSSSLayer.call(this);this.setServiceType(IONIC.api.maps.WFSSSLayer.SERVICE_TYPE);this.name=name;this.ns=namespace;this.filterId=null;this.selectedPortrayalDirective=null;IONIC.misc.createCustomEvents(["onPortrayalDirectiveChanged"],this);};IONIC.misc.extendType(IONIC.api.maps.WFSSSLayer,IONIC.api.maps.WxSSSLayer);IONIC.api.maps.WFSSSLayer.SERVICE_TYPE="WFS";IONIC.api.maps.WFSSSLayer.newInstance=function(name,namespace){return new IONIC.api.maps.WFSSSLayer(name,namespace);};IONIC.api.maps.WFSSSLayer.prototype.setFilterId=function(filterId){this.filterId=filterId;};IONIC.api.maps.WFSSSLayer.prototype.getFilterId=function(){return this.filterId;};IONIC.api.maps.WFSSSLayer.prototype.getName=function(){return this.name;};IONIC.api.maps.WFSSSLayer.prototype.getNamespace=function(){return this.ns;};IONIC.api.maps.WFSSSLayer.prototype.getFeatureTypeInfoOrFail=function(){return IONIC.feature.FeatureTypeInfoPool.getFeatureTypeInfoOrFail(this.getName(),this.getNamespace());};IONIC.api.maps.WFSSSLayer.prototype.withFeatureTypeInfo=function(callback){IONIC.feature.FeatureTypeInfoPool.withFeatureTypeInfo(this.getParentLayerDescriptor().getServiceUrl(),this.getName(),this.getNamespace(),callback);};IONIC.api.maps.WFSSSLayer.WFST_INSERT=1<<0;IONIC.api.maps.WFSSSLayer.WFST_UPDATE=1<<1;IONIC.api.maps.WFSSSLayer.WFST_DELETE=1<<2;IONIC.api.maps.WFSSSLayer.prototype.setTransactionalOperations=function(mask){this._transOp=mask;};IONIC.api.maps.WFSSSLayer.prototype.getTransactionalOperations=function(){return this._transOp;};IONIC.api.maps.WFSSSLayer.prototype.getCurrentPortrayalDirective=function(){return this.currentPortrayalDirective;};IONIC.api.maps.WFSSSLayer.prototype.setCurrentPortrayalDirective=function(designator,norefresh){var directive=this.getAdditionalPortrayalDirective(designator);if(!directive){throw"Cannot set portrayal directive: bad directive designator "+ (typeof designator==="string"?designator:"");} if(this.currentPortrayalDirective!==directive){this.currentPortrayalDirective=directive;this.onPortrayalDirectiveChanged.fire(directive);if(!norefresh){this.getParentLayerDescriptor().refresh();}}};IONIC.api.maps.WFSSSLayer.SERIALIZER=function(wfsSSLayer){return((IONIC.api.maps.StyledSSLayer.getLayerSerializer("W*S"))(wfsSSLayer));};IONIC.api.maps.WFSSSLayer.DESERIALIZER=function(tflo,ldConfig){return((IONIC.api.maps.StyledSSLayer.getLayerDeserializer("W*S"))(tflo,ldConfig));};IONIC.api.maps.StyledSSLayer.registerLayerSerialization(IONIC.api.maps.WFSSSLayer.SERVICE_TYPE,IONIC.api.maps.WFSSSLayer.SERIALIZER,IONIC.api.maps.WFSSSLayer.DESERIALIZER); IONIC.api.maps.ECWPSSLayer=function(url,ecwpUrl,name,imageFormat,login,password){IONIC.api.maps.StyledSSLayer.call(this);this.setServiceType(IONIC.api.maps.ECWPSSLayer.SERVICE_TYPE);this.setServiceUrl(url);this.setECWPUrl(ecwpUrl);this.setLogin(login);this.setPassword(password);this.name=name||"";this.imgFmt=imageFormat||"ecwjp2";};IONIC.misc.extendType(IONIC.api.maps.ECWPSSLayer,IONIC.api.maps.StyledSSLayer);IONIC.api.maps.ECWPSSLayer.findEpsgIdTolerance=0.000001;IONIC.api.maps.ECWPSSLayer.SERVICE_TYPE="ECWP";IONIC.api.maps.ECWPSSLayer.prototype.getName=function(){return this.name;};IONIC.api.maps.ECWPSSLayer.prototype.getImageFormat=function(){return this.imgFmt;};IONIC.api.maps.ECWPSSLayer.prototype.isBasemap=function(){return true;};IONIC.api.maps.ECWPSSLayer.prototype.setECWPUrl=function(url){this.ecwpUrl=url;};IONIC.api.maps.ECWPSSLayer.prototype.getECWPUrl=function(){return this.ecwpUrl;};IONIC.api.maps.ECWPSSLayer.prototype.getAuthenticatedECWPUrl=function(){var urlBase=this.getECWPUrl();if(!urlBase){return;} var parts=[urlBase];var login=this.getLogin();if(login){parts.push(login,this.getPassword());} if(this.getUrlSuffix()){if(login){throw"Cannot use both URL suffix and login information.";} parts.push(this.getUrlSuffix());} return parts.join("|");};IONIC.api.maps.ECWPSSLayer.prototype.getEpsgId=function(ld){if(typeof this.epsgIdFound!=="number"){this.epsgIdFound=this.findEpsgId(ld);} return this.epsgIdFound;};IONIC.api.maps.ECWPSSLayer.prototype.findEpsgId=function(ld){var name=this.getName();var control=ld.getControl();var definedBoxes,curDefinedBBox,i,n,oom;if(control){var box=this.getUnreferencedBoundingBox(control);definedBoxes=this.getDefinedBoundingBoxes();for(i=0,n=definedBoxes.length;i2||b<0)?corrs[0]:corrs[b];if(typeof corr==="undefined"){throw"Cannot determine which button was pressed ("+b+")";} btns=corr;} return btns;};IONIC.api.maps.ViewMouseProcessor.prototype.relativePosition=function(e){var view=this.getView();var vi=JSToolbox.Position.get(view.getHTMLView());e=e||view.getOwnerWindow().event;var evt=JSToolbox.Event;var mx=evt.getMouseX(e);var my=evt.getMouseY(e);return[mx-vi.left,my-vi.top];};IONIC.api.maps.ViewMouseProcessor.prototype._pointDataFromPixel=function(pxl){return({pixel:pxl,point:IONIC.maps.NavHelper.pixelToSRSPoint(pxl,this.getView())});};IONIC.api.maps.ViewMouseProcessor.prototype.mouseOut=function(e){if(!this.isActive()){return false;} var action=this.getCurrentAction();if(!action){return false;} e=e||window.event;var map=this.getMap();var curPos=this.relativePosition(e);if(curPos[0]<0||curPos[0]>=map.getWidth()||curPos[1]<0||curPos[1]>=map.getHeight()){if(this.m_mouseDownAt&&action.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG)){this.internalMouseUp(e,this.lastPixelPosition);}}};IONIC.api.maps.ViewMouseProcessor.prototype.mouseDown=function(e){if(!this.isActive()){return false;} if(!this.getView().getSrsBox()){return false;} var curAct=this.getCurrentAction();if(!curAct){return false;} e=e||window.event;var pixel=this.relativePosition(e);var ptData=this._pointDataFromPixel(pixel);this.m_mouseDownAt=ptData;var res;if(curAct.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DOWN)){res=curAct.m_callback(this,IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DOWN,ptData,ptData,this.getEventButtons(e),curAct.__lastResult,e);if(res){curAct.__lastResult=res;}} if(curAct.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG)){this._lastDragPixel=pixel;this.getView().onDragStart();}};IONIC.api.maps.ViewMouseProcessor.prototype.mouseUp=function(e){if(!this.isActive()){return false;} var downAt=this.m_mouseDownAt;if(!downAt){return false;} var action=this.getCurrentAction();if(!action){return false;} e=e||window.event;var pixel=this.relativePosition(e);this.internalMouseUp(e,pixel);};IONIC.api.maps.ViewMouseProcessor.prototype.internalMouseUp=function(e,pixel){var downAt=this.m_mouseDownAt;var action=this.getCurrentAction();var hUp=action.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP);var hCl=action.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_CLICK);var ptData;if(hUp||hCl){ptData=this._pointDataFromPixel(pixel);} this.checkDragProperlyFinished(action,e,pixel);this.m_mouseDownAt=null;var res;if(hUp){res=action.m_callback(this,IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP,downAt,ptData,this.getEventButtons(e),action.__lastResult,e);if(res){action.__lastResult=res;}} if(hCl){res=action.m_callback(this,IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_CLICK,downAt,ptData,this.getEventButtons(e),action.__lastResult,e);if(res){action.__lastResult=res;}} this._lastDragPixel=null;};IONIC.api.maps.ViewMouseProcessor.prototype.mouseMove=function(e){e=e||window.event;this.lastPixelPosition=this.relativePosition(e);if(!this.isActive()){return false;} var action=this.getCurrentAction();if(!action){return false;} this.internalMouseMove(action,e);};IONIC.api.maps.ViewMouseProcessor.prototype.internalMouseMove=function(action,e){if(this.m_mouseDownAt){if(action.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG)){this.doMouseDrag(action,e);}}else{if(action.handlesEvent(IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_MOVE)){this.doMouseMove(action,e);}}};IONIC.api.maps.ViewMouseProcessor.prototype.doMouseMove=function(action,e){var pixel=this.relativePosition(e);var ptData=this._pointDataFromPixel(pixel);var res=action.m_callback(this,IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_MOVE,this.m_mouseDownAt,ptData,this.getEventButtons(e),action.__lastResult,e);if(res){action.__lastResult=res;} this._lastDragPixel=null;};IONIC.api.maps.ViewMouseProcessor.prototype.doMouseDrag=function(action,e){var pixel=this.relativePosition(e);var ptData=this._pointDataFromPixel(pixel);var res=action.m_callback(this,IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG,this.m_mouseDownAt,ptData,this.getEventButtons(e),action.__lastResult,e);if(res){action.__lastResult=res;} this._lastDragPixel=pixel;};IONIC.api.maps.ViewMouseProcessor.prototype.checkDragProperlyFinished=function(action,e,pixel){if(this._lastDragPixel){if(this._lastDragPixel[0]!==pixel[0]||this._lastDragPixel[1]!==pixel[1]){this.internalMouseMove(action,e);} this.getView().onDragEnd();}};IONIC.api.maps.ViewMouseProcessor.prototype.showHelpText=function(text,onclick){var view=this.getView();var helpDiv=this.getHelpTextDiv(onclick);helpDiv.style.zIndex=this.getView().zIndexFor("imp");helpDiv.innerHTML=text;helpDiv.style.display="";};IONIC.api.maps.ViewMouseProcessor.prototype.hideHelpText=function(){var hd=this.getHelpTextDiv();hd.style.display="none";};IONIC.api.maps.ViewMouseProcessor.prototype.getHelpTextDiv=function(onclick){var view=this.getView();var cd;if(!view.helpTextDiv){cd=view.getOwnerDocument().createElement('div');cd.id="captureLabelDivFor"+view.getId();cd.className='captureText';cd.style.position="absolute";cd.style.display='none';view.getHTMLView().appendChild(cd);view.helpTextDiv=cd;} view.helpTextDiv.title="Click here to cancel";if(!onclick){onclick=(function(localRef){return function(event){localRef.stopCapture();};})(this);} view.helpTextDiv.onclick=onclick;return view.helpTextDiv;};IONIC.api.maps.ViewMouseProcessor.ZOOM_CODE=function(processor,eventType,mouseDownPositionInfo,currentMousePositionInfo,buttons,lastResult){var boxStart=mouseDownPositionInfo.pixel;var boxEnd=currentMousePositionInfo.pixel;var diffx=boxEnd[0]-boxStart[0];var diffy=boxEnd[1]-boxStart[1];var view=processor.getView();var navTb,zoomIn,bkp,wPart,hPart;switch(eventType){case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP:processor.hideBox();if(Math.abs(diffx)<2&&Math.abs(diffy)<2){view.zoomAtPixel(boxStart[0],boxStart[1]);}else{view.zoomPixelBox(new IONIC.api.geom.Box(boxStart[0],boxStart[1],boxEnd[0],boxEnd[1]));} break;case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG:processor.drawBox(boxStart,boxEnd);break;}};IONIC.api.maps.ViewMouseProcessor.ZOOMOUT_CODE=function(processor,eventType,mouseDownPositionInfo,currentMousePositionInfo,buttons,lastResult){var view=processor.getView();var navTb;var zoomOut=view.getZoomFactor();var width=view.getWidth()*zoomOut;var height=view.getHeight()*zoomOut;var left=(currentMousePositionInfo.pixel[0])-width/2;var top=(currentMousePositionInfo.pixel[1])-height/2;view.zoomPixelBox(new IONIC.api.geom.Box(left,top,left+width,top+height));};IONIC.api.maps.ViewMouseProcessor.PAN_CODE=function(processor,eventType,mouseDownPositionInfo,currentMousePositionInfo,buttons,lastResult){var boxStart=mouseDownPositionInfo.pixel;var boxEnd=currentMousePositionInfo.pixel;var diffx=boxEnd[0]-boxStart[0];var diffy=boxEnd[1]-boxStart[1];var view=processor.getView();var srsBox;switch(eventType){case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP:if(Math.abs(diffx)<2&&Math.abs(diffy)<2){srsBox=view.getSrsBox();srsBox.centerAround(currentMousePositionInfo.point);view.setSrsBox(srsBox);}else{view.forEachLayer(function(ld){ld.endDrag(-diffx,diffy);});IONIC.maps.NavHelper.panViewByPixels(view,-diffx,diffy);} break;case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG:view.forEachLayer(function(ld){ld.shift(diffx,diffy);});break;}};IONIC.api.maps.ViewMouseProcessor.SELECT_BOX_CODE=function(processor,eventType,downInfo,currentInfo,buttons,lastResult){var box,view=processor.getView();switch(eventType){case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP:view.setSelectedBox(new IONIC.api.geom.Box(downInfo.point.x,downInfo.point.y,currentInfo.point.x,currentInfo.point.y,view.getBox().epsgId));break;case IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG:processor.drawBox(downInfo.pixel,currentInfo.pixel);break;}};IONIC.api.maps.ViewMouseProcessor.prototype.registerAction=function(name,eventsMask,callback,onSelect,onDeselect){if(this.getAction(name,true)){throw"There's already an action named "+name;} var act=new IONIC.api.maps.ViewMouseProcessor.Action(name,eventsMask,callback,onSelect,onDeselect);this.m_actions[name]=act;act._setViewMouseProcessor(this);return act;};IONIC.api.maps.ViewMouseProcessor.prototype.selectAction=function(name,noHandlersCalled){name=name||IONIC.api.maps.ViewMouseProcessor._VOID_ACTION_NAME;var prev=this.m_selectedAction;var selected=this.getAction(name);var cur=this.getCurrentAction();if(cur){cur.deselect();} this.m_selectedAction=name;if(noHandlersCalled!==true){selected.select(prev);} if(name===IONIC.api.maps.ViewMouseProcessor._VOID_ACTION_NAME){this.onActionSelected.fire(null,null);}else{this.onActionSelected.fire(name,selected);}};IONIC.api.maps.ViewMouseProcessor.prototype.getAction=function(name,quiet){var act=this.m_actions[name];if(!act&&quiet!==true){throw"No such action: "+name;} return act;};IONIC.api.maps.ViewMouseProcessor.prototype.getCurrentAction=function(){return this.getAction(this.m_selectedAction,true);};IONIC.api.maps.ViewMouseProcessor.prototype.removeAction=function(name){var act=this.getAction(name);if(this.getCurrentAction()===act){act.deselect();} this.m_actions[name]=undefined;};IONIC.api.maps.ViewMouseProcessor.prototype.pushAction=function(){var ca=this.getCurrentAction();if(ca){ca.deselect();this.m_selectedActionsStack.push(ca.getName());}};IONIC.api.maps.ViewMouseProcessor.prototype.popAction=function(){var ca=this.getCurrentAction();if(ca){ca.deselect();} this.selectAction(this.m_selectedActionsStack.pop());};IONIC.api.maps.ViewMouseProcessor.Action=function(name,eventsMask,callback,onSelect,onDeselect){var eventsSyms=({"mousedown":IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DOWN,"mouseup":IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP,"mouseclick":IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_CLICK,"mousemove":IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_MOVE,"mousedrag":IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_DRAG});this.m_eventMask=0;var i,ce,ek;if(typeof eventsMask==="number"){this.m_eventMask=eventsMask;}else{for(i=0;i=0&&ptOnLine[0]<=tr[0]){ptOnLinePxl=IONIC.maps.NavHelper.srsPointToPixel(new IONIC.api.geom.Point(ptOnLine[0]+bl[0],ptOnLine[1]+bl[1],point.epsgId),view);dist2=pixelEd2(ptOnLinePxl,pixel);if(dist2<=400){if((!bestSegment)||bestSegment[0]>dist2){bestSegment=[dist2,IONIC.geom.edit.GeometryPointer.add(sptr,1)];}}}});} var bestBoundaryDist;if(type===IONIC.geom.GeometryTypes.TYPE_LINE_STRING||type===IONIC.geom.GeometryTypes.TYPE_MULTI_LINE_STRING){if(geom.countVertices()>0){firstPxl=IONIC.maps.NavHelper.srsPointToPixel(geom.getPointAt(geom.getStartPointer()),view);lastPxl=IONIC.maps.NavHelper.srsPointToPixel(geom.getPointAt(geom.getEndPointer()),view);firstDist=pixelEd2(pixel,firstPxl);lastDist=pixelEd2(pixel,lastPxl);if(firstDist0.00000001){this.scaleHTMLLayerToBox(curBox,prevBox);}} var img=new Image();img.style.position="absolute";img.style.top="0px";img.style.left="0px";img.onload=IONIC.api.maps.LayerDescriptor.ONLOAD_HANDLER;img.onerror=IONIC.api.maps.LayerDescriptor.ONERROR_HANDLER;img.mapRequest=mapRequest;img.requestedBox=mapRequest.getBox().clone();img.layerDescriptor=this;img.currentlyLoading=true;img.src=url;var curLoading=this.imageCurrentlyLoading;if(curLoading){if(curLoading.mapRequest){curLoading.mapRequest.layerLoadingCanceled(this);} IONIC.api.maps.LayerDescriptor.REMOVE_CYCLIC_DEPENDENCIES(curLoading);curLoading.src=null;this.imageCurrentlyLoading=null;} this.imageCurrentlyLoading=img;this.onLoading.fire(img.src);};IONIC.api.maps.LayerDescriptor.ONLOAD_HANDLER=function(){var img=this;var ld=img.layerDescriptor;var mapRequest=img.mapRequest;var visibility=ld.getVisibility();var requestedBox=img.requestedBox;ld.imageCurrentlyLoading=null;if(mapRequest&&!mapRequest.isGreedy()){visibility=false;} img.currentlyLoading=false;var htmlLayer=ld.getHTMLLayer();var map=ld.getMap();var ctx;if(map){if(IE){ld.transformHTMLLayerDiv(1,1,0,0);}else{ld.setHTMLLayerChildAsImg();} htmlLayer.replaceChild(img,htmlLayer.childNodes[0]);} ld.setLastValidLoadedData(requestedBox,img);ld.onLoadingDone.fire(img.src);if(mapRequest){mapRequest.layerLoaded(ld);} IONIC.api.maps.LayerDescriptor.REMOVE_CYCLIC_DEPENDENCIES(img);};IONIC.api.maps.LayerDescriptor.ONERROR_HANDLER=function(){var img=this;var ld=this.layerDescriptor;ld.imageCurrentlyLoading=null;img.currentlyLoading=false;img.style.visibility="hidden";var htmlLayer=ld.getHTMLLayer();var map=ld.getMap();var htmlView;if(map){if(IE){ld.transformHTMLLayerDiv(1,1,0,0);}else{ld.setHTMLLayerChildAsImg();} htmlLayer.replaceChild(img,htmlLayer.childNodes[0]);} IONIC.security.SecureServices.isSecure(ld.getServiceType(),ld.getServiceUrl(),true);ld.onLoadingError.fire(img.src);if(img.mapRequest){img.mapRequest.layerLoadingError(ld);} IONIC.api.maps.LayerDescriptor.REMOVE_CYCLIC_DEPENDENCIES(img);};IONIC.api.maps.LayerDescriptor.REMOVE_CYCLIC_DEPENDENCIES=function(img){img.onload=img.onerror=null;img.mapRequest=null;img.layerDescriptor=null;img.requestedBox=null;};IONIC.api.maps.LayerDescriptor.prototype.mapFullyRefreshed=function(){var map=this.getMap();if(!map.isGreedyDisplay()){this.setHTMLLayerVisibility(this.getVisibility());}};IONIC.api.maps.LayerDescriptor.prototype.toString=function(){return IONIC.maps.AbstractLayerDescriptor.prototype.toString.call(this)+": "+this.getTitle();};IONIC.api.maps.LayerDescriptor.prototype.getImageFormat=function(){return this.imageFormat;};IONIC.api.maps.LayerDescriptor.prototype.setImageFormat=function(format){var oldFormat=this.imageFormat;this.imageFormat=format;this.onAttributeChanged.fire("imageFormat",format,oldFormat);};IONIC.api.maps.LayerDescriptor.prototype.getNativelySupportedSrses=function(){var sup;IONIC.misc.forEach(function(ssl){if(!sup){sup=ssl.getNativelySupportedSrses();}else{sup=IONIC.misc.intersection(sup,ssl.getNativelySupportedSrses());}},this.getServerSideLayers());return sup||[];};IONIC.api.maps.LayerDescriptor.prototype.isNativelySupportedSrs=function(epsgId){var sup=true;IONIC.misc.forEach(function(ssl){sup=sup&&ssl.isNativelySupportedSrs(epsgId);},this.getServerSideLayers());return sup;};IONIC.api.maps.LayerDescriptor.prototype.getServerSideLayerByName=function(name,ns){for(var i=0;isr[1]){return false;}} var ok;if(this.getServiceType().toUpperCase()===IONIC.api.maps.WMSSSLayer.SERVICE_TYPE){this.forEachServerSideLayer(function(ssl){if(typeof ok==="boolean"){if(all){ok=ok&&ssl.isVisibleAtScale(scale);}else{ok=ok||ssl.isVisibleAtScale(scale);}}else{ok=ssl.isVisibleAtScale(scale);}});}else{ok=true;} return ok;};IONIC.api.maps.LayerDescriptor.prototype.getAdvertisedScaleRange=function(){var sr;if(this.getServiceType().toUpperCase()===IONIC.api.maps.WMSSSLayer.SERVICE_TYPE){this.forEachServerSideLayer(function(ssl){var cur=ssl.getAdvertisedScaleRange();if(cur){if(sr){sr=[Math.min(sr[0],cur[0]),Math.max(sr[1],cur[1])];}else{sr=cur;}}});} return sr;};IONIC.api.maps.LayerDescriptor.prototype.getUserScaleRange=function(){return this.userScaleRange;};IONIC.api.maps.LayerDescriptor.prototype.setUserScaleRange=function(range){if(range){this.userScaleRange=[Math.min.apply(Math,range),Math.max.apply(Math,range)];}else{this.userScaleRange=null;} this.fireVisibilityChanged();};IONIC.api.maps.LayerDescriptor.LAYER_SERIALIZERS={};IONIC.api.maps.LayerDescriptor.registerLayerSerialization=function(type,serializer,deserializer){IONIC.api.maps.LayerDescriptor.LAYER_SERIALIZERS[type]=[serializer,deserializer];};IONIC.api.maps.LayerDescriptor.getLayerSerializer=function(type){var a=IONIC.api.maps.LayerDescriptor.LAYER_SERIALIZERS[type];if(a){return a[0];}};IONIC.api.maps.LayerDescriptor.getLayerDeserializer=function(type){var a=IONIC.api.maps.LayerDescriptor.LAYER_SERIALIZERS[type];if(a){return a[1];}};IONIC.api.maps.LayerDescriptor.fromTransportFormat=function(tflo,ldConfig){ldConfig=ldConfig||{};var styp=tflo.serviceType.toUpperCase();var deserializer=IONIC.api.maps.LayerDescriptor.getLayerDeserializer(styp);if(deserializer){return deserializer(tflo,ldConfig);}else{throw"Cannot create layer of type: "+styp;}};IONIC.api.maps.LayerDescriptor.toTransportFormat=function(ld){var serviceType=ld.getServiceType().toUpperCase();var serializer=IONIC.api.maps.LayerDescriptor.getLayerSerializer(serviceType);if(serializer){return serializer(ld);}else{throw"Cannot serialize layer of type: "+serviceType;}};IONIC.api.maps.LayerDescriptor.applyCommonConfiguration=function(ld,ldConfig){ld.setUserVisibility(!ldConfig.hidden);if(ldConfig.customTitle){ld.setTitle(ldConfig.customTitle);} if(typeof ldConfig.opacity==="number"){ld.setOpacity(ldConfig.opacity);} if(typeof ldConfig.userSelected==="boolean"){ld.setUserSelected(ldConfig.userSelected);}};IONIC.api.maps.LayerDescriptor.SERIALIZER_WxS=function(ld){var ssLayers=ld.getServerSideLayers()||[];var layersAndConfig=[];for(var i=0,n=ssLayers.length;i0&&s<5;};IONIC.api.maps.ECWPLayerDescriptor.checkSupport=function(){if(typeof ECWCheck==="function"){return ECWCheck();}else{throw"The ECW code doesn't seem to be included";}};IONIC.api.maps.ECWPLayerDescriptor.prototype.isBasemap=function(){return true;};IONIC.api.maps.ECWPLayerDescriptor.prototype.supportsReprojecting=function(){return false;};IONIC.api.maps.ECWPLayerDescriptor.prototype.supportsPreviewing=function(){return true;};IONIC.api.maps.ECWPLayerDescriptor.prototype.withControl=function(callback){this.withInitializedLayer(function(layer){callback(layer.getControl());});};IONIC.api.maps.ECWPLayerDescriptor.prototype.getControl=function(){if(this.isLayerInitializing()){return null;}else{return document[this._uid];}};IONIC.api.maps.ECWPLayerDescriptor.prototype.getControlOrFail=function(){var c=this.getControl();if(!c){throw"The ECWP control should be available";} return c;};IONIC.api.maps.ECWPLayerDescriptor.prototype.refresh=function(mapRequest){var map=this.getMap();var self=this;this.withControl(function(control){var box;if(mapRequest){box=mapRequest.getBox();}else{box=map.getBox();} if(box){self.setExtents(box,mapRequest);}});};IONIC.api.maps.ECWPLayerDescriptor.prototype.scaleHTMLLayerToBox=function(newBox){this.setExtents(newBox);};IONIC.api.maps.ECWPLayerDescriptor.prototype.produceHTMLLayer=function(){var v=this.getMap();var aArgs=[];this._uid=gensym("ecwpLayerControl");aArgs.push(this._uid,"100%","100%");var self=this;var percentTrampName="ecwp_layer_trampoline_"+this.uuid+"_onPercentComplete";_root()[percentTrampName]=function(percent){self.onPercentComplete(percent);};var errorTrampName="ecwp_layer_trampoline_"+this.uuid+"_onError";_root()[errorTrampName]=function(){self.onError();};aArgs.push(PARAM_VIEW_ONPERCENTCOMPLETE,percentTrampName);aArgs.push(PARAM_VIEW_ONERROR,errorTrampName);var txt=NCSCreateViewReturnString(aArgs);var elt=document.createElement("div");elt.style.position="absolute";elt.style.top="0px";elt.style.left="0px";elt.style.width=v.getWidth()+"px";elt.style.height=v.getHeight()+"px";elt.style.visibility="visible";elt.innerHTML=txt;setTimeout(function(){self.setLayerInitializing(false);},1000);return elt;};IONIC.api.maps.ECWPLayerDescriptor.prototype.setMap=function(map){var layer;if(map){IONIC.maps.AbstractLayerDescriptor.prototype.setMap.call(this,map);if(!this.getHTMLLayer()){layer=this.produceHTMLLayer();layer.style.zIndex=this.computeHTMLLayerZIndex();this.setHTMLLayer(layer);this.getMap().getHTMLView().appendChild(layer);}}else{layer=this.getHTMLLayer();if(layer&&(layer.parentNode===this.getMap().getHTMLView())){this.getMap().getHTMLView().removeChild(layer);} IONIC.maps.AbstractLayerDescriptor.prototype.setMap.call(this,map);}};IONIC.api.maps.ECWPLayerDescriptor.ONRESIZED_HANDLER=function(type,args){var w=args[0];var h=args[1];var elt=this.getHTMLLayer();if(elt){elt.style.width=w+"px";elt.style.height=h+"px";} var self=this;setTimeout(function(){self.setExtents(self.getMap().getBox());},1000);};IONIC.api.maps.ECWPLayerDescriptor.prototype.attachToMap=function(map){map.onResized.subscribe(IONIC.api.maps.ECWPLayerDescriptor.ONRESIZED_HANDLER,this,true);};IONIC.api.maps.ECWPLayerDescriptor.prototype.detachFromMap=function(map){IONIC.maps.AbstractLayerDescriptor.prototype.detachFromMap.call(this,map);map.onResized.unsubscribe(IONIC.api.maps.ECWPLayerDescriptor.ONRESIZED_HANDLER,this);};IONIC.api.maps.ECWPLayerDescriptor.prototype.shift=function(shiftx,shifty){var view=this.getView();var box=view.getBox();var newBox=IONIC.maps.NavHelper.panBoxByPixels(view.getWidth(),view.getHeight(),box,-shiftx,shifty);this.setExtents(newBox);};IONIC.api.maps.ECWPLayerDescriptor.prototype.lonLatBoxToExtents=function(box,callback){var control=this.getControlOrFail();var tlx=control.GetCoordEasting(box.maxy,box.minx);var tly=control.GetCoordNorthing(box.maxy,box.minx);var bry=control.GetCoordNorthing(box.miny,box.maxx);var brx=control.GetCoordEasting(box.miny,box.maxx);return[new IONIC.api.geom.Point(tlx,tly),new IONIC.api.geom.Point(brx,bry)];};IONIC.api.maps.ECWPLayerDescriptor.prototype.extentsToLonLatBox=function(tl,br){var control=this.getControlOrFail();return new IONIC.api.geom.Box(control.GetCoordLongitude(tl.x,tl.y),control.GetCoordLatitude(tl.x,tl.y),control.GetCoordLongitude(br.x,br.y),control.GetCoordLatitude(br.x,br.y),-1);};IONIC.api.maps.ECWPLayerDescriptor.prototype.getVisibleLayerExtents=function(name){var control=this.getControlOrFail();var tlx=control.GetLayerVisibleImageTopLeftWorldCoordinateX(name);var tly=control.GetLayerVisibleImageTopLeftWorldCoordinateY(name);var brx=control.GetLayerVisibleImageBottomRightWorldCoordinateX(name);var bry=control.GetLayerVisibleImageBottomRightWorldCoordinateY(name);return[new IONIC.api.geom.Point(tlx,tly),new IONIC.api.geom.Point(brx,bry)];};IONIC.api.maps.ECWPLayerDescriptor.prototype.setExtents=function(box,mapRequest){var map=this.getMap();if(!mapRequest){mapRequest=new IONIC.maps.MapRequest(map,[this]);mapRequest.setBox(box);map.enqueueMapRequest(mapRequest);mapRequest.perform();return;} var curMR=this.getCurrentMapRequest();if(curMR){curMR.layerLoadingCanceled(this);} this.setCurrentMapRequest(mapRequest);var self=this;this.withControl(function(control){var proceed=function(box){control.SetExtents(box.minx,box.maxy,box.maxx,box.miny);var pc=control.GetPercentComplete();self.onPercentComplete(pc);};proceed(box);});};IONIC.api.maps.ECWPLayerDescriptor.prototype.setOpacity=function(factor){var self=this;this.withControl(function(control){self.forEachServerSideLayer(function(ssLayer,ssLayerIdx){control.SetLayerTransparency(ssLayer.getName(),"#",factor);});});};IONIC.api.maps.ECWPLayerDescriptor.prototype.getOpacity=function(){var opa,self=this;var control=this.getControl();if(control){this.forEachServerSideLayer(function(ssLayer,ssLayerIdx){opa=control.GetLayerTransparency(ssLayer.getName(),"#");});return opa;}else{return 1.0;}};IONIC.api.maps.ECWPLayerDescriptor.prototype.getBoundingBox=function(){var control=this.getControl();var box;var self=this;if(control){this.forEachServerSideLayer(function(ssLayer){box=ssLayer.getECWPBoundingBox(self);});} return box;};IONIC.api.maps.ECWPLayerDescriptor.prototype.onError=function(layerName,num,errorCode,descText){};IONIC.api.maps.ECWPLayerDescriptor.prototype.onPercentComplete=function(percent){this.setPercentComplete(percent);var mr=this.getCurrentMapRequest();if(mr){if(percent===100){mr.layerLoaded(this);this.setCurrentMapRequest(null);}else{var li=mr.getLayerInfo(this);if(li){li.setProgress(percent/100.0);}}}};IONIC.api.maps.ECWPLayerDescriptor.prototype.setPercentComplete=function(percent){this.percentComplete=percent;};IONIC.api.maps.ECWPLayerDescriptor.prototype.getPercentComplete=function(){return this.percentComplete;};IONIC.api.maps.ECWPLayerDescriptor.prototype.setCurrentMapRequest=function(mr){this.currentMapRequest=mr;};IONIC.api.maps.ECWPLayerDescriptor.prototype.getCurrentMapRequest=function(){return this.currentMapRequest;};IONIC.api.maps.ECWPLayerDescriptor.SERIALIZER=function(ld){var wmsSerializer=IONIC.api.maps.LayerDescriptor.getLayerSerializer(IONIC.api.maps.WMSSSLayer.SERVICE_TYPE);var layersAndConfig=wmsSerializer(ld);layersAndConfig=IONIC.misc.mapcar(function(layerAndConfig,ssLayer){layerAndConfig.layer.serviceUrl=ssLayer.getServiceUrl();layerAndConfig.layer.ecwpAccessUrl=ssLayer.getECWPUrl();return layerAndConfig;},layersAndConfig,ld.getServerSideLayers());return layersAndConfig;};IONIC.api.maps.ECWPLayerDescriptor.DESERIALIZER=function(tfld,ldConfig){var ssLayer,ld;if(IONIC.api.maps.ECWPLayerDescriptor.isECWPUsable()){ssLayer=new IONIC.api.maps.ECWPSSLayer(tfld.serviceUrl,tfld.ecwpAccessUrl,tfld.name,null,ldConfig?ldConfig.login:null,ldConfig?ldConfig.password:null);ssLayer.setTitle(tfld.title);ssLayer.setDefinedBoundingBoxes(IONIC.misc.mapcar1(function(bbox){return IONIC.api.geom.Box.fromValues(bbox);},tfld.bboxes));ssLayer.setServiceVersion(tfld.serviceVersion);ssLayer.setNativelySupportedSrses(tfld.nativelySupportedSrs.slice());ld=new IONIC.api.maps.ECWPLayerDescriptor([ssLayer]);IONIC.api.maps.LayerDescriptor.applyCommonConfiguration(ld,ldConfig);}else{tfld.serviceType="WMS";ld=(IONIC.api.maps.LayerDescriptor.getLayerDeserializer("WMS"))(tfld,ldConfig);} return ld;};IONIC.api.maps.LayerDescriptor.registerLayerSerialization(IONIC.api.maps.ECWPSSLayer.SERVICE_TYPE,IONIC.api.maps.ECWPLayerDescriptor.SERIALIZER,IONIC.api.maps.ECWPLayerDescriptor.DESERIALIZER); IONIC.api.maps.ProviderDiscoveryTool=function(map){this._requestTool=IONIC.misc.RequestTool.newInstance();this._map=map;this.allowBoxReset=true;};IONIC.api.maps.ProviderDiscoveryTool.prototype.getRequestTool=function(){return this._requestTool;};IONIC.api.maps.ProviderDiscoveryTool.getDiscoveryUrl=function(serviceUrl,serviceType){return IONIC.misc.getWebappBaseUrl()+"/discover"+"?providerUrl="+escape(serviceUrl)+"&serviceType="+escape(serviceType);};IONIC.api.maps.ProviderDiscoveryTool.prototype.allowBoxReset=function(flag){this.allowBoxReset=flag;};IONIC.api.maps.ProviderDiscoveryTool.prototype.setTiling=function(flag){this.tiling=flag;};IONIC.api.maps.ProviderDiscoveryTool.prototype.isTilingEnabled=function(){return!!this.tiling;};IONIC.api.maps.ProviderDiscoveryTool.prototype.withDiscovery=function(serviceUrl,serviceType,beginCallback,iterationCallback,endCallback,errorCallback){var fullUrl=IONIC.api.maps.ProviderDiscoveryTool.getDiscoveryUrl(serviceUrl,serviceType);var __ldlist=null;var self=this;errorCallback=errorCallback||IONIC.misc.ErrorMessage.alert;function handleResponse(success,parsedObject,responseText,thisReq){if(parsedObject.type){if(errorCallback){errorCallback(parsedObject);} return;} self.getRequestTool()._wrapIterationCallbacks(function(success,object,responseText,thisReq){__ldlist=object.layerDescriptorsInfo;if(beginCallback){beginCallback(success,object,responseText,thisReq);}},iterationCallback,function(success,parsedObject,req){if(endCallback){endCallback(success,parsedObject,req);}},"children",null,function(layerMinimalTreeInfo){var tfld=__ldlist[layerMinimalTreeInfo.idx];var proxy={name:layerMinimalTreeInfo.name,title:layerMinimalTreeInfo.title,id:gensym("ldpxy"),serviceType:serviceType,makeLayerDescriptor:function(){var deserializer=IONIC.api.maps.LayerDescriptor.getLayerDeserializer(serviceType);return deserializer(tfld,{});}};return proxy;},"layersTree").apply(self,arguments);} this.getRequestTool()._withUrl(fullUrl,"GET",handleResponse);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withAddedLayers=function(url,type,predicate,endCallback,errorCallback){var thisRef=this;var descriptors=[];this.withDiscovery(url,type,null,function(proxy,parentProxy,pos,count,depth){if(!predicate||predicate(proxy)){descriptors.push(proxy.makeLayerDescriptor());}},function(success,obj){if(thisRef._map){thisRef._map.addLayerDescriptors(descriptors);} if(endCallback){endCallback(descriptors);}},errorCallback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withAddedOGCLayers=function(url,type,layerNames,endCallback,errorCallback){if(typeof layerNames==='string'){layerNames=[layerNames];} if(layerNames&&layerNames.length===0){throw"At least one layer must be added.";} this.withAddedLayers(url,type,function(proxy){var item,isValid=proxy.name&&proxy.name!=="";if(!isValid){return false;} if(layerNames){item=IONIC.misc.find(proxy.name,layerNames);if(item){return true;}else{return false;}}else{return true;}},function(lds){var diff,ldNames;if(layerNames&&lds.length!==layerNames.length){ldNames=[];IONIC.misc.forEach(function(ld){ldNames.push(ld.getServerSideLayers()[0].getName());},lds);diff=IONIC.misc.difference(layerNames,ldNames);alert("One layer has not been found ("+ diff.join(", ")+")");} if(endCallback){endCallback(lds);}},errorCallback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withAddedWMSLayers=function(url,layerNames,endCallback){this.withAddedOGCLayers(url,"WMS",layerNames,endCallback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withAddedWFSLayers=function(url,layerNames,endCallback){this.withAddedOGCLayers(url,"WFS",layerNames,endCallback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withBuiltWMSTree=function(url,htmlElt,win,callback){this.withBuiltTree(url,"WMS",htmlElt,win,callback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withBuiltWFSTree=function(url,htmlElt,win,callback){this.withBuiltTree(url,"WFS",htmlElt,win,callback);};IONIC.api.maps.ProviderDiscoveryTool.prototype.withBuiltTree=function(url,type,htmlElt,win,callback,expand){var dh=IONIC.api.ui.DomHelper.forDocument(win||window);var thisRef=this;if(typeof expand!=="number"){expand=1;} function authenticationErrorHandler(status,respText){var errorMsg=eval("("+respText+")");var loginElt=dh.elt("div");if(errorMsg.type.indexOf("authentication")!==0){return;} IONIC.misc.RequestTool.DEFAULT_IONIC_ERROR_HANDLER_FUN(status,respText,null,null,true);var errorString="Authentication error"+ (errorMsg.message?(": "+errorMsg.message):"");dh.clr(htmlElt);dh.append(htmlElt,dh.txt(errorString),loginElt);var loginPanel=new IONIC.ui.security.LoginPanel(errorMsg.serviceType,errorMsg.serviceUrl,loginElt);function authenticationStatusChanged(){if(IONIC.security.SecureServices.isAccessible(errorMsg.serviceType,errorMsg.serviceUrl,false)){IONIC.security.SecureServices.onChange.unsubscribe(authenticationStatusChanged);dh.clr(htmlElt);buildTree();}} IONIC.security.SecureServices.onChange.subscribe(authenticationStatusChanged);} var pdt=this.clone();var pdtb=new IONIC.ui.ProviderDiscoveryTreeBuilder(pdt);pdt.getRequestTool().setErrorHandler(IONIC.misc.RequestTool.IONIC_ERROR_HTTP_CODE,authenticationErrorHandler);buildTree();function buildTree(){var loadingImg=dh.elt("img");loadingImg.src=IONIC.misc.getWebappBaseUrl()+"/images/api/maps/ProviderDiscoveryTool/loading.gif";dh.clr(htmlElt);dh.append(htmlElt,dh.elt("span",loadingImg,dh.txt("Please wait...")));pdtb.buildTree(url,type,htmlElt,dh,null,function(layerDescriptor){var map=pdt._map,box;if(!map){return;} if(pdt.allowBoxReset&&map.getMapLayerDescriptors().length===0&&map.getBox()&&!layerDescriptor.isNativelySupportedSrs(map.getSrs())&&!layerDescriptor.supportsReprojecting()){box=layerDescriptor.getPreferredBoundingBox();if(box){map.setBox(box,true);}} map.addLayerDescriptor(layerDescriptor);},function(tree){function expandNode(node){node.expand();if(node.children.length===1){expandNode(node.children[0]);}} switch(expand){case 0:break;case 1:expandNode(tree.getRoot());break;case 2:tree.getRoot().expandAll();break;default:throw"Expand: wrong argument";} if(callback){callback(tree);}},function(errorMessage){var msg="The service discovery cannot be performed"+ (errorMessage.message?" ("+errorMessage.message+").":".");dh.clr(htmlElt);dh.append(htmlElt,dh.txt(msg));});}};IONIC.api.maps.ProviderDiscoveryTool.prototype.clone=function(){var pdt=new IONIC.api.maps.ProviderDiscoveryTool(this._map);pdt.tiling=this.tiling;pdt.allowBoxReset=this.allowBoxReset;return pdt;}; IONIC.api.maps.keymap.Manager=function(){};IONIC.api.maps.keymap.Manager.newInstance=function(){return new IONIC.api.maps.keymap.Manager();};IONIC.api.maps.keymap.Manager.prototype.setParentMap=function(pmv){this.pmv=pmv;};IONIC.api.maps.keymap.Manager.prototype.setOverviewMap=function(omv){this.omv=omv;};IONIC.api.maps.keymap.Manager.prototype.getParentMapView=function(){return this.getParentMap();};IONIC.api.maps.keymap.Manager.prototype.getParentMap=function(){return this.pmv;};IONIC.api.maps.keymap.Manager.prototype.getKeyMapView=function(){return this.getOverviewMap();};IONIC.api.maps.keymap.Manager.prototype.getOverviewMap=function(){return this.omv;};IONIC.api.maps.keymap.Manager.prototype.negociateOverviewMapBox=function(box){throw"IONIC.api.maps.keymap.Manager is an abstract type; "+"KeyMapManager.negociateOverviewMapBox () should be "+"implemented by a concrete type.";};IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromParentMap=function(parentSrsBox,proceed){var epsgId=this.getOverviewMap().getSrsBox()?this.getOverviewMap().getSrsBox().epsgId:parentSrsBox.epsgId;IONIC.geom.TransformTool.withTransforms([IONIC.geom.TransformTool.Transform.newInstance(parentSrsBox,parentSrsBox.epsgId,epsgId)],function(transforms){var transform=transforms?transforms[0]:null;if(transform){proceed(transform,undefined);}else{alert("Error while trying to retrieve transformed box. Cannot update view.");}});};IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromOverviewMap=function(keySrsBox,proceed){IONIC.geom.TransformTool.withTransforms([IONIC.geom.TransformTool.Transform.newInstance(keySrsBox,keySrsBox.epsgId,this.getParentMapView().getSrsBox().epsgId)],function(transforms){var transform=transforms?transforms[0]:null;if(transform){proceed(transform);}else{alert("Error while trying to retrieve transformed box. Cannot update view.");}});}; IONIC.api.maps.keymap.StillManager=function(){IONIC.api.maps.keymap.Manager.call(this);};IONIC.api.maps.keymap.StillManager.newInstance=function(){return new IONIC.api.maps.keymap.StillManager();};IONIC.misc.extendType(IONIC.api.maps.keymap.StillManager,IONIC.api.maps.keymap.Manager);IONIC.api.maps.keymap.StillManager.prototype.negociateOverviewMapBox=function(box){return undefined;};IONIC.api.maps.keymap.StillManager.prototype.withDerivedBoxFromParentMap=function(parentSrsBox,proceed){IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromParentMap.call(this,parentSrsBox,function(transformedParentBox,undefined){proceed(transformedParentBox,transformedParentBox);});};IONIC.api.maps.keymap.StillManager.prototype.withDerivedBoxFromOverviewMap=function(overviewSrsBox,proceed){IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromOverviewMap.call(this,overviewSrsBox,function(transformedOverviewBox){proceed(transformedOverviewBox);});}; IONIC.api.maps.keymap.FixedRatioManager=function(){IONIC.api.maps.keymap.Manager.call(this);this.setRatio(2.);};IONIC.api.maps.keymap.FixedRatioManager.newInstance=function(){return new IONIC.api.maps.keymap.FixedRatioManager();};IONIC.misc.extendType(IONIC.api.maps.keymap.FixedRatioManager,IONIC.api.maps.keymap.Manager);IONIC.api.maps.keymap.FixedRatioManager.prototype.setRatio=function(ratio){if(ratio<=0.){throw"Invalid ratio. Must be strictly positive";} this._ratio=ratio;};IONIC.api.maps.keymap.FixedRatioManager.prototype.getRatio=function(ratio){return this._ratio;};IONIC.api.maps.keymap.FixedRatioManager.prototype.negociateOverviewMapBox=function(box){return box;};IONIC.api.maps.keymap.FixedRatioManager.prototype.withDerivedBoxFromParentMap=function(parentSrsBox,proceed){var ratio=this.getRatio();IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromParentMap.call(this,parentSrsBox,function(transformedParentBox,unused){proceed(transformedParentBox,transformedParentBox.expanded(ratio));});};IONIC.api.maps.keymap.FixedRatioManager.prototype.withDerivedBoxFromOverviewMap=function(overviewSrsBox,proceed){var ratio=this.getRatio();IONIC.api.maps.keymap.Manager.prototype.withDerivedBoxFromOverviewMap.call(this,overviewSrsBox,function(transformedOverviewBox){proceed(transformedOverviewBox.expanded(1./ratio));});}; IONIC.api.maps.BaseMapElement=function(map,point,htmlElement,callback){var meld=(map instanceof IONIC.api.maps.Map)?map.getMELayerDescriptor():map;this.meld=meld;this.htmlElement=htmlElement;this.hideOutOfBox=true;this.alignX=IONIC.api.maps.BaseMapElement.prototype.ALIGN_X_CENTER;this.alignY=IONIC.api.maps.BaseMapElement.prototype.ALIGN_Y_CENTER;var map=this.meld.getMap();this.normalZIndex=map.zIndexFor("me");this.onMapDragZIndex=map.zIndexFor("mbcd");var transform=new IONIC.geom.TransformTool.Transform(point,point.epsgId,map.getBox().epsgId);var self=this;IONIC.geom.TransformTool.withTransform(transform,function(transformed){self.point=transformed;if(self.meld){self.meld.accept(self);} if(callback){callback();}});};IONIC.api.maps.BaseMapElement.newInstance=function(meld,point,htmlElement){return new IONIC.api.maps.BaseMapElement(meld,point,htmlElement);};IONIC.api.maps.BaseMapElement.prototype.ALIGN_X_CENTER=1<<1;IONIC.api.maps.BaseMapElement.prototype.ALIGN_X_LEFT=1<<2;IONIC.api.maps.BaseMapElement.prototype.ALIGN_Y_CENTER=1<<(1+16);IONIC.api.maps.BaseMapElement.prototype.ALIGN_Y_BOTTOM=1<<(2+16);IONIC.api.maps.BaseMapElement.prototype._getMELD=function(){return this.meld;};IONIC.api.maps.BaseMapElement.prototype.getMap=function(){return this._getMELD().getMap();};IONIC.api.maps.BaseMapElement.prototype.setAlignX=function(alignX){this.alignX=alignX;this.setPoint(this.getPoint());};IONIC.api.maps.BaseMapElement.prototype.setAlignY=function(alignY){this.alignY=alignY;this.setPoint(this.getPoint());};IONIC.api.maps.BaseMapElement.prototype.onMapDragStart=function(){this.getHTMLElement().style.zIndex=this.onMapDragZIndex;};IONIC.api.maps.BaseMapElement.prototype.onMapDragEnd=function(){this.getHTMLElement().style.zIndex=this.normalZIndex;};IONIC.api.maps.BaseMapElement.prototype.getHTMLElement=function(){return this.htmlElement;};IONIC.api.maps.BaseMapElement.prototype._getExtentPixel=function(topleftFlag,shiftx,shifty){var w=this.getWidth();var h=this.getHeight();var fx=topleftFlag?-1:1;var fy=topleftFlag?-1:1;switch(this.alignX){case IONIC.api.maps.BaseMapElement.prototype.ALIGN_X_CENTER:break;case IONIC.api.maps.BaseMapElement.prototype.ALIGN_X_LEFT:fx=0;break;default:throw"Unknown X alignment: "+this.alignX;} switch(this.alignY){case IONIC.api.maps.BaseMapElement.prototype.ALIGN_Y_CENTER:break;case IONIC.api.maps.BaseMapElement.prototype.ALIGN_Y_BOTTOM:fy=-2;break;default:throw"Unknown Y alignment: "+this.alignY;} return[Math.round(this.pixel[0]+((w/2)*fx)+(shiftx?shiftx:0)),Math.round(this.pixel[1]+((h/2)*fy)+(shifty?shifty:0))];};IONIC.api.maps.BaseMapElement.prototype.getPixel=function(){return this.pixel;};IONIC.api.maps.BaseMapElement.prototype.getTopLeftPixel=function(shiftx,shifty){return this._getExtentPixel(true,shiftx,shifty);};IONIC.api.maps.BaseMapElement.prototype.getBottomRightPixel=function(shiftx,shifty){return this._getExtentPixel(false,shiftx,shifty);};IONIC.api.maps.BaseMapElement.prototype.isOutOfBox=function(shiftx,shifty){var p=this.getPixel();var x=p[0]+(shiftx||0);var y=p[1]+(shifty||0);var map=this.getMap();return x<0||x>=map.getWidth()||y<0||y>=map.getHeight();};IONIC.api.maps.BaseMapElement.prototype.isHideOutOfBox=function(){return this.hideOutOfBox;};IONIC.api.maps.BaseMapElement.prototype.getPoint=function(){return this.point;};IONIC.api.maps.BaseMapElement.prototype.setPoint=function(pt){var map=this.getMap();this.setPointInArea(pt,map.getDimensions(),map.getBox());};IONIC.api.maps.BaseMapElement.prototype.setPointInArea=function(pt,areaDimensions,areaBox,shiftx,shifty){this.point=pt;this.computePixelSpaceCoords(areaDimensions,areaBox,shiftx,shifty);var st=this.htmlElement.style;if(this.isOutOfBox(shiftx,shifty)&&this.isHideOutOfBox()){st.display="none";}else{st.display="";}};IONIC.api.maps.BaseMapElement.prototype.computePixelSpaceCoords=function(dimensions,box,shiftx,shifty){this.pixel=IONIC.maps.NavHelper.srsPointToPixelOnArea(this.point,dimensions,box);var pxl=this.getTopLeftPixel(shiftx,shifty);var hes=this.htmlElement.style;hes.left=pxl[0]+'px';hes.top=pxl[1]+'px';};IONIC.api.maps.BaseMapElement.prototype.attachToHTMLLayer=function(htmlLayer){var he=this.htmlElement;var hes=he.style;hes.position='absolute';htmlLayer.appendChild(he);var map=this.getMap();hes.zIndex=this.normalZIndex;this.setPoint(this.getPoint());this.onattach(htmlLayer);};IONIC.api.maps.BaseMapElement.prototype.destroy=function(){var he=this.htmlElement;var pn=he.parentNode;if(pn){pn.removeChild(he);this.ondetach(pn);}};IONIC.api.maps.BaseMapElement.prototype.onattach=function(htmlLayer){};IONIC.api.maps.BaseMapElement.prototype.ondetach=function(htmlLayer){};IONIC.api.maps.BaseMapElement.prototype.getWidth=function(){var nfo;if(!this.cachedWidth){nfo=JSToolbox.Position.get(this.htmlElement);this.cachedWidth=nfo.width;} return this.cachedWidth;};IONIC.api.maps.BaseMapElement.prototype.getHeight=function(){var nfo;if(!this.cachedHeight){nfo=JSToolbox.Position.get(this.htmlElement);this.cachedHeight=nfo.height;} return this.cachedHeight;};IONIC.api.maps.BaseMapElement.prototype._clearDimensionsCache=function(){this.cachedWidth=this.cachedHeight=undefined;};IONIC.api.maps.BaseMapElement.prototype._forceDimensionsCache=function(w,h){this.cachedWidth=w;this.cachedHeight=h;}; IONIC.api.maps.InteractiveMapElement=function(map,point,htmlElement,onMouseOver,onMouseOut,onClick){IONIC.api.maps.BaseMapElement.call(this,map,point,htmlElement);var he=this.htmlElement;if(he){if(onMouseOver)he.onmouseover=onMouseOver;if(onMouseOut)he.onmouseout=onMouseOut;if(onClick)he.onclick=onClick;}};IONIC.misc.extendType(IONIC.api.maps.InteractiveMapElement,IONIC.api.maps.BaseMapElement); IONIC.api.maps.PopupMapElement=function(map,point,htmlElement,popupElement,onClick){var thisRef=this;var ps=popupElement.style;ps.position='absolute';ps.left='1px';ps.top='1px';ps.visibility='hidden';this.infoPopup=popupElement;IONIC.api.maps.InteractiveMapElement.call(this,map,point,htmlElement,function(event){thisRef.activate(true);},function(event){thisRef.activate(false);},onClick);};IONIC.misc.extendType(IONIC.api.maps.PopupMapElement,IONIC.api.maps.InteractiveMapElement);IONIC.api.maps.PopupMapElement.newInstance=function(map,point,htmlElement,infoHTML,onClick){return new IONIC.api.maps.PopupMapElement(map,point,htmlElement,infoHTML,onClick);};IONIC.api.maps.PopupMapElement.prototype.getPopupWidth=function(){if(this.cpw===0){var nfo=JSToolbox.Position.get(this.infoPopup);this.cpw=nfo.width;} return this.cpw;};IONIC.api.maps.PopupMapElement.prototype.getPopupHeight=function(){if(this.cph===0){var nfo=JSToolbox.Position.get(this.infoPopup);this.cph=nfo.height;} return this.cph;};IONIC.api.maps.PopupMapElement.prototype._positionInfoPopup=function(){var hel_w=this.getWidth();var hel_h=this.getHeight();var width=this.getPopupWidth();var height=this.getPopupHeight();var map=this.getMap();var pt=this.getBottomRightPixel();var x=pt[0];var y=pt[1];if((x+width)>=map.getWidth()){x=this.pixelx-width-hel_w/2;} if((y+height)>=map.getHeight()){y=this.pixely-height-hel_h/2;} var ips=this.infoPopup.style;ips.left=x+'px';ips.top=y+'px';ips.zIndex=map.zIndexFor("mep");};IONIC.api.maps.PopupMapElement.prototype.activate=function(activation){var hel=this.htmlElement;var pup=this.infoPopup;if(!activation){if(hel){hel.style.zIndex=this.getMap().zIndexFor("me");if(hel.inactiveOpacity){setElementOpacity(hel,hel.inactiveOpacity/100);} if(hel.border){hel.style.borderWidth=hel.border;}} if(pup){pup.style.visibility='hidden';}}else{if(hel){hel.style.zIndex=this.getMap().zIndexFor("me")+1;if(hel.activeOpacity){setElementOpacity(hel,hel.activeOpacity/100);} if(hel.border){hel.style.borderWidth=hel.border;}} if(pup){this._positionInfoPopup();pup.style.visibility='visible';}}};IONIC.api.maps.PopupMapElement.prototype.destroy=function(){var pn=this.infoPopup.parentNode;pn.removeChild(this.infoPopup);IONIC.api.maps.BaseMapElement.prototype.destroy.call(this);};IONIC.api.maps.PopupMapElement.prototype.attachToHTMLLayer=function(htmlLayer){IONIC.api.maps.BaseMapElement.prototype.attachToHTMLLayer.call(this,htmlLayer);htmlLayer.appendChild(this.infoPopup);}; IONIC.api.maps.MapElementGroup=function(groupId){storeMapElementGroup(groupId,this);this.id=groupId;this.mapElements={};};(function(){var _grps=new Array();window.getMapElementGroup=function(groupId){return _grps[groupId];};window.storeMapElementGroup=function(groupId,group){_grps[groupId]=group;};window.deleteMapElementGroup=function(groupId){var group=_grps[groupId];if(group){group.detachAll();group.getView().removeLayer(group.getLayerDescriptor());_grps[groupId]=null;}};})();IONIC.api.maps.MapElementGroup.prototype.getMapElement=function(id){return this.mapElements[id];} IONIC.api.maps.MapElementGroup.prototype.getMapElements=function(){return this.mapElements;} IONIC.api.maps.MapElementGroup.prototype.store=function(mapElement,id){this.mapElements[id]=mapElement;} IONIC.api.maps.MapElementGroup.prototype._resolve=function(meDesignator){if(typeof meDesignator==="string") return this.mapElements[meDesignator];else return meDesignator;} IONIC.api.maps.MapElementGroup.prototype.detach=function(meDesignator){var me=this._resolve(meDesignator);if(me){if(typeof meDesignator==="string") delete this.mapElements[meDesignator];else throw"FIXME: Unimp.: detachMapElement with a designator that's actually a map element, not an ID";return me;}} IONIC.api.maps.MapElementGroup.prototype.forEachElement=function(fun,predicate){var mes=this.mapElements;for(var id in mes){if(mes.hasOwnProperty(id)){var me=mes[id];if(!predicate||predicate(me,id)){fun(me,id);}}}};IONIC.api.maps.MapElementGroup.prototype.detachAll=function(){var group=this;this.forEachElement(function(elt,id){group.detach(elt);});this.mapElements={};} IONIC.api.maps.MapElementGroup.prototype.destroyAll=function(){this.forEachElement(function(elt,id){elt.destroy();});this.mapElements={};} IONIC.api.ui.DomHelper=function(doc){var thisRef;this._doc=doc;};IONIC.api.ui.DomHelper.newInstance=function(doc){return new IONIC.api.ui.DomHelper(doc);};IONIC.api.ui.DomHelper.forDocument=function(doc){if(!doc){return;} doc=(doc.document?doc.document:doc);if(typeof doc.getElementById==="undefined"){return;} return new IONIC.api.ui.DomHelper(doc);};IONIC.api.ui.DomHelper.prototype.getDocument=function(){return this._doc;};IONIC.api.ui.DomHelper.prototype.elt=function(type){var eltPts=type.split(".");var elt=this._doc.createElement(eltPts[0]);if(eltPts.length>1){elt.className=eltPts[1];} for(var i=1,n=arguments.length;i0){this._purge(elt.childNodes[0]);elt.removeChild(elt.childNodes[0]);}}} return elt;};IONIC.api.ui.DomHelper.prototype.append=function(parentDesignator){var parent=this.get(parentDesignator);if(!parent){if(typeof parentDesignator==="string"){throw"No element with ID \""+parentDesignator+"\" could be found in the document";}} for(var i=1,n=arguments.length;i");}else{elt=this.elt("input");elt.type=type;elt.name=name;elt.value=value;if(id){elt.id=id;} if(checked){elt.checked="CHECKED";}} return elt;};IONIC.api.ui.DomHelper.prototype.mkCanvas=function(){var doc=this.getDocument();var c=doc.createElement("CANVAS");if(IE){document.body.appendChild(c);c=G_vmlCanvasManager_.initElement(c);c.parentNode.removeChild(c);} return c;};IONIC.api.ui.DomHelper.prototype._enableDebug=function(){this._wrapFunWithHandler("append");this._wrapFunWithHandler("elt");};IONIC.api.ui.DomHelper.prototype._wrapFunWithHandler=function(funname){var oldFun=this[funname];this[funname]=function(){try{return oldFun.apply(this,arguments);}catch(e){var callers=[];var cler=arguments.callee.caller;if(cler){do{callers.push(cler.name||"[anonymous]");cler=cler.caller;}while(cler);} throw e;}};}; IONIC.api.ui.LayerList=function(map,htmlElt,items,win){win=win||window;var dh=IONIC.api.ui.DomHelper.newInstance(win.document);this.dragEltGroup=gensym();this._layerActions=[];var htmlList=dh.elt("ul.LayerList");htmlList.id=gensym();IONIC.ui.AbstractMapAttachedComponent.call(this,htmlElt,htmlList,map);if(typeof items!=="undefined"&&items!==null){this.bwCompatBuildItems(IONIC.api.ui.LayerList._toArray(items));} this.setLegendIconThumbnailing(false);};IONIC.misc.extendType(IONIC.api.ui.LayerList,IONIC.ui.AbstractMapAttachedComponent);IONIC.api.ui.LayerList.newInstance=function(map,containerList,containerDocument,items,imagePath){return new IONIC.api.ui.LayerList(map,containerList,containerDocument,items,imagePath);};IONIC.api.ui.LayerList.VISIBILITY=1<<0;IONIC.api.ui.LayerList.FIT=1<<2;IONIC.api.ui.LayerList.EDIT=1<<3;IONIC.api.ui.LayerList.SELECT=1<<4;IONIC.api.ui.LayerList.METADATA=1<<5;IONIC.api.ui.LayerList.REMOVE=1<<6;IONIC.api.ui.LayerList.OPACITY=1<<7;IONIC.api.ui.LayerList.CONFIGURE=1<<8;IONIC.api.ui.LayerList._toArray=function(items){if(items instanceof Array){return items;} var rv=[];for(var i=0;i0&&ld.getServerSideLayers()[0];var stype=ld.getServiceType();if(stype){stype=stype.toUpperCase();} var style;if(stype==="WMS"&&firstSSLayer){style=firstSSLayer.getCurrentStyle();if(style&&style.iconUrl){self.finalizeThumbnailization(thumbnailImg,firstSSLayer,style.iconUrl);thumbOk=true;}} if(!thumbOk){this.finalizeThumbnailization(thumbnailImg,firstSSLayer,firstSSLayer?this.getThumbnailProducerUrl(firstSSLayer,false):null);} switch(stype){case"WMS":firstSSLayer&&firstSSLayer.onStyleChanged.subscribe(function(){self.finalizeThumbnailization(thumbnailImg,firstSSLayer,self.getThumbnailProducerUrl(firstSSLayer,false));});break;case"WFS":firstSSLayer&&firstSSLayer.onPortrayalDirectiveChanged.subscribe(function(){self.finalizeThumbnailization(thumbnailImg,firstSSLayer,self.getThumbnailProducerUrl(firstSSLayer,false));});break;case"ECWP":break;case"TMS":break;case null:break;default:throw"Unrecognized layer type: "+stype;} var info={domHelper:dh,itemFactory:tif,layerDescriptor:ld,layerList:this,listEntry:liEntry};var toolbarHolder=dh.elt("div.actions");toolbarHolder.onclick=function(e){e=e||event;var icon=e.target||e.srcElement;while(icon&&!icon.layerActionIcon){icon=icon.parentNode;} if(!icon){return;} var ccn=IONIC.misc.CompositeClassName.forElement(icon,true);if(!ccn){return;} var iconName=ccn.getPart(IONIC.ui.layerlistactions.AbstractLayerAction.ACTION_CSS_CONCEPT);if(!iconName){return;} var action=self.getLayerActionByName(iconName);if(!action){return;} action.handleClick(ld);};var imgHolder=dh.elt("div.imgHolder",thumbnailImg);var ttle=dh.elt("div.title",titleHolder);var actions=toolbarHolder;var closeBox=dh.elt("div.closeBox");var box;if(IE){box=dh.elt("div.layerEntry",dh.elt("div.IEFix",imgHolder,ttle,actions));}else{box=dh.elt("div.layerEntry",imgHolder,ttle,actions,closeBox);} dh.append(liEntry,box);liEntry.box=box;var ul=this.getListComponent();var liPos=ul.childNodes.length-position;if(liPos>0){dh.after(liEntry,ul.childNodes[liPos-1]);}else{if(ul.childNodes.length){dh.before(liEntry,ul.childNodes[0]);}else{dh.append(ul,liEntry);}} var dd=new IONIC.ui.LayerListDDEntry(liEntry.id,null,{owner:this});YAHOO.util.DDM.clickTimeThresh=500;ld.ldEventListenerCBData={layerDescriptor:ld,layerList:this};var curEvent,i,n;IONIC.misc.forEach(function(e){ld[e].subscribe(IONIC.api.ui.LayerList.LAYER_DESCRIPTOR_EVENT_LISTENER,ld.ldEventListenerCBData);},ld.getCustomEventsNames());this.forEachLayerAction(function(layerAction){dh.append(toolbarHolder,layerAction.getComponent(ld));layerAction.initialize(ld);});};IONIC.api.ui.LayerList.prototype.forEachLayerAction=function(callback){IONIC.misc.forEach(callback,this.getLayerActions());};IONIC.api.ui.LayerList.prototype.getLayerActions=function(){return this._layerActions;};IONIC.api.ui.LayerList.prototype.getLayerActionByName=function(name){var i,n,as=this.getLayerActions();for(i=0,n=as.length;i=0;},li.getElementsByTagName("div"))[0];return toolbar;};IONIC.api.ui.LayerList.prototype.setLayerTitleStyle=function(layerDescriptor,id,value){var ccn,title=this.getLayerTitleComponent(layerDescriptor);if(title){ccn=IONIC.misc.CompositeClassName.forElement(title);ccn.setPart(id,value);}};IONIC.api.ui.LayerList.prototype.setLayerTitleText=function(layerDescriptor,title){var titleDiv=this.getLayerTitleComponent(layerDescriptor);titleDiv.innerHTML=title;};IONIC.api.ui.LayerList.prototype.getLayerTitleComponent=function(layerDescriptor){var li=this.getListEntryByLayer(layerDescriptor);if(!li){return;} var title,cur,i;var divs=li.getElementsByTagName("div");for(i=0;i=0){title=divs[i];}} if(!title){return;} return title;};IONIC.api.ui.LayerList.LAYER_DESCRIPTOR_EVENT_LISTENER=function(type,args,data){var ld=data.layerDescriptor;var ll=data.layerList;ll.forEachLayerAction(function(layerAction){if(layerAction.canHandleLayerEvent(type)){layerAction.handleLayerEvent(type,args,ld);}});var attr;switch(type){case"onLoading":ll.setLayerTitleStyle(ld,"loadstate","loading");break;case"onLoadingDone":ll.setLayerTitleStyle(ld,"loadstate","loaded");break;case"onLoadingError":ll.setLayerTitleStyle(ld,"loadstate","error");break;case"onAttributeChanged":attrName=args[0];switch(attrName){case"title":ll.setLayerTitleText(ld,args[1],args[2]);break;} break;}};IONIC.api.ui.LayerList.prototype.getThumbnailProducerUrl=function(ssLayer,tryHard){var ld=ssLayer.getParentLayerDescriptor();var pd,pdId;if(ld.getServiceType().toUpperCase()==="WFS"){pd=ssLayer.getCurrentPortrayalDirective();pdId=pd?pd.ref:null;} return IONIC.misc.getWebappBaseUrl()+"/produceThumbnail.do"+"?serviceUrl="+escape(ld.getServiceUrl())+"&serviceType="+escape(ld.getServiceType())+"&layerName="+escape(ssLayer?ssLayer.name:"")+ (pdId?("&portrayalDirectiveId="+escape(pdId)):"")+"&tryHarder="+escape(tryHard?tryHard:false)+"&format="+escape("image/"+(IE?"gif":"png"))+"&width=36&height=36";};IONIC.api.ui.LayerList.prototype.finalizeThumbnailization=function(img,ssLayer,startUrl){if(ssLayer){var ld=ssLayer.getParentLayerDescriptor();var self=this;img.onerror=function(e){img.onclick=function(e){img.onload=function(e){img.onload=img.onerror=null;img.title=ld.title;};img.src=self.getThumbnailProducerUrl(ssLayer,true);};img.onerror=null;img.title="No thumbnail available. Click to generate one.";img.src=IONIC.misc.getWebappBaseUrl()+"/images/LayerList/no_thumbnail.gif";img.width=36;img.height=36;};img.src=this.getThumbnailProducerUrl(ssLayer,this.getLegendIconThumbnailing());}else{img.src=IONIC.misc.getWebappBaseUrl()+"/images/LayerList/no_thumbnail.gif";}};IONIC.api.ui.LayerList.prototype.applyLayersOrder=function(){var ul=this.getAvailableComponent();var cn=ul.childNodes;var lds=[];var i,n,li;for(i=0,n=cn.length;i=(tv.pageCount*this.getItemsPerPage())){tab=this.createPage();}else{tab=tv.getTab(tv.pageCount-1);} this.injectResult(tab,item);tv.resultCount++;};IONIC.api.ui.NotebookResultsHandler.prototype.getTabView=function(){return this._tv;};IONIC.api.ui.NotebookResultsHandler.prototype.setTabView=function(tv){this._tv=tv;};IONIC.api.ui.NotebookResultsHandler.prototype.injectResult=function(tab,item){this.injectHTMLResult(tab,this.getRenderer().render(this,item));};IONIC.api.ui.NotebookResultsHandler.prototype.injectHTMLResult=function(tab,html){var dh=this.getDomHelper();dh.append(tab.hackGetContents(),html);};IONIC.api.ui.NotebookResultsHandler.prototype.createPage=function(){var dh=this.getDomHelper();var tv=this.getTabView();var pageNr=tv.pageCount;var pageContents=this.createPageContents();tv.addTab(new YAHOO.widget.Tab(undefined,{label:"Page #"+(pageNr+1),contentEl:pageContents,active:pageNr===0}));var tab=tv.getTab(pageNr);tab.hackGetContents=function(){return pageContents;};tv.pageCount++;return tab;};IONIC.api.ui.NotebookResultsHandler.prototype.createPageContents=function(){return this.getDomHelper().elt("div");};IONIC.api.ui.NotebookResultsHandler.prototype.onEnd=function(){var dh=this.getDomHelper();var ctr=this.getContainer();var tv=this.getTabView();if(tv.resultCount===0){dh.clr(ctr);dh.append(ctr,dh.elt("span",dh.txt("No results found...")));}}; IONIC.defns("api.ui.navigation");IONIC.api.ui.navigation.NavBar=function(htmlElt,map,win){win=win||window;var dh=IONIC.api.ui.DomHelper.newInstance(win.document);var toolbarHolder=dh.elt("div.NavBar");var toolbarComponent=dh.elt("div.yui-skin-sam",toolbarHolder);IONIC.ui.AbstractToolbar.call(this,toolbarHolder,win.document);IONIC.ui.AbstractMapAttachedComponent.call(this,htmlElt,toolbarComponent,map,win);};IONIC.misc.extendType(IONIC.api.ui.navigation.NavBar,IONIC.ui.AbstractToolbar);IONIC.misc.augmentType(IONIC.api.ui.navigation.NavBar,IONIC.ui.AbstractMapAttachedComponent);IONIC.api.ui.navigation.NavBar.prototype.onMapAvailable=function(map){IONIC.misc.forEach(function(button){button.onMapAvailable(map);},this.getButtons()||[]);this.attachToMap(map);};IONIC.api.ui.navigation.NavBar.prototype.onB4MapUnavailable=function(map){IONIC.misc.forEach(function(button){button.onB4MapAvailable(map);},this.getButtons()||[]);this.detachFromMap(map);};IONIC.api.ui.navigation.NavBar.prototype.onMapUnavailable=function(){IONIC.misc.forEach(function(button){button.onMapUnavailable();},this.getButtons()||[]);};IONIC.api.ui.navigation.NavBar.prototype.attachToMap=function(map){var curEvent,i,n;for(i=0,n=IONIC.api.maps.Map.customEventsNames.length;i10){dist=Math.round(d);}else{dist=Math.round(d*1e2)/1e2;} return dist;}; IONIC.api.ui.navigation.ZoomButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.ZoomButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.ZoomButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.ZoomButton.ATTRIBUTES={type:"push",label:"Zoom In",value:"zoom",mapAction:"zoom",groupName:"main"}; IONIC.api.ui.navigation.InteractiveZoomButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.InteractiveZoomButton.ATTRIBUTES);this.checkAvailability();};IONIC.misc.extendType(IONIC.api.ui.navigation.InteractiveZoomButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.InteractiveZoomButton.ATTRIBUTES={type:"push",label:"Interactively zoom in or out",value:"interactivezoom",mapAction:"interactivezoom",groupName:"main",mapEvents:["onLayerAdded","onB4LayerRemove"]};IONIC.api.ui.navigation.InteractiveZoomButton.prototype.handleMapEvent=function(type,args){if(type==="onLayerAdded"||type==="onB4LayerRemove"){this.checkAvailability();}else{throw"Illegal state: IONIC.api.ui.navigation.InteractiveZoomButton.prototype.handleMapEvent() called with an unsupported event: "+type;}};IONIC.api.ui.navigation.InteractiveZoomButton.prototype.checkAvailability=function(type,args){var map=this.getMap();if(map&&map.supportsPreviewing()){this.enable();}else{this.disable();}};IONIC.api.ui.navigation.InteractiveZoomButton.INTERACTIVE_ZOOM_CODE=function(processor,eventType,mouseDown,mouseCurrent,buttons,lastResult){var vmpa=IONIC.api.maps.ViewMouseProcessor.Action;var map=processor.getMap();var center=map.getBox().getCenter();var dy=mouseCurrent.pixel[1]-mouseDown.pixel[1];if(dy===0){return;} var zoomout=dy<0;var zoomFactor=(Math.abs(dy)/30);var ratio=1+zoomFactor;var currentBox=map.getBox().expanded(zoomout?ratio:(1/ratio));var downInPixelOnCurrent=IONIC.maps.NavHelper.srsPointToPixel(mouseDown.point,map);var downInPixelOnNew=IONIC.maps.NavHelper._srsPointsToPixels([mouseDown.point],0,1,map.getDimensions(),currentBox);var shiftx=(downInPixelOnNew[0]-downInPixelOnCurrent[0])*currentBox.diffX()/map.getWidth();var shifty=-(downInPixelOnNew[1]-downInPixelOnCurrent[1])*currentBox.diffY()/map.getHeight();currentBox.centerAround(new IONIC.api.geom.Point(center.x+shiftx,center.y+shifty,currentBox.epsgId));switch(eventType){case vmpa.EVENT_MOUSE_UP:map.setBox(currentBox);break;case vmpa.EVENT_MOUSE_DRAG:map.setIntermediateBox(currentBox,mouseDown.point);break;}};IONIC.api.maps.ViewMouseProcessor.prototype.postIniters.push(function(vmp){vmp.registerAction("interactivezoom",["mousedrag","mouseup"],IONIC.api.ui.navigation.InteractiveZoomButton.INTERACTIVE_ZOOM_CODE);}); IONIC.api.ui.navigation.ZoomoutButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.ZoomoutButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.ZoomoutButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.ZoomoutButton.ATTRIBUTES={type:"push",label:"Zoom Out",value:"zoomout",mapAction:"zoomout",groupName:"main"}; IONIC.api.ui.navigation.PanButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.PanButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.PanButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.PanButton.ATTRIBUTES={type:"push",label:"Pan",value:"pan",mapAction:"pan",groupName:"main"}; IONIC.api.ui.navigation.SetExtentButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.SetExtentButton.ATTRIBUTES);this.box=new IONIC.api.geom.Box(-180,-90,180,90,4326);};IONIC.misc.extendType(IONIC.api.ui.navigation.SetExtentButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.SetExtentButton.prototype.setBox=function(box){this.box=box;};IONIC.api.ui.navigation.SetExtentButton.ATTRIBUTES={type:"push",label:"Reset the map extent",value:"setextent",groupName:"main",onclick:function(toolbar){this.getMap().setBox(this.box);}}; IONIC.api.ui.navigation.HistoryBackButton=function(navigationBar){IONIC.ui.navigation.AbstractHistoryButton.call(this,navigationBar,IONIC.api.ui.navigation.HistoryBackButton.ATTRIBUTES,2);};IONIC.misc.extendType(IONIC.api.ui.navigation.HistoryBackButton,IONIC.ui.navigation.AbstractHistoryButton);IONIC.api.ui.navigation.HistoryBackButton.ATTRIBUTES={type:"push",label:"History back",value:"history-back",groupName:"navigation-history",onclick:function(navigationBar){var map=this.getMap(navigationBar);if(map){map.getHistory().back();}}}; IONIC.api.ui.navigation.HistoryForwardButton=function(navigationBar){IONIC.ui.navigation.AbstractHistoryButton.call(this,navigationBar,IONIC.api.ui.navigation.HistoryForwardButton.ATTRIBUTES,3);};IONIC.misc.extendType(IONIC.api.ui.navigation.HistoryForwardButton,IONIC.ui.navigation.AbstractHistoryButton);IONIC.api.ui.navigation.HistoryForwardButton.ATTRIBUTES={type:"push",label:"History forward",value:"history-forward",groupName:"navigation-history",onclick:function(navigationBar){var map=this.getMap(navigationBar);if(map){map.getHistory().forward();}}}; IONIC.api.ui.navigation.SelectBoxButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.SelectBoxButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.SelectBoxButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.SelectBoxButton.ATTRIBUTES={type:"push",label:"Select box",value:"selectbox",mapAction:"selectbox",groupName:"main"}; IONIC.api.ui.navigation.GetFeatureInfoButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.GetFeatureInfoButton.ATTRIBUTES);this._pixelBoxSize=IONIC.api.ui.navigation.GetFeatureInfoButton._DEFAULT_GFI_WFS_PIXELBOXSIZE;};IONIC.misc.extendType(IONIC.api.ui.navigation.GetFeatureInfoButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.GetFeatureInfoButton.prototype.onMapAvailable=function(map){var vmp=map.getViewMouseProcessor();vmp.getAction("gfi").setNavigationBarItem(this);};IONIC.api.ui.navigation.GetFeatureInfoButton.ATTRIBUTES={type:"push",label:"Get Feature Info",value:"featureinfo",mapAction:"gfi",groupName:"main"};IONIC.api.ui.navigation.GetFeatureInfoButton._DEFAULT_GFI_WFS_PIXELBOXSIZE=10;IONIC.api.ui.navigation.GetFeatureInfoButton.prototype.setPixelBoxSize=function(size){this._pixelBoxSize=size;};IONIC.api.ui.navigation.GetFeatureInfoButton.prototype.getPixelBoxSize=function(){return this._pixelBoxSize;}; IONIC.api.ui.navigation.MeasureButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.MeasureButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.MeasureButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.MeasureButton.ATTRIBUTES={type:"push",label:"Measure Tool",value:"measure",mapAction:"measuredistance",groupName:"main"};IONIC.api.ui.navigation.MeasureButton.prototype.buildOverlayContents=function(navigationBar){var dh=navigationBar.getDomHelper();var overlay=dh.elt("div",dh.elt("span.computed"),dh.elt("span.estimated"));return overlay;};IONIC.api.ui.navigation.MeasureButton.prototype.onSelected=function(){this.restartMeasure();var act=this.getToolbar().getMap().getViewMouseProcessor().getAction("measuredistance");act.setMeasureButton(this);};IONIC.api.ui.navigation.MeasureButton.prototype.trackMouse=function(steps,pixel){};IONIC.api.ui.navigation.MeasureButton.prototype.restartMeasure=function(){this.getComputedComponent().innerHTML="No distance computed yet";this.getEstimatedComponent().innerHTML="";this.clearSteps();};IONIC.api.ui.navigation.MeasureButton.prototype.getComputedComponent=function(){return this.getAssociatedOverlayElement().getElementsByTagName("span")[0];};IONIC.api.ui.navigation.MeasureButton.prototype.getEstimatedComponent=function(){return this.getAssociatedOverlayElement().getElementsByTagName("span")[1];};IONIC.api.ui.navigation.MeasureButton.Step=function(point,pixel){this.point=point;this.pixel=pixel;};IONIC.api.ui.navigation.MeasureButton.prototype.formatDistance=function(distance,unit){if(distance>10){distance=Math.round(distance);}else{distance=Math.round(distance*1e2)/1e2;} return distance;};IONIC.api.ui.navigation.MeasureButton.prototype.computePath=function(steps){this.getComputedComponent().innerHTML="Computing distance...";this.getEstimatedComponent().innerHTML="";this.setSteps(steps);var self=this;IONIC.geom.MeasureTool.withComputedDistance(this.getToolbar().getMap().getSrsBox().epsgId,this.getStepsPoints(),function(success,result){self.getComputedComponent().innerHTML=self.formatDistance(result.distance)+" "+ result.unit;self.getEstimatedComponent().innerHTML="";});};IONIC.api.ui.navigation.MeasureButton.prototype.setSteps=function(steps){this._steps=steps;this.getToolbar().getMap().getMeasureLayerDescriptor().drawLinearMeasure(this.getStepsPoints());};IONIC.api.ui.navigation.MeasureButton.prototype.clearSteps=function(){this.setSteps([]);};IONIC.api.ui.navigation.MeasureButton.prototype.getSteps=function(){return this._steps||[];};IONIC.api.ui.navigation.MeasureButton.prototype.addStep=function(step){var steps=this.getSteps();steps.push(step);this.setSteps(steps);};IONIC.api.ui.navigation.MeasureButton.prototype.getStepsPoints=function(){return IONIC.misc.mapcar1(function(step){return step.point;},this.getSteps());};IONIC.api.maps.ViewMouseProcessor.prototype.postIniters.push(function(vmp){var view=vmp.getView();var onEscStopMeasure=function(e){var act,ld;if(e.keyCode==27){act=vmp.getAction("measuredistance");act.noFollowMouse=true;view.getMeasureLayerDescriptor().clearCanvas();}};var act=vmp.registerAction("measuredistance",["mouseup","mousemove"],function(vmp,event,downAt,upAt,buttons){var ld=view.getMeasureLayerDescriptor();var steps,pStep,lStep,step,from,to;var measureButton=act.getMeasureButton();if(event===IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_UP){steps=measureButton.getSteps();pStep=steps.length?steps[steps.length-1]:null;step=new IONIC.api.ui.navigation.MeasureButton.Step(upAt.point,upAt.pixel);if(pStep){step.srsDist=Math.sqrt(IONIC.api.geom.Point.ed2(upAt.point,new IONIC.api.geom.Point(pStep.point.x,pStep.point.y)));step.srsTotalDist=pStep.srsTotalDist+step.srsDist;} measureButton.addStep(step);steps=measureButton.getSteps();measureButton.computePath(steps);}else if(event===IONIC.api.maps.ViewMouseProcessor.Action.EVENT_MOUSE_MOVE){if(act.noFollowMouse){return;} steps=measureButton.getSteps();lStep=steps.length?steps[steps.length-1]:null;if(!lStep){return;} from=[lStep.pixel[0],lStep.pixel[1]];to=upAt.pixel;IONIC.misc.getDefaultLogger().warn("NEED TO TRACK THE MOUSE!");}},function(previous){var ld=view.getMeasureLayerDescriptor();ld.setUserVisibility(true);ld.clearCanvas();act.noFollowMouse=false;var doc=view.getOwnerDocument();YAHOO.util.Event.addListener(doc,"keypress",onEscStopMeasure);},function(){var ld=view.getMeasureLayerDescriptor();ld.setUserVisibility(false);var doc=view.getOwnerDocument();YAHOO.util.Event.removeListener(doc,"keypress",onEscStopMeasure);});act.getMeasureButton=function(){return this._mbut;};act.setMeasureButton=function(but){this._mbut=but;};}); IONIC.api.ui.navigation.LoadSaveDataButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.LoadSaveDataButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.LoadSaveDataButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.LoadSaveDataButton.ATTRIBUTES={type:"push",label:"Load/Save data",value:"loadsavedata",groupName:"context"};IONIC.api.ui.navigation.LoadSaveDataButton.prototype.buildOverlayContents=function(navigationBar){var thisRef=this;var dh=navigationBar.getDomHelper();var tabView=new YAHOO.widget.TabView();var loadElt=this.createLoadTabElt(navigationBar);tabView.addTab(new YAHOO.widget.Tab({label:"Load",contentEl:loadElt}));var saveElt=this.createSaveTabElt(navigationBar);tabView.addTab(new YAHOO.widget.Tab({label:"Save",contentEl:saveElt,active:true}));var cancelButton=dh.elt("input.cancelButton");cancelButton.type="button";cancelButton.value="Cancel";cancelButton.onclick=function(){thisRef.getToolbar().doDeselectButton(thisRef);return false;};var elt=dh.elt("div.yui-toolbar-loadsavedata yui-skin-sam");tabView.appendTo(elt);dh.append(elt,dh.elt("div.popup-actions",cancelButton));return elt;};IONIC.api.ui.navigation.LoadSaveDataButton.prototype.createLoadTabElt=function(navigationBar){var dh=navigationBar.getDomHelper();var thisRef=this;var elt=dh.elt("div.loadTabContent");var userDataPanel=new IONIC.api.ui.UserDataPanel(elt);userDataPanel.addPage(IONIC.api.ui.UserDataPanel.PAGE_SHAPE_FILE);userDataPanel.addPage(IONIC.api.ui.UserDataPanel.PAGE_GML_FILE);userDataPanel.onWFSCreated.subscribe(function(type,args){if(!thisRef.getMap()){return;} var serviceInfo=args[0];var providerDiscovery=new IONIC.api.maps.ProviderDiscoveryTool(thisRef.getMap());providerDiscovery.withAddedLayers(serviceInfo.getUrl(),"WFS",undefined,function(lds){alert(lds.length+" layers have been loaded.");});navigationBar.doDeselectButton(thisRef);});return elt;};IONIC.api.ui.navigation.LoadSaveDataButton.prototype.createSaveTabElt=function(navigationBar){var dh=navigationBar.getDomHelper();var thisRef=this;var elt=dh.elt("div");var panel=new IONIC.api.ui.SaveDataPanel(elt,navigationBar.getMap(),dh.getDocument());panel.onSaved.subscribe(function(type,args){navigationBar.doDeselectButton(thisRef);});return elt;}; IONIC.api.ui.navigation.LoadContextButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.LoadContextButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.LoadContextButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.LoadContextButton.ATTRIBUTES={type:"push",label:"Load Context",value:"loadcontext",groupName:"context"};IONIC.api.ui.navigation.LoadContextButton.prototype.buildOverlayContents=function(navigationBar){var dh=navigationBar.getDomHelper();var self=this;var menu=dh.elt("div.yui-toolbar-loadcontext loadcontextcontent yui-skin-sam");var tabView=new YAHOO.widget.TabView();var fileInputElt=dh.elt("input");fileInputElt.type="file";fileInputElt.name="contextFile";var fileInputButtonElt=dh.elt("input");fileInputButtonElt.type="submit";fileInputButtonElt.value="Load";var fileTabFormElt=dh.elt("form",fileInputElt,fileInputButtonElt);fileTabFormElt.onsubmit=function(){IONIC.maps.ContextSerializationTool.withDeserialized(fileTabFormElt,null,null,self.getMap());navigationBar.doDeselectButton(self);return false;};tabView.addTab(new YAHOO.widget.Tab({label:"From file",contentEl:fileTabFormElt,active:true}));var urlInputElt=dh.elt("input");urlInputElt.type="text";urlInputElt.name="contextUrl";var urlInputButtonElt=dh.elt("input");urlInputButtonElt.type="submit";urlInputButtonElt.value="Load";var urlTabFormElt=dh.elt("form",urlInputElt,urlInputButtonElt);urlTabFormElt.enctype="multipart/form-data";urlTabFormElt.method="POST";urlTabFormElt.onsubmit=function(){self.getMap().loadWMCFromUrl(urlInputElt.value);navigationBar.doDeselectButton(self);return false;};tabView.addTab(new YAHOO.widget.Tab({label:"From URL",contentEl:urlTabFormElt}));tabView.appendTo(menu);var cancelButton=dh.elt("input");cancelButton.type="button";cancelButton.value="Cancel";cancelButton.onclick=function(){self.getToolbar().doDeselectButton(self);return false;};var cancelButtonElt=dh.elt("p",cancelButton);cancelButtonElt.style.textAlign="right";dh.append(menu,dh.elt("p",cancelButtonElt));return menu;}; IONIC.api.ui.navigation.SaveContextButton=function(navigationBar){IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.SaveContextButton.ATTRIBUTES);this.saveCredentials=false;};IONIC.misc.extendType(IONIC.api.ui.navigation.SaveContextButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.SaveContextButton.prototype.setSaveCredentials=function(saveCredentials){this.saveCredentials=saveCredentials;};IONIC.api.ui.navigation.SaveContextButton.prototype.buildOverlayContents=function(navigationBar){var thisRef=this;var dh=navigationBar.getDomHelper();var saveCheckbox=dh.elt("input");this.saveCheckbox=saveCheckbox;saveCheckbox.type="checkbox";saveCheckbox.onchange=function(){if(saveCheckbox.checked){plainCheckbox.disabled=false;YAHOO.util.Dom.removeClass(plainElt,"disabled");}else{plainCheckbox.disabled=true;YAHOO.util.Dom.addClass(plainElt,"disabled");}} var plainCheckbox=dh.elt("input");this.plainCheckbox=plainCheckbox;plainCheckbox.type="checkbox";var plainElt=dh.elt("div",plainCheckbox,dh.txt("Password in plain text"));var saveButton=dh.elt("input");saveButton.type="submit";saveButton.value="Save";var cancelButton=dh.elt("input");cancelButton.type="button";cancelButton.value="Cancel";cancelButton.onclick=function(){thisRef.getToolbar().doDeselectButton(thisRef);return false;};var overlayForm=dh.elt("form",dh.elt("div",saveCheckbox,dh.txt("Include passwords")),plainElt,dh.elt("p",cancelButton,saveButton));overlayForm.action="#";overlayForm.onsubmit=function(){try{thisRef.saveContext();thisRef.getToolbar().doDeselectButton(thisRef);}catch(e){} return false;} YAHOO.util.Dom.addClass(overlayForm,"toolbar-savecontext");saveCheckbox.onchange();return overlayForm;};IONIC.api.ui.navigation.SaveContextButton.ATTRIBUTES={type:"push",label:"Save Context",value:"savecontext",groupName:"context",onclick:function(navigationBar){var map=this.getMap(navigationBar);if(map&&map.getBox()&&(typeof this.saveCredentials==="boolean")){this.saveContext();this.getAssociatedOverlay().hide();}}};IONIC.api.ui.navigation.SaveContextButton.prototype.saveContext=function(){var map=this.getToolbar().getMap();var saveCredentials=null;if(typeof this.saveCredentials!=="boolean"){if(this.saveCheckbox.checked){if(this.plainCheckbox.checked){saveCredentials="plain";}else{saveCredentials="basic";}}}else{saveCredentials=this.saveCredentials?"basic":null;} if(map){IONIC.maps.ContextSerializationTool.serialize(map,saveCredentials);}}; IONIC.api.ui.navigation.FindFeaturesButton=function(navigationBar,allowEdition){this._allowEdition=!!allowEdition;IONIC.ui.navigation.AbstractNavBarButton.call(this,navigationBar,IONIC.api.ui.navigation.FindFeaturesButton.ATTRIBUTES);};IONIC.misc.extendType(IONIC.api.ui.navigation.FindFeaturesButton,IONIC.ui.navigation.AbstractNavBarButton);IONIC.api.ui.navigation.FindFeaturesButton.ATTRIBUTES={type:"push",label:"Find features",value:"findfeatures",groupName:"main"};IONIC.api.ui.navigation.FindFeaturesButton.prototype.buildOverlayContents=function(navigationBar){var dh=navigationBar.getDomHelper();var editAction,self=this;var overlay=dh.elt("div.find-features");var barAndTable=dh.elt("div");this._barContents=dh.elt("div.FeatureFinderBar");this._tableContents=dh.elt("div.FeatureFinderTable");this._featureTable=new IONIC.api.ui.FeatureTable(this._tableContents,dh.getDocument());this._featureTable.setNoFeatureMessage("No feature found");this._editionPanelContents=dh.elt("div.EditionPanel");if(this._allowEdition){editAction=new IONIC.api.ui.featuretableactions.Edit(this._featureTable,this._editionPanelContents,dh.getDocument());editAction.onEditionInitializing.subscribe(function(type,args){self._editionPanelContents.style.display="block";barAndTable.style.display="none";});editAction.onEditionFinished.subscribe(function(type,args){self._editionPanelContents.style.display="none";barAndTable.style.display="block";});} var cancelBut=dh.elt("input");cancelBut.type="button";cancelBut.value="Close";cancelBut.onclick=function(){self.getToolbar().doDeselectButton(self);};var actionsContents=dh.elt("div.popup-actions",dh.elt("p",cancelBut));dh.append(barAndTable,this._barContents,this._tableContents);dh.append(overlay,barAndTable,this._editionPanelContents,actionsContents);return overlay;};IONIC.api.ui.navigation.FindFeaturesButton.prototype.getFeatureTable=function(){return this._featureTable;};IONIC.api.ui.navigation.FindFeaturesButton.prototype.onMapAvailable=function(map){this.getFeatureTable().attachMap(map);this._ffBar=new IONIC.api.ui.FeatureFinderBar(this.getBarContents(),map,this.getFeatureTable());this._ffBar.addItems(IONIC.api.ui.FeatureFinderBar.ALL_ITEMS);};IONIC.api.ui.navigation.FindFeaturesButton.prototype.getFeatureFinderBar=function(){return this._ffBar;};IONIC.api.ui.navigation.FindFeaturesButton.prototype.onB4MapUnavailable=function(map){this.getFeatureTable().attachMap(null);this.getFeatureTable().clear();var dh;if(this._ffBar){dh=this.getToolbar().getDomHelper();dh.clr(this.getBarContents());} this._ffBar=null;};IONIC.api.ui.navigation.FindFeaturesButton.prototype.getBarContents=function(){return this._barContents;};IONIC.api.ui.navigation.FindFeaturesButton.prototype.getTableContents=function(){return this._tableContents;}; IONIC.defns("api.ui.navigation");IONIC.api.ui.navigation.NavInfo=function(htmlElt,map,win){win=win||window;var dh=IONIC.api.ui.DomHelper.newInstance(win.document);var toolbarHolder=dh.elt("div.NavInfo");this._fields=[];IONIC.ui.AbstractMapAttachedComponent.call(this,htmlElt,toolbarHolder,map,win);};IONIC.misc.augmentType(IONIC.api.ui.navigation.NavInfo,IONIC.ui.AbstractMapAttachedComponent);IONIC.api.ui.navigation.NavInfo.prototype.onMapAvailable=function(map){IONIC.misc.forEach(function(field){field.onMapAvailable(map);},this.getFields()||[]);};IONIC.api.ui.navigation.NavInfo.prototype.onB4MapUnavailable=function(map){IONIC.misc.forEach(function(field){field.onB4MapUnavailable(map);},this.getFields()||[]);};IONIC.api.ui.navigation.NavInfo.prototype.onMapUnavailable=function(){IONIC.misc.forEach(function(field){field.onMapUnavailable();},this.getFields()||[]);};IONIC.api.ui.navigation.NavInfo.prototype.getFields=function(field){return this._fields;};IONIC.api.ui.navigation.NavInfo.prototype.addField=function(field){var dh=this.getDomHelper();dh.append(this.getAvailableComponent(),field.getComponent());this._fields.push(field);};IONIC.api.ui.navigation.NavInfo.getDefaultFields=function(){return[IONIC.api.ui.navigation.XCoordField,IONIC.api.ui.navigation.YCoordField,IONIC.api.ui.navigation.ScaleField];};IONIC.api.ui.navigation.NavInfo.prototype.createDefaultFields=function(){var self=this;IONIC.misc.forEach(function(field){self.addField(new field(self));},IONIC.api.ui.navigation.NavInfo.getDefaultFields())}; IONIC.api.ui.navigation.XCoordField=function(navigationInfo){IONIC.ui.navigation.AbstractCoordField.call(this,navigationInfo);};IONIC.misc.extendType(IONIC.api.ui.navigation.XCoordField,IONIC.ui.navigation.AbstractCoordField);IONIC.api.ui.navigation.XCoordField.prototype.onMapAvailable=function(map){var self=this;IONIC.ui.navigation.AbstractCoordField.prototype.onMapAvailable.call(this,map,function(event){var lonlat;var map=self.getMap();if(map.getSrsBox()){lonlat=IONIC.maps.NavHelper.pixelToSRSPoint(map.getViewMouseProcessor().relativePosition(event),map);self.setCoordValue(lonlat.x);}});};IONIC.api.ui.navigation.XCoordField.prototype.getLabelText=function(){return"X";};IONIC.api.ui.navigation.XCoordField.prototype.modifyBox=function(box,arg){var center=box.getCenter();box=box.expanded(1.0);center.x=arg;box.centerAround(center,1.0);return box;}; IONIC.api.ui.navigation.YCoordField=function(navigationInfo){IONIC.ui.navigation.AbstractCoordField.call(this,navigationInfo);};IONIC.misc.extendType(IONIC.api.ui.navigation.YCoordField,IONIC.ui.navigation.AbstractCoordField);IONIC.api.ui.navigation.YCoordField.prototype.onMapAvailable=function(map){var self=this;IONIC.ui.navigation.AbstractCoordField.prototype.onMapAvailable.call(this,map,function(event){var lonlat;var map=self.getMap();if(map.getSrsBox()){lonlat=IONIC.maps.NavHelper.pixelToSRSPoint(map.getViewMouseProcessor().relativePosition(event),map);self.setCoordValue(lonlat.y);}});};IONIC.api.ui.navigation.YCoordField.prototype.getLabelText=function(){return"Y";};IONIC.api.ui.navigation.YCoordField.prototype.modifyBox=function(box,arg){var center=box.getCenter();box=box.expanded(1.0);center.y=arg;box.centerAround(center,1.0);return box;}; IONIC.api.ui.navigation.ScaleField=function(navigationInfo){IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField.call(this,navigationInfo);this.setInputSize(13);};IONIC.misc.extendType(IONIC.api.ui.navigation.ScaleField,IONIC.ui.navigation.AbstractBoxModifyingNavInfoInputField);IONIC.api.ui.navigation.ScaleField.ON_COMPUTING_HANDLER=function(type,args){this.setEnabled(false);};IONIC.api.ui.navigation.ScaleField.ON_COMPUTED_HANDLER=function(type,args){this.setValue(Math.round(args[0]));this.setEnabled(true);};IONIC.api.ui.navigation.ScaleField.prototype.onMapAvailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onMapAvailable.call(this,map);map.onScaleComputing.subscribe(IONIC.api.ui.navigation.ScaleField.ON_COMPUTING_HANDLER,this,true);map.onScaleComputed.subscribe(IONIC.api.ui.navigation.ScaleField.ON_COMPUTED_HANDLER,this,true);var scale=map.getComputedScale();if(scale>0){this.setValue(map.getComputedScale());}};IONIC.api.ui.navigation.ScaleField.prototype.onB4MapUnavailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onB4MapUnavailable.call(this,map);map.onScaleComputing.unsubscribe(IONIC.api.ui.navigation.ScaleField.ON_COMPUTING_HANDLER,this);map.onScaleComputed.unsubscribe(IONIC.api.ui.navigation.ScaleField.ON_COMPUTED_HANDLER,this);};IONIC.api.ui.navigation.ScaleField.prototype.getLabelText=function(){return"Scale";};IONIC.api.ui.navigation.ScaleField.prototype.modifyBox=function(box,arg){var curScale=this.getMap().getComputedScale();var factor=arg/curScale;return box.expanded(factor);}; IONIC.api.ui.navigation.SRSSelector=function(navigationInfo){IONIC.ui.navigation.AbstractNavInfoField.call(this,navigationInfo);this._customSRS=true;};IONIC.misc.extendType(IONIC.api.ui.navigation.SRSSelector,IONIC.ui.navigation.AbstractNavInfoField);IONIC.api.ui.navigation.SRSSelector.prototype.makeComponent=function(){var dh=this.getNavigationInfo().getDomHelper();var select=dh.elt("select");var self=this;select.onchange=function(){var map=self.getMap();if(!map){return;} var o=select.options;var cs=o[o.selectedIndex];var epsgId=+cs.value;if(epsgId===IONIC.api.ui.navigation.SRSSelector.CUSTOM_SRS_MARKER){epsgId=(+(prompt("Please, enter an EPSG ID","")));} if(!isNaN(epsgId)&&epsgId!==0){map.switchSrs(epsgId,function(success){if(success){self.refreshSRSList();}},true);}else{self.refreshSRSList();}};var wrapper=dh.elt("span.select-field-wrapper",select);return wrapper;};IONIC.api.ui.navigation.SRSSelector.prototype.setSRSList=function(srses){srses=srses||[];var o;var dh=this.getNavigationInfo().getDomHelper();var s=this.getComponentSelector();dh.clr(s);IONIC.misc.forEach(function(epsgId){dh.mkOpt(s,epsgId);},srses);if(this.customSRSAllowed()){o=dh.mkOpt(s,"Choose SRS");o.value=IONIC.api.ui.navigation.SRSSelector.CUSTOM_SRS_MARKER;}};IONIC.api.ui.navigation.SRSSelector.prototype.getComponentSelector=function(){var c=this.getComponent();return c.getElementsByTagName("select")[0];};IONIC.api.ui.navigation.SRSSelector.prototype.onMapAvailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onMapAvailable.call(this,map);this.refreshSRSList();map.onSrsBoxChanged.subscribe(this.refreshSRSList,this,true);map.onLayerAdded.subscribe(this.refreshSRSList,this,true);};IONIC.api.ui.navigation.SRSSelector.prototype.onB4MapUnavailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onMapUnavailable.call(this,map);map.onSrsBoxChanged.unsubscribe(this.refreshSRSList,this);map.onLayerAdded.unsubscribe(this.refreshSRSList,this);this.setSRSList(null);};IONIC.api.ui.navigation.SRSSelector.prototype.refreshSRSList=function(){var map=this.getMap();if(!map){return;} var srsList=[];srsList.push(map.getSrs());srsList.push.apply(srsList,this.getAdditionalSRSes());srsList.push.apply(srsList,map.getAvailableSrses());srsList=IONIC.misc.removeDuplicates(srsList);this.setSRSList(srsList);};IONIC.api.ui.navigation.SRSSelector.prototype.getAdditionalSRSes=function(){return this._addSRSes||[];};IONIC.api.ui.navigation.SRSSelector.prototype.setAdditionalSRSes=function(srses){this._addSRSes=srses;this.refreshSRSList();};IONIC.api.ui.navigation.SRSSelector.CUSTOM_SRS_MARKER=-1205;IONIC.api.ui.navigation.SRSSelector.prototype.enableCustomSRS=function(){this.setCustomSRSAbility(true);};IONIC.api.ui.navigation.SRSSelector.prototype.disableCustomSRS=function(){this.setCustomSRSAbility(false);};IONIC.api.ui.navigation.SRSSelector.prototype.customSRSAllowed=function(){return!!this._customSRS;};IONIC.api.ui.navigation.SRSSelector.prototype.setCustomSRSAbility=function(flag){this._customSRS=!!flag;this.refreshSRSList();}; IONIC.api.ui.navigation.MapDimensions=function(navigationInfo){this.allowCustomDimension=true;this.predefinedDimensions=[];IONIC.ui.navigation.AbstractNavInfoField.call(this,navigationInfo);};IONIC.misc.extendType(IONIC.api.ui.navigation.MapDimensions,IONIC.ui.navigation.AbstractNavInfoField);IONIC.api.ui.navigation.MapDimensions.prototype.makeComponent=function(){var dh=this.getNavigationInfo().getDomHelper();var select=dh.elt("select");var self=this;select.onchange=function(){var map=self.getMap();if(!map){return;} var o=select.options;var cs=o[o.selectedIndex];var w=cs.mapWidth;var h=cs.mapHeight;if(!w||!h){w=(+(prompt("Width",map.getWidth())));h=(+(prompt("Height",map.getHeight())));} if(w&&!isNaN(w)&&h&&!isNaN(h)){map.setDimensions(w,h);} self.refreshDimensionsList();};var wrapper=dh.elt("span.select-field-wrapper",select);return wrapper;};IONIC.api.ui.navigation.MapDimensions.prototype.setPredefinedDimensions=function(list){this.predefinedDimensions=(list||[]).slice();this.refreshDimensionsList();};IONIC.api.ui.navigation.MapDimensions.prototype.getPredefinedDimensions=function(){return this.predefinedDimensions;};IONIC.api.ui.navigation.MapDimensions.prototype.refreshDimensionsList=function(){var map=this.getMap();if(!map){return;} var dh=this.getNavigationInfo().getDomHelper();var stor=this.getComponentSelector();dh.clr(stor);IONIC.misc.forEach(function(dim){var w=dim.width,h=dim.height;var o=dh.mkOpt(stor,w+"x"+h);o.width=w;o.height=h;},[{width:map.getWidth(),height:map.getHeight()}].concat(this.predefinedDimensions));var o;if(this.customDimensionsAllowed()){o=dh.mkOpt(stor,"Custom");}};IONIC.api.ui.navigation.MapDimensions.prototype.getComponentSelector=function(){var c=this.getComponent();return c.getElementsByTagName("select")[0];};IONIC.api.ui.navigation.MapDimensions.prototype.onMapAvailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onMapAvailable.call(this,map);this.refreshDimensionsList();map.onResized.subscribe(this.refreshDimensionsList,this,true);};IONIC.api.ui.navigation.MapDimensions.prototype.onB4MapUnavailable=function(map){IONIC.ui.navigation.AbstractNavInfoField.prototype.onMapUnavailable.call(this,map);map.onResized.unsubscribe(this.refreshDimensionsList,this);this.refreshDimensionsList();};IONIC.api.ui.navigation.MapDimensions.prototype.enableCustomDimensions=function(){this.setCustomDimensionsAbility(true);};IONIC.api.ui.navigation.MapDimensions.prototype.disableCustomDimensions=function(){this.setCustomDimensionsAbility(false);};IONIC.api.ui.navigation.MapDimensions.prototype.customDimensionsAllowed=function(){return!!this.allowCustomDimension;};IONIC.api.ui.navigation.MapDimensions.prototype.setCustomDimensionsAbility=function(flag){this.allowCustomDimension=!!flag;this.refreshDimensionsList();}; IONIC.api.feature.FeatureUtils=function(serverUrl,featureName,featureNamespace){if(arguments.length===1){var ssld=serverUrl;featureName=ssld.getName();featureNamespace=ssld.getNamespace();serverUrl=ssld.getParentLayerDescriptor().getServiceUrl()} this._fet=new IONIC.feature.FeatureEditionTool(serverUrl,featureName,featureNamespace);};IONIC.api.feature.FeatureUtils.prototype.getFeatureEditionTool=function(){return this._fet;};IONIC.api.feature.FeatureUtils.withFeaturesFromMap=function(map,callback,maxNbFeatures,layerPredicate,filter,filterId,epsgId){layerPredicate=layerPredicate||function(ssld){return true;};maxNbFeatures=maxNbFeatures||-1;var sslds=[];map.forEachMapLayer(function(ld){ld.forEachServerSideLayer(function(ssld,id){if(ssld.getParentLayerDescriptor().getServiceType()==="WFS"&&layerPredicate(ssld)){sslds.push(ssld);}})});var fetchInfos=IONIC.misc.mapcar1(function(wfsSSLayer){return new IONIC.feature.FeatureTypeInfoPool.FetchInfo(wfsSSLayer.getParentLayerDescriptor().getServiceUrl(),wfsSSLayer.getName(),wfsSSLayer.getNamespace());},sslds);IONIC.feature.FeatureTypeInfoPool.withMultipleSparseFeatureTypeInfo(fetchInfos,function(ftis){var featuresAndLayerInfo=[],i,n;if(sslds.length===0){callback(featuresAndLayerInfo);}else{for(i=0,n=sslds.length;i"+resultName+"
"+ (resultDesignation?(" ("+resultDesignation+")"):"")+"";var popup=this.map.___ownerDocument.createElement('div');popup.innerHTML=innerHTML;var me=IONIC.api.maps.PopupMapElement.newInstance(this.map.getMELayerDescriptor(),resultLocation,elementImg,popup);thisRef._meg.store(me,gensym());if(this.htmlElt){anc.href="#";anc.onmouseover=function(event){me.activate(true);};me.activate(false);anc.onclick=function(event){var view=thisRef.map;var srsBox=thisRef.map.getBox().expanded(1.0).centerAround(resultLocation);var dx=srsBox.diffX(),dy=srsBox.diffY();me.activate(false);thisRef.map.setBox(srsBox);me.activate(true);return false;};anc.onmouseout=function(event){me.activate(false);};}} if(this.htmlElt){var tableBodyElement=this.htmlElt.firstChild.firstChild;dh.append(tableBodyElement,dh.elt("tr",dh.elt("td",anc)));}} IONIC.api.feature.BasicGazetteerRenderer.prototype.resultEnd=function(nbResults){if(nbResults===0&&this.htmlElt){var dh=IONIC.api.ui.DomHelper.newInstance(this.htmlElt.ownerDocument);var txt=dh.txt("No result found");dh.append(this.htmlElt,txt);}} IONIC.api.feature.BasicGazetteerRenderer.prototype.reset=function(){if(this.htmlElt){var dh=IONIC.api.ui.DomHelper.newInstance(this.htmlElt.ownerDocument);dh.clr(this.htmlElt);} if(this.map){this._meg.destroyAll();}} IONIC.api.feature.Gazetteer=function(url,featureTypeName,featureTypeNamespace,map,htmlElt,searchPropertyName,searchPropertyNamespace,geometryPropertyName,geometryPropertyNamespace){this.url=url;this.featureTypeName=featureTypeName;this.featureTypeNamespace=featureTypeNamespace;this.map=map;this.htmlElt=htmlElt;IONIC.api.feature.GazetteerTool.call(this,url,featureTypeName,featureTypeNamespace,searchPropertyName,searchPropertyNamespace,geometryPropertyName,geometryPropertyNamespace);this._maxNbResults=-1;this._renderer=new IONIC.api.feature.BasicGazetteerRenderer();this._renderer.init(map,htmlElt);};IONIC.misc.extendType(IONIC.api.feature.Gazetteer,IONIC.api.feature.GazetteerTool);IONIC.api.feature.Gazetteer.prototype.query=function(queryString,callback){this.reset();var thisRef=this;this._renderer.queryStarted(queryString);var nbResults=0;var results=[];if(this.htmlElt){this.displayLoading(this.htmlElt);} this.search(queryString,this.map.getBox(),this.map.getBox().epsgId,this._maxNbResults,function(isSuccess,obj){if(this.htmlElt){this.htmlElt.innerHTML="";} thisRef._renderer.resultBegin(isSuccess);},function(result,parent,pos,cnt,depth){thisRef._renderer.resultIterate(result,nbResults);nbResults++;if(callback){results.push(result);}},function(){thisRef._renderer.resultEnd(nbResults);if(callback){callback(results);}});};IONIC.api.feature.Gazetteer.prototype.displayLoading=function(elt){var dh=new IONIC.api.ui.DomHelper(elt.ownerDocument);var img=dh.elt("img");img.src=IONIC.misc.getWebappBaseUrl()+"/images/gazetteer/loading.gif";dh.append(elt,img,dh.txt("Loading..."));};IONIC.api.feature.Gazetteer.prototype.reset=function(queryString){this._renderer.reset();};IONIC.api.feature.Gazetteer.prototype.setMaximumNbResults=function(maxNb){this._maxNbResults=maxNb;};IONIC.api.feature.Gazetteer.prototype.setRenderer=function(renderer){this._renderer=renderer;}; IONIC.api.feature.TransientWFSTool=function(){IONIC.misc.RequestTool.call(this);};IONIC.misc.extendType(IONIC.api.feature.TransientWFSTool,IONIC.misc.RequestTool);IONIC.api.feature.TransientWFSTool.prototype.withUploadedForm=function(form,callback,win){var dh=IONIC.api.ui.DomHelper.forDocument(win||window);IONIC.misc.ajaxifyForm(dh,form,null,false,function(obj){if(callback){callback(IONIC.api.feature.TransientWFSTool.TransientWFSInfo.fromTransportFormat(obj));}},null);form.submit();};IONIC.api.feature.TransientWFSTool.URL_DATA_PATH_TYPE="url";IONIC.api.feature.TransientWFSTool.WEBAPP_DATA_PATH_TYPE="webapp";IONIC.api.feature.TransientWFSTool.CLASSPATH_DATA_PATH_TYPE="classpath";IONIC.api.feature.TransientWFSTool.prototype.withServiceFromShapefile=function(name,path,pathType,epsgId,shared,callback){this.withServiceFromResource("/uploadShapeFile.do",name,path,pathType,epsgId,shared,callback);};IONIC.api.feature.TransientWFSTool.prototype.withServiceFromGML=function(name,path,pathType,shared,callback){this.withServiceFromResource("/uploadGml.do",name,path,pathType,null,shared,callback);};IONIC.api.feature.TransientWFSTool.prototype.withServiceFromResource=function(actionPath,name,path,pathType,epsgId,shared,callback){var fullUrl=IONIC.misc.getWebappBaseUrl()+actionPath+"?dataPath="+escape(path)+"&serviceName="+escape(name)+"&dataPathType="+escape(pathType)+ (typeof epsgId==="number"?("&srs="+escape(epsgId)):"")+"&shared="+escape(!!shared);this.withUrl(fullUrl,"POST",function(success,obj){if(callback){callback(IONIC.api.feature.TransientWFSTool.TransientWFSInfo.fromTransportFormat(obj));}});};IONIC.api.feature.TransientWFSTool.prototype.serviceInfoAction=function(url,serviceInfo,callback){var tfsi=IONIC.api.feature.TransientWFSTool.TransientWFSInfo.toTransportFormat(serviceInfo);this.withUrl(url,"POST",function(success,obj){var si;if(callback){if(obj){si=IONIC.api.feature.TransientWFSTool.TransientWFSInfo.fromTransportFormat(obj);} callback(si);}},JSON.stringify(tfsi));};IONIC.api.feature.TransientWFSTool.prototype.withChangesApplied=function(serviceInfo,callback){var url=IONIC.misc.getWebappBaseUrl()+"/transientDataServiceManagement.do?actionType="+escape("update");this.serviceInfoAction(url,serviceInfo,callback);};IONIC.api.feature.TransientWFSTool.prototype.withDeletedService=function(serviceInfo,callback){var url=IONIC.misc.getWebappBaseUrl()+"/transientDataServiceManagement.do?actionType="+escape("remove");this.serviceInfoAction(url,serviceInfo,callback);};IONIC.api.feature.TransientWFSTool.prototype.withServices=function(begin,iteration,end){var url=IONIC.misc.getWebappBaseUrl()+"/listTransientDataServices.do";var deserializer=IONIC.api.feature.TransientWFSTool.TransientWFSInfo.fromTransportFormat;this.withUrl(url,"GET",this._wrapIterationCallbacks(begin,function(obj){if(iteration){iteration(deserializer(obj));}},end,null,function(one,other){if(one.serviceOwner!==other.serviceOwner){if(one.serviceOwner){return-1;}else{return 1;}} if(one.nameother.name){return 1;}else{return 0;}},null,"services"));};IONIC.api.feature.TransientWFSTool.TransientWFSInfo=function(url,name,id,owner,shared,created,ownerId){this.url=url;this.name=name;this.id=id;this.owner=owner;this.shared=shared;this.created=created;this.ownerId=ownerId;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.getUrl=function(){return this.url;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.getName=function(){return this.name;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.setName=function(name){this.name=name;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.isShared=function(){return this.shared;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.setShared=function(flag){this.shared=flag;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.getId=function(){return this.id;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.isServiceOwner=function(){return this.owner;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.getCreationDate=function(){return this.created;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.prototype.getOwnerId=function(){return this.ownerId;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.fromTransportFormat=function(rawObj){var cDate=new Date();cDate.setISO8601(rawObj.creationDate);var info=new IONIC.api.feature.TransientWFSTool.TransientWFSInfo(rawObj.url,rawObj.name,rawObj.id,rawObj.serviceOwner,rawObj.isShared,cDate,rawObj.ownerId);return info;};IONIC.api.feature.TransientWFSTool.TransientWFSInfo.toTransportFormat=function(info){var obj={url:info.getUrl(),name:info.getName(),id:info.getId(),serviceOwner:info.isServiceOwner(),isShared:info.isShared(),creationDate:info.getCreationDate().toISO8601String(),ownerId:info.getOwnerId()};return obj;}; IONIC.api.geom.Point=function(x,y,epsgId){this.x=(typeof x==="number"?x:NaN);this.y=(typeof y==="number"?y:NaN);this.epsgId=epsgId;this.env=new IONIC.api.geom.Box(this.x,this.y,this.x,this.y,this.epsgId);};IONIC.api.geom.Point.newInstance=function(x,y,epsgId){return new IONIC.api.geom.Point(x,y,epsgId);};IONIC.api.geom.Point.ed=function(p0,p1){if(p0.epsgId!==p1.epsgId){throw"EpsgIds must match.";} return Math.sqrt(IONIC.api.geom.Point.ed2(p0,p1));};IONIC.api.geom.Point.ed2=function(p0,p1){var dx=p1.x-p0.x;var dy=p1.y-p0.y;return dx*dx+dy*dy;};IONIC.api.geom.Point.prototype.isEnvelopeUpToDate=function(){return true;};IONIC.api.geom.Point.prototype.getEnvelope=function(){this.env.minx=this.env.maxx=this.x;this.env.miny=this.env.maxy=this.y;this.env.epsgId=this.epsgId;return this.env;};IONIC.api.geom.Point.prototype.checkValidity=function(){return(!isNaN(this.x)&&!isNaN(this.y))?true:"At least one point needed";};IONIC.api.geom.Point.prototype.countVertices=function(){return(this.checkValidity()===true?1:0);};IONIC.api.geom.Point.prototype.getStartPointer=(function(){var stpt=[];return function(){return stpt;};})();IONIC.api.geom.Point.prototype.getEndPointer=IONIC.api.geom.Point.prototype.getStartPointer;IONIC.api.geom.Point.prototype.findNearestPointerInfo=function(point){var ptr=this.getStartPointer();return[ptr,IONIC.api.geom.Point.ed2(this,point)];};IONIC.api.geom.Point.prototype.getPointAt=function(ptr){this._chkPtr(ptr);return this;};IONIC.api.geom.Point.prototype.deletePointAt=function(ptr){this._chkPtr(ptr);this.x=this.y=NaN;this.epsgId=undefined;};IONIC.api.geom.Point.prototype.setPointAt=function(ptr,pt){this._chkPtr(ptr);this.x=pt.x;this.y=pt.y;this.epsgId=pt.epsgId;};IONIC.api.geom.Point.prototype.insertPointAt=IONIC.api.geom.Point.prototype.setPointAt;IONIC.api.geom.Point.prototype.equals=function(other){return this.x==other.x&&this.y==other.y&&this.epsgId==other.epsgId;};IONIC.api.geom.Point.prototype.toString=function(){return this.toStringExt();};IONIC.api.geom.Point.prototype.toStringExt=function(separator,noEpsgId){var cpts=[this.x,this.y];if(noEpsgId!==true){cpts.push(this.epsgId);} return cpts.join(separator||", ");};IONIC.api.geom.Point.prototype._chkPtr=function(ptr){if(ptr.length){throw"Unexpected pointer ["+ptr+"] for IONIC.api.geom.Point";}}; IONIC.api.geom.Box=function(minx,miny,maxx,maxy,epsgId){this.minx=Math.min(minx,maxx);this.miny=Math.min(miny,maxy);this.maxx=Math.max(minx,maxx);this.maxy=Math.max(miny,maxy);this.epsgId=epsgId;};IONIC.api.geom.Box.newInstance=function(minx,miny,maxx,maxy,epsgId){return new IONIC.api.geom.Box(minx,miny,maxx,maxy,epsgId);};IONIC.api.geom.Box.prototype.diffX=function(){return this.maxx-this.minx;};IONIC.api.geom.Box.prototype.getEnvelope=function(){return this;};IONIC.api.geom.Box.prototype.diffY=function(){return this.maxy-this.miny;};IONIC.api.geom.Box.prototype.getRatio=function(){return this.diffY()/this.diffX();};IONIC.api.geom.Box.prototype.getCenter=function(){var diffs=this.diffs();return new IONIC.api.geom.Point(this.minx+(diffs[0]/2),this.miny+(diffs[1]/2),this.epsgId);};IONIC.api.geom.Box.prototype.getTopLeft=function(){return new IONIC.api.geom.Point(this.minx,this.miny,this.epsgId);};IONIC.api.geom.Box.prototype.getBottomRight=function(){return new IONIC.api.geom.Point(this.maxx,this.maxy,this.epsgId);};IONIC.api.geom.Box.prototype.getMin=function(){return new IONIC.api.geom.Point(this.minx,this.miny,this.epsgId);};IONIC.api.geom.Box.prototype.getMax=function(){return new IONIC.api.geom.Point(this.maxx,this.maxy,this.epsgId);};IONIC.api.geom.Box.prototype.shift=function(offx,offy){this.minx+=offx;this.maxx+=offx;this.miny+=offy;this.maxy+=offy;};IONIC.api.geom.Box.prototype.centerAround=function(point,ratio){if(!ratio){ratio=1.0;} if(point.epsgId!==this.epsgId){throw"Invalid EPSG Id "+point.epsgId+"for point "+point+". SRS box is in "+this.epsgId;} var diffxOn2=this.diffX()/2;var diffyOn2=this.diffY()/2;this.minx=point.x-diffxOn2*ratio;this.miny=point.y-diffyOn2*ratio;this.maxx=point.x+diffxOn2*ratio;this.maxy=point.y+diffyOn2*ratio;return this;};IONIC.api.geom.Box.prototype.diffs=function(){return[this.diffX(),this.diffY()];};IONIC.api.geom.Box.prototype.isEmpty=function(){return this.getArea()===0;};IONIC.api.geom.Box.prototype.getArea=function(){var d=this.diffs();return d[0]*d[1];};IONIC.api.geom.Box.prototype.toPolygon=function(){var pts=[this.minx,this.miny,this.minx,this.maxy,this.maxx,this.maxy,this.maxx,this.miny];var plg=new IONIC.api.geom.Polygon(this.epsgId);plg.pushChild(new IONIC.api.geom.LinearRing(pts,this.epsgId));return plg;};IONIC.api.geom.Box.prototype.isPoint=function(){return(this.minx===this.maxx)&&(this.miny===this.maxy);};IONIC.api.geom.Box.prototype.isEnvelopeUpToDate=function(){return true;};IONIC.api.geom.Box.prototype.growWithGeometry=function(geom){if(this.epsgId!==geom.epsgId){throw"The epsgId of the geometry to grow this box with is not compatible";} var oe=geom.getEnvelope();if(oe.minxthis.maxx){this.maxx=oe.maxx;} if(oe.maxy>this.maxy){this.maxy=oe.maxy;}};IONIC.api.geom.Box.prototype.commaRepresentation=function(noEpsgId){var out=[this.minx,this.miny,this.maxx,this.maxy];if(!noEpsgId){out.push(this.epsgId);} return out.join(", ");};IONIC.api.geom.Box.prototype.toString=function(){return this.commaRepresentation();};IONIC.api.geom.Box.prototype.clone=function(){return new IONIC.api.geom.Box(this.minx,this.miny,this.maxx,this.maxy,this.epsgId);};IONIC.api.geom.Box.prototype.equals=function(other){return this.minx===other.minx&&this.miny===other.miny&&this.maxx===other.maxx&&this.maxy===other.maxy&&this.epsgId===other.epsgId;};IONIC.api.geom.Box.prototype.roughlyEquals=function(other,tol,noCheckEpsgId){if(Math.abs(this.minx-other.minx)>tol||Math.abs(this.maxx-other.maxx)>tol||Math.abs(this.miny-other.miny)>tol||Math.abs(this.maxy-other.maxy)>tol){return false;} if(noCheckEpsgId===true){return true;}else{return this.epsgId===other.epsgId;}};IONIC.api.geom.Box.prototype.expand=function(ratio){return this.centerAround(this.getCenter(),ratio);};IONIC.api.geom.Box.prototype.expanded=function(ratio){var newBox=new IONIC.api.geom.Box(this.minx,this.miny,this.maxx,this.maxy,this.epsgId);newBox.expand(ratio);return newBox;};IONIC.api.geom.Box.prototype.contains=function(pt){if(pt.epsgId!==this.epsgId){throw"'contains' can only be applied to boxes using the same epsgId.";} return(this.minx<=pt.x&&this.maxx>=pt.x&&this.miny<=pt.y&&this.maxy>=pt.y);};IONIC.api.geom.Box.prototype.getCorners=function(){var mx=this.minx;var my=this.miny;var MX=this.maxx;var MY=this.maxy;var eid=this.epsgId;var Pc=IONIC.api.geom.Point;return[new Pc(mx,MY,eid),new Pc(MX,MY,eid),new Pc(MX,my,eid),new Pc(mx,my,eid)];};IONIC.api.geom.Box.prototype.intersectsBox=function(b){if(b.epsgId!=this.epsgId){throw"'intersectsBox' can only be applied to boxes using the same epsgId.";} return this.minyb.miny&&this.maxx>b.minx&&this.minx5){return undefined;} return IONIC.api.geom.Box.fromValues([+parts[0],+parts[1],+parts[2],+parts[3],+parts[4]]);};IONIC.api.geom.Box.fromValues=function(values){if(values instanceof IONIC.api.geom.Box){return values.clone();} if(!values||!isArray(values)||values.length<4||values.length>5){throw"Cannot create box from values "+values;} var box=new IONIC.api.geom.Box(values[0],values[1],values[2],values[3],values[4]);return box;}; IONIC.api.geom.Polygon=function(epsgId){this.init(epsgId);} IONIC.misc.extendType(IONIC.api.geom.Polygon,IONIC.geom.CCG);IONIC.api.geom.Polygon.newInstance=function(epsgId){return new IONIC.api.geom.Polygon(epsgId);};IONIC.api.geom.Polygon.prototype.checkValidity=function(){var n=this.countChildren();if(n==0) return"paic.geometry.polygon.invalid.needsonering";for(var i=0;i0){this.points=pts.slice();} this.env=new IONIC.api.geom.Box(NaN,NaN,NaN,NaN,this.epsgId);this.envOk=false;};IONIC.api.geom.MultiPoint.prototype.getEnvelope=function(){this.checkEnvelope();return this.env;};IONIC.api.geom.MultiPoint.prototype.isEnvelopeUpToDate=function(){return this.envOk;};IONIC.api.geom.MultiPoint.prototype.checkEnvelope=function(){var i,n,minx=NaN,maxx=NaN,miny=NaN,maxy=NaN,x,y,p;if(!this.envOk){p=this.points;if(p.length>=2){minx=maxx=p[0];miny=maxy=p[1];for(i=2,n=p.length;imaxx){maxx=x;} if(y>maxy){maxy=y;}}} this.env.minx=minx;this.env.miny=miny;this.env.maxx=maxx;this.env.maxy=maxy;this.env.epsgId=this.epsgId;this.envOk=true;}};IONIC.api.geom.MultiPoint.prototype.countVertices=function(){return Math.floor(this.points.length/2);};IONIC.api.geom.MultiPoint.prototype.checkValidity=function(){return true;};IONIC.api.geom.MultiPoint.prototype.insertPointAt=function(ptr,pt){var tc=this.countVertices();var idx=ptr[0];if(idx>tc){throw"Index "+ptr+" out of range for insertPointAt(); MultiPoint has "+tc;} if(pt.epsgId&&pt.epsgId!=this.epsgId){throw"Point does not use the right epsgId.";} this.points.splice((idx<<1),0,pt.x,pt.y);this.envOk=false;};IONIC.api.geom.MultiPoint.prototype.getPointAt=function(ptr){var tc=this.countVertices();var idx=ptr[0];if(idx>tc){throw"Pointer "+ptr+" out of range for getPointAt(); MultiPoint has "+tc;} var p=this.points;return new IONIC.api.geom.Point(p[idx<<1],p[(idx<<1)+1],this.epsgId);};IONIC.api.geom.MultiPoint.prototype.deletePointAt=function(ptr){var tc=this.countVertices();var idx=ptr[0];if(idx>tc){throw"Index "+ptr+" out of range for deletePointAt(); MultiPoint has "+tc;} this.points.splice((idx<<1),2);this.envOk=false;};IONIC.api.geom.MultiPoint.prototype.setPointAt=function(ptr,pt){var tc=this.countVertices();var idx=ptr[0];if(idx>tc){throw"Index "+ptr+" out of range for movePointAt(); MultiPoint has "+tc;} this.points[idx<<1]=pt.x;this.points[(idx<<1)+1]=pt.y;this.envOk=false;};IONIC.api.geom.MultiPoint.prototype.assertEpsgId=function(epsgId){if(epsgId&&epsgId!==this.epsgId){throw"The epsg ID differ";}};IONIC.api.geom.MultiPoint.prototype.pushPoints=function(){var i,n,p;for(i=0,n=arguments.length;i=this.countVertices()?undefined:[idx]);};IONIC.api.geom.MultiPoint.prototype.findNearestPointerInfo=function(point){var nv=this.countVertices();if(nv<1){return;} var tx=point.x;var ty=point.y;var idx=0;var dx=tx-this.points[0];var dy=ty-this.points[1];var dist2=dx*dx+dy*dy;var is,nd2;for(var i=1,n=nv;i=2?true:"At least two points needed";};IONIC.api.geom.LineString.prototype.forEachPair=function(fun){this.doForEachPair(fun);};IONIC.api.geom.LineString.prototype.doForEachPair=function(fun,parentPtr,wrap){var pc=this.countVertices();if(pc<2){return;} var i,n,ptr,ps=this.points;for(i=0,n=pc-1;i=3?true:"At least three points needed";};IONIC.api.geom.LinearRing.prototype.forEachPair=function(fun){this.doForEachPair(fun);};IONIC.api.geom.LinearRing.prototype.doForEachPair=function(fun,parentPtr){IONIC.api.geom.LineString.prototype.doForEachPair.call(this,fun,parentPtr,true);};IONIC.api.geom.LinearRing.prototype.contains=function(pt){if(pt.epsgId!==this.epsgId){throw"'contains' can only be applied to geometries using the same epsgId.";} var odd=false;var x=pt.x,y=pt.y;this.forEachPair(function(coords){if(((coords[1]<=y&&y